From 403f01979cef7e03b8322ddb870e3959c8de0f77 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Wed, 4 Sep 2002 23:31:05 +0000 Subject: merging in the new_api branch ... unfortunately video_out / vo_scale is broken now ... matthias/miguel: please fix it :-) CVS patchset: 2606 CVS date: 2002/09/04 23:31:05 --- src/audio_out/audio_alsa_out.c | 176 ++--- src/audio_out/audio_arts_out.c | 53 +- src/audio_out/audio_esd_out.c | 62 +- src/audio_out/audio_irixal_out.c | 30 +- src/audio_out/audio_oss_out.c | 66 +- src/audio_out/audio_sun_out.c | 28 +- src/demuxers/demux_aiff.c | 6 +- src/demuxers/demux_asf.c | 29 +- src/demuxers/demux_avi.c | 29 +- src/demuxers/demux_elem.c | 32 +- src/demuxers/demux_film.c | 6 +- src/demuxers/demux_fli.c | 6 +- src/demuxers/demux_idcin.c | 7 +- src/demuxers/demux_mpeg.c | 32 +- src/demuxers/demux_mpeg_block.c | 32 +- src/demuxers/demux_mpgaudio.c | 28 +- src/demuxers/demux_ogg.c | 28 +- src/demuxers/demux_pes.c | 10 +- src/demuxers/demux_qt.c | 28 +- src/demuxers/demux_roq.c | 6 +- src/demuxers/demux_smjpeg.c | 6 +- src/demuxers/demux_snd.c | 10 +- src/demuxers/demux_ts.c | 10 +- src/demuxers/demux_voc.c | 7 +- src/demuxers/demux_vqa.c | 10 +- src/demuxers/demux_wav.c | 6 +- src/demuxers/demux_wc3movie.c | 9 +- src/input/input_cda.c | 47 +- src/input/input_dvd.c | 235 ++++--- src/input/input_file.c | 38 +- src/input/input_http.c | 25 +- src/input/input_mms.c | 26 +- src/input/input_net.c | 28 +- src/input/input_rtp.c | 29 +- src/input/input_stdin_fifo.c | 26 +- src/input/input_vcd.c | 30 +- src/input/net_buf_ctrl.c | 4 +- src/liba52/xine_decoder.c | 42 +- src/libdivx4/xine_decoder.c | 52 +- src/libdts/xine_decoder.c | 39 +- src/libfaad/xine_decoder.c | 39 +- src/libffmpeg/xine_decoder.c | 72 +- src/liblpcm/xine_decoder.c | 41 +- src/libmad/xine_decoder.c | 38 +- src/libmpeg2/decode.c | 7 +- src/libmpeg2/slice.c | 1 + src/libmpeg2/xine_decoder.c | 41 +- src/libspucc/cc_decoder.c | 4 +- src/libspucc/xine_decoder.c | 23 +- src/libspudec/spu.c | 5 +- src/libspudec/xine_decoder.c | 5 +- src/libsputext/xine_decoder.c | 25 +- src/libvorbis/xine_decoder.c | 35 +- src/libw32dll/w32codec.c | 120 ++-- src/libxineadec/adpcm.c | 48 +- src/libxineadec/logpcm.c | 7 +- src/libxineadec/roqaudio.c | 35 +- src/libxinevdec/cinepak.c | 44 +- src/libxinevdec/cyuv.c | 44 +- src/libxinevdec/fli.c | 46 +- src/libxinevdec/idcinvideo.c | 8 +- src/libxinevdec/msrle.c | 45 +- src/libxinevdec/msvc.c | 44 +- src/libxinevdec/qtrpza.c | 8 +- src/libxinevdec/qtsmc.c | 8 +- src/libxinevdec/rgb.c | 44 +- src/libxinevdec/roqvideo.c | 40 +- src/libxinevdec/svq1.c | 44 +- src/libxinevdec/wc3video.c | 8 +- src/libxinevdec/yuv.c | 49 +- src/libxvid/xine_decoder.c | 43 +- src/video_out/Makefile.am | 148 ++-- src/video_out/alphablend.c | 1 + src/video_out/video_out_aa.c | 7 +- src/video_out/video_out_fb.c | 41 +- src/video_out/video_out_opengl.c | 6 +- src/video_out/video_out_sdl.c | 54 +- src/video_out/video_out_syncfb.c | 64 +- src/video_out/video_out_vidix.c | 10 +- src/video_out/video_out_x11.h | 121 ---- src/video_out/video_out_xshm.c | 45 +- src/video_out/video_out_xv.c | 116 +-- src/xine-engine/Makefile.am | 4 +- src/xine-engine/audio_decoder.c | 20 +- src/xine-engine/audio_out.c | 18 +- src/xine-engine/audio_out.h | 48 +- src/xine-engine/configfile.c | 392 +++++------ src/xine-engine/configfile.h | 113 +-- src/xine-engine/events.c | 8 +- src/xine-engine/load_plugins.c | 1437 ++++++++++++++++---------------------- src/xine-engine/metronom.c | 12 +- src/xine-engine/osd.c | 9 +- src/xine-engine/plugin_catalog.h | 71 ++ src/xine-engine/tvmode.c | 650 ++++------------- src/xine-engine/video_decoder.c | 7 +- src/xine-engine/video_out.c | 80 ++- src/xine-engine/video_out.h | 77 +- src/xine-engine/video_overlay.c | 11 +- src/xine-engine/vo_scale.c | 52 +- src/xine-engine/vo_scale.h | 14 +- src/xine-engine/xine.c | 536 +++++++------- src/xine-engine/xine_interface.c | 318 +++++++++ src/xine-engine/xine_internal.h | 461 ++---------- src/xine-engine/xine_plugin.h | 68 ++ src/xine-utils/Makefile.am | 2 +- src/xine-utils/list.c | 205 ++++++ src/xine-utils/memcpy.c | 23 +- src/xine-utils/xineutils.h | 76 +- 108 files changed, 3707 insertions(+), 4012 deletions(-) delete mode 100644 src/video_out/video_out_x11.h create mode 100644 src/xine-engine/plugin_catalog.h create mode 100644 src/xine-engine/xine_interface.c create mode 100644 src/xine-engine/xine_plugin.h create mode 100644 src/xine-utils/list.c (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index fd276ba9d..5db74b169 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton * * - * $Id: audio_alsa_out.c,v 1.75 2002/07/31 06:29:08 pmhahn Exp $ + * $Id: audio_alsa_out.c,v 1.76 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -72,7 +72,7 @@ typedef struct alsa_driver_s { - ao_driver_t ao_driver; + xine_ao_driver_t ao_driver; config_values_t *config; @@ -154,7 +154,7 @@ static long ao_alsa_get_volume_from_percent(int val, long min, long max) /* * open the audio device for writing to */ -static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) +static int ao_alsa_open(xine_ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) { alsa_driver_t *this = (alsa_driver_t *) this_gen; config_values_t *config = this->config; @@ -180,7 +180,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "default", _("device used for mono output"), NULL, - NULL, + 10, NULL, NULL); break; case AO_CAP_MODE_STEREO: @@ -190,7 +190,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "default", _("device used for stereo output"), NULL, - NULL, + 10, NULL, NULL); break; case AO_CAP_MODE_4CHANNEL: @@ -200,7 +200,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "surround40", _("device used for 4-channel output"), NULL, - NULL, + 10, NULL, NULL); break; case AO_CAP_MODE_5CHANNEL: @@ -210,7 +210,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "surround51", _("device used for 5-channel output"), NULL, - NULL, + 10, NULL, NULL); break; case AO_CAP_MODE_5_1CHANNEL: @@ -220,7 +220,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "surround51", _("device used for 5.1-channel output"), NULL, - NULL, + 10, NULL, NULL); break; case AO_CAP_MODE_A52: @@ -231,7 +231,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int "iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2", _("device used for 5.1-channel output"), NULL, - NULL, + 10, NULL, NULL); break; default: @@ -388,7 +388,7 @@ __close: /* * Return the number of audio channels */ -static int ao_alsa_num_channels(ao_driver_t *this_gen) +static int ao_alsa_num_channels(xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; return this->num_channels; @@ -397,7 +397,7 @@ static int ao_alsa_num_channels(ao_driver_t *this_gen) /* * Return the number of bytes per frame */ -static int ao_alsa_bytes_per_frame(ao_driver_t *this_gen) +static int ao_alsa_bytes_per_frame(xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; return this->bytes_per_frame; @@ -406,7 +406,7 @@ static int ao_alsa_bytes_per_frame(ao_driver_t *this_gen) /* * Return gap tolerance (in pts) */ -static int ao_alsa_get_gap_tolerance (ao_driver_t *this_gen) +static int ao_alsa_get_gap_tolerance (xine_ao_driver_t *this_gen) { return GAP_TOLERANCE; } @@ -414,7 +414,7 @@ static int ao_alsa_get_gap_tolerance (ao_driver_t *this_gen) /* * Return the delay. is frames measured by looking at pending samples */ -static int ao_alsa_delay (ao_driver_t *this_gen) +static int ao_alsa_delay (xine_ao_driver_t *this_gen) { snd_pcm_status_t *pcm_stat; snd_pcm_sframes_t delay; @@ -459,7 +459,7 @@ static void xrun(alsa_driver_t *this) /* * Write audio data to output buffer (blocking) */ -static int ao_alsa_write(ao_driver_t *this_gen,int16_t *data, uint32_t count) +static int ao_alsa_write(xine_ao_driver_t *this_gen,int16_t *data, uint32_t count) { snd_pcm_sframes_t result; uint8_t *buffer=(uint8_t *)data; @@ -486,7 +486,7 @@ static int ao_alsa_write(ao_driver_t *this_gen,int16_t *data, uint32_t count) /* * This is called when the decoder no longer uses the audio */ -static void ao_alsa_close(ao_driver_t *this_gen) +static void ao_alsa_close(xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; if(this->audio_fd) snd_pcm_close(this->audio_fd); @@ -497,7 +497,7 @@ static void ao_alsa_close(ao_driver_t *this_gen) /* * Find out what output modes + capatilities are supported */ -static uint32_t ao_alsa_get_capabilities (ao_driver_t *this_gen) { +static uint32_t ao_alsa_get_capabilities (xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; return this->capabilities; } @@ -505,7 +505,7 @@ static uint32_t ao_alsa_get_capabilities (ao_driver_t *this_gen) { /* * Shut down audio output driver plugin and free all resources allocated */ -static void ao_alsa_exit(ao_driver_t *this_gen) +static void ao_alsa_exit(xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; void *p; @@ -532,7 +532,7 @@ static void ao_alsa_exit(ao_driver_t *this_gen) /* * Get a property of audio driver */ -static int ao_alsa_get_property (ao_driver_t *this_gen, int property) { +static int ao_alsa_get_property (xine_ao_driver_t *this_gen, int property) { alsa_driver_t *this = (alsa_driver_t *) this_gen; int err; @@ -576,7 +576,7 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) { /* * Set a property of audio driver */ -static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) { +static int ao_alsa_set_property (xine_ao_driver_t *this_gen, int property, int value) { alsa_driver_t *this = (alsa_driver_t *) this_gen; int err; @@ -647,7 +647,7 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) /* * Misc control operations */ -static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { +static int ao_alsa_ctrl(xine_ao_driver_t *this_gen, int cmd, ...) { alsa_driver_t *this = (alsa_driver_t *) this_gen; int result; @@ -712,7 +712,7 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { /* * Initialize mixer */ -static void ao_alsa_mixer_init(ao_driver_t *this_gen) { +static void ao_alsa_mixer_init(xine_ao_driver_t *this_gen) { alsa_driver_t *this = (alsa_driver_t *) this_gen; config_values_t *config = this->config; char *pcm_device; @@ -733,7 +733,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { "default", _("device used for mono output"), NULL, - NULL, + 10, NULL, NULL); if ((err = snd_ctl_open (&ctl_handle, pcm_device, 0)) < 0) { @@ -860,14 +860,12 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { config->update_string(config, "audio.alsa_mixer_name", "PCM"); } - config->save(config); - this->mixer.name = config->register_string(config, "audio.alsa_mixer_name", "PCM", _("alsa mixer device"), NULL, - NULL, + 10, NULL, NULL); goto __again; @@ -903,67 +901,68 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { /* * Initialize plugin */ -ao_driver_t *init_audio_out_plugin (config_values_t *config) { +void *init_audio_out_plugin (xine_t *xine, void *data) { - alsa_driver_t *this; - int err; - char *pcm_device; + config_values_t *config = xine->config; + alsa_driver_t *this; + int err; + char *pcm_device; snd_pcm_hw_params_t *params; this = (alsa_driver_t *) malloc (sizeof (alsa_driver_t)); snd_pcm_hw_params_alloca(¶ms); /* Fill the .xinerc file with options */ pcm_device = config->register_string(config, - "audio.alsa_default_device", - "default", - _("device used for mono output"), - NULL, - NULL, - NULL); + "audio.alsa_default_device", + "default", + _("device used for mono output"), + NULL, + 10, NULL, + NULL); pcm_device = config->register_string(config, - "audio.alsa_front_device", - "default", - _("device used for stereo output"), - NULL, - NULL, - NULL); + "audio.alsa_front_device", + "default", + _("device used for stereo output"), + NULL, + 10, NULL, + NULL); pcm_device = config->register_string(config, - "audio.alsa_surround40_device", - "surround40", - _("device used for 4-channel output"), - NULL, - NULL, - NULL); + "audio.alsa_surround40_device", + "surround40", + _("device used for 4-channel output"), + NULL, + 10, NULL, + NULL); pcm_device = config->register_string(config, - "audio.alsa_surround50_device", - "surround51", - _("device used for 5-channel output"), - NULL, - NULL, - NULL); + "audio.alsa_surround50_device", + "surround51", + _("device used for 5-channel output"), + NULL, + 10, NULL, + NULL); pcm_device = config->register_string(config, - "audio.alsa_surround51_device", - "surround51", - _("device used for 5.1-channel output"), - NULL, - NULL, - NULL); + "audio.alsa_surround51_device", + "surround51", + _("device used for 5.1-channel output"), + NULL, + 10, NULL, + NULL); pcm_device = config->register_string(config, - "audio.alsa_a52_device", - "iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2", - _("device used for 5.1-channel output"), - NULL, - NULL, - NULL); + "audio.alsa_a52_device", + "iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2", + _("device used for 5.1-channel output"), + NULL, + 10, NULL, + NULL); /* Use the default device to open first */ pcm_device = config->register_string(config, - "audio.alsa_default_device", - "default", - _("device used for mono output"), - NULL, - NULL, - NULL); + "audio.alsa_default_device", + "default", + _("device used for mono output"), + NULL, + 10, NULL, + NULL); /* * find best device driver/channel @@ -1014,7 +1013,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { 0, _("used to inform xine about what the sound card can do"), NULL, - NULL, + 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_4CHANNEL; printf ("4-channel "); @@ -1027,7 +1026,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { 0, _("used to inform xine about what the sound card can do"), NULL, - NULL, + 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5CHANNEL; printf ("5-channel "); @@ -1040,7 +1039,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { 0, _("used to inform xine about what the sound card can do"), NULL, - NULL, + 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; printf ("5.1-channel "); @@ -1058,7 +1057,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { 0, _("used to inform xine about what the sound card can do"), NULL, - NULL, + 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; @@ -1077,7 +1076,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { "PCM", _("alsa mixer device"), NULL, - NULL, + 10, NULL, NULL); pthread_mutex_init(&this->mixer.mutex, NULL); @@ -1099,16 +1098,23 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { return &this->ao_driver; } -static ao_info_t ao_info_alsa9 = { - AO_OUT_ALSA_IFACE_VERSION, - "alsa09", - NULL, - 11 +static ao_info_t ao_info_alsa = { + "xine audio output plugin using alsa-compliant audio devices/drivers", + 10 }; ao_info_t *get_audio_out_plugin_info() { - ao_info_alsa9.description = _("xine audio output plugin using alsa-compliant audio devices/drivers"); - return &ao_info_alsa9; + ao_info_alsa.description = _("xine audio output plugin using alsa-compliant audio devices/drivers"); + return &ao_info_alsa; } +/* + * 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_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index 4d0530fbd..f90d01bd5 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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_arts_out.c,v 1.13 2002/06/12 12:22:26 f1rmb Exp $ + * $Id: audio_arts_out.c,v 1.14 2002/09/04 23:31:07 guenter Exp $ */ /* required for swab() */ @@ -50,7 +50,7 @@ typedef struct arts_driver_s { - ao_driver_t ao_driver; + xine_ao_driver_t ao_driver; arts_stream_t audio_stream; int capabilities; @@ -95,7 +95,7 @@ static void ao_arts_volume(void *buffer, int length, int left, int right) /* * open the audio device for writing to */ -static int ao_arts_open(ao_driver_t *this_gen, +static int ao_arts_open(xine_ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -154,24 +154,24 @@ static int ao_arts_open(ao_driver_t *this_gen, } -static int ao_arts_num_channels(ao_driver_t *this_gen) +static int ao_arts_num_channels(xine_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) +static int ao_arts_bytes_per_frame(xine_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) +static int ao_arts_get_gap_tolerance (xine_ao_driver_t *this_gen) { return GAP_TOLERANCE; } -static int ao_arts_write(ao_driver_t *this_gen, int16_t *data, +static int ao_arts_write(xine_ao_driver_t *this_gen, int16_t *data, uint32_t num_frames) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -184,7 +184,7 @@ static int ao_arts_write(ao_driver_t *this_gen, int16_t *data, } -static int ao_arts_delay (ao_driver_t *this_gen) +static int ao_arts_delay (xine_ao_driver_t *this_gen) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -197,7 +197,7 @@ static int ao_arts_delay (ao_driver_t *this_gen) return this->latency * this->sample_rate / 1000; } -static void ao_arts_close(ao_driver_t *this_gen) +static void ao_arts_close(xine_ao_driver_t *this_gen) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -207,12 +207,12 @@ static void ao_arts_close(ao_driver_t *this_gen) } } -static uint32_t ao_arts_get_capabilities (ao_driver_t *this_gen) { +static uint32_t ao_arts_get_capabilities (xine_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) +static void ao_arts_exit(xine_ao_driver_t *this_gen) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -225,7 +225,7 @@ static void ao_arts_exit(ao_driver_t *this_gen) /* * */ -static int ao_arts_get_property (ao_driver_t *this_gen, int property) { +static int ao_arts_get_property (xine_ao_driver_t *this_gen, int property) { arts_driver_t *this = (arts_driver_t *) this_gen; @@ -246,7 +246,7 @@ static int ao_arts_get_property (ao_driver_t *this_gen, int property) { /* * */ -static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) { +static int ao_arts_set_property (xine_ao_driver_t *this_gen, int property, int value) { arts_driver_t *this = (arts_driver_t *) this_gen; int mute = (value) ? 1 : 0; @@ -279,7 +279,7 @@ static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) /* * */ -static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) { +static int ao_arts_ctrl(xine_ao_driver_t *this_gen, int cmd, ...) { /*arts_driver_t *this = (arts_driver_t *) this_gen;*/ switch (cmd) { @@ -298,9 +298,10 @@ static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) { } -ao_driver_t *init_audio_out_plugin (config_values_t *config) { +void *init_audio_out_plugin (xine_t *xine, void *data) { - arts_driver_t *this; + /* config_values_t *config = xine->config; */ + arts_driver_t *this; int rc; this = (arts_driver_t *) malloc (sizeof (arts_driver_t)); @@ -345,13 +346,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->ao_driver.get_gap_tolerance = ao_arts_get_gap_tolerance; this->ao_driver.control = ao_arts_ctrl; - return &this->ao_driver; + return this; } static ao_info_t ao_info_arts = { - AO_OUT_ARTS_IFACE_VERSION, - "arts", - NULL, + "xine audio output plugin using arts-compliant audio devices/drivers", 5 }; @@ -360,3 +359,13 @@ ao_info_t *get_audio_out_plugin_info() { return &ao_info_arts; } +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_ARTS_IFACE_VERSION, "arts", XINE_VERSION_CODE, &ao_info_arts, init_audio_out_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 3ac872a69..ab489f471 100644 --- a/src/audio_out/audio_esd_out.c +++ b/src/audio_out/audio_esd_out.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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_esd_out.c,v 1.19 2002/06/12 12:22:26 f1rmb Exp $ + * $Id: audio_esd_out.c,v 1.20 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -45,7 +45,7 @@ typedef struct esd_driver_s { - ao_driver_t ao_driver; + xine_ao_driver_t ao_driver; int audio_fd; int capabilities; @@ -76,7 +76,7 @@ typedef struct esd_driver_s { /* * connect to esd */ -static int ao_esd_open(ao_driver_t *this_gen, +static int ao_esd_open(xine_ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) { esd_driver_t *this = (esd_driver_t *) this_gen; @@ -139,20 +139,20 @@ static int ao_esd_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_esd_num_channels(ao_driver_t *this_gen) +static int ao_esd_num_channels(xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; return this->num_channels; } -static int ao_esd_bytes_per_frame(ao_driver_t *this_gen) +static int ao_esd_bytes_per_frame(xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; return this->bytes_per_frame; } -static int ao_esd_delay(ao_driver_t *this_gen) +static int ao_esd_delay(xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; int bytes_left; @@ -178,7 +178,7 @@ static int ao_esd_delay(ao_driver_t *this_gen) return bytes_left / this->bytes_per_frame; } -static int ao_esd_write(ao_driver_t *this_gen, +static int ao_esd_write(xine_ao_driver_t *this_gen, int16_t* frame_buffer, uint32_t num_frames) { @@ -214,24 +214,24 @@ static int ao_esd_write(ao_driver_t *this_gen, return 1; } -static void ao_esd_close(ao_driver_t *this_gen) +static void ao_esd_close(xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; esd_close(this->audio_fd); this->audio_fd = -1; } -static uint32_t ao_esd_get_capabilities (ao_driver_t *this_gen) { +static uint32_t ao_esd_get_capabilities (xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; return this->capabilities; } -static int ao_esd_get_gap_tolerance (ao_driver_t *this_gen) { +static int ao_esd_get_gap_tolerance (xine_ao_driver_t *this_gen) { /* esd_driver_t *this = (esd_driver_t *) this_gen; */ return GAP_TOLERANCE; } -static void ao_esd_exit(ao_driver_t *this_gen) +static void ao_esd_exit(xine_ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; @@ -243,7 +243,7 @@ static void ao_esd_exit(ao_driver_t *this_gen) free (this); } -static int ao_esd_get_property (ao_driver_t *this_gen, int property) { +static int ao_esd_get_property (xine_ao_driver_t *this_gen, int property) { esd_driver_t *this = (esd_driver_t *) this_gen; int mixer_fd; esd_player_info_t *esd_pi; @@ -281,7 +281,7 @@ static int ao_esd_get_property (ao_driver_t *this_gen, int property) { return 0; } -static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) { +static int ao_esd_set_property (xine_ao_driver_t *this_gen, int property, int value) { esd_driver_t *this = (esd_driver_t *) this_gen; int mixer_fd; @@ -343,8 +343,8 @@ static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) return ~value; } -static int ao_esd_ctrl(ao_driver_t *this_gen, int cmd, ...) { - esd_driver_t *this = (esd_driver_t *) this_gen; +static int ao_esd_ctrl(xine_ao_driver_t *this_gen, int cmd, ...) { + /* esd_driver_t *this = (esd_driver_t *) this_gen; */ switch (cmd) { @@ -362,11 +362,12 @@ static int ao_esd_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -ao_driver_t *init_audio_out_plugin (config_values_t *config) { +void *init_audio_out_plugin (xine_t *xine, void *data) { - esd_driver_t *this; - int audio_fd; - sigset_t vo_mask, vo_mask_orig; + config_values_t *config = xine->config; + esd_driver_t *this; + int audio_fd; + sigset_t vo_mask, vo_mask_orig; /* * open stream to ESD server @@ -412,7 +413,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->latency = config->register_range (config, "audio.esd_latency", 30000, -30000, 90000, _("esd audio output latency (adjust a/v sync)"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->ao_driver.get_capabilities = ao_esd_get_capabilities; this->ao_driver.get_property = ao_esd_get_property; @@ -427,14 +428,12 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->ao_driver.exit = ao_esd_exit; this->ao_driver.control = ao_esd_ctrl; - return &this->ao_driver; + return this; } static ao_info_t ao_info_esd = { - AO_OUT_ESD_IFACE_VERSION, - "esd", - NULL, - 5 + "xine audio output plugin using esd", + 4 }; ao_info_t *get_audio_out_plugin_info() { @@ -442,3 +441,12 @@ ao_info_t *get_audio_out_plugin_info() { return &ao_info_esd; } +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_ESD_IFACE_VERSION, "esd", XINE_VERSION_CODE, &ao_info_esd, init_audio_out_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c index a116033d2..5b8191c16 100644 --- a/src/audio_out/audio_irixal_out.c +++ b/src/audio_out/audio_irixal_out.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -17,13 +17,16 @@ * 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.7 2002/06/12 12:22:27 f1rmb Exp $ + * $Id: audio_irixal_out.c,v 1.8 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#warning DISABLED: FIXME +#if 0 + #include #include #include @@ -395,14 +398,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) this->ao_driver.get_gap_tolerance = ao_irixal_get_gap_tolerance; this->ao_driver.control = ao_irixal_ctrl; - return &this->ao_driver; + return this; } -static ao_info_t ao_info_irixal = -{ - AO_IRIXAL_IFACE_VERSION, - "irixal", - NULL, +static ao_info_t ao_info_irixal = { + "xine audio output plugin using IRIX libaudio", 10 }; @@ -412,3 +412,15 @@ ao_info_t *get_audio_out_plugin_info() return &ao_info_irixal; } +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_IRIXAL_IFACE_VERSION, "irixal", XINE_VERSION_CODE, &ao_info_irixal, init_audio_out_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + + +#endif diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 429e084ae..d03ce62ad 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.71 2002/07/05 20:54:37 miguelfreitas Exp $ + * $Id: audio_oss_out.c,v 1.72 2002/09/04 23:31:07 guenter Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -108,7 +108,7 @@ typedef struct oss_driver_s { - ao_driver_t ao_driver; + xine_ao_driver_t ao_driver; char audio_dev[20]; int audio_fd; int capabilities; @@ -141,7 +141,7 @@ typedef struct oss_driver_s { /* * open the audio device for writing to */ -static int ao_oss_open(ao_driver_t *this_gen, +static int ao_oss_open(xine_ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) { oss_driver_t *this = (oss_driver_t *) this_gen; @@ -322,27 +322,27 @@ static int ao_oss_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_oss_num_channels(ao_driver_t *this_gen) { +static int ao_oss_num_channels(xine_ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; return this->num_channels; } -static int ao_oss_bytes_per_frame(ao_driver_t *this_gen) { +static int ao_oss_bytes_per_frame(xine_ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; return this->bytes_per_frame; } -static int ao_oss_get_gap_tolerance (ao_driver_t *this_gen){ +static int ao_oss_get_gap_tolerance (xine_ao_driver_t *this_gen){ /* oss_driver_t *this = (oss_driver_t *) this_gen; */ return GAP_TOLERANCE; } -static int ao_oss_delay(ao_driver_t *this_gen) { +static int ao_oss_delay(xine_ao_driver_t *this_gen) { count_info info; oss_driver_t *this = (oss_driver_t *) this_gen; @@ -398,7 +398,7 @@ static int ao_oss_delay(ao_driver_t *this_gen) { * audio frames are equivalent one sample on each channel. * I.E. Stereo 16 bits audio frames are 4 bytes. */ -static int ao_oss_write(ao_driver_t *this_gen, +static int ao_oss_write(xine_ao_driver_t *this_gen, int16_t* frame_buffer, uint32_t num_frames) { oss_driver_t *this = (oss_driver_t *) this_gen; @@ -429,7 +429,7 @@ static int ao_oss_write(ao_driver_t *this_gen, return write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); } -static void ao_oss_close(ao_driver_t *this_gen) { +static void ao_oss_close(xine_ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; @@ -437,14 +437,14 @@ static void ao_oss_close(ao_driver_t *this_gen) { this->audio_fd = -1; } -static uint32_t ao_oss_get_capabilities (ao_driver_t *this_gen) { +static uint32_t ao_oss_get_capabilities (xine_ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; return this->capabilities; } -static void ao_oss_exit(ao_driver_t *this_gen) { +static void ao_oss_exit(xine_ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; @@ -454,7 +454,7 @@ static void ao_oss_exit(ao_driver_t *this_gen) { free (this); } -static int ao_oss_get_property (ao_driver_t *this_gen, int property) { +static int ao_oss_get_property (xine_ao_driver_t *this_gen, int property) { oss_driver_t *this = (oss_driver_t *) this_gen; int mixer_fd; @@ -498,7 +498,7 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { return 0; } -static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) { +static int ao_oss_set_property (xine_ao_driver_t *this_gen, int property, int value) { oss_driver_t *this = (oss_driver_t *) this_gen; int mixer_fd; @@ -582,7 +582,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) return ~value; } -static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { +static int ao_oss_ctrl(xine_ao_driver_t *this_gen, int cmd, ...) { oss_driver_t *this = (oss_driver_t *) this_gen; switch (cmd) { @@ -611,9 +611,10 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -ao_driver_t *init_audio_out_plugin (config_values_t *config) { +void *init_audio_out_plugin (xine_t *xine, void *data) { - oss_driver_t *this; + config_values_t *config = xine->config; + oss_driver_t *this; int caps; #ifdef CONFIG_DEVFS_FS char devname[] = "/dev/sound/dsp\0\0\0"; @@ -638,7 +639,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { best_rate = 0; devnum = config->register_num (config, "audio.oss_device_num", -1, _("/dev/dsp# device to use for oss output, -1 => auto_detect"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); if (devnum >= 0) { sprintf (this->audio_dev, DSP_TEMPLATE, devnum); @@ -706,7 +707,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->sync_method = config->register_enum (config, "audio.oss_sync_method", OSS_SYNC_AUTO_DETECT, sync_methods, _("A/V sync method to use by OSS, depends on driver/hardware"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); if (this->sync_method == OSS_SYNC_AUTO_DETECT) { @@ -774,7 +775,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { -3000, 3000, _("Adjust a/v sync for OSS softsync"), _("Use this to manually adjust a/v sync if you're using softsync"), - NULL, NULL); + 10, NULL, NULL); this->capabilities = 0; @@ -800,7 +801,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { if ( (status != -1) && (num_channels==4) ) { if (config->register_bool (config, "audio.four_channel", 0, _("Enable 4.0 channel analog surround output"), - NULL, NULL, NULL)) { + NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_4CHANNEL; printf ("4-channel "); } else @@ -811,7 +812,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { if ( (status != -1) && (num_channels==5) ) { if (config->register_bool (config, "audio.five_channel", 0, _("Enable 5.0 channel analog surround output"), - NULL, NULL, NULL)) { + NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5CHANNEL; printf ("5-channel "); } else @@ -822,7 +823,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { if ( (status != -1) && (num_channels==6) ) { if (config->register_bool (config, "audio.five_lfe_channel", 0, _("Enable 5.1 channel analog surround output"), - NULL, NULL, NULL)) { + NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; printf ("5.1-channel "); } else @@ -833,7 +834,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { if (caps & AFMT_AC3) { if (config->register_bool (config, "audio.a52_pass_through", 0, _("Enable A52 / AC5 digital audio output via spdif"), - NULL, NULL, NULL)) { + NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; printf ("a/52-pass-through "); @@ -848,7 +849,8 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { */ this->mixer.name = config->register_string(config, "audio.mixer_name", "/dev/mixer", - _("oss mixer device"), NULL, NULL, NULL); + _("oss mixer device"), NULL, + 10, NULL, NULL); { int mixer_fd; int audio_devs; @@ -909,13 +911,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->ao_driver.get_gap_tolerance = ao_oss_get_gap_tolerance; this->ao_driver.control = ao_oss_ctrl; - return &this->ao_driver; + return this; } static ao_info_t ao_info_oss = { - AO_OUT_OSS_IFACE_VERSION, - "oss", - NULL, + "xine audio output plugin using oss-compliant audio devices/drivers", 10 }; @@ -923,3 +923,13 @@ ao_info_t *get_audio_out_plugin_info() { ao_info_oss.description = _("xine audio output plugin using oss-compliant audio devices/drivers"); return &ao_info_oss; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_OSS_IFACE_VERSION, "oss", XINE_VERSION_CODE, &ao_info_oss, init_audio_out_plugin }, + { 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 944b91b60..b5af274c8 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2001 the xine project + * Copyright (C) 2001-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -17,13 +17,16 @@ * 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.20 2002/06/12 12:22:28 f1rmb Exp $ + * $Id: audio_sun_out.c,v 1.21 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#warning DISABLED: FIXME +#if 0 + #include #include #include @@ -734,13 +737,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->ao_driver.get_gap_tolerance = ao_sun_get_gap_tolerance; this->ao_driver.control = ao_sun_ctrl; - return &this->ao_driver; + return this; } static ao_info_t ao_info_sun = { - AO_SUN_IFACE_VERSION, - "sun", - NULL, + "xine audio output plugin using sun-compliant audio devices/drivers", 10 }; @@ -749,3 +750,16 @@ ao_info_t *get_audio_out_plugin_info() { return &ao_info_sun; } +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_OUT, AO_OUT_SUN_IFACE_VERSION, "sun", XINE_VERSION_CODE, &ao_info_sun, init_audio_out_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + + +#endif + diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index 6f0e4d1fa..ed656c67d 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -19,7 +19,7 @@ * * AIFF File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_aiff.c,v 1.1 2002/08/12 03:56:12 tmmm Exp $ + * $Id: demux_aiff.c,v 1.2 2002/09/04 23:31:07 guenter Exp $ * */ @@ -231,7 +231,7 @@ static int demux_aiff_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_aiff", VALID_ENDS, _("valid mrls ending for aiff demuxer"), - NULL, NULL, NULL))); + NULL, 10, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -494,7 +494,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_aiff", VALID_ENDS, _("valid mrls ending for aiff demuxer"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_aiff_open; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 363f01727..e849ef8a7 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.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_asf.c,v 1.53 2002/08/27 23:12:16 tmattern Exp $ + * $Id: demux_asf.c,v 1.54 2002/09/04 23:31:07 guenter Exp $ * * demultiplexer for asf streams * @@ -1406,7 +1406,7 @@ static int demux_asf_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_asf", VALID_ENDS, _("valid mrls ending for asf demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1439,18 +1439,10 @@ static int demux_asf_get_stream_length (demux_plugin_t *this_gen) { return this->length; } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +void *init_demuxer_plugin (xine_t *xine, void *data) { demux_asf_t *this; - if (iface != 10) { - printf (_("demux_asf: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_asf_t)); this->config = xine->config; this->xine = xine; @@ -1458,7 +1450,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_asf", VALID_ENDS, _("valid mrls ending for asf demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_asf_open; @@ -1474,5 +1466,16 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "asf", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 8175b9c1e..4e0ff1acc 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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_avi.c,v 1.107 2002/08/19 18:26:34 mroi Exp $ + * $Id: demux_avi.c,v 1.108 2002/09/04 23:31:07 guenter Exp $ * * demultiplexer for avi streams * @@ -1534,7 +1534,7 @@ static int demux_avi_open(demux_plugin_t *this_gen, this->config->register_string(this->config, "mrl.ends_avi", VALID_ENDS, _("valid mrls ending for avi demuxer"), - NULL, NULL, NULL)); + NULL, 20, NULL, NULL)); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1591,19 +1591,10 @@ static int demux_avi_get_stream_length (demux_plugin_t *this_gen) { return 0; } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin(xine_t *xine, void *data) { demux_avi_t *this; - if (iface != 10) { - xine_log (xine, XINE_LOG_PLUGIN, - _("demux_avi: this plugin doesn't support plugin API version %d.\n" - "demux_avi: this means there's a version mismatch between xine and this " - "demux_avi: demuxer plugin.\nInstalling current demuxer plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_avi_t)); this->config = xine->config; this->xine = xine; @@ -1611,7 +1602,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_avi", VALID_ENDS, _("valid mrls ending for avi demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_avi_open; @@ -1627,5 +1618,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "avi", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index bd1a04e59..4063a71d5 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.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_elem.c,v 1.49 2002/07/14 22:27:25 miguelfreitas Exp $ + * $Id: demux_elem.c,v 1.50 2002/09/04 23:31:07 guenter Exp $ * * demultiplexer for elementary mpeg streams * @@ -315,7 +315,7 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_elem", VALID_ENDS, _("valid mrls ending for elementary demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -357,21 +357,11 @@ static void demux_mpeg_elem_close (demux_plugin_t *this) { static int demux_mpeg_elem_get_stream_length(demux_plugin_t *this_gen) { return 0 ; /*FIXME: implement */ } -/* - * - */ -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { + +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_mpeg_elem_t *this; - if (iface != 10) { - printf (_("demux_elem: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_mpeg_elem_t)); this->config = xine->config; this->xine = xine; @@ -379,7 +369,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_elem", VALID_ENDS, _("valid mrls ending for elementary demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUX_MPEG_ELEM_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_elem_open; @@ -395,5 +385,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return &this->demux_plugin; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "elem", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index 4230c04d0..412d89614 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.21 2002/08/02 13:00:13 tmmm Exp $ + * $Id: demux_film.c,v 1.22 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -527,7 +527,7 @@ static int demux_film_open(demux_plugin_t *this_gen, input_plugin_t *input, (this->config->register_string(this->config, "mrl.ends_film", VALID_ENDS, _("valid mrls ending for film demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -802,7 +802,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_film", VALID_ENDS, _("valid mrls ending for film demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_film_open; diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index af3776da7..fab3a1593 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -22,7 +22,7 @@ * avoid while programming a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_fli.c,v 1.6 2002/08/31 18:20:50 mroi Exp $ + * $Id: demux_fli.c,v 1.7 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -225,7 +225,7 @@ static int demux_fli_open(demux_plugin_t *this_gen, input_plugin_t *input, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_fli", VALID_ENDS, "valid mrls ending for fli demuxer", - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -419,7 +419,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_fli", VALID_ENDS, "valid mrls ending for fli demuxer", - NULL, NULL, NULL); + NULL, 10, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_fli_open; diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 00face10f..2c42b1895 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -63,7 +63,7 @@ * - if any bytes exceed 63, do not shift the bytes at all before * transmitting them to the video decoder * - * $Id: demux_idcin.c,v 1.6 2002/09/01 14:06:23 tmmm Exp $ + * $Id: demux_idcin.c,v 1.7 2002/09/04 23:31:07 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -385,7 +385,7 @@ static int demux_idcin_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_idcin", VALID_ENDS, _("valid mrls ending for idcin demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -604,7 +604,8 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_idcin", VALID_ENDS, - _("valid mrls ending for idcin demuxer"), NULL, NULL, NULL); + _("valid mrls ending for idcin demuxer"), + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_idcin_open; diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index aec9789ae..8347d2de7 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.73 2002/09/04 10:44:44 mroi Exp $ + * $Id: demux_mpeg.c,v 1.74 2002/09/04 23:31:07 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -1062,7 +1062,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, this->config->register_string(this->config, "mrl.mrls_mpeg", VALID_MRLS, _("valid mrls for mpeg demuxer"), - NULL, NULL, NULL)); + NULL, 20, NULL, NULL)); media = strstr(MRL, "://"); if (media) { @@ -1095,7 +1095,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, this->config->register_string(this->config, "mrl.ends_mpeg", VALID_ENDS, _("valid mrls ending for mpeg demuxer"), - NULL, NULL, NULL)); + NULL, 20, NULL, NULL)); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1140,18 +1140,10 @@ static int demux_mpeg_get_stream_length (demux_plugin_t *this_gen) { } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_mpeg_t *this; - if (iface != 10) { - printf (_("demux_mpeg: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_mpeg_t)); this->config = xine->config; this->xine = xine; @@ -1159,11 +1151,11 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { /* Calling register_string() configure valid mrls in configfile */ (void*) this->config->register_string(this->config, "mrl.mrls_mpeg", VALID_MRLS, _("valid mrls for mpeg demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); (void*) this->config->register_string(this->config, "mrl.ends_mpeg", VALID_ENDS, _("valid mrls ending for mpeg demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_open; @@ -1179,5 +1171,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "mpeg", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 3cc9efa3b..fb2992b79 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.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_block.c,v 1.110 2002/08/07 20:50:45 miguelfreitas Exp $ + * $Id: demux_mpeg_block.c,v 1.111 2002/09/04 23:31:07 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -1099,7 +1099,7 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, xine_strdupa(valid_mrls, (this->config->register_string(this->config, "mrl.mrls_mpeg_block", VALID_MRLS, _("valid mrls for mpeg block demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); MRL = input->get_mrl (input); @@ -1140,7 +1140,7 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_mpeg_block", VALID_ENDS, _("valid mrls ending for mpeg block demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1184,18 +1184,10 @@ static int demux_mpeg_block_get_stream_length (demux_plugin_t *this_gen) { } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_mpeg_block_t *this; - if (iface != 10) { - printf (_("demux_mpeg_block: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_mpeg_block_t)); this->config = xine->config; this->xine = xine; @@ -1203,11 +1195,11 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { /* Calling register_string() configure valid mrls in configfile */ (void*) this->config->register_string(this->config, "mrl.mrls_mpeg_block", VALID_MRLS, _("valid mrls for mpeg block demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); (void*) this->config->register_string(this->config, "mrl.ends_mpeg_block", VALID_ENDS, _("valid mrls ending for mpeg block demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_block_open; @@ -1224,5 +1216,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "mpeg_block", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 407c90602..ec9b8c02d 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.58 2002/08/30 14:19:48 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.59 2002/09/04 23:31:08 guenter Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -605,7 +605,7 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_mgaudio", VALID_ENDS, _("valid mrls ending for mpeg audio demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -653,18 +653,10 @@ static int demux_mpgaudio_get_stream_length (demux_plugin_t *this_gen) { } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_mpgaudio_t *this; - if (iface != 10) { - printf (_("demux_mpeg: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_mpgaudio_t)); this->config = xine->config; this->xine = xine; @@ -672,7 +664,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_mgaudio", VALID_ENDS, _("valid mrls ending for mpeg audio demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUX_MPGAUDIO_IFACE_VERSION; this->demux_plugin.open = demux_mpgaudio_open; @@ -688,5 +680,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return &this->demux_plugin; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "mp3", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 0f47eb773..d3deffede 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.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_ogg.c,v 1.39 2002/09/01 20:50:57 guenter Exp $ + * $Id: demux_ogg.c,v 1.40 2002/09/04 23:31:08 guenter Exp $ * * demultiplexer for ogg streams * @@ -1038,7 +1038,7 @@ static int demux_ogg_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_ogg", VALID_ENDS, _("valid mrls ending for ogg demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1073,18 +1073,10 @@ static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) { return 0; } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_ogg_t *this; - if (iface != 10) { - printf( _("demux_ogg: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_ogg_t)); this->config = xine->config; this->xine = xine; @@ -1092,7 +1084,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_ogg", VALID_ENDS, _("valid mrls ending for ogg demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_ogg_open; @@ -1108,5 +1100,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "ogg", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c index 5b54db737..931f3bad4 100644 --- a/src/demuxers/demux_pes.c +++ b/src/demuxers/demux_pes.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_pes.c,v 1.34 2002/07/14 22:27:25 miguelfreitas Exp $ + * $Id: demux_pes.c,v 1.35 2002/09/04 23:31:08 guenter Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -524,7 +524,7 @@ static int demux_pes_open(demux_plugin_t *this_gen, xine_strdupa(valid_mrls, (this->config->register_string(this->config, "mrl.mrls_pes", VALID_MRLS, _("valid mrls for pes demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); media = strstr(MRL, "://"); if(media) { @@ -554,7 +554,7 @@ static int demux_pes_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_pes", VALID_ENDS, _("valid mrls ending for pes demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -612,11 +612,11 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.mrls_pes", VALID_MRLS, _("valid mrls for pes demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); (void*) this->config->register_string(this->config, "mrl.ends_pes", VALID_ENDS, _("valid mrls ending for pes demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_pes_open; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 874becd3d..fe8922ae5 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.80 2002/08/02 13:00:12 tmmm Exp $ + * $Id: demux_qt.c,v 1.81 2002/09/04 23:31:08 guenter Exp $ * */ @@ -1445,7 +1445,7 @@ static int demux_qt_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_qt", VALID_ENDS, _("valid mrls ending for qt demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1750,18 +1750,10 @@ static int demux_qt_get_stream_length (demux_plugin_t *this_gen) { return this->qt->duration / this->qt->time_scale; } -demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { +static void *init_demuxer_plugin (xine_t *xine, void *data) { demux_qt_t *this; - if (iface != 10) { - printf (_("demux_qt: plugin doesn't support plugin API version %d.\n" - " this means there's a version mismatch between xine and this " - " demuxer plugin.\nInstalling current demux plugins should help.\n"), - iface); - return NULL; - } - this = xine_xmalloc (sizeof (demux_qt_t)); this->config = xine->config; this->xine = xine; @@ -1769,7 +1761,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_qt", VALID_ENDS, _("valid mrls ending for qt demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_qt_open; @@ -1785,5 +1777,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this->status = DEMUX_FINISHED; pthread_mutex_init( &this->mutex, NULL ); - return (demux_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 10, "mov", XINE_VERSION_CODE, NULL, init_demuxer_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index 2a9796a83..35188d113 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -21,7 +21,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_roq.c,v 1.10 2002/08/01 03:56:31 tmmm Exp $ + * $Id: demux_roq.c,v 1.11 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -291,7 +291,7 @@ static int demux_roq_open(demux_plugin_t *this_gen, input_plugin_t *input, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_roq", VALID_ENDS, _("valid mrls ending for roq demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -542,7 +542,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_roq", VALID_ENDS, _("valid mrls ending for roq demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_roq_open; diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index a9a8d5706..80566a6c4 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -21,7 +21,7 @@ * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.10 2002/09/03 02:44:01 tmmm Exp $ + * $Id: demux_smjpeg.c,v 1.11 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -296,7 +296,7 @@ static int demux_smjpeg_open(demux_plugin_t *this_gen, input_plugin_t *input, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_smjpeg", VALID_ENDS, _("valid mrls ending for smjpeg demuxer"), - NULL, NULL, NULL))); + NULL, 2, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -571,7 +571,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_smjpeg", VALID_ENDS, _("valid mrls ending for smjpeg demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_smjpeg_open; diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index c94fee5b6..9fce979f0 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -19,7 +19,7 @@ * * SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_snd.c,v 1.2 2002/09/01 04:30:04 tmmm Exp $ + * $Id: demux_snd.c,v 1.3 2002/09/04 23:31:08 guenter Exp $ * */ @@ -219,7 +219,8 @@ static int demux_snd_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_snd", VALID_ENDS, _("valid mrls ending for snd demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 10, NULL, NULL))); + while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -477,8 +478,9 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_snd", VALID_ENDS, - _("valid mrls ending for snd demuxer"), NULL, NULL, NULL); - + _("valid mrls ending for snd demuxer"), + NULL, 10, NULL, NULL); + this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_snd_open; this->demux_plugin.start = demux_snd_start; diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index c3bd029c8..c8b020999 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.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_ts.c,v 1.52 2002/07/05 17:32:01 mroi Exp $ + * $Id: demux_ts.c,v 1.53 2002/09/04 23:31:08 guenter Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -1463,7 +1463,7 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input, (this->config->register_string(this->config, "mrl.mrls_ts", VALID_MRLS, _("valid mrls for ts demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); mrl = input->get_mrl(input); media = strstr(mrl, "://"); @@ -1498,7 +1498,7 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input, (this->config->register_string(this->config, "mrl.ends_ts", VALID_ENDS, _("valid mrls ending for ts demuxer"), - NULL, NULL, NULL))); + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -1677,11 +1677,11 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.mrls_ts", VALID_MRLS, _("valid mrls for ts demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); (void*) this->config->register_string(this->config, "mrl.ends_ts", VALID_ENDS, _("valid mrls ending for ts demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->plugin.open = demux_ts_open; diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index f761f3123..6c9c74ac7 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -23,7 +23,7 @@ * It will only play that block if it is PCM data. More variations will be * supported as they are encountered. * - * $Id: demux_voc.c,v 1.2 2002/08/12 03:53:49 tmmm Exp $ + * $Id: demux_voc.c,v 1.3 2002/09/04 23:31:08 guenter Exp $ * */ @@ -218,7 +218,8 @@ static int demux_voc_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_voc", VALID_ENDS, _("valid mrls ending for voc demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 10, NULL, NULL))); + while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -470,7 +471,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_voc", VALID_ENDS, _("valid mrls ending for voc demuxer"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_voc_open; diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 6d720df99..256cf25b1 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -21,7 +21,7 @@ * For more information regarding the VQA file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_vqa.c,v 1.2 2002/09/02 17:27:16 tmmm Exp $ + * $Id: demux_vqa.c,v 1.3 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -297,7 +297,8 @@ static int demux_vqa_open(demux_plugin_t *this_gen, input_plugin_t *input, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_vqa", VALID_ENDS, _("valid mrls ending for vqa demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 10, NULL, NULL))); + while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -566,8 +567,9 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_vqa", VALID_ENDS, - _("valid mrls ending for vqa demuxer"), NULL, NULL, NULL); - + _("valid mrls ending for vqa demuxer"), + NULL, 10, NULL, NULL); + this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_vqa_open; this->demux_plugin.start = demux_vqa_start; diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index db64f285b..de4964390 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -20,7 +20,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.8 2002/08/02 13:11:25 tmmm Exp $ + * $Id: demux_wav.c,v 1.9 2002/09/04 23:31:08 guenter Exp $ * */ @@ -224,7 +224,7 @@ static int demux_wav_open(demux_plugin_t *this_gen, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_wav", VALID_ENDS, _("valid mrls ending for wav demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 20, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -480,7 +480,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void*) this->config->register_string(this->config, "mrl.ends_wav", VALID_ENDS, _("valid mrls ending for wav demuxer"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_wav_open; diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index b23af392c..0cd3fee35 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -22,7 +22,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.3 2002/09/04 02:43:48 tmmm Exp $ + * $Id: demux_wc3movie.c,v 1.4 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -363,7 +363,7 @@ static int demux_mve_open(demux_plugin_t *this_gen, input_plugin_t *input, xine_strdupa(valid_ends, (this->config->register_string(this->config, "mrl.ends_mve", VALID_ENDS, _("valid mrls ending for mve demuxer"), - NULL, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { + NULL, 10, NULL, NULL))); while((m = xine_strsep(&valid_ends, ",")) != NULL) { while(*m == ' ' || *m == '\t') m++; @@ -608,8 +608,9 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { (void *) this->config->register_string(this->config, "mrl.ends_mve", VALID_ENDS, - _("valid mrls ending for mve demuxer"), NULL, NULL, NULL); - + _("valid mrls ending for mve demuxer"), + NULL, 10, NULL, NULL); + this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_mve_open; this->demux_plugin.start = demux_mve_start; diff --git a/src/input/input_cda.c b/src/input/input_cda.c index 3c5981d87..dbf0d51fb 100644 --- a/src/input/input_cda.c +++ b/src/input/input_cda.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: input_cda.c,v 1.28 2002/07/05 17:32:01 mroi Exp $ + * $Id: input_cda.c,v 1.29 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -196,22 +196,22 @@ static void _cda_stop_cd(cdainfo_t *); /* * Callbacks for configuratoin changes. */ -static void device_change_cb(void *data, cfg_entry_t *cfg) { +static void device_change_cb(void *data, xine_cfg_entry_t *cfg) { cda_input_plugin_t *this = (cda_input_plugin_t *) data; this->cda->device_name = cfg->str_value; } -static void server_change_cb(void *data, cfg_entry_t *cfg) { +static void server_change_cb(void *data, xine_cfg_entry_t *cfg) { cda_input_plugin_t *this = (cda_input_plugin_t *) data; this->cddb.server = cfg->str_value; } -static void port_change_cb(void *data, cfg_entry_t *cfg) { +static void port_change_cb(void *data, xine_cfg_entry_t *cfg) { cda_input_plugin_t *this = (cda_input_plugin_t *) data; this->cddb.port = cfg->num_value; } -static void cachedir_change_cb(void *data, cfg_entry_t *cfg) { +static void cachedir_change_cb(void *data, xine_cfg_entry_t *cfg) { cda_input_plugin_t *this = (cda_input_plugin_t *) data; this->cddb.cache_dir = cfg->str_value; @@ -1429,7 +1429,7 @@ static buf_element_t *cda_plugin_read_block (input_plugin_t *this_gen, if(this->xine->speed != this->speed) { int old_status = this->cda->status; this->speed = this->xine->speed; - if((this->speed == SPEED_PAUSE) && this->cda->status == CDA_PLAY) { + if((this->speed == XINE_SPEED_PAUSE) && this->cda->status == CDA_PLAY) { _cda_pause_cd(this->cda); } else { @@ -1782,23 +1782,13 @@ static void cda_plugin_dispose (input_plugin_t *this_gen ) { /* * Initialize plugin. */ -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { cda_input_plugin_t *this; config_values_t *config; int i; _ENTER_FUNC(); - if (iface != 8) { - LOG_MSG(xine, - _("cda input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (cda_input_plugin_t *) xine_xmalloc(sizeof(cda_input_plugin_t)); config = xine->config; @@ -1840,22 +1830,22 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->cda->device_name = config->register_string(config, "input.cda_device", CDROM, _("path to your local cd audio device file"), - NULL, + NULL, 10, device_change_cb, (void *) this); this->cddb.server = config->register_string(config, "input.cda_cddb_server", CDDB_SERVER, - _("cddbp server name"), NULL, + _("cddbp server name"), NULL, 10, server_change_cb, (void *) this); this->cddb.port = config->register_num(config, "input.cda_cddb_port", CDDB_PORT, - _("cddbp server port"), NULL, + _("cddbp server port"), NULL, 10, port_change_cb, (void *) this); this->cddb.fd = -1; this->cddb.cache_dir = config->register_string(config, "input.cda_cddb_cachedir", (_cda_cddb_get_default_location()), - _("cddbp cache directory"), NULL, + _("cddbp cache directory"), NULL, 20, cachedir_change_cb, (void *) this); this->mrls = (mrl_t **) xine_xmalloc(sizeof(mrl_t*)); @@ -1865,3 +1855,14 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { return (input_plugin_t *) this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "cda", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 46d3a9a02..c2ea4d3bb 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,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: input_dvd.c,v 1.71 2002/09/04 10:48:36 mroi Exp $ + * $Id: input_dvd.c,v 1.72 2002/09/04 23:31:08 guenter Exp $ * */ @@ -171,7 +171,7 @@ static void flush_buffers(dvdnav_input_plugin_t *this); static void xine_dvdnav_send_button_update(dvdnav_input_plugin_t *this, int mode); /* Callback on device name change */ -static void device_change_cb(void *data, cfg_entry_t *cfg) { +static void device_change_cb(void *data, xine_cfg_entry_t *cfg) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t *) data; this->dvd_device = cfg->str_value; @@ -182,12 +182,12 @@ static uint32_t dvdnav_plugin_get_capabilities (input_plugin_t *this_gen) { return INPUT_CAP_AUTOPLAY | INPUT_CAP_BLOCK | INPUT_CAP_CLUT | #if CAN_SEEK - INPUT_CAP_SEEKABLE | INPUT_CAP_VARIABLE_BITRATE | + INPUT_CAP_SEEKABLE | INPUT_CAP_VARIABLE_BITRATE | #endif INPUT_CAP_AUDIOLANG | INPUT_CAP_SPULANG | INPUT_CAP_GET_DIR | INPUT_CAP_CHAPTERS; } -void read_ahead_cb(void *this_gen, cfg_entry_t *entry) { +void read_ahead_cb(void *this_gen, xine_cfg_entry_t *entry) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t*)this_gen; if(!this) @@ -199,7 +199,7 @@ void read_ahead_cb(void *this_gen, cfg_entry_t *entry) { dvdnav_set_readahead_flag(this->dvdnav, entry->num_value); } -void region_changed_cb(void *this_gen, cfg_entry_t *entry) { +void region_changed_cb (void *this_gen, xine_cfg_entry_t *entry) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t*)this_gen; if(!this) @@ -218,7 +218,7 @@ void region_changed_cb(void *this_gen, cfg_entry_t *entry) { } } -void language_changed_cb(void *this_gen, cfg_entry_t *entry) { +void language_changed_cb(void *this_gen, xine_cfg_entry_t *entry) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t*)this_gen; if(!this) @@ -385,7 +385,7 @@ static int dvdnav_plugin_open (input_plugin_t *this_gen, char *mrl) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t *) this_gen; dvdnav_status_t ret; char *intended_dvd_device; - cfg_entry_t *region_entry, *lang_entry, *cache_entry; + xine_cfg_entry_t *region_entry, *lang_entry, *cache_entry; trace_print("Called\n"); /* printf("input_dvd: open1: dvdnav=%p opened=%d\n",this->dvdnav, this->opened); */ @@ -507,22 +507,22 @@ static int dvdnav_plugin_open (input_plugin_t *this_gen, char *mrl) { /* Set region code */ - region_entry = this->config->lookup_entry(this->config, - "input.dvd_region"); + region_entry = xine_config_lookup_entry (this->xine, + "input.dvd_region"); if(region_entry) { region_changed_cb(this, region_entry); } /* Set languages */ - lang_entry = this->config->lookup_entry(this->config, - "input.dvdnav_language"); + lang_entry = xine_config_lookup_entry(this->xine, + "input.dvdnav_language"); if(lang_entry) { language_changed_cb(this, lang_entry); } /* Set cache usage */ - cache_entry = this->config->lookup_entry(this->config, - "input.dvdnav_use_readahead"); + cache_entry = xine_config_lookup_entry(this->xine, + "input.dvdnav_use_readahead"); if(cache_entry) { read_ahead_cb(this, cache_entry); } @@ -1384,129 +1384,122 @@ check_solaris_vold_device(dvdnav_input_plugin_t *this) } #endif -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { dvdnav_input_plugin_t *this; config_values_t *config = xine->config; void *dvdcss; trace_print("Called\n"); - switch (iface) { - case 8: - this = (dvdnav_input_plugin_t *) malloc (sizeof (dvdnav_input_plugin_t)); - - this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; - this->input_plugin.get_capabilities = dvdnav_plugin_get_capabilities; - this->input_plugin.open = dvdnav_plugin_open; - this->input_plugin.read = dvdnav_plugin_read; - this->input_plugin.read_block = dvdnav_plugin_read_block; - this->input_plugin.seek = dvdnav_plugin_seek; - this->input_plugin.get_current_pos = dvdnav_plugin_get_current_pos; - this->input_plugin.get_length = dvdnav_plugin_get_length; - this->input_plugin.get_blocksize = dvdnav_plugin_get_blocksize; - this->input_plugin.get_dir = dvdnav_plugin_get_dir; - this->input_plugin.eject_media = dvdnav_plugin_eject_media; - this->input_plugin.get_mrl = dvdnav_plugin_get_mrl; - this->input_plugin.stop = dvdnav_plugin_stop; - this->input_plugin.close = dvdnav_plugin_close; - this->input_plugin.get_description = dvdnav_plugin_get_description; - this->input_plugin.get_identifier = dvdnav_plugin_get_identifier; - this->input_plugin.get_autoplay_list = dvdnav_plugin_get_autoplay_list; - this->input_plugin.get_optional_data = dvdnav_plugin_get_optional_data; - this->input_plugin.is_branch_possible = NULL; - this->input_plugin.dispose = dvdnav_plugin_dispose; - - this->config = config; - this->xine = xine; - this->dvdnav = NULL; - this->opened = 0; - this->buttonN = 0; - this->typed_buttonN = 0; - this->dvd_name[0] = 0; - this->dvd_name_length = 0; - this->mrls = NULL; - this->num_mrls = 0; - - pthread_mutex_init(&this->buf_mutex, NULL); - this->mem_stack = 0; - - xine_register_event_listener(this->xine, dvdnav_event_listener, this); - this->dvd_device = config->register_string(config, - "input.dvd_device", - DVD_PATH, - "device used for dvd drive", - NULL, - device_change_cb, (void *)this); - this->current_dvd_device = this->dvd_device; - - if ((dvdcss = dlopen("libdvdcss.so.2", RTLD_LAZY)) != NULL) { - /* we have found libdvdcss, enable the specific config options */ + this = (dvdnav_input_plugin_t *) malloc (sizeof (dvdnav_input_plugin_t)); + + this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; + this->input_plugin.get_capabilities = dvdnav_plugin_get_capabilities; + this->input_plugin.open = dvdnav_plugin_open; + this->input_plugin.read = dvdnav_plugin_read; + this->input_plugin.read_block = dvdnav_plugin_read_block; + this->input_plugin.seek = dvdnav_plugin_seek; + this->input_plugin.get_current_pos = dvdnav_plugin_get_current_pos; + this->input_plugin.get_length = dvdnav_plugin_get_length; + this->input_plugin.get_blocksize = dvdnav_plugin_get_blocksize; + this->input_plugin.get_dir = dvdnav_plugin_get_dir; + this->input_plugin.eject_media = dvdnav_plugin_eject_media; + this->input_plugin.get_mrl = dvdnav_plugin_get_mrl; + this->input_plugin.stop = dvdnav_plugin_stop; + this->input_plugin.close = dvdnav_plugin_close; + this->input_plugin.get_description = dvdnav_plugin_get_description; + this->input_plugin.get_identifier = dvdnav_plugin_get_identifier; + this->input_plugin.get_autoplay_list = dvdnav_plugin_get_autoplay_list; + this->input_plugin.get_optional_data = dvdnav_plugin_get_optional_data; + this->input_plugin.is_branch_possible = NULL; + this->input_plugin.dispose = dvdnav_plugin_dispose; + + this->config = config; + this->xine = xine; + this->dvdnav = NULL; + this->opened = 0; + this->buttonN = 0; + this->typed_buttonN = 0; + this->dvd_name[0] = 0; + this->dvd_name_length = 0; + this->mrls = NULL; + this->num_mrls = 0; + + pthread_mutex_init(&this->buf_mutex, NULL); + this->mem_stack = 0; + + xine_register_event_listener(this->xine, dvdnav_event_listener, this); + this->dvd_device = config->register_string(config, + "input.dvd_device", + DVD_PATH, + "device used for dvd drive", + NULL, + 0, device_change_cb, (void *)this); + this->current_dvd_device = this->dvd_device; + + if ((dvdcss = dlopen("libdvdcss.so.2", RTLD_LAZY)) != NULL) { + /* we have found libdvdcss, enable the specific config options */ #ifndef HAVE_DVDNAV - char *raw_device; + char *raw_device; #endif - static char *decrypt_modes[] = { "key", "disc", "title", NULL }; - int mode; - + static char *decrypt_modes[] = { "key", "disc", "title", NULL }; + int mode; + #ifndef HAVE_DVDNAV - /* only our local copy of libdvdread supports raw device reads, - * so we don't provide this option, when we are using a shared version - * of libdvdnav/libdvdread */ - raw_device = config->register_string(config, "input.dvd_raw_device", - RDVD_PATH, "raw device set up for dvd access", - NULL, NULL, NULL); - if (raw_device) xine_setenv("DVDCSS_RAW_DEVICE", raw_device, 0); + /* only our local copy of libdvdread supports raw device reads, + * so we don't provide this option, when we are using a shared version + * of libdvdnav/libdvdread */ + raw_device = config->register_string(config, "input.dvd_raw_device", + RDVD_PATH, "raw device set up for dvd access", + NULL, 10, NULL, NULL); + if (raw_device) xine_setenv("DVDCSS_RAW_DEVICE", raw_device, 0); #endif - - mode = config->register_enum(config, "input.css_decryption_method", 0, - decrypt_modes, "the css decryption method libdvdcss should use", - NULL, NULL, NULL); - xine_setenv("DVDCSS_METHOD", decrypt_modes[mode], 0); - - dlclose(dvdcss); - } - - config->register_num(config, "input.dvd_region", - 1, - "Region that DVD player claims " - "to be (1 -> 8)", - "This only needs to be changed " - "if your DVD jumps to a screen " - "complaining about region code ", - region_changed_cb, - this); - config->register_string(config, "input.dvdnav_language", - "en", - "The default language for dvd", - "The dvdnav plugin tries to use this " - "language as a default. This must be a" - "two character ISO country code.", - language_changed_cb, this); - config->register_bool(config, "input.dvdnav_use_readahead", - 1, - "Do we use read-ahead caching?", - "This " - "may lead to jerky playback on low-end " - "machines.", - read_ahead_cb, this); + mode = config->register_enum(config, "input.css_decryption_method", 0, + decrypt_modes, "the css decryption method libdvdcss should use", + NULL, 10, NULL, NULL); + xine_setenv("DVDCSS_METHOD", decrypt_modes[mode], 0); + + dlclose(dvdcss); + } + + config->register_num(config, "input.dvd_region", + 1, + "Region that DVD player claims " + "to be (1 -> 8)", + "This only needs to be changed " + "if your DVD jumps to a screen " + "complaining about region code ", + 0, region_changed_cb, + this); + config->register_string(config, "input.dvdnav_language", + "en", + "The default language for dvd", + "The dvdnav plugin tries to use this " + "language as a default. This must be a" + "two character ISO country code.", + 0, language_changed_cb, this); + config->register_bool(config, "input.dvdnav_use_readahead", + 1, + "Do we use read-ahead caching?", + "This " + "may lead to jerky playback on low-end " + "machines.", + 10, read_ahead_cb, this); + #ifdef __sun - check_solaris_vold_device(this); + check_solaris_vold_device(this); #endif - return (input_plugin_t *) this; - break; - default: - printf ("DVD Navigator input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n", - iface); - return NULL; - } + return this; } + /* * $Log: input_dvd.c,v $ + * Revision 1.72 2002/09/04 23:31:08 guenter + * merging in the new_api branch ... unfortunately video_out / vo_scale is broken now ... matthias/miguel: please fix it :-) + * * Revision 1.71 2002/09/04 10:48:36 mroi * - handle numeric events for button selection (maybe this makes some * dvd's easter eggs accesible) @@ -1576,3 +1569,9 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { * First stage of DVD plugin -> dvdnav conversion * */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "dvd", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/input/input_file.c b/src/input/input_file.c index 4dee6db02..24d22f4ec 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.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: input_file.c,v 1.52 2002/07/05 17:32:02 mroi Exp $ + * $Id: input_file.c,v 1.53 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -110,12 +110,12 @@ typedef struct { /* * Callback for config changes. */ -static void hidden_bool_cb(void *data, cfg_entry_t *cfg) { +static void hidden_bool_cb(void *data, xine_cfg_entry_t *cfg) { file_input_plugin_t *this = (file_input_plugin_t *) data; this->show_hidden_files = cfg->num_value; } -static void origin_change_cb(void *data, cfg_entry_t *cfg) { +static void origin_change_cb(void *data, xine_cfg_entry_t *cfg) { file_input_plugin_t *this = (file_input_plugin_t *) data; this->origin_path = cfg->str_value; @@ -847,24 +847,11 @@ static void file_plugin_dispose (input_plugin_t *this_gen ) { free (this); } -/* - * - */ -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { file_input_plugin_t *this; config_values_t *config; - if (iface != 8) { - LOG_MSG(xine, - _("file input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (file_input_plugin_t *) xine_xmalloc (sizeof (file_input_plugin_t)); config = xine->config; this->xine = xine; @@ -906,12 +893,23 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->origin_path = config->register_string(this->config, "input.file_origin_path", current_dir, _("origin path to grab file mrls"), - NULL, origin_change_cb, (void *) this); + NULL, 0, origin_change_cb, (void *) this); } this->show_hidden_files = this->config->register_bool(this->config, "input.file_hidden_files", 1, _("hidden files displaying."), - NULL, hidden_bool_cb, (void *) this); + NULL, 10, hidden_bool_cb, (void *) this); - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "file", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_http.c b/src/input/input_http.c index 80561f7b0..84ffad158 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -685,21 +685,11 @@ static void http_plugin_dispose (input_plugin_t *this_gen ) { free (this_gen); } -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { http_input_plugin_t *this; config_values_t *config; - if (iface != 8) { - xine_log (xine, XINE_LOG_PLUGIN, - _("http input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (http_input_plugin_t *) xine_xmalloc(sizeof(http_input_plugin_t)); config = xine->config; this->xine = xine; @@ -730,5 +720,16 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->curpos = 0; this->nbc = NULL; - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "http", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_mms.c b/src/input/input_mms.c index fcc415671..d378f880b 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.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: input_mms.c,v 1.15 2002/07/05 17:32:02 mroi Exp $ + * $Id: input_mms.c,v 1.16 2002/09/04 23:31:08 guenter Exp $ * * mms input plugin based on work from major mms */ @@ -284,20 +284,11 @@ static void mms_plugin_dispose (input_plugin_t *this_gen ) { free (this); } -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { mms_input_plugin_t *this; config_values_t *config; - if (iface != 8) { - printf ("mms input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n", - iface); - return NULL; - } - this = (mms_input_plugin_t *) malloc (sizeof (mms_input_plugin_t)); config = xine->config; this->xine = xine; @@ -328,5 +319,16 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->curpos = 0; this->nbc = NULL; - return &this->input_plugin; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "mms", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_net.c b/src/input/input_net.c index 7ea5c8b23..1b023e38e 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -331,24 +331,11 @@ static void net_plugin_dispose (input_plugin_t *this_gen ) { free (this_gen); } -/* - * - */ -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { net_input_plugin_t *this; config_values_t *config; - if (iface != 8) { - LOG_MSG(xine, - _("net input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (net_input_plugin_t *) xine_xmalloc(sizeof(net_input_plugin_t)); config = xine->config; this->xine = xine; @@ -380,5 +367,16 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->curpos = 0; this->nbc = NULL; - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "tcp", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index 44886ca7c..cbce3e7db 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -503,22 +503,12 @@ static void rtp_plugin_dispose (input_plugin_t *this_gen ) { /* * */ -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { rtp_input_plugin_t *this; config_values_t *config; int bufn; - if (iface != 8) { - LOG_MSG(xine, - _("rtp input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (rtp_input_plugin_t *) xine_xmalloc(sizeof(rtp_input_plugin_t)); config = xine->config; @@ -564,5 +554,16 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->mrl = NULL; this->config = config; - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "rtp", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index cf77dc6c5..4dd3f1116 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.28 2002/07/05 17:32:02 mroi Exp $ + * $Id: input_stdin_fifo.c,v 1.29 2002/09/04 23:31:08 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -347,21 +347,11 @@ static void stdin_plugin_dispose (input_plugin_t *this_gen ) { } -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { stdin_input_plugin_t *this; config_values_t *config; - if (iface != 8) { - xine_log (xine, XINE_LOG_PLUGIN, - _("stdin/fifo input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (stdin_input_plugin_t *) xine_xmalloc(sizeof(stdin_input_plugin_t)); config = xine->config; this->xine = xine; @@ -393,5 +383,15 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->curpos = 0; this->nbc = NULL; - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "stdin", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index dae0fdb20..61d368835 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.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: input_vcd.c,v 1.46 2002/07/05 17:32:02 mroi Exp $ + * $Id: input_vcd.c,v 1.47 2002/09/04 23:31:08 guenter Exp $ * */ @@ -142,7 +142,7 @@ typedef struct { /* * Callback for configuratoin changes. */ -static void device_change_cb(void *data, cfg_entry_t *cfg) { +static void device_change_cb (void *data, xine_cfg_entry_t *cfg) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) data; this->device = cfg->str_value; @@ -1135,22 +1135,12 @@ static void vcd_plugin_dispose (input_plugin_t *this_gen ) { /* * */ -input_plugin_t *init_input_plugin (int iface, xine_t *xine) { +void *init_input_plugin (xine_t *xine, void *data) { vcd_input_plugin_t *this; config_values_t *config; int i; - if (iface != 8) { - LOG_MSG(xine, - _("vcd input plugin doesn't support plugin API version %d.\n" - "PLUGIN DISABLED.\n" - "This means there's a version mismatch between xine and this input" - "plugin.\nInstalling current input plugins should help.\n"), - iface); - return NULL; - } - this = (vcd_input_plugin_t *) xine_xmalloc(sizeof(vcd_input_plugin_t)); config = xine->config; this->xine = xine; @@ -1182,7 +1172,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->device = config->register_string(config, "input.vcd_device", CDROM, _("path to your local vcd device file"), - NULL, device_change_cb, (void *)this); + NULL, 10, device_change_cb, (void *)this); this->mrls = (mrl_t **) xine_xmalloc(sizeof(mrl_t*)); this->mrls_allocated_entries = 0; @@ -1191,5 +1181,15 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->mrl = NULL; this->config = config; - return (input_plugin_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_INPUT, 8, "vcd", XINE_VERSION_CODE, NULL, init_input_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index a3e7a9b78..3065e5885 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -79,14 +79,14 @@ void nbc_check_buffers (nbc_t *this) { } } - this->xine->metronom->set_speed (this->xine->metronom, SPEED_PAUSE); + this->xine->metronom->set_speed (this->xine->metronom, XINE_SPEED_PAUSE); this->xine->metronom->set_option (this->xine->metronom, METRONOM_SCR_ADJUSTABLE, 0); if (this->xine->audio_out) this->xine->audio_out->audio_paused = 2; this->buffering = 1; } else if ( (fifo_fill>this->high_water_mark) && (this->buffering)) { - this->xine->metronom->set_speed (this->xine->metronom, SPEED_NORMAL); + this->xine->metronom->set_speed (this->xine->metronom, XINE_SPEED_NORMAL); this->xine->metronom->set_option (this->xine->metronom, METRONOM_SCR_ADJUSTABLE, 1); if (this->xine->audio_out) this->xine->audio_out->audio_paused = 0; diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index ee64afe07..7e5f8c943 100644 --- a/src/liba52/xine_decoder.c +++ b/src/liba52/xine_decoder.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: xine_decoder.c,v 1.29 2002/08/28 20:27:56 mroi Exp $ + * $Id: xine_decoder.c,v 1.30 2002/09/04 23:31:08 guenter Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -35,11 +35,11 @@ #include #include +#include "xine_internal.h" #include "audio_out.h" #include "a52.h" #include "a52_internal.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #undef DEBUG_A52 @@ -127,10 +127,6 @@ static const struct frmsize_s frmsizecod_tbl[64] = { 640 ,{1280 ,1394 ,1920 } } }; -int a52dec_can_handle (audio_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_AUDIO_A52) ; -} - void a52dec_reset (audio_decoder_t *this_gen) { a52dec_decoder_t *this = (a52dec_decoder_t *) this_gen; @@ -538,25 +534,15 @@ static void a52dec_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { a52dec_decoder_t *this ; config_values_t *cfg; - if (iface_version != 9) { - printf(_("liba52: plugin doesn't support plugin API version %d.\n" - "liba52: this means there's a version mismatch between xine and this " - "liba52: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - cfg = xine->config; this = (a52dec_decoder_t *) malloc (sizeof (a52dec_decoder_t)); memset(this, 0, sizeof (a52dec_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = a52dec_can_handle; this->audio_decoder.init = a52dec_init; this->audio_decoder.decode_data = a52dec_decode_data; this->audio_decoder.reset = a52dec_reset; @@ -569,14 +555,28 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->a52_level = (float) cfg->register_range (cfg, "codec.a52_level", 100, 0, 200, _("a/52 volume control"), - NULL, NULL, NULL) / 100.0; + NULL, 0, NULL, NULL) / 100.0; this->disable_dynrng = !cfg->register_bool (cfg, "codec.a52_dynrng", 0, _("enable a/52 dynamic range compensation"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->enable_surround_downmix = cfg->register_bool (cfg, "codec.a52_surround_downmix", 0, _("enable audio downmixing to 2.0 surround stereo"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); - return (audio_decoder_t *) this; + return this; } +static uint32_t audio_types[] = { + BUF_AUDIO_A52, 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 2 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "a/52", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index 167a0a34b..b0551549c 100644 --- a/src/libdivx4/xine_decoder.c +++ b/src/libdivx4/xine_decoder.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: xine_decoder.c,v 1.40 2002/07/15 21:42:33 esnel Exp $ + * $Id: xine_decoder.c,v 1.41 2002/09/04 23:31:09 guenter Exp $ * * xine decoder plugin using divx4 * @@ -440,8 +440,8 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* need to decode a frame */ /* allocate image (taken from ffmpeg plugin) */ img = this->video_out->get_frame (this->video_out, this->bih.biWidth, - this->bih.biHeight, XINE_ASPECT_RATIO_DONT_TOUCH, - IMGFMT_YV12, + this->bih.biHeight, XINE_VO_ASPECT_DONT_TOUCH, + XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -502,7 +502,7 @@ static void divx4_close (video_decoder_t *this_gen) { this->buf = NULL; } -static void divx4_update_postproc(void *this_gen, cfg_entry_t *entry) { +static void divx4_update_postproc(void *this_gen, xine_cfg_entry_t *entry) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; @@ -510,7 +510,7 @@ static void divx4_update_postproc(void *this_gen, cfg_entry_t *entry) { printf ("divx4: update_postproc this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); #endif - if( this->postproc != entry->num_value ) { + if( this->postproc != entry->num_value) { this->postproc = entry->num_value; divx4_set_pp( this ); } @@ -546,7 +546,7 @@ static void divx4_dispose(video_decoder_t *this_gen) { /* This is pretty generic. I took the liberty to increase the priority over that of libffmpeg :-) */ -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { divx4_decoder_t *this ; char *libdecore_name; @@ -554,14 +554,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { decoreFunc libdecore_func = 0; config_values_t *cfg; - if (iface_version != 10) { - printf(_("divx4: plugin doesn't support plugin API version %d.\n" - "divx4: this means there's a version mismatch between xine and this " - "divx4: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - - return NULL; - } cfg = xine->config; /* Try to dlopen libdivxdecore, then look for decore function @@ -569,7 +561,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { us from then on. */ libdecore_name = cfg->register_string (cfg, "codec.divx4_libdivxdecore", "libdivxdecore.so", _("Relative path to libdivxdecore.so to open"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); libdecore_handle = dlopen(libdecore_name, RTLD_LAZY); if (libdecore_handle) @@ -583,8 +575,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->decoder_ok = 0; - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = divx4_can_handle; this->video_decoder.init = divx4_init; this->video_decoder.decode_data = divx4_decode_data; this->video_decoder.close = divx4_close; @@ -594,20 +584,20 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = divx4_dispose; this->video_decoder.priority = cfg->register_num (cfg, "codec.divx4_priority", 4, _("priority of the divx4 plugin (>5 => enable)"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->decore = libdecore_func; this->postproc = cfg->register_range (cfg, "codec.divx4_postproc", 3, 0, 6, _("the postprocessing level, 0 = none and fast, 6 = all and slow"), - NULL, divx4_update_postproc, this); + NULL, 10, divx4_update_postproc, this); this->can_handle_311 = cfg->register_bool (cfg, "codec.divx4_msmpeg4v3", 1, _("use divx4 plugin for msmpeg4v3 streams"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); this->size = 0; /* allow override of version checking by user */ this->version = cfg->register_num(cfg, "codec.divx4_forceversion", 0, _("Divx version to check for (set to 0 (default) if unsure)"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); /* if the version set in the config file, we can check right now. * otherwise postpone until we retrieve the version from the library @@ -630,4 +620,24 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { return (video_decoder_t *) this; } +/* + * exported plugin catalog entry + */ +static uint32_t video_types[] = { + /* BUF_VIDEO_MSMPEG4_V3 && this->can_handle_311 , */ + /* BUF_VIDEO_MSMPEG4_V2, */ + BUF_VIDEO_MPEG4, BUF_VIDEO_DIVX5, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 4 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "divx4", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libdts/xine_decoder.c b/src/libdts/xine_decoder.c index 26765fb54..db137df29 100644 --- a/src/libdts/xine_decoder.c +++ b/src/libdts/xine_decoder.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: xine_decoder.c,v 1.23 2002/07/05 17:32:02 mroi Exp $ + * $Id: xine_decoder.c,v 1.24 2002/09/04 23:31:09 guenter Exp $ * * 04-09-2001 DTS passtrough (C) Joachim Koenig * 09-12-2001 DTS passthrough inprovements (C) James Courtier-Dutton @@ -36,9 +36,10 @@ #include #include #include /* ntohs */ + +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" typedef struct dts_decoder_s { @@ -53,12 +54,6 @@ typedef struct dts_decoder_s { int output_open; } dts_decoder_t; -int dts_can_handle (audio_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_AUDIO_DTS); -} - void dts_reset (audio_decoder_t *this_gen) { @@ -225,22 +220,12 @@ static void dts_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { dts_decoder_t *this ; - if (iface_version != 9) { - printf(_("libdts: plugin doesn't support plugin API version %d.\n" - "libdts: this means there's a version mismatch between xine and this " - "libdts: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (dts_decoder_t *) malloc (sizeof (dts_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = dts_can_handle; this->audio_decoder.init = dts_init; this->audio_decoder.decode_data = dts_decode_data; this->audio_decoder.reset = dts_reset; @@ -249,6 +234,20 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->audio_decoder.dispose = dts_dispose; this->audio_decoder.priority = 1; - return (audio_decoder_t *) this; + return this; } +static uint32_t audio_types[] = { + BUF_AUDIO_DTS, 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "dts", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index 1c73b470e..ec3117662 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.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: xine_decoder.c,v 1.5 2002/07/17 20:29:04 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.6 2002/09/04 23:31:09 guenter Exp $ * */ @@ -27,9 +27,10 @@ #include #include #include + +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "faad.h" @@ -64,12 +65,6 @@ typedef struct faad_decoder_s { int output_open; } faad_decoder_t; -static int faad_can_handle (audio_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_AUDIO_AAC ); -} - static void faad_reset (audio_decoder_t *this_gen) { @@ -354,23 +349,13 @@ static void faad_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { faad_decoder_t *this ; - if (iface_version != 9) { - printf(_("libfaad: plugin doesn't support plugin API version %d.\n" - "libfaad: this means there's a version mismatch between xine and this " - "libfaad: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (faad_decoder_t *) malloc (sizeof (faad_decoder_t)); this->xine = xine; - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = faad_can_handle; this->audio_decoder.init = faad_init; this->audio_decoder.decode_data = faad_decode_data; this->audio_decoder.reset = faad_reset; @@ -379,6 +364,20 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->audio_decoder.dispose = faad_dispose; this->audio_decoder.priority = 1; - return (audio_decoder_t *) this; + return this; } +static uint32_t audio_types[] = { + BUF_AUDIO_AAC, 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "faad", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 470cba149..c8af6b995 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.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: xine_decoder.c,v 1.51 2002/08/19 17:40:41 guenter Exp $ + * $Id: xine_decoder.c,v 1.52 2002/09/04 23:31:09 guenter Exp $ * * xine decoder plugin using ffmpeg * @@ -79,25 +79,6 @@ typedef struct ff_decoder_s { #define VIDEOBUFSIZE 128*1024 -static int ff_can_handle (video_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_VIDEO_MSMPEG4_V3 || - buf_type == BUF_VIDEO_MSMPEG4_V2 || - buf_type == BUF_VIDEO_MSMPEG4_V1 || - buf_type == BUF_VIDEO_WMV7 || - buf_type == BUF_VIDEO_MPEG4 || - buf_type == BUF_VIDEO_XVID || - buf_type == BUF_VIDEO_DIVX5 || - buf_type == BUF_VIDEO_MJPEG || - /* buf_type == BUF_VIDEO_I263 || */ - buf_type == BUF_VIDEO_H263 || - buf_type == BUF_VIDEO_RV10 || - /* PIX_FMT_YUV410P must be supported to enable svq1 */ - /* buf_type == BUF_VIDEO_SORENSON_V1 || */ - buf_type == BUF_VIDEO_JPEG || - buf_type == BUF_VIDEO_MPEG); -} static void init_codec (ff_decoder_t *this, AVCodec *codec) { @@ -450,18 +431,18 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { switch(this->context.aspect_ratio_info) { case FF_ASPECT_SQUARE: - ratio = XINE_ASPECT_RATIO_SQUARE; + ratio = XINE_VO_ASPECT_SQUARE; break; case FF_ASPECT_4_3_625: case FF_ASPECT_4_3_525: - ratio = XINE_ASPECT_RATIO_4_3; + ratio = XINE_VO_ASPECT_4_3; break; case FF_ASPECT_16_9_625: case FF_ASPECT_16_9_525: - ratio = XINE_ASPECT_RATIO_ANAMORPHIC; + ratio = XINE_VO_ASPECT_ANAMORPHIC; break; default: - ratio = XINE_ASPECT_RATIO_DONT_TOUCH; + ratio = XINE_VO_ASPECT_DONT_TOUCH; } img = this->video_out->get_frame (this->video_out, @@ -469,7 +450,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->bih.biWidth, this->bih.biHeight, ratio, - IMGFMT_YV12, + XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -627,24 +608,13 @@ static void ff_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { ff_decoder_t *this ; static pthread_once_t once_control = PTHREAD_ONCE_INIT; - if (iface_version != 10) { - printf(_("ffmpeg: plugin doesn't support plugin API version %d.\n" - "ffmpeg: this means there's a version mismatch between xine and this " - "ffmpeg: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - - return NULL; - } - this = (ff_decoder_t *) malloc (sizeof (ff_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = ff_can_handle; this->video_decoder.init = ff_init; this->video_decoder.decode_data = ff_decode_data; this->video_decoder.flush = ff_flush; @@ -660,7 +630,8 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->chunk_buffer = xine_xmalloc (SLICE_BUFFER_SIZE + 4); this->illegal_vlc = xine->config->register_bool (xine->config, "codec.ffmpeg_illegal_vlc", 1, - _("allow illegal vlc codes in mpeg4 streams"), NULL, NULL, NULL); + _("allow illegal vlc codes in mpeg4 streams"), NULL, + 10, NULL, NULL); pthread_once( &once_control, init_routine ); @@ -668,3 +639,28 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { } +/* + * exported plugin catalog entry + */ + +static uint32_t supported_types[] = { + BUF_VIDEO_MSMPEG4_V3, BUF_VIDEO_MSMPEG4_V2, + BUF_VIDEO_MSMPEG4_V1, BUF_VIDEO_WMV7, BUF_VIDEO_MPEG4, + BUF_VIDEO_XVID, BUF_VIDEO_DIVX5, BUF_VIDEO_MJPEG, + BUF_VIDEO_H263, BUF_VIDEO_RV10, + /* PIX_FMT_YUV410P must be supported to enable svq1 */ + /* BUF_VIDEO_SORENSON_V1 */ + BUF_VIDEO_JPEG, BUF_VIDEO_MPEG, 0 +}; + +static decoder_info_t dec_info_ffmpeg = { + supported_types, /* supported types */ + 5 /* priority */ +}; + + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "ffmpeg", XINE_VERSION_CODE, &dec_info_ffmpeg, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c index e235036cd..fe210871a 100644 --- a/src/liblpcm/xine_decoder.c +++ b/src/liblpcm/xine_decoder.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: xine_decoder.c,v 1.31 2002/09/01 04:32:08 tmmm Exp $ + * $Id: xine_decoder.c,v 1.32 2002/09/04 23:31:09 guenter Exp $ * * 31-8-2001 Added LPCM rate sensing. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -34,9 +34,10 @@ #include #include #include /* ntohs */ + +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" typedef struct lpcm_decoder_s { @@ -52,14 +53,6 @@ typedef struct lpcm_decoder_s { int cpu_be; /* TRUE, if we're a Big endian CPU */ } lpcm_decoder_t; -int lpcm_can_handle (audio_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_AUDIO_LPCM_BE || - buf_type == BUF_AUDIO_LPCM_LE ); -} - - void lpcm_reset (audio_decoder_t *this_gen) { /* lpcm_decoder_t *this = (lpcm_decoder_t *) this_gen; */ @@ -204,22 +197,12 @@ static void lpcm_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { lpcm_decoder_t *this ; - if (iface_version != 9) { - printf(_("liblpcm: plugin doesn't support plugin API version %d.\n" - "liblpcm: this means there's a version mismatch between xine and this " - "liblpcm: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (lpcm_decoder_t *) malloc (sizeof (lpcm_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = lpcm_can_handle; this->audio_decoder.init = lpcm_init; this->audio_decoder.decode_data = lpcm_decode_data; this->audio_decoder.reset = lpcm_reset; @@ -228,6 +211,20 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->audio_decoder.dispose = lpcm_dispose; this->audio_decoder.priority = 1; - return (audio_decoder_t *) this; + return this; } +static uint32_t audio_types[] = { + BUF_AUDIO_LPCM_BE, BUF_AUDIO_LPCM_LE, 0 +}; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "pcm", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libmad/xine_decoder.c b/src/libmad/xine_decoder.c index 71aa183d9..f3723890e 100644 --- a/src/libmad/xine_decoder.c +++ b/src/libmad/xine_decoder.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: xine_decoder.c,v 1.23 2002/07/28 21:10:40 heikos Exp $ + * $Id: xine_decoder.c,v 1.24 2002/09/04 23:31:09 guenter Exp $ * * stuff needed to turn libmad into a xine decoder plugin */ @@ -25,9 +25,9 @@ #include #include +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" #include "frame.h" #include "synth.h" #include "xineutils.h" @@ -57,11 +57,6 @@ typedef struct mad_decoder_s { } mad_decoder_t; -static int mad_can_handle (audio_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_AUDIO_MPEG) ; -} - - static void mad_reset (audio_decoder_t *this_gen) { mad_decoder_t *this = (mad_decoder_t *) this_gen; @@ -275,23 +270,12 @@ static void mad_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { mad_decoder_t *this ; - if (iface_version != 9) { - printf(_("libmad: plugin doesn't support plugin API version %d.\n" - "libmad: this means there's a version mismatch between xine and this " - "libmad: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - - return NULL; - } - this = (mad_decoder_t *) malloc (sizeof (mad_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = mad_can_handle; this->audio_decoder.init = mad_init; this->audio_decoder.decode_data = mad_decode_data; this->audio_decoder.reset = mad_reset; @@ -300,6 +284,20 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->audio_decoder.dispose = mad_dispose; this->audio_decoder.priority = 5; - return (audio_decoder_t *) this; + return this; } +static uint32_t audio_types[] = { + BUF_AUDIO_MPEG, 0 +}; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "mad", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 39683a5eb..09863e682 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -31,12 +31,11 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "mpeg2.h" #include "mpeg2_internal.h" #include "xineutils.h" -#include "xine_internal.h" -#include "events.h" /* #define LOG_PAN_SCAN @@ -373,7 +372,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->coded_picture_width, picture->coded_picture_height, picture->aspect_ratio_information, - IMGFMT_YV12, + XINE_IMGFMT_YV12, picture->picture_structure); else { picture->current_frame = @@ -381,7 +380,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->coded_picture_width, picture->coded_picture_height, picture->aspect_ratio_information, - IMGFMT_YV12, + XINE_IMGFMT_YV12, (VO_PREDICTION_FLAG | picture->picture_structure)); if (picture->forward_reference_frame) picture->forward_reference_frame->free (picture->forward_reference_frame); diff --git a/src/libmpeg2/slice.c b/src/libmpeg2/slice.c index 3345b65bc..b190acdd6 100644 --- a/src/libmpeg2/slice.c +++ b/src/libmpeg2/slice.c @@ -25,6 +25,7 @@ #include +#include "xine_internal.h" #include "video_out.h" #include "mpeg2_internal.h" #include "attributes.h" diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index a2a9ad69d..b50f5d823 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.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: xine_decoder.c,v 1.37 2002/08/19 17:43:45 guenter Exp $ + * $Id: xine_decoder.c,v 1.38 2002/09/04 23:31:09 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -47,10 +47,6 @@ typedef struct mpeg2dec_decoder_s { pthread_mutex_t lock; /* mutex for async flush */ } mpeg2dec_decoder_t; -static int mpeg2dec_can_handle (video_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_VIDEO_MPEG) ; -} - static void mpeg2dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; @@ -86,10 +82,9 @@ static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) if (buf->decoder_flags & BUF_FLAG_SPECIAL) { if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) { this->mpeg2.force_aspect = buf->decoder_info[2]; - if (buf->decoder_info[3] == 0x1 - && buf->decoder_info[2] == XINE_ASPECT_RATIO_ANAMORPHIC) + if (buf->decoder_info[3] == 0x1 && buf->decoder_info[2] == XINE_VO_ASPECT_ANAMORPHIC) /* letterboxing is denied, we have to do pan&scan */ - this->mpeg2.force_aspect = XINE_ASPECT_RATIO_PAN_SCAN; + this->mpeg2.force_aspect = XINE_VO_ASPECT_PAN_SCAN; } pthread_mutex_unlock (&this->lock); return; @@ -162,23 +157,13 @@ static void mpeg2dec_dispose (video_decoder_t *this_gen) { free (this); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { mpeg2dec_decoder_t *this ; - if (iface_version != 10) { - printf(_("libmpeg2: plugin doesn't support plugin API version %d.\n" - "libmpeg2: this means there's a version mismatch between xine and this " - "libmpeg2: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (mpeg2dec_decoder_t *) malloc (sizeof (mpeg2dec_decoder_t)); memset(this, 0, sizeof (mpeg2dec_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = mpeg2dec_can_handle; this->video_decoder.init = mpeg2dec_init; this->video_decoder.decode_data = mpeg2dec_decode_data; this->video_decoder.flush = mpeg2dec_flush; @@ -191,6 +176,22 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->mpeg2.xine = xine; pthread_mutex_init (&this->lock, NULL); - return (video_decoder_t *) this; + return this; } +/* + * exported plugin catalog entry + */ + +static uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; + +static decoder_info_t dec_info_mpeg2 = { + supported_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c index a01241e13..2820671ae 100644 --- a/src/libspucc/cc_decoder.c +++ b/src/libspucc/cc_decoder.c @@ -20,7 +20,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: cc_decoder.c,v 1.16 2002/04/26 20:31:47 jkeil Exp $ + * $Id: cc_decoder.c,v 1.17 2002/09/04 23:31:09 guenter Exp $ * * stuff needed to provide closed captioning decoding and display * @@ -37,8 +37,8 @@ #include -#include "video_out.h" #include "xine_internal.h" +#include "video_out.h" #include "xineutils.h" #include "osd.h" #include "video_out/alphablend.h" diff --git a/src/libspucc/xine_decoder.c b/src/libspucc/xine_decoder.c index 071fa366e..5fa56c04d 100644 --- a/src/libspucc/xine_decoder.c +++ b/src/libspucc/xine_decoder.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: xine_decoder.c,v 1.15 2002/07/05 17:32:03 mroi Exp $ + * $Id: xine_decoder.c,v 1.16 2002/09/04 23:31:10 guenter Exp $ * * closed caption spu decoder. receive data by events. * @@ -28,7 +28,6 @@ #include #include "buffer.h" -#include "events.h" #include "xine_internal.h" #include "xineutils.h" #include "cc_decoder.h" @@ -125,7 +124,7 @@ static void spucc_do_init (spucc_decoder_t *this, vo_instance_t *vo_out) /*----------------- configuration listeners --------------------------------*/ -static void spucc_cfg_enable_change(void *this_gen, cfg_entry_t *value) +static void spucc_cfg_enable_change(void *this_gen, xine_cfg_entry_t *value) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; @@ -148,7 +147,7 @@ static void spucc_cfg_enable_change(void *this_gen, cfg_entry_t *value) } -static void spucc_cfg_scheme_change(void *this_gen, cfg_entry_t *value) +static void spucc_cfg_scheme_change(void *this_gen, xine_cfg_entry_t *value) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; @@ -165,7 +164,7 @@ static void spucc_cfg_scheme_change(void *this_gen, cfg_entry_t *value) } -static void spucc_font_change(void *this_gen, cfg_entry_t *value) +static void spucc_font_change(void *this_gen, xine_cfg_entry_t *value) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; @@ -188,7 +187,7 @@ static void spucc_font_change(void *this_gen, cfg_entry_t *value) } -static void spucc_num_change(void *this_gen, cfg_entry_t *value) +static void spucc_num_change(void *this_gen, xine_cfg_entry_t *value) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; @@ -218,37 +217,37 @@ static void spucc_register_cfg_vars(spucc_decoder_t *this, cc_vars->cc_enabled = xine_cfg->register_bool(xine_cfg, "misc.cc_enabled", 0, _("Enable closed captions in MPEG-2 streams"), - NULL, spucc_cfg_enable_change, + NULL, 0, spucc_cfg_enable_change, this); cc_vars->cc_scheme = xine_cfg->register_enum(xine_cfg, "misc.cc_scheme", 0, cc_schemes, _("Closed-captioning foreground/background scheme"), - NULL, spucc_cfg_scheme_change, + NULL, 10, spucc_cfg_scheme_change, this); copy_str(cc_vars->font, xine_cfg->register_string(xine_cfg, "misc.cc_font", "cc", _("Standard closed captioning font"), - NULL, spucc_font_change, this), + NULL, 10, spucc_font_change, this), CC_FONT_MAX); copy_str(cc_vars->italic_font, xine_cfg->register_string(xine_cfg, "misc.cc_italic_font", "cci", _("Italic closed captioning font"), - NULL, spucc_font_change, this), + NULL, 10, spucc_font_change, this), CC_FONT_MAX); cc_vars->font_size = xine_cfg->register_num(xine_cfg, "misc.cc_font_size", 24, _("Closed captioning font size"), - NULL, spucc_num_change, + NULL, 10, spucc_num_change, this); cc_vars->center = xine_cfg->register_bool(xine_cfg, "misc.cc_center", 1, _("Center-adjust closed captions"), - NULL, spucc_num_change, + NULL, 10, spucc_num_change, this); } diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index c64dd699e..b302ce9dc 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -35,7 +35,7 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spu.c,v 1.44 2002/09/01 06:02:53 jcdutton Exp $ + * $Id: spu.c,v 1.45 2002/09/04 23:31:10 guenter Exp $ * */ @@ -50,12 +50,11 @@ #include #include +#include "xine_internal.h" #include "video_out/alphablend.h" #include "xineutils.h" -#include "xine_internal.h" #include "spu.h" #include "buffer.h" -#include "events.h" #include "xine-engine/bswap.h" #include "nav_types.h" #include "nav_read.h" diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 13d6ceae1..a72734e00 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,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: xine_decoder.c,v 1.72 2002/09/01 06:02:53 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.73 2002/09/04 23:31:10 guenter Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -32,9 +32,8 @@ #include #include -#include "buffer.h" -#include "events.h" #include "xine_internal.h" +#include "buffer.h" #include "video_out/alphablend.h" /* For clut_t */ #include "xine-engine/bswap.h" #include "xineutils.h" diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 7909636dc..83acbdf8a 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * * This file is part of xine, a free video player. * @@ -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: xine_decoder.c,v 1.38 2002/07/05 17:32:03 mroi Exp $ + * $Id: xine_decoder.c,v 1.39 2002/09/04 23:31:10 guenter Exp $ * * code based on mplayer module: * @@ -39,7 +39,6 @@ #include #include "buffer.h" -#include "events.h" #include "xine_internal.h" #include "xineutils.h" #include "osd.h" @@ -995,7 +994,7 @@ static char *spudec_get_id(void) { return "sputext"; } -static void update_osd_font(void *this_gen, cfg_entry_t *entry) +static void update_osd_font(void *this_gen, xine_cfg_entry_t *entry) { sputext_decoder_t *this = (sputext_decoder_t *)this_gen; @@ -1007,7 +1006,7 @@ static void update_osd_font(void *this_gen, cfg_entry_t *entry) printf("libsputext: spu_font = %s\n", this->font ); } -static void update_osd_src_encoding(void *this_gen, cfg_entry_t *entry) +static void update_osd_src_encoding(void *this_gen, xine_cfg_entry_t *entry) { sputext_decoder_t *this = (sputext_decoder_t *)this_gen; @@ -1016,7 +1015,7 @@ static void update_osd_src_encoding(void *this_gen, cfg_entry_t *entry) printf("libsputext: spu_src_encoding = %s\n", this->src_encoding ); } -static void update_osd_dst_encoding(void *this_gen, cfg_entry_t *entry) +static void update_osd_dst_encoding(void *this_gen, xine_cfg_entry_t *entry) { sputext_decoder_t *this = (sputext_decoder_t *)this_gen; @@ -1025,7 +1024,7 @@ static void update_osd_dst_encoding(void *this_gen, cfg_entry_t *entry) printf("libsputext: spu_dst_encoding = %s\n", this->dst_encoding ); } -static void update_subtitle_size(void *this_gen, cfg_entry_t *entry) +static void update_subtitle_size(void *this_gen, xine_cfg_entry_t *entry) { sputext_decoder_t *this = (sputext_decoder_t *)this_gen; @@ -1034,7 +1033,7 @@ static void update_subtitle_size(void *this_gen, cfg_entry_t *entry) update_font_size (this_gen); } -static void update_time_offset(void *this_gen, cfg_entry_t *entry) +static void update_time_offset(void *this_gen, xine_cfg_entry_t *entry) { sputext_decoder_t *this = (sputext_decoder_t *)this_gen; @@ -1076,28 +1075,28 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { "codec.spu_font", "sans", _("font for avi subtitles"), - NULL, update_osd_font, this); + NULL, 0, update_osd_font, this); this->subtitle_size = xine->config->register_enum(xine->config, "codec.spu_subtitle_size", 1, subtitle_size_strings, _("subtitle size (relative window size)"), - NULL, update_subtitle_size, this); + NULL, 0, update_subtitle_size, this); this->src_encoding = xine->config->register_string(xine->config, "codec.spu_src_encoding", "windows-1250", _("source encoding of subtitles"), - NULL, update_osd_src_encoding, this); + NULL, 10, update_osd_src_encoding, this); this->dst_encoding = xine->config->register_string(xine->config, "codec.spu_dst_encoding", "iso-8859-2", _("target encoding for subtitles (have to match font encoding)"), - NULL, update_osd_dst_encoding, this); + NULL, 10, update_osd_dst_encoding, this); this->time_offset = xine->config->register_num (xine->config, "codec.spu_time_offset", 0, _("subtitle time offset in 1/100 sec"), - NULL, update_time_offset, this); + NULL, 10, update_time_offset, this); return (spu_decoder_t *) this; } diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c index 5cda59cdd..5999fd85c 100644 --- a/src/libvorbis/xine_decoder.c +++ b/src/libvorbis/xine_decoder.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: xine_decoder.c,v 1.15 2002/08/19 22:12:54 guenter Exp $ + * $Id: xine_decoder.c,v 1.16 2002/09/04 23:31:10 guenter Exp $ * * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine */ @@ -29,9 +29,9 @@ #include #include +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" #include #include @@ -65,10 +65,6 @@ typedef struct vorbis_decoder_s { } vorbis_decoder_t; -static int vorbis_can_handle (audio_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_AUDIO_VORBIS) ; -} - static void vorbis_reset (audio_decoder_t *this_gen) { @@ -241,23 +237,12 @@ static void vorbis_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { vorbis_decoder_t *this ; - if (iface_version != 9) { - printf(_("libvorbis: plugin doesn't support plugin API version %d.\n" - "libvorbis: this means there's a version mismatch between xine and this " - "libvorbis: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - - return NULL; - } - this = (vorbis_decoder_t *) malloc (sizeof (vorbis_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = vorbis_can_handle; this->audio_decoder.init = vorbis_init; this->audio_decoder.decode_data = vorbis_decode_data; this->audio_decoder.reset = vorbis_reset; @@ -269,3 +254,17 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { return (audio_decoder_t *) this; } +static uint32_t audio_types[] = { + BUF_AUDIO_VORBIS, 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "vorbis", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index da1115ba0..6a1b94f85 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.90 2002/08/29 06:06:02 tmmm Exp $ + * $Id: w32codec.c,v 1.91 2002/09/04 23:31:10 guenter Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -41,11 +41,11 @@ #include "DirectShow/DS_AudioDecoder.h" #include "DirectShow/DS_VideoDecoder.h" +#include "xine_internal.h" #include "video_out.h" #include "audio_out.h" #include "buffer.h" #include "xineutils.h" -#include "xine_internal.h" /* #define LOG @@ -400,29 +400,6 @@ static char* get_vids_codec_name(w32v_decoder_t *this, #define IMGFMT_16RGB mmioFOURCC( 16,'R','G','B') #define IMGFMT_15RGB mmioFOURCC( 15,'R','G','B') -static int w32v_can_handle (video_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_VIDEO_MSMPEG4_V1 || - buf_type == BUF_VIDEO_MSMPEG4_V2 || - buf_type == BUF_VIDEO_MSMPEG4_V3 || - buf_type == BUF_VIDEO_IV50 || - buf_type == BUF_VIDEO_IV41 || - buf_type == BUF_VIDEO_IV32 || - buf_type == BUF_VIDEO_IV31 || - buf_type == BUF_VIDEO_CINEPAK || - /* buf_type == BUF_VIDEO_ATIVCR1 || */ - buf_type == BUF_VIDEO_ATIVCR2 || - buf_type == BUF_VIDEO_I263 || - buf_type == BUF_VIDEO_MSVC || - buf_type == BUF_VIDEO_DV || - buf_type == BUF_VIDEO_WMV7 || - buf_type == BUF_VIDEO_WMV8 || - buf_type == BUF_VIDEO_VP31 || - buf_type == BUF_VIDEO_MSS1 || - buf_type == BUF_VIDEO_XXAN ); -} - static void w32v_init (video_decoder_t *this_gen, vo_instance_t *video_out) { w32v_decoder_t *this = (w32v_decoder_t *) this_gen; @@ -926,21 +903,6 @@ static void w32v_dispose (video_decoder_t *this_gen) { * audio stuff */ -static int w32a_can_handle (audio_decoder_t *this_gen, int buf_type) { - - int codec = buf_type & 0xFFFF0000; - - return ( (codec == BUF_AUDIO_DIVXA) || - (codec == BUF_AUDIO_MSADPCM) || - (codec == BUF_AUDIO_MSIMAADPCM) || - (codec == BUF_AUDIO_MSGSM) || - (codec == BUF_AUDIO_IMC) || - (codec == BUF_AUDIO_LH) || - (codec == BUF_AUDIO_VOXWARE) || - (codec == BUF_AUDIO_ACELPNET) || - (codec == BUF_AUDIO_VIVOG723) ); -} - static char* get_auds_codec_name(w32a_decoder_t *this, int buf_type) { buf_type = buf_type & 0xFFFF0000; @@ -1339,30 +1301,20 @@ static void init_routine(void) { w32v_init_rgb_ycc(); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { w32v_decoder_t *this ; config_values_t *cfg; - if (iface_version != 10) { - printf( "w32codec: plugin doesn't support plugin API version %d.\n" - "w32codec: this means there's a version mismatch between xine and this " - "w32codec: decoder plugin.\nInstalling current decoder plugins should help.\n", - iface_version); - - return NULL; - } cfg = xine->config; win32_def_path = cfg->register_string (cfg, "codec.win32_path", "/usr/lib/win32", _("path to win32 codec dlls"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this = (w32v_decoder_t *) xine_xmalloc (sizeof (w32v_decoder_t)); this->xine = xine; - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = w32v_can_handle; this->video_decoder.init = w32v_init; this->video_decoder.decode_data = w32v_decode_data; this->video_decoder.flush = w32v_flush; @@ -1376,38 +1328,31 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->prof_rgb2yuv = xine_profiler_allocate_slot ("w32codec rgb2yuv convert"); - return (video_decoder_t *) this; +#ifdef SYNC_SHUTDOWN + w32v_instance = NULL; +#endif + + return this; } static void w32a_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { w32a_decoder_t *this ; config_values_t *cfg; - if (iface_version != 9) { - printf(_("w32codec: plugin doesn't support plugin API version %d.\n" - "w32codec: this means there's a version mismatch between xine and this " - "w32codec: decoder plugin.\nInstalling current decoder plugins should help.\n"), - iface_version); - - return NULL; - } - cfg = xine->config; win32_def_path = cfg->register_string (cfg, "codec.win32_path", "/usr/lib/win32", _("path to win32 codec dlls"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this = (w32a_decoder_t *) xine_xmalloc (sizeof (w32a_decoder_t)); this->xine = xine; - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = w32a_can_handle; this->audio_decoder.init = w32a_init; this->audio_decoder.decode_data = w32a_decode_data; this->audio_decoder.reset = w32a_reset; @@ -1418,6 +1363,47 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { pthread_once (&once_control, init_routine); - return (audio_decoder_t *) this; +#ifdef SYNC_SHUTDOWN + w32a_instance = NULL; +#endif + + return this; } +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_MSMPEG4_V1, BUF_VIDEO_MSMPEG4_V2, BUF_VIDEO_MSMPEG4_V3, + BUF_VIDEO_IV50, BUF_VIDEO_IV41, BUF_VIDEO_IV32, BUF_VIDEO_IV31, + BUF_VIDEO_CINEPAK, /* BUF_VIDEO_ATIVCR1, */ + BUF_VIDEO_ATIVCR2, BUF_VIDEO_I263, BUF_VIDEO_MSVC, + BUF_VIDEO_DV, BUF_VIDEO_WMV7, BUF_VIDEO_WMV8, + BUF_VIDEO_VP31, BUF_VIDEO_MSS1, BUF_VIDEO_XXAN, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +static uint32_t audio_types[] = { + BUF_AUDIO_DIVXA, BUF_AUDIO_MSADPCM, BUF_AUDIO_MSIMAADPCM, + BUF_AUDIO_MSGSM, BUF_AUDIO_IMC, BUF_AUDIO_LH, + BUF_AUDIO_VOXWARE, BUF_AUDIO_ACELPNET, BUF_AUDIO_VIVOG723, + 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "win32", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_AUDIO_DECODER, 9, "win32", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxineadec/adpcm.c b/src/libxineadec/adpcm.c index a4382157f..24a5d0eaa 100644 --- a/src/libxineadec/adpcm.c +++ b/src/libxineadec/adpcm.c @@ -24,7 +24,7 @@ * formats can be found here: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: adpcm.c,v 1.12 2002/09/03 02:46:30 tmmm Exp $ + * $Id: adpcm.c,v 1.13 2002/09/04 23:31:10 guenter Exp $ */ #include @@ -33,9 +33,10 @@ #include #include +#include "xine_internal.h" +#include "video_out.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -963,18 +964,6 @@ static void vqa_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { this->size = 0; } -static int adpcm_can_handle (audio_decoder_t *this_gen, int buf_type) { - buf_type &= 0xFFFF0000; - - return ( buf_type == BUF_AUDIO_MSADPCM || - buf_type == BUF_AUDIO_MSIMAADPCM || - buf_type == BUF_AUDIO_QTIMAADPCM || - buf_type == BUF_AUDIO_DK3ADPCM || - buf_type == BUF_AUDIO_DK4ADPCM || - buf_type == BUF_AUDIO_SMJPEG_IMA || - buf_type == BUF_AUDIO_VQA_IMA ); -} - static void adpcm_reset (audio_decoder_t *this_gen) { /* adpcm_decoder_t *this = (adpcm_decoder_t *) this_gen; */ @@ -1145,22 +1134,12 @@ static void adpcm_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { adpcm_decoder_t *this ; - if (iface_version != 9) { - printf( "libadpcm: plugin doesn't support plugin API version %d.\n" - "libadpcm: this means there's a version mismatch between xine and this " - "libadpcm: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (adpcm_decoder_t *) malloc (sizeof (adpcm_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = adpcm_can_handle; this->audio_decoder.init = adpcm_init; this->audio_decoder.decode_data = adpcm_decode_data; this->audio_decoder.reset = adpcm_reset; @@ -1169,5 +1148,22 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this->audio_decoder.dispose = adpcm_dispose; this->audio_decoder.priority = 9; - return (audio_decoder_t *) this; + return this; } + +static uint32_t audio_types[] = { + BUF_AUDIO_MSADPCM, BUF_AUDIO_MSIMAADPCM, + BUF_AUDIO_QTIMAADPCM, BUF_AUDIO_DK3ADPCM, + BUF_AUDIO_DK4ADPCM, 0 + }; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "adpcm", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxineadec/logpcm.c b/src/libxineadec/logpcm.c index ede098d9c..f755681ba 100644 --- a/src/libxineadec/logpcm.c +++ b/src/libxineadec/logpcm.c @@ -30,7 +30,7 @@ * http://sox.sourceforge.net/ * which listed the code as being lifted from Sun Microsystems. * - * $Id: logpcm.c,v 1.2 2002/09/01 04:26:20 tmmm Exp $ + * $Id: logpcm.c,v 1.3 2002/09/04 23:31:10 guenter Exp $ * */ @@ -41,9 +41,10 @@ #include #include -#include "audio_out.h" #include "buffer.h" #include "xine_internal.h" +#include "video_out.h" +#include "audio_out.h" #include "xineutils.h" #include "bswap.h" @@ -263,8 +264,6 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { this = (logpcm_decoder_t *) malloc (sizeof (logpcm_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = logpcm_can_handle; this->audio_decoder.init = logpcm_init; this->audio_decoder.decode_data = logpcm_decode_data; this->audio_decoder.reset = logpcm_reset; diff --git a/src/libxineadec/roqaudio.c b/src/libxineadec/roqaudio.c index 5c2fbc5f3..49f811f30 100644 --- a/src/libxineadec/roqaudio.c +++ b/src/libxineadec/roqaudio.c @@ -21,7 +21,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: roqaudio.c,v 1.4 2002/07/05 17:32:04 mroi Exp $ + * $Id: roqaudio.c,v 1.5 2002/09/04 23:31:10 guenter Exp $ * */ @@ -32,9 +32,9 @@ #include #include +#include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -66,10 +66,6 @@ typedef struct roqaudio_decoder_s { short square_array[256]; } roqaudio_decoder_t; -static int roqaudio_can_handle (audio_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_AUDIO_ROQ); -} - static void roqaudio_reset (audio_decoder_t *this_gen) { } @@ -186,23 +182,12 @@ static void roqaudio_dispose (audio_decoder_t *this_gen) { free (this_gen); } -audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { +void *init_audio_decoder_plugin (xine_t *xine, void *data) { roqaudio_decoder_t *this ; - if (iface_version != 9) { - printf(_("RoQ Audio: plugin doesn't support plugin API version %d.\n" - "RoQ Audio: this means there's a version mismatch between xine and this\n" - "RoQ Audio: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - - return NULL; - } - this = (roqaudio_decoder_t *) malloc (sizeof (roqaudio_decoder_t)); - this->audio_decoder.interface_version = iface_version; - this->audio_decoder.can_handle = roqaudio_can_handle; this->audio_decoder.init = roqaudio_init; this->audio_decoder.decode_data = roqaudio_decode_data; this->audio_decoder.reset = roqaudio_reset; @@ -214,3 +199,17 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, xine_t *xine) { return (audio_decoder_t *) this; } +static uint32_t audio_types[] = { + BUF_AUDIO_ROQ, 0 +}; + +static decoder_info_t dec_info_audio = { + audio_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_AUDIO_DECODER, 9, "roq", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/cinepak.c b/src/libxinevdec/cinepak.c index 089506dc2..58b006659 100644 --- a/src/libxinevdec/cinepak.c +++ b/src/libxinevdec/cinepak.c @@ -22,17 +22,17 @@ * based on overview of Cinepak algorithm and example decoder * by Tim Ferguson: http://www.csse.monash.edu.au/~timf/ * - * $Id: cinepak.c,v 1.11 2002/07/18 20:08:00 esnel Exp $ + * $Id: cinepak.c,v 1.12 2002/09/04 23:31:11 guenter Exp $ */ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "bswap.h" #include "xineutils.h" -#include "xine_internal.h" #define MAX_STRIPS 32 #define VIDEOBUFSIZE 128 * 1024 @@ -291,10 +291,6 @@ static void cinepak_decode_frame (cvid_decoder_t *this, uint8_t *data, int size) } } -static int cvid_can_handle (video_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_VIDEO_CINEPAK); -} - static void cvid_init (video_decoder_t *this_gen, vo_instance_t *video_out) { cvid_decoder_t *this = (cvid_decoder_t *) this_gen; @@ -353,8 +349,8 @@ static void cvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->video_out->get_frame (this->video_out, this->biWidth, this->biHeight, - XINE_ASPECT_RATIO_SQUARE, - IMGFMT_YV12, VO_BOTH_FIELDS); + XINE_VO_ASPECT_SQUARE, + XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -444,23 +440,13 @@ static void cvid_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { cvid_decoder_t *this ; - if (iface_version != 10) { - printf(_("cinepak: plugin doesn't support plugin API version %d.\n" - "cinepak: this means there's a version mismatch between xine and this " - "cinepak: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (cvid_decoder_t *) malloc (sizeof (cvid_decoder_t)); memset(this, 0, sizeof (cvid_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = cvid_can_handle; this->video_decoder.init = cvid_init; this->video_decoder.decode_data = cvid_decode_data; this->video_decoder.flush = cvid_flush; @@ -472,3 +458,23 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { return (video_decoder_t *) this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_CINEPAK, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "cinepak", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/cyuv.c b/src/libxinevdec/cyuv.c index 6bbf39687..79dbdf27f 100644 --- a/src/libxinevdec/cyuv.c +++ b/src/libxinevdec/cyuv.c @@ -18,7 +18,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: cyuv.c,v 1.5 2002/07/15 21:42:34 esnel Exp $ + * $Id: cyuv.c,v 1.6 2002/09/04 23:31:11 guenter Exp $ */ /* And this is the header that came with the CYUV decoder: */ @@ -50,9 +50,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #define VIDEOBUFSIZE 128*1024 @@ -70,10 +70,6 @@ typedef struct cyuv_decoder_s { int height; } cyuv_decoder_t; -static int cyuv_can_handle (video_decoder_t *this_gen, int buf_type) { - return (buf_type == BUF_VIDEO_CYUV); -} - static void cyuv_init (video_decoder_t *this_gen, vo_instance_t *video_out) { cyuv_decoder_t *this = (cyuv_decoder_t *) this_gen; @@ -185,7 +181,7 @@ static void cyuv_decode_data (video_decoder_t *this_gen, if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* time to decode a frame */ img = this->video_out->get_frame (this->video_out, this->width, - this->height, XINE_ASPECT_RATIO_SQUARE, IMGFMT_YUY2, + this->height, XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -236,22 +232,12 @@ static void cyuv_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { cyuv_decoder_t *this ; - if (iface_version != 10) { - printf( "CYUV: plugin doesn't support plugin API version %d.\n" - "CYUV: this means there's a version mismatch between xine and this " - "CYUV: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (cyuv_decoder_t *) malloc (sizeof (cyuv_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = cyuv_can_handle; this->video_decoder.init = cyuv_init; this->video_decoder.decode_data = cyuv_decode_data; this->video_decoder.flush = cyuv_flush; @@ -261,5 +247,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = cyuv_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_CYUV, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "cyuv", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c index 3527692c0..cb3f597ab 100644 --- a/src/libxinevdec/fli.c +++ b/src/libxinevdec/fli.c @@ -23,7 +23,7 @@ * avoid when implementing a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: fli.c,v 1.3 2002/08/28 03:37:17 tmmm Exp $ + * $Id: fli.c,v 1.4 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -32,9 +32,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -403,11 +403,6 @@ void decode_fli_frame(fli_decoder_t *this) { * xine video plugin functions *************************************************************************/ -static int fli_can_handle (video_decoder_t *this_gen, int buf_type) { - - return (buf_type == BUF_VIDEO_FLI); -} - /* * This function is responsible is called to initialize the video decoder * for use. Initialization usually involves setting up the fields in your @@ -479,7 +474,7 @@ static void fli_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -569,23 +564,13 @@ static void fli_dispose (video_decoder_t *this_gen) { * plugins for the same buffer types to coexist peacefully. The higher the * priority number, the more precedence a decoder has. E.g., 9 beats 1. */ -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { fli_decoder_t *this ; - if (iface_version != 10) { - printf( "fli: plugin doesn't support plugin API version %d.\n" - "fli: this means there's a version mismatch between xine and this " - "fli: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (fli_decoder_t *) malloc (sizeof (fli_decoder_t)); memset(this, 0, sizeof (fli_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = fli_can_handle; this->video_decoder.init = fli_init; this->video_decoder.decode_data = fli_decode_data; this->video_decoder.flush = fli_flush; @@ -595,5 +580,26 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = fli_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_FLI, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "fli", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + diff --git a/src/libxinevdec/idcinvideo.c b/src/libxinevdec/idcinvideo.c index dde1c8562..0147589d1 100644 --- a/src/libxinevdec/idcinvideo.c +++ b/src/libxinevdec/idcinvideo.c @@ -21,7 +21,7 @@ * the Id CIN format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: idcinvideo.c,v 1.2 2002/08/28 03:37:17 tmmm Exp $ + * $Id: idcinvideo.c,v 1.3 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -30,9 +30,9 @@ #include #include -#include "video_out.h" #include "buffer.h" #include "xine_internal.h" +#include "video_out.h" #include "xineutils.h" #include "bswap.h" @@ -300,7 +300,7 @@ static void idcinvideo_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -402,8 +402,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (idcinvideo_decoder_t *) malloc (sizeof (idcinvideo_decoder_t)); memset(this, 0, sizeof (idcinvideo_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = idcinvideo_can_handle; this->video_decoder.init = idcinvideo_init; this->video_decoder.decode_data = idcinvideo_decode_data; this->video_decoder.flush = idcinvideo_flush; diff --git a/src/libxinevdec/msrle.c b/src/libxinevdec/msrle.c index 0d748c580..006c1d57f 100644 --- a/src/libxinevdec/msrle.c +++ b/src/libxinevdec/msrle.c @@ -21,7 +21,7 @@ * For more information on the MS RLE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: msrle.c,v 1.4 2002/08/28 03:37:17 tmmm Exp $ + * $Id: msrle.c,v 1.5 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -30,9 +30,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -165,12 +165,6 @@ void decode_msrle8(msrle_decoder_t *this) { * xine video plugin functions *************************************************************************/ -static int msrle_can_handle (video_decoder_t *this_gen, int buf_type) { - - return (buf_type == BUF_VIDEO_MSRLE); - -} - /* * This function is responsible is called to initialize the video decoder * for use. Initialization usually involves setting up the fields in your @@ -259,7 +253,7 @@ static void msrle_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -346,23 +340,13 @@ static void msrle_dispose (video_decoder_t *this_gen) { * plugins for the same buffer types to coexist peacefully. The higher the * priority number, the more precedence a decoder has. E.g., 9 beats 1. */ -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { msrle_decoder_t *this ; - if (iface_version != 10) { - printf( "msrle: plugin doesn't support plugin API version %d.\n" - "msrle: this means there's a version mismatch between xine and this " - "msrle: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (msrle_decoder_t *) malloc (sizeof (msrle_decoder_t)); memset(this, 0, sizeof (msrle_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = msrle_can_handle; this->video_decoder.init = msrle_init; this->video_decoder.decode_data = msrle_decode_data; this->video_decoder.flush = msrle_flush; @@ -372,6 +356,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = msrle_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_MSRLE, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "msrle", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/msvc.c b/src/libxinevdec/msvc.c index 983d64f32..fe95de7c5 100644 --- a/src/libxinevdec/msvc.c +++ b/src/libxinevdec/msvc.c @@ -22,17 +22,17 @@ * based on overview of Microsoft Video-1 algorithm * by Mike Melanson: http://www.pcisys.net/~melanson/codecs/video1.txt * - * $Id: msvc.c,v 1.8 2002/07/15 21:42:34 esnel Exp $ + * $Id: msvc.c,v 1.9 2002/09/04 23:31:11 guenter Exp $ */ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "bswap.h" #include "xineutils.h" -#include "xine_internal.h" #define VIDEOBUFSIZE 128 * 1024 @@ -189,10 +189,6 @@ static void cram_decode_frame (msvc_decoder_t *this, uint8_t *data, int size) { } } -static int msvc_can_handle (video_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_VIDEO_MSVC); -} - static void msvc_init (video_decoder_t *this_gen, vo_instance_t *video_out) { msvc_decoder_t *this = (msvc_decoder_t *) this_gen; @@ -271,7 +267,7 @@ static void msvc_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->video_out->get_frame (this->video_out, this->biWidth, this->biHeight, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -349,23 +345,13 @@ static void msvc_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { msvc_decoder_t *this ; - if (iface_version != 10) { - printf( "msvc: plugin doesn't support plugin API version %d.\n" - "msvc: this means there's a version mismatch between xine and this " - "msvc: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (msvc_decoder_t *) malloc (sizeof (msvc_decoder_t)); memset(this, 0, sizeof (msvc_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = msvc_can_handle; this->video_decoder.init = msvc_init; this->video_decoder.decode_data = msvc_decode_data; this->video_decoder.flush = msvc_flush; @@ -375,5 +361,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = msvc_dispose; this->video_decoder.priority = 5; - return (video_decoder_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_MSVC, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 5 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "msvc", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/qtrpza.c b/src/libxinevdec/qtrpza.c index c79d32e0f..6b6f2dfa1 100644 --- a/src/libxinevdec/qtrpza.c +++ b/src/libxinevdec/qtrpza.c @@ -21,7 +21,7 @@ * For more information about the RPZA format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtrpza.c,v 1.1 2002/09/01 01:50:39 tmmm Exp $ + * $Id: qtrpza.c,v 1.2 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -30,9 +30,9 @@ #include #include -#include "video_out.h" #include "buffer.h" #include "xine_internal.h" +#include "video_out.h" #include "xineutils.h" #include "bswap.h" @@ -366,7 +366,7 @@ static void qtrpza_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -460,8 +460,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (qtrpza_decoder_t *) malloc (sizeof (qtrpza_decoder_t)); memset(this, 0, sizeof (qtrpza_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = qtrpza_can_handle; this->video_decoder.init = qtrpza_init; this->video_decoder.decode_data = qtrpza_decode_data; this->video_decoder.flush = qtrpza_flush; diff --git a/src/libxinevdec/qtsmc.c b/src/libxinevdec/qtsmc.c index ff9518191..75c110fe4 100644 --- a/src/libxinevdec/qtsmc.c +++ b/src/libxinevdec/qtsmc.c @@ -23,7 +23,7 @@ * For more information on the SMC format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtsmc.c,v 1.1 2002/08/29 06:09:06 tmmm Exp $ + * $Id: qtsmc.c,v 1.2 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -32,9 +32,9 @@ #include #include -#include "video_out.h" #include "buffer.h" #include "xine_internal.h" +#include "video_out.h" #include "xineutils.h" #include "bswap.h" @@ -598,7 +598,7 @@ static void qtsmc_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -692,8 +692,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (qtsmc_decoder_t *) malloc (sizeof (qtsmc_decoder_t)); memset(this, 0, sizeof (qtsmc_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = qtsmc_can_handle; this->video_decoder.init = qtsmc_init; this->video_decoder.decode_data = qtsmc_decode_data; this->video_decoder.flush = qtsmc_flush; diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c index 7b01fcbb7..812afdaa3 100644 --- a/src/libxinevdec/rgb.c +++ b/src/libxinevdec/rgb.c @@ -21,7 +21,7 @@ * Actually, this decoder just converts a raw RGB image to a YUY2 map * suitable for display under xine. * - * $Id: rgb.c,v 1.4 2002/08/28 03:37:17 tmmm Exp $ + * $Id: rgb.c,v 1.5 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -30,9 +30,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -63,11 +63,6 @@ typedef struct rgb_decoder_s { } rgb_decoder_t; -static int rgb_can_handle (video_decoder_t *this_gen, int buf_type) { - - return (buf_type == BUF_VIDEO_RGB); -} - static void rgb_init (video_decoder_t *this_gen, vo_instance_t *video_out) { rgb_decoder_t *this = (rgb_decoder_t *) this_gen; @@ -154,7 +149,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -280,23 +275,13 @@ static void rgb_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { rgb_decoder_t *this ; - if (iface_version != 10) { - printf( "rgb: plugin doesn't support plugin API version %d.\n" - "rgb: this means there's a version mismatch between xine and this " - "rgb: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (rgb_decoder_t *) malloc (sizeof (rgb_decoder_t)); memset(this, 0, sizeof (rgb_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = rgb_can_handle; this->video_decoder.init = rgb_init; this->video_decoder.decode_data = rgb_decode_data; this->video_decoder.flush = rgb_flush; @@ -306,6 +291,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = rgb_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_RGB, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "rgb", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/roqvideo.c b/src/libxinevdec/roqvideo.c index bcee1a2b7..95c4d3809 100644 --- a/src/libxinevdec/roqvideo.c +++ b/src/libxinevdec/roqvideo.c @@ -18,7 +18,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: roqvideo.c,v 1.6 2002/07/15 21:42:34 esnel Exp $ + * $Id: roqvideo.c,v 1.7 2002/09/04 23:31:11 guenter Exp $ */ /* And this is the header that came with the RoQ video decoder: */ @@ -50,9 +50,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #define VIDEOBUFSIZE 128*1024 @@ -428,7 +428,7 @@ static void roq_decode_data (video_decoder_t *this_gen, if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* time to decode a frame */ img = this->video_out->get_frame (this->video_out, this->width, - this->height, XINE_ASPECT_RATIO_SQUARE, IMGFMT_YV12, + this->height, XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -489,22 +489,12 @@ static void roq_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { roq_decoder_t *this ; - if (iface_version != 10) { - printf(_("RoQ: plugin doesn't support plugin API version %d.\n" - "RoQ: this means there's a version mismatch between xine and this " - "RoQ: decoder plugin.\nInstalling current plugins should help.\n"), - iface_version); - return NULL; - } - this = (roq_decoder_t *) malloc (sizeof (roq_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = roq_can_handle; this->video_decoder.init = roq_init; this->video_decoder.decode_data = roq_decode_data; this->video_decoder.flush = roq_flush; @@ -514,5 +504,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = roq_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_ROQ, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "roq", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/svq1.c b/src/libxinevdec/svq1.c index c0353e70b..8e44612ba 100644 --- a/src/libxinevdec/svq1.c +++ b/src/libxinevdec/svq1.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: svq1.c,v 1.6 2002/07/18 22:58:54 esnel Exp $ + * $Id: svq1.c,v 1.7 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -25,11 +25,11 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "bswap.h" #include "xineutils.h" -#include "xine_internal.h" #include "svq1_codebooks.h" @@ -1366,10 +1366,6 @@ static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitches[3]) { } } -static int svq1dec_can_handle (video_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_VIDEO_SORENSON_V1); -} - static void svq1dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) { svq1dec_decoder_t *this = (svq1dec_decoder_t *) this_gen; @@ -1422,7 +1418,7 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) img = this->video_out->get_frame (this->video_out, this->svq1->width, this->svq1->height, - 42, IMGFMT_YV12, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -1500,22 +1496,12 @@ static void svq1dec_dispose (video_decoder_t *this_gen) { free (this_gen); } -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { svq1dec_decoder_t *this ; - if (iface_version != 10) { - printf( "svq1: plugin doesn't support plugin API version %d.\n" - "svq1: this means there's a version mismatch between xine and this " - "svq1: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (svq1dec_decoder_t *) xine_xmalloc (sizeof (svq1dec_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = svq1dec_can_handle; this->video_decoder.init = svq1dec_init; this->video_decoder.decode_data = svq1dec_decode_data; this->video_decoder.flush = svq1dec_flush; @@ -1525,5 +1511,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = svq1dec_dispose; this->video_decoder.priority = 4; - return (video_decoder_t *) this; + return this; } + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_SORENSON_V1, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 4 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "svq1", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxinevdec/wc3video.c b/src/libxinevdec/wc3video.c index 0fe835b7e..43ae0a873 100644 --- a/src/libxinevdec/wc3video.c +++ b/src/libxinevdec/wc3video.c @@ -22,7 +22,7 @@ * For more information on the WC3 Movie format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: wc3video.c,v 1.1 2002/09/04 02:52:16 tmmm Exp $ + * $Id: wc3video.c,v 1.2 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -31,9 +31,9 @@ #include #include -#include "video_out.h" #include "buffer.h" #include "xine_internal.h" +#include "video_out.h" #include "xineutils.h" #include "bswap.h" @@ -433,7 +433,7 @@ static void wc3video_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, WC3_WIDTH, WC3_HEIGHT, - 42, IMGFMT_YUY2, VO_BOTH_FIELDS); + 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -545,8 +545,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (wc3video_decoder_t *) malloc (sizeof (wc3video_decoder_t)); memset(this, 0, sizeof (wc3video_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = wc3video_can_handle; this->video_decoder.init = wc3video_init; this->video_decoder.decode_data = wc3video_decode_data; this->video_decoder.flush = wc3video_flush; diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c index 9ee9ad678..618e4d849 100644 --- a/src/libxinevdec/yuv.c +++ b/src/libxinevdec/yuv.c @@ -21,7 +21,7 @@ * Actually, this decoder just reorganizes chunks of raw YUV data in such * a way that xine can display them. * - * $Id: yuv.c,v 1.3 2002/08/28 14:03:30 miguelfreitas Exp $ + * $Id: yuv.c,v 1.4 2002/09/04 23:31:11 guenter Exp $ */ #include @@ -30,9 +30,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "buffer.h" -#include "xine_internal.h" #include "xineutils.h" #include "bswap.h" @@ -60,12 +60,6 @@ typedef struct yuv_decoder_s { * xine video plugin functions *************************************************************************/ -static int yuv_can_handle (video_decoder_t *this_gen, int buf_type) { - - return (buf_type == BUF_VIDEO_YVU9 || - buf_type == BUF_VIDEO_GREY); -} - /* * This function is responsible is called to initialize the video decoder * for use. Initialization usually involves setting up the fields in your @@ -145,7 +139,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YV12, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); xine_fast_memcpy(img->base[0], this->buf, this->width * this->height); @@ -188,7 +182,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YV12, VO_BOTH_FIELDS); + 42, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); xine_fast_memcpy(img->base[0], this->buf, this->width * this->height); memset( img->base[1], 0x80, this->width * this->height / 4 ); @@ -199,7 +193,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, /* just allocate something to avoid compiler warnings */ img = this->video_out->get_frame (this->video_out, this->width, this->height, - 42, IMGFMT_YV12, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); } @@ -289,23 +283,13 @@ static void yuv_dispose (video_decoder_t *this_gen) { * plugins for the same buffer types to coexist peacefully. The higher the * priority number, the more precedence a decoder has. E.g., 9 beats 1. */ -video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { +void *init_video_decoder_plugin (xine_t *xine, void *data) { yuv_decoder_t *this ; - if (iface_version != 10) { - printf( "yuv: plugin doesn't support plugin API version %d.\n" - "yuv: this means there's a version mismatch between xine and this " - "yuv: decoder plugin.\nInstalling current plugins should help.\n", - iface_version); - return NULL; - } - this = (yuv_decoder_t *) malloc (sizeof (yuv_decoder_t)); memset(this, 0, sizeof (yuv_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = yuv_can_handle; this->video_decoder.init = yuv_init; this->video_decoder.decode_data = yuv_decode_data; this->video_decoder.flush = yuv_flush; @@ -315,6 +299,25 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = yuv_dispose; this->video_decoder.priority = 1; - return (video_decoder_t *) this; + return this; } +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_YVU9, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 1 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "yuv", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libxvid/xine_decoder.c b/src/libxvid/xine_decoder.c index 7de76fa76..aa203282d 100644 --- a/src/libxvid/xine_decoder.c +++ b/src/libxvid/xine_decoder.c @@ -67,14 +67,6 @@ typedef struct xvid_decoder_s { void *xvid_handle; } xvid_decoder_t; -static int xvid_can_handle (video_decoder_t *this_gen, int buf_type) { - buf_type &= (BUF_MAJOR_MASK|BUF_DECODER_MASK); - - /* FIXME: what is it exactly that xvid can handle? :> */ - - return ((buf_type == BUF_VIDEO_XVID) || (buf_type == BUF_VIDEO_DIVX5)); -} - static void xvid_init_plugin (video_decoder_t *this_gen, vo_instance_t *video_out) { xvid_decoder_t *this = (xvid_decoder_t *) this_gen; @@ -155,8 +147,8 @@ static void xvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { image = this->video_out->get_frame (this->video_out, this->frame_width, this->frame_height, - XINE_ASPECT_RATIO_DONT_TOUCH, - IMGFMT_YV12, VO_BOTH_FIELDS); + XINE_VO_ASPECT_DONT_TOUCH, + XINE_IMGFMT_YV12, VO_BOTH_FIELDS); image->pts = buf->pts; image->duration = this->frame_duration; image->bad_frame = 0; @@ -243,8 +235,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (xvid_decoder_t *) malloc (sizeof (xvid_decoder_t)); - this->video_decoder.interface_version = iface_version; - this->video_decoder.can_handle = xvid_can_handle; this->video_decoder.init = xvid_init_plugin; this->video_decoder.decode_data = xvid_decode_data; this->video_decoder.flush = xvid_flush; @@ -253,8 +243,35 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this->video_decoder.dispose = xvid_dispose; this->video_decoder.priority = xine->config->register_num (xine->config, "codec.xvid_priority", 3, _("priority of the xvid plugin (>5 => enable)"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->frame_size = 0; return (video_decoder_t *) this; } + +static int xvid_can_handle (video_decoder_t *this_gen, int buf_type) { + buf_type &= (BUF_MAJOR_MASK|BUF_DECODER_MASK); + + /* FIXME: what is it exactly that xvid can handle? :> */ + return 0; +} + +/* + * exported plugin catalog entry + */ + +static uint32_t video_types[] = { + BUF_VIDEO_XVID, BUF_VIDEO_DIVX5, + 0 + }; + +static decoder_info_t dec_info_video = { + video_types, /* supported types */ + 3 /* priority */ +}; + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER, 10, "xvid", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 99cd43fe1..532e7d87d 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -2,45 +2,42 @@ SUBDIRS = libdha vidix VIDIX_CFLAGS = -I$(top_builddir)/src/video_out/vidix -I$(top_srcdir)/src/video_out/vidix -CFLAGS = @CFLAGS@ $(X_CFLAGS) $(LIBMPEG2_CFLAGS) -DXINE_COMPILE $(SDL_CFLAGS) $(VIDIX_CFLAGS) $(DIRECTFB_CFLAGS) -DEBUG_CFLAGS = @DEBUG_CFLAGS@ $(X_CFLAGS) $(LIBMPEG2_CFLAGS) -DXINE_COMPILE $(SDL_CFLAGS) $(VIDIX_CFLAGS) $(DIRECTFB_CFLAGS) +CFLAGS = @CFLAGS@ $(X_CFLAGS) $(LIBMPEG2_CFLAGS) -DXINE_COMPILE $(SDL_CFLAGS) $(VIDIX_CFLAGS) +DEBUG_CFLAGS = @DEBUG_CFLAGS@ $(X_CFLAGS) $(LIBMPEG2_CFLAGS) -DXINE_COMPILE $(SDL_CFLAGS) $(VIDIX_CFLAGS) LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic libdir = $(XINE_PLUGINDIR) -if HAVE_X11 -xshm_module = xineplug_vo_out_xshm.la -syncfb_module = xineplug_vo_out_syncfb.la -if HAVE_VIDIX -vidix_module = xineplug_vo_out_vidix.la -endif -if HAVE_XV +#if HAVE_X11 +#xshm_module = xineplug_vo_out_xshm.la +#syncfb_module = xineplug_vo_out_syncfb.la +#if HAVE_VIDIX +#vidix_module = xineplug_vo_out_vidix.la +#endif +#if HAVE_XV xv_module = xineplug_vo_out_xv.la -endif -if HAVE_OPENGL -opengl_module = xineplug_vo_out_opengl.la -endif -if HAVE_SUNFB -pgx64_module = xineplug_vo_out_pgx64.la -endif -endif +#endif +#if HAVE_OPENGL +#opengl_module = xineplug_vo_out_opengl.la +#endif +#endif -if HAVE_AA -aa_module = xineplug_vo_out_aa.la -endif +#if HAVE_AA +#aa_module = xineplug_vo_out_aa.la +#endif -if HAVE_FB -fb_module = xineplug_vo_out_fb.la -endif +#if HAVE_FB +#fb_module = xineplug_vo_out_fb.la +#endif -if HAVE_DIRECTFB -directfb_module = xineplug_vo_out_directfb.la -endif +#if HAVE_DIRECTFB +#directfb_module = xineplug_vo_out_directfb.la +#endif -if HAVE_SDL -sdl_module = xineplug_vo_out_sdl.la -endif +#if HAVE_SDL +#sdl_module = xineplug_vo_out_sdl.la +#endif @@ -49,67 +46,54 @@ endif # all xine video out plugins should be named # "xineplug_vo_out_*" -lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(directfb_module) $(aa_module) \ - $(syncfb_module) $(fb_module) $(opengl_module) \ - $(sdl_module) $(vidix_module) $(pgx64_module) +#lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(directfb_module) $(aa_module) \ +# $(syncfb_module) $(fb_module) $(opengl_module) $(sdl_module) $(vidix_module) +lib_LTLIBRARIES = $(xv_module) xineplug_vo_out_xv_la_SOURCES = deinterlace.c alphablend.c video_out_xv.c xineplug_vo_out_xv_la_LIBADD = $(XV_LIB) $(X_LIBS) -lXext \ - $(top_builddir)/src/xine-utils/libxineutils.la \ - $(top_builddir)/src/xine-engine/libxine.la + $(top_builddir)/src/xine-utils/libxineutils.la xineplug_vo_out_xv_la_LDFLAGS = -avoid-version -module -xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - alphablend.c video_out_xshm.c -xineplug_vo_out_xshm_la_LIBADD = $(X_LIBS) -lXext \ - $(top_builddir)/src/xine-utils/libxineutils.la \ - $(top_builddir)/src/xine-engine/libxine.la -xineplug_vo_out_xshm_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - alphablend.c video_out_opengl.c -xineplug_vo_out_opengl_la_LIBADD = $(OPENGL_LIBS) $(GLUT_LIBS) $(GLU_LIBS) $(X_LIBS) \ - $(top_builddir)/src/xine-utils/libxineutils.la -xineplug_vo_out_opengl_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_syncfb_la_SOURCES = alphablend.c video_out_syncfb.c -xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) -lXext \ - $(top_builddir)/src/xine-utils/libxineutils.la \ - $(top_builddir)/src/xine-engine/libxine.la -xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) -xineplug_vo_out_aa_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - alphablend.c video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = $(top_builddir)/src/xine-utils/libxineutils.la \ - $(top_builddir)/src/xine-engine/libxine.la -xineplug_vo_out_fb_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_directfb_la_SOURCES = alphablend.c video_out_directfb.c -xineplug_vo_out_directfb_la_LIBADD = $(DIRECTFB_LIBS) -xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_sdl_la_SOURCES = alphablend.c video_out_sdl.c -xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) \ - $(top_builddir)/src/xine-engine/libxine.la -xineplug_vo_out_sdl_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_vidix_la_SOURCES = alphablend.c video_out_vidix.c -xineplug_vo_out_vidix_la_LIBADD = $(X_LIBS) $(top_builddir)/src/video_out/vidix/libvidix.la \ - $(top_builddir)/src/xine-engine/libxine.la -xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module - -xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c -xineplug_vo_out_pgx64_la_LIBADD = $(X_LIBS) -xineplug_vo_out_pgx64_la_LDFLAGS = -avoid-version -module +#xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ +# alphablend.c video_out_xshm.c +#xineplug_vo_out_xshm_la_LIBADD = $(X_LIBS) -lXext \ +# $(top_builddir)/src/xine-utils/libxineutils.la +#xineplug_vo_out_xshm_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ +# alphablend.c video_out_opengl.c +#xineplug_vo_out_opengl_la_LIBADD = $(OPENGL_LIBS) $(GLUT_LIBS) $(GLU_LIBS) $(X_LIBS) \ +# $(top_builddir)/src/xine-utils/libxineutils.la +#xineplug_vo_out_opengl_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_syncfb_la_SOURCES = alphablend.c video_out_syncfb.c +#xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(top_builddir)/src/xine-utils/libxineutils.la +#xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_aa_la_SOURCES = video_out_aa.c +#xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) +#xineplug_vo_out_aa_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ +# alphablend.c video_out_fb.c +#xineplug_vo_out_fb_la_LIBADD = $(top_builddir)/src/xine-utils/libxineutils.la +#xineplug_vo_out_fb_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_directfb_la_SOURCES = alphablend.c video_out_directfb.c +#xineplug_vo_out_directfb_la_LIBADD = $(DIRECTFB_LIBS) +#xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_sdl_la_SOURCES = alphablend.c video_out_sdl.c +#xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) +#xineplug_vo_out_sdl_la_LDFLAGS = -avoid-version -module +# +#xineplug_vo_out_vidix_la_SOURCES = alphablend.c video_out_vidix.c +#xineplug_vo_out_vidix_la_LIBADD = $(X_LIBS) $(top_builddir)/src/video_out/vidix/libvidix.la +#xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module noinst_HEADERS = yuv2rgb.h video_out_syncfb.h alphablend.h deinterlace.h -include_HEADERS = video_out_x11.h - debug: @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) -DXINE_COMPILE" diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c index 07cb89dc4..1e9d19a6a 100644 --- a/src/video_out/alphablend.c +++ b/src/video_out/alphablend.c @@ -37,6 +37,7 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "alphablend.h" diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 99e66522e..6ebdc0dd7 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.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: video_out_aa.c,v 1.25 2002/08/10 21:25:20 miguelfreitas Exp $ + * $Id: video_out_aa.c,v 1.26 2002/09/04 23:31:12 guenter Exp $ * * video_out_aa.c, ascii-art output plugin for xine * @@ -27,6 +27,9 @@ #include "config.h" #endif +#warning DISABLED: FIXME +#if 0 + #include #include #include @@ -300,3 +303,5 @@ vo_info_t *get_video_out_plugin_info() { vo_info_aa.description = _("xine video output plugin using the ascii-art library"); return &vo_info_aa; } + +#endif diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 2d74452de..a6b0b43c1 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: video_out_fb.c,v 1.15 2002/08/23 00:24:30 miguelfreitas Exp $ + * $Id: video_out_fb.c,v 1.16 2002/09/04 23:31:12 guenter Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -44,6 +44,7 @@ #include #include +#include "xine.h" #include "video_out.h" #include @@ -90,7 +91,7 @@ typedef struct fb_frame_s { typedef struct fb_driver_s { - vo_driver_t vo_driver; + xine_vo_driver_t vo_driver; config_values_t *config; @@ -120,14 +121,14 @@ typedef struct fb_driver_s { * and now, the driver functions */ -static uint32_t fb_get_capabilities (vo_driver_t *this_gen) { +static uint32_t fb_get_capabilities (xine_vo_driver_t *this_gen) { return VO_CAP_COPIES_IMAGE | VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_BRIGHTNESS; } static void fb_frame_copy (vo_frame_t *vo_img, uint8_t **src) { fb_frame_t *frame = (fb_frame_t *) vo_img ; - if (frame->format == IMGFMT_YV12) { + if (frame->format == XINE_IMGFMT_YV12) { frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0], src[1], src[2]); } else { @@ -171,7 +172,7 @@ static void fb_frame_dispose (vo_frame_t *vo_img) { } -static vo_frame_t *fb_alloc_frame (vo_driver_t *this_gen) { +static vo_frame_t *fb_alloc_frame (xine_vo_driver_t *this_gen) { fb_driver_t *this = (fb_driver_t *) this_gen; fb_frame_t *frame ; @@ -226,7 +227,7 @@ static void fb_compute_rgb_size (fb_driver_t *this, fb_frame_t *frame) { #endif } -static void fb_update_frame_format (vo_driver_t *this_gen, +static void fb_update_frame_format (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { @@ -290,7 +291,7 @@ static void fb_update_frame_format (vo_driver_t *this_gen, frame->data = xine_xmalloc (frame->sc.output_width * frame->sc.output_height * this->bytes_per_pixel ); - if (format == IMGFMT_YV12) { + if (format == XINE_IMGFMT_YV12) { frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); @@ -387,7 +388,7 @@ static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, vo_overlay_t *overlay, } } -static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { +static void fb_overlay_blend (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { fb_driver_t *this = (fb_driver_t *) this_gen; fb_frame_t *frame = (fb_frame_t *) frame_gen; @@ -419,11 +420,11 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_o } } -static int fb_redraw_needed (vo_driver_t *this_gen) { +static int fb_redraw_needed (xine_vo_driver_t *this_gen) { return 0; } -static void fb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { +static void fb_display_frame (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { fb_driver_t *this = (fb_driver_t *) this_gen; fb_frame_t *frame = (fb_frame_t *) frame_gen; @@ -457,7 +458,7 @@ static void fb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { frame->vo_frame.displayed (&frame->vo_frame); } -static int fb_get_property (vo_driver_t *this_gen, int property) { +static int fb_get_property (xine_vo_driver_t *this_gen, int property) { fb_driver_t *this = (fb_driver_t *) this_gen; @@ -496,7 +497,7 @@ static int fb_set_property (vo_driver_t *this_gen, return value; } -static void fb_get_property_min_max (vo_driver_t *this_gen, +static void fb_get_property_min_max (xine_vo_driver_t *this_gen, int property, int *min, int *max) { /* fb_driver_t *this = (fb_driver_t *) this_gen; */ @@ -517,14 +518,14 @@ static int is_fullscreen_size (fb_driver_t *this, int w, int h) return 0; } -static int fb_gui_data_exchange (vo_driver_t *this_gen, +static int fb_gui_data_exchange (xine_vo_driver_t *this_gen, int data_type, void *data) { return 0; } -static void fb_exit (vo_driver_t *this_gen) { +static void fb_exit (xine_vo_driver_t *this_gen) { fb_driver_t *this = (fb_driver_t *) this_gen; @@ -533,7 +534,7 @@ static void fb_exit (vo_driver_t *this_gen) { close(this->fd); } -vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { +xine_vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { fb_driver_t *this; int mode; @@ -735,7 +736,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->yuv2rgb_gamma = config->register_range (config, "video.fb_gamma", 0, -100, 100, "gamma correction for fb driver", - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->yuv2rgb_factory = yuv2rgb_factory_init (mode, this->yuv2rgb_swap, this->yuv2rgb_cmap); @@ -749,7 +750,7 @@ static vo_info_t vo_info_fb = { 6, "fb", NULL, - VISUAL_TYPE_FB, + XINE_VISUAL_TYPE_FB, 5 }; @@ -757,3 +758,5 @@ vo_info_t *get_video_out_plugin_info() { vo_info_fb.description = _("xine video output plugin using linux framebuffer device"); return &vo_info_fb; } + + diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index c4ba278ef..2a504b9c0 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.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: video_out_opengl.c,v 1.16 2002/08/10 21:25:20 miguelfreitas Exp $ + * $Id: video_out_opengl.c,v 1.17 2002/09/04 23:31:12 guenter Exp $ * * video_out_glut.c, glut based OpenGL rendering interface for xine * Matthias Hopf @@ -57,6 +57,9 @@ #include "config.h" #endif +#warning DISABLED: FIXME +#if 0 + #include #include #include @@ -1113,3 +1116,4 @@ vo_info_t *get_video_out_plugin_info() { return &vo_info_shm; } +#endif diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index d03432cde..98b107892 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: video_out_sdl.c,v 1.12 2002/08/16 21:10:02 miguelfreitas Exp $ + * $Id: video_out_sdl.c,v 1.13 2002/09/04 23:31:12 guenter Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -49,15 +49,15 @@ #include #include -#include "video_out.h" +#include "xine.h" #include "xine_internal.h" +#include "video_out.h" #include "alphablend.h" #include "xineutils.h" #include "vo_scale.h" #ifdef HAVE_X11 #include -#include "video_out_x11.h" #endif /* @@ -75,13 +75,13 @@ typedef struct sdl_frame_s { struct sdl_driver_s { - vo_driver_t vo_driver; + xine_vo_driver_t vo_driver; config_values_t *config; - SDL_Surface * surface; - uint32_t sdlflags; - uint8_t bpp; + SDL_Surface *surface; + uint32_t sdlflags; + uint8_t bpp; pthread_mutex_t mutex; @@ -98,7 +98,7 @@ struct sdl_driver_s { }; -static uint32_t sdl_get_capabilities (vo_driver_t *this_gen) { +static uint32_t sdl_get_capabilities (xine_vo_driver_t *this_gen) { sdl_driver_t *this = (sdl_driver_t *) this_gen; @@ -119,7 +119,7 @@ static void sdl_frame_dispose (vo_frame_t *vo_img) { free (frame); } -static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) { +static vo_frame_t *sdl_alloc_frame (xine_vo_driver_t *this_gen) { sdl_frame_t *frame ; @@ -160,7 +160,7 @@ static void sdl_compute_output_size (sdl_driver_t *this) { } -static void sdl_update_frame_format (vo_driver_t *this_gen, +static void sdl_update_frame_format (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { @@ -181,14 +181,14 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, frame->overlay = NULL; } - if( format == IMGFMT_YV12 ) { + if( format == XINE_IMGFMT_YV12 ) { #ifdef SDL_LOG printf ("video_out_sdl: format YV12 "); #endif frame->overlay = SDL_CreateYUVOverlay (width, height, SDL_YV12_OVERLAY, this->surface); - } else if( format == IMGFMT_YUY2 ) { + } else if( format == XINE_IMGFMT_YUY2 ) { #ifdef SDL_LOG printf ("video_out_sdl: format YUY2 "); #endif @@ -219,12 +219,12 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, /* * */ -static void sdl_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { +static void sdl_overlay_blend (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { sdl_frame_t *frame = (sdl_frame_t *) frame_gen; if (overlay->rle) { - if( frame->format == IMGFMT_YV12 ) + if( frame->format == XINE_IMGFMT_YV12 ) blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height); else blend_yuy2( frame->vo_frame.base[0], overlay, frame->width, frame->height); @@ -251,7 +251,7 @@ static void sdl_check_events (sdl_driver_t * this) } } -static int sdl_redraw_needed (vo_driver_t *this_gen) { +static int sdl_redraw_needed (xine_vo_driver_t *this_gen) { sdl_driver_t *this = (sdl_driver_t *) this_gen; int ret = 0; @@ -290,7 +290,7 @@ static int sdl_redraw_needed (vo_driver_t *this_gen) { } -static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { +static void sdl_display_frame (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { sdl_driver_t *this = (sdl_driver_t *) this_gen; sdl_frame_t *frame = (sdl_frame_t *) frame_gen; @@ -331,7 +331,7 @@ static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { pthread_mutex_unlock(&this->mutex); } -static int sdl_get_property (vo_driver_t *this_gen, int property) { +static int sdl_get_property (xine_vo_driver_t *this_gen, int property) { sdl_driver_t *this = (sdl_driver_t *) this_gen; @@ -360,7 +360,7 @@ static int sdl_set_property (vo_driver_t *this_gen, return value; } -static void sdl_get_property_min_max (vo_driver_t *this_gen, +static void sdl_get_property_min_max (xine_vo_driver_t *this_gen, int property, int *min, int *max) { /* sdl_driver_t *this = (sdl_driver_t *) this_gen; */ @@ -377,9 +377,9 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, switch (data_type) { - case GUI_DATA_EX_DRAWABLE_CHANGED: + case XINE_GUI_SEND_DRAWABLE_CHANGED: #ifdef SDL_LOG - printf ("video_out_sdl: GUI_DATA_EX_DRAWABLE_CHANGED\n"); + printf ("video_out_sdl: XINE_GUI_SEND_DRAWABLE_CHANGED\n"); #endif this->drawable = (Drawable) data; @@ -387,9 +387,9 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, /* probably we need to close and reinitialize SDL */ break; - case GUI_DATA_EX_EXPOSE_EVENT: + case XINE_GUI_SEND_EXPOSE_EVENT: #ifdef SDL_LOG - printf ("video_out_sdl: GUI_DATA_EX_EXPOSE_EVENT\n"); + printf ("video_out_sdl: XINE_GUI_SEND_EXPOSE_EVENT\n"); #endif break; @@ -421,7 +421,7 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, return ret; } -static void sdl_exit (vo_driver_t *this_gen) { +static void sdl_exit (xine_vo_driver_t *this_gen) { sdl_driver_t *this = (sdl_driver_t *) this_gen; @@ -429,7 +429,7 @@ static void sdl_exit (vo_driver_t *this_gen) { SDL_QuitSubSystem (SDL_INIT_VIDEO); } -vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { +xine_vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { sdl_driver_t *this; const SDL_VideoInfo * vidInfo; @@ -530,7 +530,7 @@ static vo_info_t vo_info_sdl = { 6, "sdl", NULL, - VISUAL_TYPE_X11, + XINE_VISUAL_TYPE_X11, 4 }; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index e727dee77..7465dcf26 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.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: video_out_syncfb.c,v 1.76 2002/08/16 22:51:39 miguelfreitas Exp $ + * $Id: video_out_syncfb.c,v 1.77 2002/09/04 23:31:12 guenter Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -53,8 +53,8 @@ #include "video_out_syncfb.h" +#include "xine.h" #include "video_out.h" -#include "video_out_x11.h" #include "xine_internal.h" #include "alphablend.h" #include "xineutils.h" @@ -78,7 +78,7 @@ typedef struct { struct syncfb_driver_s { - vo_driver_t vo_driver; + xine_vo_driver_t vo_driver; config_values_t *config; @@ -263,14 +263,14 @@ static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) { switch(frame->format) { - case IMGFMT_YUY2: + case XINE_IMGFMT_YUY2: if(this->capabilities.palettes & (1<yuv_format) { case VIDEO_PALETTE_YUV422: write_frame_YUV422(this, frame); @@ -378,13 +378,13 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->syncfb_config.syncfb_mode |= SYNCFB_FEATURE_DEINTERLACE; switch(this->cur_frame->format) { - case IMGFMT_YV12: + case XINE_IMGFMT_YV12: this->syncfb_config.src_palette = this->yuv_format; break; - case IMGFMT_YUY2: + case XINE_IMGFMT_YUY2: this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; break; - default: + default: printf("video_out_syncfb: error. (unknown frame format)\n"); this->syncfb_config.src_palette = 0; break; @@ -420,7 +420,7 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) * public functions defined and used by the xine interface */ -static int syncfb_redraw_needed(vo_driver_t* this_gen) +static int syncfb_redraw_needed(xine_vo_driver_t* this_gen) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; @@ -438,7 +438,7 @@ static int syncfb_redraw_needed(vo_driver_t* this_gen) return ret; } -static uint32_t syncfb_get_capabilities (vo_driver_t *this_gen) +static uint32_t syncfb_get_capabilities (xine_vo_driver_t *this_gen) { syncfb_driver_t *this = (syncfb_driver_t *) this_gen; @@ -460,7 +460,7 @@ static void syncfb_frame_dispose(vo_frame_t* vo_img) } } -static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) +static vo_frame_t* syncfb_alloc_frame(xine_vo_driver_t* this_gen) { syncfb_frame_t* frame; @@ -488,7 +488,7 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) return (vo_frame_t *) frame; } -static void syncfb_update_frame_format(vo_driver_t* this_gen, +static void syncfb_update_frame_format(xine_vo_driver_t* this_gen, vo_frame_t* frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) @@ -510,7 +510,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->format = format; switch(format) { - case IMGFMT_YV12: + case XINE_IMGFMT_YV12: /* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame_size, (void **)&frame->data_mem[0]); frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[1]); frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[2]);*/ @@ -521,21 +521,21 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->vo_frame.base[1] = malloc(frame->vo_frame.pitches[1] * ((height+1)/2)); frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); break; - case IMGFMT_YUY2: + case XINE_IMGFMT_YUY2: /* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, (frame_size*2), (void **)&frame->data_mem[0]);*/ frame->vo_frame.pitches[0] = 8*((width + 3) / 4); frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; break; - default: + default: printf("video_out_syncfb: error. (unable to allocate framedata because of unknown frame format: %04x)\n", format); } /* if((format == IMGFMT_YV12 && (frame->data_mem[0] == NULL || frame->data_mem[1] == NULL || frame->data_mem[2] == NULL)) || (format == IMGFMT_YUY2 && frame->data_mem[0] == NULL)) {*/ - if((format == IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) - || (format == IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { + if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) + || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { printf("video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); @@ -545,20 +545,20 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->ratio_code = ratio_code; } -static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) +static void syncfb_overlay_blend(xine_vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) { syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; /* alpha blend here */ if(overlay->rle) { - if(frame->format == IMGFMT_YV12) + if(frame->format == XINE_IMGFMT_YV12) blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height); else blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height); } } -static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) +static void syncfb_display_frame(xine_vo_driver_t* this_gen, vo_frame_t* frame_gen) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; @@ -631,14 +631,14 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) this->bufinfo.id = -1; } -static int syncfb_get_property(vo_driver_t* this_gen, int property) +static int syncfb_get_property(xine_vo_driver_t* this_gen, int property) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; return this->props[property].value; } -static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) +static int syncfb_set_property(xine_vo_driver_t* this_gen, int property, int value) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; @@ -745,7 +745,7 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) return value; } -static void syncfb_get_property_min_max(vo_driver_t *this_gen, +static void syncfb_get_property_min_max(xine_vo_driver_t *this_gen, int property, int *min, int *max) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; @@ -760,7 +760,7 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, syncfb_driver_t* this = (syncfb_driver_t *) this_gen; switch (data_type) { - case GUI_DATA_EX_DRAWABLE_CHANGED: + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); break; @@ -790,7 +790,7 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, return 0; } -static void syncfb_exit(vo_driver_t *this_gen) +static void syncfb_exit(xine_vo_driver_t *this_gen) { syncfb_driver_t *this = (syncfb_driver_t *) this_gen; @@ -803,7 +803,7 @@ static void syncfb_exit(vo_driver_t *this_gen) close(this->fd); } -vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) +xine_vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) { syncfb_driver_t* this; Display* display = NULL; @@ -815,7 +815,8 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) display = visual->display; device_name = config->register_string(config, "video.syncfb_device", "/dev/syncfb", - _("syncfb (teletux) device node"), NULL, NULL, NULL); + _("syncfb (teletux) device node"), + NULL, 10, NULL, NULL); if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) { printf("video_out_syncfb: aborting. (allocation of syncfb_driver_t failed: out of memory)\n"); @@ -938,7 +939,10 @@ vo_driver_t *init_video_out_plugin(config_values_t *config, void *visual_gen) /* FIXME: setting the default_repeat to anything higher than 1 will result in a distorted video, so for now, set this manually to 0 until the kernel driver is fixed... */ - this->default_repeat = config->register_range(config, "video.syncfb_default_repeat", 3, 1, 4, "default frame repeat for SyncFB", NULL, NULL, NULL); + this->default_repeat = config->register_range(config, + "video.syncfb_default_repeat", 3, 1, 4, + "default frame repeat for SyncFB", NULL, + 0, NULL, NULL); this->default_repeat = 0; this->display = visual->display; @@ -978,7 +982,7 @@ static vo_info_t vo_info_syncfb = { 6, "SyncFB", NULL, - VISUAL_TYPE_X11, + XINE_VISUAL_TYPE_X11, 10 }; @@ -986,3 +990,5 @@ vo_info_t *get_video_out_plugin_info() { vo_info_syncfb.description = _("xine video output plugin using the SyncFB module for Matrox G200/G400 cards"); return &vo_info_syncfb; } + + diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index a610705b6..9262f14b0 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: video_out_vidix.c,v 1.10 2002/09/02 19:58:47 f1rmb Exp $ + * $Id: video_out_vidix.c,v 1.11 2002/09/04 23:31:12 guenter Exp $ * * video_out_vidix.c * @@ -33,6 +33,9 @@ #include "config.h" #endif +#warning DISABLED: FIXME +#if 0 + #include #include #include @@ -741,3 +744,4 @@ vo_info_t *get_video_out_plugin_info() { return &vo_info_vidix; } +#endif diff --git a/src/video_out/video_out_x11.h b/src/video_out/video_out_x11.h deleted file mode 100644 index 16d687277..000000000 --- a/src/video_out/video_out_x11.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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: video_out_x11.h,v 1.15 2002/03/21 18:29:51 miguelfreitas Exp $ - * - * structs and defines specific to all x11 related output plugins - * (any x11 base xine ui should include this) - */ - -#ifndef HAVE_VIDEO_OUT_X11_H -#define HAVE_VIDEO_OUT_X11_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - - /* area of that drawable to be used by video */ - int x,y,w,h; - -} x11_rectangle_t; - -/* - * this is the visual data struct any x11 gui should supply - * (pass this to init_video_out_plugin or the xine_load_video_output_plugin - * utility function) - */ - -typedef struct { - - /* some information about the display */ - Display *display; - int screen; - double display_ratio; - - /* drawable to display the video in/on */ - Drawable d; - - void *user_data; - - /* - * dest size callback - * - * this will be called by the video driver to find out - * how big the video output area size will be for a - * given video size. The ui should _not_ adjust it's - * video out area, just do some calculations and return - * the size. This will be called for every frame, ui - * implementation should be fast. - */ - void (*dest_size_cb) (void *user_data, - int video_width, int video_height, - int *dest_width, int *dest_height); - - /* - * frame output callback - * - * this will be called by the video driver for every frame - * it's about to draw. ui can adapt it's size if necessary - * here. - * note: the ui doesn't have to adjust itself to this - * size, this is just to be taken as a hint. - * ui must return the actual size of the video output - * area and the video output driver will do it's best - * to adjust the video frames to that size (while - * preserving aspect ration and stuff). - * dest_x, dest_y: offset inside window - * dest_width, dest_height: available drawing space - * win_x, win_y: window absolute screen position - */ - - void (*frame_output_cb) (void *user_data, - int video_width, int video_height, - int *dest_x, int *dest_y, - int *dest_width, int *dest_height, - int *win_x, int *win_y); - -} x11_visual_t; - -/* - * constants for gui_data_exchange's data_type parameter - */ - -/* xevent *data */ -#define GUI_DATA_EX_COMPLETION_EVENT 1 -/* Drawable has changed */ -#define GUI_DATA_EX_DRAWABLE_CHANGED 2 -/* xevent *data */ -#define GUI_DATA_EX_EXPOSE_EVENT 3 -/* x11_rectangle_t *data */ -#define GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO 4 -/* int *data */ -#define GUI_DATA_EX_VIDEOWIN_VISIBLE 5 - -/* *data contains chosen visual, select a new one or change it to NULL - * to indicate the visual to use or that no visual will work */ -/* XVisualInfo **data */ -#define GUI_SELECT_VISUAL 8 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index f9b0b32ab..f202d6d95 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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: video_out_xshm.c,v 1.86 2002/08/28 14:20:10 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.87 2002/09/04 23:31:12 guenter Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -37,6 +37,7 @@ #include #include +#include "xine.h" #include "video_out.h" #include @@ -54,7 +55,6 @@ #include #include "xine_internal.h" -#include "video_out_x11.h" #include "alphablend.h" #include "yuv2rgb.h" #include "xineutils.h" @@ -90,7 +90,7 @@ typedef struct xshm_frame_s { typedef struct xshm_driver_s { - vo_driver_t vo_driver; + xine_vo_driver_t vo_driver; config_values_t *config; @@ -296,7 +296,7 @@ static void dispose_ximage (xshm_driver_t *this, * and now, the driver functions */ -static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { +static uint32_t xshm_get_capabilities (xine_vo_driver_t *this_gen) { return VO_CAP_COPIES_IMAGE | VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_BRIGHTNESS; } @@ -308,7 +308,7 @@ static void xshm_frame_copy (vo_frame_t *vo_img, uint8_t **src) { printf ("video_out_xshm: copy... (format %d)\n", frame->format); #endif - if (frame->format == IMGFMT_YV12) { + if (frame->format == XINE_IMGFMT_YV12) { frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0], src[1], src[2]); } else { @@ -360,7 +360,7 @@ static void xshm_frame_dispose (vo_frame_t *vo_img) { } -static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { +static vo_frame_t *xshm_alloc_frame (xine_vo_driver_t *this_gen) { xshm_frame_t *frame ; xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -422,7 +422,7 @@ static void xshm_compute_rgb_size (xshm_driver_t *this, xshm_frame_t *frame) { #endif } -static void xshm_update_frame_format (vo_driver_t *this_gen, +static void xshm_update_frame_format (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { @@ -521,7 +521,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, XUnlockDisplay (this->display); - if (format == IMGFMT_YV12) { + if (format == XINE_IMGFMT_YV12) { frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); @@ -597,7 +597,7 @@ static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overla } } -static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { +static void xshm_overlay_blend (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -649,7 +649,7 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { XUnlockDisplay (this->display); } -static int xshm_redraw_needed (vo_driver_t *this_gen) { +static int xshm_redraw_needed (xine_vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; int ret = 0; @@ -669,7 +669,7 @@ static int xshm_redraw_needed (vo_driver_t *this_gen) { return ret; } -static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { +static void xshm_display_frame (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -759,7 +759,7 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { #endif } -static int xshm_get_property (vo_driver_t *this_gen, int property) { +static int xshm_get_property (xine_vo_driver_t *this_gen, int property) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -807,7 +807,7 @@ static int xshm_set_property (vo_driver_t *this_gen, return value; } -static void xshm_get_property_min_max (vo_driver_t *this_gen, +static void xshm_get_property_min_max (xine_vo_driver_t *this_gen, int property, int *min, int *max) { /* xshm_driver_t *this = (xshm_driver_t *) this_gen; */ @@ -826,7 +826,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, xshm_driver_t *this = (xshm_driver_t *) this_gen; switch (data_type) { - case GUI_DATA_EX_COMPLETION_EVENT: { + case XINE_GUI_SEND_COMPLETION_EVENT: { XShmCompletionEvent *cev = (XShmCompletionEvent *) data; @@ -844,7 +844,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, } break; - case GUI_DATA_EX_EXPOSE_EVENT: + case XINE_GUI_SEND_EXPOSE_EVENT: /* FIXME : take care of completion events */ #ifdef LOG @@ -894,7 +894,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, break; - case GUI_DATA_EX_DRAWABLE_CHANGED: + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; XFreeGC(this->display, this->gc); @@ -902,7 +902,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, break; - case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: if (this->cur_frame) { @@ -930,7 +930,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, return 0; } -static void xshm_exit (vo_driver_t *this_gen) { +static void xshm_exit (xine_vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -996,7 +996,7 @@ static char *visual_class_name(Visual *visual) { } } -vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { +xine_vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { xshm_driver_t *this; x11_visual_t *visual = (x11_visual_t *) visual_gen; @@ -1038,7 +1038,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->sc.scaling_disabled = config->register_bool (config, "video.disable_scaling", 0, _("disable all video scaling (faster!)"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); this->drawable = visual->d; this->expecting_event = 0; this->cur_frame = NULL; @@ -1185,7 +1185,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->yuv2rgb_gamma = config->register_range (config, "video.xshm_gamma", 0, -100, 100, _("gamma correction for XShm driver"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, this->yuv2rgb_cmap); @@ -1198,7 +1198,7 @@ static vo_info_t vo_info_shm = { 6, /* interface version */ "XShm", /* id */ NULL, - VISUAL_TYPE_X11, /* visual_type */ + XINE_VISUAL_TYPE_X11, /* visual_type */ 6 }; @@ -1207,3 +1207,4 @@ vo_info_t *get_video_out_plugin_info() { return &vo_info_shm; } + diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 56c729217..015c18757 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.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: video_out_xv.c,v 1.128 2002/08/19 13:06:37 miguelfreitas Exp $ + * $Id: video_out_xv.c,v 1.129 2002/09/04 23:31:12 guenter Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -41,6 +41,7 @@ #include #include #include +#include #if defined(__FreeBSD__) #include @@ -57,8 +58,8 @@ #include #include +#include "xine.h" #include "video_out.h" -#include "video_out_x11.h" #include "xine_internal.h" /* #include "overlay.h" */ #include "alphablend.h" @@ -97,7 +98,7 @@ typedef struct { struct xv_driver_s { - vo_driver_t vo_driver; + xine_vo_driver_t vo_driver; config_values_t *config; @@ -113,7 +114,6 @@ struct xv_driver_s { XColor black; int expecting_event; /* completion event handling */ int use_shm; - xv_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; @@ -138,7 +138,7 @@ struct xv_driver_s { int gX11Fail; -static uint32_t xv_get_capabilities (vo_driver_t *this_gen) { +static uint32_t xv_get_capabilities (xine_vo_driver_t *this_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -175,7 +175,7 @@ static void xv_frame_dispose (vo_frame_t *vo_img) { free (frame); } -static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { +static vo_frame_t *xv_alloc_frame (xine_vo_driver_t *this_gen) { xv_frame_t *frame ; @@ -234,10 +234,10 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, XvImage *image=NULL; switch (format) { - case IMGFMT_YV12: + case XINE_IMGFMT_YV12: xv_format = this->xv_format_yv12; break; - case IMGFMT_YUY2: + case XINE_IMGFMT_YUY2: xv_format = this->xv_format_yuy2; break; default: @@ -337,10 +337,10 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, char *data; switch (format) { - case IMGFMT_YV12: + case XINE_IMGFMT_YV12: data = malloc (width * height * 3/2); break; - case IMGFMT_YUY2: + case XINE_IMGFMT_YUY2: data = malloc (width * height * 2); break; default: @@ -375,7 +375,7 @@ static void dispose_ximage (xv_driver_t *this, } } -static void xv_update_frame_format (vo_driver_t *this_gen, +static void xv_update_frame_format (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, int ratio_code, int format, int flags) { @@ -561,14 +561,14 @@ static void xv_compute_output_size (xv_driver_t *this) { /* onefield_xv divide by 2 the number of lines */ if (this->deinterlace_enabled - && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) - && (this->cur_frame->format == IMGFMT_YV12)) { + && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) + && (this->cur_frame->format == XINE_IMGFMT_YV12)) { this->sc.displayed_height = this->sc.displayed_height / 2; this->sc.displayed_yoffset = this->sc.displayed_yoffset / 2; } } -static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { +static void xv_overlay_blend (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -577,7 +577,7 @@ static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_o */ if (overlay->rle) { - if( frame->format == IMGFMT_YV12 ) + if (frame->format == XINE_IMGFMT_YV12) blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height); else blend_yuy2( frame->vo_frame.base[0], overlay, frame->width, frame->height); @@ -614,10 +614,10 @@ static void xv_flush_recent_frames (xv_driver_t *this) { } #endif -static int xv_redraw_needed (vo_driver_t *this_gen) { +static int xv_redraw_needed (xine_vo_driver_t *this_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; int ret = 0; - + if( vo_scale_redraw_needed( &this->sc ) ) { xv_compute_output_size (this); @@ -630,7 +630,7 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { return ret; } -static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { +static void xv_display_frame (xine_vo_driver_t *this_gen, vo_frame_t *frame_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -661,7 +661,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { */ if (this->deinterlace_enabled && this->deinterlace_method - && frame->format == IMGFMT_YV12) + && frame->format == XINE_IMGFMT_YV12) xv_deinterlace_frame (this); /* @@ -721,24 +721,25 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { */ } -static int xv_get_property (vo_driver_t *this_gen, int property) { +static int xv_get_property (xine_vo_driver_t *this_gen, int property) { xv_driver_t *this = (xv_driver_t *) this_gen; return this->props[property].value; } -static void xv_property_callback (void *property_gen, cfg_entry_t *entry) { +static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { xv_property_t *property = (xv_property_t *) property_gen; xv_driver_t *this = property->this; XvSetPortAttribute (this->display, this->xv_port, - property->atom, entry->num_value); + property->atom, + entry->num_value); } -static int xv_set_property (vo_driver_t *this_gen, +static int xv_set_property (xine_vo_driver_t *this_gen, int property, int value) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -814,7 +815,7 @@ static int xv_set_property (vo_driver_t *this_gen, return value; } -static void xv_get_property_min_max (vo_driver_t *this_gen, +static void xv_get_property_min_max (xine_vo_driver_t *this_gen, int property, int *min, int *max) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -823,13 +824,13 @@ static void xv_get_property_min_max (vo_driver_t *this_gen, *max = this->props[property].max; } -static int xv_gui_data_exchange (vo_driver_t *this_gen, +static int xv_gui_data_exchange (xine_vo_driver_t *this_gen, int data_type, void *data) { xv_driver_t *this = (xv_driver_t *) this_gen; switch (data_type) { - case GUI_DATA_EX_COMPLETION_EVENT: { + case XINE_GUI_SEND_COMPLETION_EVENT: { XShmCompletionEvent *cev = (XShmCompletionEvent *) data; @@ -841,7 +842,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, } break; - case GUI_DATA_EX_EXPOSE_EVENT: { + case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ @@ -884,12 +885,12 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, } break; - case GUI_DATA_EX_DRAWABLE_CHANGED: + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); break; - case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: { int x1, y1, x2, y2; x11_rectangle_t *rect = data; @@ -906,7 +907,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, /* onefield_xv divide by 2 the number of lines */ if (this->deinterlace_enabled && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) - && (this->cur_frame->format == IMGFMT_YV12)) { + && (this->cur_frame->format == XINE_IMGFMT_YV12)) { rect->y = rect->y * 2; rect->h = rect->h * 2; } @@ -921,7 +922,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, return 0; } -static void xv_exit (vo_driver_t *this_gen) { +static void xv_exit (xine_vo_driver_t *this_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; int i; @@ -956,7 +957,7 @@ static int xv_check_yv12 (Display *display, XvPortID port) { formatValues = XvListImageFormats (display, port, &formats); for (i = 0; i < formats; i++) - if ((formatValues[i].id == IMGFMT_YV12) && + if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { XFree (formatValues); return 0; @@ -997,13 +998,13 @@ static void xv_check_capability (xv_driver_t *this, if ((attr.min_value == 0) && (attr.max_value == 1)) { this->config->register_bool (this->config, this->scratch, int_default, _("Xv property"), - NULL, xv_property_callback, &this->props[property]); + NULL, 10, xv_property_callback, &this->props[property]); } else { this->config->register_range (this->config, this->scratch, int_default, this->props[property].min, this->props[property].max, _("Xv property"), - NULL, xv_property_callback, &this->props[property]); + NULL, 10, xv_property_callback, &this->props[property]); } entry = this->config->lookup_entry (this->config, this->scratch); @@ -1018,15 +1019,13 @@ static void xv_check_capability (xv_driver_t *this, } } -static void xv_update_deinterlace(void *this_gen, cfg_entry_t *entry) -{ +static void xv_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { xv_driver_t *this = (xv_driver_t *) this_gen; this->deinterlace_method = entry->num_value; } -static void xv_update_XV_FILTER(void *this_gen, cfg_entry_t *entry) -{ +static void xv_update_XV_FILTER(void *this_gen, xine_cfg_entry_t *entry) { xv_driver_t *this = (xv_driver_t *) this_gen; Atom atom; int xv_filter; @@ -1039,8 +1038,7 @@ static void xv_update_XV_FILTER(void *this_gen, cfg_entry_t *entry) printf("video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); } -static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, cfg_entry_t *entry) -{ +static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) { xv_driver_t *this = (xv_driver_t *) this_gen; Atom atom; int xv_double_buffer; @@ -1054,8 +1052,9 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, cfg_entry_t *entry) } -vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { +void *init_video_out_plugin (xine_t *xine, void *visual_gen) { + config_values_t *config = xine->config; xv_driver_t *this; Display *display = NULL; unsigned int adaptor_num, adaptors, i, j, formats; @@ -1141,7 +1140,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->overlay = NULL; this->screen = visual->screen; - vo_scale_init( &this->sc, visual->display_ratio, 1, 0 ); + vo_scale_init (&this->sc, 1.0 /* FIXME */, 1, 0 ); this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; @@ -1239,13 +1238,13 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { xv_filter = config->register_range (config, "video.XV_FILTER", 0, attr[k].min_value, attr[k].max_value, _("bilinear scaling mode (permedia 2/3)"), - NULL, xv_update_XV_FILTER, this); + NULL, 10, xv_update_XV_FILTER, this); config->update_num(config,"video.XV_FILTER",xv_filter); } else if(!strcmp(attr[k].name, "XV_DOUBLE_BUFFER")) { int xv_double_buffer; xv_double_buffer = config->register_bool (config, "video.XV_DOUBLE_BUFFER", 1, _("double buffer to sync video to the retrace"), - NULL, xv_update_XV_DOUBLE_BUFFER, this); + NULL, 10, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.XV_DOUBLE_BUFFER",xv_double_buffer); } } @@ -1272,11 +1271,11 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); #endif - if (fo[i].id == IMGFMT_YV12) { + if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; printf("video_out_xv: this adaptor supports the yv12 format.\n"); - } else if (fo[i].id == IMGFMT_YUY2) { + } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; printf("video_out_xv: this adaptor supports the yuy2 format.\n"); @@ -1288,24 +1287,22 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { * to find out if MIT shm really works, using supported format */ myimage = create_ximage (this, &myshminfo, 100, 100, - (this->xv_format_yv12 != 0) ? IMGFMT_YV12 : IMGFMT_YUY2); + (this->xv_format_yv12 != 0) ? XINE_IMGFMT_YV12 : XINE_IMGFMT_YUY2); dispose_ximage (this, &myshminfo, myimage); this->deinterlace_method = config->register_enum (config, "video.deinterlace_method", 4, deinterlace_methods, _("Software deinterlace method (Key I toggles deinterlacer on/off)"), - NULL, xv_update_deinterlace, this); + NULL, 10, xv_update_deinterlace, this); this->deinterlace_enabled = 0; return &this->vo_driver; } static vo_info_t vo_info_xv = { - 6, - "Xv", - NULL, - VISUAL_TYPE_X11, - 9 + 5, /* priority */ + "xine video output plugin using the MIT X video extension", /* description */ + XINE_VISUAL_TYPE_X11 /* visual type */ }; vo_info_t *get_video_out_plugin_info() { @@ -1313,4 +1310,17 @@ vo_info_t *get_video_out_plugin_info() { return &vo_info_xv; } +/* + * exported plugin catalog entry + */ + +plugin_info_t xine_plugin_info[] = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_OUT, 9, "xv", XINE_VERSION_CODE, &vo_info_xv, init_video_out_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + + #endif + + diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index b7d7174a4..dbb8e8aec 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -14,7 +14,7 @@ endif libxine_la_SOURCES = $(nvtv) xine.c metronom.c configfile.c buffer.c \ load_plugins.c video_decoder.c buffer_types.c \ audio_decoder.c video_out.c audio_out.c resample.c events.c lrb.c \ - video_overlay.c osd.c scratch.c locale.c demux.c vo_scale.c + video_overlay.c osd.c scratch.c locale.c demux.c vo_scale.c xine_interface.c libxine_la_DEPENDENCIES = @INTLLIBS@ libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ $(ZLIB_LIBS) -lm @@ -23,7 +23,7 @@ libxine_la_LDFLAGS = \ include_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \ audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \ - events.h lrb.h video_overlay.h osd.h scratch.h xineintl.h + lrb.h video_overlay.h osd.h scratch.h xineintl.h noinst_HEADERS = bswap.h nvtvd.h diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index b40675912..cabd18b03 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.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_decoder.c,v 1.82 2002/07/26 14:51:23 mroi Exp $ + * $Id: audio_decoder.c,v 1.83 2002/09/04 23:31:13 guenter Exp $ * * * functions that implement audio decoding @@ -234,7 +234,7 @@ void *audio_decoder_loop (void *this_gen) { int streamtype = (buf->type>>16) & 0xFF; - decoder = this->audio_decoder_plugins [streamtype]; + decoder = get_audio_decoder (this, streamtype); /* close old decoder of audio type has changed */ @@ -362,19 +362,3 @@ int xine_get_audio_channel (xine_t *this) { return this->audio_type & 0xFFFF; } -void xine_select_audio_channel (xine_t *this, int channel) { - - pthread_mutex_lock (&this->xine_lock); - - if (channel < -2) - channel = -2; - - this->audio_channel_user = channel; - - pthread_mutex_unlock (&this->xine_lock); -} - -int xine_get_audio_selection (xine_t *this) { - - return this->audio_channel_user; -} diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index bfba30d6e..89ac7afde 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.63 2002/08/09 22:07:29 mroi Exp $ + * $Id: audio_out.c,v 1.64 2002/09/04 23:31:13 guenter Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -704,10 +704,6 @@ static void ao_exit(ao_instance_t *this) { vol = this->driver->get_property(this->driver, prop); this->xine->config->update_num(this->xine->config, "audio.mixer_volume", vol); - - /* Save config is needed, otherwise value change will be lost */ - this->xine->config->save(this->xine->config); - this->driver->exit(this->driver); pthread_mutex_unlock( &this->driver_lock ); @@ -792,7 +788,7 @@ static int ao_control (ao_instance_t *this, int cmd, ...) { return rval; } -ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) { +ao_instance_t *ao_new_instance (xine_ao_driver_t *driver, xine_t *xine) { config_values_t *config = xine->config; ao_instance_t *this; @@ -823,16 +819,16 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) { this->resample_conf = config->register_enum (config, "audio.resample_mode", 0, resample_modes, _("adjust whether resampling is done or not"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->force_rate = config->register_num (config, "audio.force_rate", 0, _("if !=0 always resample to given rate"), - NULL, NULL, NULL); + NULL, 20, NULL, NULL); this->passthrough_offset = config->register_num (config, "audio.passthrough_offset", 10000, _("adjust if audio is offsync"), - NULL, NULL, NULL); + NULL, 10, NULL, NULL); /* * pre-allocate memory for samples @@ -872,12 +868,12 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) { vol = config->register_range (config, "audio.mixer_volume", 50, 0, 100, _("Audio volume"), - NULL, NULL, NULL); + NULL, 0, NULL, NULL); if(config->register_bool (config, "audio.remember_volume", 0, _("restore volume level at startup"), _("if this not set, xine will not touch any mixer settings at startup"), - NULL, NULL)) { + 0, NULL, NULL)) { int prop = 0; if((ao_get_capabilities(this)) & AO_CAP_MIXER_VOL) diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index b3aa50f85..a83e37f6b 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.32 2002/07/28 21:37:35 heikos Exp $ + * $Id: audio_out.h,v 1.33 2002/09/04 23:31:13 guenter Exp $ */ #ifndef HAVE_AUDIO_OUT_H #define HAVE_AUDIO_OUT_H @@ -44,9 +44,7 @@ extern "C" { * driver plugin has to implement. */ -typedef struct ao_driver_s ao_driver_t; - -struct ao_driver_s { +struct xine_ao_driver_s { /* * @@ -55,7 +53,7 @@ struct ao_driver_s { * * See AO_CAP_* bellow. */ - uint32_t (*get_capabilities) (ao_driver_t *this); + uint32_t (*get_capabilities) (xine_ao_driver_t *this); /* * open the driver and make it ready to receive audio data @@ -63,26 +61,26 @@ struct ao_driver_s { * * return value: 0 : failure, >0 : output sample rate */ - int (*open)(ao_driver_t *this, uint32_t bits, uint32_t rate, int mode); + int (*open)(xine_ao_driver_t *this, uint32_t bits, uint32_t rate, int mode); /* return the number of audio channels */ - int (*num_channels)(ao_driver_t *self_gen); + int (*num_channels)(xine_ao_driver_t *self_gen); /* return the number of bytes per frame. * A frame is equivalent to one sample being output on every audio channel. */ - int (*bytes_per_frame)(ao_driver_t *self_gen); + int (*bytes_per_frame)(xine_ao_driver_t *self_gen); /* return the delay is frames measured by * looking at pending samples in the audio output device */ - int (*delay)(ao_driver_t *self_gen); + int (*delay)(xine_ao_driver_t *self_gen); /* * return gap tolerance (in pts) needed for this driver */ - int (*get_gap_tolerance) (ao_driver_t *self_gen); + int (*get_gap_tolerance) (xine_ao_driver_t *self_gen); /* * write audio data to output buffer @@ -92,20 +90,20 @@ struct ao_driver_s { * 0 => audio samples were not yet processed, * call write_audio_data with the _same_ samples again */ - int (*write)(ao_driver_t *this, + int (*write)(xine_ao_driver_t *this, int16_t* audio_data, uint32_t num_samples); /* * this is called when the decoder no longer uses the audio * output driver - the driver should get ready to get opened() again */ - void (*close)(ao_driver_t *this); + void (*close)(xine_ao_driver_t *this); /* * shut down this audio output driver plugin and * free all resources allocated */ - void (*exit) (ao_driver_t *this); + void (*exit) (xine_ao_driver_t *this); /* * Get, Set a property of audio driver. @@ -115,9 +113,9 @@ struct ao_driver_s { * * See AO_PROP_* below for available properties. */ - int (*get_property) (ao_driver_t *this, int property); + int (*get_property) (xine_ao_driver_t *this, int property); - int (*set_property) (ao_driver_t *this, int property, int value); + int (*set_property) (xine_ao_driver_t *this, int property, int value); /* @@ -125,7 +123,7 @@ struct ao_driver_s { * * See AO_CTRL_* below. */ - int (*control) (ao_driver_t *this, int cmd, /* arg */ ...); + int (*control) (xine_ao_driver_t *this, int cmd, /* arg */ ...); }; /* @@ -204,7 +202,7 @@ struct ao_instance_s { /* private stuff */ - ao_driver_t *driver; + xine_ao_driver_t *driver; pthread_mutex_t driver_lock; metronom_t *metronom; xine_t *xine; @@ -236,20 +234,16 @@ struct ao_instance_s { /* This initiates the audio_out sync routines * found in ./src/xine-engine/audio_out.c */ -ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) ; +ao_instance_t *ao_new_instance (xine_ao_driver_t *driver, xine_t *xine) ; /* * to build a dynamic audio output plugin, * you have to implement these driver: * * - * ao_driver_t *init_audio_out_plugin (config_values_t *config) + * xine_ao_driver_t *init_audio_out_plugin (config_values_t *config) * * init this plugin, check if device is available * - * ao_info_t *get_audio_out_plugin_info () - * - * peek at some (static) information about the plugin without initializing it - * */ /* @@ -288,14 +282,6 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) ; /* above that value audio frames are discarded */ #define AO_MAX_GAP 15000 -typedef struct ao_info_s { - - int interface_version; - char *id; - char *description; - int priority; -} ao_info_t ; - #ifdef __cplusplus } #endif diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 95f2864cd..618c596ff 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.23 2002/06/17 07:47:50 f1rmb Exp $ + * $Id: configfile.c,v 1.24 2002/09/04 23:31:13 guenter Exp $ * - * config file management - implementation + * config object (was: file) management - implementation * */ @@ -35,9 +35,10 @@ #include #include "configfile.h" #include "xineutils.h" +#include "xine_internal.h" /* -#define CONFIG_LOG +#define LOG */ @@ -59,7 +60,7 @@ static char *copy_string (char *str) { return cpy; } -static cfg_entry_t *config_file_add (config_values_t *this, char *key) { +static cfg_entry_t *xine_config_add (config_values_t *this, char *key) { cfg_entry_t *entry; @@ -78,7 +79,7 @@ static cfg_entry_t *config_file_add (config_values_t *this, char *key) { this->last = entry; -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: add entry key=%s\n", key); #endif @@ -89,7 +90,7 @@ static cfg_entry_t *config_file_add (config_values_t *this, char *key) { * external interface */ -static cfg_entry_t *config_file_lookup_entry (config_values_t *this, char *key) { +static cfg_entry_t *_xine_config_lookup_entry (config_values_t *this, char *key) { cfg_entry_t *entry; entry = this->first; @@ -101,28 +102,29 @@ static cfg_entry_t *config_file_lookup_entry (config_values_t *this, char *key) } -static char *config_file_register_string (config_values_t *this, - char *key, char *def_value, - char *description, - char *help, - config_cb_t changed_cb, - void *cb_data) { +static char *_xine_config_register_string (config_values_t *this, + char *key, char *def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; assert (key); assert (def_value); -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: registering %s\n", key); #endif /* make sure this entry exists, create it if not */ - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (!entry) { - entry = config_file_add (this, key); + entry = xine_config_add (this, key); entry->unknown_value = copy_string(def_value); } @@ -156,33 +158,35 @@ static char *config_file_register_string (config_values_t *this, entry->str_default = copy_string(def_value); entry->description = description; entry->help = help; + entry->exp_level = exp_level; entry->callback = changed_cb; entry->callback_data = cb_data; return entry->str_value; } -static int config_file_register_num (config_values_t *this, - char *key, int def_value, - char *description, - char *help, - config_cb_t changed_cb, - void *cb_data) { +static int _xine_config_register_num (config_values_t *this, + char *key, int def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; assert (key); -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: registering %s\n", key); #endif /* make sure this entry exists, create it if not */ - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (!entry) { - entry = config_file_add (this, key); + entry = xine_config_add (this, key); entry->unknown_value = NULL; } @@ -209,33 +213,35 @@ static int config_file_register_num (config_values_t *this, entry->num_default = def_value; entry->description = description; entry->help = help; + entry->exp_level = exp_level; entry->callback = changed_cb; entry->callback_data = cb_data; return entry->num_value; } -static int config_file_register_bool (config_values_t *this, - char *key, int def_value, - char *description, - char *help, - config_cb_t changed_cb, - void *cb_data) { +static int _xine_config_register_bool (config_values_t *this, + char *key, int def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; assert (key); -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: registering %s\n", key); #endif /* make sure this entry exists, create it if not */ - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (!entry) { - entry = config_file_add (this, key); + entry = xine_config_add (this, key); entry->unknown_value = NULL; } @@ -262,33 +268,35 @@ static int config_file_register_bool (config_values_t *this, entry->num_default = def_value; entry->description = description; entry->help = help; + entry->exp_level = exp_level; entry->callback = changed_cb; entry->callback_data = cb_data; return entry->num_value; } -static int config_file_register_range (config_values_t *this, - char *key, int def_value, - int min, int max, - char *description, - char *help, - config_cb_t changed_cb, - void *cb_data) { +static int _xine_config_register_range (config_values_t *this, + char *key, int def_value, + int min, int max, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; assert (key); -#ifdef CONFIG_LOG - printf ("configfile: registering %s\n", key); +#ifdef LOG + printf ("configfile: registering range %s\n", key); #endif /* make sure this entry exists, create it if not */ - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (!entry) { - entry = config_file_add (this, key); + entry = xine_config_add (this, key); entry->unknown_value = NULL; } @@ -316,13 +324,14 @@ static int config_file_register_range (config_values_t *this, entry->range_max = max; entry->description = description; entry->help = help; + entry->exp_level = exp_level; entry->callback = changed_cb; entry->callback_data = cb_data; return entry->num_value; } -static int config_file_parse_enum (char *str, char **values) { +static int xine_config_parse_enum (char *str, char **values) { char **value; int i; @@ -333,7 +342,7 @@ static int config_file_parse_enum (char *str, char **values) { while (*value) { -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: parse enum, >%s< ?= >%s<\n", *value, str); #endif @@ -345,7 +354,7 @@ static int config_file_parse_enum (char *str, char **values) { i++; } -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: warning, >%s< is not a valid enum here, using 0\n", str); #endif @@ -353,28 +362,29 @@ static int config_file_parse_enum (char *str, char **values) { return 0; } -static int config_file_register_enum (config_values_t *this, - char *key, int def_value, - char **values, - char *description, - char *help, - config_cb_t changed_cb, - void *cb_data) { +static int _xine_config_register_enum (config_values_t *this, + char *key, int def_value, + char **values, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; assert (key); assert (values); -#ifdef CONFIG_LOG - printf ("configfile: registering %s\n", key); +#ifdef LOG + printf ("configfile: registering enum %s\n", key); #endif /* make sure this entry exists, create it if not */ - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (!entry) { - entry = config_file_add (this, key); + entry = xine_config_add (this, key); entry->unknown_value = NULL; } @@ -390,7 +400,7 @@ static int config_file_register_enum (config_values_t *this, entry->type = CONFIG_TYPE_ENUM; if (entry->unknown_value) - entry->num_value = config_file_parse_enum (entry->unknown_value, values); + entry->num_value = xine_config_parse_enum (entry->unknown_value, values); else entry->num_value = def_value; @@ -402,22 +412,28 @@ static int config_file_register_enum (config_values_t *this, entry->enum_values = values; entry->description = description; entry->help = help; + entry->exp_level = exp_level; entry->callback = changed_cb; entry->callback_data = cb_data; return entry->num_value; } -static void config_file_update_num (config_values_t *this, +static void xine_config_update_num (config_values_t *this, char *key, int value) { cfg_entry_t *entry; entry = this->lookup_entry (this, key); +#ifdef LOG + printf ("configfile: updating %s to %d\n", + key, value); +#endif + if (!entry) { -#ifdef CONFIG_LOG +#ifdef LOG printf ("configfile: WARNING! tried to update unknown key %s (to %d)\n", key, value); #endif @@ -434,15 +450,22 @@ static void config_file_update_num (config_values_t *this, entry->num_value = value; + /* FIXME if (entry->callback) entry->callback (entry->callback_data, entry); + */ } -static void config_file_update_string (config_values_t *this, +static void xine_config_update_string (config_values_t *this, char *key, char *value) { cfg_entry_t *entry; +#ifdef LOG + printf ("configfile: updating %s to %s\n", + key, value); +#endif + entry = this->lookup_entry (this, key); if (!entry) { @@ -465,20 +488,60 @@ static void config_file_update_string (config_values_t *this, entry->str_value = copy_string (value); } + /* FIXME if (entry->callback) entry->callback (entry->callback_data, entry); + */ } -static void config_file_save (config_values_t *this) { +/* + * load/save config data from/to afile (e.g. $HOME/.xine/config) + */ +void xine_load_config (xine_t *x, char *filename) { + + config_values_t *this = x->config; FILE *f_config; - char filename[1024]; - sprintf (filename, "%s/.xine", xine_get_homedir()); - mkdir (filename, 0755); +#ifdef LOG + printf ("configfile: reading from file '%s'\n", + filename); +#endif - sprintf (filename, "%s/.xine/config", xine_get_homedir()); + f_config = fopen (filename, "r"); + + if (f_config) { + + char line[1024]; + char *value; -#ifdef CONFIG_LOG + while (fgets (line, 1023, f_config)) { + line[strlen(line)-1]= (char) 0; /* eliminate lf */ + + if (line[0] == '#') + continue; + + if ((value = strchr (line, ':'))) { + + cfg_entry_t *entry; + + *value = (char) 0; + value++; + + entry = xine_config_add (this, line); + entry->unknown_value = copy_string (value); + } + } + + fclose (f_config); + } +} + +void xine_save_config (xine_t *x, char *filename) { + + config_values_t *this = x->config; + FILE *f_config; + +#ifdef LOG printf ("writing config file to %s\n", filename); #endif @@ -493,6 +556,11 @@ static void config_file_save (config_values_t *this) { entry = this->first; while (entry) { + +#ifdef LOG + printf ("configfile: saving key '%s'\n", entry->key); +#endif + if (entry->description) fprintf (f_config, "# %s\n", entry->description); @@ -553,45 +621,16 @@ static void config_file_save (config_values_t *this) { } } -static void config_file_read (config_values_t *this, char *filename){ +static void xine_config_dispose (config_values_t *this) { - FILE *f_config; - - f_config = fopen (filename, "r"); - - if (f_config) { - - char line[1024]; - char *value; - - while (fgets (line, 1023, f_config)) { - line[strlen(line)-1]= (char) 0; /* eliminate lf */ - - if (line[0] == '#') - continue; - - if ((value = strchr (line, ':'))) { - - cfg_entry_t *entry; - - *value = (char) 0; - value++; - - entry = config_file_add (this, line); - entry->unknown_value = copy_string (value); - } - } - - fclose (f_config); - } -} - -static void config_file_dispose (config_values_t *this) -{ cfg_entry_t *entry, *last; entry = this->first; +#ifdef LOG + printf ("configfile: dispose\n"); +#endif + while (entry) { last = entry; entry = entry->next; @@ -612,15 +651,15 @@ static void config_file_dispose (config_values_t *this) } -static void config_file_unregister_cb (config_values_t *this, - char *key) -{ +static void xine_config_unregister_cb (config_values_t *this, + char *key) { + cfg_entry_t *entry; assert (this); assert (key); - entry = config_file_lookup_entry (this, key); + entry = _xine_config_lookup_entry (this, key); if (entry) { entry->callback = NULL; entry->callback_data = NULL; @@ -628,46 +667,43 @@ static void config_file_unregister_cb (config_values_t *this, } -config_values_t *xine_config_file_init (char *filename) { +config_values_t *xine_config_init () { #ifdef HAVE_IRIXAL volatile /* is this a (old, 2.91.66) irix gcc bug?!? */ #endif config_values_t *this; - if ( (this = xine_xmalloc(sizeof(config_values_t))) ) { - - this->first = NULL; - this->last = NULL; + if (!(this = xine_xmalloc(sizeof(config_values_t)))) { - config_file_read (this, filename); - - } else { printf ("configfile: could not allocate config object\n"); abort(); } - this->register_string = config_file_register_string; - this->register_range = config_file_register_range; - this->register_enum = config_file_register_enum; - this->register_num = config_file_register_num; - this->register_bool = config_file_register_bool; - this->update_num = config_file_update_num; - this->update_string = config_file_update_string; - this->parse_enum = config_file_parse_enum; - this->lookup_entry = config_file_lookup_entry; - this->save = config_file_save; - this->read = config_file_read; - this->dispose = config_file_dispose; - this->unregister_callback = config_file_unregister_cb; + this->first = NULL; + this->last = NULL; + + this->register_string = _xine_config_register_string; + this->register_range = _xine_config_register_range; + this->register_enum = _xine_config_register_enum; + this->register_num = _xine_config_register_num; + this->register_bool = _xine_config_register_bool; + this->update_num = xine_config_update_num; + this->update_string = xine_config_update_string; + this->parse_enum = xine_config_parse_enum; + this->lookup_entry = _xine_config_lookup_entry; + this->unregister_callback = xine_config_unregister_cb; return this; } - -int config_file_change_opt(config_values_t *config, char *opt) { +int xine_config_change_opt(config_values_t *config, char *opt) { cfg_entry_t *entry; int handled = 0; + +#ifdef LOG + printf ("configfile: change_opt '%s'\n", opt); +#endif if(config && opt && (!strncasecmp(opt, "opt:", 4))) { char *optsafe; @@ -701,7 +737,7 @@ int config_file_change_opt(config_values_t *config, char *opt) { break; case CONFIG_TYPE_UNKNOWN: -#if LOG +#ifdef LOG printf("configfile: change_opt() try to update an CONFIG_TYPE_UNKNOWN entry\n"); #endif break; @@ -714,95 +750,3 @@ int config_file_change_opt(config_values_t *config, char *opt) { return handled; } -/* - * $Log: configfile.c,v $ - * Revision 1.23 2002/06/17 07:47:50 f1rmb - * Add Siggi's idea about option config change on the fly. New "mrl style" - * opt:key=value. I hope i haven't introduced races here. - * - * Revision 1.22 2002/04/29 23:32:00 jcdutton - * Replace all exit(1) with abort(). - * xine-lib should really never do an exit or abort, but instead pass back nice error values to the calling application, but until that happens, use abort() as that is tracable with gdb, whereas exit(1) is not backtraceable. - * - * Revision 1.21 2002/04/27 23:00:40 cvogler - * Add function to unregister configfile callback. - * - * Necessary to prevent segfaults if target of a callback has been disposed. - * - * Revision 1.20 2002/04/11 07:17:43 esnel - * Fix configfile corruption reported by Chris Rankin - * - * Revision 1.19 2002/03/16 13:33:47 esnel - * fix memory leak, add dispose() function to config_values_s - * - * Revision 1.18 2002/02/06 10:57:15 f1rmb - * rename config_file_init to xine_config_file_init. - * - * Revision 1.17 2002/01/13 23:08:27 jcdutton - * Fix another compiler warning. - * - * Revision 1.16 2002/01/13 21:21:05 jcdutton - * Undo last change. - * - * Revision 1.15 2002/01/13 21:15:48 jcdutton - * Fix a few compile warnings. - * - * Revision 1.14 2002/01/09 15:16:37 mshopf - * IRIX port finally compiles (and actually works) again. - * - * Revision 1.13 2001/12/01 22:38:32 guenter - * add avi subtitle decoder (based on mplayer code), minor cleanups, removed register_empty function from configfile (undocumented and doesn't make sense) - * - * Revision 1.12 2001/11/30 21:55:06 f1rmb - * Add an automatic way for input plugin to add extra valid mrls: - * add at bottom of init_input_plugin() a line like this: - * REGISTER_VALID_MRLS(this->config, "mrl.mrls_mpeg_block", "xxx"); - * - * Revision 1.11 2001/11/20 19:13:28 guenter - * add more checks against incorrect configfile usage - * - * Revision 1.10 2001/11/20 17:22:14 miguelfreitas - * testing some configfile stuff... - * - * Revision 1.9 2001/11/19 02:57:10 guenter - * make description strings optional - config options without description string will not appear in setup dialog - * - * Revision 1.8 2001/11/18 21:38:23 miguelfreitas - * fix enum value saving - * - * Revision 1.7 2001/11/18 15:08:31 guenter - * more cleanups, config stuff bugfixes - * - * Revision 1.6 2001/11/18 03:53:25 guenter - * new configfile interface, code cleanup, xprintf is gone - * - * Revision 1.5 2001/11/17 14:26:39 f1rmb - * Add 'xine_' prefix to all of xine-utils functions (what about cpu - * acceleration?). Merge xine-utils header files to a new one "xineutils.h". - * Update xine-lib C/headers to reflect those changes. - * dxr3 headers are no more installed ine $includdir, but $includdir/xine. - * - * Revision 1.4 2001/07/26 11:12:26 f1rmb - * Updated doxy sections in xine.h.tmpl.in. Added man3. Removed french man page. Added API doc in html. Add new rpm package (doc). Fixes some little bugs in - * proto decl, etc... - * - * Revision 1.3 2001/06/15 11:08:13 f1rmb - * Check arguments in public functions. - * - * Revision 1.2 2001/06/15 10:17:53 f1rmb - * Passing NULL to config_file_lookup_str() is valid. - * - * Revision 1.1.1.1 2001/04/18 22:36:01 f1rmb - * Initial import into CVS - * - * Revision 1.8 2001/03/31 03:42:25 guenter - * more cleanups, started xv driver - * - * Revision 1.7 2001/03/28 12:30:25 siggi - * fixed init function - * added read function (multiple config files now supported) - * - * Revision 1.6 2001/03/27 17:12:49 siggi - * made config file handler a dynamic "object" - * - */ diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 965f99bff..14e6fd4d7 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: configfile.h,v 1.11 2002/06/17 07:47:50 f1rmb Exp $ + * $Id: configfile.h,v 1.12 2002/09/04 23:31:13 guenter Exp $ * * config file management * @@ -32,11 +32,11 @@ extern "C" { #include +#include "xine.h" + typedef struct cfg_entry_s cfg_entry_t; typedef struct config_values_s config_values_t; -typedef void (*config_cb_t) (void *, cfg_entry_t *); - struct cfg_entry_s { cfg_entry_t *next; config_values_t *config; @@ -68,8 +68,11 @@ struct cfg_entry_s { char *description; char *help; + /* user experience level */ + int exp_level; + /* callback function and data for live changeable values */ - config_cb_t callback; + xine_config_cb_t callback; void *callback_data; }; @@ -100,7 +103,8 @@ struct config_values_s { char *def_value, char *description, char *help, - config_cb_t changed_cb, + int exp_level, + xine_config_cb_t changed_cb, void *cb_data); int (*register_range) (config_values_t *this, @@ -109,7 +113,8 @@ struct config_values_s { int min, int max, char *description, char *help, - config_cb_t changed_cb, + int exp_level, + xine_config_cb_t changed_cb, void *cb_data); int (*register_enum) (config_values_t *this, @@ -118,7 +123,8 @@ struct config_values_s { char **values, char *description, char *help, - config_cb_t changed_cb, + int exp_level, + xine_config_cb_t changed_cb, void *cb_data); int (*register_num) (config_values_t *this, @@ -126,7 +132,8 @@ struct config_values_s { int def_value, char *description, char *help, - config_cb_t changed_cb, + int exp_level, + xine_config_cb_t changed_cb, void *cb_data); int (*register_bool) (config_values_t *this, @@ -134,7 +141,8 @@ struct config_values_s { int def_value, char *description, char *help, - config_cb_t changed_cb, + int exp_level, + xine_config_cb_t changed_cb, void *cb_data); /* convenience function to update range, enum, num and bool values */ @@ -158,21 +166,6 @@ struct config_values_s { cfg_entry_t* (*lookup_entry) (config_values_t *this, char *key); - /* - * write config file to disk - */ - void (*save) (config_values_t *this); - - /* - * read config file from disk, overriding values in memory - */ - void (*read) (config_values_t *this, char *filename); - - /* - * free memory resources - */ - void (*dispose) (config_values_t *this); - /* * unregister callback function */ @@ -182,15 +175,21 @@ struct config_values_s { /* * config values are stored here: */ - cfg_entry_t *first, *last; + cfg_entry_t *first, *last, *cur; + xine_cfg_entry_t public_entry; }; /* - * init internal data structures, read config file - * (if it exists) + * allocate and init a new xine config object + */ +config_values_t *xine_config_init (); + +/* + * hack: intepret "opt:"-style mrls for config value changes */ -config_values_t *xine_config_file_init (char *filename); -int config_file_change_opt(config_values_t *config, char *opt); + +int xine_config_change_opt(config_values_t *config, char *opt) ; + #ifdef __cplusplus } @@ -198,55 +197,3 @@ int config_file_change_opt(config_values_t *config, char *opt); #endif -/* - * $Log: configfile.h,v $ - * Revision 1.11 2002/06/17 07:47:50 f1rmb - * Add Siggi's idea about option config change on the fly. New "mrl style" - * opt:key=value. I hope i haven't introduced races here. - * - * Revision 1.10 2002/04/27 23:00:40 cvogler - * Add function to unregister configfile callback. - * - * Necessary to prevent segfaults if target of a callback has been disposed. - * - * Revision 1.9 2002/03/16 13:33:47 esnel - * fix memory leak, add dispose() function to config_values_s - * - * Revision 1.8 2002/02/06 10:57:15 f1rmb - * rename config_file_init to xine_config_file_init. - * - * Revision 1.7 2001/12/01 22:38:32 guenter - * add avi subtitle decoder (based on mplayer code), minor cleanups, removed register_empty function from configfile (undocumented and doesn't make sense) - * - * Revision 1.6 2001/11/30 21:55:06 f1rmb - * Add an automatic way for input plugin to add extra valid mrls: - * add at bottom of init_input_plugin() a line like this: - * REGISTER_VALID_MRLS(this->config, "mrl.mrls_mpeg_block", "xxx"); - * - * Revision 1.5 2001/11/20 17:22:14 miguelfreitas - * testing some configfile stuff... - * - * Revision 1.4 2001/11/18 03:53:25 guenter - * new configfile interface, code cleanup, xprintf is gone - * - * Revision 1.3 2001/07/26 11:12:26 f1rmb - * Updated doxy sections in xine.h.tmpl.in. Added man3. Removed french man page. Added API doc in html. Add new rpm package (doc). Fixes some little bugs in - * proto decl, etc... - * - * Revision 1.2 2001/07/18 21:38:17 f1rmb - * Split alsa drivers, more checks about versions. Made xine lib c++ compliant. - * - * Revision 1.1.1.1 2001/04/18 22:36:05 f1rmb - * Initial import into CVS - * - * Revision 1.6 2001/03/31 03:42:25 guenter - * more cleanups, started xv driver - * - * Revision 1.5 2001/03/28 12:30:25 siggi - * fixed init function - * added read function (multiple config files now supported) - * - * Revision 1.4 2001/03/27 21:49:02 siggi - * started touching demuxers - * - */ diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index 5db72b59c..623a984fc 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -29,8 +29,9 @@ #include "xine_internal.h" -int xine_register_event_listener(xine_t *this, xine_event_listener_t listener, - void *user_data) { +int xine_register_event_listener (xine_t *this, + xine_event_listener_cb_t listener, + void *user_data) { /* Ensure the listener is non-NULL */ if(listener == NULL) { return 0; @@ -59,7 +60,8 @@ void xine_send_event(xine_t *this, xine_event_t *event) { } } -int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener) { +int xine_remove_event_listener(xine_t *this, + xine_event_listener_cb_t listener) { uint16_t i, found; found = 1; i = 0; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 6a66d0133..fea86521e 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.80 2002/07/17 21:23:57 f1rmb Exp $ + * $Id: load_plugins.c,v 1.81 2002/09/04 23:31:13 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,8 @@ #include #include "xine_internal.h" +#include "xine_plugin.h" +#include "plugin_catalog.h" #include "demuxers/demux.h" #include "input/input_plugin.h" #include "video_out.h" @@ -51,15 +54,6 @@ #define LOG */ -/* transition code; between xine 0.9.7 and 0.9.8, the dxr3enc driver - * was integrated in the dxr3 driver and no longer exists as a seperate - * plugin. upgraded installs may have an old dxr3enc driver left in the - * plugins dir, which we do not want to load. this define activates - * some code to check for this and print warnings. - * should probably be removed for version 1.0 - * --- Harm van der Heijden */ -#define IGNORE_DXR3ENC 1 - extern int errno; static char *plugin_name; @@ -90,1000 +84,652 @@ static void remove_segv_handler(void){ #endif -/* - * Demuxers plugins section - */ -void load_demux_plugins (xine_t *this, config_values_t *config) { - DIR *dir; - - if (this == NULL || config == NULL) { - printf (_("%s(%s@%d): parameter should be non null, exiting\n"), - __FILE__, __XINE_FUNCTION__, __LINE__); - abort(); - } - this->num_demuxer_plugins = 0; - install_segv_handler(); - - dir = opendir (XINE_PLUGINDIR) ; - - if (dir) { - struct dirent *pEntry; - - while ((pEntry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - - int nLen = strlen (pEntry->d_name); - - if ((strncasecmp(pEntry->d_name, - XINE_DEMUXER_PLUGIN_PREFIXNAME, - XINE_DEMUXER_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((pEntry->d_name[nLen-3]=='.') - && (pEntry->d_name[nLen-2]=='s') - && (pEntry->d_name[nLen-1]=='o'))) { - - /* - * demux plugin found => load it - */ - - sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); - plugin_name = str; - - if(!(plugin = dlopen (str, RTLD_LAZY))) { - char *dl_error_msg = dlerror(); - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: cannot open demux plugin %s:\n%s\n"), - str, dl_error_msg); +/* + * plugin list/catalog management functions + * + */ - } else { +static char *_strclone(const char *str){ + char *new; - void *(*initplug) (int, xine_t *); - - if((initplug = dlsym(plugin, "init_demuxer_plugin")) != NULL) { - demux_plugin_t *dxp; - - dxp = (demux_plugin_t *) initplug (DEMUXER_PLUGIN_IFACE_VERSION, this); - if (dxp) { - this->demuxer_plugins[this->num_demuxer_plugins] = dxp; - - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: demux plugin found : %s\n"), - this->demuxer_plugins[this->num_demuxer_plugins]->get_identifier()); + new = xine_xmalloc(strlen(str)+1); + strcpy(new, str); + return new; +} - this->num_demuxer_plugins++; - } - } - - if(this->num_demuxer_plugins > DEMUXER_PLUGIN_MAX) { - printf ( _("load_plugins: too many demux plugins installed, exiting.\n")); - abort(); - } - } - } +static void _insert_plugin (xine_list_t *list, + char *filename, plugin_info_t *info){ + + plugin_node_t *entry; + vo_info_t *vo_new, *vo_old; + ao_info_t *ao_new, *ao_old; + decoder_info_t *decoder_new, *decoder_old; + uint32_t *types; + int i; + + /* FIXME: TODO: insert replacement/priority logic here */ + + entry = xine_xmalloc(sizeof(plugin_node_t)); + entry->filename = _strclone(filename); + entry->info = xine_xmalloc(sizeof(plugin_info_t)); + *(entry->info) = *info; + entry->info->id = _strclone(info->id); + entry->info->init = NULL; + + switch (info->type){ + + case PLUGIN_VIDEO_OUT: + vo_old = info->special_info; + vo_new = xine_xmalloc(sizeof(vo_info_t)); + vo_new->priority = vo_old->priority; + vo_new->description = _strclone(vo_old->description); + vo_new->visual_type = vo_old->visual_type; + entry->info->special_info = vo_new; + break; + + case PLUGIN_AUDIO_OUT: + ao_old = info->special_info; + ao_new = xine_xmalloc(sizeof(ao_info_t)); + ao_new->priority = ao_old->priority; + ao_new->description = _strclone(ao_old->description); + entry->info->special_info = ao_new; + break; + + case PLUGIN_AUDIO_DECODER: + case PLUGIN_VIDEO_DECODER: + decoder_old = info->special_info; + decoder_new = xine_xmalloc(sizeof(decoder_info_t)); + if (decoder_old == NULL) { + printf ("load_plugins: plugin %s from %s is broken: special_info=NULL\n", + info->id, entry->filename); + abort(); + } + for (i=0; decoder_old->supported_types[i] != 0; ++i); + types = xine_xmalloc((i+1)*sizeof(uint32_t)); + for (i=0; decoder_old->supported_types[i] != 0; ++i){ + types[i] = decoder_old->supported_types[i]; } - closedir(dir); + decoder_new->supported_types = types; + decoder_new->priority = decoder_old->priority; + entry->info->special_info = decoder_new; + break; } - - remove_segv_handler(); + /* - * init demuxer + * insert plugin into list + * FIXME: find right place depending on plugin priority */ + + xine_list_append_content (list, entry); +} + + +static plugin_catalog_t *_empty_catalog(void){ + + plugin_catalog_t *catalog; - this->cur_demuxer_plugin = NULL; + catalog = xine_xmalloc(sizeof(plugin_catalog_t)); + catalog->input = xine_list_new(); + catalog->demux = xine_list_new(); + catalog->spu = xine_list_new(); + catalog->audio = xine_list_new(); + catalog->video = xine_list_new(); + catalog->aout = xine_list_new(); + catalog->vout = xine_list_new(); + + return catalog; } -void xine_list_demux_plugins (config_values_t *config, - char **identifiers, char **mimetypes) { +/* + * First stage plugin loader (catalog builder) + * + ***************************************************************************/ + +static void collect_plugins(xine_t *this, char *path){ + DIR *dir; - xine_t *this; - int sizeid, sizemime; - int incsize; - char *s; - - this = xine_xmalloc (sizeof (xine_t)); - - sizeid = sizemime = incsize = 4096; - *identifiers = xine_xmalloc (sizeid); - *mimetypes = xine_xmalloc (sizemime); - - this->config = config; - install_segv_handler(); - - dir = opendir (XINE_PLUGINDIR) ; - +#ifdef LOG + printf ("load_plugins: collect_plugins in %s\n", path); +#endif + + dir = opendir(path); if (dir) { struct dirent *pEntry; while ((pEntry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - - int nLen = strlen (pEntry->d_name); - - if ((strncasecmp(pEntry->d_name, - XINE_DEMUXER_PLUGIN_PREFIXNAME, - XINE_DEMUXER_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((pEntry->d_name[nLen-3]=='.') - && (pEntry->d_name[nLen-2]=='s') - && (pEntry->d_name[nLen-1]=='o'))) { - - /* - * demux plugin found => load it - */ - - sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); - plugin_name = str; - - if(!(plugin = dlopen (str, RTLD_LAZY))) { - printf ("load_plugins: cannot open demux plugin %s:\n%s\n", - str, dlerror()); - } else { - void *(*initplug) (int, xine_t *); + char *str; + void *lib; + struct stat statbuffer; - if((initplug = dlsym(plugin, "init_demuxer_plugin")) != NULL) { - demux_plugin_t *dxp; - - dxp = (demux_plugin_t *) initplug(DEMUXER_PLUGIN_IFACE_VERSION, this); - if (dxp) { - /* realloc sucks, but it will make this code much simpler */ - s = dxp->get_identifier(); - if( strlen(s) + strlen(*identifiers) + 2 > sizeid ) { - sizeid += incsize; - *identifiers = realloc( *identifiers, sizeid ); - } - strcat(*identifiers, s); - strcat(*identifiers, "\n"); + str = xine_xmalloc(strlen(path) + strlen(pEntry->d_name) + 2); + sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); + + if (stat(str, &statbuffer)) { + xine_log (this, XINE_LOG_PLUGIN, + _("load_plugins: unable to stat %s\n"), str); + } + else { + + switch (statbuffer.st_mode & S_IFMT){ + + case S_IFREG: + /* regular file, ie. plugin library, found => load it */ + + plugin_name = str; + + if(!(lib = dlopen (str, RTLD_LAZY))) { + char *dl_error_msg = dlerror(); + +#ifdef LOG + /* too noisy */ + printf ("load_plugins: cannot open plugin lib %s:\n%s\n", + str, dl_error_msg); +#endif + } + else { + + plugin_info_t *info; + + if ((info = dlsym(lib, "xine_plugin_info"))) { + + for (; info->type != PLUGIN_NONE; ++info){ - s = dxp->get_mimetypes(); - if( strlen(s) + strlen(*mimetypes) + 2 > sizemime ) { - sizemime += incsize; - *identifiers = realloc( *identifiers, sizemime ); + xine_log (this, XINE_LOG_PLUGIN, + _("load_plugins: plugin %s found\n"), str); + + switch (info->type){ + case PLUGIN_INPUT: + _insert_plugin(this->plugin_catalog->input, str, info); + break; + case PLUGIN_DEMUX: + _insert_plugin(this->plugin_catalog->demux, str, info); + break; + case PLUGIN_AUDIO_DECODER: + _insert_plugin(this->plugin_catalog->audio, str, info); + break; + case PLUGIN_VIDEO_DECODER: + _insert_plugin(this->plugin_catalog->video, str, info); + break; + case PLUGIN_SPU_DECODER: + _insert_plugin(this->plugin_catalog->spu, str, info); + break; + case PLUGIN_AUDIO_OUT: + _insert_plugin(this->plugin_catalog->aout, str, info); + break; + case PLUGIN_VIDEO_OUT: + _insert_plugin(this->plugin_catalog->vout, str, info); + break; + default: + xine_log (this, XINE_LOG_PLUGIN, + _("load_plugins: unknown plugin type %d in %s\n"), + info->type, str); + } } - strcat(*mimetypes, s); + + } + else { + char *dl_error_msg = dlerror(); + + xine_log (this, XINE_LOG_PLUGIN, + _("load_plugins: can't get plugin info from %s:\n%s\n"), + str, dl_error_msg); } + dlclose(lib); } - dlclose(plugin); - } - } - } - closedir(dir); - } - remove_segv_handler(); - - free(this); -} + break; + case S_IFDIR: + + if (*pEntry->d_name != '.'){ /* catches ".", ".." or ".hidden" dirs */ + collect_plugins(this, str); + } + } /* switch */ + } /* if (stat(...)) */ + free(str); + } /* while */ + } /* if (dir) */ +} /* collect_plugins */ -/** *************************************************************** - * Input plugins section + +/* + * generic 2nd stage plugin loader */ -void load_input_plugins (xine_t *this, - config_values_t *config) { - DIR *dir; - - this->num_input_plugins = 0; - - install_segv_handler(); - dir = opendir (XINE_PLUGINDIR) ; - - if (dir) { - struct dirent *pEntry; - - while ((pEntry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - - int nLen = strlen (pEntry->d_name); - - if ((strncasecmp(pEntry->d_name, - XINE_INPUT_PLUGIN_PREFIXNAME, - XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((pEntry->d_name[nLen-3]=='.') - && (pEntry->d_name[nLen-2]=='s') - && (pEntry->d_name[nLen-1]=='o'))) { - - /* - * input plugin found => load it - */ - - sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); - plugin_name = str; - - if(!(plugin = dlopen (str, RTLD_LAZY))) { - char *dl_error_msg = dlerror(); - - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: cannot open input plugin %s:\n%s\n"), - str, dl_error_msg); - } else { - void *(*initplug) (int, xine_t *); - - if((initplug = dlsym(plugin, "init_input_plugin")) != NULL) { - input_plugin_t *ip; - - ip = (input_plugin_t *) initplug (INPUT_PLUGIN_IFACE_VERSION, this); - if (ip) { - this->input_plugins[this->num_input_plugins] = ip; - - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: input plugin found : %s\n"), - this->input_plugins[this->num_input_plugins]->get_identifier(this->input_plugins[this->num_input_plugins])); +static void *_load_plugin(xine_t *this, + char *filename, plugin_info_t *target, + void *data) { - this->num_input_plugins++; - } + void *lib; - } else { - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: %s is no valid input plugin (lacks init_input_plugin() function)\n"), str); - } + if(!(lib = dlopen (filename, RTLD_LAZY))) { + + xine_log (this, XINE_LOG_PLUGIN, + _("load_plugins: cannot (stage 2) open plugin lib %s:\n%s\n"), + filename, dlerror()); + + } else { + + plugin_info_t *info; + + if ((info = dlsym(lib, "xine_plugin_info"))) { + /* TODO: use sigsegv handler */ + while (info->type != PLUGIN_NONE){ + if (info->type == target->type + && info->API == target->API + && !strcasecmp(info->id, target->id) + && info->version == target->version){ - if(this->num_input_plugins > INPUT_PLUGIN_MAX) { - printf (_("%s(%d): too many input plugins installed, " - "exiting.\n"), __FILE__, __LINE__); - abort(); - } + return info->init(this, data); } } + + } else { + xine_log (this, XINE_LOG_PLUGIN, + "load_plugins: Yikes! %s doesn't contain plugin info.\n", + filename); } - closedir(dir); } - - remove_segv_handler(); - - if (this->num_input_plugins == 0) { - printf (_("load_plugins: no input plugins found in %s! - " - "Did you install xine correctly??\n"), XINE_PLUGINDIR); - abort(); - } - + return NULL; /* something failed if we came here... */ } -static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) { - input_plugin_t *ip; - char **plugin_ids; - int i; - int n = 0; +/* + * load input+demuxer plugins + */ +static void load_plugins(xine_t *this) { - if(!this->num_input_plugins) - return NULL; + plugin_node_t *node; - plugin_ids = (char **) xine_xmalloc (this->num_input_plugins * sizeof (char *)); + /* + * input plugins + */ - for(i = 0; i < this->num_input_plugins; i++) { + node = xine_list_first_content (this->plugin_catalog->input); + while (node) { - ip = this->input_plugins[i]; +#ifdef LOG + printf("load_plugins: load input plugin %s from %s\n", + node->info->id, node->filename); +#endif - if(ip->get_capabilities(ip) & feature) { - plugin_ids[n] = (char *) malloc (strlen(ip->get_identifier(ip)) + 1 ); - strcpy (plugin_ids[n], ip->get_identifier(ip)); - /* printf("%s(%d): %s is featured\n", */ - /* __XINE_FUNCTION__, feature, ip->get_identifier(ip)); */ - n++; - } + node->plugin = _load_plugin(this, node->filename, node->info, NULL); + node = xine_list_next_content (this->plugin_catalog->input); } - plugin_ids[n] = NULL; - - return plugin_ids; -} - -char **xine_get_autoplay_input_plugin_ids(xine_t *this) { - - return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_AUTOPLAY)); -} + /* + * demux plugins + */ -char **xine_get_browsable_input_plugin_ids(xine_t *this) { + node = xine_list_first_content (this->plugin_catalog->demux); + while (node) { - return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_GET_DIR)); -} +#ifdef LOG + printf("load_plugins: load demux plugin %s from %s\n", + node->info->id, node->filename); +#endif -char *xine_get_input_plugin_description(xine_t *this, char *plugin_id) { - char *str; - input_plugin_t *ip; - int i; + node->plugin = _load_plugin(this, node->filename, node->info, NULL); - if((this == NULL) || (this->num_input_plugins < 1) || (plugin_id == NULL)) - return NULL; - - for(i = 0; i < this->num_input_plugins; i++) { - - ip = this->input_plugins[i]; - - if(!strcasecmp((ip->get_identifier(ip)), plugin_id)) { - str = strdup(ip->get_description(ip)); - return str; - } + node = xine_list_next_content (this->plugin_catalog->demux); } - - return NULL; } -uint32_t xine_get_input_plugin_capabilities(xine_t *this) { - - if (this && this->cur_input_plugin && this->cur_input_plugin->get_capabilities) - return this->cur_input_plugin->get_capabilities(this->cur_input_plugin); - - return INPUT_CAP_NOCAP; -} +static void map_decoders (xine_t *this) { -/** *************************************************************** - * Decoder plugins section - */ -static int decide_spu_insert(spu_decoder_t *p, int streamtype, int prio) { + plugin_catalog_t *catalog = this->plugin_catalog; + plugin_node_t *node; + int i; - if (!p->can_handle (p, (streamtype<<16) | BUF_SPU_BASE)) - return 0; +#ifdef LOG + printf ("load_plugins: map_decoders\n"); +#endif - if (p->priority < prio) - return 0; + /* clean up */ - /* All conditions successfully passed */ - return p->priority; -} + for (i=0; iaudio_decoder_map[i]=NULL; + catalog->video_decoder_map[i]=NULL; + catalog->spu_decoder_map[i]=NULL; + } -static int decide_video_insert(video_decoder_t *p, int streamtype, int prio) { + /* + * map audio decoders + */ + + node = xine_list_first_content (this->plugin_catalog->audio); + while (node) { - if (!p->can_handle (p, (streamtype<<16) | BUF_VIDEO_BASE)) - return 0; + decoder_info_t *di = (decoder_info_t *) node->info->special_info; + int *type; - if (p->priority < prio) - return 0; +#ifdef LOG + printf ("load_plugins: mapping decoder %s\n", node->info->id); +#endif - /* All conditions successfully passed */ - return p->priority; -} + type = di->supported_types; -static int decide_audio_insert(audio_decoder_t *p, int streamtype, int prio) { + while (type && (*type)) { - if (!p->can_handle (p, (streamtype<<16) | BUF_AUDIO_BASE)) - return 0; + int streamtype = ((*type)>>16) & 0xFF; + int priority; - if (p->priority < prio) - return 0; +#ifdef LOG + printf ("load_plugins: decoder handles stream type %02x, priority %d\n", + streamtype, di->priority); +#endif - /* All conditions successfully passed */ - return p->priority; -} + if (catalog->audio_decoder_map[streamtype]) { + priority = ((decoder_info_t *) catalog->audio_decoder_map[streamtype]->info->special_info)->priority; + } else + priority = 0; -/* - * load audio and video decoder plugins - */ -void load_decoder_plugins (xine_t *this, config_values_t *config) { - DIR *dir; - int i; - int spu_prio[DECODER_PLUGIN_MAX], video_prio[DECODER_PLUGIN_MAX], - audio_prio[DECODER_PLUGIN_MAX]; + if (di->priority > priority) { +#ifdef LOG + printf ("load_plugins: using decoder %s for stream type %02x\n", + node->info->id, streamtype); +#endif + catalog->audio_decoder_map[streamtype] = node; + } - if (this == NULL || config == NULL) { - printf ( _("%s(%s@%d): parameter should be non null, exiting\n"), - __FILE__, __XINE_FUNCTION__, __LINE__); - abort(); + type++; + } + + node = xine_list_next_content (this->plugin_catalog->audio); } - /* - * clean up first + /* + * map video decoders */ - this->cur_spu_decoder_plugin = NULL; - for (i=0; ispu_decoder_plugins[i] = NULL; - spu_prio[i] = 0; - } - this->num_spu_decoders_loaded = 0; + + node = xine_list_first_content (this->plugin_catalog->video); + while (node) { - this->cur_video_decoder_plugin = NULL; - for (i=0; ivideo_decoder_plugins[i] = NULL; - video_prio[i] = 0; - } - this->num_video_decoders_loaded = 0; + decoder_info_t *di = (decoder_info_t *) node->info->special_info; + int *type; - this->cur_audio_decoder_plugin = NULL; - for (i=0; iaudio_decoder_plugins[i] = NULL; - audio_prio[i] = 0; - } - this->num_audio_decoders_loaded = 0; +#ifdef LOG + printf ("load_plugins: mapping decoder %s\n", node->info->id); +#endif - /* - * now scan for decoder plugins - */ + type = di->supported_types; - - install_segv_handler(); - - dir = opendir (XINE_PLUGINDIR) ; - - if (dir) { - struct dirent *pEntry; - - while ((pEntry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - - int nLen = strlen (pEntry->d_name); - - if ((strncasecmp(pEntry->d_name, - XINE_DECODER_PLUGIN_PREFIXNAME, - XINE_DECODER_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((pEntry->d_name[nLen-3]=='.') - && (pEntry->d_name[nLen-2]=='s') - && (pEntry->d_name[nLen-1]=='o'))) { - - /* - * decoder plugin found => load it - */ - - sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); - plugin_name = str; - - if(!(plugin = dlopen (str, RTLD_LAZY))) { - char *dl_error_msg = dlerror(); - - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: failed to load plugin %s:\n%s\n"), - str, dl_error_msg); - - } else { - int plugin_prio; - - /* - * does this plugin provide an spu decoder plugin? - */ - { - void *(*initplug) (int, xine_t *); - - if((initplug = dlsym(plugin, "init_spu_decoder_plugin")) != NULL) { - - spu_decoder_t *sdp; - int streamtype; - - sdp = (spu_decoder_t *) initplug (SPU_DECODER_IFACE_VERSION, this); - if (sdp) { - - this->spu_decoders_loaded [this->num_spu_decoders_loaded] = sdp; - this->num_spu_decoders_loaded++; - - for (streamtype = 0; streamtypespu_decoder_plugins[streamtype] = sdp; - spu_prio[streamtype] = plugin_prio; - } - } - - xine_log (this, XINE_LOG_PLUGIN, - _("spu decoder plugin found : %s\n"), - sdp->get_identifier()); + while (type && (*type)) { - } - } - } + int streamtype = ((*type)>>16) & 0xFF; + int priority; - /* - * does this plugin provide an video decoder plugin? - */ - - { - void *(*initplug) (int, xine_t *); - if((initplug = dlsym(plugin, "init_video_decoder_plugin")) != NULL) { - - video_decoder_t *vdp; - int streamtype; - - vdp = (video_decoder_t *) initplug(VIDEO_DECODER_IFACE_VERSION, this); - if (vdp) { - - this->video_decoders_loaded [this->num_video_decoders_loaded] = vdp; - this->num_video_decoders_loaded++; - - for (streamtype = 0; streamtypevideo_decoder_plugins[streamtype] = vdp; - video_prio[streamtype] = plugin_prio; - } - - xine_log (this, XINE_LOG_PLUGIN, - _("video decoder plugin found : %s\n"), - vdp->get_identifier()); +#ifdef LOG + printf ("load_plugins: decoder handles stream type %02x, priority %d\n", + streamtype, di->priority); +#endif - } - } - - /* - * does this plugin provide an audio decoder plugin? - */ - - if((initplug = dlsym(plugin, "init_audio_decoder_plugin")) != NULL) { - - audio_decoder_t *adp; - int streamtype; - - adp = (audio_decoder_t *) initplug(AUDIO_DECODER_IFACE_VERSION, this); - if (adp) { - - this->audio_decoders_loaded [this->num_audio_decoders_loaded] = adp; - this->num_audio_decoders_loaded++; - - for (streamtype = 0; streamtypeaudio_decoder_plugins[streamtype] = adp; - audio_prio[streamtype] = plugin_prio; - } - - xine_log (this, XINE_LOG_PLUGIN, - _("audio decoder plugin found : %s\n"), - adp->get_identifier()); + if (catalog->video_decoder_map[streamtype]) { + priority = ((decoder_info_t *) catalog->video_decoder_map[streamtype]->info->special_info)->priority; + } else + priority = 0; - } - } - - } - } + if (di->priority > priority) { +#ifdef LOG + printf ("load_plugins: using decoder %s for stream type %02x\n", + node->info->id, streamtype); +#endif + catalog->video_decoder_map[streamtype] = node; } + + type++; } - closedir(dir); - } - remove_segv_handler(); - this->cur_spu_decoder_plugin = NULL; - this->cur_video_decoder_plugin = NULL; - this->cur_audio_decoder_plugin = NULL; -} + node = xine_list_next_content (this->plugin_catalog->video); + } -/** *************************************************************** - * Video output plugins section - */ -char **xine_list_video_output_plugins (int visual_type) { + /* + * map spu decoders + */ + + node = xine_list_first_content (this->plugin_catalog->spu); + while (node) { - char **plugin_ids; - int num_plugins = 0; - DIR *dir; - int i,j; - int plugin_prios[50]; + decoder_info_t *di = (decoder_info_t *) node->info->special_info; + int *type; - plugin_ids = (char **) xine_xmalloc (50 * sizeof (char *)); - plugin_ids[0] = NULL; +#ifdef LOG + printf ("load_plugins: mapping decoder %s\n", node->info->id); +#endif - install_segv_handler(); - -#ifdef ENABLE_NLS - bindtextdomain("xine-lib", XINE_LOCALEDIR); -#endif + type = di->supported_types; - dir = opendir (XINE_PLUGINDIR); + while (type && (*type)) { - if (dir) { - struct dirent *dir_entry; + int streamtype = ((*type)>>16) & 0xFF; + int priority; - while ((dir_entry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - int nLen = strlen (dir_entry->d_name); +#ifdef LOG + printf ("load_plugins: decoder handles stream type %02x, priority %d\n", + streamtype, di->priority); +#endif - if ((strncasecmp(dir_entry->d_name, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((dir_entry->d_name[nLen-3]=='.') - && (dir_entry->d_name[nLen-2]=='s') - && (dir_entry->d_name[nLen-1]=='o'))) { + if (catalog->spu_decoder_map[streamtype]) { + priority = ((decoder_info_t *) catalog->spu_decoder_map[streamtype]->info->special_info)->priority; + } else + priority = 0; + if (di->priority > priority) { #ifdef LOG - printf ("load_plugins: found a video output plugin: %s\n", - dir_entry->d_name); + printf ("load_plugins: using decoder %s for stream type %02x\n", + node->info->id, streamtype); #endif + catalog->spu_decoder_map[streamtype] = node; + } -#if IGNORE_DXR3ENC - if (!strncasecmp(dir_entry->d_name, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME "dxr3enc", - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH + 7)) { - printf ("load_plugins: (ignoring obsolete dxr3enc driver)"); - continue; - } + type++; + } + + node = xine_list_next_content (this->plugin_catalog->spu); + } +} + +/* + * initialize catalog, load all plugins into new catalog + */ +void scan_plugins (xine_t *this) { + +#ifdef LOG + printf("load_plugins: scan_plugins()\n"); #endif + if (this == NULL || this->config == NULL) { + fprintf(stderr, "%s(%s@%d): parameter should be non null, exiting\n", + __FILE__, __XINE_FUNCTION__, __LINE__); + abort(); + } - sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name); - plugin_name = str; - - /* - * now, see if we can open this plugin, - * check if it has got the right visual type - * and finally if all this went through get it's id - */ + this->plugin_catalog = _empty_catalog(); + /* TODO: add more plugin dir(s), maybe ~/.xine/plugins or /usr/local/... */ + collect_plugins(this, XINE_PLUGINDIR); - if(!(plugin = dlopen (str, RTLD_LAZY | RTLD_GLOBAL))) { + load_plugins (this); - printf("load_plugins: cannot load plugin %s:\n%s\n", - str, dlerror()); + map_decoders (this); +} - } else { - vo_info_t* (*getinfo) (); - vo_info_t *vo_info; - if ((getinfo = dlsym(plugin, "get_video_out_plugin_info")) != NULL) { - vo_info = getinfo(); +static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) { - if ( (vo_info->visual_type == visual_type) - && (vo_info->interface_version == VIDEO_OUT_DRIVER_IFACE_VERSION) ) { -#ifdef LOG - printf("video output plugin found : %s (%s)\n", - vo_info->id, vo_info->description); -#endif + /* FIXME */ - /* sort the list by vo_info->priority */ +#if 0 - i = 0; - while ( (ipriorityi) { - plugin_ids[j] = plugin_ids[j-1]; - plugin_prios[j] = plugin_prios[j-1]; - j--; - } + if(!this->num_input_plugins) + return NULL; - plugin_ids[i] = (char *) malloc (strlen(vo_info->id)+1); - strcpy (plugin_ids[i], vo_info->id); - plugin_prios[i] = vo_info->priority; - - num_plugins++; - plugin_ids[num_plugins] = NULL; - } else { - - if(vo_info->interface_version != VIDEO_OUT_DRIVER_IFACE_VERSION) - printf ("load_plugins: %s has wrong interface version (%d)\n", - str, vo_info->interface_version); -#ifdef LOG - else if(vo_info->visual_type != visual_type) - printf ("load_plugins: %s has wrong visual type (%d)\n", - str, vo_info->visual_type); -#endif - } - } else { + plugin_ids = (char **) xine_xmalloc (this->num_input_plugins * sizeof (char *)); - printf("load_plugins: %s seems to be an invalid plugin " - "(lacks get_video_out_plugin_info() function)\n", str); + for(i = 0; i < this->num_input_plugins; i++) { - } - dlclose (plugin); - } - } + ip = this->input_plugins[i]; + + if(ip->get_capabilities(ip) & feature) { + plugin_ids[n] = (char *) malloc (strlen(ip->get_identifier(ip)) + 1 ); + strcpy (plugin_ids[n], ip->get_identifier(ip)); + /* printf("%s(%d): %s is featured\n", */ + /* __XINE_FUNCTION__, feature, ip->get_identifier(ip)); */ + n++; } - closedir(dir); - } else { - printf ("load_plugins: %s - cannot access plugin dir '%s': %s\n", - __XINE_FUNCTION__, XINE_PLUGINDIR, strerror(errno)); - } - - remove_segv_handler(); - if (!num_plugins) { - fprintf(stderr, "load_plugins: no video plugins found, make sure you have them " - "installed at %s\n", XINE_PLUGINDIR ); } + + plugin_ids[n] = NULL; + return plugin_ids; + +#endif + return NULL; } +char **xine_get_autoplay_input_plugin_ids(xine_t *this) { -vo_driver_t *xine_load_video_output_plugin(config_values_t *config, - char *id, - int visual_type, void *visual) { - DIR *dir; - vo_driver_t *vod; - -#ifdef ENABLE_NLS - bindtextdomain("xine-lib", XINE_LOCALEDIR); -#endif - -#if IGNORE_DXR3ENC - if (! strcasecmp(id, "dxr3enc")) { - printf( /* big poo poo */ - "load_plugins: *************************************************************\n" - "load_plugins: WARNING: video out driver \"dxr3enc\" no longer exists.\n" - "load_plugins: the mpeg encoding output is now integrated in the \"dxr3\"\n" - "load_plugins: driver.\n" - "load_plugins: *************************************************************\n" - ); - return 0; - } -#endif + return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_AUTOPLAY)); +} - install_segv_handler(); +char **xine_get_browsable_input_plugin_ids(xine_t *this) { - dir = opendir (XINE_PLUGINDIR); - - if (dir) { - struct dirent *dir_entry; - - while ((dir_entry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - - int nLen = strlen (dir_entry->d_name); - - if ((strncasecmp(dir_entry->d_name, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((dir_entry->d_name[nLen-3]=='.') - && (dir_entry->d_name[nLen-2]=='s') - && (dir_entry->d_name[nLen-1]=='o'))) { - -#if IGNORE_DXR3ENC - if (! strncasecmp(dir_entry->d_name, - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME "dxr3enc", - XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH + 7)) - { - printf("load_plugins: ignoring obsolete dxr3enc driver.\n"); - continue; - } -#endif + return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_GET_DIR)); +} - sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name); - - if(!(plugin = dlopen (str, RTLD_LAZY | RTLD_GLOBAL))) { - printf("load_plugins: video output plugin %s failed to link:\n%s\n", - str, dlerror()); - } else { - vo_info_t* (*getinfo) (void); - vo_info_t *vo_info; +char *xine_get_input_plugin_description(xine_t *this, char *plugin_id) { - if ((getinfo = dlsym(plugin, "get_video_out_plugin_info")) != NULL) { - vo_info = getinfo(); + /* FIXME */ - if (!strcasecmp(id, vo_info->id) ) { +#if 0 + char *str; + input_plugin_t *ip; + int i; - if (vo_info->interface_version == VIDEO_OUT_DRIVER_IFACE_VERSION) { - - if(vo_info->visual_type == visual_type) { - void *(*initplug) (config_values_t *, void *); - - if((initplug = dlsym(plugin, "init_video_out_plugin")) != NULL) { - - vod = (vo_driver_t *) initplug(config, visual); - - if (vod) - printf("load_plugins: video output plugin %s successfully" - " loaded.\n", id); - else - printf("load_plugins: video output plugin %s: " - "init_video_out_plugin failed.\n", str); - - closedir(dir); - remove_segv_handler(); - - return vod; - } - } - else { - printf("load_plugins: video output plugin %s: " - "wrong interface visual type %d.\n", str, vo_info->visual_type); - } - } - else { - printf("load_plugins: video output plugin %s: " - "wrong interface version %d.\n", str, vo_info->interface_version); - } - } - } - } - } + if((this == NULL) || (this->num_input_plugins < 1) || (plugin_id == NULL)) + return NULL; + + for(i = 0; i < this->num_input_plugins; i++) { + + ip = this->input_plugins[i]; + + if(!strcasecmp((ip->get_identifier(ip)), plugin_id)) { + str = strdup(ip->get_description(ip)); + return str; } - closedir(dir); } +#endif - remove_segv_handler(); - - printf ("load_plugins: failed to find video output plugin <%s>\n", id); return NULL; } -/** *************************************************************** - * Audio output plugins section +/* + * video out plugins section */ -char **xine_list_audio_output_plugins(void) { - char **plugin_ids; - int num_plugins = 0; - DIR *dir; - int i,j; - int plugin_prios[50]; - - plugin_ids = (char **) xine_xmalloc (50 * sizeof (char *)); - plugin_ids[0] = NULL; - - install_segv_handler(); - -#ifdef ENABLE_NLS - bindtextdomain("xine-lib", XINE_LOCALEDIR); -#endif - - dir = opendir (XINE_PLUGINDIR); +xine_vo_driver_t *xine_open_video_driver (xine_t *this, + char *id, + int visual_type, void *visual) { - if (dir) { - struct dirent *dir_entry; - - while ((dir_entry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - int nLen = strlen (dir_entry->d_name); - - if ((strncasecmp(dir_entry->d_name, - XINE_AUDIO_OUT_PLUGIN_PREFIXNAME, - XINE_AUDIO_OUT_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((dir_entry->d_name[nLen-3]=='.') - && (dir_entry->d_name[nLen-2]=='s') - && (dir_entry->d_name[nLen-1]=='o'))) { - - sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name); - plugin_name = str; - - /* printf ("load_plugins: trying to load plugin %s\n", str); */ + plugin_node_t *node; + xine_vo_driver_t *driver; + vo_info_t *vo_info; - /* - * now, see if we can open this plugin, - * and get it's id - */ + driver = NULL; - if(!(plugin = dlopen (str, RTLD_LAZY))) { + node = xine_list_first_content (this->plugin_catalog->vout); + while (node) { - printf("load_plugins: cannot load plugin %s (%s)\n", - str, dlerror()); + vo_info = node->info->special_info; + if (vo_info->visual_type == visual_type) { + if (id) { + if (!strcasecmp (node->info->id, id)) { + driver = (xine_vo_driver_t*)_load_plugin (this, node->filename, + node->info, visual); + break; + } - } else { + } else { - ao_info_t* (*getinfo) (); - ao_info_t *ao_info; + driver = (xine_vo_driver_t*)_load_plugin (this, node->filename, + node->info, visual); + if (driver) + break; + + } + } + + node = xine_list_next_content (this->plugin_catalog->vout); + } -#ifdef LOG - printf ("load_plugins: plugin %s successfully loaded.\n", str); -#endif + if (!driver) + printf ("load_plugins: failed to load video output plugin <%s>\n", id); - if ((getinfo = dlsym(plugin, "get_audio_out_plugin_info")) != NULL) { - ao_info = getinfo(); + return driver; +} -#ifdef LOG - printf("load_plugins: id=%s (%s), priority=%d, interface_version=%d\n", - ao_info->id, ao_info->description, - ao_info->priority, ao_info->interface_version); -#endif +/* + * audio output plugins section + */ - if ( ao_info->interface_version == AUDIO_OUT_IFACE_VERSION) { +char **xine_list_audio_output_plugins(void) { - /* sort the list by ao_info->priority */ + return NULL; +} - i = 0; - while ( (ipriorityi) { - plugin_ids[j] = plugin_ids[j-1]; - plugin_prios[j] = plugin_prios[j-1]; - j--; - } - plugin_ids[i] = (char *) malloc (strlen(ao_info->id)+1); - strcpy (plugin_ids[i], ao_info->id); - plugin_prios[i] = ao_info->priority; +xine_ao_driver_t *xine_open_audio_driver (xine_t *this, char *id, + void *data) { - num_plugins++; - plugin_ids[num_plugins] = NULL; - } else { + plugin_node_t *node; + xine_ao_driver_t *driver; + ao_info_t *ao_info; - printf ("load_plugins: audio output plugin >%s< doesn't support interface version %d\n", - ao_info->id, AUDIO_OUT_IFACE_VERSION); + driver = NULL; - } - } else { + node = xine_list_first_content (this->plugin_catalog->aout); + while (node) { - printf("load_plugins: %s seems to be an invalid plugin " - "(lacks get_audio_out_plugin_info() function)\n", str); + ao_info = node->info->special_info; - } - dlclose (plugin); - } + if (id) { + if (!strcasecmp(node->info->id, id)) { + driver = (xine_ao_driver_t*)_load_plugin(this, node->filename, node->info, data); + break; } + } else { + driver = (xine_ao_driver_t*)_load_plugin (this, node->filename, node->info, data); + if (driver) + break; } - closedir(dir); - } else { - printf ("load_plugins: %s - cannot access plugin dir: %s", - __XINE_FUNCTION__, strerror(errno)); - } - - remove_segv_handler(); - - return plugin_ids; -} - -ao_driver_t *xine_load_audio_output_plugin(config_values_t *config, char *id) { - DIR *dir; - ao_driver_t *aod = NULL; - - install_segv_handler(); - -#ifdef ENABLE_NLS - bindtextdomain("xine-lib", XINE_LOCALEDIR); -#endif - - dir = opendir (XINE_PLUGINDIR); - - if (dir) { - struct dirent *pEntry; - - while ((pEntry = readdir (dir)) != NULL) { - char str[1024]; - void *plugin; - int nLen = strlen (pEntry->d_name); - - aod = NULL; - memset(&str, 0, 1024); - - if ((strncasecmp(pEntry->d_name, - XINE_AUDIO_OUT_PLUGIN_PREFIXNAME, - XINE_AUDIO_OUT_PLUGIN_PREFIXNAME_LENGTH) == 0) && - ((pEntry->d_name[nLen-3]=='.') - && (pEntry->d_name[nLen-2]=='s') - && (pEntry->d_name[nLen-1]=='o'))) { - - sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); - /* RTLD_GLOBAL is needed when using ALSA09 */ - if(!(plugin = dlopen (str, RTLD_LAZY | RTLD_GLOBAL))) { - printf("load_plugins: audio output plugin %s failed to link: %s\n", - str, dlerror()); - /* return NULL; */ - } else { - void *(*initplug) (config_values_t *); - ao_info_t* (*getinfo) (); - ao_info_t *ao_info; - - if ((getinfo = dlsym(plugin, "get_audio_out_plugin_info")) != NULL) { - ao_info = getinfo(); - - if (!strcasecmp(id, ao_info->id)) { - - if((initplug = dlsym(plugin, "init_audio_out_plugin")) != NULL) { - - aod = (ao_driver_t *) initplug(config); - - if (aod) - printf("load_plugins: audio output plugin %s successfully" - " loaded.\n", id); - else - printf("load_plugins: audio output plugin %s: " - "init_audio_out_plugin failed.\n", str); - - closedir(dir); - remove_segv_handler(); - return aod; - } - } - } - } - } - } - closedir(dir); + node = xine_list_next_content (this->plugin_catalog->aout); } - remove_segv_handler(); - return NULL; -} + if (!driver) { + if (id) + printf ("load_plugins: failed to load audio output plugin <%s>\n", id); + else + printf ("load_plugins: audio output auto-probing didn't find any usable audio driver.\n"); + } + return driver; +} /** *************************************************************** * Autoplay featured plugins section */ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls) { + + /* FIXME */ + +#if 0 input_plugin_t *ip; char **autoplay_mrls = NULL; int i; @@ -1113,12 +759,22 @@ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls) { autoplay_mrls_done: return autoplay_mrls; + + +#endif + return NULL; } -/** *************************************************************** - * Browse featured plugins section +/* + * browse featured plugins section */ -mrl_t **xine_get_browse_mrls (xine_t *this, char *plugin_id, char *start_mrl, int *num_mrls) { +xine_mrl_t **xine_get_browse_mrls (xine_t *this, char *plugin_id, + char *start_mrl, int *num_mrls) { + + /* FIXME */ + +#if 0 + input_plugin_t *ip; mrl_t **browse_mrls = NULL; int i; @@ -1148,4 +804,79 @@ mrl_t **xine_get_browse_mrls (xine_t *this, char *plugin_id, char *start_mrl, in browse_mrls_done: return browse_mrls; + +#endif + return NULL; +} + +video_decoder_t *get_video_decoder (xine_t *this, uint8_t stream_type) { + + plugin_node_t *node; + +#ifdef LOG + printf ("load_plugins: looking for video decoder for streamtype %02x\n", + stream_type); +#endif + + node = this->plugin_catalog->video_decoder_map[stream_type]; + + if (!node) + return NULL; + + if (!node->plugin) + node->plugin = _load_plugin(this, node->filename, node->info, NULL); + + return node->plugin; +} + +audio_decoder_t *get_audio_decoder (xine_t *this, uint8_t stream_type) { + + plugin_node_t *node; + +#ifdef LOG + printf ("load_plugins: looking for audio decoder for streamtype %02x\n", + stream_type); +#endif + + node = this->plugin_catalog->audio_decoder_map[stream_type]; + + if (!node) + return NULL; + + if (!node->plugin) + node->plugin = _load_plugin(this, node->filename, node->info, NULL); + + return node->plugin; +} + +spu_decoder_t *get_spu_decoder (xine_t *this, uint8_t stream_type) { + return NULL; /* FIXME */ +} + + +/* + * dispose all currently loaded plugins (shutdown) + */ + +void dispose_plugins (xine_t *this) { + + /* FIXME: adapt old code */ + +#if 0 + for (i = 0; i < this->num_demuxer_plugins; i++) + this->demuxer_plugins[i]->close (this->demuxer_plugins[i]); + + for (i = 0; i < this->num_input_plugins; i++) + this->input_plugins[i]->dispose (this->input_plugins[i]); + + for (i = 0; i < this->num_audio_decoders_loaded; i++) + this->audio_decoders_loaded[i]->dispose (this->audio_decoders_loaded[i]); + + for (i = 0; i < this->num_video_decoders_loaded; i++) + this->video_decoders_loaded[i]->dispose (this->video_decoders_loaded[i]); + + for (i = 0; i < this->num_spu_decoders_loaded; i++) + this->spu_decoders_loaded[i]->dispose (this->spu_decoders_loaded[i]); + +#endif } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index be5291e78..af5b28a70 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.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: metronom.c,v 1.90 2002/09/01 13:50:07 heikos Exp $ + * $Id: metronom.c,v 1.91 2002/09/04 23:31:13 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -137,7 +137,7 @@ static void unixscr_start (scr_plugin_t *scr, int64_t start_vpts) { pthread_mutex_unlock (&this->lock); - unixscr_set_speed (&this->scr, SPEED_NORMAL); + unixscr_set_speed (&this->scr, XINE_SPEED_NORMAL); } static int64_t unixscr_get_current (scr_plugin_t *scr) { @@ -183,7 +183,7 @@ static scr_plugin_t* unixscr_init () { pthread_mutex_init (&this->lock, NULL); - unixscr_set_speed (&this->scr, SPEED_PAUSE); + unixscr_set_speed (&this->scr, XINE_SPEED_PAUSE); printf("xine-scr_init: complete\n"); return &this->scr; @@ -215,13 +215,13 @@ static int64_t metronom_get_current_time (metronom_t *this) { static void metronom_stop_clock(metronom_t *this) { scr_plugin_t** scr; for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) - if (*scr) (*scr)->set_speed(*scr, SPEED_PAUSE); + if (*scr) (*scr)->set_speed(*scr, XINE_SPEED_PAUSE); } static void metronom_resume_clock(metronom_t *this) { scr_plugin_t** scr; for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) - if (*scr) (*scr)->set_speed(*scr, SPEED_NORMAL); + if (*scr) (*scr)->set_speed(*scr, XINE_SPEED_NORMAL); } @@ -657,7 +657,7 @@ static int metronom_sync_loop (metronom_t *this) { scr_plugin_t** scr; int64_t pts; - while (((xine_t*)this->xine)->status != XINE_QUIT) { + while (((xine_t*)this->xine)->status != XINE_STATUS_QUIT) { pts = this->scr_master->get_current(this->scr_master); for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index bff328206..3e3eb521d 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -33,7 +33,6 @@ #include #include -#include "events.h" #include "xine_internal.h" #include "video_out/alphablend.h" #include "xine-engine/bswap.h" @@ -828,7 +827,7 @@ static void osd_renderer_close (osd_renderer_t *this) { } -static void update_text_palette(void *this_gen, cfg_entry_t *entry) +static void update_text_palette(void *this_gen, xine_cfg_entry_t *entry) { osd_renderer_t *this = (osd_renderer_t *)this_gen; @@ -870,7 +869,7 @@ osd_renderer_t *osd_renderer_init( video_overlay_instance_t *video_overlay, conf this->textpalette = config->register_enum (config, "misc.osd_text_palette", 0, textpalettes_str, _("Palette (foreground-border-background) to use on subtitles"), - NULL, update_text_palette, this); + NULL, 10, update_text_palette, this); /* * set up function pointer diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h new file mode 100644 index 000000000..e674f389d --- /dev/null +++ b/src/xine-engine/plugin_catalog.h @@ -0,0 +1,71 @@ +/* + * 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: plugin_catalog.h,v 1.2 2002/09/04 23:31:13 guenter Exp $ + * + * xine-internal header: Definitions for plugin lists + * + */ + +#ifndef _PLUGIN_CATALOG_H +#define _PLUGIN_CATALOG_H + +#include "xine_plugin.h" +#include "xineutils.h" + +#define DECODER_MAX 256 + +typedef struct { + char *filename; + plugin_info_t *info; + void *plugin; +} plugin_node_t ; + +struct plugin_catalog_s { + xine_list_t *input; + xine_list_t *demux; + xine_list_t *spu; + xine_list_t *audio; + xine_list_t *video; + xine_list_t *aout; + xine_list_t *vout; + + plugin_node_t *audio_decoder_map[DECODER_MAX]; + plugin_node_t *video_decoder_map[DECODER_MAX]; + plugin_node_t *spu_decoder_map[DECODER_MAX]; +}; +typedef struct plugin_catalog_s plugin_catalog_t; + +/* + * load plugins into catalog + * + * all input+demux plugins will be fully loaded+initialized + * decoder plugins are loaded on demand + * video/audio output plugins have special load/probe functions + */ +void scan_plugins (xine_t *this); + + +/* + * dispose all currently loaded plugins (shutdown) + */ + +void dispose_plugins (xine_t *this); + +#endif diff --git a/src/xine-engine/tvmode.c b/src/xine-engine/tvmode.c index 6c5bf45c3..700e6d774 100644 --- a/src/xine-engine/tvmode.c +++ b/src/xine-engine/tvmode.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: tvmode.c,v 1.7 2002/08/03 17:33:06 siggi Exp $ + * $Id: tvmode.c,v 1.8 2002/09/04 23:31:13 guenter Exp $ * * tvmode - TV output selection * @@ -30,103 +30,76 @@ #include #include #include -#include #include -#include #include "nvtvd.h" -#include "xine_internal.h" -/* FIXME: how to include that? */ -/*#include "xine.h" */ #include "xine_internal.h" #include "xineutils.h" -#define ABS(x) ((x)>0?(x):-(x)) -#define APPROX(x,y) (ABS((x)-(y)) < 1e-2) /* less than 1% difference */ - /* * PRIVATE */ -/* TODO: config */ -static TVConnect opt_connect = CONNECT_AUTO; -static int opt_flicker = -1; - -typedef struct { - int width, height; - int fps; - int quality; - char overscan[16]; -} scan_mode_t; - /* FIXME: currently the used backend only supports one (1) connection * to a server and needs this global, external pointer */ -/* Thus we do not care about saving data in a own structure now... */ BackCardRec *back_card = 0; BackAccessRec *back_access = 0; -static int tv_stream_width, tv_stream_height; -static double tv_stream_fps; -static int tv_current_type, tv_current_system; -static int tv_current_width, tv_current_height; -static double tv_current_fps; -static TVCrtRegs tv_old_crt; -static TVRegs tv_old_tv; - -static int tv_verbose; -static int tv_capabilities; -static int tv_policy; -static int tv_prefered_fps; -static double tv_aspect; - -/* This is the list of possible modes for the used refresh rates */ -static const char *tv_scan_mode; - -/* Constant data */ -enum { TV_CAP_PAL = 1, TV_CAP_PAL60 = 2, TV_CAP_NTSC = 4 }; -static char *tv_systems_list[] = { - "No TV connected", "PAL only", "NTSC only", - "PAL and PAL60", "PAL and NTSC", "PAL, PAL60, NTSC", NULL -}; -static const int tv_system_caps[] = { - 0, TV_CAP_PAL, TV_CAP_NTSC, - TV_CAP_PAL|TV_CAP_PAL60, TV_CAP_PAL|TV_CAP_NTSC, - TV_CAP_PAL|TV_CAP_PAL60|TV_CAP_NTSC -}; - -#define SCAN_NATIVE_25 576 -#define SCAN_NATIVE_30 480 -static char *tv_scan_mode_default = -"768x576*25,800x576*25,720x576*25,704x576*25," /* Best PAL modes */ -"768x480*30,800x480*30,720x480*30," /* Best NTSC modes */ -"640x576*25,640x480*30,480x576*25,480x480*30," /* Smaller width modes */ -"800x600,800x450,1024x768"; /* Non-Native modes */ -/* Modes that are not included due to common misconfigurations: - * 640x400*30,640x480*25 - */ -enum { TV_POL_FPS_BEST = 0, TV_POL_FPS_MATCH, - TV_POL_FPS_LIST, TV_POL_MATCH_FPS }; -static char *tv_policies_list[] = { - "FPS - Best Native Match", "FPS - Best Match", "FPS - List Order", - "Best Match - FPS", NULL -}; - -static char *tv_aspect_list[] = { - "4:3", "16:9", NULL -}; -static const double tv_aspect_aspects[] = { 4.0/3.0, 16.0/9.0 }; +static int current_type, current_width, current_height; +static double current_fps; +static TVCrtRegs old_crt; +static TVRegs old_tv; + +static int tvmode_enabled; +static int was_enabled = 0; + + +/* TODO: config, and better */ +static TVSystem opt_system = TV_SYSTEM_PAL; +static TVConnect opt_connect = CONNECT_AUTO; + +/* This is the list of possible modes for the used TV system. + * TODO: + * if select_origsize == false: + * The one closest (but larger) to the input stream size is selected. + * if select_origsize == true: + * The first available mode is selected (stick to tv resolution) */ +static int scan_mode_pal[][2] = { + { 768, 576 }, { 800, 576 }, { 720, 576 }, + { 800, 600 }, + { 720, 480 }, { 640, 480 }, + { 800, 450 }, + { 1024, 768 }, + { 0 } +} ; /* Overscan sizes to be scaned for - note that we do *not* scan for 'Small' */ static char *scan_overscan[] = { - "DVD", "Interl", "Huge", "Large", "Normal", 0 -}; + "Interl", "Huge", "Large", "DVD", "Normal", 0 +} ; +/* TODO: flexible */ +static int opt_flicker = -1; +static double opt_aspect = 4.0 / 3.0; /* Just turn off warnings */ -void xine_tvmode_exit (void); -void xine_tvmode_exit2 (xine_t *this); +static void _tvmode_init(xine_t *this); +void xine_tvmode_exit (xine_t *this); +/* + * Config callback for tvmode enability. + */ +static void nvtvmode_enable_cb(void *this_gen, xine_cfg_entry_t *entry) { + xine_t *this = (xine_t *) this_gen; + + tvmode_enabled = entry->num_value; + + if(!tvmode_enabled && was_enabled) { + xine_tvmode_exit(this); + was_enabled = 0; + } +} /* Try to connect to nvtvd server */ static void tvmode_connect(xine_t *this) { @@ -143,158 +116,35 @@ static void tvmode_connect(xine_t *this) { back_card = 0; } - if (back_card) - { - printf ("tvmode: connected to nvtvd\n"); - back_card->openCard (card); + if (back_card) { + back_card->openCard (card); + was_enabled = 1; } else - printf ("tvmode: cannot connect to nvtvd - TV mode switching disabled\n"); + printf("tvmode: cannot connect to nvtvd - no TV mode switching available\n"); } /* Disconnect from server */ static void tvmode_disconnect (xine_t *this) { back_card->closeCard (); - printf ("tvmode: disconnected\n"); back_card = 0; } /* Save current CRT and TV register configuration */ static void tvmode_savestate (xine_t *this) { - back_card->getMode (&tv_old_crt, &tv_old_tv); + back_card->getMode (&old_crt, &old_tv); } /* Restore CRT and TV register configuration */ static void tvmode_restorestate (xine_t *this) { - printf ("tvmode: switching back to regular display\n"); - back_card->setMode (0, &tv_old_crt, &tv_old_tv); - tv_current_type = 0; + back_card->setMode (0, &old_crt, &old_tv); + current_type = 0; } -/* Connect to nvtvd server if possible and save current card config */ -static void tvmode_startup (xine_t *this) { - if (tv_capabilities && ! back_card) - tvmode_connect (this); - if (back_card) - tvmode_savestate (this); -} - - -/* Disconnect and recover */ -static void tvmode_closedown (xine_t *this) { - if (back_card) { - tvmode_restorestate (this); - tvmode_disconnect (this); - } -} - - -/* Sort callback */ -static int tvmode_cmp_scanmode_cb (const void *a, const void *b) { - return ((const scan_mode_t *) b) -> quality - - ((const scan_mode_t *) a) -> quality; -} - - -/* Parse mode string and set mode scan table accordingly */ -/* Returns next free mode slot */ -/* Table will be sorted based on prefwidth/prefheight/fps, when sortmode!=0 */ -static scan_mode_t *set_modes (xine_t *this, scan_mode_t *modes, int maxnum, - scan_mode_t *sortmodes, - const char *string, int fps, - int prefwidth, int minwidth, int maxwidth, - int prefheight, int minheight, int maxheight) { - const char *s = string; - int num = 0; - int i, w, h, f; - char overscan[16], *os; - - /* Check whether system is available */ - if (fps == 30 && ! (tv_capabilities & (TV_CAP_PAL60 | TV_CAP_NTSC))) - return modes; - if (fps == 25 && ! (tv_capabilities & TV_CAP_PAL)) - return modes; - - if (tv_verbose) - printf ("tmode: selecting modes, preferred %dx%d fps %d, min %dx%d\n", - prefwidth, prefheight, fps, minwidth, minheight); - /* scan modes */ - while (num < maxnum) { - while (isspace ((int) *s) || *s == ',') s++; - if (! *s) - break; - i = w = h = -1; - sscanf (s, " %d x %d %n", &w, &h, &i); - if (i < 2 || w <= 0 || h <= 0) { - printf ("tvmode: mode line syntax error after '%s'\n", s); - break; - } - s += i; - overscan [0] = 0; - if (*s == '/') { - s++; - os = overscan; - while (isspace ((int) *s)) s++; - while (isalnum ((int) *s) && os < &overscan[16-1]) - *os++ = *s++; - *os = 0; - } - f = fps; - if (*s == '*') { - f = -1; - sscanf (s, "* %d %n", &f, &i); - if (i < 1 || f <= 0) { - printf ("tvmode: mode line syntax error after '%s'\n", s); - break; - } - s += i; - } - if (w >= minwidth && w <= maxwidth - && h >= minheight && h <= maxheight - && f == fps) { - - int diff = prefwidth*prefheight - w*h; - modes[num].width = w; - modes[num].width = w; - modes[num].height = h; - modes[num].fps = f; - strncpy (modes[num].overscan, overscan, 16); - /* Set quality = Size diff in pixels + Diff in fps - * + penalty for too small sizes */ - modes[num].quality = - ABS (diff) - ABS (f - fps) - - (prefwidth > w ? 1000 * h : 0) - - (prefheight > h ? 2000 * w : 0); - if (tv_verbose) - printf ("tvmode: entry %dx%d [%s] fps %d quality %d\n", - w, h, overscan, f, modes[num].quality); - num++; - } else { - if (tv_verbose) - printf ("tvmode: entry %dx%d [%s] fps %d rejected\n", - w, h, overscan, f); - } - if (*s != ',') { - if (*s) - printf ("tvmode: mode line syntax error after '%s'\n", s); - break; - } - } - if (num >= maxnum) - printf ("tvmode: mode array overflow - some modes are not tested\n"); - if (! sortmodes) - return modes + num; - /* Now sort */ - qsort (sortmodes, (modes-sortmodes) + num, sizeof (scan_mode_t), - tvmode_cmp_scanmode_cb); - if (tv_verbose) - printf ("tvmode: sorted\n"); - return modes + num; -} - /* Set CRT and TV registers to given TV-Out configuration */ static void tvmode_settvstate (xine_t *this, int width, int height, double fps) { @@ -303,184 +153,43 @@ static void tvmode_settvstate (xine_t *this, int width, int height, double fps) TVCrtRegs crt; TVRegs tv; int found = 0; - scan_mode_t modes[256]; /* FIXME: shouldn't be fix */ - scan_mode_t *m = modes; - scan_mode_t *last_mode; - int best_rate; - char **scano; - char *current_overscan = ""; - TVSystem sys; - int i; - - if (tv_verbose) - printf ("tvmode: Requested mode for %dx%d, %g fps\n", - width, height, fps); - + int *scanm; + char **scano; + /* Modify the settings */ back_card->getSettings (&settings); - settings.connector = opt_connect; - if (opt_flicker >= 0) - settings.flicker = opt_flicker; - - /* Check fps for capability selection */ - best_rate = tv_prefered_fps; - if (APPROX (fps, 60) || APPROX (fps, 30) || - APPROX (fps, 20) || APPROX (fps, 15)) - best_rate = 30; - if (APPROX (fps, 50) || APPROX (fps, 25) || - APPROX (fps, 50.0/3) || APPROX (fps, 12.5)) - best_rate = 25; - - /* Scan mode strings and create scan table */ - /* TODO: do that at initialization and save possible combinations ?!? */ - switch (tv_policy) { - case TV_POL_FPS_BEST: - if (APPROX (fps, 24)) /* FIXME: hardcoded for this policy only */ - best_rate = 30; - if (best_rate == 30) - { - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, - SCAN_NATIVE_30, SCAN_NATIVE_30, SCAN_NATIVE_30); - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - } - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 25, - width, 0, INT_MAX, - SCAN_NATIVE_25, SCAN_NATIVE_25, SCAN_NATIVE_25); - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 25, - width, 0, INT_MAX, height, 0, INT_MAX); - if (best_rate != 30) - { - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, - SCAN_NATIVE_30, SCAN_NATIVE_30, SCAN_NATIVE_30); - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - } - break; - case TV_POL_FPS_MATCH: - if (best_rate == 30) - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 25, - width, 0, INT_MAX, height, 0, INT_MAX); - if (best_rate != 30) - m = set_modes (this, m, &modes[256]-m, m, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - break; - case TV_POL_FPS_LIST: - if (best_rate == 30) - m = set_modes (this, m, &modes[256]-m, NULL, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - m = set_modes (this, m, &modes[256]-m, NULL, tv_scan_mode, 25, - width, 0, INT_MAX, height, 0, INT_MAX); - if (best_rate != 30) - m = set_modes (this, m, &modes[256]-m, NULL, tv_scan_mode, 30, - 0, 0, INT_MAX, 0, 0, INT_MAX); - break; - case TV_POL_MATCH_FPS: - if (height <= SCAN_NATIVE_30 && best_rate == 30) { - m = set_modes (this, m, &modes[256]-m, NULL, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - m = set_modes (this, m, &modes[256]-m, modes, tv_scan_mode, 25, - width, 0, INT_MAX, height, 0, INT_MAX); - } else { - m = set_modes (this, m, &modes[256]-m, NULL, tv_scan_mode, 25, - width, 0, INT_MAX, height, 0, INT_MAX); - m = set_modes (this, m, &modes[256]-m, modes, tv_scan_mode, 30, - width, 0, INT_MAX, height, 0, INT_MAX); - } - break; - default: - abort (); + if (opt_connect > CONNECT_NONE) { + settings.connector = opt_connect; + } else { + settings.connector = CONNECT_BOTH; } - last_mode = m; - - if (tv_verbose) { - printf ("tvmode: ->"); - for (i = 0; i < last_mode-modes; i++) - printf (" %dx%d/%s*%d", modes[i].width, modes[i].height, - modes[i].overscan, modes[i].fps); - printf ("\n"); + if (opt_flicker >= 0) { + settings.flicker = opt_flicker; } - - /* Select first mode that is actually known to the chip */ - for (m = modes; m < last_mode && !found; m++) { - sys = TV_SYSTEM_PAL; - if (m->fps == 30 && (tv_capabilities & TV_CAP_PAL60)) - sys = TV_SYSTEM_PAL_60; - else if (m->fps == 30 && (tv_capabilities & TV_CAP_NTSC)) - sys = TV_SYSTEM_NTSC; - if (! *m->overscan) { - for (scano = scan_overscan; *scano && !found; scano++) { - if (tv_verbose) - printf ("tvmore: trying to use %dx%d [%s] fps %d\n", - m->width, m->height, *scano, m->fps); - if (back_card->findBySize (sys, m->width, m->height, *scano, - &mode, &crt, &tv)) { - tv_current_width = m->width; - tv_current_height = m->height; - tv_current_system = sys; - tv_current_fps = m->fps; - current_overscan = *scano; - found++; - } else if (sys == TV_SYSTEM_PAL_60 && - (tv_capabilities & TV_CAP_NTSC) && - back_card->findBySize (TV_SYSTEM_NTSC, - m->width, m->height, *scano, - &mode, &crt, &tv)) { - tv_current_width = m->width; - tv_current_height = m->height; - tv_current_system = TV_SYSTEM_NTSC; - tv_current_fps = m->fps; - current_overscan = *scano; - found++; - } - } - } else { - if (tv_verbose) - printf ("tvmore: trying to use %dx%d [%s] fps %d\n", - m->width, m->height, m->overscan, m->fps); - if (back_card->findBySize (sys, m->width, m->height, m->overscan, + /* TODO: do that at initialization and save possible combinations */ + /* Find supported TV mode */ + for (scanm = &scan_mode_pal[0][0]; *scanm && ! found; scanm += 2) { + for (scano = scan_overscan; *scano && ! found; scano++) { + printf("tvmode: trying to use %dx%d %s\n", + scanm[0], scanm[1], *scano); + if (back_card->findBySize (opt_system, scanm[0], scanm[1], *scano, &mode, &crt, &tv)) { - tv_current_width = m->width; - tv_current_height = m->height; - tv_current_system = sys; - tv_current_fps = m->fps; - current_overscan = m->overscan; - found++; - } else if (sys == TV_SYSTEM_PAL_60 && - (tv_capabilities & TV_CAP_NTSC) && - back_card->findBySize (TV_SYSTEM_NTSC, - m->width, m->height, m->overscan, - &mode, &crt, &tv)) { - tv_current_width = m->width; - tv_current_height = m->height; - tv_current_system = TV_SYSTEM_NTSC; - tv_current_fps = m->fps; - current_overscan = m->overscan; + current_width = scanm[0]; + current_height = scanm[1]; + current_fps = 25; /* TODO: currently this is PAL only */ found++; } } } - - /* Modify found Crt settings */ - crt.PrivFlags &= ~TV_MODE_MACROVISION; /* Switch to mode */ if (found) { - printf ("tvmode: Switching to TV %dx%d [%s] fps %g %s\n", - tv_current_width, tv_current_height, current_overscan, - tv_current_fps, tv_current_system == TV_SYSTEM_PAL ? "PAL" : - tv_current_system == TV_SYSTEM_PAL_60 ? "PAL60" : - tv_current_system == TV_SYSTEM_NTSC ? "NTSC" : "UNKNOWN"); back_card->setModeSettings (TV_PRIV_TVMODE | TV_PRIV_DUALVIEW, &crt, &tv, &settings); - tv_current_type = 1; + current_type = 1; } else { - printf ("tvmode: cannot find any valid TV mode - TV output disabled\n"); - tvmode_closedown (this); + printf("tvmode: cannot find any valid TV mode - TV output disabled\n"); + xine_tvmode_exit (this); } } @@ -490,184 +199,87 @@ static void tvmode_settvstate (xine_t *this, int width, int height, double fps) */ /* Set to 'regular'(0) or 'tv'(1) state, that is if it is enabled */ -int xine_tvmode_switch2 (xine_t *this, int type, int width, int height, double fps) { +int xine_tvmode_switch (xine_t *this, int type, int width, int height, double fps) { + if(tvmode_enabled) { + + /* + * Wasn't initialized + */ + if(!was_enabled) + _tvmode_init(this); + if (back_card) { + printf("tvmode: switching to %s\n", type ? "TV" : "default"); switch (type) { case 0: tvmode_restorestate (this); break; case 1: - tv_stream_width = width; - tv_stream_height = height; - tv_stream_fps = fps; tvmode_settvstate (this, width, height, fps); break; default: - printf ("tvmode: illegal type for switching\n"); + printf("tvmode: illegal type for switching\n"); tvmode_restorestate (this); } + } else { + printf("tvmode: not connected to nvtvd for switching\n"); } - return tv_current_type; + + } + + return current_type; } /* Addapt (maximum) output size to visible area and set pixel aspect and fps */ -void xine_tvmode_size2 (xine_t *this, int *width, int *height, +void xine_tvmode_size (xine_t *this, int *width, int *height, double *pixelratio, double *fps) { - switch (tv_current_type) { + if(tvmode_enabled) { + + switch (current_type) { case 1: - if (width && *width > tv_current_width) - *width = tv_current_width; - if (height && *height > tv_current_height) - *height = tv_current_height; - if (pixelratio) - *pixelratio = ((double) tv_current_width / tv_current_height) - / tv_aspect; - if (fps) - *fps = tv_current_fps; - break; + if (width && *width > current_width) + *width = current_width; + if (height && *height > current_height) + *height = current_height; + if (pixelratio) + *pixelratio = ((double) current_width / current_height) / opt_aspect; + if (fps) + *fps = current_fps; + break; } -} - -/* Configuration callbacks */ -static void tvmode_system_cb (void *data, cfg_entry_t *entry) { - xine_t *this = (xine_t *) data; - tv_capabilities = tv_system_caps [entry->num_value]; - if (tv_capabilities && !back_card) - tvmode_startup (this); - else if (!tv_capabilities && back_card) - tvmode_closedown (this); -} -static void tvmode_policy_cb (void *data, cfg_entry_t *entry) { - xine_t *this = (xine_t *) data; - tv_policy = entry->num_value; - xine_tvmode_switch2 (this, tv_current_type, tv_stream_width, - tv_stream_height, tv_stream_fps); -} -static void tvmode_mode_cb (void *data, cfg_entry_t *entry) { - xine_t *this = (xine_t *) data; - tv_scan_mode = entry->str_value; - if (this && *tv_scan_mode == '-') - /*^^^^^^^ FIXME: this check can be removed in new API */ - this->config->update_string (this->config, "tv.modes", tv_scan_mode_default); - xine_tvmode_switch2 (this, tv_current_type, tv_stream_width, - tv_stream_height, tv_stream_fps); -} -static void tvmode_aspect_cb (void *data, cfg_entry_t *entry) { - xine_t *this = (xine_t *) data; - tv_aspect = tv_aspect_aspects[entry->num_value]; - xine_tvmode_switch2 (this, tv_current_type, tv_stream_width, - tv_stream_height, tv_stream_fps); -} -static void tvmode_preferred_fps_cb (void *data, cfg_entry_t *entry) { - xine_t *this = (xine_t *) data; - tv_prefered_fps = entry->num_value ? 25 : 30; - xine_tvmode_switch2 (this, tv_current_type, tv_stream_width, - tv_stream_height, tv_stream_fps); -} -static void tvmode_verbose_cb (void *data, cfg_entry_t *entry) { - tv_verbose = entry->num_value; -} - - -/* Connect to nvtvd server if possible and register settings */ -void xine_tvmode_init2 (xine_t *this) { - /* TODO: - * more config options that can be imagined: - * - disable deinterlacing for tv mode only - * - flickerfilter - * - input filters - * - connectors + dual view - * - color systems (PAL / PAL_M / etc.) - * - FILM (24 fps) -> 50 / 60Hz / 50Hz+Speedup ? - */ - tv_capabilities = tv_system_caps [this->config->register_enum ( - this->config, "tv.capabilities", - 0, tv_systems_list, _("TV System"), - "Capabilities of the connected TV system", - tvmode_system_cb, this)]; - tv_policy = this->config->register_enum ( - this->config, "tv.policy", - 0, tv_policies_list, _("Mode Selection Policy"), - "FPS - Best Native Match:\n" - "Select system (50/60Hz) according to frame rate and TV system,\n" - "select 60Hz for FILM (24 fps),\n" - "select native resolutions only if available,\n" - "select best matching mode for given video size.\n" - "This policy prefers correct frame rates to better resolutions." - "Recommended.\n\n" - "FPS - Best Match:\n" - "Select system (50/60Hz) according to frame rate,\n" - "select 50Hz for FILM (24 fps),\n" - "select best matching mode for given video size.\n\n" - "FPS - List Order:\n" - "Select system (50/60Hz) according to frame rate,\n" - "select 50Hz for FILM (24 fps),\n" - "select first available mode in the modes list.\n\n" - "Best Match - FPS:\n" - "Select best matching mode for the given video size,\n" - "select system (50/60Hz) according to frame rate and TV system.\n" - "This policy prefers better resolutions to correct frame rates.", - tvmode_policy_cb, this); - tv_scan_mode = this->config->register_string ( - this->config, "tv.modes", - tv_scan_mode_default, _("Modes"), - "Specify valid resolutions.\n" - "x[/][*][, ...]\n" - "Enter '-' to use default list.\n" - "When no overscan mode is given, the following list is tried:\n" - "'Interl', 'Huge', 'Large', 'DVD', 'Normal'\n" - "When no FPS value is given, mode is valid for both, " - "25 (PAL) and 30 (PAL60/NTSC).", - tvmode_mode_cb, this); - tv_prefered_fps = this->config->register_bool ( - this->config, "tv.preferPAL", 1, _("Prefer PAL"), - "Prefer 50Hz modes to 60Hz modes for videos " - "with nonstandard frame rates", - tvmode_preferred_fps_cb, this) - ? 25 : 30; - tv_verbose = this->config->register_bool ( - this->config, "tv.verbose", 0, _("Verbose resolution selection"), - NULL, tvmode_verbose_cb, this); - if (*tv_scan_mode == '-') - this->config->update_string (this->config, "tv.modes", tv_scan_mode_default); - tv_aspect = tv_aspect_aspects [this->config->register_enum ( - this->config, "tv.aspect", - 0, tv_aspect_list, _("Screen Aspect Ratio"), NULL, - tvmode_aspect_cb, this)]; - tvmode_startup (this); -} - -/* Restore old CRT and TV registers and close nvtvd connection */ -void xine_tvmode_exit2 (xine_t *this) { - - tvmode_closedown (this); + } } -/***************************************************************** - * - * compatibility functions - * FIXME: these should be replaced by the *2-functions in the next release - */ - -void xine_tvmode_init () { - tvmode_connect (NULL); +/* Connect to nvtvd server if possible and fetch settings */ +static void _tvmode_init(xine_t *this) { + if(tvmode_enabled) { + tvmode_connect (this); if (back_card) - tvmode_savestate (NULL); + tvmode_savestate (this); + } } - -void xine_tvmode_exit () { - - tvmode_closedown (NULL); +void xine_tvmode_init (xine_t *this) { + + tvmode_enabled = this->config->register_bool(this->config, "misc.nv_tvmode", + 0, + _("NVidia TV-Out support."), + NULL, 10, + nvtvmode_enable_cb, this); + _tvmode_init(this); } -int xine_tvmode_switch (int type, int width, int height, double fps){ - return xine_tvmode_switch2(NULL, type, width, height, fps); -} +/* Restore old CRT and TV registers and close nvtvd connection */ +void xine_tvmode_exit (xine_t *this) { -void xine_tvmode_size (int *width, int *height, double *pixelaspect, double *fps){ - xine_tvmode_size2 (NULL, width, height, pixelaspect, fps); + if(tvmode_enabled || was_enabled) { + if (back_card) { + tvmode_restorestate (this); + tvmode_disconnect (this); + } + } } + diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index b031b0a8c..af6fa4b93 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.95 2002/09/04 10:49:25 mroi Exp $ + * $Id: video_decoder.c,v 1.96 2002/09/04 23:31:13 guenter Exp $ * */ @@ -38,8 +38,9 @@ */ static spu_decoder_t* update_spu_decoder(xine_t *this, int type) { + int streamtype = (type>>16) & 0xFF; - spu_decoder_t *spu_decoder = this->spu_decoder_plugins [streamtype]; + spu_decoder_t *spu_decoder = get_spu_decoder (this, streamtype); if (spu_decoder && this->cur_spu_decoder_plugin != spu_decoder) { @@ -263,7 +264,7 @@ void *video_decoder_loop (void *this_gen) { streamtype = (buf->type>>16) & 0xFF; - decoder = this->video_decoder_plugins [streamtype]; + decoder = get_video_decoder (this, streamtype); if (decoder) { diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 5b539fc89..14c0a3ac1 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_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: video_out.c,v 1.102 2002/08/03 20:42:32 siggi Exp $ + * $Id: video_out.c,v 1.103 2002/09/04 23:31:13 guenter Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -36,9 +36,9 @@ #include #include +#include "xine_internal.h" #include "video_out.h" #include "metronom.h" -#include "xine_internal.h" #include "xineutils.h" /* @@ -51,7 +51,7 @@ typedef struct { vo_instance_t vo; /* public part */ - vo_driver_t *driver; + xine_vo_driver_t *driver; metronom_t *metronom; xine_t *xine; @@ -365,7 +365,7 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { image_size = img->pitches[0] * img->height; - if (img->format == IMGFMT_YV12) { + if (img->format == XINE_IMGFMT_YV12) { if (img->base[0]) xine_fast_memcpy(dupl->base[0], img->base[0], image_size); if (img->base[1]) @@ -382,7 +382,7 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { dupl->vpts = 0; dupl->duration = img->duration; - if (img->format == IMGFMT_YV12) { + if (img->format == XINE_IMGFMT_YV12) { if (img->copy) { int height = img->height; uint8_t* src[3]; @@ -620,7 +620,7 @@ static void paused_loop( vos_t *this, int64_t vpts ) /* prevent decoder thread from allocating new frames */ this->free_img_buf_queue->locked_for_read = 1; - while( this->xine->speed == SPEED_PAUSE ) { + while( this->xine->speed == XINE_SPEED_PAUSE ) { /* we need at least one free frame to keep going */ if( this->display_img_buf_queue->first && @@ -747,7 +747,7 @@ static void *video_out_loop (void *this_gen) { do { vpts = this->metronom->get_current_time (this->metronom); - if( this->xine->speed == SPEED_PAUSE ) + if( this->xine->speed == XINE_SPEED_PAUSE ) paused_loop( this, vpts ); usec_to_sleep = (next_frame_vpts - vpts) * 100 / 9; @@ -798,6 +798,70 @@ static uint32_t vo_get_capabilities (vo_instance_t *this_gen) { return this->driver->get_capabilities (this->driver); } +static vo_frame_t * vo_duplicate_frame( vo_instance_t *this_gen, vo_frame_t *img ) { + + vo_frame_t *dupl; + /* vos_t *this = (vos_t *) this_gen; */ + int image_size; + + dupl = vo_get_frame (this_gen, img->width, img->height, img->ratio, + img->format, VO_BOTH_FIELDS ); + + image_size = img->pitches[0] * img->height; + + if (img->format == XINE_IMGFMT_YV12) { + /* The dxr3 video out plugin does not allocate memory for the dxr3 + * decoder, so we must check for NULL */ + if (img->base[0]) + xine_fast_memcpy(dupl->base[0], img->base[0], image_size); + if (img->base[1]) + xine_fast_memcpy(dupl->base[1], img->base[1], img->pitches[1] * ((img->height+1)/2)); + if (img->base[2]) + xine_fast_memcpy(dupl->base[2], img->base[2], img->pitches[2] * ((img->height+1)/2)); + } else { + if (img->base[0]) + xine_fast_memcpy(dupl->base[0], img->base[0], image_size); + } + + dupl->bad_frame = 0; + dupl->pts = 0; + dupl->vpts = 0; + dupl->duration = img->duration; + + /* Support copy; Dangerous, since some decoders may use a source that's + * not dupl->base. It's up to the copy implementation to check for NULL */ + if (img->format == XINE_IMGFMT_YV12) { + if (img->copy) { + int height = img->height; + uint8_t* src[3]; + + src[0] = dupl->base[0]; + src[1] = dupl->base[1]; + src[2] = dupl->base[2]; + while ((height -= 16) >= 0) { + dupl->copy(dupl, src); + src[0] += 16 * img->pitches[0]; + src[1] += 8 * img->pitches[1]; + src[2] += 8 * img->pitches[2]; + } + } + } else { + if (img->copy) { + int height = img->height; + uint8_t* src[3]; + + src[0] = dupl->base[0]; + + while ((height -= 16) >= 0) { + dupl->copy(dupl, src); + src[0] += 16 * img->pitches[0]; + } + } + } + + return dupl; +} + static void vo_open (vo_instance_t *this_gen) { vos_t *this = (vos_t *) this_gen; @@ -886,7 +950,7 @@ static void vo_enable_overlay (vo_instance_t *this_gen, int overlay_enabled) { } -vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { +vo_instance_t *vo_new_instance (xine_vo_driver_t *driver, xine_t *xine) { vos_t *this; int i; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 0d0ba633b..056ff72dc 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_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: video_out.h,v 1.58 2002/08/15 03:12:26 miguelfreitas Exp $ + * $Id: video_out.h,v 1.59 2002/09/04 23:31:13 guenter Exp $ * * * xine version of video_out.h @@ -46,26 +46,11 @@ extern "C" { #include #include -#if 0 -#if defined(XINE_COMPILE) -#include "configfile.h" -#include "metronom.h" -#include "buffer.h" -#else -#include "xine/configfile.h" -#include "xine/metronom.h" -#include "xine/buffer.h" -#endif -#endif - typedef struct vo_frame_s vo_frame_t; -typedef struct vo_driver_s vo_driver_t ; typedef struct vo_instance_s vo_instance_t; -typedef struct vo_info_s vo_info_t; typedef struct img_buf_fifo_s img_buf_fifo_t; typedef struct vo_overlay_s vo_overlay_t; typedef struct video_overlay_instance_s video_overlay_instance_t; -typedef struct xine_s xine_t; typedef struct vo_private_s vo_private_t; @@ -103,7 +88,7 @@ struct vo_frame_s { /* "backward" references to where this frame originates from */ vo_instance_t *instance; - vo_driver_t *driver; + xine_vo_driver_t *driver; int id; /* debugging - track this frame */ @@ -215,11 +200,6 @@ struct vo_instance_s { */ #define VO_NUM_RECENT_FRAMES 2 -/* image formats that can be supported by display drivers: */ - -#define IMGFMT_YV12 0x32315659 -#define IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y') -/*#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) unused */ /* possible ratios for the VO_PROP_ASPECT_RATIO call */ @@ -254,7 +234,7 @@ struct vo_instance_s { #define VO_CAP_AUTOPAINT_COLORKEY 0x00000200 /* driver can set AUTOPAINT_COLORKEY value */ /* - * vo_driver_s contains the functions every display driver + * xine_vo_driver_s contains the functions every display driver * has to implement. The vo_new_instance function (see below) * should then be used to construct a vo_instance using this * driver. Some of the function pointers will be copied @@ -264,27 +244,27 @@ struct vo_instance_s { #define VIDEO_OUT_DRIVER_IFACE_VERSION 6 -struct vo_driver_s { +struct xine_vo_driver_s { - uint32_t (*get_capabilities) (vo_driver_t *this); /* for constants see above */ + uint32_t (*get_capabilities) (xine_vo_driver_t *this); /* for constants see above */ /* * allocate an vo_frame_t struct, * the driver must supply the copy, field and dispose functions */ - vo_frame_t* (*alloc_frame) (vo_driver_t *this); + vo_frame_t* (*alloc_frame) (xine_vo_driver_t *this); /* * check if the given image fullfills the format specified * (re-)allocate memory if necessary */ - void (*update_frame_format) (vo_driver_t *this, vo_frame_t *img, + void (*update_frame_format) (xine_vo_driver_t *this, vo_frame_t *img, uint32_t width, uint32_t height, int ratio_code, int format, int flags); /* display a given frame */ - void (*display_frame) (vo_driver_t *this, vo_frame_t *vo_img); + void (*display_frame) (xine_vo_driver_t *this, vo_frame_t *vo_img); /* overlay_begin and overlay_end are used by drivers suporting * persistent overlays. they can be optimized to update only when @@ -298,18 +278,18 @@ struct vo_driver_s { * * any function pointer from this group may be set to NULL. */ - void (*overlay_begin) (vo_driver_t *this, vo_frame_t *vo_img, int changed); - void (*overlay_blend) (vo_driver_t *this, vo_frame_t *vo_img, vo_overlay_t *overlay); - void (*overlay_end) (vo_driver_t *this, vo_frame_t *vo_img); + void (*overlay_begin) (xine_vo_driver_t *this, vo_frame_t *vo_img, int changed); + void (*overlay_blend) (xine_vo_driver_t *this, vo_frame_t *vo_img, vo_overlay_t *overlay); + void (*overlay_end) (xine_vo_driver_t *this, vo_frame_t *vo_img); /* * these can be used by the gui directly: */ - int (*get_property) (vo_driver_t *this, int property); - int (*set_property) (vo_driver_t *this, + int (*get_property) (xine_vo_driver_t *this, int property); + int (*set_property) (xine_vo_driver_t *this, int property, int value); - void (*get_property_min_max) (vo_driver_t *this, + void (*get_property_min_max) (xine_vo_driver_t *this, int property, int *min, int *max); /* @@ -319,16 +299,16 @@ struct vo_driver_s { * etc. to the driver */ - int (*gui_data_exchange) (vo_driver_t *this, int data_type, + int (*gui_data_exchange) (xine_vo_driver_t *this, int data_type, void *data); - void (*exit) (vo_driver_t *this); + void (*exit) (xine_vo_driver_t *this); /* check if a redraw is needed (due to resize) * this is only used for still frames, normal video playback * must call that inside display_frame() function. */ - int (*redraw_needed) (vo_driver_t *this); + int (*redraw_needed) (xine_vo_driver_t *this); }; @@ -379,7 +359,7 @@ struct video_overlay_instance_s { int (*redraw_needed) (video_overlay_instance_t *this_gen, int64_t vpts ); void (*multiple_overlay_blend) (video_overlay_instance_t *this_gen, int64_t vpts, - vo_driver_t *output, vo_frame_t *vo_img, int enabled); + xine_vo_driver_t *output, vo_frame_t *vo_img, int enabled); }; video_overlay_instance_t *video_overlay_new_instance (); @@ -390,14 +370,14 @@ video_overlay_instance_t *video_overlay_new_instance (); * a given video driver */ -vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) ; +vo_instance_t *vo_new_instance (xine_vo_driver_t *driver, xine_t *xine) ; /* * to build a dynamic video output plugin * you have to implement these functions: * * - * vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual); + * xine_vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual); * * init and set up driver so it is fully operational * @@ -410,25 +390,8 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) ; * * * - * vo_info_t *get_video_out_plugin_info (); - * - * peek at some (static) information about the plugin without initializing it - * - * parameters: none - * - * return value: vo_info_t* : some information about the plugin */ -struct vo_info_s { - - int interface_version; /* plugin interface version */ - char *id; /* id of this plugin */ - char *description; /* human-readable description of this plugin */ - int visual_type; /* visual type supported by this plugin */ - int priority; /* priority of this plugin for auto-probing */ - -}; - #ifdef __cplusplus } #endif diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index aa752ba51..11a520917 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -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: video_overlay.c,v 1.23 2002/09/01 05:52:15 jcdutton Exp $ + * $Id: video_overlay.c,v 1.24 2002/09/04 23:31:13 guenter Exp $ * */ @@ -29,7 +29,6 @@ #include #include "buffer.h" -#include "events.h" #include "xine_internal.h" #include "video_out/alphablend.h" #include "xine-engine/bswap.h" @@ -548,8 +547,8 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { /* This is called from video_out.c * must call output->overlay_blend for each active overlay. */ -static void video_overlay_multiple_overlay_blend(video_overlay_instance_t *this_gen, int64_t vpts, - vo_driver_t *output, vo_frame_t *vo_img, int enabled) { +static void video_overlay_multiple_overlay_blend (video_overlay_instance_t *this_gen, int64_t vpts, + xine_vo_driver_t *output, vo_frame_t *vo_img, int enabled) { video_overlay_t *this = (video_overlay_t *) this_gen; int i; int32_t handle; diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index 2bad85bd9..25ebd7265 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.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: vo_scale.c,v 1.4 2002/08/28 14:20:09 miguelfreitas Exp $ + * $Id: vo_scale.c,v 1.5 2002/09/04 23:31:13 guenter Exp $ * * Contains common code to calculate video scaling parameters. * In short, it will map frame dimensions to screen/window size. @@ -61,15 +61,17 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) { switch (this->user_ratio) { case ASPECT_AUTO: switch (this->delivered_ratio_code) { - case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */ - case XINE_ASPECT_RATIO_PAN_SCAN: /* we display pan&scan as widescreen */ + case XINE_VO_ASPECT_ANAMORPHIC: /* anamorphic */ + case XINE_VO_ASPECT_PAN_SCAN: /* we display pan&scan as widescreen */ desired_ratio = 16.0 /9.0; break; - case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */ +#if 0 /* FIXME */ + case XINE_VO_ASPECT_211_1: /* 2.11:1 */ desired_ratio = 2.11/1.0; break; - case XINE_ASPECT_RATIO_SQUARE: /* square pels */ - case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ +#endif + case XINE_VO_ASPECT_SQUARE: /* square pels */ + case XINE_VO_ASPECT_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ desired_ratio = image_ratio; break; case 0: /* forbidden -> 4:3 */ @@ -77,7 +79,7 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) { default: printf ("vo_scale: unknown aspect ratio (%d) in stream => using 4:3\n", this->delivered_ratio_code); - case XINE_ASPECT_RATIO_4_3: /* 4:3 */ + case XINE_VO_ASPECT_4_3: /* 4:3 */ desired_ratio = 4.0 / 3.0; break; } @@ -96,22 +98,24 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) { desired_ratio = 4.0 / 3.0; } - corr_factor = this->display_ratio * desired_ratio / image_ratio ; - - if (fabs(corr_factor - 1.0) < 0.005) { - this->ideal_width = this->delivered_width; - this->ideal_height = this->delivered_height; - - } else { - - if (corr_factor >= 1.0) { - this->ideal_width = this->delivered_width * corr_factor + 0.5; - this->ideal_height = this->delivered_height; - } else { - this->ideal_width = this->delivered_width; - this->ideal_height = this->delivered_height / corr_factor + 0.5; - } + this->video_pixel_aspect = desired_ratio / image_ratio; + + assert (this->gui_pixel_aspect != 0.0); + if (fabs (this->video_pixel_aspect / this->gui_pixel_aspect - 1.0) + < 0.005) { + this->video_pixel_aspect = this->gui_pixel_aspect; + } + +#if 0 + + /* onefield_xv divide by 2 the number of lines */ + if (this->deinterlace_enabled + && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) + && (this->cur_frame->format == XINE_IMGFMT_YV12)) { + this->displayed_height = this->displayed_height / 2; + this->displayed_yoffset = this->displayed_yoffset / 2; } +#endif } } @@ -241,13 +245,15 @@ void vo_scale_compute_output_size (vo_scale_t *this) { int vo_scale_redraw_needed (vo_scale_t *this) { int gui_x, gui_y, gui_width, gui_height, gui_win_x, gui_win_y; + double gui_aspect; int ret = 0; if( this->frame_output_cb ) { this->frame_output_cb (this->user_data, this->ideal_width, this->ideal_height, + this->video_pixel_aspect, &gui_x, &gui_y, &gui_width, &gui_height, - &gui_win_x, &gui_win_y ); + &gui_aspect, &gui_win_x, &gui_win_y ); } else { printf ("vo_scale: error! frame_output_cb must be set!\n"); } diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h index 934da69e5..cbd04c4cb 100644 --- a/src/xine-engine/vo_scale.h +++ b/src/xine-engine/vo_scale.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: vo_scale.h,v 1.1 2002/08/15 03:12:27 miguelfreitas Exp $ + * $Id: vo_scale.h,v 1.2 2002/09/04 23:31:13 guenter Exp $ * * vo_scale.h * @@ -92,6 +92,14 @@ struct vo_scale_s { int gui_width, gui_height; int gui_win_x, gui_win_y; + /* + * video + display pixel aspect + * One pixel of height 1 has this width + * This may be corrected by the driver in order to fit the video seamlessly + */ + double gui_pixel_aspect; + double video_pixel_aspect; + /* * "output" size: * @@ -113,12 +121,16 @@ struct vo_scale_s { void *user_data; void (*frame_output_cb) (void *user_data, int video_width, int video_height, + double video_pixel_aspect, int *dest_x, int *dest_y, int *dest_height, int *dest_width, + double *dest_pixel_aspect, int *win_x, int *win_y); void (*dest_size_cb) (void *user_data, int video_width, int video_height, + double video_pixel_aspect, + double *dest_pixel_aspect, int *dest_width, int *dest_height); /* borders */ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 3fb22f370..866775863 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.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: xine.c,v 1.148 2002/08/29 22:48:00 f1rmb Exp $ + * $Id: xine.c,v 1.149 2002/09/04 23:31:13 guenter Exp $ * * top-level xine functions * @@ -41,6 +41,7 @@ #endif #include "xine_internal.h" +#include "plugin_catalog.h" #include "audio_out.h" #include "video_out.h" #include "demuxers/demux.h" @@ -58,18 +59,20 @@ #define LOGO_DELAY 500000 /* usec */ -static void play_logo_internal(xine_t *this) { +static void play_logo_internal (xine_t *this) { pthread_mutex_lock (&this->logo_lock); this->playing_logo = 1; - if( !xine_play_internal(this, this->logo_mrl, 0, 0) ) + if( !xine_open_internal(this, this->logo_mrl) ) this->playing_logo = 0; - else - this->status = XINE_LOGO; + else { + xine_play_internal (this, 0, 0); + this->status = XINE_STATUS_LOGO; + } pthread_mutex_unlock (&this->logo_lock); } /* config callback for logo mrl changing */ -static void _logo_change_cb(void *data, cfg_entry_t *cfg) { +static void _logo_change_cb(void *data, xine_cfg_entry_t *cfg) { xine_t *this = (xine_t *) data; pthread_mutex_lock (&this->logo_lock); @@ -78,10 +81,10 @@ static void _logo_change_cb(void *data, cfg_entry_t *cfg) { /* * Start playback of new mrl only if - * current status is XINE_STOP or XINE_LOGO + * current status is XINE_STATUS_STOP or XINE_STATUS_LOGO */ pthread_mutex_lock (&this->xine_lock); - if((this->status == XINE_LOGO) || (this->status == XINE_STOP)) { + if((this->status == XINE_STATUS_LOGO) || (this->status == XINE_STATUS_STOP)) { xine_stop_internal(this); this->metronom->adjust_clock(this->metronom, this->metronom->get_current_time(this->metronom) + 30 * 90000 ); @@ -104,7 +107,7 @@ void * xine_notify_stream_finished_thread (void * this_gen) { xine_usec_sleep (LOGO_DELAY); pthread_mutex_lock (&this->xine_lock); - if (this->status == XINE_STOP) { + if (this->status == XINE_STATUS_STOP) { play_logo_internal(this); } pthread_mutex_unlock (&this->xine_lock); @@ -115,7 +118,7 @@ void * xine_notify_stream_finished_thread (void * this_gen) { void xine_notify_stream_finished (xine_t *this) { int err; - if (this->status == XINE_QUIT) + if (this->status == XINE_STATUS_QUIT) return; if (this->finished_thread_running) @@ -161,8 +164,9 @@ void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t } } -int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec, - void *user_data) { +int xine_register_report_codec_cb(xine_t *this, + xine_report_codec_cb_t report_codec, + void *user_data) { this->report_codec_cb = report_codec; this->report_codec_user_data = user_data; @@ -197,7 +201,7 @@ void xine_internal_osd (xine_t *this, char *str, int duration) { } } -static void update_osd_display(void *this_gen, cfg_entry_t *entry) +static void update_osd_display(void *this_gen, xine_cfg_entry_t *entry) { xine_t *this = (xine_t *) this_gen; @@ -211,14 +215,14 @@ static void xine_set_speed_internal (xine_t *this, int speed) { /* see coment on audio_out loop about audio_paused */ if( this->audio_out ) { - this->audio_out->audio_paused = (speed != SPEED_NORMAL) + - (speed == SPEED_PAUSE); + this->audio_out->audio_paused = (speed != XINE_SPEED_NORMAL) + + (speed == XINE_SPEED_PAUSE); - if (speed != SPEED_NORMAL && speed != SPEED_PAUSE) + if (speed != XINE_SPEED_NORMAL && speed != XINE_SPEED_PAUSE) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); this->audio_out->control(this->audio_out, - speed == SPEED_PAUSE ? AO_CTRL_PLAY_PAUSE : AO_CTRL_PLAY_RESUME); + speed == XINE_SPEED_PAUSE ? AO_CTRL_PLAY_PAUSE : AO_CTRL_PLAY_RESUME); } this->speed = speed; @@ -229,7 +233,7 @@ void xine_stop_internal (xine_t *this) { printf ("xine_stop\n"); - if (this->status == XINE_STOP) { + if (this->status == XINE_STATUS_STOP) { printf ("xine_stop ignored\n"); return; } @@ -237,11 +241,11 @@ void xine_stop_internal (xine_t *this) { if (this->audio_out) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); - xine_set_speed_internal(this, SPEED_NORMAL); + xine_set_speed_internal(this, XINE_SPEED_NORMAL); /* Don't change status if we're quitting */ - if(this->status != XINE_QUIT) - this->status = XINE_STOP; + if(this->status != XINE_STATUS_QUIT) + this->status = XINE_STATUS_STOP; printf ("xine_stop: stopping demuxer\n"); if(this->cur_demuxer_plugin) { @@ -271,7 +275,7 @@ void xine_stop (xine_t *this) { this->metronom->adjust_clock(this->metronom, this->metronom->get_current_time(this->metronom) + 30 * 90000 ); - if(this->status == XINE_STOP) { + if(this->status == XINE_STATUS_STOP) { play_logo_internal(this); } @@ -280,94 +284,96 @@ void xine_stop (xine_t *this) { /* - * ***** - * Demuxers probing stuff + * demuxer probing */ -static int try_demux_with_stages(xine_t *this, const char *MRL, - int stage1, int stage2) { - int s = 0, i; +static int probe_demux (xine_t *this, char *MRL, int stage1, int stage2) { + + int i; int stages[3]; stages[0] = stage1; stages[1] = stage2; stages[2] = -1; - if(stages[0] == -1) { - printf (_("%s(%d) wrong first stage = %d !!\n"), - __XINE_FUNCTION__, __LINE__, stage1); + if (stages[0] == -1) { + printf ("xine: probe_demux stage1 = %d is not allowed \n", stage1); return 0; } - while(stages[s] != -1) { - for(i = 0; i < this->num_demuxer_plugins; i++) { - /* printf ("trying demuxer %s\n", this->demuxer_plugins[i]->get_identifier()); */ - if(this->demuxer_plugins[i]->open(this->demuxer_plugins[i], - this->cur_input_plugin, - stages[s]) == DEMUX_CAN_HANDLE) { + i = 0; + while (stages[i] != -1) { + + plugin_node_t *node; + + node = xine_list_first_content (this->plugin_catalog->demux); + + while (node) { + demux_plugin_t *plugin; + + plugin = (demux_plugin_t *) node->plugin; + + if (plugin->open (plugin, + this->cur_input_plugin, + stages[i]) == DEMUX_CAN_HANDLE) { - this->cur_demuxer_plugin = this->demuxer_plugins[i]; + this->cur_demuxer_plugin = plugin; return 1; } + node = xine_list_next_content (this->plugin_catalog->demux); } - s++; + i++; } return 0; } + /* - * Try to find a demuxer which handle the MRL stream + * try to find a demuxer which handle the MRL stream */ -static int find_demuxer(xine_t *this, const char *MRL) { +static int find_demuxer(xine_t *this, char *MRL) { this->cur_demuxer_plugin = NULL; - switch(this->demux_strategy) { + switch (this->demux_strategy) { case DEMUX_DEFAULT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_CONTENT, STAGE_BY_EXTENSION)) + if (probe_demux (this, MRL, STAGE_BY_CONTENT, STAGE_BY_EXTENSION)) return 1; break; case DEMUX_REVERT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_EXTENSION, STAGE_BY_CONTENT)) + if (probe_demux (this, MRL, STAGE_BY_EXTENSION, STAGE_BY_CONTENT)) return 1; break; case DEMUX_CONTENT_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_CONTENT, -1)) + if (probe_demux (this, MRL, STAGE_BY_CONTENT, -1)) return 1; break; case DEMUX_EXTENSION_STRATEGY: - if(try_demux_with_stages(this, MRL, STAGE_BY_EXTENSION, -1)) + if (probe_demux (this, MRL, STAGE_BY_EXTENSION, -1)) return 1; break; - } return 0; } -int xine_play_internal (xine_t *this, char *mrl, - int start_pos, int start_time) { +int xine_open_internal (xine_t *this, char *mrl) { - double share ; - off_t pos, len; - int i; - int demux_status; - - printf ("xine_play: xine open %s, start pos = %d, start time = %d (sec)\n", - mrl, start_pos, start_time); + printf ("xine_open: mrl '%s'\n", mrl); - if (this->speed != SPEED_NORMAL) { - xine_set_speed_internal (this, SPEED_NORMAL); + if (this->speed != XINE_SPEED_NORMAL) { + xine_set_speed_internal (this, XINE_SPEED_NORMAL); } /* * stop engine only for different mrl */ - if ((this->status == XINE_PLAY && strcmp (mrl, this->cur_mrl)) || (this->status == XINE_LOGO)) { + if ((this->status == XINE_STATUS_PLAY && strcmp (mrl, this->cur_mrl)) + || (this->status == XINE_STATUS_LOGO)) { if(this->cur_demuxer_plugin) { this->playing_logo = 0; @@ -385,16 +391,16 @@ int xine_play_internal (xine_t *this, char *mrl, if (this->audio_out) this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS); - this->status = XINE_STOP; + this->status = XINE_STATUS_STOP; } else { } if (strcmp (mrl, this->cur_mrl)) { /* Is it an 'opt:' mrlstyle ? */ - if(config_file_change_opt(this->config, mrl)) { + if (xine_config_change_opt(this->config, mrl)) { xine_event_t event; - this->status = XINE_STOP; + this->status = XINE_STATUS_STOP; event.type = XINE_EVENT_PLAYBACK_FINISHED; pthread_mutex_unlock (&this->xine_lock); @@ -404,21 +410,29 @@ int xine_play_internal (xine_t *this, char *mrl, } } - if (this->status == XINE_STOP ) { + if (this->status == XINE_STATUS_STOP ) { + + plugin_node_t *node; + /* * find input plugin */ this->cur_input_plugin = NULL; - - for (i = 0; i < this->num_input_plugins; i++) { - if (this->input_plugins[i]->open(this->input_plugins[i], mrl)) { - this->cur_input_plugin = this->input_plugins[i]; + node = xine_list_first_content (this->plugin_catalog->input); + while (node) { + input_plugin_t *plugin; + + plugin = (input_plugin_t *) node->plugin; + + if (plugin->open (plugin, mrl)) { + this->cur_input_plugin = plugin; break; } + node = xine_list_next_content (this->plugin_catalog->input); } if (!this->cur_input_plugin) { - xine_log (this, XINE_LOG_FORMAT, + xine_log (this, XINE_LOG_FORMAT, _("xine: cannot find input plugin for this MRL\n")); this->cur_demuxer_plugin = NULL; this->err = XINE_ERROR_NO_INPUT_PLUGIN; @@ -429,7 +443,7 @@ int xine_play_internal (xine_t *this, char *mrl, printf ("xine: using input plugin >%s< for this MRL (%s).\n", this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl); - xine_log (this, XINE_LOG_FORMAT, + xine_log (this, XINE_LOG_FORMAT, _("using input plugin '%s' for MRL '%s'\n"), this->cur_input_plugin->get_identifier(this->cur_input_plugin), mrl); @@ -439,7 +453,7 @@ int xine_play_internal (xine_t *this, char *mrl, */ if (!find_demuxer(this, mrl)) { - xine_log (this, XINE_LOG_FORMAT, + xine_log (this, XINE_LOG_FORMAT, _("xine: couldn't find demuxer for >%s<\n"), mrl); this->cur_input_plugin->close(this->cur_input_plugin); this->err = XINE_ERROR_NO_DEMUXER_PLUGIN; @@ -450,7 +464,22 @@ int xine_play_internal (xine_t *this, char *mrl, _("system layer format '%s' detected.\n"), this->cur_demuxer_plugin->get_identifier()); } - + + strncpy (this->cur_mrl, mrl, 1024); + + printf ("xine: xine_open done.\n"); + + return 1; +} + +int xine_play_internal (xine_t *this, int start_pos, int start_time) { + + double share ; + off_t pos, len; + int demux_status; + + printf ("xine: xine_play_internal\n"); + /* * start demuxer */ @@ -462,31 +491,31 @@ int xine_play_internal (xine_t *this, char *mrl, } else pos = 0; - if( this->status == XINE_STOP ) { + if (this->status == XINE_STATUS_STOP) { + demux_status = this->cur_demuxer_plugin->start (this->cur_demuxer_plugin, this->video_fifo, this->audio_fifo, pos, start_time); - } - else { + } else { demux_status = this->cur_demuxer_plugin->seek (this->cur_demuxer_plugin, pos, start_time); } + if (demux_status != DEMUX_OK) { xine_log (this, XINE_LOG_MSG, _("xine_play: demuxer failed to start\n")); this->err = XINE_ERROR_DEMUXER_FAILED; - if( this->status == XINE_STOP ) + if( this->status == XINE_STATUS_STOP ) this->cur_input_plugin->close(this->cur_input_plugin); return 0; } else { - this->status = XINE_PLAY; - strncpy (this->cur_mrl, mrl, 1024); + this->status = XINE_STATUS_PLAY; /* osd will be updated as soon as we know cur_input_time */ if( !this->playing_logo ) @@ -496,17 +525,27 @@ int xine_play_internal (xine_t *this, char *mrl, return 1; } -int xine_play (xine_t *this, char *mrl, - int start_pos, int start_time) { -int ret; +int xine_open (xine_t *this, char *mrl) { + int ret; + + pthread_mutex_lock (&this->xine_lock); + ret = xine_open_internal (this, mrl); + pthread_mutex_unlock (&this->xine_lock); + + return ret; +} + +int xine_play (xine_t *this, int start_pos, int start_time) { + int ret; pthread_mutex_lock (&this->xine_lock); - ret = xine_play_internal (this, mrl, start_pos, start_time); + ret = xine_play_internal (this, start_pos, start_time); pthread_mutex_unlock (&this->xine_lock); return ret; } + int xine_eject (xine_t *this) { int status; @@ -517,7 +556,7 @@ int xine_eject (xine_t *this) { pthread_mutex_lock (&this->xine_lock); status = 0; - if (((this->status == XINE_STOP) || (this->status == XINE_LOGO)) + if (((this->status == XINE_STATUS_STOP) || (this->status == XINE_STATUS_LOGO)) && this->last_input_plugin && this->last_input_plugin->eject_media) { status = this->last_input_plugin->eject_media (this->last_input_plugin); @@ -531,7 +570,7 @@ void xine_exit (xine_t *this) { int i; - this->status = XINE_QUIT; + this->status = XINE_STATUS_QUIT; xine_stop(this); @@ -554,7 +593,7 @@ void xine_exit (xine_t *this) { this->video_out->exit (this->video_out); this->video_fifo->dispose (this->video_fifo); - this->status = XINE_QUIT; + this->status = XINE_STATUS_QUIT; printf ("xine_exit: bye!\n"); @@ -563,20 +602,7 @@ void xine_exit (xine_t *this) { this->metronom->exit (this->metronom); - for (i = 0; i < this->num_demuxer_plugins; i++) - this->demuxer_plugins[i]->close (this->demuxer_plugins[i]); - - for (i = 0; i < this->num_input_plugins; i++) - this->input_plugins[i]->dispose (this->input_plugins[i]); - - for (i = 0; i < this->num_audio_decoders_loaded; i++) - this->audio_decoders_loaded[i]->dispose (this->audio_decoders_loaded[i]); - - for (i = 0; i < this->num_video_decoders_loaded; i++) - this->video_decoders_loaded[i]->dispose (this->video_decoders_loaded[i]); - - for (i = 0; i < this->num_spu_decoders_loaded; i++) - this->spu_decoders_loaded[i]->dispose (this->spu_decoders_loaded[i]); + dispose_plugins (this); xine_profiler_print_results (); @@ -589,45 +615,26 @@ void xine_exit (xine_t *this) { } -xine_t *xine_init (vo_driver_t *vo, - ao_driver_t *ao, - config_values_t *config) { +xine_t *xine_new (void) { - xine_t *this = xine_xmalloc (sizeof (xine_t)); - static char *demux_strategies[] = {"default", "reverse", "content", - "extension", NULL}; + xine_t *this; int i; - /* setting default logo mrl */ - pthread_mutex_init (&this->logo_lock, NULL); - - pthread_mutex_lock (&this->logo_lock); - this->logo_mrl = config->register_string(config, "misc.logo_mrl", XINE_LOGO_FILE, - _("logo mrl, displayed in video output window"), - NULL, _logo_change_cb, (void *) this); - pthread_mutex_unlock (&this->logo_lock); - - this->video_driver = vo; - - /* initialize color conversion tables and functions */ - init_yuv_conversion(); - - /* init log buffers */ - for (i = 0; i < XINE_LOG_NUM; i++) - this->log_buffers[i] = new_scratch_buffer (25); + this = xine_xmalloc (sizeof (xine_t)); + if (!this) { + printf ("xine: failed to malloc xine_t\n"); + abort(); + } + #ifdef ENABLE_NLS + /* + * i18n + */ + bindtextdomain("xine-lib", XINE_LOCALEDIR); #endif - - printf ("xine: xine_init entered\n"); - - this->err = XINE_ERROR_NONE; - this->config = config; - /* probe for optimized memcpy or config setting */ - xine_probe_fast_memcpy(config); - /* * init locks */ @@ -641,61 +648,115 @@ xine_t *xine_init (vo_driver_t *vo, this->finished_thread_running = 0; /* - * init event listeners + * config + */ + + this->config = xine_config_init (); + + /* + * log buffers + */ + + for (i = 0; i < XINE_LOG_NUM; i++) + this->log_buffers[i] = new_scratch_buffer (25); + + /* + * defaults */ - this->num_event_listeners = 0; /* Initially there are none */ - this->cur_input_plugin = NULL; /* In case the input plugin event handlers - * are called too early. */ + + this->err = XINE_ERROR_NONE; + this->spu_channel_auto = -1; + this->spu_channel_letterbox = -1; + this->spu_channel_pan_scan = -1; + this->spu_channel_user = -1; + this->cur_input_pos = 0; + this->cur_input_length = 0; + this->last_input_plugin = NULL; + this->num_event_listeners = 0; /* initially there are none */ + this->cur_input_plugin = NULL; this->cur_spu_decoder_plugin = NULL; - this->report_codec_cb = NULL; + this->report_codec_cb = NULL; + + /* + * plugins + */ + scan_plugins(this); + /* - * create a metronom + * logo */ - this->metronom = metronom_init (ao != NULL, (void *)this); + pthread_mutex_init (&this->logo_lock, NULL); + + pthread_mutex_lock (&this->logo_lock); + this->logo_mrl = this->config->register_string(this->config, + "misc.logo_mrl", + XINE_LOGO_FILE, + _("logo mrl, displayed in video output window"), + NULL, 0, _logo_change_cb, + (void *) this); + pthread_mutex_unlock (&this->logo_lock); + + return this; + +} + +void xine_init (xine_t *this, + xine_ao_driver_t *ao, + xine_vo_driver_t *vo) { + + static char *demux_strategies[] = {"default", "reverse", "content", + "extension", NULL}; + + this->video_driver = vo; + + /* initialize color conversion tables and functions */ + init_yuv_conversion(); + + /* - * load input and demuxer plugins + * create a metronom */ - load_input_plugins (this, config); - - this->demux_strategy = config->register_enum (config, "misc.demux_strategy", 0, - demux_strategies, "demuxer selection strategy", - NULL, NULL, NULL); + this->metronom = metronom_init ( (ao != NULL), this); + + /* probe for optimized memcpy or config setting */ + xine_probe_fast_memcpy (this->config); - load_demux_plugins(this, config); + /* + * content detection strategy + */ - this->spu_channel_auto = -1; - this->spu_channel_letterbox = -1; - this->spu_channel_pan_scan = -1; - this->spu_channel_user = -1; - this->cur_input_pos = 0; - this->cur_input_length = 0; - this->last_input_plugin = NULL; + this->demux_strategy = this->config->register_enum (this->config, + "misc.demux_strategy", + 0, + demux_strategies, + "media format detection strategy", + NULL, 10, NULL, NULL); /* * init and start decoder threads */ - load_decoder_plugins (this, config); - this->video_out = vo_new_instance (vo, this); video_decoder_init (this); - this->osd_renderer = osd_renderer_init (this->video_out->get_overlay_instance (this->video_out), config ); + this->osd_renderer = osd_renderer_init (this->video_out->get_overlay_instance (this->video_out), this->config ); this->osd = this->osd_renderer->new_object (this->osd_renderer, 300, 100); this->osd_renderer->set_font (this->osd, "cetus", 24); this->osd_renderer->set_text_palette (this->osd, TEXTPALETTE_WHITE_BLACK_TRANSPARENT, OSD_TEXT1 ); this->osd_renderer->set_position (this->osd, 10,10); - this->osd_display = config->register_bool(config, "misc.osd_display", 1, - "Show status on play, pause, ff, ...", NULL, - update_osd_display, this ); + this->osd_display = this->config->register_bool (this->config, + "misc.osd_display", 1, + "Show status on play, pause, ff, ...", + NULL, 0, + update_osd_display, this ); - if(ao) + if (ao) this->audio_out = ao_new_instance (ao, this); audio_decoder_init (this); @@ -719,14 +780,9 @@ xine_t *xine_init (vo_driver_t *vo, this->osd_renderer->hide (this->osd, 300000); } - play_logo_internal(this); + this->status = XINE_STATUS_STOP; - return this; -} - -int xine_get_spu_channel (xine_t *this) { - - return this->spu_channel_user; + play_logo_internal(this); } void xine_select_spu_channel (xine_t *this, int channel) { @@ -752,7 +808,7 @@ void xine_select_spu_channel (xine_t *this, int channel) { pthread_mutex_unlock (&this->xine_lock); } -int xine_get_current_position (xine_t *this) { +static int xine_get_current_position (xine_t *this) { off_t len; double share; @@ -779,68 +835,11 @@ int xine_get_status(xine_t *this) { int status; status = this->status; - if( status == XINE_LOGO ) - status = XINE_STOP; + if( status == XINE_STATUS_LOGO ) + status = XINE_STATUS_STOP; return status; } -/* *** - * Version information/check - */ - -/* - * Return version in string, like "0.5.0" - */ -char *xine_get_str_version(void) { - return VERSION; -} - -/* - * Return major version - */ -int xine_get_major_version(void) { - return XINE_MAJOR; -} - -/* - * Return minor version - */ -int xine_get_minor_version(void) { - return XINE_MINOR; -} - -/* - * Return sub version - */ -int xine_get_sub_version(void) { - return XINE_SUB; -} - -/* - * Check if xine version is <= to specifier version. - */ -int xine_check_version(int major, int minor, int sub) { - - if((XINE_MAJOR > major) || - ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || - ((XINE_MAJOR == major) && (XINE_MINOR == minor) && (XINE_SUB >= sub))) - return 1; - - return 0; -} - -/* - * manually adjust a/v sync - */ - -void xine_set_av_offset (xine_t *this, int offset_pts) { - this->metronom->set_option (this->metronom, METRONOM_AV_OFFSET, offset_pts); -} - -int xine_get_av_offset (xine_t *this) { - return this->metronom->get_option (this->metronom, METRONOM_AV_OFFSET); -} - /* * trick play */ @@ -849,31 +848,31 @@ void xine_set_speed (xine_t *this, int speed) { pthread_mutex_lock (&this->xine_lock); - if (speed <= SPEED_PAUSE) - speed = SPEED_PAUSE; - else if (speed > SPEED_FAST_4) - speed = SPEED_FAST_4; + if (speed <= XINE_SPEED_PAUSE) + speed = XINE_SPEED_PAUSE; + else if (speed > XINE_SPEED_FAST_4) + speed = XINE_SPEED_FAST_4; /* osd */ pthread_mutex_lock (&this->osd_lock); switch (speed) { - case SPEED_PAUSE: + case XINE_SPEED_PAUSE: xine_internal_osd (this, "<", 90000); break; - case SPEED_SLOW_4: + case XINE_SPEED_SLOW_4: xine_internal_osd (this, "<>", 20000 * speed); break; - case SPEED_SLOW_2: + case XINE_SPEED_SLOW_2: xine_internal_osd (this, "@>", 20000 * speed); break; - case SPEED_NORMAL: + case XINE_SPEED_NORMAL: xine_internal_osd (this, ">", 20000 * speed); break; - case SPEED_FAST_2: + case XINE_SPEED_FAST_2: xine_internal_osd (this, "$$", 20000 * speed); break; - case SPEED_FAST_4: + case XINE_SPEED_FAST_4: xine_internal_osd (this, "$$$", 20000 * speed); break; } @@ -894,11 +893,7 @@ int xine_get_speed (xine_t *this) { * time measurement / seek */ -int xine_get_current_time (xine_t *this) { - return this->cur_input_time; -} - -int xine_get_stream_length (xine_t *this) { +static int xine_get_stream_length (xine_t *this) { if(this->cur_demuxer_plugin) return this->cur_demuxer_plugin->get_stream_length (this->cur_demuxer_plugin); @@ -906,7 +901,17 @@ int xine_get_stream_length (xine_t *this) { return 0; } -int xine_get_audio_capabilities(xine_t *this) { +int xine_get_pos_length (xine_t *this, int *pos_stream, + int *pos_time, int *length_time) { + + *pos_stream = xine_get_current_position (this); + *pos_time = this->cur_input_time * 1000; + *length_time = xine_get_stream_length (this) * 1000; + + return 1; +} + +static int xine_get_audio_capabilities(xine_t *this) { if(this->audio_out) return (this->audio_out->get_capabilities(this->audio_out)); @@ -914,7 +919,7 @@ int xine_get_audio_capabilities(xine_t *this) { return AO_CAP_NOCAP; } -int xine_get_audio_property(xine_t *this, int property) { +static int xine_get_audio_property(xine_t *this, int property) { if(this->audio_out) return(this->audio_out->get_property(this->audio_out, property)); @@ -922,7 +927,7 @@ int xine_get_audio_property(xine_t *this, int property) { return 0; } -int xine_set_audio_property(xine_t *this, int property, int value) { +static int xine_set_audio_property(xine_t *this, int property, int value) { if(this->audio_out) return(this->audio_out->set_property(this->audio_out, property, value)); @@ -932,7 +937,7 @@ int xine_set_audio_property(xine_t *this, int property, int value) { int xine_get_current_frame (xine_t *this, int *width, int *height, int *ratio_code, int *format, - uint8_t **y, uint8_t **u, uint8_t **v) { + uint8_t *img) { vo_frame_t *frame; @@ -947,14 +952,31 @@ int xine_get_current_frame (xine_t *this, int *width, int *height, *ratio_code = frame->ratio; *format = frame->format; - *y = frame->base[0]; - *u = frame->base[1]; - *v = frame->base[2]; + switch (frame->format) { + + case XINE_IMGFMT_YV12: + memcpy (img, frame->base[0], frame->width*frame->height); + memcpy (img+frame->width*frame->height, frame->base[1], + frame->width*frame->height/4); + memcpy (img+frame->width*frame->height+frame->width*frame->height/4, + frame->base[1], + frame->width*frame->height/4); + break; + + case XINE_IMGFMT_YUY2: + memcpy (img, frame->base[0], frame->width * frame->height * 2); + break; + + default: + printf ("xine: error, snapshot function not implemented for format 0x%x\n", + frame->format); + abort (); + } return 1; } -void xine_get_spu_lang (xine_t *this, char *str) { +int xine_get_spu_lang (xine_t *this, int channel, char *str) { switch (this->spu_channel_user) { case -2: @@ -966,7 +988,7 @@ void xine_get_spu_lang (xine_t *this, char *str) { this->cur_input_plugin->get_optional_data (this->cur_input_plugin, this->str, INPUT_OPTIONAL_DATA_SPULANG); sprintf (str, "*(%s)", this->str); - return; + return 1; } } if (this->spu_channel_auto == -1) @@ -977,10 +999,10 @@ void xine_get_spu_lang (xine_t *this, char *str) { default: sprintf (str, "%3d", this->spu_channel_user); } - + return 0; } -void xine_get_audio_lang (xine_t *this, char *str) { +int xine_get_audio_lang (xine_t *this, int channel, char *str) { switch (this->audio_channel_user) { case -2: @@ -994,7 +1016,7 @@ void xine_get_audio_lang (xine_t *this, char *str) { sprintf (str, "*(%s)", this->str); - return; + return 1; } } if (this->audio_channel_auto == -1) @@ -1005,6 +1027,7 @@ void xine_get_audio_lang (xine_t *this, char *str) { default: sprintf (str, "%3d", this->audio_channel_user); } + return 0; } int xine_is_stream_seekable (xine_t *this) { @@ -1062,6 +1085,19 @@ char **xine_get_log (xine_t *this, int buf) { return this->log_buffers[buf]->get_content (this->log_buffers[buf]); } +void xine_register_log_cb (xine_t *self, xine_log_cb_t *cb, void *user_data) { + + printf ("xine: xine_register_log_cb: not implemented yet.\n"); + abort(); +} + + int xine_get_error (xine_t *this) { return this->err; } + +int xine_trick_mode (xine_t *this, int mode, int value) { + printf ("xine: xine_trick_mode not implemented yet.\n"); + abort (); +} + diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c new file mode 100644 index 000000000..fe8e822e3 --- /dev/null +++ b/src/xine-engine/xine_interface.c @@ -0,0 +1,318 @@ +/* + * 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: xine_interface.c,v 1.2 2002/09/04 23:31:13 guenter Exp $ + * + * convenience/abstraction layer, functions to implement + * libxine's public interface + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined (__linux__) +#include +#elif defined (__FreeBSD__) +#include +#endif + +#include "xine_internal.h" +#include "audio_out.h" +#include "video_out.h" +#include "demuxers/demux.h" + +/* + * version information / checking + */ + +char *xine_get_version_string(void) { + return VERSION; +} + +void xine_get_version (int *major, int *minor, int *sub) { + *major = XINE_MAJOR; + *minor = XINE_MINOR; + *sub = XINE_SUB; +} + +int xine_check_version(int major, int minor, int sub) { + + if((XINE_MAJOR > major) || + ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || + ((XINE_MAJOR == major) && (XINE_MINOR == minor) && (XINE_SUB >= sub))) + return 1; + + return 0; +} + +/* + * public config object access functions + */ + +char* xine_config_register_string (xine_t *self, + char *key, + char *def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + + return self->config->register_string (self->config, + key, + def_value, + description, + help, + exp_level, + changed_cb, + cb_data); + +} + +int xine_config_register_range (xine_t *self, + char *key, + int def_value, + int min, int max, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return self->config->register_range (self->config, + key, def_value, min, max, + description, help, exp_level, + changed_cb, cb_data); +} + + +int xine_config_register_enum (xine_t *self, + char *key, + int def_value, + char **values, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return self->config->register_enum (self->config, + key, def_value, values, + description, help, exp_level, + changed_cb, cb_data); +} + + +int xine_config_register_num (xine_t *self, + char *key, + int def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return self->config->register_num (self->config, + key, def_value, + description, help, exp_level, + changed_cb, cb_data); +} + + +int xine_config_register_bool (xine_t *self, + char *key, + int def_value, + char *description, + char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return self->config->register_bool (self->config, + key, def_value, + description, help, exp_level, + changed_cb, cb_data); +} + + +/* + * helper function: + * + * copy current config entry data to public struct + * and return it + */ + +xine_cfg_entry_t *xine_config_get_current_entry (xine_t *this) { + + config_values_t *config = this->config; + + if (!config->cur) + return NULL; + + config->public_entry.key = config->cur->key; + config->public_entry.type = config->cur->type; + + config->public_entry.unknown_value = config->cur->unknown_value; + config->public_entry.str_value = config->cur->str_value; + config->public_entry.str_default = config->cur->str_default; + config->public_entry.str_sticky = config->cur->str_sticky; + config->public_entry.num_value = config->cur->num_value; + config->public_entry.num_default = config->cur->num_default; + config->public_entry.range_min = config->cur->range_min; + config->public_entry.range_max = config->cur->range_max; + config->public_entry.enum_values = config->cur->enum_values; + + config->public_entry.description = config->cur->description; + config->public_entry.help = config->cur->help; + config->public_entry.callback = config->cur->callback; + config->public_entry.callback_data = config->cur->callback_data; + config->public_entry.exp_level = config->cur->exp_level; + + return &config->public_entry; +} + +/* + * get first config item + */ +xine_cfg_entry_t *xine_config_get_first_entry (xine_t *this) { + + config_values_t *config = this->config; + + config->cur = config->first; + + return xine_config_get_current_entry (this); +} + + +/* + * get next config item (iterate through the items) + * this will return NULL when called after returning the last item + */ +xine_cfg_entry_t *xine_config_get_next_entry (xine_t *this) { + + config_values_t *config = this->config; + + config->cur = config->cur->next; + + return xine_config_get_current_entry (this); +} + + +/* + * search for a config entry by key + */ + +xine_cfg_entry_t *xine_config_lookup_entry (xine_t *this, char *key) { + + config_values_t *config = this->config; + + config->cur = config->lookup_entry (config, key); + + return xine_config_get_current_entry (this); +} + + +/* + * update a config entry (which was returned from lookup_entry() ) + */ +void xine_config_update_entry (xine_t *this, xine_cfg_entry_t *entry){ + printf ("xine_interface: xine_config_update_entry: not implemented\n"); + abort(); +} + + +void xine_reset_config (xine_t *this){ + printf ("xine_interface: xine_reset_config: not implemented\n"); + abort(); +} + +int xine_gui_send_vo_data (xine_t *this, + int type, void *data) { + + return this->video_driver->gui_data_exchange (this->video_driver, type, data); +} + +void xine_set_param (xine_t *this, int param, int value) { + + switch (param) { + case XINE_PARAM_SPEED: + xine_set_speed (this, value); + break; + + case XINE_PARAM_AV_OFFSET: + this->metronom->set_option (this->metronom, METRONOM_AV_OFFSET, value); + break; + + case XINE_PARAM_AUDIO_CHANNEL_LOGICAL: + pthread_mutex_lock (&this->xine_lock); + if (value < -2) + value = -2; + this->audio_channel_user = value; + pthread_mutex_unlock (&this->xine_lock); + break; + + case XINE_PARAM_SPU_CHANNEL: + xine_select_spu_channel (this, value); + break; + + case XINE_PARAM_VIDEO_CHANNEL: + pthread_mutex_lock (&this->xine_lock); + if (value<0) + value = 0; + this->video_channel = value; + pthread_mutex_unlock (&this->xine_lock); + break; + } +} + +int xine_get_param (xine_t *this, int param) { + + switch (param) { + case XINE_PARAM_SPEED: + return this->speed; + + case XINE_PARAM_AV_OFFSET: + return this->metronom->get_option (this->metronom, METRONOM_AV_OFFSET); + + case XINE_PARAM_AUDIO_CHANNEL_LOGICAL: + return this->audio_channel_user; + + case XINE_PARAM_SPU_CHANNEL: + return this->spu_channel_user; + + case XINE_PARAM_VIDEO_CHANNEL: + return this->video_channel; + + default: + printf ("xine_interface: unknown param %d\n", param); + abort (); + } + + return 0; +} + +uint32_t xine_get_stream_info (xine_t *self, int info) { + printf ("xine_interface: xine_get_stream_info: not implemented\n"); + abort(); +} diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index efe20c3e9..7c38ee929 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.92 2002/07/14 20:55:17 miguelfreitas Exp $ + * $Id: xine_internal.h,v 1.93 2002/09/04 23:31:13 guenter Exp $ * */ @@ -30,6 +30,16 @@ extern "C" { #include +/* + * include public part of xine header + */ + +#ifdef XINE_COMPILE +#include "include/xine.h" +#else +#include "xine.h" +#endif + #ifdef XINE_COMPILE #include "input/input_plugin.h" #include "demuxers/demux.h" @@ -37,29 +47,31 @@ extern "C" { #include "input_plugin.h" #include "demux.h" #endif + #include "video_out.h" #include "audio_out.h" #include "metronom.h" #include "spu_decoder.h" -#include "events.h" #include "lrb.h" + #ifdef XINE_COMPILE #include "libspudec/spu_decoder_api.h" #else #include "spu_decoder_api.h" #endif + #include "osd.h" #include "scratch.h" #include "xineintl.h" +#include "plugin_catalog.h" -#define INPUT_PLUGIN_MAX 50 -#define DEMUXER_PLUGIN_MAX 50 -#define DECODER_PLUGIN_MAX 256 #define VIDEO_DECODER_IFACE_VERSION 10 #define AUDIO_DECODER_IFACE_VERSION 9 -#define AUDIO_OUT_PLUGIN_MAX 50 -#define VIDEO_OUT_PLUGIN_MAX 50 -#define XINE_MAX_EVENT_LISTENERS 50 +#define XINE_MAX_EVENT_LISTENERS 50 + +/* used by plugin loader */ +#define XINE_VERSION_CODE XINE_MAJOR_VERSION*10000+XINE_MINOR_VERSION*100+XINE_SUB_VERSION + /* * generic xine video decoder plugin interface @@ -73,10 +85,6 @@ typedef struct video_decoder_s video_decoder_t; struct video_decoder_s { - int interface_version; - - int (*can_handle) (video_decoder_t *this, int buf_type); - void (*init) (video_decoder_t *this, vo_instance_t *video_out); void (*decode_data) (video_decoder_t *this, buf_element_t *buf); @@ -107,10 +115,6 @@ typedef struct audio_decoder_s audio_decoder_t; struct audio_decoder_s { - int interface_version; - - int (*can_handle) (audio_decoder_t *this, int buf_type); - void (*init) (audio_decoder_t *this, ao_instance_t *audio_out); void (*decode_data) (audio_decoder_t *this, buf_element_t *buf); @@ -128,34 +132,17 @@ struct audio_decoder_s { }; /* - * gui callback functions - * - */ - -/* - * player status constants: + * log constants */ -#define XINE_STOP 0 -#define XINE_PLAY 1 -#define XINE_QUIT 2 -#define XINE_LOGO 3 - -/* - * log output - */ #define XINE_LOG_FORMAT 0 /* stream format, decoders, video size... */ #define XINE_LOG_MSG 1 /* warnings, errors, ... */ #define XINE_LOG_PLUGIN 2 #define XINE_LOG_NUM 3 /* # of log buffers defined */ -typedef void (*xine_event_listener_t) (void *user_data, xine_event_t *); - -#define XINE_CODEC_AUDIO 0 -#define XINE_CODEC_VIDEO 1 - -typedef void (*xine_report_codec_t) (void *user_data, int codec_type, - uint32_t fourcc, char *description, int handled); +/* + * the big xine struct, holding everything together + */ struct xine_s { @@ -170,14 +157,12 @@ struct xine_s { /* Logo manipulation mutex */ pthread_mutex_t logo_lock; - input_plugin_t *input_plugins[INPUT_PLUGIN_MAX]; - int num_input_plugins; + plugin_catalog_t *plugin_catalog; + input_plugin_t *cur_input_plugin; /* kept to do proper ejecting (otherwise we eject the logo) */ input_plugin_t *last_input_plugin; - demux_plugin_t *demuxer_plugins[DEMUXER_PLUGIN_MAX]; - int num_demuxer_plugins; demux_plugin_t *cur_demuxer_plugin; int demux_strategy; @@ -190,11 +175,8 @@ struct xine_s { spu_functions_t *spu_out; pthread_t spu_thread; - spu_decoder_t *spu_decoder_plugins[DECODER_PLUGIN_MAX]; spu_decoder_t *cur_spu_decoder_plugin; int spu_finished; - spu_decoder_t *spu_decoders_loaded[DECODER_PLUGIN_MAX]; - int num_spu_decoders_loaded; /* *_user: -2 => off -1 => auto (use *_auto value) @@ -209,16 +191,14 @@ struct xine_s { int spu_channel_pan_scan; int spu_channel; - vo_driver_t *video_driver; + xine_vo_driver_t *video_driver; vo_instance_t *video_out; fifo_buffer_t *video_fifo; pthread_t video_thread; - video_decoder_t *video_decoder_plugins[DECODER_PLUGIN_MAX]; video_decoder_t *cur_video_decoder_plugin; - video_decoder_t *video_decoders_loaded[DECODER_PLUGIN_MAX]; - int num_video_decoders_loaded; int video_finished; int video_in_discontinuity; + int video_channel; osd_renderer_t *osd_renderer; osd_object_t *osd; @@ -228,10 +208,7 @@ struct xine_s { fifo_buffer_t *audio_fifo; lrb_t *audio_temp; pthread_t audio_thread; - audio_decoder_t *audio_decoder_plugins[DECODER_PLUGIN_MAX]; audio_decoder_t *cur_audio_decoder_plugin; - audio_decoder_t *audio_decoders_loaded[DECODER_PLUGIN_MAX]; - int num_audio_decoders_loaded; uint32_t audio_track_map[50]; int audio_track_map_entries; int audio_finished; @@ -244,7 +221,7 @@ struct xine_s { pthread_mutex_t finished_lock; /* Array of event handlers. */ - xine_event_listener_t event_listeners[XINE_MAX_EVENT_LISTENERS]; + xine_event_listener_cb_t event_listeners[XINE_MAX_EVENT_LISTENERS]; void *event_listener_user_data[XINE_MAX_EVENT_LISTENERS]; uint16_t num_event_listeners; @@ -259,7 +236,7 @@ struct xine_s { pthread_t finished_thread; int finished_thread_running; - xine_report_codec_t report_codec_cb; + xine_report_codec_cb_t report_codec_cb; void *report_codec_user_data; int playing_logo; @@ -268,282 +245,51 @@ struct xine_s { }; /* - * read config file and init a config object - * (if it exists) - */ -config_values_t *xine_config_file_init (char *filename); - -/* - * init xine - call once at startup - */ - -xine_t *xine_init (vo_driver_t *vo, - ao_driver_t *ao, - config_values_t *config); - -/* - * open a stream sekk to a given position and play it - * - * name : mrl to open - * start_pos : position in input source (0..65535) - * start_time : position measured in seconds from stream start - * - * if both parameters are !=0 start_pos will be used - * for non-seekable streams both values will be ignored - * - * returns 1 on succ, 0 on failure - */ -int xine_play (xine_t *this, char *MRL, int start_pos, int start_time); -int xine_play_internal (xine_t *this, char *MRL, int start_pos, int start_time); - - -/* - * set/get playback speed - * - * constants see below - */ - -void xine_set_speed (xine_t *this, int speed); -int xine_get_speed (xine_t *this); - -#define SPEED_PAUSE 0 -#define SPEED_SLOW_4 1 -#define SPEED_SLOW_2 2 -#define SPEED_NORMAL 4 -#define SPEED_FAST_2 8 -#define SPEED_FAST_4 16 - -/* - * manually adjust a/v sync - */ - -void xine_set_av_offset (xine_t *this, int offset_pts); -int xine_get_av_offset (xine_t *this); - -/* - * stop playing - */ -void xine_stop_internal (xine_t *this); -void xine_stop (xine_t *this); - -/* - * tell current input plugin to eject media. - */ -int xine_eject(xine_t *this); - -/* - * return current status (XINE_PLAY/XINE_STOP...) - */ -int xine_get_status (xine_t *this); - -/* - * get current position in stream - * returns position (range : 0 - 65535) - */ -int xine_get_current_position (xine_t *this); - -/* - * get current position measured in seconds from - * the beginning of the stream - */ -int xine_get_current_time (xine_t *this); - -/* - * estimate length of input stream in seconds - * may return 0 if stream is not seekable - */ -int xine_get_stream_length (xine_t *this); - -/* - * return the current physical audio channel - */ -int xine_get_audio_channel (xine_t *this); - -/* - * return the current logical audio channel - */ -int xine_get_audio_selection (xine_t *this); - -/* - * try to find out current audio language - */ -void xine_get_audio_lang (xine_t *this, char *str); - -/* - * set desired logical audio channel (-1 => auto) - */ -void xine_select_audio_channel (xine_t *this, int channel); - -/* - * return the current SPU channel - */ -int xine_get_spu_channel (xine_t *this); - -/* - * set desired SPU channel - */ -void xine_select_spu_channel (xine_t *this, int channel); - -/* - * try to find out current spu language - */ -void xine_get_spu_lang (xine_t *this, char *str); - -/* - * check if the stream is seekable (at the moment) - */ - -int xine_is_stream_seekable (xine_t *this); - -/* - * exit xine - */ -void xine_exit (xine_t *this); - -/* - * browsing support - */ - -/* - * some input plugins are browseable - * returns a list of ids of these plugins - */ -char **xine_get_browsable_input_plugin_ids (xine_t *this) ; - -/* - * browse function - * asks input plugin named to return - * a list of available MRLs in domain/directory - * - * start_mrl may be NULL indicating the toplevel domain/dir - * returns start_mrl if start_mrl is a valid MRL, not a directory - * returns NULL if start_mrl is an invalid MRL, not even a directory - */ - -mrl_t **xine_get_browse_mrls (xine_t *this, char *plugin_id, - char *start_mrl, int *num_mrls); - -/* - * autoplay support - */ - -/* - * some input plugins can generate autoplay lists - * returns a list of ids of these plugins - */ -char **xine_get_autoplay_input_plugin_ids (xine_t *this) ; - -/* - * get autoplay MRL list for input plugin named - */ -char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls); - -/* - * internal use only + * private function prototypes: */ +int xine_open_internal (xine_t *this, char *MRL); +int xine_play_internal (xine_t *this, + int start_pos, int start_time); +void xine_stop_internal (xine_t *this); void xine_notify_stream_finished (xine_t *this); -void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t buf_type, int handled ); -void xine_internal_osd (xine_t *this, char *str, int duration); +void xine_report_codec (xine_t *this, int codec_type, + uint32_t fourcc, uint32_t buf_type, int handled ); +void xine_internal_osd (xine_t *this, char *str, int duration); -/* - * video decoder stuff - */ - -/* - * init video decoders, allocate video fifo, - * start video decoder thread - */ - -void video_decoder_init (xine_t *this); - -/* - * quit video thread - */ - -void video_decoder_shutdown (xine_t *this); - -/* - * spu decoder stuff - */ - -/* - * init audio decoders, allocate audio fifo, - * start audio decoder thread - */ - -void audio_decoder_init (xine_t *this); - -/* - * quit audio thread - */ - -void audio_decoder_shutdown (xine_t *this); +void video_decoder_init (xine_t *this); +void video_decoder_shutdown (xine_t *this); +void audio_decoder_init (xine_t *this); +void audio_decoder_shutdown (xine_t *this); /* - * Load input/demux/audio_out/video_out plugins + * demuxer helper functions from demux.c */ -/* plugin naming scheme */ -#define XINE_INPUT_PLUGIN_PREFIXNAME "xineplug_inp_" -#define XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH 13 - -#define XINE_DEMUXER_PLUGIN_PREFIXNAME "xineplug_dmx_" -#define XINE_DEMUXER_PLUGIN_PREFIXNAME_LENGTH 13 - -#define XINE_VIDEO_OUT_PLUGIN_PREFIXNAME "xineplug_vo_out_" -#define XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH 16 +void xine_demux_flush_engine (xine_t *this); -#define XINE_AUDIO_OUT_PLUGIN_PREFIXNAME "xineplug_ao_out_" -#define XINE_AUDIO_OUT_PLUGIN_PREFIXNAME_LENGTH 16 +void xine_demux_control_newpts (xine_t *this, int64_t pts, uint32_t flags ); -#define XINE_DECODER_PLUGIN_PREFIXNAME "xineplug_decode_" -#define XINE_DECODER_PLUGIN_PREFIXNAME_LENGTH 16 +void xine_demux_control_start (xine_t *this ); -/* - * load all available demuxer plugins - */ -void load_demux_plugins (xine_t *this, - config_values_t *config); - -/* - * list (open and close) all available demuxer plugins - */ -void xine_list_demux_plugins (config_values_t *config, - char **identifiers, char **mimetypes); - -/* - * load all available input plugins - */ - -void load_input_plugins (xine_t *this, - config_values_t *config); +void xine_demux_control_end (xine_t *this, uint32_t flags ); /* - * load all available decoder plugins + * plugin management */ -void load_decoder_plugins (xine_t *this, - config_values_t *config); /* - * output driver load support functions + * on-demand loading of audio/video/spu decoder plugins */ -/* video */ - -#define VISUAL_TYPE_X11 1 -#define VISUAL_TYPE_AA 2 -#define VISUAL_TYPE_FB 3 -#define VISUAL_TYPE_GTK 4 -#define VISUAL_TYPE_DFB 5 +video_decoder_t *get_video_decoder (xine_t *this, uint8_t stream_type); +audio_decoder_t *get_audio_decoder (xine_t *this, uint8_t stream_type); +spu_decoder_t *get_spu_decoder (xine_t *this, uint8_t stream_type); -/* - * list_video_output_plugins +/* + * plugin_loader functions * - * returns a list of available video output plugins for - * the specified visual type - the list is sorted by plugin - * priority */ char **xine_list_video_output_plugins (int visual_type); @@ -554,8 +300,8 @@ char **xine_list_video_output_plugins (int visual_type); * load a specific video output plugin */ -vo_driver_t *xine_load_video_output_plugin(config_values_t *config, - char *id, int visual_type, void *visual); +xine_vo_driver_t *xine_load_video_output_plugin(xine_t *this, + char *id, int visual_type, void *visual); /* * audio output plugin dynamic loading stuff @@ -576,101 +322,18 @@ char **xine_list_audio_output_plugins (); * load a specific audio output plugin */ -ao_driver_t *xine_load_audio_output_plugin(config_values_t *config, char *id); - -/* - * sending events - * event dispatcher mechanism - */ - -/* - * register an event listener callback. - * returns 0 if the listener was registerd, non-zero if it could not. - */ - -int xine_register_event_listener(xine_t *this, xine_event_listener_t listener, - void *user_data); - -/* - * attempt to remove a registered event listener. - * returns 0 if the listener was removed, non-zero if not (e.g. not found). - */ - -int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener); - -/* - * send an event to all listeners. - */ +xine_ao_driver_t *xine_load_audio_output_plugin (xine_t *self, char *id); -void xine_send_event(xine_t *this, xine_event_t *event); -/* - * register an codec reporting callback. - * return 0 if ok - * obs: set to NULL to unregister - */ - -int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec, - void *user_data); - - -/* - * snapshot function - * - * returns: - * width, height : size of image (be aware that u,v may be subsampled) - * ratio_code : aspect ratio of the frame - * format : subsampling format YUV 4:2:0 or 4:2:2 - * y : lumiance information - * u,v : subsample color information - */ -int xine_get_current_frame (xine_t *this, int *width, int *height, - int *ratio_code, int *format, - uint8_t **y, uint8_t **u, - uint8_t **v); - -#define XINE_ASPECT_RATIO_SQUARE 1 -#define XINE_ASPECT_RATIO_4_3 2 -#define XINE_ASPECT_RATIO_ANAMORPHIC 3 -#define XINE_ASPECT_RATIO_211_1 4 -#define XINE_ASPECT_RATIO_PAN_SCAN 41 -#define XINE_ASPECT_RATIO_DONT_TOUCH 42 - -osd_renderer_t *xine_get_osd_renderer (xine_t *this); - -/* - * xine log functions - */ - -char **xine_get_log_names (xine_t *this); -void xine_log (xine_t *this, int buf, const char *format, ...); -char **xine_get_log (xine_t *this, int buf); -int xine_get_log_section_count (xine_t *this); - - -/* - * xine error reporting - */ - -#define XINE_ERROR_NONE 0 -#define XINE_ERROR_NO_INPUT_PLUGIN 1 -#define XINE_ERROR_NO_DEMUXER_PLUGIN 2 -#define XINE_ERROR_DEMUXER_FAILED 3 - -int xine_get_error (xine_t *this); - - -/* - * demuxer helper functions from demux.c - */ +void xine_set_speed (xine_t *this, int speed) ; -void xine_demux_flush_engine(xine_t *this); +int xine_get_spu_lang (xine_t *this, int channel, char *str) ; -void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags ); +void xine_select_spu_channel (xine_t *this, int channel) ; -void xine_demux_control_start( xine_t *this ); +int xine_get_audio_channel (xine_t *this) ; -void xine_demux_control_end( xine_t *this, uint32_t flags ); +int xine_get_spu_channel (xine_t *this) ; #ifdef __cplusplus } diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h new file mode 100644 index 000000000..c9ebc6055 --- /dev/null +++ b/src/xine-engine/xine_plugin.h @@ -0,0 +1,68 @@ +/* + * 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: xine_plugin.h,v 1.2 2002/09/04 23:31:13 guenter Exp $ + * + * generic plugin definitions + * + */ + +#ifndef XINE_PLUGIN_H +#define XINE_PLUGIN_H + +#define PLUGIN_NONE 0 +#define PLUGIN_INPUT 1 +#define PLUGIN_DEMUX 2 +#define PLUGIN_AUDIO_DECODER 3 +#define PLUGIN_VIDEO_DECODER 4 +#define PLUGIN_SPU_DECODER 5 +#define PLUGIN_AUDIO_OUT 6 +#define PLUGIN_VIDEO_OUT 7 + + +typedef struct { + uint8_t type; /* one of the PLUGIN_* constants above */ + uint8_t API; /* API version supported by this plugin */ + const char *id; /* a name that identifies this plugin */ + uint32_t version; /* version number, increased every release */ + void *special_info; /* plugin-type specific, see structs below */ + void *(*init)(xine_t *, void *); /* used to get/initialize an instance*/ +} plugin_info_t; + + +/* special_info for a video output plugin */ +typedef struct { + int priority; /* priority of this plugin for auto-probing */ + char *description; /* human-readable description of this plugin */ + int visual_type; /* visual type supported by this plugin */ +} vo_info_t; + +/* special info for a audio output plugin */ +typedef struct { + char *description; + int priority; +} ao_info_t ; + +/* special_info for a decoder plugin */ +typedef struct { + uint32_t *supported_types;/* streamtypes this decoder can handle */ + int priority; +} decoder_info_t; + +#endif diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index 2b6182585..bcd604db8 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -12,7 +12,7 @@ endif CFLAGS = @CFLAGS@ $(THREAD_CFLAGS) -libxineutils_la_SOURCES = $(pppc_files) utils.c memcpy.c monitor.c cpu_accel.c xine_mutex.c xmllexer.c xmlparser.c color.c +libxineutils_la_SOURCES = $(pppc_files) utils.c memcpy.c monitor.c cpu_accel.c xine_mutex.c xmllexer.c xmlparser.c color.c list.c libxineutils_la_LIBADD = $(THREAD_LIBS) libxineutils_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) diff --git a/src/xine-utils/list.c b/src/xine-utils/list.c new file mode 100644 index 000000000..1ef36fb05 --- /dev/null +++ b/src/xine-utils/list.c @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2000-2002 the xine project + * + * This file is part of xine, a unix 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: list.c,v 1.2 2002/09/04 23:31:13 guenter Exp $ + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "xineutils.h" + +/* + * create a new, empty list + */ +xine_list_t *xine_list_new (void) { + xine_list_t *list; + + list = (xine_list_t *) xine_xmalloc(sizeof(xine_list_t)); + + list->first=NULL; + list->last =NULL; + list->cur =NULL; + + return list; +} + +/* + * dispose a list (and only the list, contents have to be managed separately) + * TODO: this is easy to fix by using "content destructors" + */ +void xine_list_free(xine_list_t *l) { + xine_node_t *node; + + if (!l) { + fprintf(stderr, "%s(): No list.\n", __FUNCTION__); + return; + } + + if(!l->first) { + return; + } + + node = l->first; + + while(node) { + xine_node_t *n = node; + + /* TODO: support for content destructors */ + node = n->next; + free(n); + } + + l->first = l->cur = l->last = NULL; /* FIXME: free(l) instead */ +} + +void *xine_list_first_content (xine_list_t *l) { + + l->cur = l->first; + + if (l->first) + return l->first->content; + else + return NULL; +} + +void *xine_list_next_content (xine_list_t *l) { + if (l->cur) { + + if (l->cur->next) { + l->cur = l->cur->next; + return l->cur->content; + } + else + return NULL; + + } + else { + fprintf(stderr,"%s() WARNING: passed end of list\n", __FUNCTION__); + return NULL; + } +} + +int xine_list_is_empty (xine_list_t *l) { + + if (l == NULL){ + fprintf(stderr, "%s(): list is NULL\n", __FUNCTION__); + return -1; + } + return (l->first != NULL); +} + +void *xine_list_last_content (xine_list_t *l) { + + if (l->last) { + l->cur = l->last; + return l->last->content; + } + else { + fprintf(stderr, "xine_list: wanted last of empty list\n"); + return NULL; + } +} + +void *xine_list_prev_content (xine_list_t *l) { + + if (l->cur) { + if (l->cur->prev) { + l->cur = l->cur->prev; + return l->cur->content; + } + else + return NULL; + } + else { + fprintf(stderr, "xine_list: passed begin of list\n"); + return NULL; + } +} + +void xine_list_append_content (xine_list_t *l, void *content) { + xine_node_t *node; + + node = (xine_node_t *) xine_xmalloc(sizeof(xine_node_t)); + node->content = content; + + if (l->last) { + node->next = NULL; + node->prev = l->last; + l->last->next = node; + l->last = node; + l->cur = node; + } + else { + l->first = l->last = l->cur = node; + node->prev = node->next = NULL; + } +} + +void xine_list_insert_content (xine_list_t *l, void *content) { + xine_node_t *nodecur, *nodenext, *nodenew; + + if(l->cur->next) { + nodenew = (xine_node_t *) xine_xmalloc(sizeof(xine_node_t)); + + nodenew->content = content; + nodecur = l->cur; + nodenext = l->cur->next; + nodecur->next = nodenew; + nodenext->prev = nodenew; + nodenew->prev = nodecur; + nodenew->next = nodenext; + l->cur = nodenew; + } + else { /* current is last, append to the list */ + xine_list_append_content(l, content); + } + +} + +void xine_list_delete_current (xine_list_t *l) { + xine_node_t *node_cur; + + node_cur = l->cur; + + if(node_cur->prev) { + node_cur->prev->next = node_cur->next; + } + else { /* First entry */ + l->first = node_cur->next; + } + + if(node_cur->next) { + node_cur->next->prev = node_cur->prev; + l->cur = node_cur->next; + } + else { /* last entry in the list */ + l->last = node_cur->prev; + l->cur = node_cur->prev; + } + + /* TODO: support content destructors */ + free(node_cur); +} diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index a27cce1d3..0b4e28c2c 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2001 the xine project + * Copyright (C) 2001-2002 the xine project * - * This file is part of xine, a unix video player. + * 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 @@ -397,17 +397,20 @@ static unsigned long long int rdtsc() } #endif -static void update_fast_memcpy(void *this_gen, cfg_entry_t *entry) -{ +static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) { static int config_flags = -1; + int method; + config_flags = xine_mm_accel(); - if( entry->num_value != 0 && - (config_flags & memcpy_method[entry->num_value].cpu_require) == - memcpy_method[entry->num_value].cpu_require ) { - printf("xine: using %s\n", memcpy_method[entry->num_value].name ); - xine_fast_memcpy = memcpy_method[entry->num_value].function; + method = entry->num_value; + + if (method != 0 + && (config_flags & memcpy_method[method].cpu_require) == + memcpy_method[method].cpu_require ) { + printf("xine: using %s\n", memcpy_method[method].name ); + xine_fast_memcpy = memcpy_method[method].function; return; } else { printf("xine: will probe memcpy on startup\n" ); @@ -437,7 +440,7 @@ void xine_probe_fast_memcpy(config_values_t *config) best = config->register_enum (config, "misc.memcpy_method", 0, memcpy_methods, _("Memcopy method to use in xine for large data chunks."), - NULL, update_fast_memcpy, NULL); + NULL, 20, update_fast_memcpy, NULL); /* check if function is configured and valid for this machine */ if( best != 0 && diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index cd44dca80..9875da713 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.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: xineutils.h,v 1.21 2002/08/28 03:32:48 tmmm Exp $ + * $Id: xineutils.h,v 1.22 2002/09/04 23:31:14 guenter Exp $ * */ #ifndef XINEUTILS_H @@ -35,6 +35,7 @@ extern "C" { #include "attributes.h" #include "compat.h" #include "xmlparser.h" + /* * debugable mutexes */ @@ -784,6 +785,79 @@ extern int v_r_table[256]; extern int v_g_table[256]; extern int v_b_table[256]; + +/******** double cained lists with builtin iterator *******/ + +typedef struct xine_node_s { + + struct xine_node_s *next, *prev; + + void *content; + +} xine_node_t; + + +typedef struct { + + xine_node_t *first, *last, *cur; + +} xine_list_t; + + + +xine_list_t *xine_list_new (void); + + +/** + * dispose the whole list. + * note: disposes _only_ the list structure, content must be free()d elsewhere + */ +void xine_list_free(xine_list_t *l); + + +/** + * returns: Boolean + */ +int xine_list_is_empty (xine_list_t *l); + +/** + * return content of first entry in list. + */ +void *xine_list_first_content (xine_list_t *l); + +/** + * return next content in list. + */ +void *xine_list_next_content (xine_list_t *l); + +/** + * Return last content of list. + */ +void *xine_list_last_content (xine_list_t *l); + +/** + * Return previous content of list. + */ +void *xine_list_prev_content (xine_list_t *l); + +/** + * Append content to list. + */ +void xine_list_append_content (xine_list_t *l, void *content); + +/** + * Insert content in list. + */ +void xine_list_insert_content (xine_list_t *l, void *content); + +/** + * Remove current content in list. + * note: removes only the list entry; content must be free()d elsewhere. + */ +void xine_list_delete_current (xine_list_t *l); + + + #ifdef __cplusplus } #endif -- cgit v1.2.3