no setenv on Windows

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-12-25 16:15:33 -08:00
parent c17493f2d3
commit 44080154b0

View File

@ -23,6 +23,10 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef _WIN32
#include <processenv.h>
#endif
#define MPD_PULSE_NAME "Music Player Daemon" #define MPD_PULSE_NAME "Music Player Daemon"
class PulseOutput final : AudioOutput { class PulseOutput final : AudioOutput {
@ -175,8 +179,13 @@ PulseOutput::PulseOutput(const ConfigBlock &block)
sink(block.GetBlockValue("sink")), sink(block.GetBlockValue("sink")),
media_role(block.GetBlockValue("media_role")) media_role(block.GetBlockValue("media_role"))
{ {
#ifdef _WIN32
SetEnvironmentVariableA("PULSE_PROP_media.role", "music");
SetEnvironmentVariableA("PULSE_PROP_application.icon_name", "mpd");
#else
setenv("PULSE_PROP_media.role", "music", true); setenv("PULSE_PROP_media.role", "music", true);
setenv("PULSE_PROP_application.icon_name", "mpd", true); setenv("PULSE_PROP_application.icon_name", "mpd", true);
#endif
} }
struct pa_threaded_mainloop * struct pa_threaded_mainloop *