summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/liba52/xine_decoder.c58
-rw-r--r--src/post/goom/xine_goom.c10
-rw-r--r--src/xine-engine/load_plugins.c84
-rw-r--r--src/xine-engine/plugin_catalog.h4
-rw-r--r--src/xine-engine/xine_plugin.h10
5 files changed, 91 insertions, 75 deletions
diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c
index 6fb57b532..9b00b8fa4 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.45 2002/12/26 21:53:42 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.46 2003/01/03 22:38:30 miguelfreitas Exp $
*
* stuff needed to turn liba52 into a xine decoder plugin
*/
@@ -54,6 +54,11 @@ int a52file;
typedef struct {
audio_decoder_class_t decoder_class;
config_values_t *config;
+
+ float a52_level;
+ int disable_dynrng;
+ int enable_surround_downmix;
+
} a52dec_class_t;
typedef struct a52dec_decoder_s {
@@ -73,7 +78,6 @@ typedef struct a52dec_decoder_s {
int a52_flags;
int a52_bit_rate;
int a52_sample_rate;
- float a52_level;
int have_lfe;
int a52_flags_map[11];
@@ -85,8 +89,6 @@ typedef struct a52dec_decoder_s {
int output_open;
int output_mode;
- int disable_dynrng;
- int enable_surround_downmix;
} a52dec_decoder_t;
struct frmsize_s
@@ -183,7 +185,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) {
if (!this->bypass_mode) {
int a52_output_flags, i;
- sample_t level = this->a52_level;
+ sample_t level = this->class->a52_level;
audio_buffer_t *buf;
int16_t *int_samples;
sample_t *samples = a52_samples(this->a52_state);
@@ -204,7 +206,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts) {
return;
}
- if (this->disable_dynrng)
+ if (this->class->disable_dynrng)
a52_dynrng (this->a52_state, NULL, NULL);
this->have_lfe = a52_output_flags & A52_LFE;
@@ -521,7 +523,6 @@ static void a52dec_dispose (audio_decoder_t *this_gen) {
static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) {
a52dec_decoder_t *this ;
- config_values_t *cfg;
#ifdef LOG
printf ("liba52:open_plugin called\n");
#endif
@@ -535,18 +536,6 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
this->audio_decoder.dispose = a52dec_dispose;
this->stream = stream;
this->class = (a52dec_class_t *) class_gen;
- cfg = this->class->config;
-
- this->a52_level = (float) cfg->register_range (cfg, "codec.a52_level", 100,
- 0, 200,
- _("a/52 volume control"),
- NULL, 0, NULL, NULL) / 100.0;
- this->disable_dynrng = !cfg->register_bool (cfg, "codec.a52_dynrng", 0,
- _("enable a/52 dynamic range compensation"),
- 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, 0, NULL, NULL);
/* int i; */
@@ -570,13 +559,13 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
this->bypass_mode = 0;
this->a52_flags_map[A52_MONO] = A52_MONO;
- this->a52_flags_map[A52_STEREO] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_3F] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_2F1R] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_3F1R] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_2F2R] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_3F2R] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
- this->a52_flags_map[A52_DOLBY] = ((this->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_STEREO] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_3F] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_2F1R] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_3F1R] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_2F2R] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_3F2R] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
+ this->a52_flags_map[A52_DOLBY] = ((this->class->enable_surround_downmix ? A52_DOLBY : A52_STEREO));
this->ao_flags_map[A52_MONO] = AO_CAP_MODE_MONO;
this->ao_flags_map[A52_STEREO] = AO_CAP_MODE_STEREO;
@@ -669,6 +658,7 @@ static void dispose_class (audio_decoder_class_t *this) {
static void *init_plugin (xine_t *xine, void *data) {
a52dec_class_t *this;
+ config_values_t *cfg;
this = (a52dec_class_t *) malloc (sizeof (a52dec_class_t));
@@ -677,8 +667,20 @@ static void *init_plugin (xine_t *xine, void *data) {
this->decoder_class.get_description = get_description;
this->decoder_class.dispose = dispose_class;
- this->config = xine->config;
+ cfg = this->config = xine->config;
+ this->a52_level = (float) cfg->register_range (cfg, "codec.a52_level", 100,
+ 0, 200,
+ _("a/52 volume control"),
+ NULL, 0, NULL, NULL) / 100.0;
+ this->disable_dynrng = !cfg->register_bool (cfg, "codec.a52_dynrng", 0,
+ _("enable a/52 dynamic range compensation"),
+ 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, 0, NULL, NULL);
+
+
#ifdef LOG
printf ("liba52:init_plugin called\n");
#endif
@@ -699,6 +701,6 @@ static decoder_info_t dec_info_audio = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_AUDIO_DECODER, 13, "a/52", XINE_VERSION_CODE, &dec_info_audio, init_plugin },
+ { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 13, "a/52", XINE_VERSION_CODE, &dec_info_audio, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index 9be2aef6b..80fc46f52 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.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_goom.c,v 1.15 2003/01/03 21:29:20 tmattern Exp $
+ * $Id: xine_goom.c,v 1.16 2003/01/03 22:38:25 miguelfreitas Exp $
*
* GOOM post plugin.
*
@@ -93,11 +93,13 @@ static void *goom_init_plugin(xine_t *xine, void *);
/* plugin catalog information */
-post_info_t goom_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION };
+post_info_t goom_special_info = {
+ XINE_POST_TYPE_AUDIO_VISUALIZATION
+};
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_POST, 2, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin },
+ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 2, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
@@ -345,7 +347,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->samples_per_frame = rate / this->class->fps;
this->sample_rate = rate;
this->stream = stream;
- init_yuv_planes(&this->yuv, GOOM_WIDTH, GOOM_HEIGHT);
+ init_yuv_planes(&this->yuv, this->class->width, this->class->height);
return port->original_port->open(port->original_port, stream, bits, rate, mode );
}
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 2d08416da..8382bebae 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.128 2003/01/01 20:39:21 guenter Exp $
+ * $Id: load_plugins.c,v 1.129 2003/01/03 22:38:27 miguelfreitas Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -177,7 +177,7 @@ static void _insert_plugin (xine_t *this,
entry->plugin_class = NULL;
entry->ref = 0;
- switch (info->type){
+ switch (info->type & PLUGIN_TYPE_MASK){
case PLUGIN_VIDEO_OUT:
vo_old = info->special_info;
@@ -326,7 +326,7 @@ static void collect_plugins(xine_t *this, char *path){
xine_log (this, XINE_LOG_PLUGIN,
_("load_plugins: plugin %s found\n"), str);
- switch (info->type){
+ switch (info->type & PLUGIN_TYPE_MASK){
case PLUGIN_INPUT:
_insert_plugin (this, this->plugin_catalog->input, str,
&statbuffer, info,
@@ -454,46 +454,49 @@ static void *_load_plugin_class(xine_t *this,
/*
* load input+demuxer plugins
+ * load plugins that asked to be initialized
*/
-static void load_plugins(xine_t *this) {
+static void _load_required_plugins(xine_t *this, xine_list_t *list) {
plugin_node_t *node;
+ int load;
- /*
- * input plugins
- */
-
- node = xine_list_first_content (this->plugin_catalog->input);
+ node = xine_list_first_content (list);
while (node) {
-
+
+ if( (node->info->type & PLUGIN_TYPE_MASK) == PLUGIN_INPUT ||
+ (node->info->type & PLUGIN_TYPE_MASK) == PLUGIN_DEMUX ||
+ (node->info->type & PLUGIN_MUST_PRELOAD) )
+ load = 1;
+ else
+ load = 0;
+
+ if( load && !node->plugin_class ) {
#ifdef LOG
- printf("load_plugins: load input plugin %s from %s\n",
- node->info->id, node->filename);
+ printf("load_plugins: load input plugin %s from %s\n",
+ node->info->id, node->filename);
#endif
- node->plugin_class = _load_plugin_class (this, node->filename, node->info, NULL);
-
- node = xine_list_next_content (this->plugin_catalog->input);
+ node->plugin_class = _load_plugin_class (this, node->filename, node->info, NULL);
+ }
+
+ node = xine_list_next_content (list);
}
+}
- /*
- * demux plugins
- */
-
- node = xine_list_first_content (this->plugin_catalog->demux);
- while (node) {
-
-#ifdef LOG
- printf("load_plugins: load demux plugin %s from %s\n",
- node->info->id, node->filename);
-#endif
-
- node->plugin_class = _load_plugin_class (this, node->filename, node->info, NULL);
+static void load_required_plugins(xine_t *this) {
- node = xine_list_next_content (this->plugin_catalog->demux);
- }
+ _load_required_plugins (this, this->plugin_catalog->input);
+ _load_required_plugins (this, this->plugin_catalog->demux);
+ _load_required_plugins (this, this->plugin_catalog->spu);
+ _load_required_plugins (this, this->plugin_catalog->audio);
+ _load_required_plugins (this, this->plugin_catalog->video);
+ _load_required_plugins (this, this->plugin_catalog->aout);
+ _load_required_plugins (this, this->plugin_catalog->vout);
+ _load_required_plugins (this, this->plugin_catalog->post);
}
+
#ifdef USE_CACHED_CATALOG
/*
* save plugin list information to file (cached catalog)
@@ -520,7 +523,7 @@ static void save_plugin_list(FILE *fp, xine_list_t *plugins) {
fprintf(fp, "id=%s\n", node->info->id );
fprintf(fp, "version=%lu\n", (unsigned long) node->info->version );
- switch (node->info->type){
+ switch (node->info->type & PLUGIN_TYPE_MASK){
case PLUGIN_VIDEO_OUT:
vo_info = node->info->special_info;
@@ -547,7 +550,7 @@ static void save_plugin_list(FILE *fp, xine_list_t *plugins) {
case PLUGIN_POST:
post_info = node->info->special_info;
- fprintf(fp, "post_type=%d\n", post_info->type);
+ fprintf(fp, "post_type=%lu\n", (unsigned long)post_info->type);
break;
}
@@ -621,7 +624,7 @@ static void load_plugin_list(FILE *fp, xine_list_t *plugins) {
sscanf(value," %d",&i);
node->info->type = i;
- switch (node->info->type){
+ switch (node->info->type & PLUGIN_TYPE_MASK){
case PLUGIN_VIDEO_OUT:
vo_info = node->info->special_info =
@@ -678,9 +681,9 @@ static void load_plugin_list(FILE *fp, xine_list_t *plugins) {
sscanf(value," %d",&i);
decoder_info->priority = i;
} else if( !strcmp("post_type",line) && post_info ) {
- sscanf(value," %d",&i);
- post_info->type = i;
- }
+ sscanf(value," %lu",&lu);
+ post_info->type = lu;
+ }
}
}
}
@@ -941,7 +944,7 @@ void scan_plugins (xine_t *this) {
save_catalog (this);
#endif
- load_plugins (this);
+ load_required_plugins (this);
map_decoders (this);
}
@@ -1732,6 +1735,9 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs,
plugin_catalog_t *catalog = xine->plugin_catalog;
plugin_node_t *node;
+ if( !name )
+ return NULL;
+
pthread_mutex_lock(&catalog->lock);
node = xine_list_first_content(catalog->post);
@@ -1951,7 +1957,7 @@ static void dispose_plugin_list (xine_list_t *list) {
void *cls = node->plugin_class;
/* dispose of plugin class */
- switch (node->info->type) {
+ switch (node->info->type & PLUGIN_TYPE_MASK) {
case PLUGIN_INPUT:
((input_class_t *)cls)->dispose ((input_class_t *)cls);
break;
@@ -1980,7 +1986,7 @@ static void dispose_plugin_list (xine_list_t *list) {
}
/* free special info */
- switch (node->info->type) {
+ switch (node->info->type & PLUGIN_TYPE_MASK) {
case PLUGIN_SPU_DECODER:
case PLUGIN_AUDIO_DECODER:
case PLUGIN_VIDEO_DECODER:
diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h
index 033b817b5..8497b8741 100644
--- a/src/xine-engine/plugin_catalog.h
+++ b/src/xine-engine/plugin_catalog.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: plugin_catalog.h,v 1.10 2002/12/29 14:04:43 mroi Exp $
+ * $Id: plugin_catalog.h,v 1.11 2003/01/03 22:38:29 miguelfreitas Exp $
*
* xine-internal header: Definitions for plugin lists
*
@@ -35,7 +35,7 @@
/* the engine takes this many plugins for one stream type */
#define PLUGINS_PER_TYPE 10
-#define CACHE_CATALOG_VERSION 1
+#define CACHE_CATALOG_VERSION 2
#define CACHE_CATALOG_FILE ".xine/catalog.cache"
#define CACHE_CATALOG_DIR ".xine"
diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h
index fa07f7d5c..823448b50 100644
--- a/src/xine-engine/xine_plugin.h
+++ b/src/xine-engine/xine_plugin.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_plugin.h,v 1.8 2002/12/29 14:04:43 mroi Exp $
+ * $Id: xine_plugin.h,v 1.9 2003/01/03 22:38:29 miguelfreitas Exp $
*
* generic plugin definitions
*
@@ -34,8 +34,14 @@
#define PLUGIN_SPU_DECODER 5
#define PLUGIN_AUDIO_OUT 6
#define PLUGIN_VIDEO_OUT 7
-#define PLUGIN_POST 8
+#define PLUGIN_POST 8
+/* this flag may be or'ed with type in order to force preloading the plugin.
+ * very useful to register config items on xine initialization.
+ */
+#define PLUGIN_MUST_PRELOAD 128
+
+#define PLUGIN_TYPE_MASK 127
typedef struct {
uint8_t type; /* one of the PLUGIN_* constants above */