From 90b866329e8962a3f1f03dc8172cf75ccc9d2b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 10:49:51 +0100 Subject: Replace get_identifier/get_description functions with strings. This is the start of a new experimental branch, with the first objective being the replacement of the get_description and get_identifier functions with direct-access strings. The reason for this change is to reduce code size and time of execution. By replacing the functions with direct-access strings there is one less call to be done in those cases where the description has to be fetched. The solution is not yet definitive though, there are a couple of problems to take care of: - the use of N_() still makes it easy to internationalise the strings, but it requires for the string to be found on libxine2 catalog, which is not exactly a nice solution for external plugins; - it would be simpler to re-use the id field in plugin_info_t, and then move description there; it should reduce memory usage for the class structures; - I'm not really aware of any reason why get_description and get_identifier were used beside the idea of making i18n simpler. This probably would break a couple of frontends, especially if they have some internal plugins (like post-plugins), so it needs to be reviewed carefully before merging in 1.2 branch. My current goal is to get this in before 1.2 though, rather than waiting for 1.3. --- src/xine-engine/audio_decoder.h | 15 ++++++++------- src/xine-engine/audio_out.h | 15 ++++++++------- src/xine-engine/post.h | 15 ++++++++------- src/xine-engine/spu_decoder.h | 17 +++++++++-------- src/xine-engine/video_decoder.h | 17 +++++++++-------- src/xine-engine/video_out.h | 15 ++++++++------- 6 files changed, 50 insertions(+), 44 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index 8f75ba242..7ad46e2f8 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -47,16 +47,17 @@ struct audio_decoder_class_s { */ audio_decoder_t* (*open_plugin) (audio_decoder_class_t *this, xine_stream_t *stream); - /* - * return short, human readable identifier for this plugin class + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (audio_decoder_class_t *this); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (audio_decoder_class_t *this); + const char *description; /* * free all class-related resources diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 6ead6505e..415c47cc7 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -237,16 +237,17 @@ struct audio_driver_class_s { */ ao_driver_t* (*open_plugin) (audio_driver_class_t *, const void *data); - /* - * return short, human readable identifier for this plugin class + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (audio_driver_class_t *); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (audio_driver_class_t *); + const char *description; /* * free all class-related resources diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 6186f31e0..006daa20c 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -54,16 +54,17 @@ struct post_class_s { xine_audio_port_t **audio_target, xine_video_port_t **video_target); - /* - * return short, human readable identifier for this plugin class + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (post_class_t *this); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (post_class_t *this); + const char *description; /* * free all class-related resources diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index 66ab5e54a..7acd8618d 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -48,17 +48,18 @@ struct spu_decoder_class_s { */ spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this, xine_stream_t *stream); - /* - * return short, human readable identifier for this plugin class + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (spu_decoder_class_t *this); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (spu_decoder_class_t *this); - + const char *description; + /* * free all class-related resources */ diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index 7b13159a3..7dfd10a14 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -47,17 +47,18 @@ struct video_decoder_class_s { * open a new instance of this plugin class */ video_decoder_t* (*open_plugin) (video_decoder_class_t *this, xine_stream_t *stream); - - /* - * return short, human readable identifier for this plugin class + + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (video_decoder_class_t *this); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (video_decoder_class_t *this); + const char *description; /* * free all class-related resources diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index db99334eb..161fbd899 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -369,16 +369,17 @@ struct video_driver_class_s { */ vo_driver_t* (*open_plugin) (video_driver_class_t *self, const void *visual); - /* - * return short, human readable identifier for this plugin class + /** + * @brief short human readable identifier for this plugin class */ - char* (*get_identifier) (video_driver_class_t *self); + const char *identifier; - /* - * return human readable (verbose = 1 line) description for - * this plugin class + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - char* (*get_description) (video_driver_class_t *self); + const char *description; /* * free all class-related resources -- cgit v1.2.3 From 60e025ce15431f04955502084bc54c18d69c7d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 10:50:12 +0100 Subject: Update the code not to use the get_* functions that were removed. --- src/xine-engine/load_plugins.c | 2 +- src/xine-engine/xine.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 19a8b4e05..1c59099a5 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2299,7 +2299,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, uint32_t type) { else \ return NULL; \ } \ - return ic->get_description(ic); \ + return gettext(ic->description); \ } \ } \ return NULL; \ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 77430a053..abd9a932c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -862,11 +862,11 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { int res; xine_log (stream->xine, XINE_LOG_MSG, _("xine: found input plugin : %s\n"), - stream->input_plugin->input_class->get_description(stream->input_plugin->input_class)); + gettext(stream->input_plugin->input_class->description)); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, - (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class))); + stream->input_plugin->input_class->identifier); res = (stream->input_plugin->open) (stream->input_plugin); switch(res) { @@ -929,7 +929,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { } _x_meta_info_set_utf8(stream, XINE_META_INFO_SYSTEMLAYER, - (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); + stream->demux_plugin->demux_class->identifier); free(demux_name); } else { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); @@ -1004,7 +1004,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { lprintf ("demux and input plugin found\n"); _x_meta_info_set_utf8(stream, XINE_META_INFO_SYSTEMLAYER, - (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); + stream->demux_plugin->demux_class->identifier); free(demux_name); } else { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); @@ -1210,11 +1210,11 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { lprintf ("demux and input plugin found\n"); _x_meta_info_set_utf8(stream, XINE_META_INFO_SYSTEMLAYER, - (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); + stream->demux_plugin->demux_class->identifier); } xine_log (stream->xine, XINE_LOG_MSG, _("xine: found demuxer plugin: %s\n"), - stream->demux_plugin->demux_class->get_description(stream->demux_plugin->demux_class)); + gettext(stream->demux_plugin->demux_class->description)); _x_extra_info_reset( stream->current_extra_info ); _x_extra_info_reset( stream->video_decoder_extra_info ); -- cgit v1.2.3 From 051c26d8e93ce4eacf071c068b32fe9c06b3739d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 10:58:08 +0100 Subject: Leave to the plugin the call to gettext exactly as before. This way external plugins can use their own gettext catalog for i18n. --- src/xine-engine/load_plugins.c | 2 +- src/xine-engine/xine.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 1c59099a5..22d199295 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2299,7 +2299,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, uint32_t type) { else \ return NULL; \ } \ - return gettext(ic->description); \ + return ic->description; \ } \ } \ return NULL; \ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index abd9a932c..eb5d624e2 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -862,7 +862,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { int res; xine_log (stream->xine, XINE_LOG_MSG, _("xine: found input plugin : %s\n"), - gettext(stream->input_plugin->input_class->description)); + stream->input_plugin->input_class->description); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, @@ -1214,7 +1214,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { } xine_log (stream->xine, XINE_LOG_MSG, _("xine: found demuxer plugin: %s\n"), - gettext(stream->demux_plugin->demux_class->description)); + stream->demux_plugin->demux_class->description); _x_extra_info_reset( stream->current_extra_info ); _x_extra_info_reset( stream->video_decoder_extra_info ); -- cgit v1.2.3 From 5b812f5ae063e9e6dadb4eff65bbbe78e977c6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 14:02:35 +0100 Subject: Add a textdomain field to allow using a different i18n catalog for the description translation. --- src/xine-engine/audio_decoder.h | 5 +++++ src/xine-engine/audio_out.h | 5 +++++ src/xine-engine/post.h | 5 +++++ src/xine-engine/spu_decoder.h | 5 +++++ src/xine-engine/video_decoder.h | 5 +++++ src/xine-engine/video_out.h | 5 +++++ 6 files changed, 30 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index 7ad46e2f8..df8556902 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -59,6 +59,11 @@ struct audio_decoder_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 415c47cc7..32d9d5813 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -249,6 +249,11 @@ struct audio_driver_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 006daa20c..940f269e1 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -66,6 +66,11 @@ struct post_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index 7acd8618d..badf15e41 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -60,6 +60,11 @@ struct spu_decoder_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index 7dfd10a14..249b86b4c 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -60,6 +60,11 @@ struct video_decoder_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 161fbd899..e81947276 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -381,6 +381,11 @@ struct video_driver_class_s { */ const char *description; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ -- cgit v1.2.3 From c17489d9fc412f779631fad1ad97b15fbffa5276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 14:03:29 +0100 Subject: Use dgettext to localise the description string for plugins. --- src/xine-engine/load_plugins.c | 2 +- src/xine-engine/xine.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 22d199295..3e6708e65 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2299,7 +2299,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, uint32_t type) { else \ return NULL; \ } \ - return ic->description; \ + return dgettext(ic->textdomain ? : XINE_TEXTDOMAIN, ic->description); \ } \ } \ return NULL; \ diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index eb5d624e2..17ea5d679 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -862,7 +862,8 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { int res; xine_log (stream->xine, XINE_LOG_MSG, _("xine: found input plugin : %s\n"), - stream->input_plugin->input_class->description); + dgettext(stream->input_plugin->input_class->textdomain ? : XINE_TEXTDOMAIN, + stream->input_plugin->input_class->description)); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, @@ -1214,7 +1215,8 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { } xine_log (stream->xine, XINE_LOG_MSG, _("xine: found demuxer plugin: %s\n"), - stream->demux_plugin->demux_class->description); + dgettext(stream->demux_plugin->demux_class->textdomain ? : XINE_TEXTDOMAIN, + stream->demux_plugin->demux_class->description)); _x_extra_info_reset( stream->current_extra_info ); _x_extra_info_reset( stream->video_decoder_extra_info ); -- cgit v1.2.3 From 448923a2d401f3e21eb586f50c1ca9e2dd6259d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 14:26:34 +0100 Subject: Define free() as the default dispose function for plugin classes. Most plugin classes in xine define a dispose function simply to call free(), but free() is ABI-compatible with our dispose functions, so add a macro that allows to pass free() directly as dispose function. It's an opt-in so that no extra conditional is needed, and plugin authors won't forget about providing a dispose function (if they need to). --- src/xine-engine/audio_decoder.h | 1 + src/xine-engine/audio_out.h | 2 ++ src/xine-engine/post.h | 2 ++ src/xine-engine/spu_decoder.h | 3 ++- src/xine-engine/video_decoder.h | 1 + src/xine-engine/video_out.h | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index df8556902..f5a9f506e 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -71,6 +71,7 @@ struct audio_decoder_class_s { void (*dispose) (audio_decoder_class_t *this); }; +#define default_audio_decoder_class_dispose (void (*) (audio_decoder_class_t *this))free struct audio_decoder_s { diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 32d9d5813..0dffa6620 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -261,6 +261,8 @@ struct audio_driver_class_s { void (*dispose) (audio_driver_class_t *); }; +#define default_audio_driver_class_dispose (void (*) (audio_driver_class_t *this))free + /** * @brief Initialise the audio_out sync routines * diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 940f269e1..1995ca82f 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -78,6 +78,8 @@ struct post_class_s { void (*dispose) (post_class_t *this); }; +#define default_post_class_dispose (void (*) (post_class_t *this))free + struct post_plugin_s { /* public part of the plugin */ diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index badf15e41..2a7337c71 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -70,7 +70,8 @@ struct spu_decoder_class_s { */ void (*dispose) (spu_decoder_class_t *this); }; - + +#define default_spu_decoder_class_dispose (void (*) (spu_decoder_class_t *this))free struct spu_decoder_s { diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index 249b86b4c..ed3386717 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -71,6 +71,7 @@ struct video_decoder_class_s { void (*dispose) (video_decoder_class_t *this); }; +#define default_video_decoder_class_dispose (void (*) (video_decoder_class_t *this))free struct video_decoder_s { diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index e81947276..39dbe0caa 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -392,6 +392,7 @@ struct video_driver_class_s { void (*dispose) (video_driver_class_t *self); }; +#define default_video_driver_class_dispose (void (*) (video_driver_class_t *this))free typedef struct rle_elem_s { uint16_t len; -- cgit v1.2.3 From b9dffdcf551ccd23b31618cf86716082e9f50f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 18:08:49 +0100 Subject: Bump the interface version for SPU decoders. --- src/xine-engine/spu_decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index 2a7337c71..dcf9107f7 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -32,7 +32,7 @@ # include #endif -#define SPU_DECODER_IFACE_VERSION 16 +#define SPU_DECODER_IFACE_VERSION 17 /* * generic xine spu decoder plugin interface -- cgit v1.2.3 From 0c1d668e424582f9d748ca3dae96c845aca4c65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 18:13:54 +0100 Subject: Bump the interface version for audio output plugins. --- src/xine-engine/audio_out.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 0dffa6620..bd1b910df 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -37,7 +37,7 @@ extern "C" { #endif -#define AUDIO_OUT_IFACE_VERSION 8 +#define AUDIO_OUT_IFACE_VERSION 9 /* * ao_driver_s contains the driver every audio output -- cgit v1.2.3 From 158ced5414ebb912f1d5111d2303097c7206f656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 18:15:14 +0100 Subject: Bump the interface version for video output plugins. --- src/xine-engine/video_out.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 39dbe0caa..8efdae9f6 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -291,7 +291,7 @@ struct xine_video_port_s { * from generic vo functions. */ -#define VIDEO_OUT_DRIVER_IFACE_VERSION 21 +#define VIDEO_OUT_DRIVER_IFACE_VERSION 22 struct vo_driver_s { -- cgit v1.2.3 From 5d4f71c06873aea6df30b07abb84e7bdace5d54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 18:19:30 +0100 Subject: Bump the interface version for audio decoder plugins. --- src/xine-engine/audio_decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index f5a9f506e..307692b81 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -31,7 +31,7 @@ # include #endif -#define AUDIO_DECODER_IFACE_VERSION 15 +#define AUDIO_DECODER_IFACE_VERSION 16 /* * generic xine audio decoder plugin interface -- cgit v1.2.3 From 86af045eabd1e30e41a9750a6d48fa3ed8767df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 18:21:13 +0100 Subject: Bump the interface version for video decoder plugins. --- src/xine-engine/video_decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index ed3386717..705efa3da 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -31,7 +31,7 @@ # include #endif -#define VIDEO_DECODER_IFACE_VERSION 18 +#define VIDEO_DECODER_IFACE_VERSION 19 /* -- cgit v1.2.3 From 161cc6fe26901b63fc04a85432018b2aaad371f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 19:13:09 +0100 Subject: Update the plugins loader to use the new extensions and mimetypes attributes. --- src/xine-engine/load_plugins.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 3e6708e65..717f81786 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2429,6 +2429,7 @@ char *xine_get_file_extensions (xine_t *self) { plugin_node_t *node; char *str; int list_id, list_size; + const char *exts; pthread_mutex_lock (&catalog->lock); @@ -2438,14 +2439,13 @@ char *xine_get_file_extensions (xine_t *self) { list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - const char *exts; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { cls = (demux_class_t *)node->plugin_class; - if((exts = cls->get_extensions(cls)) && *exts) + if( (exts = cls->extensions) && *exts ) len += strlen(exts) + 1; } } @@ -2457,7 +2457,6 @@ char *xine_get_file_extensions (xine_t *self) { list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - const char *e; int l; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); @@ -2465,9 +2464,9 @@ char *xine_get_file_extensions (xine_t *self) { cls = (demux_class_t *)node->plugin_class; - if((e = cls->get_extensions (cls)) && *e) { - l = strlen(e); - memcpy (&str[pos], e, l); + if((exts = cls->extensions) && *exts) { + l = strlen(exts); + memcpy (&str[pos], exts, l); pos += l; @@ -2507,16 +2506,14 @@ char *xine_get_mime_types (xine_t *self) { for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - const char *s; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { cls = (demux_class_t *)node->plugin_class; - s = cls->get_mimetypes (cls); - if (s) - len += strlen(s); + if ( cls->mimetypes ); + len += strlen(cls->mimetypes); } } @@ -2529,18 +2526,15 @@ char *xine_get_mime_types (xine_t *self) { for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - const char *s; - int l; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { cls = (demux_class_t *)node->plugin_class; - s = cls->get_mimetypes (cls); - if (s) { - l = strlen(s); - memcpy (&str[pos], s, l); + if (cls->mimetypes) { + const size_t l = strlen(cls->mimetypes); + memcpy (&str[pos], cls->mimetypes, l); pos += l; } @@ -2586,9 +2580,8 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { cls = (demux_class_t *)node->plugin_class; - mt = cls->get_mimetypes (cls); - if (mt) { - mime_demux = strdup(mt); + if (cls->mimetypes) { + mime_demux = strdup(cls->mimetypes); for(s=mime_demux; *s; s++) *s = tolower(*s); -- cgit v1.2.3 From 68fa754870eac5150ae6e96a1a5e18c1f07f63dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 19:21:21 +0100 Subject: Check if the extension is compatible with the plugin before trying to open it. --- src/xine-engine/load_plugins.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 717f81786..0a885f2d9 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1298,6 +1298,12 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probing demux '%s'\n", node->info->id); if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) { + if ( stream->content_detection_method == METHOD_BY_EXTENSION && + ! _x_demux_check_extension(input->get_mrl(input), + ((demux_class_t *)node->plugin_class)->extensions) + ) + continue; + if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { inc_node_ref(node); plugin->node = node; @@ -1357,6 +1363,13 @@ demux_plugin_t *_x_find_demux_plugin_by_name(xine_stream_t *stream, const char * if (strcasecmp(node->info->id, name) == 0) { if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) { + + if ( stream->content_detection_method == METHOD_BY_EXTENSION && + ! _x_demux_check_extension(input->get_mrl(input), + ((demux_class_t *)node->plugin_class)->extensions) + ) + continue; + if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { inc_node_ref(node); plugin->node = node; @@ -1414,6 +1427,14 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); if (node->plugin_class || _load_plugin_class(xine, node, NULL)) { + + if ( stream->content_detection_method == METHOD_BY_EXTENSION && + ! _x_demux_check_extension(input->get_mrl(input), + ((demux_class_t *)node->plugin_class)->extensions) + ) + continue; + + if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: using demuxer '%s' (instead of '%s')\n", node->info->id, last_demux_name); -- cgit v1.2.3 From ef8cf26197068261acd3ff8dc37f664fe979d337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 19:21:46 +0100 Subject: Remove stray variable. --- src/xine-engine/load_plugins.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 0a885f2d9..4103df507 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2581,7 +2581,6 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { char *id = NULL; char *mime_arg, *mime_demux; char *s; - const char *mt; int list_id, list_size; /* create a copy and convert to lower case */ -- cgit v1.2.3 From c818bc04294ababd55f33c52ed4ac3f6e1b4ca3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 19:23:11 +0100 Subject: Let _x_demux_check_extension() consider empty extensions string as an always-pass. --- src/xine-engine/demux.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/xine-engine') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index f33397256..379d552bf 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -449,6 +449,10 @@ int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t si int _x_demux_check_extension (const char *mrl, const char *extensions){ char *last_dot, *e, *ext_copy, *ext_work; + /* An empty extensions string means that the by-extension method can't + be used, so consider those cases as always passing. */ + if ( extensions == NULL ) return 1; + ext_copy = strdup(extensions); ext_work = ext_copy; -- cgit v1.2.3 From f77028285a231edada74b0d93e4198fa8179880e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 20:09:04 +0100 Subject: Rename METHOD_BY_EXTENSION to METHOD_BY_MRL, as it's used to identify protocols too. --- src/xine-engine/load_plugins.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 4103df507..08ddc9424 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1298,7 +1298,7 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probing demux '%s'\n", node->info->id); if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) { - if ( stream->content_detection_method == METHOD_BY_EXTENSION && + if ( stream->content_detection_method == METHOD_BY_MRL && ! _x_demux_check_extension(input->get_mrl(input), ((demux_class_t *)node->plugin_class)->extensions) ) @@ -1325,16 +1325,16 @@ demux_plugin_t *_x_find_demux_plugin (xine_stream_t *stream, input_plugin_t *inp switch (stream->xine->demux_strategy) { case XINE_DEMUX_DEFAULT_STRATEGY: - return probe_demux (stream, METHOD_BY_CONTENT, METHOD_BY_EXTENSION, input); + return probe_demux (stream, METHOD_BY_CONTENT, METHOD_BY_MRL, input); case XINE_DEMUX_REVERT_STRATEGY: - return probe_demux (stream, METHOD_BY_EXTENSION, METHOD_BY_CONTENT, input); + return probe_demux (stream, METHOD_BY_MRL, METHOD_BY_CONTENT, input); case XINE_DEMUX_CONTENT_STRATEGY: return probe_demux (stream, METHOD_BY_CONTENT, -1, input); case XINE_DEMUX_EXTENSION_STRATEGY: - return probe_demux (stream, METHOD_BY_EXTENSION, -1, input); + return probe_demux (stream, METHOD_BY_MRL, -1, input); default: xprintf (stream->xine, XINE_VERBOSITY_LOG, @@ -1364,7 +1364,7 @@ demux_plugin_t *_x_find_demux_plugin_by_name(xine_stream_t *stream, const char * if (strcasecmp(node->info->id, name) == 0) { if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) { - if ( stream->content_detection_method == METHOD_BY_EXTENSION && + if ( stream->content_detection_method == METHOD_BY_MRL && ! _x_demux_check_extension(input->get_mrl(input), ((demux_class_t *)node->plugin_class)->extensions) ) @@ -1402,7 +1402,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha demux_plugin_t *plugin = NULL; methods[0] = METHOD_BY_CONTENT; - methods[1] = METHOD_BY_EXTENSION; + methods[1] = METHOD_BY_MRL; methods[2] = -1; i = 0; @@ -1428,7 +1428,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha "load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); if (node->plugin_class || _load_plugin_class(xine, node, NULL)) { - if ( stream->content_detection_method == METHOD_BY_EXTENSION && + if ( stream->content_detection_method == METHOD_BY_MRL && ! _x_demux_check_extension(input->get_mrl(input), ((demux_class_t *)node->plugin_class)->extensions) ) -- cgit v1.2.3 From 47e34b5c2e7649f647597c9551d241de1a1df23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 20:20:22 +0100 Subject: Make _x_demux_check_extension check for protocol prefixes too if :/ is in the string. --- src/xine-engine/demux.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 379d552bf..405384626 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -448,6 +448,7 @@ int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t si int _x_demux_check_extension (const char *mrl, const char *extensions){ char *last_dot, *e, *ext_copy, *ext_work; + int found = 0; /* An empty extensions string means that the by-extension method can't be used, so consider those cases as always passing. */ @@ -459,15 +460,21 @@ int _x_demux_check_extension (const char *mrl, const char *extensions){ last_dot = strrchr (mrl, '.'); if (last_dot) { last_dot++; - while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) { - if (strcasecmp (last_dot, e) == 0) { - free(ext_copy); - return 1; + } + + while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) { + if ( strstr(e, ":/") ) { + if ( strcasecmp (mrl, e) == 0 ) { + found = 1; + break; } + } else if (strcasecmp (last_dot, e) == 0) { + found = 1; + break; } } free(ext_copy); - return 0; + return found; } -- cgit v1.2.3 From 0c14df4d032947b635815e7acf537bd6a49315e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 20:43:05 +0100 Subject: Check if a dot was found before dereferencing the pointer. --- src/xine-engine/demux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 405384626..187c27873 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -468,9 +468,11 @@ int _x_demux_check_extension (const char *mrl, const char *extensions){ found = 1; break; } - } else if (strcasecmp (last_dot, e) == 0) { - found = 1; - break; + } else if (last_dot) { + if (strcasecmp (last_dot, e) == 0) { + found = 1; + break; + } } } free(ext_copy); -- cgit v1.2.3 From 0a83e75a5caea6537ea4bede87d7cfaaa4a1a0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Dec 2007 21:01:45 +0100 Subject: Don't export _x_demux_check_extension, now that plugins don't need it anymore. --- src/xine-engine/xine_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 48aafa3f3..7e57640c0 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -446,7 +446,7 @@ void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_ int _x_demux_start_thread (xine_stream_t *stream) XINE_PROTECTED; int _x_demux_stop_thread (xine_stream_t *stream) XINE_PROTECTED; int _x_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size) XINE_PROTECTED; -int _x_demux_check_extension (const char *mrl, const char *extensions) XINE_PROTECTED; +int _x_demux_check_extension (const char *mrl, const char *extensions); off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; -- cgit v1.2.3