summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/load_plugins.c102
-rw-r--r--src/xine-engine/xine.c40
-rw-r--r--src/xine-engine/xine_internal.h27
3 files changed, 54 insertions, 115 deletions
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