summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-06-15 22:17:33 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-06-15 22:17:33 +0000
commitd6a2b329919a1b1882120b001e78f7b43bd63b55 (patch)
treeb803c021163a21c9a1d2bb9f60133f5d3c0017ec /src
parentc2e900b2010d0622db3d4540e569539c78094138 (diff)
downloadxine-lib-d6a2b329919a1b1882120b001e78f7b43bd63b55.tar.gz
xine-lib-d6a2b329919a1b1882120b001e78f7b43bd63b55.tar.bz2
Dont load many times input plugins to get features.
CVS patchset: 188 CVS date: 2001/06/15 22:17:33
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/load_plugins.c159
1 files changed, 26 insertions, 133 deletions
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 7ab6a5c83..94d1bd5d1 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.23 2001/06/14 18:32:57 guenter Exp $
+ * $Id: load_plugins.c,v 1.24 2001/06/15 22:17:33 f1rmb Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -201,152 +201,45 @@ void load_input_plugins (xine_t *this,
}
-char **xine_get_autoplay_input_plugin_ids(xine_t *this) {
- char **plugin_ids;
- int num_plugins = 0;
- DIR *dir;
-
- plugin_ids = xmalloc (50 * sizeof (char *));
- plugin_ids[num_plugins] = NULL;
-
- dir = opendir (XINE_PLUGINDIR);
-
- if (dir) {
- struct dirent *dir_entry;
-
- while ((dir_entry = readdir (dir)) != NULL) {
- char str[1024];
- void *plugin;
- int nLen = strlen (dir_entry->d_name);
-
- if ((strncasecmp(dir_entry->d_name,
- XINE_INPUT_PLUGIN_PREFIXNAME,
- XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH) == 0) &&
- ((dir_entry->d_name[nLen-3]=='.')
- && (dir_entry->d_name[nLen-2]=='s')
- && (dir_entry->d_name[nLen-1]=='o'))) {
-
- sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name);
-
- /* printf ("load_plugins: trying to load plugin %s\n", str); */
+static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) {
+ input_plugin_t *ip;
+ char **plugin_ids;
+ int num_plugins = this->num_input_plugins;
+ int i;
+ int n = 0;
- /*
- * now, see if we can open this plugin,
- * and get it's id
- */
+ if(!num_plugins)
+ return NULL;
- if(!(plugin = dlopen (str, RTLD_LAZY))) {
+ plugin_ids = xmalloc (num_plugins * sizeof (char *));
- /* printf("load_plugins: cannot load plugin %s (%s)\n",
- str, dlerror()); */
+ for(i = 0; i < num_plugins; i++) {
- } else {
+ ip = this->input_plugins[i];
- void *(*initplug) (int, config_values_t *);
-
- if((initplug = dlsym(plugin, "init_input_plugin")) != NULL) {
- input_plugin_t *ip;
-
- ip = (input_plugin_t *) initplug(INPUT_PLUGIN_IFACE_VERSION,
- this->config);
+ 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", */
+/* __FUNCTION__, feature, ip->get_identifier(ip)); */
+ n++;
+ }
- if(((ip->get_capabilities(ip)) & INPUT_CAP_AUTOPLAY)) {
- plugin_ids[num_plugins] = (char *)
- malloc (strlen(ip->get_identifier(ip)+1));
- strcpy (plugin_ids[num_plugins], ip->get_identifier(ip));
- num_plugins++;
- plugin_ids[num_plugins] = NULL;
- }
+ }
- dlclose(plugin);
+ plugin_ids[n] = NULL;
- } else {
- printf ("load_plugins: %s is no valid input plugin "
- "(lacks init_input_plugin() function)\n", str);
- }
- }
- }
- }
- } else {
- fprintf (stderr, "load_plugins: %s - cannot access plugin dir: %s",
- __FUNCTION__, strerror(errno));
- }
-
return plugin_ids;
}
-char **xine_get_browsable_input_plugin_ids(xine_t *this) {
- char **plugin_ids;
- int num_plugins = 0;
- DIR *dir;
-
- plugin_ids = xmalloc (50 * sizeof (char *));
- plugin_ids[num_plugins] = NULL;
-
- dir = opendir (XINE_PLUGINDIR);
-
- if (dir) {
- struct dirent *dir_entry;
-
- while ((dir_entry = readdir (dir)) != NULL) {
- char str[1024];
- void *plugin;
- int nLen = strlen (dir_entry->d_name);
-
- if ((strncasecmp(dir_entry->d_name,
- XINE_INPUT_PLUGIN_PREFIXNAME,
- XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH) == 0) &&
- ((dir_entry->d_name[nLen-3]=='.')
- && (dir_entry->d_name[nLen-2]=='s')
- && (dir_entry->d_name[nLen-1]=='o'))) {
-
- sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name);
-
- /* printf ("load_plugins: trying to load plugin %s\n", str); */
-
- /*
- * now, see if we can open this plugin,
- * and get it's id
- */
-
- if(!(plugin = dlopen (str, RTLD_LAZY))) {
-
- /* printf("load_plugins: cannot load plugin %s (%s)\n",
- str, dlerror()); */
-
- } else {
-
- void *(*initplug) (int, config_values_t *);
-
- if((initplug = dlsym(plugin, "init_input_plugin")) != NULL) {
- input_plugin_t *ip;
-
- ip = (input_plugin_t *) initplug(INPUT_PLUGIN_IFACE_VERSION,
- this->config);
+char **xine_get_autoplay_input_plugin_ids(xine_t *this) {
- if(((ip->get_capabilities(ip)) & INPUT_CAP_AUTOPLAY)) {
- plugin_ids[num_plugins] = (char *)
- malloc (strlen(ip->get_identifier(ip)+1));
- strcpy (plugin_ids[num_plugins], ip->get_identifier(ip));
- num_plugins++;
- plugin_ids[num_plugins] = NULL;
- }
+ return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_AUTOPLAY));
+}
- dlclose(plugin);
+char **xine_get_browsable_input_plugin_ids(xine_t *this) {
- } else {
- printf ("load_plugins: %s is no valid input plugin "
- "(lacks init_input_plugin() function)\n", str);
- }
- }
- }
- }
- } else {
- fprintf (stderr, "load_plugins: %s - cannot access plugin dir: %s",
- __FUNCTION__, strerror(errno));
- }
-
- return plugin_ids;
+ return (_xine_get_featured_input_plugin_ids(this, INPUT_CAP_GET_DIR));
}
/** ***************************************************************