summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-05-07 03:40:34 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-05-07 03:40:34 +0000
commit7a901686f18c37b2cd885bd324916d47b34e7c5a (patch)
tree471f3f5e6919d82dc3c848fe1ab50db2625285b6 /src
parent2866aa5a2be3ef68979648fe550a208bd65416ae (diff)
downloadxine-lib-7a901686f18c37b2cd885bd324916d47b34e7c5a.tar.gz
xine-lib-7a901686f18c37b2cd885bd324916d47b34e7c5a.tar.bz2
Fixed the way to detect libtool version. Add get_capabilities(),get_property()
and set_property() to audio out. get_supported_modes removed, use get_cap() instead. Change the way of capabilities, match like video_out AO_CAP_* and AO_PROP_*. Fixed a small typo in demux_mpeg.c. Fixed libmpg123 audio output callings arguments. Change the AO_MODE to AO_CAP_MODE in all required locations. CVS patchset: 69 CVS date: 2001/05/07 03:40:34
Diffstat (limited to 'src')
-rw-r--r--src/audio_out/audio_oss_out.c51
-rw-r--r--src/demuxers/demux_mpeg.c4
-rw-r--r--src/libac3/decode.c8
-rw-r--r--src/libmpg123/layer1.c8
-rw-r--r--src/libmpg123/layer2.c8
-rw-r--r--src/libmpg123/layer3.c8
-rw-r--r--src/xine-engine/audio_out.h63
7 files changed, 108 insertions, 42 deletions
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 8e3ebd1f3..d72667c3a 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.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_oss_out.c,v 1.4 2001/05/07 02:25:00 f1rmb Exp $
+ * $Id: audio_oss_out.c,v 1.5 2001/05/07 03:40:35 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -106,7 +106,7 @@ static int ao_open(ao_functions_t *this_gen,
printf ("audio_oss_out: ao_open rate=%d, mode=%d\n", rate, mode);
- if ((mode != AO_MODE_STEREO) && (mode != AO_MODE_MONO)) {
+ if (((mode & AO_CAP_MODE_STEREO) == 0) && ((mode & AO_CAP_MODE_MONO) == 0)) {
printf ("OSS Driver only supports mono/stereo output modes at the moment\n");
return -1;
}
@@ -145,7 +145,7 @@ static int ao_open(ao_functions_t *this_gen,
* configure audio device
*/
- tmp = (mode == AO_MODE_STEREO) ? 1 : 0;
+ tmp = (mode & AO_CAP_MODE_STEREO) ? 1 : 0;
ioctl(this->audio_fd,SNDCTL_DSP_STEREO,&tmp);
this->num_channels = tmp+1;
@@ -377,8 +377,8 @@ static void ao_close(ao_functions_t *this_gen)
this->audio_fd = -1;
}
-static uint32_t ao_get_supported_modes (ao_functions_t *this) {
- return AO_MODE_STEREO | AO_MODE_MONO;
+static uint32_t ao_get_capabilities (ao_functions_t *this) {
+ return AO_CAP_MODE_STEREO | AO_CAP_MODE_MONO;
}
static void ao_connect (ao_functions_t *this_gen, metronom_t *metronom) {
@@ -398,6 +398,43 @@ static void ao_exit(ao_functions_t *this_gen)
free (this);
}
+/*
+ *
+ */
+static int ao_get_property (ao_functions_t *this, int property) {
+
+ /* FIXME: implement some properties
+ switch(property) {
+ case AO_PROP_MIXER_VOL:
+ break;
+ case AO_PROP_PCM_VOL:
+ break;
+ case AO_PROP_MUTE_VOL:
+ break;
+ }
+ */
+ return 0;
+}
+
+/*
+ *
+ */
+static int ao_set_property (ao_functions_t *this, int property, int value) {
+
+ /* FIXME: Implement property support.
+ switch(property) {
+ case AO_PROP_MIXER_VOL:
+ break;
+ case AO_PROP_PCM_VOL:
+ break;
+ case AO_PROP_MUTE_VOL:
+ break;
+ }
+ */
+
+ return ~value;
+}
+
ao_functions_t *init_audio_out_plugin (config_values_t *config) {
oss_functions_t *this;
@@ -482,7 +519,9 @@ ao_functions_t *init_audio_out_plugin (config_values_t *config) {
this->zero_space = malloc (8192);
memset (this->zero_space, 0, 8192);
- this->ao_functions.get_supported_modes = ao_get_supported_modes;
+ this->ao_functions.get_capabilities = ao_get_capabilities;
+ this->ao_functions.get_property = ao_get_property;
+ this->ao_functions.set_property = ao_set_property;
this->ao_functions.connect = ao_connect;
this->ao_functions.open = ao_open;
this->ao_functions.write_audio_data = ao_write_audio_data;
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 0b7c40627..f42bc2b4e 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.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: demux_mpeg.c,v 1.8 2001/05/06 14:25:42 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.9 2001/05/07 03:40:35 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -501,7 +501,7 @@ static void demux_mpeg_start (demux_plugin_t *this_gen,
xprintf (VERBOSE|DEMUX, "=>seek to %Ld\n",pos);
this->input->seek (this->input, pos+4, SEEK_SET);
} else
- read_bytes(4);
+ read_bytes(this, 4);
printf ("demux_mpeg: create start packages...\n");
diff --git a/src/libac3/decode.c b/src/libac3/decode.c
index 3239c5543..96ee6c1a3 100644
--- a/src/libac3/decode.c
+++ b/src/libac3/decode.c
@@ -137,7 +137,7 @@ static uint32_t decode_buffer_syncframe (syncinfo_t *syncinfo, uint8_t **start,
//if we got to this point, we found a valid ac3 frame to decode
//
- if ((ac3_config.flags & AO_MODE_AC3) == 0) {
+ if ((ac3_config.flags & AO_CAP_MODE_AC3) == 0) {
bitstream_init (buffer);
//get rid of the syncinfo struct as we already parsed it
bitstream_get (24);
@@ -213,7 +213,7 @@ size_t ac3_decode_data (uint8_t *data_start, uint8_t *data_end, uint32_t pts_)
goto error;
#endif
- if ((ac3_config.flags & AO_MODE_AC3) == 0) {
+ if ((ac3_config.flags & AO_CAP_MODE_AC3) == 0) {
parse_bsi (&bsi);
// compute downmix parameters
@@ -286,11 +286,11 @@ size_t ac3_decode_data (uint8_t *data_start, uint8_t *data_end, uint32_t pts_)
if (!is_output_initialized) {
ac3_output->open (ac3_output, 16, syncinfo.sampling_rate,
- (ac3_config.flags & AO_MODE_AC3) ? AO_MODE_AC3 : AO_MODE_STEREO);
+ (ac3_config.flags & AO_CAP_MODE_AC3) ? AO_CAP_MODE_AC3 : AO_CAP_MODE_STEREO);
is_output_initialized = 1;
}
- if ((ac3_config.flags & AO_MODE_AC3) == 0) {
+ if ((ac3_config.flags & AO_CAP_MODE_AC3) == 0) {
ac3_output->write_audio_data(ac3_output,
s16_samples, 256*6, pts_);
}
diff --git a/src/libmpg123/layer1.c b/src/libmpg123/layer1.c
index a4e8075de..b10c938fd 100644
--- a/src/libmpg123/layer1.c
+++ b/src/libmpg123/layer1.c
@@ -149,17 +149,17 @@ void do_layer1(metronom_t *metronom, mpgaudio_t *mp, uint32_t pts)
if ((!mp->is_output_initialized) || (mp->sample_rate_device != fr->sample_rate)) {
if (mp->is_output_initialized)
- mp->ao_output->close();
+ mp->ao_output->close(mp->ao_output);
- mp->ao_output->open (16, fr->sample_rate,
- stereo-1 ? AO_MODE_STEREO: AO_MODE_MONO);
+ mp->ao_output->open (mp->ao_output, 16, fr->sample_rate,
+ stereo-1 ? AO_CAP_MODE_STEREO: AO_CAP_MODE_MONO);
mp->is_output_initialized = 1;
mp->sample_rate_device = fr->sample_rate;
printf ("layer1\n");
}
- mp->ao_output->write_audio_data (metronom, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
+ mp->ao_output->write_audio_data (mp->ao_output, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
}
diff --git a/src/libmpg123/layer2.c b/src/libmpg123/layer2.c
index 42d680273..ee5a95cef 100644
--- a/src/libmpg123/layer2.c
+++ b/src/libmpg123/layer2.c
@@ -289,17 +289,17 @@ void do_layer2(metronom_t *metronom, mpgaudio_t *mp, uint32_t pts)
if ((!mp->is_output_initialized) || (mp->sample_rate_device != fr->sample_rate)) {
if (mp->is_output_initialized)
- mp->ao_output->close();
+ mp->ao_output->close(mp->ao_output);
- mp->ao_output->open (16, fr->sample_rate,
- stereo-1 ? AO_MODE_STEREO: AO_MODE_MONO);
+ mp->ao_output->open (mp->ao_output, 16, fr->sample_rate,
+ stereo-1 ? AO_CAP_MODE_STEREO: AO_CAP_MODE_MONO);
mp->is_output_initialized = 1;
mp->sample_rate_device = fr->sample_rate;
printf ("layer2\n");
}
- mp->ao_output->write_audio_data (metronom, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
+ mp->ao_output->write_audio_data (mp->ao_output, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
}
diff --git a/src/libmpg123/layer3.c b/src/libmpg123/layer3.c
index 697415834..89b11776d 100644
--- a/src/libmpg123/layer3.c
+++ b/src/libmpg123/layer3.c
@@ -1599,15 +1599,15 @@ void do_layer3(metronom_t *metronom, mpgaudio_t *mp, uint32_t pts)
if ((!mp->is_output_initialized) || (mp->sample_rate_device != fr->sample_rate)) {
if (mp->is_output_initialized)
- mp->ao_output->close();
+ mp->ao_output->close(mp->ao_output);
- mp->ao_output->open (16, fr->sample_rate,
- stereo-1 ? AO_MODE_STEREO: AO_MODE_MONO);
+ mp->ao_output->open (mp->ao_output, 16, fr->sample_rate,
+ stereo-1 ? AO_CAP_MODE_STEREO: AO_CAP_MODE_MONO);
mp->is_output_initialized = 1;
mp->sample_rate_device = fr->sample_rate;
printf ("layer3\n");
}
- mp->ao_output->write_audio_data (metronom, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
+ mp->ao_output->write_audio_data (mp->ao_output, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), pts);
}
diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h
index 98bbc4683..7836d3578 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.3 2001/04/28 19:47:42 guenter Exp $
+ * $Id: audio_out.h,v 1.4 2001/05/07 03:40:35 f1rmb Exp $
*/
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H
@@ -33,17 +33,6 @@
#define AUDIO_OUT_IFACE_VERSION 1
/*
- * audio output modes Used as Bitfield in AC3 decoder
- */
-
-#define AO_MODE_AC3 1
-#define AO_MODE_AC5 2
-#define AO_MODE_MONO 4 /* 1 sample == 2 bytes */
-#define AO_MODE_STEREO 8 /* 1 sample == 4 bytes */
-#define AO_MODE_4CHANNEL 16 /* 1 sample == 8 bytes */
-#define AO_MODE_5CHANNEL 32 /* 1 sample == 10 bytes */
-
-/*
* ao_functions_s contains the functions every audio output
* driver plugin has to implement.
*/
@@ -52,12 +41,14 @@ typedef struct ao_functions_s ao_functions_t;
struct ao_functions_s {
- /*
- * find out what output modes are supported by this plugin
- * (constants for the bit vector to return see above)
+ /*
+ *
+ * find out what output modes + capatilities are supported by
+ * this plugin (constants for the bit vector to return see above)
+ *
+ * See AO_CAP_* bellow.
*/
-
- uint32_t (*get_supported_modes) (ao_functions_t *this);
+ uint32_t (*get_capabilities) (ao_functions_t *this);
/*
* connect this driver to the xine engine
@@ -96,7 +87,19 @@ struct ao_functions_s {
void (*exit) (ao_functions_t *this);
-} ;
+ /*
+ * Get, Set a property of audio driver.
+ *
+ * get_property() return 1 in success, 0 on failure.
+ * set_property() return value on success, ~value on failure.
+ *
+ * See AC_PROP_* bellow for available properties.
+ */
+ int (*get_property) (ao_functions_t *this, int property);
+
+ int (*set_property) (ao_functions_t *this, int property, int value);
+
+};
/*
@@ -114,6 +117,30 @@ struct ao_functions_s {
*
*/
+/*
+ * audio output modes + capabilities
+ */
+
+#define AO_CAP_NOCAP 0x00000000 /* Driver have no capabilities */
+#define AO_CAP_MODE_AC3 0x00000001 /* Driver support AC3 output */
+#define AO_CAP_MODE_AC5 0x00000002 /* Driver support AC5 output */
+/* 1 sample == 2 bytes */
+#define AO_CAP_MODE_MONO 0x00000004 /* Driver support mono output */
+ /* 1 sample == 4 bytes */
+#define AO_CAP_MODE_STEREO 0x00000008 /* Driver support stereo output */
+ /* 1 sample == 8 bytes */
+#define AO_CAP_MODE_4CHANNEL 0x00000010 /* Driver support 4 channels */
+/* 1 sample == 10 bytes */
+#define AO_CAP_MODE_5CHANNEL 0x00000020 /* Driver support 5 channels */
+#define AO_CAP_MIXER_VOL 0x00000040 /* Driver support mixer control */
+#define AO_CAP_PCM_VOL 0x00000080 /* Driver support pcm control */
+#define AO_CAP_MUTE_VOL 0x00000100 /* Driver can mute volume */
+
+/* properties supported by get/set_property() */
+#define AO_PROP_MIXER_VOL 0
+#define AO_PROP_PCM_VOL 1
+#define AO_PROP_MUTE_VOL 2
+
typedef struct ao_info_s {
int interface_version;