diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2002-05-01 19:42:56 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2002-05-01 19:42:56 +0000 |
commit | f5ef61ef9364a04765b71d80ea19675a80616f40 (patch) | |
tree | d5e5d3b26d57bcf6af977fa95a1daaf376fea784 | |
parent | 47760fada8acc782d6f3037017733aff8d49a4f5 (diff) | |
download | xine-lib-f5ef61ef9364a04765b71d80ea19675a80616f40.tar.gz xine-lib-f5ef61ef9364a04765b71d80ea19675a80616f40.tar.bz2 |
big cleanup on plugin dispose handling, small improvements on version handling for decoder plugins
CVS patchset: 1824
CVS date: 2002/05/01 19:42:56
-rw-r--r-- | src/libdivx4/xine_decoder.c | 88 | ||||
-rw-r--r-- | src/libffmpeg/xine_decoder.c | 4 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 6 | ||||
-rw-r--r-- | src/libspucc/xine_decoder.c | 4 | ||||
-rw-r--r-- | src/libspudec/spu_decoder_api.h | 6 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 6 | ||||
-rw-r--r-- | src/libsputext/xine_decoder.c | 6 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 4 | ||||
-rw-r--r-- | src/libxinevdec/cinepak.c | 6 | ||||
-rw-r--r-- | src/libxinevdec/cyuv.c | 6 | ||||
-rw-r--r-- | src/libxinevdec/msvc.c | 6 | ||||
-rw-r--r-- | src/libxvid/xine_decoder.c | 2 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 102 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 40 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 27 |
15 files changed, 145 insertions, 168 deletions
diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index 0b51dae3e..4bb3f210f 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.32 2002/04/29 23:31:59 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.33 2002/05/01 19:42:56 guenter Exp $ * * xine decoder plugin using divx4 * @@ -60,7 +60,9 @@ #if CATCH_SIGSEGV #include <signal.h> -/* #define LOG */ +/* +#define LOG +*/ /* to be able to restore the old handler */ void (*old_handler)(int); @@ -107,6 +109,7 @@ typedef struct divx4_decoder_s { int bufsize; decoreFunc decore; /* ptr to decore function in libdivxdecore */ + /* version as reported by decore with GET_OPT_VERSION command */ int version; /* whether to decode MSMPEG4_V3 format @@ -203,31 +206,30 @@ static int divx4_check_version(divx4_decoder_t *this) static void divx4_set_pp(divx4_decoder_t *this) { DEC_SET setpp; /* for setting postproc level */ int ret; + +#ifdef LOG + printf ("divx4: this->decoder_ok=%d\n", this->decoder_ok); +#endif + + if (!this->decoder_ok) + return; /* multiply postproc level by 10 for internal consumption */ - printf("divx4: Setting post processing level to %d (see ~/.xinerc)\n" + printf("divx4: Setting post processing level to %d (see ~/.xine/options)\n" "divx4: Valid range 0-6, reduce if you get frame drop\n", this->postproc); - setpp.postproc_level=this->postproc*10; - setpp.deblock_hor_luma = 0; - setpp.deblock_ver_luma = 0; - setpp.deblock_hor_chr = 0; - setpp.deblock_ver_chr = 0; - setpp.dering_luma = 0; - setpp.dering_chr = 0; - setpp.pp_semaphore = 0; + setpp.postproc_level = this->postproc*10; setpp.deblock_hor_luma = 0; setpp.deblock_ver_luma = 0; - setpp.deblock_hor_chr = 0; - setpp.deblock_ver_chr = 0; - setpp.dering_luma = 0; - setpp.dering_chr = 0; - setpp.pp_semaphore = 0; + setpp.deblock_hor_chr = 0; + setpp.deblock_ver_chr = 0; + setpp.dering_luma = 0; + setpp.dering_chr = 0; + setpp.pp_semaphore = 0; ret = this->decore((unsigned long)this, DEC_OPT_SETPP, &setpp, 0); - if (ret != DEC_OK) - { + if (ret != DEC_OK) { printf("divx4: decore DEC_OPT_SETPP command returned %s.\n", decore_retval(ret)); /* perhaps not fatal, so we'll continue */ } @@ -235,11 +237,15 @@ static void divx4_set_pp(divx4_decoder_t *this) { /* helper function to initialize decore */ -static int divx4_init_decoder(divx4_decoder_t *this, buf_element_t *buf) -{ +static int divx4_init_decoder(divx4_decoder_t *this, buf_element_t *buf) { + DEC_PARAM param; /* for init */ int ret, codec_type; +#ifdef LOG + printf ("divx4: init_decoder\n"); +#endif + memcpy ( &this->bih, buf->content, sizeof (BITMAPINFOHEADER)); this->biWidth = str2ulong(&this->bih.biWidth); this->biHeight = str2ulong(&this->bih.biHeight); @@ -289,6 +295,8 @@ static int divx4_init_decoder(divx4_decoder_t *this, buf_element_t *buf) return 0; } + this->decoder_ok = 1; + divx4_set_pp( this ); return 1; @@ -363,6 +371,10 @@ static int divx4_can_handle (video_decoder_t *this_gen, int buf_type) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; buf_type &= 0xFFFF0000; +#ifdef LOG + printf ("divx4: can_handle\n"); +#endif + /* divx4 currently does not support MSMPEG4 v1/v2 */ return ( (buf_type == BUF_VIDEO_MSMPEG4_V3 && this->can_handle_311) || /* buf_type == BUF_VIDEO_MSMPEG4_V12 || */ @@ -375,6 +387,10 @@ static void divx4_init (video_decoder_t *this_gen, vo_instance_t *video_out) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; +#ifdef LOG + printf ("divx4: divx4_init\n"); +#endif + this->video_out = video_out; this->decoder_ok = 0; this->buf = NULL; @@ -406,7 +422,7 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { divx4_get_version(this); this->decoder_ok = ( divx4_check_version(this) && - divx4_init_decoder(this, buf) ); + divx4_init_decoder (this, buf) ); if (this->decoder_ok) { this->video_out->open (this->video_out); @@ -490,6 +506,8 @@ static void divx4_close (video_decoder_t *this_gen) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; + printf ("divx4: close\n"); + if (this->decoder_ok) { /* FIXME: this segfaults here */ /* Note: we NEED this; after 0.9.4, xine closes and reopens @@ -505,9 +523,13 @@ 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, cfg_entry_t *entry) { + divx4_decoder_t *this = (divx4_decoder_t *) this_gen; + +#ifdef LOG + printf ("divx4: update_postproc this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); +#endif if( this->postproc != entry->num_value ) { this->postproc = entry->num_value; @@ -517,17 +539,29 @@ static void divx4_update_postproc(void *this_gen, cfg_entry_t *entry) static char *divx4_get_id(void) { +#ifdef LOG + printf ("divx4: get_id\n"); +#endif return "divx4 video decoder"; } static void divx4_flush(video_decoder_t *this_gen) { +#ifdef LOG + printf ("divx4: flush\n"); +#endif } static void divx4_reset(video_decoder_t *this_gen) { /* seems to handle seeking quite nicelly without any code here */ +#ifdef LOG + printf ("divx4: reset\n"); +#endif } static void divx4_dispose(video_decoder_t *this_gen) { +#ifdef LOG + printf ("divx4: dispose\n"); +#endif free (this_gen); } @@ -541,7 +575,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { decoreFunc libdecore_func = 0; config_values_t *cfg; - if (iface_version != 7) { + if (iface_version != 8) { 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", @@ -568,6 +602,8 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { this = (divx4_decoder_t *) malloc (sizeof (divx4_decoder_t)); + 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; @@ -608,6 +644,10 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { if (this->postproc > 10) this->postproc=10; if (this->postproc < 0) this->postproc=0; +#ifdef LOG + printf ("divx4: this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); +#endif + return (video_decoder_t *) this; } diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index c10e0e7d6..c2896e41c 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.35 2002/04/27 17:03:30 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.36 2002/05/01 19:42:56 guenter Exp $ * * xine decoder plugin using ffmpeg * @@ -420,7 +420,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { ff_decoder_t *this ; static pthread_once_t once_control = PTHREAD_ONCE_INIT; - if (iface_version != 7) { + if (iface_version != 8) { 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", diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 91579459c..fc0ac5dc3 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.c @@ -1,7 +1,7 @@ /* * 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: xine_decoder.c,v 1.31 2002/04/28 10:39:47 esnel Exp $ + * $Id: xine_decoder.c,v 1.32 2002/05/01 19:42:56 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -152,7 +152,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { mpeg2dec_decoder_t *this ; - if (iface_version != 7) { + if (iface_version != 8) { 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", diff --git a/src/libspucc/xine_decoder.c b/src/libspucc/xine_decoder.c index 5c097783f..7fdcc69f0 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.11 2002/04/27 23:31:33 cvogler Exp $ + * $Id: xine_decoder.c,v 1.12 2002/05/01 19:42:56 guenter Exp $ * * closed caption spu decoder. receive data by events. * @@ -385,7 +385,7 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { spucc_decoder_t *this ; - if (iface_version != 6) { + if (iface_version != 7) { printf("libspucc: doesn't support plugin api version %d.\n" "libspucc: This means there is a version mismatch between xine and\n" "libspucc: this plugin.\n", iface_version); diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h index f7f4a6bcb..bbde5786a 100644 --- a/src/libspudec/spu_decoder_api.h +++ b/src/libspudec/spu_decoder_api.h @@ -24,7 +24,9 @@ #ifndef HAVE_SPU_API_H #define HAVE_SPU_API_H - /* +#define SPU_DECODER_IFACE_VERSION 7 + +/* * generic xine spu decoder plugin interface * * for a dynamic plugin make sure you provide this function call: @@ -54,8 +56,6 @@ struct spu_decoder_s { int priority; - metronom_t *metronom; - }; typedef struct spu_button_s spu_button_t; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 818b10959..333267261 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.66 2002/04/24 20:26:07 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.67 2002/05/01 19:42:56 guenter Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -301,7 +301,7 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { spudec_decoder_t *this ; - if (iface_version != 6) { + if (iface_version != 7) { printf("libspudec: Doesn't support plugin API version %d.\n" "libspudec: This means there is a version mismatch between XINE and\n" "libspudec: this plugin.\n", iface_version); @@ -309,8 +309,6 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { } this = (spudec_decoder_t *) xine_xmalloc (sizeof (spudec_decoder_t)); -/* xine_xmalloc does memset */ -/* memset (this, 0, sizeof(*this)); */ this->spu_decoder.interface_version = iface_version; this->spu_decoder.can_handle = spudec_can_handle; diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index e461468f4..58164f979 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2000-2001 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: xine_decoder.c,v 1.21 2002/04/23 15:45:25 esnel Exp $ + * $Id: xine_decoder.c,v 1.22 2002/05/01 19:42:57 guenter Exp $ * * code based on mplayer module: * @@ -1005,7 +1005,7 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { sputext_decoder_t *this ; - if (iface_version != 6) { + if (iface_version != 7) { printf("libsputext: doesn't support plugin api version %d.\n" "libsputext: This means there is a version mismatch between xine and\n" "libsputext: this plugin.\n", iface_version); diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 0940bb6bd..dc686b25a 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.76 2002/04/28 15:32:41 esnel Exp $ + * $Id: w32codec.c,v 1.77 2002/05/01 19:42:57 guenter Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -1326,7 +1326,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { w32v_decoder_t *this ; config_values_t *cfg; - if (iface_version != 7) { + if (iface_version != 8) { 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 input plugins should help.\n", diff --git a/src/libxinevdec/cinepak.c b/src/libxinevdec/cinepak.c index 35506b40d..05e86facf 100644 --- a/src/libxinevdec/cinepak.c +++ b/src/libxinevdec/cinepak.c @@ -1,7 +1,7 @@ /* * Copyright (C) 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 @@ -22,7 +22,7 @@ * based on overview of Cinepak algorithm and example decoder * by Tim Ferguson: http://www.csse.monash.edu.au/~timf/ * - * $Id: cinepak.c,v 1.2 2002/04/30 20:06:16 esnel Exp $ + * $Id: cinepak.c,v 1.3 2002/05/01 19:42:57 guenter Exp $ */ #include <stdlib.h> @@ -424,7 +424,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { cvid_decoder_t *this ; - if (iface_version != 7) { + if (iface_version != 8) { 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", diff --git a/src/libxinevdec/cyuv.c b/src/libxinevdec/cyuv.c index fd54686e1..60f929ecc 100644 --- a/src/libxinevdec/cyuv.c +++ b/src/libxinevdec/cyuv.c @@ -1,6 +1,6 @@ /* This is the standard xine header: */ /* - * Copyright (C) 2000-2001 the xine project + * Copyright (C) 2000-2002 the xine project * * This file is part of xine, a free video player. * @@ -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.1 2002/04/30 08:28:10 esnel Exp $ + * $Id: cyuv.c,v 1.2 2002/05/01 19:42:57 guenter Exp $ */ /* And this is the header that came with the CYUV decoder: */ @@ -228,7 +228,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { cyuv_decoder_t *this ; - if (iface_version != 7) { + if (iface_version != 8) { 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", diff --git a/src/libxinevdec/msvc.c b/src/libxinevdec/msvc.c index 0db5dd6a9..d819688e8 100644 --- a/src/libxinevdec/msvc.c +++ b/src/libxinevdec/msvc.c @@ -1,7 +1,7 @@ /* * Copyright (C) 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 @@ -22,7 +22,7 @@ * based on overview of Microsoft Video-1 algorithm * by Mike Melanson: http://www.pcisys.net/~melanson/codecs/video1.txt * - * $Id: msvc.c,v 1.1 2002/04/30 08:28:10 esnel Exp $ + * $Id: msvc.c,v 1.2 2002/05/01 19:42:57 guenter Exp $ */ #include <stdlib.h> @@ -335,7 +335,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { msvc_decoder_t *this ; - if (iface_version != 7) { + if (iface_version != 8) { 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", diff --git a/src/libxvid/xine_decoder.c b/src/libxvid/xine_decoder.c index 2fe2cde70..a03e8ec7a 100644 --- a/src/libxvid/xine_decoder.c +++ b/src/libxvid/xine_decoder.c @@ -236,7 +236,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) { xvid_decoder_t *this; XVID_INIT_PARAM xinit; - if (iface_version != 7) { + if (iface_version != 8) { printf ("xvid: plugin doesn't support plugin API version %d.\n" "xvid: this means there's a version mismatch between xine and this\n" "xvid: decoder plugin. Installing current plugins should help.\n", diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 6108d83da..9cf00ab6b 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.76 2002/04/29 23:32:00 jcdutton Exp $ + * $Id: load_plugins.c,v 1.77 2002/05/01 19:42:57 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -90,11 +90,10 @@ static void remove_segv_handler(void){ #endif -/** *************************************************************** +/* * Demuxers plugins section */ -void load_demux_plugins (xine_t *this, - config_values_t *config, int iface_version) { +void load_demux_plugins (xine_t *this, config_values_t *config) { DIR *dir; if (this == NULL || config == NULL) { @@ -146,7 +145,7 @@ void load_demux_plugins (xine_t *this, if((initplug = dlsym(plugin, "init_demuxer_plugin")) != NULL) { demux_plugin_t *dxp; - dxp = (demux_plugin_t *) initplug(iface_version, this); + dxp = (demux_plugin_t *) initplug (DEMUXER_PLUGIN_IFACE_VERSION, this); if (dxp) { this->demuxer_plugins[this->num_demuxer_plugins] = dxp; @@ -262,7 +261,7 @@ void xine_list_demux_plugins (config_values_t *config, * Input plugins section */ void load_input_plugins (xine_t *this, - config_values_t *config, int iface_version) { + config_values_t *config) { DIR *dir; this->num_input_plugins = 0; @@ -306,7 +305,7 @@ void load_input_plugins (xine_t *this, if((initplug = dlsym(plugin, "init_input_plugin")) != NULL) { input_plugin_t *ip; - ip = (input_plugin_t *) initplug(iface_version, this); + ip = (input_plugin_t *) initplug (INPUT_PLUGIN_IFACE_VERSION, this); if (ip) { this->input_plugins[this->num_input_plugins] = ip; @@ -446,17 +445,13 @@ static int decide_audio_insert(audio_decoder_t *p, int streamtype, int prio) { /* * load audio and video decoder plugins */ -void load_decoder_plugins (xine_t *this, - config_values_t *config, int iface_version) { +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]; - int *spu_used[DECODER_PLUGIN_MAX], *video_used[DECODER_PLUGIN_MAX], - *audio_used[DECODER_PLUGIN_MAX]; - - if(this == NULL || config == NULL) { + if (this == NULL || config == NULL) { printf ( _("%s(%s@%d): parameter should be non null, exiting\n"), __FILE__, __XINE_FUNCTION__, __LINE__); abort(); @@ -469,22 +464,22 @@ void load_decoder_plugins (xine_t *this, for (i=0; i<DECODER_PLUGIN_MAX; i++) { this->spu_decoder_plugins[i] = NULL; spu_prio[i] = 0; - spu_used[i] = NULL; } + this->num_spu_decoders_loaded = 0; this->cur_video_decoder_plugin = NULL; for (i=0; i<DECODER_PLUGIN_MAX; i++) { this->video_decoder_plugins[i] = NULL; video_prio[i] = 0; - video_used[i] = NULL; } + this->num_video_decoders_loaded = 0; this->cur_audio_decoder_plugin = NULL; for (i=0; i<DECODER_PLUGIN_MAX; i++) { this->audio_decoder_plugins[i] = NULL; audio_prio[i] = 0; - audio_used[i] = NULL; } + this->num_audio_decoders_loaded = 0; /* * now scan for decoder plugins @@ -539,35 +534,25 @@ void load_decoder_plugins (xine_t *this, spu_decoder_t *sdp; int streamtype; - sdp = (spu_decoder_t *) initplug(6, this); + sdp = (spu_decoder_t *) initplug (SPU_DECODER_IFACE_VERSION, this); if (sdp) { - int *used = (int *)xine_xmalloc (sizeof (int)); - sdp->metronom = this->metronom; - - for (streamtype = 0; streamtype<DECODER_PLUGIN_MAX; streamtype++) + this->spu_decoders_loaded [this->num_spu_decoders_loaded] = sdp; + this->num_spu_decoders_loaded++; + + for (streamtype = 0; streamtype<DECODER_PLUGIN_MAX; streamtype++) { if ((plugin_prio = decide_spu_insert(sdp, streamtype, spu_prio[streamtype]))) { - if (spu_used[streamtype] && --(*spu_used[streamtype]) == 0) { - this->spu_decoder_plugins[streamtype]->dispose (this->spu_decoder_plugins[streamtype]); - free (spu_used[streamtype]); - } - this->spu_decoder_plugins[streamtype] = sdp; spu_prio[streamtype] = plugin_prio; - spu_used[streamtype] = used; - (*used)++; } + } xine_log (this, XINE_LOG_PLUGIN, _("spu decoder plugin found : %s\n"), sdp->get_identifier()); - if (*used == 0) { - sdp->dispose (sdp); - free (used); - } } } } @@ -583,35 +568,24 @@ void load_decoder_plugins (xine_t *this, video_decoder_t *vdp; int streamtype; - vdp = (video_decoder_t *) initplug(iface_version, this); + vdp = (video_decoder_t *) initplug(VIDEO_DECODER_IFACE_VERSION, this); if (vdp) { - int *used = (int *)xine_xmalloc (sizeof (int)); - vdp->metronom = this->metronom; - + this->video_decoders_loaded [this->num_video_decoders_loaded] = vdp; + this->num_video_decoders_loaded++; + for (streamtype = 0; streamtype<DECODER_PLUGIN_MAX; streamtype++) if ((plugin_prio = decide_video_insert(vdp, streamtype, video_prio[streamtype]))) { - if (video_used[streamtype] && --(*video_used[streamtype]) == 0) { - this->video_decoder_plugins[streamtype]->dispose (this->video_decoder_plugins[streamtype]); - free (video_used[streamtype]); - } - this->video_decoder_plugins[streamtype] = vdp; video_prio[streamtype] = plugin_prio; - video_used[streamtype] = used; - (*used)++; } xine_log (this, XINE_LOG_PLUGIN, _("video decoder plugin found : %s\n"), vdp->get_identifier()); - if (*used == 0) { - vdp->dispose (vdp); - free (used); - } } } @@ -624,33 +598,24 @@ void load_decoder_plugins (xine_t *this, audio_decoder_t *adp; int streamtype; - adp = (audio_decoder_t *) initplug(iface_version, this); + adp = (audio_decoder_t *) initplug(AUDIO_DECODER_IFACE_VERSION, this); if (adp) { - int *used = (int *)xine_xmalloc (sizeof (int)); - + + this->audio_decoders_loaded [this->num_audio_decoders_loaded] = adp; + this->num_audio_decoders_loaded++; + for (streamtype = 0; streamtype<DECODER_PLUGIN_MAX; streamtype++) if ((plugin_prio = decide_audio_insert(adp, streamtype, audio_prio[streamtype]))) { - if (audio_used[streamtype] && --(*audio_used[streamtype]) == 0) { - this->audio_decoder_plugins[streamtype]->dispose (this->audio_decoder_plugins[streamtype]); - free (audio_used[streamtype]); - } - this->audio_decoder_plugins[streamtype] = adp; audio_prio[streamtype] = plugin_prio; - audio_used[streamtype] = used; - (*used)++; } xine_log (this, XINE_LOG_PLUGIN, _("audio decoder plugin found : %s\n"), adp->get_identifier()); - if (*used == 0) { - adp->dispose (adp); - free (used); - } } } @@ -662,17 +627,6 @@ void load_decoder_plugins (xine_t *this, } remove_segv_handler(); - for (i=0; i<DECODER_PLUGIN_MAX; i++) { - if (spu_used[i] && --(*spu_used[i]) == 0) - free (spu_used[i]); - - if (video_used[i] && --(*video_used[i]) == 0) - free (video_used[i]); - - if (audio_used[i] && --(*audio_used[i]) == 0) - free (audio_used[i]); - } - this->cur_spu_decoder_plugin = NULL; this->cur_video_decoder_plugin = NULL; this->cur_audio_decoder_plugin = NULL; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 7f0c21a8e..7814fdae6 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.122 2002/04/29 23:32:00 jcdutton Exp $ + * $Id: xine.c,v 1.123 2002/05/01 19:42:57 guenter Exp $ * * top-level xine functions * @@ -456,7 +456,7 @@ int xine_eject (xine_t *this) { void xine_exit (xine_t *this) { - int i, j; + int i; xine_stop(this); @@ -487,32 +487,14 @@ void xine_exit (xine_t *this) { for (i = 0; i < this->num_input_plugins; i++) this->input_plugins[i]->dispose (this->input_plugins[i]); - for (i = 0; i < DECODER_PLUGIN_MAX; i++) { - if (this->audio_decoder_plugins[i]) { - this->audio_decoder_plugins[i]->dispose (this->audio_decoder_plugins[i]); + for (i = 0; i < this->num_audio_decoders_loaded; i++) + this->audio_decoders_loaded[i]->dispose (this->audio_decoders_loaded[i]); - for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { - if (this->audio_decoder_plugins[j] == this->audio_decoder_plugins[i]) - this->audio_decoder_plugins[j] = NULL; - } - } - if (this->video_decoder_plugins[i]) { - this->video_decoder_plugins[i]->dispose (this->video_decoder_plugins[i]); - - for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { - if (this->video_decoder_plugins[j] == this->video_decoder_plugins[i]) - this->video_decoder_plugins[j] = NULL; - } - } - if (this->spu_decoder_plugins[i]) { - this->spu_decoder_plugins[i]->dispose (this->spu_decoder_plugins[i]); + for (i = 0; i < this->num_video_decoders_loaded; i++) + this->video_decoders_loaded[i]->dispose (this->video_decoders_loaded[i]); - for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { - if (this->spu_decoder_plugins[j] == this->spu_decoder_plugins[i]) - this->spu_decoder_plugins[j] = NULL; - } - } - } + for (i = 0; i < this->num_spu_decoders_loaded; i++) + this->spu_decoders_loaded[i]->dispose (this->spu_decoders_loaded[i]); xine_profiler_print_results (); @@ -573,13 +555,13 @@ xine_t *xine_init (vo_driver_t *vo, * load input and demuxer plugins */ - load_input_plugins (this, config, INPUT_PLUGIN_IFACE_VERSION); + load_input_plugins (this, config); this->demux_strategy = config->register_enum (config, "misc.demux_strategy", 0, demux_strategies, "demuxer selection strategy", NULL, NULL, NULL); - load_demux_plugins(this, config, DEMUXER_PLUGIN_IFACE_VERSION); + load_demux_plugins(this, config); this->spu_channel_auto = -1; this->spu_channel_user = -1; @@ -590,7 +572,7 @@ xine_t *xine_init (vo_driver_t *vo, * init and start decoder threads */ - load_decoder_plugins (this, config, DECODER_PLUGIN_IFACE_VERSION); + load_decoder_plugins (this, config); this->video_out = vo_new_instance (vo, this); video_decoder_init (this); diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 8d65a820c..a1a1600d8 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.79 2002/04/23 15:45:26 esnel Exp $ + * $Id: xine_internal.h,v 1.80 2002/05/01 19:42:57 guenter Exp $ * */ @@ -55,7 +55,8 @@ extern "C" { #define INPUT_PLUGIN_MAX 50 #define DEMUXER_PLUGIN_MAX 50 #define DECODER_PLUGIN_MAX 256 -#define DECODER_PLUGIN_IFACE_VERSION 7 +#define VIDEO_DECODER_IFACE_VERSION 8 +#define AUDIO_DECODER_IFACE_VERSION 7 #define AUDIO_OUT_PLUGIN_MAX 50 #define VIDEO_OUT_PLUGIN_MAX 50 #define XINE_MAX_EVENT_LISTENERS 50 @@ -65,7 +66,7 @@ extern "C" { * * for a dynamic plugin make sure you provide this function call: * video_decoder_t *init_video_decoder_plugin (int iface_version, - * config_values_t *cfg); + * xine_t *xine); */ typedef struct video_decoder_s video_decoder_t; @@ -92,8 +93,6 @@ struct video_decoder_s { int priority; - metronom_t *metronom; - }; /* @@ -101,7 +100,7 @@ struct video_decoder_s { * * for a dynamic plugin make sure you provide this function call: * audio_decoder_t *init_audio_decoder_plugin (int iface_version, - * config_values_t *cfg); + * xine_t *xine); */ typedef struct audio_decoder_s audio_decoder_t; @@ -178,9 +177,10 @@ struct xine_s { spu_functions_t *spu_out; pthread_t spu_thread; spu_decoder_t *spu_decoder_plugins[DECODER_PLUGIN_MAX]; - int num_spu_decoder_plugins; 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) @@ -199,6 +199,8 @@ struct xine_s { 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; @@ -211,8 +213,9 @@ struct xine_s { lrb_t *audio_temp; pthread_t audio_thread; audio_decoder_t *audio_decoder_plugins[DECODER_PLUGIN_MAX]; - int num_audio_decoder_plugins; 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; @@ -475,26 +478,26 @@ void audio_decoder_shutdown (xine_t *this); * load all available demuxer plugins */ void load_demux_plugins (xine_t *this, - config_values_t *config, int iface_version); + 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); + char **identifiers, char **mimetypes); /* * load all available input plugins */ void load_input_plugins (xine_t *this, - config_values_t *config, int iface_version); + config_values_t *config); /* * load all available decoder plugins */ void load_decoder_plugins (xine_t *this, - config_values_t *config, int iface_version); + config_values_t *config); /* * output driver load support functions |