diff options
author | Viliam Mateicka <viliam.mateicka@gmail.com> | 2009-01-10 17:53:33 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-10 17:55:38 +0100 |
commit | 11c29cccb3409fb4d0fea5171a56230253583864 (patch) | |
tree | 6ab080de10e9f0d3c4acf48b24815689f9fc4be5 /src/output | |
parent | 8ebe7bfb250f2b1048d6e7f6c2477717daaad8e9 (diff) | |
download | mpd-11c29cccb3409fb4d0fea5171a56230253583864.tar.gz mpd-11c29cccb3409fb4d0fea5171a56230253583864.tar.xz mpd-11c29cccb3409fb4d0fea5171a56230253583864.zip |
Introducing mixer api
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in
alsa and oss output plugin
Diffstat (limited to '')
-rw-r--r-- | src/output/alsa_plugin.c | 15 | ||||
-rw-r--r-- | src/output/oss_plugin.c | 16 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c index fc5c56c21..58f549800 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -52,7 +52,7 @@ typedef struct _AlsaData { int sampleSize; int useMmap; - struct alsa_mixer *mixer; + struct mixer mixer; } AlsaData; @@ -74,7 +74,8 @@ static AlsaData *newAlsaData(void) ret->buffer_time = MPD_ALSA_BUFFER_TIME_US; ret->period_time = 0; - ret->mixer = alsa_mixer_init(); + //use alsa mixer by default + mixer_init(&ret->mixer, &alsa_mixer); return ret; } @@ -82,7 +83,7 @@ static AlsaData *newAlsaData(void) static void freeAlsaData(AlsaData * ad) { g_free(ad->device); - alsa_mixer_finish(ad->mixer); + mixer_finish(&ad->mixer); free(ad); } @@ -133,7 +134,7 @@ static void *alsa_initDriver(G_GNUC_UNUSED struct audio_output *ao, if (param) { alsa_configure(ad, param); - alsa_mixer_configure(ad->mixer, param); + mixer_configure(&ad->mixer, param); } return ad; @@ -189,7 +190,7 @@ static bool alsa_openDevice(void *data, struct audio_format *audioFormat) unsigned int period_time, period_time_ro; unsigned int buffer_time; - alsa_mixer_open(ad->mixer); + mixer_open(&ad->mixer); if ((bitformat = get_bitformat(audioFormat)) == SND_PCM_FORMAT_UNKNOWN) g_warning("ALSA device \"%s\" doesn't support %u bit audio\n", @@ -413,7 +414,7 @@ static void alsa_closeDevice(void *data) snd_pcm_close(ad->pcmHandle); ad->pcmHandle = NULL; } - alsa_mixer_close(ad->mixer); + mixer_close(&ad->mixer); } static bool @@ -451,7 +452,7 @@ static bool alsa_control(void *data, int cmd, void *arg) { AlsaData *ad = data; - return alsa_mixer_control(ad->mixer, cmd, arg); + return mixer_control(&ad->mixer, cmd, arg); } const struct audio_output_plugin alsaPlugin = { diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c index f46377254..175aace1a 100644 --- a/src/output/oss_plugin.c +++ b/src/output/oss_plugin.c @@ -55,7 +55,7 @@ typedef struct _OssData { int numSupported[3]; int *unsupported[3]; int numUnsupported[3]; - struct oss_mixer *mixer; + struct mixer mixer; } OssData; enum oss_support { @@ -276,7 +276,7 @@ static OssData *newOssData(void) supportParam(ret, SNDCTL_DSP_CHANNELS, 2); supportParam(ret, SNDCTL_DSP_SAMPLESIZE, 16); - ret->mixer = oss_mixer_init(); + mixer_init( &ret->mixer, &oss_mixer); return ret; } @@ -290,7 +290,7 @@ static void freeOssData(OssData * od) g_free(od->unsupported[OSS_CHANNELS]); g_free(od->unsupported[OSS_BITS]); - oss_mixer_finish(od->mixer); + mixer_finish(&od->mixer); free(od); } @@ -355,7 +355,7 @@ static void *oss_open_default(ConfigParam *param) if (ret[i] == 0) { OssData *od = newOssData(); od->device = default_devices[i]; - oss_mixer_configure(od->mixer, param); + mixer_configure(&od->mixer, param); return od; } } @@ -396,7 +396,7 @@ static void *oss_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput, if (bp) { OssData *od = newOssData(); od->device = bp->value; - oss_mixer_configure(od->mixer, param); + mixer_configure(&od->mixer, param); return od; } } @@ -522,7 +522,7 @@ oss_openDevice(void *data, struct audio_format *audioFormat) od->audio_format.bits, od->audio_format.channels, od->audio_format.sample_rate); - oss_mixer_open(od->mixer); + mixer_open(&od->mixer); return ret; } @@ -532,7 +532,7 @@ static void oss_closeDevice(void *data) OssData *od = data; oss_close(od); - oss_mixer_close(od->mixer); + mixer_close(&od->mixer); } static void oss_dropBufferedAudio(void *data) @@ -575,7 +575,7 @@ static bool oss_control(void *data, int cmd, void *arg) { OssData *od = data; - return oss_mixer_control(od->mixer, cmd, arg); + return mixer_control(&od->mixer, cmd, arg); } const struct audio_output_plugin ossPlugin = { |