diff options
-rw-r--r-- | include/xine.h.in | 14 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 108 |
2 files changed, 120 insertions, 2 deletions
diff --git a/include/xine.h.in b/include/xine.h.in index 2a1f0ce20..64ccedb4c 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -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.h.in,v 1.25 2002/10/24 19:37:27 guenter Exp $ + * $Id: xine.h.in,v 1.26 2002/10/24 22:54:27 guenter Exp $ * * public xine-lib (libxine) interface and documentation * @@ -487,6 +487,18 @@ char **xine_get_autoplay_mrls (xine_t *self, const char *plugin_id, int *num_mrls); +/* get a list of file extensions for file types supported by xine + * the list is separated by spaces + * + * the pointer returned can be free()ed when no longer used */ +char *xine_get_file_extensions (xine_t *self); + +/* get a list of mime types supported by xine + * + * the pointer returned can be free()ed when no longer used */ +char *xine_get_mime_types (xine_t *self); + + /* get a description string for an input plugin */ const char *xine_get_input_plugin_description (xine_t *self, const char *plugin_id); diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 7005dc549..b2828639f 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.103 2002/10/18 20:17:07 f1rmb Exp $ + * $Id: load_plugins.c,v 1.104 2002/10/24 22:54:27 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1284,6 +1284,112 @@ void free_spu_decoder (xine_stream_t *stream, spu_decoder_t *sd) { pthread_mutex_unlock (&catalog->lock); } +/* get a list of file extensions for file types supported by xine + * the list is separated by spaces + * + * the pointer returned can be free()ed when no longer used */ +char *xine_get_file_extensions (xine_t *self) { + + plugin_catalog_t *catalog = self->plugin_catalog; + int len, pos; + plugin_node_t *node; + char *str; + + pthread_mutex_lock (&catalog->lock); + + /* calc length of output */ + + len = 0; node = xine_list_first_content (catalog->demux); + while (node) { + demux_class_t *cls = (demux_class_t *)node->plugin_class; + + len += strlen(cls->get_extensions (cls))+1; + + node = xine_list_next_content (catalog->demux); + } + + /* create output */ + + str = malloc (len+1); + pos = 0; + + node = xine_list_first_content (catalog->demux); + while (node) { + demux_class_t *cls = (demux_class_t *)node->plugin_class; + char *e; + int l; + + e = cls->get_extensions (cls); + l = strlen(e); + memcpy (&str[pos], e, l); + + node = xine_list_next_content (catalog->demux); + pos += l; + str[pos] = ' '; + pos++; + } + + str[pos] = 0; + + pthread_mutex_unlock (&catalog->lock); + + return str; +} + +/* get a list of mime types supported by xine + * + * the pointer returned can be free()ed when no longer used */ +char *xine_get_mime_types (xine_t *self) { + + plugin_catalog_t *catalog = self->plugin_catalog; + int len, pos; + plugin_node_t *node; + char *str; + + pthread_mutex_lock (&catalog->lock); + + /* calc length of output */ + + len = 0; node = xine_list_first_content (catalog->demux); + while (node) { + demux_class_t *cls = (demux_class_t *)node->plugin_class; + char *s; + + s = cls->get_mimetypes (cls); + if (s) + len += strlen(s); + + node = xine_list_next_content (catalog->demux); + } + + /* create output */ + + str = malloc (len+1); + pos = 0; + + node = xine_list_first_content (catalog->demux); + while (node) { + demux_class_t *cls = (demux_class_t *)node->plugin_class; + char *s; + int l; + + s = cls->get_mimetypes (cls); + if (s) { + l = strlen(s); + memcpy (&str[pos], s, l); + + pos += l; + } + node = xine_list_next_content (catalog->demux); + } + + str[pos] = 0; + + pthread_mutex_unlock (&catalog->lock); + + return str; +} + /* * dispose all currently loaded plugins (shutdown) |