From 73323efba4f2da47ea7de0fcea2b022d0c297ded Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Thu, 5 Sep 2002 16:24:14 +0000 Subject: first steps towards implementing plugin list functions CVS patchset: 2613 CVS date: 2002/09/05 16:24:14 --- src/xine-engine/load_plugins.c | 54 ++++++++++++++++------------------------ src/xine-engine/plugin_catalog.h | 6 ++++- src/xine-engine/xine_plugin.h | 4 +-- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index fea86521e..276513db6 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.81 2002/09/04 23:31:13 guenter Exp $ + * $Id: load_plugins.c,v 1.82 2002/09/05 16:24:14 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -222,12 +222,14 @@ static void collect_plugins(xine_t *this, char *path){ plugin_name = str; if(!(lib = dlopen (str, RTLD_LAZY))) { - char *dl_error_msg = dlerror(); #ifdef LOG - /* too noisy */ - printf ("load_plugins: cannot open plugin lib %s:\n%s\n", - str, dl_error_msg); + { + char *dl_error_msg = dlerror(); + /* too noisy */ + printf ("load_plugins: cannot open plugin lib %s:\n%s\n", + str, dl_error_msg); + } #endif } else { @@ -554,44 +556,32 @@ void scan_plugins (xine_t *this) { map_decoders (this); } - - static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) { - /* FIXME */ - -#if 0 + plugin_catalog_t *catalog; + int i; + plugin_node_t *node; - input_plugin_t *ip; - char **plugin_ids; - int i; - int n = 0; + catalog = this->plugin_catalog; - if(!this->num_input_plugins) - return NULL; + i = 0; + node = xine_list_first_content (catalog->input); + while (node) { + input_plugin_t *ip; - plugin_ids = (char **) xine_xmalloc (this->num_input_plugins * sizeof (char *)); + ip = (input_plugin_t *) node->plugin; + if (ip->get_capabilities(ip) & feature) { - for(i = 0; i < this->num_input_plugins; i++) { - - ip = this->input_plugins[i]; + catalog->ids[i] = node->info->id; - if(ip->get_capabilities(ip) & feature) { - plugin_ids[n] = (char *) malloc (strlen(ip->get_identifier(ip)) + 1 ); - strcpy (plugin_ids[n], ip->get_identifier(ip)); - /* printf("%s(%d): %s is featured\n", */ - /* __XINE_FUNCTION__, feature, ip->get_identifier(ip)); */ - n++; + i++; } - + node = xine_list_next_content (this->plugin_catalog->input); } - plugin_ids[n] = NULL; - - return plugin_ids; + catalog->ids[i] = NULL; -#endif - return NULL; + return catalog->ids; } char **xine_get_autoplay_input_plugin_ids(xine_t *this) { diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h index e674f389d..e851a17a8 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.2 2002/09/04 23:31:13 guenter Exp $ + * $Id: plugin_catalog.h,v 1.3 2002/09/05 16:24:14 guenter Exp $ * * xine-internal header: Definitions for plugin lists * @@ -30,6 +30,7 @@ #include "xineutils.h" #define DECODER_MAX 256 +#define PLUGIN_MAX 256 typedef struct { char *filename; @@ -49,6 +50,9 @@ struct plugin_catalog_s { plugin_node_t *audio_decoder_map[DECODER_MAX]; plugin_node_t *video_decoder_map[DECODER_MAX]; plugin_node_t *spu_decoder_map[DECODER_MAX]; + + char *ids[PLUGIN_MAX]; + }; typedef struct plugin_catalog_s plugin_catalog_t; diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h index c9ebc6055..99297cc7e 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.2 2002/09/04 23:31:13 guenter Exp $ + * $Id: xine_plugin.h,v 1.3 2002/09/05 16:24:14 guenter Exp $ * * generic plugin definitions * @@ -39,7 +39,7 @@ typedef struct { uint8_t type; /* one of the PLUGIN_* constants above */ uint8_t API; /* API version supported by this plugin */ - const char *id; /* a name that identifies this plugin */ + char *id; /* a name that identifies this plugin */ uint32_t version; /* version number, increased every release */ void *special_info; /* plugin-type specific, see structs below */ void *(*init)(xine_t *, void *); /* used to get/initialize an instance*/ -- cgit v1.2.3