summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/load_plugins.c261
-rw-r--r--src/xine-engine/video_out.h52
-rw-r--r--src/xine-engine/xine_internal.h87
3 files changed, 225 insertions, 175 deletions
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 4ff20ecf2..fde565b03 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.10 2001/04/27 11:32:39 f1rmb Exp $
+ * $Id: load_plugins.c,v 1.11 2001/04/27 23:51:52 guenter Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -41,11 +41,10 @@
#include "video_out.h"
#include "metronom.h"
#include "configfile.h"
+#include "utils.h"
#include "monitor.h"
-/*
- *
- */
+
void load_demux_plugins (xine_t *this,
config_values_t *config, int iface_version) {
DIR *dir;
@@ -121,9 +120,7 @@ void load_demux_plugins (xine_t *this,
this->cur_demuxer_plugin = NULL;
}
-/*
- *
- */
+
void load_input_plugins (xine_t *this,
config_values_t *config, int iface_version) {
DIR *dir;
@@ -323,106 +320,132 @@ void load_decoder_plugins (xine_t *this,
}
-void load_video_out_plugins (xine_t *this,
- config_values_t *config, int iface_version) {
+char **xine_list_video_output_plugins (int visual_type) {
- if(this == NULL || config == NULL) {
- printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __FUNCTION__, __LINE__);
- exit(1);
- }
+ char **plugin_ids;
+ int num_plugins = 0;
+ DIR *dir;
-}
+ plugin_ids = xmalloc (50 * sizeof (char *));
+ plugin_ids[0] = NULL;
-void load_audio_out_plugins (xine_t *this,
- config_values_t *config, int iface_version) {
+ 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_VIDEO_OUT_PLUGIN_PREFIXNAME,
+ XINE_VIDEO_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'))) {
+
+ /*printf ("load_plugins: found a video output plugin: %s\n",
+ dir_entry->d_name); */
- if(this == NULL || config == NULL) {
- printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __FUNCTION__, __LINE__);
- exit(1);
- }
+ sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name);
+
+ /*
+ * now, see if we can open this plugin,
+ * check if it has got the right visual type
+ * and finally if all this went through get it's id
+ */
+
+ if(!(plugin = dlopen (str, RTLD_LAZY))) {
+
+ /* printf("load_plugins: cannot load plugin %s (%s)\n",
+ str, dlerror()); */
+
+ } else {
+
+ vo_info_t* (*getinfo) ();
+ vo_info_t *vo_info;
+
+ if ((getinfo = dlsym(plugin, "get_video_out_plugin_info")) != NULL) {
+ vo_info = getinfo();
+
+ if ( (vo_info->visual_type == visual_type)
+ && (vo_info->interface_version == VIDEO_OUT_IFACE_VERSION) ) {
+ /* printf("video output plugin found : %s (%s)\n",
+ vo_info->id, vo_info->description); */
+
+ /* FIXME: sort the list by vo_info->priority */
+
+ plugin_ids[num_plugins] = vo_info->id;
+ num_plugins++;
+ plugin_ids[num_plugins] = NULL;
+ }
+ } else {
+
+ printf("load_plugins: %s seems to be an invalid plugin (lacks get_video_out_plugin_info() function)\n", str);
+ }
+ }
+ }
+ }
+ } else {
+ perror ("load_plugins: get_available_video_output_plugins - cannot access plugin dir:");
+ }
+
+ return plugin_ids;
}
+
vo_driver_t *xine_load_video_output_plugin(config_values_t *config,
- char *filename, char *id,
- int visual_type, void *visual) {
+ char *id, int visual_type, void *visual) {
DIR *dir;
- vo_driver_t *vod = NULL;
-
- if((filename == NULL && id == NULL) || visual == NULL || config == NULL) {
- printf("%s(%s@%d): parameter(s) should be non null.\n",
- __FILE__, __FUNCTION__, __LINE__);
- return NULL;
- }
+ vo_driver_t *vod;
dir = opendir (XINE_PLUGINDIR);
if (dir) {
- struct dirent *pEntry;
+ struct dirent *dir_entry;
- while ((pEntry = readdir (dir)) != NULL) {
+ while ((dir_entry = readdir (dir)) != NULL) {
char str[1024];
void *plugin;
- int nLen = strlen (pEntry->d_name);
- vod = NULL;
- memset(&str, 0, 1024);
-
- if ((strncasecmp(pEntry->d_name,
+ int nLen = strlen (dir_entry->d_name);
+
+ if ((strncasecmp(dir_entry->d_name,
XINE_VIDEO_OUT_PLUGIN_PREFIXNAME,
XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH) == 0) &&
- ((pEntry->d_name[nLen-3]=='.')
-
- && (pEntry->d_name[nLen-2]=='s')
- && (pEntry->d_name[nLen-1]=='o'))) {
+ ((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, pEntry->d_name);
-
- if(filename) { /* load by name */
- if(!strncasecmp(filename, pEntry->d_name, strlen(pEntry->d_name))) {
+ sprintf (str, "%s/%s", XINE_PLUGINDIR, dir_entry->d_name);
+
+ if(!(plugin = dlopen (str, RTLD_LAZY))) {
+ printf("load_plugins: video output plugin %s failed to link: %s\n",
+ str, dlerror());
+ return NULL;
+ } else {
+ void *(*initplug) (config_values_t *, void *);
+ vo_info_t* (*getinfo) ();
+ vo_info_t *vo_info;
+
+ if ((getinfo = dlsym(plugin, "get_video_out_plugin_info")) != NULL) {
+ vo_info = getinfo();
+
+ if (!strcmp(id, vo_info->id)) {
- 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 *, void *, int);
-
if((initplug = dlsym(plugin, "init_video_out_plugin")) != NULL) {
- vod = (vo_driver_t *) initplug(VIDEO_OUT_PLUGIN_IFACE_VERSION,
- config, visual, visual_type);
+ vod = (vo_driver_t *) initplug(config, visual);
- printf("video output plugin found : %s(ID: %s, iface: %d)\n",
- str, vod->get_identifier(), vod->interface_version);
+ if (vod)
+ printf("load_plugins: video output plugin %s sucessfully loaded.\n", str);
+ else
+ printf("load_plugins: video output plugin %s: init_video_out_plugin failed.\n", str);
return vod;
- }
- }
- }
- }
- else { /* load by ID */
- 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 *, void *, int);
-
- if((initplug = dlsym(plugin, "init_video_out_plugin")) != NULL) {
-
- vod = (vo_driver_t *) initplug(VIDEO_OUT_PLUGIN_IFACE_VERSION,
- config, visual, visual_type);
-
- printf("video output plugin found : %s(ID: %s, iface: %d)\n",
- str, vod->get_identifier(), vod->interface_version);
-
- if(!strcasecmp(id, vod->get_identifier())) {
- return vod;
}
}
}
@@ -430,25 +453,16 @@ vo_driver_t *xine_load_video_output_plugin(config_values_t *config,
}
}
}
- return NULL;
-}
-
-char **enum_video_output_plugins(int visual_type) {
- // Not implemented
+
+ printf ("load_plugins: failed to find video output plugin <%s>\n", id);
return NULL;
}
ao_functions_t *xine_load_audio_output_plugin(config_values_t *config,
- char *filename, char *id) {
+ char *id) {
DIR *dir;
ao_functions_t *aod = NULL;
- if(filename == NULL && id == NULL) {
- printf("%s(%s@%d): parameter(s) should be non null.\n",
- __FILE__, __FUNCTION__, __LINE__);
- return NULL;
- }
-
dir = opendir (XINE_PLUGINDIR);
if (dir) {
@@ -471,49 +485,24 @@ ao_functions_t *xine_load_audio_output_plugin(config_values_t *config,
sprintf (str, "%s/%s", XINE_PLUGINDIR, pEntry->d_name);
- if(filename) { /* load by name */
- if(!strncasecmp(filename, pEntry->d_name, strlen(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 *);
-
- 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);
-
- return aod;
- }
- }
- }
+ 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 { /* load by ID */
- 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 *);
+ else {
+ void *(*initplug) (int, config_values_t *);
+
+ if((initplug = dlsym(plugin, "init_audio_out_plugin")) != NULL) {
- 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(!strcasecmp(id, aod->get_identifier())) {
- return aod;
- }
+ 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(!strcasecmp(id, aod->get_identifier())) {
+ return aod;
}
}
}
@@ -523,9 +512,9 @@ ao_functions_t *xine_load_audio_output_plugin(config_values_t *config,
return NULL;
}
-char **enum_audio_output_plugins(int output_type) {
+char **xine_list_audio_output_plugins() {
- // Not implemented
+ printf ("load_plugins: FIXME: list_audio_output_plugins not implemented yet\n");
return NULL;
}
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index b26adb614..864132660 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.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: video_out.h,v 1.2 2001/04/26 11:31:36 f1rmb Exp $
+ * $Id: video_out.h,v 1.3 2001/04/27 23:51:52 guenter Exp $
*
*
* xine version of video_out.h
@@ -213,15 +213,11 @@ struct vo_instance_s {
* from generic vo functions.
*/
+#define VIDEO_OUT_IFACE_VERSION 1
struct vo_driver_s {
- /*
- * plugin interface version, lower versions _may_ be supported
- */
- int interface_version;
-
- uint32_t (*get_capabilities) (vo_driver_t *this); /* for constants see below */
+ uint32_t (*get_capabilities) (vo_driver_t *this); /* for constants see above */
/*
* allocate an vo_frame_t struct,
@@ -255,10 +251,6 @@ struct vo_driver_s {
void (*exit) (vo_driver_t *this);
- /*
- * return human readable identifier for this plugin
- */
- char* (*get_identifier) (void);
};
@@ -270,14 +262,40 @@ struct vo_driver_s {
vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) ;
/*
- * init a video driver. The driver is selected either
- * by auto-detection or (if given) by the driver_name
+ * to build a dynamic video output plugin
+ * you have to implement these functions:
+ *
+ *
+ * init_video_out_plugin init and set up driver so it is fully operational
+ *
+ * parameters: config - config object pointer
+ * visual - driver specific info (e.g. Display*)
+ *
+ * return value: video_driver_t* in case of success,
+ * NULL on failure (e.g. wrong interface version, wrong visual type...)
+ *
+ * vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual);
+ *
+ *
+ * get_video_out_plugin_info
+ *
+ * peek at some (static) information about the plugin without initializing it
+ *
+ * parameters: none
+ *
+ * return value: vo_info_t* : some information about the plugin
+ * vo_info_t *get_video_out_plugin_info ();
*/
-vo_instance_t *vo_init (char *driver_name);
+typedef struct vo_info_s {
+
+ int interface_version; /* plugin interface version */
+ char *id; /* id of this plugin */
+ char *description; /* human-readable description of this plugin */
+ int visual_type; /* visual type supported by this plugin */
+ int priority; /* priority of this plugin for auto-probing */
-/* returns a list of available drivers */
-
-char *vo_get_available_drivers ();
+} vo_info_t;
#endif
+
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 0a5497757..fd2fc0d01 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.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_internal.h,v 1.12 2001/04/27 10:42:38 f1rmb Exp $
+ * $Id: xine_internal.h,v 1.13 2001/04/27 23:51:52 guenter Exp $
*
*/
@@ -315,7 +315,8 @@ void audio_decoder_shutdown (xine_t *this);
/*
* Load input/demux/audio_out/video_out plugins
*/
-/* plugin names scheme */
+
+/* plugin naming scheme */
#define XINE_INPUT_PLUGIN_PREFIXNAME "xineplug_inp_"
#define XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH 13
@@ -331,31 +332,73 @@ void audio_decoder_shutdown (xine_t *this);
#define XINE_DECODER_PLUGIN_PREFIXNAME "xineplug_decode_"
#define XINE_DECODER_PLUGIN_PREFIXNAME_LENGTH 16
-/* prototypes of load_plugins.c functions. */
+/*
+ * load all available demuxer plugins
+ */
void load_demux_plugins (xine_t *this,
config_values_t *config, int iface_version);
+
+/*
+ * load all available input plugins
+ */
+
void load_input_plugins (xine_t *this,
config_values_t *config, int iface_version);
-void load_video_out_plugins (xine_t *this,
- config_values_t *config, int iface_version);
-void load_audio_out_plugins (xine_t *this,
- config_values_t *config, int iface_version);
+
+/*
+ * load all available decoder plugins
+ */
void load_decoder_plugins (xine_t *this,
config_values_t *config, int iface_version);
-/* visual_type (see bellow) */
-#define VIDEO_OUTPUT_TYPE_GETID 0
-#define VIDEO_OUTPUT_TYPE_PROBE 1
-#define VIDEO_OUTPUT_TYPE_X11 2
-#define VIDEO_OUTPUT_TYPE_FB 3
+
+/*
+ * output driver load support functions
+ */
+
+/* video */
+
+#define VISUAL_TYPE_X11 1
+#define VISUAL_TYPE_FB 2
+#define VISUAL_TYPE_GTK 3
+
+/*
+ * list_video_output_plugins
+ *
+ * returns a list of available video output plugins for
+ * the specified visual type - the list is sorted by plugin
+ * priority
+ */
+
+char **xine_list_video_output_plugins (int visual_type);
+
+/*
+ * load_video_output_plugin
+ *
+ * load a specific video output plugin
+ */
+
vo_driver_t *xine_load_video_output_plugin(config_values_t *config,
- char *filename, char *id,
- int visual_type, void *visual);
-#define AUDIO_OUTPUT_TYPE_GETID 0
-#define AUDIO_OUTPUT_TYPE_PROBE 1
-#define AUDIO_OUTPUT_TYPE_OSS 2
-#define AUDIO_OUTPUT_TYPE_ALSA 3
-#define AUDIO_OUTPUT_TYPE_ESD 4
-ao_functions_t *xine_load_audio_output_plugin(config_values_t *config,
- char *filename, char *id);
-#endif
+ char *id, int visual_type, void *visual);
+
+/*
+ * audio output plugin dynamic loading stuff
+ */
+
+/*
+ * list_audio_output_plugins
+ *
+ * returns a list of available audio output plugins
+ * the list returned is sorted by plugin priority
+ */
+
+char **xine_list_audio_output_plugins ();
+
+/*
+ * load_audio_output_plugin
+ *
+ * load a specific audio output plugin
+ */
+ao_functions_t *xine_load_audio_output_plugin(config_values_t *config, char *id);
+
+#endif