forked from enlightenment/efl
* emotion: Add backend autodetection ability (you can pass NULL, and
have some good hope for a result now :-) ) SVN revision: 44784
This commit is contained in:
parent
fa435074e0
commit
edf90cc827
|
@ -866,6 +866,10 @@ main(int argc, char **argv)
|
|||
else if (!strcmp(argv[i], "-xr"))
|
||||
{
|
||||
}
|
||||
else if (!strcmp(argv[i], "-auto"))
|
||||
{
|
||||
module_filename = NULL;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-xine"))
|
||||
{
|
||||
module_filename = "xine";
|
||||
|
|
|
@ -88,13 +88,17 @@ static Evas_Smart *smart = NULL;
|
|||
static Eina_Hash *_backends = NULL;
|
||||
static Eina_Array *_modules = NULL;
|
||||
|
||||
static const char *_backend_priority[] = {
|
||||
"xine",
|
||||
"gstreamer",
|
||||
"vlc"
|
||||
};
|
||||
|
||||
EAPI Eina_Bool
|
||||
_emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close)
|
||||
{
|
||||
Eina_Emotion_Plugins *plugin;
|
||||
|
||||
fprintf(stderr, "registering: %s\n", name);
|
||||
|
||||
plugin = malloc(sizeof (Eina_Emotion_Plugins));
|
||||
if (!plugin) return EINA_FALSE;
|
||||
|
||||
|
@ -107,7 +111,6 @@ EAPI Eina_Bool
|
|||
EAPI Eina_Bool
|
||||
_emotion_module_unregister(const char *name)
|
||||
{
|
||||
fprintf(stderr, "unregistering: %s\n", name);
|
||||
return eina_hash_del(_backends, name, NULL);
|
||||
}
|
||||
|
||||
|
@ -116,6 +119,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
|
|||
{
|
||||
Eina_Emotion_Plugins *plugin;
|
||||
Smart_Data *sd;
|
||||
int index = 0;
|
||||
|
||||
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
|
||||
if (!_backends)
|
||||
|
@ -125,9 +129,16 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
|
|||
}
|
||||
|
||||
/* FIXME: Always look for a working backend. */
|
||||
retry:
|
||||
if (name == NULL || index > 0)
|
||||
name = _backend_priority[index++];
|
||||
|
||||
plugin = eina_hash_find(_backends, name);
|
||||
if (!plugin)
|
||||
{
|
||||
if (index != 0 && index < (sizeof (_backend_priority) / sizeof (char*)))
|
||||
goto retry;
|
||||
|
||||
fprintf(stderr, "No backend loaded\n");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
@ -141,6 +152,9 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
|
|||
}
|
||||
}
|
||||
|
||||
if (index != 0 && index < (sizeof (_backend_priority) / sizeof (char*)))
|
||||
goto retry;
|
||||
|
||||
fprintf (stderr, "Unable to load module %s\n", name);
|
||||
|
||||
return EINA_FALSE;
|
||||
|
|
Loading…
Reference in New Issue