diff options
-rw-r--r-- | src/audio_out/Makefile.am | 22 | ||||
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 59 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 6 |
3 files changed, 61 insertions, 26 deletions
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 692ce728b..7b6394aff 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -1,7 +1,6 @@ AM_CFLAGS = -DXINE_COMPILE $(ALSA_CFLAGS) $(ESD_CFLAGS) $(IRIXAL_CFLAGS) $(ARTS_CFLAGS) -EXTRA_DIST = audio_alsa_out.c \ - audio_arts_out.c \ +EXTRA_DIST = audio_arts_out.c \ audio_esd_out.c \ audio_irixal_out.c \ audio_sun_out.c @@ -14,11 +13,11 @@ if HAVE_OSS oss_module = xineplug_ao_out_oss.la endif -#if HAVE_ALSA -#if HAVE_ALSA09 -#alsa_module = xineplug_ao_out_alsa.la -#endif -#endif +if HAVE_ALSA +if HAVE_ALSA09 +alsa_module = xineplug_ao_out_alsa.la +endif +endif #if HAVE_ESD #esd_module = xineplug_ao_out_esd.la @@ -42,7 +41,8 @@ endif # all xine audio out plugins should be named like the # scheme "xineplug_ao_out_" # -lib_LTLIBRARIES = $(oss_module) +lib_LTLIBRARIES = $(oss_module) \ + $(alsa_module) #lib_LTLIBRARIES = \ # $(alsa_module) \ @@ -55,9 +55,9 @@ lib_LTLIBRARIES = $(oss_module) xineplug_ao_out_oss_la_SOURCES = audio_oss_out.c xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module -#xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c -#xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) -#xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module +xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c +xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) +xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module #xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c #xineplug_ao_out_esd_la_LIBADD = $(ESD_LIBS) diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 3a93f4a39..c7944b629 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.81 2002/10/12 10:36:50 jcdutton Exp $ + * $Id: audio_alsa_out.c,v 1.82 2002/10/18 13:13:30 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -65,7 +65,7 @@ #define LOG_DEBUG */ -#define AO_OUT_ALSA_IFACE_VERSION 4 +#define AO_OUT_ALSA_IFACE_VERSION 5 #define BUFFER_TIME 1000*1000 #define PERIOD_TIME 100*1000 @@ -75,6 +75,12 @@ #define MIXER_MASK_RIGHT (1 << 1) #define MIXER_MASK_STEREO (MIXER_MASK_LEFT|MIXER_MASK_RIGHT) +typedef struct { + audio_driver_class_t driver_class; + + config_values_t *config; +} alsa_class_t; + typedef struct alsa_driver_s { xine_ao_driver_t ao_driver; @@ -987,9 +993,10 @@ static void ao_alsa_mixer_init(xine_ao_driver_t *this_gen) { /* * Initialize plugin */ -static void *init_audio_out_plugin (xine_t *xine, void *data) { +static xine_ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { - config_values_t *config = xine->config; + alsa_class_t *class = (alsa_class_t *) class_gen; + config_values_t *config = class->config; alsa_driver_t *this; int err; char *pcm_device; @@ -1184,23 +1191,51 @@ static void *init_audio_out_plugin (xine_t *xine, void *data) { return &this->ao_driver; } -static ao_info_t ao_info_alsa = { - "xine audio output plugin using alsa-compliant audio devices/drivers", - 10 -}; +/* + * class functions + */ + +static char* get_identifier (audio_driver_class_t *this_gen) { + return "alsa"; +} + +static char* get_description (audio_driver_class_t *this_gen) { + return _("xine audio output plugin using alsa-compliant audio devices/drivers"); +} -ao_info_t *get_audio_out_plugin_info() { +static void dispose_class (audio_driver_class_t *this_gen) { - ao_info_alsa.description = _("xine audio output plugin using alsa-compliant audio devices/drivers"); - return &ao_info_alsa; + alsa_class_t *this = (alsa_class_t *) this_gen; + + free (this); } +static void *init_class (xine_t *xine, void *data) { + + alsa_class_t *this; + + this = (alsa_class_t *) malloc (sizeof (alsa_class_t)); + + this->driver_class.open_plugin = open_plugin; + this->driver_class.get_identifier = get_identifier; + this->driver_class.get_description = get_description; + this->driver_class.dispose = dispose_class; + + this->config = xine->config; + + return this; + } + +static ao_info_t ao_info_alsa = { + 10 +}; + /* * exported plugin catalog entry */ plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_AUDIO_OUT, AO_OUT_ALSA_IFACE_VERSION, "alsa", XINE_VERSION_CODE, &ao_info_alsa, init_audio_out_plugin }, + { PLUGIN_AUDIO_OUT, AO_OUT_ALSA_IFACE_VERSION, "alsa", XINE_VERSION_CODE, &ao_info_alsa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index e0c371629..d9f65579d 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.70 2002/10/14 15:47:25 guenter Exp $ + * $Id: audio_out.c,v 1.71 2002/10/18 13:13:30 jcdutton Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -67,9 +67,9 @@ #include "resample.h" #include "metronom.h" -/* + #define LOG -*/ + #define NUM_AUDIO_BUFFERS 32 #define AUDIO_BUF_SIZE 32768 |