From c4ba81f5006174c35a52b1090b2c654cf8bdb55c Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Mon, 30 Sep 2013 10:11:46 +0300 Subject: audio_out: move speaker arrangement enum values and help strings to common header. --- src/audio_out/Makefile.am | 2 ++ src/audio_out/audio_alsa_out.c | 54 +++++--------------------------- src/audio_out/audio_jack_out.c | 52 +++---------------------------- src/audio_out/audio_oss_out.c | 54 +++++--------------------------- src/audio_out/speakers.h | 70 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 142 deletions(-) create mode 100644 src/audio_out/speakers.h (limited to 'src') diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 7932d7af6..1f9c31276 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -5,6 +5,8 @@ include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) AM_LDFLAGS = $(xineplug_ldflags) +noinst_HEADERS = speakers.h + ## # IMPORTANT: # --------- diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index c16250282..2f6e742c3 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -55,6 +55,8 @@ #include #include +#include "speakers.h" + /* #define ALSA_LOG #define ALSA_LOG_BUFFERS @@ -1359,23 +1361,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da int err; char *pcm_device; snd_pcm_hw_params_t *params; - /* for usability reasons, keep this in sync with audio_oss_out.c */ - static const char * const speaker_arrangement[] = {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", - "Surround 3.0", "Surround 4.0", "Surround 4.1", "Surround 5.0", "Surround 5.1", "Surround 6.0", - "Surround 6.1", "Surround 7.1", "Pass Through", NULL}; - #define MONO 0 - #define STEREO 1 - #define HEADPHONES 2 - #define SURROUND21 3 - #define SURROUND3 4 - #define SURROUND4 5 - #define SURROUND41 6 - #define SURROUND5 7 - #define SURROUND51 8 - #define SURROUND6 9 - #define SURROUND61 10 - #define SURROUND71 11 - #define A52_PASSTHRU 12 + + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_TYPES; int speakers; this = calloc(1, sizeof (alsa_driver_t)); @@ -1494,36 +1481,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da /* for usability reasons, keep this in sync with audio_oss_out.c */ speakers = config->register_enum(config, "audio.output.speaker_arrangement", STEREO, - speaker_arrangement, - _("speaker arrangement"), - _("Select how your speakers are arranged, " - "this determines which speakers xine uses for sound output. " - "The individual values are:\n\n" - "Mono 1.0: You have only one speaker.\n" - "Stereo 2.0: You have two speakers for left and right channel.\n" - "Headphones 2.0: You use headphones.\n" - "Stereo 2.1: You have two speakers for left and right channel, and one " - "subwoofer for the low frequencies.\n" - "Surround 3.0: You have three speakers for left, right and rear channel.\n" - "Surround 4.0: You have four speakers for front left and right and rear " - "left and right channels.\n" - "Surround 4.1: You have four speakers for front left and right and rear " - "left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 5.0: You have five speakers for front left, center and right and " - "rear left and right channels.\n" - "Surround 5.1: You have five speakers for front left, center and right and " - "rear left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 6.0: You have six speakers for front left, center and right and " - "rear left, center and right channels.\n" - "Surround 6.1: You have six speakers for front left, center and right and " - "rear left, center and right channels, and one subwoofer for the low frequencies.\n" - "Surround 7.1: You have seven speakers for front left, center and right, " - "left and right and rear left and right channels, and one subwoofer for the " - "low frequencies.\n" - "Pass Through: Your sound system will receive undecoded digital sound from xine. " - "You need to connect a digital surround decoder capable of decoding the " - "formats you want to play to your sound card's digital output."), - 0, alsa_speaker_arrangement_cb, this); + speaker_arrangement, + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_HELP, + 0, alsa_speaker_arrangement_cb, this); char *logmsg = strdup (_("audio_alsa_out : supported modes are")); diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c index 16f68faee..9b2d8efe9 100644 --- a/src/audio_out/audio_jack_out.c +++ b/src/audio_out/audio_jack_out.c @@ -17,6 +17,8 @@ #include +#include "speakers.h" + #define AO_OUT_JACK_IFACE_VERSION 9 #define GAP_TOLERANCE AO_MAX_GAP @@ -687,26 +689,7 @@ static ao_driver_t *open_jack_plugin (audio_driver_class_t *class_gen, char *jack_device; const char **matching_ports = NULL; - /* for usability reasons, keep this in sync with audio_oss_out.c */ - static const char * const speaker_arrangement[] = { - "Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", - "Surround 3.0", "Surround 4.0", "Surround 4.1", "Surround 5.0", - "Surround 5.1", "Surround 6.0", - "Surround 6.1", "Surround 7.1", "Pass Through", NULL - }; -#define MONO 0 -#define STEREO 1 -#define HEADPHONES 2 -#define SURROUND21 3 -#define SURROUND3 4 -#define SURROUND4 5 -#define SURROUND41 6 -#define SURROUND5 7 -#define SURROUND51 8 -#define SURROUND6 9 -#define SURROUND61 10 -#define SURROUND71 11 -#define A52_PASSTHRU 12 + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_TYPES; int speakers; /* Try to create a client called "xine[-NN]" */ @@ -738,34 +721,7 @@ static ao_driver_t *open_jack_plugin (audio_driver_class_t *class_gen, speakers = config->register_enum (config, "audio.output.speaker_arrangement", STEREO, speaker_arrangement, - _("speaker arrangement"), - _("Select how your speakers are arranged, " - "this determines which speakers xine uses for sound output. " - "The individual values are:\n\n" - "Mono 1.0: You have only one speaker.\n" - "Stereo 2.0: You have two speakers for left and right channel.\n" - "Headphones 2.0: You use headphones.\n" - "Stereo 2.1: You have two speakers for left and right channel, and one " - "subwoofer for the low frequencies.\n" - "Surround 3.0: You have three speakers for left, right and rear channel.\n" - "Surround 4.0: You have four speakers for front left and right and rear " - "left and right channels.\n" - "Surround 4.1: You have four speakers for front left and right and rear " - "left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 5.0: You have five speakers for front left, center and right and " - "rear left and right channels.\n" - "Surround 5.1: You have five speakers for front left, center and right and " - "rear left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 6.0: You have six speakers for front left, center and right and " - "rear left, center and right channels.\n" - "Surround 6.1: You have six speakers for front left, center and right and " - "rear left, center and right channels, and one subwoofer for the low frequencies.\n" - "Surround 7.1: You have seven speakers for front left, center and right, " - "left and right and rear left and right channels, and one subwoofer for the " - "low frequencies.\n" - "Pass Through: Your sound system will receive undecoded digital sound from xine. " - "You need to connect a digital surround decoder capable of decoding the " - "formats you want to play to your sound card's digital output."), + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_HELP, 0, jack_speaker_arrangement_cb, this); int port_flags = JackPortIsInput; diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 6d83191b6..b09137e49 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -71,6 +71,8 @@ #include +#include "speakers.h" + #ifndef SNDCTL_DSP_SETFMT /* Deprecated OSS API */ #define SNDCTL_DSP_SETFMT SOUND_PCM_SETFMT @@ -707,23 +709,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da static const char * const sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", "probebuffer", NULL}; static const char * const devname_opts[] = {"auto", "/dev/dsp", "/dev/sound/dsp", NULL}; int devname_val, devname_num; - /* for usability reasons, keep this in sync with audio_alsa_out.c */ - static const char * const speaker_arrangement[] = {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", - "Surround 3.0", "Surround 4.0", "Surround 4.1", "Surround 5.0", "Surround 5.1", "Surround 6.0", - "Surround 6.1", "Surround 7.1", "Pass Through", NULL}; - #define MONO 0 - #define STEREO 1 - #define HEADPHONES 2 - #define SURROUND21 3 - #define SURROUND3 4 - #define SURROUND4 5 - #define SURROUND41 6 - #define SURROUND5 7 - #define SURROUND51 8 - #define SURROUND6 9 - #define SURROUND61 10 - #define SURROUND71 11 - #define A52_PASSTHRU 12 + + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_TYPES; int speakers; @@ -921,36 +908,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da /* for usability reasons, keep this in sync with audio_alsa_out.c */ speakers = config->register_enum(config, "audio.output.speaker_arrangement", STEREO, - speaker_arrangement, - _("speaker arrangement"), - _("Select how your speakers are arranged, " - "this determines which speakers xine uses for sound output. " - "The individual values are:\n\n" - "Mono 1.0: You have only one speaker.\n" - "Stereo 2.0: You have two speakers for left and right channel.\n" - "Headphones 2.0: You use headphones.\n" - "Stereo 2.1: You have two speakers for left and right channel, and one " - "subwoofer for the low frequencies.\n" - "Surround 3.0: You have three speakers for left, right and rear channel.\n" - "Surround 4.0: You have four speakers for front left and right and rear " - "left and right channels.\n" - "Surround 4.1: You have four speakers for front left and right and rear " - "left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 5.0: You have five speakers for front left, center and right and " - "rear left and right channels.\n" - "Surround 5.1: You have five speakers for front left, center and right and " - "rear left and right channels, and one subwoofer for the low frequencies.\n" - "Surround 6.0: You have six speakers for front left, center and right and " - "rear left, center and right channels.\n" - "Surround 6.1: You have six speakers for front left, center and right and " - "rear left, center and right channels, and one subwoofer for the low frequencies.\n" - "Surround 7.1: You have seven speakers for front left, center and right, " - "left and right and rear left and right channels, and one subwoofer for the " - "low frequencies.\n" - "Pass Through: Your sound system will receive undecoded digital sound from xine. " - "You need to connect a digital surround decoder capable of decoding the " - "formats you want to play to your sound card's digital output."), - 0, oss_speaker_arrangement_cb, this); + speaker_arrangement, + AUDIO_DEVICE_SPEAKER_ARRANGEMENT_HELP, + 0, oss_speaker_arrangement_cb, this); char *logmsg = strdup (_("audio_oss_out: supported modes are")); diff --git a/src/audio_out/speakers.h b/src/audio_out/speakers.h new file mode 100644 index 000000000..ea8c5188a --- /dev/null +++ b/src/audio_out/speakers.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2013 the xine project + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + */ + +#define MONO 0 +#define STEREO 1 +#define HEADPHONES 2 +#define SURROUND21 3 +#define SURROUND3 4 +#define SURROUND4 5 +#define SURROUND41 6 +#define SURROUND5 7 +#define SURROUND51 8 +#define SURROUND6 9 +#define SURROUND61 10 +#define SURROUND71 11 +#define A52_PASSTHRU 12 + +#define AUDIO_DEVICE_SPEAKER_ARRANGEMENT_HELP \ + _("speaker arrangement"), \ + _("Select how your speakers are arranged, " \ + "this determines which speakers xine uses for sound output. " \ + "The individual values are:\n\n" \ + "Mono 1.0: You have only one speaker.\n" \ + "Stereo 2.0: You have two speakers for left and right channel.\n" \ + "Headphones 2.0: You use headphones.\n" \ + "Stereo 2.1: You have two speakers for left and right channel, and one " \ + "subwoofer for the low frequencies.\n" \ + "Surround 3.0: You have three speakers for left, right and rear channel.\n" \ + "Surround 4.0: You have four speakers for front left and right and rear " \ + "left and right channels.\n" \ + "Surround 4.1: You have four speakers for front left and right and rear " \ + "left and right channels, and one subwoofer for the low frequencies.\n" \ + "Surround 5.0: You have five speakers for front left, center and right and " \ + "rear left and right channels.\n" \ + "Surround 5.1: You have five speakers for front left, center and right and " \ + "rear left and right channels, and one subwoofer for the low frequencies.\n" \ + "Surround 6.0: You have six speakers for front left, center and right and " \ + "rear left, center and right channels.\n" \ + "Surround 6.1: You have six speakers for front left, center and right and " \ + "rear left, center and right channels, and one subwoofer for the low frequencies.\n" \ + "Surround 7.1: You have seven speakers for front left, center and right, " \ + "left and right and rear left and right channels, and one subwoofer for the " \ + "low frequencies.\n" \ + "Pass Through: Your sound system will receive undecoded digital sound from xine. " \ + "You need to connect a digital surround decoder capable of decoding the " \ + "formats you want to play to your sound card's digital output.") + +#define AUDIO_DEVICE_SPEAKER_ARRANGEMENT_TYPES \ + static const char * const speaker_arrangement[] = { \ + "Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", \ + "Surround 3.0", "Surround 4.0", "Surround 4.1", "Surround 5.0", \ + "Surround 5.1", "Surround 6.0", "Surround 6.1", "Surround 7.1", \ + "Pass Through", NULL}; -- cgit v1.2.3