-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide audio format to pipe output command #4
Provide audio format to pipe output command #4
Conversation
So far, the pipe output of MPD had the problem that the commands in the pipe had no information about the format of the raw audio data sent into the pipe. With this patch mpd sets the environment variables MPDPIPE_BITS, MPDPIPE_CHANNELS, MPDPIPE_RATE to the number of bits per sample, the number of channels, and the sample rate of the raw PCM sent to the pipe, respectively. These variables can then be used in the command or within a script which is started for the pipe.
This is a nicer version to achieve the same as the rejected pull request #3. Thanks for the hint to set environment variables; I was not aware of the rules for the environment of a process started with The code works fine for me (and is indeed much nicer than in #3), an adjustment of the documentation is included. |
This implementation is not acceptable, because it leaks the environment variables to the MPD process as well. The problem is, of course, that |
I cannot see any problem with setting these environment variables for the MPD process itself. |
Your code will not compile on Windows, because Windows has no fork(). |
I wasn't aware that MPD can be used on Windows. I don't have any Windows system and do not know how to find out what is available there. (Have only used cygwin which does have fork().) You didn't mention Windows after commit d1f170e. Does that work on Windows? |
I wrote "This is where you should use |
Use earlier version on Windows because fork() is not available. Add explicit call of wait to Close method to avoid zombies.
Ok, thanks for the hint. |
@@ -84,12 +97,30 @@ PipeOutput::Create(const ConfigBlock &block, Error &error) | |||
return po; | |||
} | |||
|
|||
#define set_MPDPIPE_vars(audio_format) {\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't write preprocessor macros when you can write C++.
It's been 3 months without a reply. Closing for now. |
So far, the pipe output of MPD had the problem that the commands
in the pipe had no information about the format of the raw audio data
sent into the pipe.
With this patch mpd sets the environment variables
MPDPIPE_BITS,
MPDPIPE_CHANNELS,
MPDPIPE_RATE
to the number of bits per sample,
the number of channels, and the sample rate of the raw PCM sent to the
pipe, respectively. These variables can then be used in the command or
within a script which is started for the pipe.