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/demuxers/demux.h | 15 ++++++++------- src/input/input_plugin.h | 18 +++++++++--------- 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 ++++++++------- 8 files changed, 67 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h index 81907cfcf..301fe0f2b 100644 --- a/src/demuxers/demux.h +++ b/src/demuxers/demux.h @@ -53,16 +53,17 @@ struct demux_class_s { */ demux_plugin_t* (*open_plugin) (demux_class_t *this, xine_stream_t *stream, input_plugin_t *input); - /* - * return human readable (verbose = 1 line) description for this plugin + /** + * @brief short human readable identifier for this plugin class */ - const char* (*get_description) (demux_class_t *this); + const char *identifier; - /* - * return human readable identifier for this plugin + /** + * @brief human readable (verbose = 1 line) description for this plugin class + * + * The description is passed to gettext() to internationalise. */ - - const char* (*get_identifier) (demux_class_t *this); + const char *description; /* * return MIME types supported for this plugin diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 3f59bab6c..31a4f9846 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -35,7 +35,7 @@ # include #endif -#define INPUT_PLUGIN_IFACE_VERSION 17 +#define INPUT_PLUGIN_IFACE_VERSION 18 typedef struct input_class_s input_class_t ; typedef struct input_plugin_s input_plugin_t; @@ -48,17 +48,17 @@ struct input_class_s { */ input_plugin_t* (*get_instance) (input_class_t *this, xine_stream_t *stream, const char *mrl); - /* - * return short, human readable identifier for this plugin class - * The returned string should not be malloc'd as it is not freed. + /** + * @brief short human readable identifier for this plugin class */ - const char* (*get_identifier) (input_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* (*get_description) (input_class_t *this); + const char *description; /* * ls function, optional: may be NULL 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