diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libffmpeg/audio_decoder.c | 4 | ||||
-rw-r--r-- | src/libffmpeg/dvaudio_decoder.c | 4 | ||||
-rw-r--r-- | src/libflac/decoder_flac.c | 18 | ||||
-rw-r--r-- | src/liblpcm/xine_decoder.c | 4 | ||||
-rw-r--r-- | src/libmusepack/xine_decoder.c | 4 | ||||
-rw-r--r-- | src/libspeex/xine_decoder.c | 26 | ||||
-rw-r--r-- | src/libvorbis/xine_decoder.c | 25 | ||||
-rw-r--r-- | src/libw32dll/qt_decoder.c | 24 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 4 | ||||
-rw-r--r-- | src/libxineadec/fooaudio.c | 4 | ||||
-rw-r--r-- | src/libxineadec/nsf.c | 4 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 20 | ||||
-rw-r--r-- | src/xine-engine/audio_out.h | 6 |
13 files changed, 45 insertions, 102 deletions
diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index 38a152c0c..11efbbba7 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.22 2005/11/04 22:37:14 tmattern Exp $ + * $Id: audio_decoder.c,v 1.23 2006/03/07 08:03:08 tmattern Exp $ * * xine audio decoder plugin using ffmpeg * @@ -257,7 +257,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if (!this->output_open) { this->output_open = this->stream->audio_out->open(this->stream->audio_out, this->stream, this->audio_bits, this->audio_sample_rate, - (this->audio_channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + _x_ao_channels2mode(this->audio_channels)); } /* if the audio still isn't open, bail */ diff --git a/src/libffmpeg/dvaudio_decoder.c b/src/libffmpeg/dvaudio_decoder.c index 2ad4b6c5c..f88d049d2 100644 --- a/src/libffmpeg/dvaudio_decoder.c +++ b/src/libffmpeg/dvaudio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvaudio_decoder.c,v 1.7 2005/08/25 15:36:30 valtri Exp $ + * $Id: dvaudio_decoder.c,v 1.8 2006/03/07 08:03:08 tmattern Exp $ * * dv audio decoder based on patch by Dan Dennedy <dan@dennedy.org> * @@ -289,7 +289,7 @@ static void dvaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if (!this->output_open) { this->output_open = this->stream->audio_out->open(this->stream->audio_out, this->stream, this->audio_bits, this->audio_sample_rate, - (this->audio_channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + _x_ao_channels2mode(this->audio_channels)); } /* if the audio still isn't open, bail */ diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index 05f440d37..29cbf8dc5 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -248,23 +248,7 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) this->bits_per_sample = buf->decoder_info[2]; this->channels = buf->decoder_info[3]; - switch (this->channels) - { - case 1: - mode = AO_CAP_MODE_MONO; - break; - case 2: - mode = AO_CAP_MODE_STEREO; - break; - case 4: - mode = AO_CAP_MODE_4CHANNEL; - break; - case 5: - mode = AO_CAP_MODE_5CHANNEL; - break; - case 6: - mode = AO_CAP_MODE_5_1CHANNEL; - } + mode = _x_ao_channels2mode(this->channels); if (!this->output_open) { diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c index 5577ff998..92be95ae8 100644 --- a/src/liblpcm/xine_decoder.c +++ b/src/liblpcm/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.56 2004/12/16 13:59:10 mroi Exp $ + * $Id: xine_decoder.c,v 1.57 2006/03/07 08:03:10 tmattern Exp $ * * 31-8-2001 Added LPCM rate sensing. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -130,7 +130,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); - this->ao_cap_mode=(this->number_of_channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO; + this->ao_cap_mode=_x_ao_channels2mode(this->number_of_channels); /* force 24-bit samples into 16 bits for now */ if (this->bits_per_sample == 24) diff --git a/src/libmusepack/xine_decoder.c b/src/libmusepack/xine_decoder.c index 6d862d4c7..6016627fd 100644 --- a/src/libmusepack/xine_decoder.c +++ b/src/libmusepack/xine_decoder.c @@ -23,7 +23,7 @@ * 32bit float output * Seeking?? * - * $Id: xine_decoder.c,v 1.4 2005/01/30 14:41:34 valtri Exp $ + * $Id: xine_decoder.c,v 1.5 2006/03/07 08:03:10 tmattern Exp $ */ #include <stdio.h> @@ -274,7 +274,7 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->stream, this->bits_per_sample, this->sample_rate, - (this->channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + _x_ao_channels2mode(this->channels)); } /* if the audio still isn't open, do not go any further with the decode */ diff --git a/src/libspeex/xine_decoder.c b/src/libspeex/xine_decoder.c index 5d4f57ab6..5a094595f 100644 --- a/src/libspeex/xine_decoder.c +++ b/src/libspeex/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.16 2004/12/16 13:59:11 mroi Exp $ + * $Id: xine_decoder.c,v 1.17 2006/03/07 08:03:10 tmattern Exp $ * * (ogg/)speex audio decoder plugin (libspeex wrapper) for xine */ @@ -276,29 +276,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->header_count--; if (!this->header_count) { - int mode = AO_CAP_MODE_MONO; - - switch (this->channels) { - case 1: - mode = AO_CAP_MODE_MONO; - break; - case 2: - mode = AO_CAP_MODE_STEREO; - break; - case 4: - mode = AO_CAP_MODE_4CHANNEL; - break; - case 5: - mode = AO_CAP_MODE_5CHANNEL; - break; - case 6: - mode = AO_CAP_MODE_5_1CHANNEL; - break; - default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "libspeex: help, %d channels ?!\n", this->channels); - /* FIXME: handle error */ - } + int mode = _x_ao_channels2mode(this->channels); if (!this->output_open) { this->output_open = diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c index 4918af31a..3ba92eb45 100644 --- a/src/libvorbis/xine_decoder.c +++ b/src/libvorbis/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.43 2005/01/27 11:17:28 holstsn Exp $ + * $Id: xine_decoder.c,v 1.44 2006/03/07 08:03:10 tmattern Exp $ * * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine */ @@ -166,28 +166,7 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { get_metadata (this); - - switch (this->vi.channels) { - case 1: - mode = AO_CAP_MODE_MONO; - break; - case 2: - mode = AO_CAP_MODE_STEREO; - break; - case 4: - mode = AO_CAP_MODE_4CHANNEL; - break; - case 5: - mode = AO_CAP_MODE_5CHANNEL; - break; - case 6: - mode = AO_CAP_MODE_5_1CHANNEL; - break; - default: - printf ("libvorbis: help, %d channels ?!\n", - this->vi.channels); - /* FIXME: handle error */ - } + mode = _x_ao_channels2mode(this->vi.channels); this->convsize=MAX_NUM_SAMPLES/this->vi.channels; diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 36a03793b..cadaa0ace 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: qt_decoder.c,v 1.39 2004/12/17 13:39:54 mroi Exp $ + * $Id: qt_decoder.c,v 1.40 2006/03/07 08:03:10 tmattern Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -399,27 +399,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { lprintf ("audio: opening output.\n"); - switch (this->wave.nChannels) { - case 1: - mode = AO_CAP_MODE_MONO; - break; - case 2: - mode = AO_CAP_MODE_STEREO; - break; - case 4: - mode = AO_CAP_MODE_4CHANNEL; - break; - case 5: - mode = AO_CAP_MODE_5CHANNEL; - break; - case 6: - mode = AO_CAP_MODE_5_1CHANNEL; - break; - default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "qt_audio: help, %d channels ?!\n", this->wave.nChannels); - _x_abort (); - } + mode = _x_ao_channels2mode(this->wave.nChannels); this->frame_size = this->wave.nChannels * this->wave.wBitsPerSample / 8; diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 1823c9c79..f38ad7ab1 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: w32codec.c,v 1.149 2005/11/21 10:29:57 valtri Exp $ + * $Id: w32codec.c,v 1.150 2006/03/07 08:03:16 tmattern Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -1181,7 +1181,7 @@ static int w32a_init_audio (w32a_decoder_t *this, this->output_open = this->stream->audio_out->open( this->stream->audio_out, this->stream, 16, in_fmt->nSamplesPerSec, - (in_fmt->nChannels >= 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + _x_ao_channels2mode(in_fmt->nChannels)); if (!this->output_open) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: (ACM_Decoder) Cannot open audio output device\n"); diff --git a/src/libxineadec/fooaudio.c b/src/libxineadec/fooaudio.c index 8460c1265..14a8eb0c9 100644 --- a/src/libxineadec/fooaudio.c +++ b/src/libxineadec/fooaudio.c @@ -21,7 +21,7 @@ * player. It really works too! It will output a continuous sine wave in * place of the data it should actually send. * - * $Id: fooaudio.c,v 1.14 2004/12/16 13:59:12 mroi Exp $ + * $Id: fooaudio.c,v 1.15 2006/03/07 08:03:21 tmattern Exp $ */ #include <stdio.h> @@ -116,7 +116,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* this->bits_per_sample, */ 16, this->sample_rate, -/* (this->channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO);*/ +/* _x_ao_channels2mode(this->channels));*/ AO_CAP_MODE_MONO); } diff --git a/src/libxineadec/nsf.c b/src/libxineadec/nsf.c index 53185c1d5..28ed3677f 100644 --- a/src/libxineadec/nsf.c +++ b/src/libxineadec/nsf.c @@ -20,7 +20,7 @@ * NSF Audio "Decoder" using the Nosefart NSF engine by Matt Conte * http://www.baisoku.org/ * - * $Id: nsf.c,v 1.8 2004/12/16 13:59:12 mroi Exp $ + * $Id: nsf.c,v 1.9 2006/03/07 08:03:22 tmattern Exp $ */ #include <stdio.h> @@ -131,7 +131,7 @@ static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->stream, this->bits_per_sample, this->sample_rate, - (this->channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + _x_ao_channels2mode(this->channels)); } /* if the audio still isn't open, do not go any further with the decode */ diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index d04d045f8..e42f1cb90 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.197 2006/02/05 19:18:28 miguelfreitas Exp $ + * $Id: audio_out.c,v 1.198 2006/03/07 08:03:22 tmattern Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -521,6 +521,24 @@ int _x_ao_mode2channels( int mode ) { return 0; } +int _x_ao_channels2mode( int channels ) { + + switch( channels ) { + case 1: + return AO_CAP_MODE_MONO; + case 2: + return AO_CAP_MODE_STEREO; + case 3: + case 4: + return AO_CAP_MODE_4CHANNEL; + case 5: + return AO_CAP_MODE_5CHANNEL; + case 6: + return AO_CAP_MODE_5_1CHANNEL; + } + return AO_CAP_NOCAP; +} + static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { int i, maxs; diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 853c338ca..7754ff3a7 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.h,v 1.75 2005/09/11 22:07:48 miguelfreitas Exp $ + * $Id: audio_out.h,v 1.76 2006/03/07 08:03:29 tmattern Exp $ */ #ifndef HAVE_AUDIO_OUT_H #define HAVE_AUDIO_OUT_H @@ -293,6 +293,10 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_o * converts the audio output mode into the number of channels */ int _x_ao_mode2channels( int mode ); +/* + * converts the number of channels into the audio output mode + */ +int _x_ao_channels2mode( int channels ); #define AO_CAP_MIXER_VOL 0x00000100 /* driver supports mixer control */ #define AO_CAP_PCM_VOL 0x00000200 /* driver supports pcm control */ |