diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2009-12-30 12:54:06 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2009-12-30 12:54:06 +0000 |
commit | edf90cc827fdbfd9549cd9e1f62eab31ade1d3d9 (patch) | |
tree | 76fffc7f28ce65424aafeb781697f065aa5093e8 /legacy/emotion/src/lib/emotion_smart.c | |
parent | fa435074e0c78c50d49434f10707715af63521f1 (diff) |
* emotion: Add backend autodetection ability (you can pass NULL, and
have some good hope for a result now :-) )
SVN revision: 44784
Diffstat (limited to '')
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index c9ceca373e..e3c54b417f 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -88,13 +88,17 @@ static Evas_Smart *smart = NULL; | |||
88 | static Eina_Hash *_backends = NULL; | 88 | static Eina_Hash *_backends = NULL; |
89 | static Eina_Array *_modules = NULL; | 89 | static Eina_Array *_modules = NULL; |
90 | 90 | ||
91 | static const char *_backend_priority[] = { | ||
92 | "xine", | ||
93 | "gstreamer", | ||
94 | "vlc" | ||
95 | }; | ||
96 | |||
91 | EAPI Eina_Bool | 97 | EAPI Eina_Bool |
92 | _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close) | 98 | _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close) |
93 | { | 99 | { |
94 | Eina_Emotion_Plugins *plugin; | 100 | Eina_Emotion_Plugins *plugin; |
95 | 101 | ||
96 | fprintf(stderr, "registering: %s\n", name); | ||
97 | |||
98 | plugin = malloc(sizeof (Eina_Emotion_Plugins)); | 102 | plugin = malloc(sizeof (Eina_Emotion_Plugins)); |
99 | if (!plugin) return EINA_FALSE; | 103 | if (!plugin) return EINA_FALSE; |
100 | 104 | ||
@@ -107,7 +111,6 @@ EAPI Eina_Bool | |||
107 | EAPI Eina_Bool | 111 | EAPI Eina_Bool |
108 | _emotion_module_unregister(const char *name) | 112 | _emotion_module_unregister(const char *name) |
109 | { | 113 | { |
110 | fprintf(stderr, "unregistering: %s\n", name); | ||
111 | return eina_hash_del(_backends, name, NULL); | 114 | return eina_hash_del(_backends, name, NULL); |
112 | } | 115 | } |
113 | 116 | ||
@@ -116,6 +119,7 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module ** | |||
116 | { | 119 | { |
117 | Eina_Emotion_Plugins *plugin; | 120 | Eina_Emotion_Plugins *plugin; |
118 | Smart_Data *sd; | 121 | Smart_Data *sd; |
122 | int index = 0; | ||
119 | 123 | ||
120 | E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); | 124 | E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); |
121 | if (!_backends) | 125 | if (!_backends) |
@@ -125,9 +129,16 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module ** | |||
125 | } | 129 | } |
126 | 130 | ||
127 | /* FIXME: Always look for a working backend. */ | 131 | /* FIXME: Always look for a working backend. */ |
132 | retry: | ||
133 | if (name == NULL || index > 0) | ||
134 | name = _backend_priority[index++]; | ||
135 | |||
128 | plugin = eina_hash_find(_backends, name); | 136 | plugin = eina_hash_find(_backends, name); |
129 | if (!plugin) | 137 | if (!plugin) |
130 | { | 138 | { |
139 | if (index != 0 && index < (sizeof (_backend_priority) / sizeof (char*))) | ||
140 | goto retry; | ||
141 | |||
131 | fprintf(stderr, "No backend loaded\n"); | 142 | fprintf(stderr, "No backend loaded\n"); |
132 | return EINA_FALSE; | 143 | return EINA_FALSE; |
133 | } | 144 | } |
@@ -141,6 +152,9 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module ** | |||
141 | } | 152 | } |
142 | } | 153 | } |
143 | 154 | ||
155 | if (index != 0 && index < (sizeof (_backend_priority) / sizeof (char*))) | ||
156 | goto retry; | ||
157 | |||
144 | fprintf (stderr, "Unable to load module %s\n", name); | 158 | fprintf (stderr, "Unable to load module %s\n", name); |
145 | 159 | ||
146 | return EINA_FALSE; | 160 | return EINA_FALSE; |