aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutput.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-08 01:53:13 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-08 01:53:13 +0000
commitb5e55a648f12cea229f49c00730ef11a8583b66b (patch)
tree2ca0130ddee4b343c3aea396f0539136010ff185 /src/audioOutput.c
parentfa08a7e3ff0d0f60415c29c080cc4130cf4032c9 (diff)
downloadmpd-b5e55a648f12cea229f49c00730ef11a8583b66b.tar.gz
mpd-b5e55a648f12cea229f49c00730ef11a8583b66b.tar.xz
mpd-b5e55a648f12cea229f49c00730ef11a8583b66b.zip
we ne allow audioOutput plugins to set the final outAudioFormat that will be used. we now use alsa's _near functions to detect what to use.
git-svn-id: https://svn.musicpd.org/mpd/trunk@3038 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audioOutput.c')
-rw-r--r--src/audioOutput.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/audioOutput.c b/src/audioOutput.c
index c973e1beb..1186dbe0d 100644
--- a/src/audioOutput.c
+++ b/src/audioOutput.c
@@ -73,13 +73,14 @@ AudioOutput * newAudioOutput(ConfigParam * param) {
memset(&ret->inAudioFormat, 0, sizeof(AudioFormat));
memset(&ret->outAudioFormat, 0, sizeof(AudioFormat));
+ memset(&ret->reqAudioFormat, 0, sizeof(AudioFormat));
getBlockParam(AUDIO_OUTPUT_FORMAT, format, 0);
if(format) {
ret->convertAudioFormat = 1;
- if(0 != parseAudioConfig(&ret->outAudioFormat, format))
+ if(0 != parseAudioConfig(&ret->reqAudioFormat, format))
{
ERROR("error parsing format at line %i\n",
bp->line);
@@ -102,6 +103,8 @@ AudioOutput * newAudioOutput(ConfigParam * param) {
}
int openAudioOutput(AudioOutput * audioOutput, AudioFormat * audioFormat) {
+ int ret;
+
if(audioOutput->open) {
if(cmpAudioFormat(audioFormat, &audioOutput->inAudioFormat)
== 0)
@@ -114,20 +117,24 @@ int openAudioOutput(AudioOutput * audioOutput, AudioFormat * audioFormat) {
copyAudioFormat(&audioOutput->inAudioFormat, audioFormat);
if(audioOutput->convertAudioFormat) {
- if(cmpAudioFormat(&audioOutput->inAudioFormat,
- &audioOutput->outAudioFormat) == 0)
- {
- audioOutput->sameInAndOutFormats = 1;
- }
- else audioOutput->sameInAndOutFormats = 0;
+ copyAudioFormat(&audioOutput->outAudioFormat,
+ &audioOutput->reqAudioFormat);
}
else {
- audioOutput->sameInAndOutFormats = 1;
copyAudioFormat(&audioOutput->outAudioFormat,
&audioOutput->inAudioFormat);
}
- return audioOutput->openDeviceFunc(audioOutput);
+ ret = audioOutput->openDeviceFunc(audioOutput);
+
+ if(cmpAudioFormat(&audioOutput->inAudioFormat,
+ &audioOutput->outAudioFormat) == 0)
+ {
+ audioOutput->sameInAndOutFormats = 1;
+ }
+ else audioOutput->sameInAndOutFormats = 0;
+
+ return ret;
}
static void convertAudioFormat(AudioOutput * audioOutput, char ** chunkArgPtr,