summaryrefslogtreecommitdiff
path: root/src/audio_out
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_out')
-rw-r--r--src/audio_out/Makefile.am136
-rw-r--r--src/audio_out/audio_alsa_out.c64
-rw-r--r--src/audio_out/audio_arts_out.c418
-rw-r--r--src/audio_out/audio_coreaudio_out.c32
-rw-r--r--src/audio_out/audio_directx2_out.c37
-rw-r--r--[-rwxr-xr-x]src/audio_out/audio_directx_out.c30
-rw-r--r--src/audio_out/audio_esd_out.c36
-rw-r--r--src/audio_out/audio_file_out.c36
-rw-r--r--src/audio_out/audio_fusionsound_out.c73
-rw-r--r--src/audio_out/audio_irixal_out.c12
-rw-r--r--src/audio_out/audio_jack_out.c29
-rw-r--r--src/audio_out/audio_none_out.c34
-rw-r--r--src/audio_out/audio_oss_out.c57
-rw-r--r--src/audio_out/audio_pulse_out.c158
-rw-r--r--src/audio_out/audio_sun_out.c38
15 files changed, 247 insertions, 943 deletions
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am
index d52f700f3..2003383e6 100644
--- a/src/audio_out/Makefile.am
+++ b/src/audio_out/Makefile.am
@@ -1,156 +1,116 @@
include $(top_srcdir)/misc/Makefile.common
-AM_CPPFLAGS = -DXINE_COMPILE
+AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG)
+AM_LDFLAGS = $(xineplug_ldflags)
-EXTRA_DIST = audio_irixal_out.c
+##
+# IMPORTANT:
+# ---------
+# all xine audio out plugins should be named like the
+# scheme "xineplug_ao_out_"
+#
-libdir = $(XINE_PLUGINDIR)
+EXTRA_DIST = audio_irixal_out.c
-if HAVE_OSS
+if ENABLE_OSS
oss_module = xineplug_ao_out_oss.la
endif
-if HAVE_ALSA
+if ENABLE_ALSA
alsa_module = xineplug_ao_out_alsa.la
endif
-if HAVE_ESD
+if ENABLE_ESD
esd_module = xineplug_ao_out_esd.la
endif
-if HAVE_SUNAUDIO
+if ENABLE_SUNAUDIO
sun_module = xineplug_ao_out_sun.la
endif
-#if HAVE_IRIXAL
+#if ENABLE_IRIXAL
#irixal_module = xineplug_ao_out_irixal.la
#endif
-if HAVE_ARTS
-arts_module = xineplug_ao_out_arts.la
-endif
-
-if HAVE_DIRECTX
+if ENABLE_DIRECTX
directx_module = xineplug_ao_out_directx.la
directx2_module = xineplug_ao_out_directx2.la
endif
-if HAVE_COREAUDIO
+if ENABLE_COREAUDIO
coreaudio_module = xineplug_ao_out_coreaudio.la
endif
-if HAVE_PULSEAUDIO
+if ENABLE_PULSEAUDIO
pulseaudio_module = xineplug_ao_out_pulseaudio.la
endif
-if HAVE_FUSIONSOUND
+if ENABLE_FUSIONSOUND
fusionsound_module = xineplug_ao_out_fusionsound.la
endif
-if HAVE_JACK
+if ENABLE_JACK
jack_module = xineplug_ao_out_jack.la
endif
-##
-# IMPORTANT:
-# ---------
-# all xine audio out plugins should be named like the
-# scheme "xineplug_ao_out_"
-#
-lib_LTLIBRARIES = xineplug_ao_out_none.la xineplug_ao_out_file.la \
- $(oss_module) \
- $(alsa_module) \
- $(sun_module) \
- $(arts_module) \
- $(esd_module) \
- $(directx_module) \
- $(coreaudio_module) \
- $(pulseaudio_module) \
+xineplug_LTLIBRARIES = \
+ xineplug_ao_out_none.la \
+ xineplug_ao_out_file.la \
+ $(oss_module) \
+ $(alsa_module) \
+ $(sun_module) \
+ $(esd_module) \
+ $(directx_module) \
+ $(coreaudio_module) \
+ $(pulseaudio_module) \
$(directx2_module) \
- $(fusionsound_module) \
+ $(fusionsound_module) \
$(jack_module)
-#lib_LTLIBRARIES = \
-# $(alsa_module) \
-# $(arts_module) \
-# $(esd_module) \
-# $(irixal_module) \
-# $(oss_module) \
-# $(sun_module)
-
xineplug_ao_out_none_la_SOURCES = audio_none_out.c
-xineplug_ao_out_none_la_LIBADD = $(XINE_LIB)
-xineplug_ao_out_none_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_none_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_none_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_ao_out_file_la_SOURCES = audio_file_out.c
-xineplug_ao_out_file_la_LIBADD = $(XINE_LIB)
-xineplug_ao_out_file_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_file_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_file_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_ao_out_oss_la_SOURCES = audio_oss_out.c
-xineplug_ao_out_oss_la_LIBADD = $(XINE_LIB)
-xineplug_ao_out_oss_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_oss_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c
-xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS)
-xineplug_ao_out_alsa_la_CFLAGS = $(VISIBILITY_FLAG) $(ALSA_CFLAGS)
-xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_alsa_la_LIBADD = $(XINE_LIB) $(ALSA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL)
+xineplug_ao_out_alsa_la_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS)
xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c
-xineplug_ao_out_esd_la_LIBADD = $(ESD_LIBS) $(XINE_LIB)
-xineplug_ao_out_esd_la_CFLAGS = $(VISIBILITY_FLAG) $(ESD_CFLAGS)
-xineplug_ao_out_esd_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_esd_la_LIBADD = $(XINE_LIB) $(ESD_LIBS) $(LTLIBINTL)
+xineplug_ao_out_esd_la_CFLAGS = $(AM_CFLAGS) $(ESD_CFLAGS)
xineplug_ao_out_sun_la_SOURCES = audio_sun_out.c
xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB)
-xineplug_ao_out_sun_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module
#xineplug_ao_out_irixal_la_SOURCES = audio_irixal_out.c
#xineplug_ao_out_irixal_la_LIBADD = $(IRIXAL_LIBS)
-#xineplug_ao_out_irixal_la_CFLAGS = $(VISIBILITY_FLAG) $(IRIXAL_CFLAGS)
-#xineplug_ao_out_irixal_la_LDFLAGS = -avoid-version -module
-
-xineplug_ao_out_arts_la_SOURCES = audio_arts_out.c
-xineplug_ao_out_arts_la_LIBADD = $(ARTS_LIBS) $(XINE_LIB)
-xineplug_ao_out_arts_la_CFLAGS = $(VISIBILITY_FLAG) $(ARTS_CFLAGS)
-xineplug_ao_out_arts_la_LDFLAGS = -avoid-version -module
+#xineplug_ao_out_irixal_la_CFLAGS = $(AM_CFLAGS) $(IRIXAL_CFLAGS)
xineplug_ao_out_directx_la_SOURCES = audio_directx_out.c
-xineplug_ao_out_directx_la_CPPFLAGS = $(DIRECTX_CPPFLAGS)
-xineplug_ao_out_directx_la_LIBADD = $(DIRECTX_AUDIO_LIBS) $(XINE_LIB)
-xineplug_ao_out_directx_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_directx_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_directx_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS)
+xineplug_ao_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS)
xineplug_ao_out_coreaudio_la_SOURCES = audio_coreaudio_out.c
xineplug_ao_out_coreaudio_la_LIBADD = $(XINE_LIB)
-# The "-Wl,-framework -Wl,..." is needed for libtool versions before
-# 1.5.x (1.257): the default version that ships with Mac OS X is 1.5 (1.1220)
-xineplug_ao_out_coreaudio_la_LDFLAGS = \
- -Wl,-framework -Wl,Cocoa -framework CoreAudio \
- -Wl,-framework -Wl,AudioUnit -framework AudioUnit \
- -avoid-version -module
-xineplug_ao_out_coreaudio_la_CFLAGS = -framework CoreAudio -framework AudioUnit $(VISIBILITY_FLAG)
+xineplug_ao_out_coreaudio_la_LDFLAGS = $(AM_LDFLAGS) -framework CoreAudio -framework AudioUnit
xineplug_ao_out_pulseaudio_la_SOURCES = audio_pulse_out.c
-xineplug_ao_out_pulseaudio_la_LIBADD = $(PULSEAUDIO_LIBS) $(XINE_LIB)
-xineplug_ao_out_pulseaudio_la_CFLAGS = $(VISIBILITY_FLAG) $(PULSEAUDIO_CFLAGS)
-xineplug_ao_out_pulseaudio_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_pulseaudio_la_LIBADD = $(XINE_LIB) $(PULSEAUDIO_LIBS) $(LTLIBINTL)
+xineplug_ao_out_pulseaudio_la_CFLAGS = $(AM_CFLAGS) $(PULSEAUDIO_CFLAGS)
xineplug_ao_out_directx2_la_SOURCES = audio_directx2_out.c
-xineplug_ao_out_directx2_la_CPPFLAGS = $(DIRECTX_CPPFLAGS)
+xineplug_ao_out_directx2_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS)
xineplug_ao_out_directx2_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS) $(PTHREAD_LIBS)
-xineplug_ao_out_directx2_la_CFLAGS = $(VISIBILITY_FLAG)
-xineplug_ao_out_directx2_la_LDFLAGS = -avoid-version -module
xineplug_ao_out_fusionsound_la_SOURCES = audio_fusionsound_out.c
-xineplug_ao_out_fusionsound_la_LIBADD = $(FUSIONSOUND_LIBS) $(XINE_LIB)
-xineplug_ao_out_fusionsound_la_CFLAGS = $(VISIBILITY_FLAG) $(FUSIONSOUND_CFLAGS)
-xineplug_ao_out_fusionsound_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_fusionsound_la_LIBADD = $(XINE_LIB) $(FUSIONSOUND_LIBS)
+xineplug_ao_out_fusionsound_la_CFLAGS = $(AM_CFLAGS) $(FUSIONSOUND_CFLAGS)
xineplug_ao_out_jack_la_SOURCES = audio_jack_out.c
-xineplug_ao_out_jack_la_LIBADD = $(JACK_LIBS) $(XINE_LIB)
-xineplug_ao_out_jack_la_CFLAGS = $(VISIBILITY_FLAG) $(JACK_CFLAGS)
-xineplug_ao_out_jack_la_LDFLAGS = -avoid-version -module
+xineplug_ao_out_jack_la_LIBADD = $(XINE_LIB) $(JACK_LIBS) $(LTLIBINTL)
+xineplug_ao_out_jack_la_CFLAGS = $(AM_FLAGS) $(JACK_CFLAGS)
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index f176b7594..a6f81cb35 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -15,7 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Credits go
* - for the SPDIF A/52 sync part
@@ -24,9 +24,6 @@
* for initial ALSA 0.9.x support.
* adding MONO/STEREO/4CHANNEL/5CHANNEL/5.1CHANNEL analogue support.
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
- *
- *
- * $Id: audio_alsa_out.c,v 1.168 2007/02/25 22:33:25 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,7 +38,9 @@
#include <stdlib.h>
#include <fcntl.h>
#include <math.h>
+#ifdef HAVE_ALLOCA_H
#include <alloca.h>
+#endif
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
@@ -51,10 +50,10 @@
#include <inttypes.h>
#include <pthread.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "compat.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/audio_out.h>
/*
#define ALSA_LOG
@@ -64,7 +63,7 @@
#define LOG_DEBUG
*/
-#define AO_OUT_ALSA_IFACE_VERSION 8
+#define AO_OUT_ALSA_IFACE_VERSION 9
#define BUFFER_TIME 1000*1000
#define GAP_TOLERANCE 5000
@@ -139,7 +138,7 @@ static int my_snd_mixer_wait(snd_mixer_t *mixer, int timeout) {
return count;
if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) {
- pfds = malloc(count * sizeof(*pfds));
+ pfds = calloc(count, sizeof(*pfds));
if (!pfds)
return -ENOMEM;
@@ -265,10 +264,7 @@ static long ao_alsa_get_volume_from_percent(int val, long min, long max) {
* Error callback, we need to control this,
* error message should be printed only in DEBUG mode.
*/
-static void
-#ifdef __GNUC__
- __attribute__((format (printf, 5, 6)))
-#endif
+static void XINE_FORMAT_PRINTF(5, 6)
error_callback(const char *file, int line,
const char *function, int err, const char *fmt, ...) {
#ifdef DEBUG
@@ -755,6 +751,9 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
if (res < 0)
return 0;
state = snd_pcm_state(this->audio_fd);
+ } else if (state == SND_PCM_STATE_DISCONNECTED) {
+ /* the device is gone. audio_out.c handles it if we return something < 0 */
+ return -1;
}
if (state == SND_PCM_STATE_XRUN) {
#ifdef LOG_DEBUG
@@ -787,11 +786,11 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
#endif
snd_pcm_status(this->audio_fd, pcm_stat);
if ( snd_pcm_status_get_avail(pcm_stat) < number_of_frames) {
- wait_result = snd_pcm_wait(this->audio_fd, 1000000);
+ wait_result = snd_pcm_wait(this->audio_fd, 1000);
#ifdef LOG_DEBUG
printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result);
#endif
- if (wait_result < 0) return 0;
+ if (wait_result <= 0) return 0;
}
}
if (this->mmap != 0) {
@@ -811,7 +810,10 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
return 0;
continue;
}
- if ( (state != SND_PCM_STATE_PREPARED) &&
+ if (state == SND_PCM_STATE_DISCONNECTED) {
+ /* the device is gone. audio_out.c handles it if we return something < 0 */
+ return -1;
+ } else if ( (state != SND_PCM_STATE_PREPARED) &&
(state != SND_PCM_STATE_RUNNING) &&
(state != SND_PCM_STATE_DRAINING) ) {
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
@@ -854,7 +856,11 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
static void ao_alsa_close(ao_driver_t *this_gen) {
alsa_driver_t *this = (alsa_driver_t *) this_gen;
- if(this->audio_fd) snd_pcm_close(this->audio_fd);
+ if(this->audio_fd) {
+ snd_pcm_nonblock(this->audio_fd, 0);
+ snd_pcm_drain(this->audio_fd);
+ snd_pcm_close(this->audio_fd);
+ }
this->audio_fd = NULL;
this->has_pause_resume = 0; /* This is set at open time */
}
@@ -1656,22 +1662,6 @@ static void alsa_speaker_arrangement_cb (void *user_data,
/*
* 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");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- alsa_class_t *this = (alsa_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
alsa_class_t *this;
@@ -1681,9 +1671,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "alsa";
+ this->driver_class.description = N_("xine audio output plugin using alsa-compliant audio devices/drivers");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
/* this->config = xine->config; */
this->xine = xine;
diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c
deleted file mode 100644
index f38575aff..000000000
--- a/src/audio_out/audio_arts_out.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (C) 2000-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_arts_out.c,v 1.32 2006/07/16 16:18:09 dsalt Exp $
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <math.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <artsc.h>
-
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
-#include "bswap.h"
-
-#define AO_OUT_ARTS_IFACE_VERSION 8
-
-#define AUDIO_NUM_FRAGMENTS 15
-#define AUDIO_FRAGMENT_SIZE 8192
-
-#define GAP_TOLERANCE AO_MAX_GAP
-
-typedef struct arts_driver_s {
-
- ao_driver_t ao_driver;
-
- xine_t *xine;
-
- arts_stream_t audio_stream;
- int capabilities;
- int mode;
-
- int32_t sample_rate;
- uint32_t num_channels;
- uint32_t bits_per_sample;
- uint32_t bytes_per_frame;
-
- uint32_t latency;
-
- struct {
- int volume;
- int mute;
- int vol_scale;
- int v_mixer;
- } mixer;
-
-} arts_driver_t;
-
-typedef struct {
- audio_driver_class_t driver_class;
-
- xine_t *xine;
- int inited;
-} arts_class_t;
-
-/*
- * Software stereo volume control.....
- * Igor Mokrushin <igor@avtomir.ru>
- */
-static void ao_arts_volume(void *buffer, int length, int volume) {
- int v;
- short *data = (short *)buffer;
-
- while (length--) {
- v=(int) ((*(data) * volume) / 100);
- *(data)=(v>32767) ? 32767 : ((v<-32768) ? -32768 : v);
- *(data)=LE_16(data);
- data++;
- }
-}
-/* End volume control */
-
-/*
- * open the audio device for writing to
- */
-static int ao_arts_open(ao_driver_t *this_gen,
- uint32_t bits, uint32_t rate, int mode)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
-
- xprintf (this->xine, XINE_VERBOSITY_DEBUG,
- "audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode);
-
- if ( (mode & this->capabilities) == 0 ) {
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: unsupported mode %08x\n", mode);
- return 0;
- }
-
- if (this->audio_stream) {
-
- if ( (mode == this->mode) && (rate == this->sample_rate) )
- return this->sample_rate;
-
- sleep(2); /* arts might segfault if we are still playing */
- arts_close_stream(this->audio_stream);
- }
-
- this->mode = mode;
- this->sample_rate = rate;
- this->bits_per_sample = bits;
-
- switch (mode) {
- case AO_CAP_MODE_MONO:
- this->num_channels = 1;
- break;
- case AO_CAP_MODE_STEREO:
- this->num_channels = 2;
- break;
- }
-
- this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8;
-
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: %d channels output\n", this->num_channels);
-
- this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine");
-
- this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY);
-
- /* try to keep latency low, if we don't do this we might end
- with very high latencies for low quality sound and audio_out will
- try to fill gaps every time...(values in ms) */
- if( this->latency > 800 )
- {
- this->latency = 800 - arts_stream_get (this->audio_stream, ARTS_P_SERVER_LATENCY);
- if( this->latency < 100 )
- this->latency = 100;
- arts_stream_set( this->audio_stream, ARTS_P_BUFFER_TIME, this->latency );
- this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY);
- }
-
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : latency %d ms\n", this->latency);
-
- return this->sample_rate;
-}
-
-
-static int ao_arts_num_channels(ao_driver_t *this_gen)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
- return this->num_channels;
-}
-
-static int ao_arts_bytes_per_frame(ao_driver_t *this_gen)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
- return this->bytes_per_frame;
-}
-
-static int ao_arts_get_gap_tolerance (ao_driver_t *this_gen)
-{
- return GAP_TOLERANCE;
-}
-
-static int ao_arts_write(ao_driver_t *this_gen, int16_t *data,
- uint32_t num_frames)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
- int size = num_frames * this->bytes_per_frame;
-
- ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale );
- arts_write(this->audio_stream, data, size );
-
- return 1;
-}
-
-
-static int ao_arts_delay (ao_driver_t *this_gen)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
-
- /* Just convert latency (ms) to frame units.
- please note that there is no function in aRts C API to
- get the current buffer utilization. This is, at best,
- a very roughly aproximation.
- */
-
- return this->latency * this->sample_rate / 1000;
-}
-
-static void ao_arts_close(ao_driver_t *this_gen)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
-
- if (this->audio_stream) {
- sleep(2); /* arts might segfault if we are still playing */
- arts_close_stream(this->audio_stream);
- this->audio_stream = NULL;
- }
-}
-
-static uint32_t ao_arts_get_capabilities (ao_driver_t *this_gen) {
- arts_driver_t *this = (arts_driver_t *) this_gen;
- return this->capabilities;
-}
-
-static void ao_arts_exit(ao_driver_t *this_gen)
-{
- arts_driver_t *this = (arts_driver_t *) this_gen;
-
- ao_arts_close(this_gen);
- /* FIXME: arts_free() freezes on BSD, so don't use it there */
-#if !defined(__OpenBSD__) && !defined (__FreeBSD__) && !defined(__NetBSD__)
- arts_free();
-#endif
-
- free (this);
-}
-
-static int ao_arts_get_property (ao_driver_t *this_gen, int property) {
-
- arts_driver_t *this = (arts_driver_t *) this_gen;
-
- switch(property) {
- case AO_PROP_PCM_VOL:
- case AO_PROP_MIXER_VOL:
- if(!this->mixer.mute)
- this->mixer.volume = this->mixer.vol_scale;
- return this->mixer.volume;
- break;
- case AO_PROP_MUTE_VOL:
- return this->mixer.mute;
- break;
- }
- return 0;
-}
-
-static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) {
-
- arts_driver_t *this = (arts_driver_t *) this_gen;
- int mute = (value) ? 1 : 0;
-
- switch(property) {
- case AO_PROP_PCM_VOL:
- case AO_PROP_MIXER_VOL:
- if(!this->mixer.mute)
- this->mixer.volume = value;
- this->mixer.vol_scale = this->mixer.volume;
- return this->mixer.volume;
- break;
- case AO_PROP_MUTE_VOL:
- if(mute) {
- this->mixer.v_mixer = this->mixer.volume;
- this->mixer.volume = 0;
- this->mixer.vol_scale = this->mixer.volume;
- } else {
- this->mixer.volume = this->mixer.v_mixer;
- this->mixer.vol_scale = this->mixer.volume;
- }
- this->mixer.mute = mute;
- return value;
- break;
- }
-
- return ~value;
-}
-
-static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) {
- /*arts_driver_t *this = (arts_driver_t *) this_gen;*/
-
- switch (cmd) {
-
- case AO_CTRL_PLAY_PAUSE:
- break;
-
- case AO_CTRL_PLAY_RESUME:
- break;
-
- case AO_CTRL_FLUSH_BUFFERS:
- break;
- }
-
- return 0;
-}
-
-static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) {
- arts_class_t *class = (arts_class_t *) class_gen;
- arts_driver_t *this;
- int rc;
-
- lprintf ("audio_arts_out: open_plugin called\n");
-
- this = (arts_driver_t *) xine_xmalloc (sizeof (arts_driver_t));
- if (!this)
- return NULL;
-
- this->xine = class->xine;
-
- if (class->inited == 0) {
- rc = arts_init();
- class->inited++;
- } else {
- xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_arts_out: not trying to initialise a second time\n");
- free(this);
- return NULL;
- }
-
- if (rc < 0) {
- xprintf (this->xine, XINE_VERBOSITY_DEBUG,"audio_arts_out: arts_init failed: %s\n", arts_error_text(rc));
- free(this);
- return NULL;
- }
-
- /*
- * set volume control
- */
- this->mixer.mute = 0;
- this->mixer.vol_scale = 60;
- this->mixer.v_mixer = 0;
- /*
- * set capabilities
- */
- this->capabilities = 0;
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : supported modes are ");
- this->capabilities |= AO_CAP_MODE_MONO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL;
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "mono ");
- this->capabilities |= AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL;
- xprintf (this->xine, XINE_VERBOSITY_DEBUG, "stereo ");
-
- this->sample_rate = 0;
- this->audio_stream = NULL;
-
- this->ao_driver.get_capabilities = ao_arts_get_capabilities;
- this->ao_driver.get_property = ao_arts_get_property;
- this->ao_driver.set_property = ao_arts_set_property;
- this->ao_driver.open = ao_arts_open;
- this->ao_driver.num_channels = ao_arts_num_channels;
- this->ao_driver.bytes_per_frame = ao_arts_bytes_per_frame;
- this->ao_driver.delay = ao_arts_delay;
- this->ao_driver.write = ao_arts_write;
- this->ao_driver.close = ao_arts_close;
- this->ao_driver.exit = ao_arts_exit;
- this->ao_driver.get_gap_tolerance = ao_arts_get_gap_tolerance;
- this->ao_driver.control = ao_arts_ctrl;
-
- return &this->ao_driver;
-}
-
-/*
- * class functions
- */
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "arts";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin using kde artsd");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- arts_class_t *this = (arts_class_t *) this_gen;
-
- free (this);
-}
-
-static void *init_class (xine_t *xine, void *data) {
-
- arts_class_t *this;
-
- lprintf ("audio_arts_out: init class\n");
-
- this = (arts_class_t *) xine_xmalloc (sizeof (arts_class_t));
- if (!this)
- return NULL;
-
- this->inited = 0;
-
- 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->xine = xine;
-
- return this;
-}
-
-static ao_info_t ao_info_arts = {
- 5
-};
-
-/*
- * exported plugin catalog entry
- */
-
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_AUDIO_OUT, AO_OUT_ARTS_IFACE_VERSION, "arts", XINE_VERSION_CODE, &ao_info_arts, init_class },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
-
diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c
index 22f53c0ef..001d873fa 100644
--- a/src/audio_out/audio_coreaudio_out.c
+++ b/src/audio_out/audio_coreaudio_out.c
@@ -15,7 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* done by Daniel Mack <xine@zonque.org>
* modified by Rich Wareham <richwareham@users.sourceforge.net>
@@ -41,9 +41,9 @@
#include <unistd.h>
#include <inttypes.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
#include <CoreAudio/CoreAudio.h>
#include <CoreAudio/CoreAudioTypes.h>
@@ -52,7 +52,7 @@
#include <AudioUnit/AudioUnitParameters.h>
#include <AudioUnit/AudioOutputUnit.h>
-#define AO_OUT_COREAUDIO_IFACE_VERSION 8
+#define AO_OUT_COREAUDIO_IFACE_VERSION 9
#define GAP_TOLERANCE AO_MAX_GAP
#define BUFSIZE 30720
@@ -560,22 +560,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "coreaudio";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine output plugin for Coreaudio/Mac OS X");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- coreaudio_class_t *this = (coreaudio_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
coreaudio_class_t *this;
@@ -587,9 +571,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "coreaudio";
+ this->driver_class.description = N_("xine output plugin for Coreaudio/Mac OS X");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c
index aff4412ec..309edf961 100644
--- a/src/audio_out/audio_directx2_out.c
+++ b/src/audio_out/audio_directx2_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_directx2_out.c,v 1.9 2006/07/16 16:18:09 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
* xine audio output plugin using DirectX
@@ -60,11 +58,11 @@
#define LOG
*/
-#include "xine_internal.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/audio_out.h>
-#define AO_OUT_DIRECTX2_IFACE_VERSION 8
+#define AO_OUT_DIRECTX2_IFACE_VERSION 9
/*
* buffer size in miliseconds
@@ -151,10 +149,7 @@ static int buffer_ready(dx2_driver_t *this);
/* popup a dialog with error */
-static void
-#ifdef __GNUC__
- __attribute__((format (printf, 1, 2)))
-#endif
+static void XINE_FORMAT_PRINTF(1, 2)
error_message(const char *fmt, ...) {
char message[256];
va_list ap;
@@ -993,22 +988,6 @@ static ao_driver_t *open_plugin(audio_driver_class_t *class_gen, const void *dat
return (ao_driver_t *)this;
}
-
-static char* get_identifier(audio_driver_class_t *this_gen) {
- return "directx2";
-}
-
-
-static char *get_description(audio_driver_class_t *this_gen) {
- return _("second xine audio output plugin using directx");
-}
-
-
-static void dispose_class(audio_driver_class_t *this_gen) {
- free(this_gen);
-}
-
-
static void *init_class(xine_t *xine, void *data) {
dx2_class_t *this;
@@ -1019,9 +998,9 @@ static void *init_class(xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "directx2";
+ this->driver_class.description = N_("second xine audio output plugin using directx");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->xine = xine;
diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c
index d2147ac52..5d16698b2 100755..100644
--- a/src/audio_out/audio_directx_out.c
+++ b/src/audio_out/audio_directx_out.c
@@ -15,12 +15,10 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* audio_directx_out.c, direct sound audio output plugin for xine
* by Matthew Grooms <elon@altavista.com>
- *
- * $Id: audio_directx_out.c,v 1.17 2006/09/21 15:01:08 valtri Exp $
*/
/*
@@ -40,8 +38,8 @@ typedef unsigned char boolean;
#define LOG
*/
-#include "audio_out.h"
-#include "xine_internal.h"
+#include <xine/audio_out.h>
+#include <xine/xine_internal.h>
#define MAX_CHANNELS 6
@@ -54,7 +52,7 @@ typedef unsigned char boolean;
#define DSBUFF_LEFT 1
#define DSBUFF_RIGHT 2
-#define AO_DIRECTX_IFACE_VERSION 8
+#define AO_DIRECTX_IFACE_VERSION 9
/*****************************************************************************
* DirectDraw GUIDs.
@@ -821,20 +819,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
return ( ao_driver_t * ) ao_directx;
}
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "DirectX";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin for win32 using directx");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
- audiox_class_t *audiox = (audiox_class_t *) this_gen;
-
- free (audiox);
-}
-
static void *init_class (xine_t *xine, void *data) {
audiox_class_t *audiox;
@@ -848,9 +832,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
audiox->driver_class.open_plugin = open_plugin;
- audiox->driver_class.get_identifier = get_identifier;
- audiox->driver_class.get_description = get_description;
- audiox->driver_class.dispose = dispose_class;
+ audiox->driver_class.identifier = "DirectX";
+ audiox->driver_class.description = N_("xine audio output plugin for win32 using directx");
+ audiox->driver_class.dispose = default_audio_driver_class_dispose;
audiox->xine = xine;
audiox->config = xine->config;
diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c
index 20e77b75d..81017f1ca 100644
--- a/src/audio_out/audio_esd_out.c
+++ b/src/audio_out/audio_esd_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_esd_out.c,v 1.35 2006/07/16 16:18:09 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*/
#ifdef HAVE_CONFIG_H
@@ -35,12 +33,12 @@
#include <sys/uio.h>
#include <inttypes.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
-#include "metronom.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
+#include <xine/metronom.h>
-#define AO_OUT_ESD_IFACE_VERSION 8
+#define AO_OUT_ESD_IFACE_VERSION 9
#define REBLOCK 1 /* reblock output to ESD_BUF_SIZE blks */
#define GAP_TOLERANCE 5000
@@ -565,22 +563,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "esd";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin using esound");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- esd_class_t *this = (esd_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
esd_class_t *this;
@@ -590,9 +572,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "esd";
+ this->driver_class.description = N_("xine audio output plugin using esound");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->xine = xine;
diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c
index e741523b2..666c9deeb 100644
--- a/src/audio_out/audio_file_out.c
+++ b/src/audio_out/audio_file_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_file_out.c,v 1.8 2006/07/16 16:18:09 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*/
#ifdef HAVE_CONFIG_H
@@ -33,12 +31,12 @@
#include <unistd.h>
#include <inttypes.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
#include "bswap.h"
-#define AO_OUT_FILE_IFACE_VERSION 8
+#define AO_OUT_FILE_IFACE_VERSION 9
#define GAP_TOLERANCE INT_MAX
@@ -74,7 +72,7 @@ typedef struct file_driver_s {
uint32_t bits_per_sample;
uint32_t bytes_per_frame;
- char *fname;
+ const char *fname;
int fd;
size_t bytes_written;
struct timeval endtime;
@@ -355,22 +353,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "file";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine file audio output plugin");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- file_class_t *this = (file_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
file_class_t *this;
@@ -382,9 +364,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "file";
+ this->driver_class.description = N_("xine file audio output plugin");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
diff --git a/src/audio_out/audio_fusionsound_out.c b/src/audio_out/audio_fusionsound_out.c
index 71a17f6e6..b33850c5e 100644
--- a/src/audio_out/audio_fusionsound_out.c
+++ b/src/audio_out/audio_fusionsound_out.c
@@ -15,7 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
* FusionSound based audio output plugin by Claudio Ciccani <klan@directfb.org>
@@ -34,9 +34,9 @@
#define LOG_VERBOSE
#include "xine.h"
-#include "xine_internal.h"
-#include "audio_out.h"
-#include "xineutils.h"
+#include <xine/xine_internal.h>
+#include <xine/audio_out.h>
+#include <xine/xineutils.h>
#include <directfb.h>
@@ -47,9 +47,15 @@
#define FUSIONSOUND_VERSION_CODE VERSION_CODE( FUSIONSOUND_MAJOR_VERSION, \
FUSIONSOUND_MINOR_VERSION, \
FUSIONSOUND_MICRO_VERSION )
+
+#if FUSIONSOUND_VERSION_CODE >= VERSION_CODE(1,1,0)
+# include <fusionsound_limits.h> /* defines FS_MAX_CHANNELS */
+#else
+# define FS_MAX_CHANNELS 2
+#endif
-#define AO_OUT_FS_IFACE_VERSION 8
+#define AO_OUT_FS_IFACE_VERSION 9
#define GAP_TOLERANCE 5000
@@ -100,7 +106,29 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver,
break;
case AO_CAP_MODE_STEREO:
dsc.channels = 2;
- break;
+ break;
+#if FS_MAX_CHANNELS > 2
+ case AO_CAP_MODE_4CHANNEL:
+ dsc.channels = 4;
+ dsc.channelmode = FSCM_SURROUND40_2F2R;
+ dsc.flags |= FSBDF_CHANNELMODE;
+ break;
+ case AO_CAP_MODE_4_1CHANNEL:
+ dsc.channels = 5;
+ dsc.channelmode = FSCM_SURROUND41_2F2R;
+ dsc.flags |= FSBDF_CHANNELMODE;
+ break;
+ case AO_CAP_MODE_5CHANNEL:
+ dsc.channels = 5;
+ dsc.channelmode = FSCM_SURROUND50;
+ dsc.flags |= FSBDF_CHANNELMODE;
+ break;
+ case AO_CAP_MODE_5_1CHANNEL:
+ dsc.channels = 6;
+ dsc.channelmode = FSCM_SURROUND51;
+ dsc.flags |= FSBDF_CHANNELMODE;
+ break;
+#endif
default:
xprintf (this->xine, XINE_VERBOSITY_LOG,
"audio_fusionsound_out: mode %#x not supported\n", mode);
@@ -250,13 +278,18 @@ static void ao_fusionsound_close(ao_driver_t *ao_driver){
*/
static uint32_t ao_fusionsound_get_capabilities(ao_driver_t *ao_driver) {
+ uint32_t caps = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO |
+ AO_CAP_MIXER_VOL | AO_CAP_MUTE_VOL |
+ AO_CAP_8BITS | AO_CAP_16BITS |
+ AO_CAP_24BITS;
#if FUSIONSOUND_VERSION_CODE >= VERSION_CODE(0,9,26)
- return (AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL |
- AO_CAP_8BITS | AO_CAP_16BITS | AO_CAP_24BITS | AO_CAP_FLOAT32);
-#else
- return (AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL |
- AO_CAP_8BITS | AO_CAP_16BITS | AO_CAP_24BITS);
+ caps |= AO_CAP_FLOAT32;
+#endif
+#if FS_MAX_CHANNELS > 2
+ caps |= AO_CAP_MODE_4CHANNEL | AO_CAP_MODE_4_1CHANNEL |
+ AO_CAP_MODE_5CHANNEL | AO_CAP_MODE_5_1CHANNEL;
#endif
+ return caps;
}
static void ao_fusionsound_exit(ao_driver_t *ao_driver) {
@@ -434,18 +467,6 @@ static ao_driver_t* open_plugin(audio_driver_class_t *ao_class,
* class functions
*/
-static char* get_identifier(audio_driver_class_t *ao_class) {
- return "FusionSound";
-}
-
-static char* get_description(audio_driver_class_t *ao_class) {
- return "xine FusionSound audio output plugin";
-}
-
-static void dispose_class(audio_driver_class_t *ao_class) {
- free (ao_class);
-}
-
static void* init_class(xine_t *xine, void *data) {
fusionsound_class_t *class;
const char *error;
@@ -468,9 +489,9 @@ static void* init_class(xine_t *xine, void *data) {
}
class->ao_class.open_plugin = open_plugin;
- class->ao_class.get_identifier = get_identifier;
- class->ao_class.get_description = get_description;
- class->ao_class.dispose = dispose_class;
+ class->ao_class.identifier = "FunsionSound";
+ class->ao_class.description = N_("xine FusionSound audio output plugin");
+ class->ao_class.dispose = default_audio_driver_class_dispose;
class->xine = xine;
return class;
diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c
index 04c338d24..e86b78e76 100644
--- a/src/audio_out/audio_irixal_out.c
+++ b/src/audio_out/audio_irixal_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_irixal_out.c,v 1.16 2006/07/16 16:18:09 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*/
#ifdef HAVE_CONFIG_H
@@ -39,10 +37,10 @@
#include <dmedia/audio.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "compat.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/audio_out.h>
//#ifndef AFMT_S16_NE
//# if defined(sparc) || defined(__sparc__) || defined(PPC)
diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c
index 1bc070527..7b8bb3eb3 100644
--- a/src/audio_out/audio_jack_out.c
+++ b/src/audio_out/audio_jack_out.c
@@ -8,13 +8,13 @@
#include <unistd.h>
#include <inttypes.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
#include <jack/jack.h>
-#define AO_OUT_JACK_IFACE_VERSION 8
+#define AO_OUT_JACK_IFACE_VERSION 9
#define GAP_TOLERANCE AO_MAX_GAP
#define BUFSIZE 81920
@@ -397,21 +397,6 @@ static ao_driver_t *open_jack_plugin (audio_driver_class_t *class_gen,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "jack";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine output plugin for JACK Audio Connection Kit");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- jack_class_t *this = (jack_class_t *) this_gen;
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
jack_class_t *this;
@@ -419,9 +404,9 @@ static void *init_class (xine_t *xine, void *data) {
this = (jack_class_t *) xine_xmalloc (sizeof (jack_class_t));
this->driver_class.open_plugin = open_jack_plugin;
- this->driver_class.get_identifier = get_identifier;
- this->driver_class.get_description = get_description;
- this->driver_class.dispose = dispose_class;
+ this->driver_class.identifier = "jack";
+ this->driver_class.description = N_("xine output plugin for JACK Audio Connection Kit");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c
index 0f0673431..fa6547880 100644
--- a/src/audio_out/audio_none_out.c
+++ b/src/audio_out/audio_none_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_none_out.c,v 1.11 2006/07/16 16:18:09 dsalt Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*/
#ifdef HAVE_CONFIG_H
@@ -33,11 +31,11 @@
#include <unistd.h>
#include <inttypes.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
-#define AO_OUT_NONE_IFACE_VERSION 8
+#define AO_OUT_NONE_IFACE_VERSION 9
#define AUDIO_NUM_FRAGMENTS 15
#define AUDIO_FRAGMENT_SIZE 8192
@@ -216,22 +214,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "none";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine dummy audio output plugin");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- none_class_t *this = (none_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
none_class_t *this;
@@ -243,9 +225,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "none";
+ this->driver_class.description = N_("xine dummy audio output plugin");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 793b47650..7cae9b300 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_oss_out.c,v 1.120 2007/03/17 06:59:31 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* 20-8-2001 First implementation of Audio sync and Audio driver separation.
* Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -34,7 +32,6 @@
* when dealing with audio_bytes instead of audio_frames.
*
* The number of samples passed to/from the audio driver is also sent in units of audio_frames.
- *
*/
#ifdef HAVE_CONFIG_H
@@ -67,10 +64,10 @@
#define LOG
*/
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "compat.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/audio_out.h>
#include <sys/time.h>
@@ -96,7 +93,7 @@
# define AFMT_AC3 0x00000400
#endif
-#define AO_OUT_OSS_IFACE_VERSION 8
+#define AO_OUT_OSS_IFACE_VERSION 9
#define AUDIO_NUM_FRAGMENTS 15
#define AUDIO_FRAGMENT_SIZE 8192
@@ -663,7 +660,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) {
* If not, the function returns 0.
*/
static int probe_audio_devices(oss_driver_t *this) {
- const char *base_names[2] = {"/dev/dsp", "/dev/sound/dsp"};
+ static const char *const base_names[2] = {"/dev/dsp", "/dev/sound/dsp"};
int base_num, i;
int audio_fd, rate;
int best_rate;
@@ -1038,20 +1035,14 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if ((parse = strstr(mixer_name, "dsp"))) {
parse[0] = '\0';
parse += 3;
- this->mixer.name = (char *)malloc(strlen(mixer_name) + sizeof("mixer") + 2);
if (devname_val == 0)
- sprintf(this->mixer.name, "%smixer%s", mixer_name, parse);
- else {
- if (mixer_num == -1)
- sprintf(this->mixer.name, "%smixer", mixer_name);
- else
- sprintf(this->mixer.name, "%smixer%d", mixer_name, mixer_num);
- }
- } else {
- this->mixer.name = (char *)malloc(1);
- this->mixer.name[0] = '\0';
+ asprintf(&this->mixer.name, "%smixer%s", mixer_name, parse);
+ else if (mixer_num == -1)
+ asprintf(&this->mixer.name, "%smixer", mixer_name);
+ else
+ asprintf(&this->mixer.name, "%smixer%d", mixer_name, mixer_num);
}
- _x_assert(this->mixer.name[0] != '\0');
+ _x_assert(this->mixer.name);
this->mixer.fd = open(this->mixer.name, O_RDONLY);
@@ -1148,22 +1139,6 @@ static void oss_speaker_arrangement_cb (void *user_data,
/*
* class functions
*/
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "oss";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin using oss-compliant audio devices/drivers");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
- oss_class_t *this = (oss_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
oss_class_t *this;
@@ -1173,9 +1148,9 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "oss";
+ this->driver_class.description = N_("xine audio output plugin using oss-compliant audio devices/drivers");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c
index 9e6089730..b4ec0b156 100644
--- a/src/audio_out/audio_pulse_out.c
+++ b/src/audio_out/audio_pulse_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_pulse_out.c,v 1.17 2007/04/01 00:32:29 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* ao plugin for pulseaudio (rename of polypaudio):
* http://0pointer.de/lennart/projects/pulsaudio/
@@ -25,7 +23,6 @@
* originally written for polypaudio simple api. Lennart then suggested
* using the async api for better control (such as volume), therefore, a lot
* of this code comes from Lennart's patch to mplayer.
- *
*/
#ifdef HAVE_CONFIG_H
@@ -44,9 +41,9 @@
#include <pulse/pulseaudio.h>
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
#include "bswap.h"
#define GAP_TOLERANCE AO_MAX_GAP
@@ -58,7 +55,6 @@ typedef struct {
audio_driver_class_t driver_class;
xine_t *xine;
- pthread_mutex_t pa_mutex; /*< Mutex controlling PulseAudio access. */
struct pa_context *context; /*< Pulseaudio connection context */
struct pa_threaded_mainloop *mainloop; /*< Main event loop object */
} pulse_class_t;
@@ -73,13 +69,15 @@ typedef struct pulse_driver_s {
char *sink; /*< The sink to connect to */
struct pa_stream *stream; /*< Pulseaudio playback stream object */
+ pthread_mutex_t info_mutex; /**< Mutex for info callback signaling */
+
pa_volume_t swvolume;
pa_cvolume cvolume;
int capabilities;
int mode;
- int32_t sample_rate;
+ uint32_t sample_rate;
uint32_t num_channels;
uint32_t bits_per_sample;
uint32_t bytes_per_frame;
@@ -88,6 +86,7 @@ typedef struct pulse_driver_s {
} pulse_driver_t;
+
/**
* @brief Callback function called when a stream operation succeed
* @param stream Stream which operation has succeeded
@@ -96,14 +95,11 @@ typedef struct pulse_driver_s {
* instance.
*/
static void __xine_pa_stream_success_callback(pa_stream *const stream, const int success,
- void *const this_gen)
+ void *const mutex_gen)
{
- pulse_driver_t *const this = (pulse_driver_t*)this_gen;
-
- _x_assert(stream); _x_assert(this);
- _x_assert(stream == this->stream);
+ pthread_mutex_t *const completion_mutex = (pthread_mutex_t*)mutex_gen;
- pa_threaded_mainloop_signal(this->pa_class->mainloop, 0);
+ pthread_mutex_unlock(completion_mutex);
}
/**
@@ -116,9 +112,6 @@ static void __xine_pa_context_status_callback(pa_context *const ctx, void *const
{
pulse_driver_t *const this = (pulse_driver_t*)this_gen;
- _x_assert(ctx); _x_assert(this);
- _x_assert(ctx == this->pa_class->context);
-
switch (pa_context_get_state(ctx)) {
case PA_CONTEXT_READY:
case PA_CONTEXT_TERMINATED:
@@ -179,21 +172,7 @@ static void __xine_pa_sink_info_callback(pa_context *const ctx, const pa_sink_in
this->cvolume = info->volume;
- __xine_pa_context_success_callback(ctx, 0, this);
-}
-
-static int wait_for_operation(pulse_driver_t *this, pa_operation *o)
-{
- _x_assert(this && o && this->pa_class->mainloop);
-
- pa_threaded_mainloop_lock(this->pa_class->mainloop);
-
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(this->pa_class->mainloop);
-
- pa_threaded_mainloop_unlock(this->pa_class->mainloop);
-
- return 0;
+ pthread_mutex_unlock(&this->info_mutex);
}
/*
@@ -249,7 +228,6 @@ static int ao_pulse_open(ao_driver_t *this_gen,
goto fail;
}
- pthread_mutex_lock(&this->pa_class->pa_mutex);
if ( this->pa_class->context && pa_context_get_state(this->pa_class->context) > PA_CONTEXT_READY ) {
pa_context_unref(this->pa_class->context);
this->pa_class->context = NULL;
@@ -300,8 +278,6 @@ static int ao_pulse_open(ao_driver_t *this_gen,
streamstate = pa_stream_get_state(this->stream);
} while (streamstate < PA_STREAM_READY);
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
if (streamstate != PA_STREAM_READY) {
xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_pulse_out: Failed to connect to server: %s\n",
pa_strerror(pa_context_errno(this->pa_class->context)));
@@ -315,7 +291,6 @@ static int ao_pulse_open(ao_driver_t *this_gen,
fail:
pa_threaded_mainloop_unlock(this->pa_class->mainloop);
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
this_gen->close(this_gen);
return 0;
}
@@ -342,7 +317,7 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data,
uint32_t num_frames)
{
pulse_driver_t *this = (pulse_driver_t *) this_gen;
- int size = num_frames * this->bytes_per_frame;
+ size_t size = num_frames * this->bytes_per_frame;
int ret = 0;
if ( !this->stream || !this->pa_class->context)
@@ -381,12 +356,10 @@ static int ao_pulse_delay (ao_driver_t *this_gen)
{
pulse_driver_t *this = (pulse_driver_t *) this_gen;
pa_usec_t latency = 0;
- int delay_frames;
+ unsigned int delay_frames;
if ( ! this->stream ) return this->frames_written;
- pthread_mutex_lock(&this->pa_class->pa_mutex);
-
if (pa_stream_get_latency(this->stream, &latency, NULL) < 0) {
pa_context_unref(this->pa_class->context);
this->pa_class->context = NULL;
@@ -395,13 +368,9 @@ static int ao_pulse_delay (ao_driver_t *this_gen)
pa_stream_unref(this->stream);
this->stream = NULL;
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
return 0;
}
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
/* convert latency (us) to frame units. */
delay_frames = (int)(latency * this->sample_rate / 1000000);
@@ -416,17 +385,19 @@ static void ao_pulse_close(ao_driver_t *this_gen)
pulse_driver_t *this = (pulse_driver_t *) this_gen;
if (this->stream) {
- pthread_mutex_lock(&this->pa_class->pa_mutex);
+ if (pa_stream_get_state(this->stream) == PA_STREAM_READY) {
+ pthread_mutex_t completion_callback = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&completion_callback);
+ pa_stream_drain(this->stream, __xine_pa_stream_success_callback, &completion_callback);
+
+ pthread_mutex_lock(&completion_callback);
+ pthread_mutex_destroy(&completion_callback);
+ }
- if (pa_stream_get_state(this->stream) == PA_STREAM_READY)
- wait_for_operation(this, pa_stream_drain(this->stream, __xine_pa_stream_success_callback, this));
pa_stream_disconnect(this->stream);
pa_stream_unref(this->stream);
this->stream = NULL;
pa_context_unref(this->pa_class->context);
-
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
}
}
@@ -449,17 +420,16 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) {
if ( ! this->stream || ! this->pa_class->context )
return 0;
- pthread_mutex_lock(&this->pa_class->pa_mutex);
-
switch(property) {
case AO_PROP_PCM_VOL:
case AO_PROP_MIXER_VOL:
{
+ pthread_mutex_lock(&this->info_mutex);
pa_operation *o = pa_context_get_sink_input_info(this->pa_class->context,
pa_stream_get_index(this->stream),
__xine_pa_sink_info_callback, this);
if ( ! o ) return 0;
- wait_for_operation(this, o);
+ pthread_mutex_lock(&this->info_mutex); pthread_mutex_unlock(&this->info_mutex);
result = (pa_sw_volume_to_linear(this->swvolume)*100);
}
@@ -470,8 +440,6 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) {
break;
}
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
return result;
}
@@ -482,16 +450,14 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value
if ( ! this->stream || ! this->pa_class->context )
return result;
- pthread_mutex_lock(&this->pa_class->pa_mutex);
-
switch(property) {
case AO_PROP_PCM_VOL:
case AO_PROP_MIXER_VOL:
this->swvolume = pa_sw_volume_from_linear((double)value/100.0);
pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume);
- wait_for_operation(this,
- pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream),
- &this->cvolume, __xine_pa_context_success_callback, this));
+
+ pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream),
+ &this->cvolume, __xine_pa_context_success_callback, this);
result = value;
break;
@@ -502,16 +468,13 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value
else
pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume);
- wait_for_operation(this,
- pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream),
- &this->cvolume, __xine_pa_context_success_callback, this));
+ pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream),
+ &this->cvolume, __xine_pa_context_success_callback, this);
result = value;
break;
}
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
return result;
}
@@ -522,39 +485,16 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) {
switch (cmd) {
- case AO_CTRL_PLAY_PAUSE:
- _x_assert(this->stream && this->pa_class->context );
-
- pthread_mutex_lock(&this->pa_class->pa_mutex);
- if(pa_stream_get_state(this->stream) == PA_STREAM_READY)
- wait_for_operation(this,pa_stream_cork(this->stream, 1, __xine_pa_stream_success_callback, this));
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
- break;
-
- case AO_CTRL_PLAY_RESUME:
+ case AO_CTRL_FLUSH_BUFFERS:
_x_assert(this->stream && this->pa_class->context);
- pthread_mutex_lock(&this->pa_class->pa_mutex);
if(pa_stream_get_state(this->stream) == PA_STREAM_READY) {
- struct pa_operation *o2, *o1;
- o1 = pa_stream_prebuf(this->stream, __xine_pa_stream_success_callback, this);
- _x_assert(o1); wait_for_operation(this, o1);
+ pthread_mutex_t completion_callback = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&completion_callback);
+ pa_stream_flush(this->stream, __xine_pa_stream_success_callback, &completion_callback);
- o2 = pa_stream_cork(this->stream, 0, __xine_pa_stream_success_callback, this);
- _x_assert(o2); wait_for_operation(this,o2);
+ pthread_mutex_lock(&completion_callback);
+ pthread_mutex_destroy(&completion_callback);
}
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
-
- break;
-
- case AO_CTRL_FLUSH_BUFFERS:
- _x_assert(this->stream && this->pa_class->context);
-
- pthread_mutex_lock(&this->pa_class->pa_mutex);
- if(pa_stream_get_state(this->stream) == PA_STREAM_READY)
- wait_for_operation(this,pa_stream_flush(this->stream, __xine_pa_stream_success_callback, this));
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
this->frames_written = 0;
@@ -620,45 +560,30 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
this->host = strdup(device);
}
+ pthread_mutex_init(&this->info_mutex, NULL);
+
xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: host %s sink %s\n",
this->host ? this->host : "(null)", this->sink ? this->sink : "(null)");
this->pa_class = class;
return &this->ao_driver;
-
- fail:
- pthread_mutex_unlock(&this->pa_class->pa_mutex);
- free(this);
- xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n");
- return NULL;
}
/*
* class functions
*/
-static char* get_identifier (audio_driver_class_t *this_gen) {
- return "pulseaudio";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin using pulseaudio sound server");
-}
-
static void dispose_class (audio_driver_class_t *this_gen) {
pulse_class_t *this = (pulse_class_t *) this_gen;
- pthread_mutex_lock(&this->pa_mutex);
-
if ( this->context )
pa_context_unref(this->context);
pa_threaded_mainloop_stop(this->mainloop);
pa_threaded_mainloop_free(this->mainloop);
- pthread_mutex_destroy(&this->pa_mutex);
free (this);
}
@@ -673,24 +598,19 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
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->driver_class.identifier = "pulseaudio";
+ this->driver_class.description = N_("xine audio output plugin using pulseaudio sound server");
this->xine = xine;
- pthread_mutex_init(&this->pa_mutex, NULL);
- pthread_mutex_lock(&this->pa_mutex);
-
this->mainloop = pa_threaded_mainloop_new();
_x_assert(this->mainloop);
pa_threaded_mainloop_start(this->mainloop);
-
+
this->context = NULL;
- pthread_mutex_unlock(&this->pa_mutex);
-
return this;
}
@@ -704,7 +624,7 @@ static const ao_info_t ao_info_pulse = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_AUDIO_OUT, 8, "pulseaudio", XINE_VERSION_CODE, &ao_info_pulse, init_class },
+ { PLUGIN_AUDIO_OUT, 9, "pulseaudio", XINE_VERSION_CODE, &ao_info_pulse, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c
index 5923eb658..921e5fd15 100644
--- a/src/audio_out/audio_sun_out.c
+++ b/src/audio_out/audio_sun_out.c
@@ -15,9 +15,7 @@
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: audio_sun_out.c,v 1.47 2007/03/10 00:55:14 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*/
#ifdef HAVE_CONFIG_H
@@ -47,9 +45,9 @@
typedef unsigned uint_t;
#endif
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "audio_out.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/audio_out.h>
#ifdef __svr4__
#define CS4231_WORKAROUND 1 /* enable workaround for audiocs play.samples bug */
@@ -66,7 +64,7 @@ typedef unsigned uint_t;
#define AUDIO_PRECISION_16 16
#endif
-#define AO_SUN_IFACE_VERSION 8
+#define AO_SUN_IFACE_VERSION 9
#define GAP_TOLERANCE 5000
#define GAP_NONRT_TOLERANCE AO_MAX_GAP
@@ -248,13 +246,11 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev)
error:
if (silence != NULL) free(silence);
if (fd >= 0) {
-#ifdef __svr4__
/*
* remove the 0 bytes from the above measurement from the
* audio driver's STREAMS queue
*/
ioctl(fd, I_FLUSH, FLUSHW);
-#endif
close(fd);
}
@@ -334,7 +330,7 @@ find_close_samplerate_match(int dev, int sample_rate)
#else
int i, err;
- int audiocs_rates[] = {
+ static const int audiocs_rates[] = {
5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050,
27420, 32000, 33075, 37800, 44100, 48000, 0
};
@@ -1015,22 +1011,6 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
/*
* class functions
*/
-
-static char* ao_sun_get_identifier (audio_driver_class_t *this_gen) {
- return "sun";
-}
-
-static char* ao_sun_get_description (audio_driver_class_t *this_gen) {
- return _("xine audio output plugin using sun-compliant audio devices/drivers");
-}
-
-static void ao_sun_dispose_class (audio_driver_class_t *this_gen) {
-
- sun_class_t *this = (sun_class_t *) this_gen;
-
- free (this);
-}
-
static void *ao_sun_init_class (xine_t *xine, void *data) {
sun_class_t *this;
@@ -1039,9 +1019,9 @@ static void *ao_sun_init_class (xine_t *xine, void *data) {
return NULL;
this->driver_class.open_plugin = ao_sun_open_plugin;
- this->driver_class.get_identifier = ao_sun_get_identifier;
- this->driver_class.get_description = ao_sun_get_description;
- this->driver_class.dispose = ao_sun_dispose_class;
+ this->driver_class.identifier = "sun";
+ this->driver_class.description = N_("xine audio output plugin using sun-compliant audio devices/drivers");
+ this->driver_class.dispose = default_audio_driver_class_dispose;
this->xine = xine;