diff options
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/audio_decoder.h | 23 | ||||
-rw-r--r-- | src/xine-engine/audio_out.h | 24 | ||||
-rw-r--r-- | src/xine-engine/demux.c | 21 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 63 | ||||
-rw-r--r-- | src/xine-engine/post.h | 22 | ||||
-rw-r--r-- | src/xine-engine/spu_decoder.h | 25 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.h | 25 | ||||
-rw-r--r-- | src/xine-engine/video_out.h | 23 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 14 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 2 |
10 files changed, 157 insertions, 85 deletions
diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index 8f75ba242..307692b81 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -31,7 +31,7 @@ # include <xine/buffer.h> #endif -#define AUDIO_DECODER_IFACE_VERSION 15 +#define AUDIO_DECODER_IFACE_VERSION 16 /* * generic xine audio decoder plugin interface @@ -47,17 +47,23 @@ 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; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ @@ -65,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 6ead6505e..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 @@ -237,17 +237,23 @@ 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; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ @@ -255,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/demux.c b/src/xine-engine/demux.c index f33397256..187c27873 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -448,6 +448,11 @@ 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. */ + if ( extensions == NULL ) return 1; ext_copy = strdup(extensions); ext_work = ext_copy; @@ -455,15 +460,23 @@ 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 ) { + } + + while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) { + if ( strstr(e, ":/") ) { + if ( strcasecmp (mrl, e) == 0 ) { + found = 1; + break; + } + } else if (last_dot) { if (strcasecmp (last_dot, e) == 0) { - free(ext_copy); - return 1; + found = 1; + break; } } } free(ext_copy); - return 0; + return found; } diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 19a8b4e05..08ddc9424 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_MRL && + ! _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; @@ -1319,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, @@ -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_MRL && + ! _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; @@ -1389,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; @@ -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_MRL && + ! _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); @@ -2299,7 +2320,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, uint32_t type) { else \ return NULL; \ } \ - return ic->get_description(ic); \ + return dgettext(ic->textdomain ? : XINE_TEXTDOMAIN, ic->description); \ } \ } \ return NULL; \ @@ -2429,6 +2450,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 +2460,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 +2478,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 +2485,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 +2527,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 +2547,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; } @@ -2566,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 */ @@ -2586,9 +2600,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); diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 6186f31e0..1995ca82f 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -54,17 +54,23 @@ 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; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ @@ -72,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 66ab5e54a..dcf9107f7 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -32,7 +32,7 @@ # include <xine/buffer.h> #endif -#define SPU_DECODER_IFACE_VERSION 16 +#define SPU_DECODER_IFACE_VERSION 17 /* * generic xine spu decoder plugin interface @@ -48,23 +48,30 @@ 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. + */ + const char *description; + + /** + * @brief Optional non-standard catalog to use with dgettext() for description. */ - char* (*get_description) (spu_decoder_class_t *this); + const char *textdomain; /* * free all class-related resources */ 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 7b13159a3..705efa3da 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -31,7 +31,7 @@ # include <xine/buffer.h> #endif -#define VIDEO_DECODER_IFACE_VERSION 18 +#define VIDEO_DECODER_IFACE_VERSION 19 /* @@ -47,24 +47,31 @@ 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; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ 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 db99334eb..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 { @@ -369,23 +369,30 @@ 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; + /** + * @brief Optional non-standard catalog to use with dgettext() for description. + */ + const char *textdomain; + /* * free all class-related resources */ 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; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 77430a053..17ea5d679 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -862,11 +862,12 @@ 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)); + 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, - (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 +930,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 +1005,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 +1211,12 @@ 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)); + 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 ); 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; |