diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-05-13 22:39:41 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-05-13 22:39:41 +0000 |
commit | 42b8c1501b6e5f322dfda3ffe0cbc2a35e8e3948 (patch) | |
tree | 6b4e8f03275cae0491dc47b2b70160c4fa97befe | |
parent | f25500b374e134b4ea06d5ec8f1e28ea2958b066 (diff) | |
download | xine-lib-42b8c1501b6e5f322dfda3ffe0cbc2a35e8e3948.tar.gz xine-lib-42b8c1501b6e5f322dfda3ffe0cbc2a35e8e3948.tar.bz2 |
add audio out driver "none"
obs: none != null (null disables audio decoding)
CVS patchset: 4842
CVS date: 2003/05/13 22:39:41
-rw-r--r-- | src/audio_out/Makefile.am | 5 | ||||
-rw-r--r-- | src/audio_out/audio_none_out.c | 252 |
2 files changed, 256 insertions, 1 deletions
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index a2a66a67d..8989ee7b7 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -38,7 +38,7 @@ endif # all xine audio out plugins should be named like the # scheme "xineplug_ao_out_" # -lib_LTLIBRARIES = $(oss_module) \ +lib_LTLIBRARIES = xineplug_ao_out_none.la $(oss_module) \ $(alsa_module) \ $(sun_module) \ $(arts_module) \ @@ -52,6 +52,9 @@ lib_LTLIBRARIES = $(oss_module) \ # $(oss_module) \ # $(sun_module) +xineplug_ao_out_none_la_SOURCES = audio_none_out.c +xineplug_ao_out_none_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ + xineplug_ao_out_oss_la_SOURCES = audio_oss_out.c xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c new file mode 100644 index 000000000..f9c54073f --- /dev/null +++ b/src/audio_out/audio_none_out.c @@ -0,0 +1,252 @@ +/* + * Copyright (C) 2000-2002 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_none_out.c,v 1.1 2003/05/13 22:39:41 miguelfreitas 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 "xine_internal.h" +#include "xineutils.h" +#include "audio_out.h" + +#define AO_OUT_NONE_IFACE_VERSION 7 + +#define AUDIO_NUM_FRAGMENTS 15 +#define AUDIO_FRAGMENT_SIZE 8192 + +#define GAP_TOLERANCE AO_MAX_GAP + +typedef struct none_driver_s { + + ao_driver_t ao_driver; + + 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; + +} none_driver_t; + +typedef struct { + audio_driver_class_t driver_class; + + config_values_t *config; +} none_class_t; + +/* + * open the audio device for writing to + */ +static int ao_none_open(ao_driver_t *this_gen, + uint32_t bits, uint32_t rate, int mode) +{ + none_driver_t *this = (none_driver_t *) this_gen; + + printf ("audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); + + 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; + } + + return this->sample_rate; +} + + +static int ao_none_num_channels(ao_driver_t *this_gen) +{ + none_driver_t *this = (none_driver_t *) this_gen; + return this->num_channels; +} + +static int ao_none_bytes_per_frame(ao_driver_t *this_gen) +{ + none_driver_t *this = (none_driver_t *) this_gen; + return this->bytes_per_frame; +} + +static int ao_none_get_gap_tolerance (ao_driver_t *this_gen) +{ + return GAP_TOLERANCE; +} + +static int ao_none_write(ao_driver_t *this_gen, int16_t *data, + uint32_t num_frames) +{ + return 1; +} + + +static int ao_none_delay (ao_driver_t *this_gen) +{ + return 0; +} + +static void ao_none_close(ao_driver_t *this_gen) +{ +} + +static uint32_t ao_none_get_capabilities (ao_driver_t *this_gen) { + none_driver_t *this = (none_driver_t *) this_gen; + return this->capabilities; +} + +static void ao_none_exit(ao_driver_t *this_gen) +{ + none_driver_t *this = (none_driver_t *) this_gen; + + ao_none_close(this_gen); + + free (this); +} + +static int ao_none_get_property (ao_driver_t *this_gen, int property) { + + return 0; +} + +static int ao_none_set_property (ao_driver_t *this_gen, int property, int value) { + + return ~value; +} + +static int ao_none_ctrl(ao_driver_t *this_gen, int cmd, ...) { + /*none_driver_t *this = (none_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) { + + /* none_class_t *class = (none_class_t *) class_gen; */ + /* config_values_t *config = class->config; */ + none_driver_t *this; + + printf ("audio_none_out: open_plugin called\n"); + + this = (none_driver_t *) malloc (sizeof (none_driver_t)); + + this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO; + + this->sample_rate = 0; + + this->ao_driver.get_capabilities = ao_none_get_capabilities; + this->ao_driver.get_property = ao_none_get_property; + this->ao_driver.set_property = ao_none_set_property; + this->ao_driver.open = ao_none_open; + this->ao_driver.num_channels = ao_none_num_channels; + this->ao_driver.bytes_per_frame = ao_none_bytes_per_frame; + this->ao_driver.delay = ao_none_delay; + this->ao_driver.write = ao_none_write; + this->ao_driver.close = ao_none_close; + this->ao_driver.exit = ao_none_exit; + this->ao_driver.get_gap_tolerance = ao_none_get_gap_tolerance; + this->ao_driver.control = ao_none_ctrl; + + return &this->ao_driver; +} + +/* + * 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; + + printf ("audio_none_out: init class\n"); + + this = (none_class_t *) malloc (sizeof (none_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_none = { + 0 +}; + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_NONE_IFACE_VERSION, "none", XINE_VERSION_CODE, &ao_info_none, init_class }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + |