diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-04-28 19:47:41 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-04-28 19:47:41 +0000 |
commit | 12d67b2b0a4fd1a0bbaea2eb2bb5e5969fef0a54 (patch) | |
tree | ba751a49d2220661b167b56df8b72b12836fa7fb /src/xine-engine/load_plugins.c | |
parent | 77489362597b81f0a4e8771281f4cf94801c3976 (diff) | |
download | xine-lib-12d67b2b0a4fd1a0bbaea2eb2bb5e5969fef0a54.tar.gz xine-lib-12d67b2b0a4fd1a0bbaea2eb2bb5e5969fef0a54.tar.bz2 |
bugfix in video_out_xv, sorted out audio output plugin handling/code
CVS patchset: 39
CVS date: 2001/04/28 19:47:41
Diffstat (limited to 'src/xine-engine/load_plugins.c')
-rw-r--r-- | src/xine-engine/load_plugins.c | 118 |
1 files changed, 94 insertions, 24 deletions
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index fde565b03..7e35e4f6b 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.11 2001/04/27 23:51:52 guenter Exp $ + * $Id: load_plugins.c,v 1.12 2001/04/28 19:47:42 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -458,8 +458,77 @@ vo_driver_t *xine_load_video_output_plugin(config_values_t *config, return NULL; } -ao_functions_t *xine_load_audio_output_plugin(config_values_t *config, - char *id) { +char **xine_list_audio_output_plugins() { + + char **plugin_ids; + int num_plugins = 0; + DIR *dir; + + plugin_ids = xmalloc (50 * sizeof (char *)); + plugin_ids[0] = 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_AUDIO_OUT_PLUGIN_PREFIXNAME, + XINE_AUDIO_OUT_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); + + /* + * 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 { + + ao_info_t* (*getinfo) (); + ao_info_t *ao_info; + + if ((getinfo = dlsym(plugin, "get_audio_out_plugin_info")) != NULL) { + ao_info = getinfo(); + + if ( ao_info->interface_version == AUDIO_OUT_IFACE_VERSION) { + + /* FIXME: sort the list by ao_info->priority */ + + plugin_ids[num_plugins] = ao_info->id; + num_plugins++; + plugin_ids[num_plugins] = NULL; + } + } else { + + printf("load_plugins: %s seems to be an invalid plugin (lacks get_audio_out_plugin_info() function)\n", str); + + } + } + } + } + } else { + perror ("load_plugins: get_available_audio_output_plugins - cannot access plugin dir:"); + } + + return plugin_ids; +} + +ao_functions_t *xine_load_audio_output_plugin(config_values_t *config, char *id) { + DIR *dir; ao_functions_t *aod = NULL; @@ -486,23 +555,30 @@ ao_functions_t *xine_load_audio_output_plugin(config_values_t *config, sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name); if(!(plugin = dlopen (str, RTLD_LAZY))) { - fprintf(stderr, "%s(%d): %s doesn't seem to be installed (%s)\n", - __FILE__, __LINE__, str, dlerror()); - exit(1); - } - else { - void *(*initplug) (int, config_values_t *); + printf("load_plugins: audio output plugin %s failed to link: %s\n", + str, dlerror()); + return NULL; + } else { + void *(*initplug) (config_values_t *); + ao_info_t* (*getinfo) (); + ao_info_t *ao_info; + + if ((getinfo = dlsym(plugin, "get_audio_out_plugin_info")) != NULL) { + ao_info = getinfo(); - if((initplug = dlsym(plugin, "init_audio_out_plugin")) != NULL) { - - aod = (ao_functions_t *) initplug(AUDIO_OUT_PLUGIN_IFACE_VERSION, - config); - - printf("audio output plugin found : %s(ID: %s, iface: %d)\n", - str, aod->get_identifier(), aod->interface_version); + if (!strcmp(id, ao_info->id)) { - if(!strcasecmp(id, aod->get_identifier())) { - return aod; + if((initplug = dlsym(plugin, "init_audio_out_plugin")) != NULL) { + + aod = (ao_functions_t *) initplug(config); + + if (aod) + printf("load_plugins: audio output plugin %s sucessfully loaded.\n", str); + else + printf("load_plugins: audio output plugin %s: init_audio_out_plugin failed.\n", str); + + return aod; + } } } } @@ -512,9 +588,3 @@ ao_functions_t *xine_load_audio_output_plugin(config_values_t *config, return NULL; } -char **xine_list_audio_output_plugins() { - - printf ("load_plugins: FIXME: list_audio_output_plugins not implemented yet\n"); - - return NULL; -} |