From 5c29923095c53ae9788bf77b7b6d416a689434e6 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 11 Apr 2008 19:46:29 +0100 Subject: Add a function for listing video output plugins of the given type(s). --- include/xine.h.in | 2 ++ src/xine-engine/load_plugins.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/xine.h.in b/include/xine.h.in index c97d778d4..219ec8687 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -1071,6 +1071,8 @@ const char *xine_get_post_plugin_description (xine_t *self, /* get lists of available audio and video output plugins */ const char *const *xine_list_audio_output_plugins (xine_t *self) XINE_PROTECTED; const char *const *xine_list_video_output_plugins (xine_t *self) XINE_PROTECTED; +/* typemask is (1ULL << XINE_VISUAL_TYPE_FOO) | ... */ +const char *const *xine_list_video_output_plugins_typed (xine_t *self, uint64_t typemask) XINE_PROTECTED; /* get list of available demultiplexor plugins */ const char *const *xine_list_demuxer_plugins(xine_t *self) XINE_PROTECTED; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 0188fb01d..30077a38e 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1665,6 +1665,36 @@ const char *const *xine_list_video_output_plugins (xine_t *xine) { return catalog->ids; } +const char *const *xine_list_video_output_plugins_typed(xine_t *xine, uint64_t typemask) +{ + plugin_catalog_t *catalog = xine->plugin_catalog; + plugin_node_t *node; + int list_id, list_size, i; + + pthread_mutex_lock (&catalog->lock); + + list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); + + for (list_id = i = 0; list_id < list_size; list_id++) + { + node = xine_sarray_get (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1], list_id); + if (typemask & (1ULL << ((vo_info_t *)node->info->special_info)->visual_type)) + { + const char *id = node->info->id; + int j = i; + while (--j >= 0) + if (!strcmp (catalog->ids[j], id)) + goto ignore; /* already listed */ + catalog->ids[i++] = id; + } + ignore: ; + } + catalog->ids[i] = NULL; + + pthread_mutex_unlock (&catalog->lock); + return catalog->ids; +} + static ao_driver_t *_load_audio_driver (xine_t *this, plugin_node_t *node, void *data) { -- cgit v1.2.3