Commit b25b9d8c authored by Simon Morlat's avatar Simon Morlat

add api to get a list of filters implementing a given interface

set default video renderer filter to X11 for linux (openGL video renderer stays black on many computers...)
parent 67f1cce7
......@@ -66,6 +66,12 @@ struct _MSFilterMethod{
};
/**
* Interface IDs, used to generate method names (see MS_FILTER_METHOD macro).
*
**/
typedef enum _MSFilterInterfaceId MSFilterInterfaceId;
/**
* Structure for holding filter's methods to set filter's options.
* @var MSFilterMethod
......@@ -269,6 +275,14 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
**/
MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
/**
* Returns a list of filter descriptions implementing a given interface.
* The list itself must be freed by the caller of this function, but not the MSFilterDesc pointed by the list elements.
* @param id a filter interface id
* @returns a newly allocated MSList of #MSFilterDesc.
**/
MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
/**
* Create encoder filter according to codec name.
*
......@@ -609,12 +623,6 @@ enum _MSFilterInterfaceId{
MSFilterAudioEncoderInterface,/**<Video encoder interface*/
};
/**
* Interface IDs, used to generate method names (see MS_FILTER_METHOD macro).
*
**/
typedef enum _MSFilterInterfaceId MSFilterInterfaceId;
/* more specific methods: to be moved into implementation specific header files*/
#define MS_FILTER_SET_FILTERLENGTH MS_FILTER_BASE_METHOD(12,int)
......
......@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msticker.h"
#define MS_FILTER_METHOD_GET_FID(id) (((id)>>16) & 0xFFFF)
#define MS_FILTER_METHOD_GET_INDEX(id) ( ((id)>>8) & 0XFF)
static MSList *desc_list=NULL;
static bool_t statistics_enabled=FALSE;
......@@ -199,6 +201,27 @@ MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name){
return NULL;
}
bool_t ms_filter_desc_implements_interface(MSFilterDesc *desc, MSFilterInterfaceId id){
MSFilterMethod *methods=desc->methods;
if (!methods) return FALSE;
for(;methods->id!=0;methods++){
unsigned int fid=MS_FILTER_METHOD_GET_FID(methods->id);
if (fid==id) return TRUE;
}
return FALSE;
}
MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id){
MSList *ret=NULL;
MSList *elem;
for(elem=desc_list;elem!=NULL;elem=elem->next){
MSFilterDesc *desc=(MSFilterDesc*)elem->data;
if (ms_filter_desc_implements_interface(desc,id))
ret=ms_list_append(ret,desc);
}
return ret;
}
MSFilter *ms_filter_new_from_name(const char *filter_name){
MSFilterDesc *desc=ms_filter_lookup_by_name(filter_name);
if (desc==NULL) return NULL;
......@@ -237,9 +260,6 @@ int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2){
return 0;
}
#define MS_FILTER_METHOD_GET_FID(id) (((id)>>16) & 0xFFFF)
#define MS_FILTER_METHOD_GET_INDEX(id) ( ((id)>>8) & 0XFF)
static inline bool_t is_interface_method(unsigned int magic){
return magic==MS_FILTER_BASE_ID || magic>MSFilterInterfaceBegin;
}
......
......@@ -115,10 +115,10 @@ static void choose_display_name(VideoStream *stream){
stream->display_name=ms_strdup("MSAndroidDisplay");
#elif __APPLE__ && !defined(__ios)
stream->display_name=ms_strdup("MSOSXGLDisplay");
#elif defined(HAVE_GL)
stream->display_name=ms_strdup("MSGLXVideo");
#elif defined (HAVE_XV)
stream->display_name=ms_strdup("MSX11Video");
#elif defined(HAVE_GL)
stream->display_name=ms_strdup("MSGLXVideo");
#elif defined(__ios)
stream->display_name=ms_strdup("IOSDisplay");
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment