1 #ifdef HAVE_CONFIG_H
2 # include "config.h"
3 #endif
4 
5 #ifdef _WIN32
6 /* normally, they will never be called as it's for Wayland */
7 # include <evil_private.h> /* setenv unsetenv */
8 #endif
9 
10 #include "emotion_private.h"
11 #include "../../static_libs/buildsystem/buildsystem.h"
12 #include <unistd.h>
13 
14 #if defined(EMOTION_STATIC_BUILD_GSTREAMER1)
15 Eina_Bool gstreamer_module_init(void);
16 void      gstreamer_module_shutdown(void);
17 #endif
18 
19 typedef struct _Emotion_Engine_Registry_Entry
20 {
21    const Emotion_Engine *engine;
22    int priority;
23 } Emotion_Engine_Registry_Entry;
24 
25 static Eina_List *_emotion_engine_registry = NULL;
26 static Eina_Array *_emotion_modules = NULL;
27 static Eina_Bool _emotion_modules_loaded = EINA_FALSE;
28 
29 static void
_emotion_engine_registry_entry_free(Emotion_Engine_Registry_Entry * re)30 _emotion_engine_registry_entry_free(Emotion_Engine_Registry_Entry *re)
31 {
32    free(re);
33 }
34 
35 static int
_emotion_engine_registry_entry_cmp(const void * pa,const void * pb)36 _emotion_engine_registry_entry_cmp(const void *pa, const void *pb)
37 {
38    const Emotion_Engine_Registry_Entry *a = pa, *b = pb;
39    int r = b->priority - a->priority;
40 
41    if (r == 0)
42      r = b->engine->priority - a->engine->priority;
43 
44    if (r == 0)
45      /* guarantee some order to ease debug */
46      r = strcmp(b->engine->name, a->engine->name);
47 
48    return r;
49 }
50 
51 static void
_emotion_modules_load(void)52 _emotion_modules_load(void)
53 {
54    char buf[PATH_MAX];
55 
56    if (_emotion_modules_loaded) return;
57    _emotion_modules_loaded = EINA_TRUE;
58 
59 #ifdef NEED_RUN_IN_TREE
60 #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
61    if (getuid() == geteuid())
62 #endif
63      {
64         if (getenv("EFL_RUN_IN_TREE"))
65           {
66              struct stat st;
67              snprintf(buf, sizeof(buf), "%s/src/modules/emotion",
68                       PACKAGE_BUILD_DIR);
69              if (stat(buf, &st) == 0)
70                {
71                   const char *built_modules[] = {
72                      "gstreamer1",
73                      NULL
74                   };
75                   const char **itr;
76                   for (itr = built_modules; *itr != NULL; itr++)
77                     {
78                        Eina_Module *m;
79                        bs_mod_get(buf, sizeof(buf), "emotion", *itr);
80                        m = eina_module_new(buf);
81 
82                        if (!m) continue;
83 
84                        if (!_emotion_modules)
85                          _emotion_modules = eina_array_new(4);
86                        eina_array_push(_emotion_modules, m);
87                     }
88                   return;
89                }
90           }
91      }
92 #endif
93 
94    snprintf(buf, sizeof(buf), "%s/emotion/modules", eina_prefix_lib_get(_emotion_pfx));
95    _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH);
96 // no - this is dumb. load ALL modules we find - force ALL the code pages of
97 // every lib a module MAY depend on and need to execute some init code into
98 // memory even if we never use it? not a good idea! the point of modules was
99 // to avoid such cost until a module is EXPLICITLY asked for.
100 //load:
101 //   if (_emotion_modules)
102 //     eina_module_list_load(_emotion_modules);
103 //
104 //   if (!_emotion_engine_registry)
105 //     ERR("Couldn't find any emotion engine.");
106 }
107 
108 Eina_Bool
emotion_modules_init(void)109 emotion_modules_init(void)
110 {
111 #if defined(EMOTION_STATIC_BUILD_GSTREAMER1)
112    gstreamer_module_init();
113 #endif
114 
115    return EINA_TRUE;
116 }
117 
118 void
emotion_modules_shutdown(void)119 emotion_modules_shutdown(void)
120 {
121    Emotion_Engine_Registry_Entry *re;
122 
123 #if defined(EMOTION_STATIC_BUILD_GSTREAMER1)
124    gstreamer_module_shutdown();
125 #endif
126 
127    if (_emotion_modules)
128      {
129         eina_module_list_free(_emotion_modules);
130         eina_array_free(_emotion_modules);
131         _emotion_modules = NULL;
132      }
133 
134    EINA_LIST_FREE(_emotion_engine_registry, re)
135      {
136         WRN("Engine was not unregistered: %p", re->engine);
137         _emotion_engine_registry_entry_free(re);
138      }
139 
140    _emotion_modules_loaded = EINA_FALSE;
141 }
142 
143 EAPI Eina_Bool
_emotion_module_register(const Emotion_Engine * api)144 _emotion_module_register(const Emotion_Engine *api)
145 {
146    Emotion_Engine_Registry_Entry *re;
147 
148    EINA_SAFETY_ON_NULL_RETURN_VAL(api, EINA_FALSE);
149 
150    if (api->version != EMOTION_ENGINE_API_VERSION)
151      {
152         ERR("Module '%p' uses api version=%u while %u was expected",
153             api, api->version, EMOTION_ENGINE_API_VERSION);
154         return EINA_FALSE;
155      }
156 
157    EINA_SAFETY_ON_NULL_RETURN_VAL(api->name, EINA_FALSE);
158 
159    INF("register name=%s, version=%u, priority=%d, api=%p",
160        api->name, api->version, api->priority, api);
161 
162    re = calloc(1, sizeof(Emotion_Engine_Registry_Entry));
163    EINA_SAFETY_ON_NULL_RETURN_VAL(re, EINA_FALSE);
164 
165    re->engine = api;
166    re->priority = api->priority; // TODO: use user-priority from file as weel.
167 
168    _emotion_engine_registry = eina_list_sorted_insert
169      (_emotion_engine_registry, _emotion_engine_registry_entry_cmp, re);
170 
171    return EINA_TRUE;
172 }
173 
174 EAPI Eina_Bool
_emotion_module_unregister(const Emotion_Engine * api)175 _emotion_module_unregister(const Emotion_Engine *api)
176 {
177    Eina_List *n;
178    Emotion_Engine_Registry_Entry *re;
179 
180    EINA_SAFETY_ON_NULL_RETURN_VAL(api, EINA_FALSE);
181    if (api->version != EMOTION_ENGINE_API_VERSION)
182      {
183         ERR("Module '%p' uses api version=%u while %u was expected",
184             api, api->version, EMOTION_ENGINE_API_VERSION);
185         return EINA_FALSE;
186      }
187 
188    INF("unregister name=%s, api=%p", api->name, api);
189 
190    EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
191      {
192         if (re->engine == api)
193           {
194              _emotion_engine_registry_entry_free(re);
195              _emotion_engine_registry = eina_list_remove_list
196                (_emotion_engine_registry, n);
197              return EINA_TRUE;
198           }
199      }
200 
201    ERR("module not registered name=%s, api=%p", api->name, api);
202    return EINA_FALSE;
203 }
204 
205 struct _Emotion_Engine_Instance
206 {
207    const Emotion_Engine *api;
208    Evas_Object *obj;
209    void *data;
210 };
211 
212 #define EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, ...)  \
213   do                                                    \
214     {                                                   \
215        if (!inst)                                       \
216          {                                              \
217             DBG("no instance to call "#meth);           \
218             return __VA_ARGS__;                         \
219          }                                              \
220        if (!inst->api->meth)                            \
221          {                                              \
222             DBG("no "#meth" in instance=%p", inst);     \
223             return __VA_ARGS__;                         \
224          }                                              \
225     }                                                   \
226   while (0)
227 
228 #define EMOTION_ENGINE_INSTANCE_CALL(inst, meth, ...)   \
229   do                                                    \
230     {                                                   \
231        EMOTION_ENGINE_INSTANCE_CHECK(inst, meth);       \
232        inst->api->meth(inst->data, ## __VA_ARGS__);     \
233     }                                                   \
234   while (0)
235 
236 #define EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meth, retval, ...)       \
237   do                                                                    \
238     {                                                                   \
239        EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, retval);               \
240        return inst->api->meth(inst->data, ## __VA_ARGS__);              \
241     }                                                                   \
242   while (0)
243 
244 
245 static const Emotion_Engine *
_emotion_engine_registry_find(const char * name)246 _emotion_engine_registry_find(const char *name)
247 {
248    const Eina_List *n;
249    const Emotion_Engine_Registry_Entry *re;
250    EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
251      {
252         if (strcmp(re->engine->name, name) == 0)
253           return re->engine;
254      }
255    return NULL;
256 }
257 
258 static Emotion_Engine_Instance *
_emotion_engine_instance_new(const Emotion_Engine * engine,Evas_Object * obj,void * data)259 _emotion_engine_instance_new(const Emotion_Engine *engine, Evas_Object *obj, void *data)
260 {
261    Emotion_Engine_Instance *inst = calloc(1, sizeof(Emotion_Engine_Instance));
262    EINA_SAFETY_ON_NULL_GOTO(inst, error);
263    inst->api = engine;
264    inst->obj = obj;
265    inst->data = data;
266    return inst;
267 
268  error:
269    engine->del(data);
270    return NULL;
271 }
272 
273 static Eina_Module *
_find_mod(const char * name)274 _find_mod(const char *name)
275 {
276    Eina_Array_Iterator iterator;
277    Eina_Module *m;
278    unsigned int i;
279    int inlen;
280 
281    if (!name || !_emotion_modules) return NULL;
282    inlen = strlen(name);
283    EINA_ARRAY_ITER_NEXT(_emotion_modules, i, m, iterator)
284      {
285         const char *path = eina_module_file_get(m);
286         const char *p, *p1, *p2, *p3;
287         int found, len, len2;
288 
289         if ((!path) || (!path[0])) continue;
290         // path is /*/modulename/ARCH/module.* - we want "modulename"
291         found = 0;
292         p1 = p2 = p3 = NULL;
293         for (p = path + strlen(path) - 1;
294              p > path;
295              p--)
296           {
297              if ((*p == '/')
298 /* FIXME : find a better way to handle Windows path in all the EFL */
299 #ifdef _WIN32
300                  || (*p == '\\')
301 #endif
302                  )
303                {
304                   found++;
305                   // found == 1 -> p = /module.*
306                   // found == 2 -> p = /ARCH/module.*
307                   // found == 3 -> p = /modulename/ARCH/module.*
308                   if (found == 1) p3 = p;
309                   if (found == 2) p2 = p;
310                   if (found == 3)
311                     {
312                        p1 = p;
313                        break;
314                     }
315                }
316           }
317         if (p1)
318           {
319              p1++;
320              len = p2 - p1;
321              len2 = p3 - (p2 + 1);
322              if (len == inlen || len2 == inlen)
323                {
324                   if (!strncmp(p1, name, len) || !strncmp(p2 + 1, name, len2)) return m;
325                }
326           }
327      }
328    return NULL;
329 }
330 
331 Emotion_Engine_Instance *
emotion_engine_instance_new(const char * name,Evas_Object * obj,Emotion_Module_Options * opts)332 emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_Options *opts)
333 {
334    const Eina_List *n;
335    const Emotion_Engine_Registry_Entry *re;
336    const Emotion_Engine *engine;
337    void *data;
338    Eina_Module *m;
339    char *disp = NULL;
340 
341    _emotion_modules_load();
342 
343    if ((!name) && getenv("EMOTION_ENGINE"))
344      {
345         name = getenv("EMOTION_ENGINE");
346         DBG("using EMOTION_ENGINE=%s", name);
347      }
348 
349    if (getenv("WAYLAND_DISPLAY"))
350      {
351         disp = eina_strdup(getenv("DISPLAY"));
352         unsetenv("DISPLAY");
353      }
354 
355 
356    if (name)
357      {
358         m = _find_mod(name);
359         if (m)
360           {
361              if (!eina_module_load(m))
362                ERR("Cannot load module %s", eina_module_file_get(m));
363           }
364      }
365 
366    if (!_emotion_engine_registry)
367      {
368         m = _find_mod("gstreamer1");
369         if (!eina_module_load(m))
370           ERR("Cannot load module %s", eina_module_file_get(m));
371      }
372 
373    if (name)
374      {
375         engine = _emotion_engine_registry_find(name);
376         if (!engine)
377           ERR("Couldn't find requested engine: %s. Try fallback", name);
378         else
379           {
380              data = engine->add(engine, obj, opts);
381              if (data)
382                {
383                   INF("Using requested engine %s, data=%p", name, data);
384                   if (disp) setenv("DISPLAY", disp, 1);
385                   free(disp);
386                   return _emotion_engine_instance_new(engine, obj, data);
387                }
388 
389              ERR("Requested engine '%s' could not be used. Try fallback", name);
390           }
391      }
392 
393    EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
394      {
395         engine = re->engine;
396         DBG("Trying engine %s, priority=%d (%d)",
397             engine->name, re->priority, engine->priority);
398 
399         data = engine->add(engine, obj, opts);
400         if (data)
401           {
402              INF("Using fallback engine %s, data=%p", engine->name, data);
403              if (disp) setenv("DISPLAY", disp, 1);
404              free(disp);
405              return _emotion_engine_instance_new(engine, obj, data);
406           }
407      }
408 
409    ERR("No engine worked");
410    if (disp) setenv("DISPLAY", disp, 1);
411    free(disp);
412    return NULL;
413 }
414 
415 void
emotion_engine_instance_del(Emotion_Engine_Instance * inst)416 emotion_engine_instance_del(Emotion_Engine_Instance *inst)
417 {
418    EINA_SAFETY_ON_NULL_RETURN(inst);
419    inst->api->del(inst->data);
420    free(inst);
421 }
422 
423 Eina_Bool
emotion_engine_instance_name_equal(const Emotion_Engine_Instance * inst,const char * name)424 emotion_engine_instance_name_equal(const Emotion_Engine_Instance *inst, const char *name)
425 {
426    /* these are valid, no safety macros here */
427    if (!name) return EINA_FALSE;
428    if (!inst) return EINA_FALSE;
429    return strcmp(name, inst->api->name) == 0;
430 }
431 
432 void *
emotion_engine_instance_data_get(const Emotion_Engine_Instance * inst)433 emotion_engine_instance_data_get(const Emotion_Engine_Instance *inst)
434 {
435    EINA_SAFETY_ON_NULL_RETURN_VAL(inst, NULL);
436    return inst->data;
437 }
438 
439 Eina_Bool
emotion_engine_instance_file_open(Emotion_Engine_Instance * inst,const char * file)440 emotion_engine_instance_file_open(Emotion_Engine_Instance *inst, const char *file)
441 {
442    EMOTION_ENGINE_INSTANCE_CHECK(inst, file_open, EINA_FALSE);
443    return inst->api->file_open(inst->data, file);
444 }
445 
446 void
emotion_engine_instance_file_close(Emotion_Engine_Instance * inst)447 emotion_engine_instance_file_close(Emotion_Engine_Instance *inst)
448 {
449    EMOTION_ENGINE_INSTANCE_CALL(inst, file_close);
450 }
451 
452 void
emotion_engine_instance_play(Emotion_Engine_Instance * inst,double pos)453 emotion_engine_instance_play(Emotion_Engine_Instance *inst, double pos)
454 {
455    EMOTION_ENGINE_INSTANCE_CALL(inst, play, pos);
456 }
457 
458 void
emotion_engine_instance_stop(Emotion_Engine_Instance * inst)459 emotion_engine_instance_stop(Emotion_Engine_Instance *inst)
460 {
461    EMOTION_ENGINE_INSTANCE_CALL(inst, stop);
462 }
463 
464 void
emotion_engine_instance_size_get(const Emotion_Engine_Instance * inst,int * w,int * h)465 emotion_engine_instance_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
466 {
467    EMOTION_ENGINE_INSTANCE_CALL(inst, size_get, w, h);
468 }
469 
470 void
emotion_engine_instance_pos_set(Emotion_Engine_Instance * inst,double pos)471 emotion_engine_instance_pos_set(Emotion_Engine_Instance *inst, double pos)
472 {
473    EMOTION_ENGINE_INSTANCE_CALL(inst, pos_set, pos);
474 }
475 
476 double
emotion_engine_instance_len_get(const Emotion_Engine_Instance * inst)477 emotion_engine_instance_len_get(const Emotion_Engine_Instance *inst)
478 {
479    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, len_get, 0.0);
480 }
481 
482 double
emotion_engine_instance_buffer_size_get(const Emotion_Engine_Instance * inst)483 emotion_engine_instance_buffer_size_get(const Emotion_Engine_Instance *inst)
484 {
485    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, buffer_size_get, 1.0);
486 }
487 
488 int
emotion_engine_instance_fps_num_get(const Emotion_Engine_Instance * inst)489 emotion_engine_instance_fps_num_get(const Emotion_Engine_Instance *inst)
490 {
491    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_num_get, 1);
492 }
493 
494 int
emotion_engine_instance_fps_den_get(const Emotion_Engine_Instance * inst)495 emotion_engine_instance_fps_den_get(const Emotion_Engine_Instance *inst)
496 {
497    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_den_get, 1);
498 }
499 
500 double
emotion_engine_instance_fps_get(const Emotion_Engine_Instance * inst)501 emotion_engine_instance_fps_get(const Emotion_Engine_Instance *inst)
502 {
503    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_get, 1.0);
504 }
505 
506 double
emotion_engine_instance_pos_get(const Emotion_Engine_Instance * inst)507 emotion_engine_instance_pos_get(const Emotion_Engine_Instance *inst)
508 {
509    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, pos_get, 0.0);
510 }
511 
512 void
emotion_engine_instance_vis_set(Emotion_Engine_Instance * inst,Emotion_Vis vis)513 emotion_engine_instance_vis_set(Emotion_Engine_Instance *inst, Emotion_Vis vis)
514 {
515    EMOTION_ENGINE_INSTANCE_CALL(inst, vis_set, vis);
516 }
517 
518 Emotion_Vis
emotion_engine_instance_vis_get(const Emotion_Engine_Instance * inst)519 emotion_engine_instance_vis_get(const Emotion_Engine_Instance *inst)
520 {
521    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_get, EMOTION_VIS_NONE);
522 }
523 
524 Eina_Bool
emotion_engine_instance_vis_supported(Emotion_Engine_Instance * inst,Emotion_Vis vis)525 emotion_engine_instance_vis_supported(Emotion_Engine_Instance *inst, Emotion_Vis vis)
526 {
527    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_supported, EINA_FALSE, vis);
528 }
529 
530 double
emotion_engine_instance_ratio_get(const Emotion_Engine_Instance * inst)531 emotion_engine_instance_ratio_get(const Emotion_Engine_Instance *inst)
532 {
533    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, ratio_get, 0.0);
534 }
535 
536 Eina_Bool
emotion_engine_instance_video_handled(Emotion_Engine_Instance * inst)537 emotion_engine_instance_video_handled(Emotion_Engine_Instance *inst)
538 {
539    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_handled, EINA_FALSE);
540 }
541 
542 Eina_Bool
emotion_engine_instance_audio_handled(Emotion_Engine_Instance * inst)543 emotion_engine_instance_audio_handled(Emotion_Engine_Instance *inst)
544 {
545    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_handled, EINA_FALSE);
546 }
547 
548 Eina_Bool
emotion_engine_instance_seekable(Emotion_Engine_Instance * inst)549 emotion_engine_instance_seekable(Emotion_Engine_Instance *inst)
550 {
551    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, seekable, EINA_FALSE);
552 }
553 
554 void
emotion_engine_instance_frame_done(Emotion_Engine_Instance * inst)555 emotion_engine_instance_frame_done(Emotion_Engine_Instance *inst)
556 {
557    EMOTION_ENGINE_INSTANCE_CALL(inst, frame_done);
558 }
559 
560 Emotion_Format
emotion_engine_instance_format_get(const Emotion_Engine_Instance * inst)561 emotion_engine_instance_format_get(const Emotion_Engine_Instance *inst)
562 {
563    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, format_get, EMOTION_FORMAT_NONE);
564 }
565 
566 void
emotion_engine_instance_video_data_size_get(const Emotion_Engine_Instance * inst,int * w,int * h)567 emotion_engine_instance_video_data_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
568 {
569    EMOTION_ENGINE_INSTANCE_CALL(inst, video_data_size_get, w, h);
570 }
571 
572 Eina_Bool
emotion_engine_instance_yuv_rows_get(const Emotion_Engine_Instance * inst,int w,int h,unsigned char ** yrows,unsigned char ** urows,unsigned char ** vrows)573 emotion_engine_instance_yuv_rows_get(const Emotion_Engine_Instance *inst, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows)
574 {
575    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, yuv_rows_get, EINA_FALSE, w, h, yrows, urows, vrows);
576 }
577 
578 Eina_Bool
emotion_engine_instance_bgra_data_get(const Emotion_Engine_Instance * inst,unsigned char ** bgra_data)579 emotion_engine_instance_bgra_data_get(const Emotion_Engine_Instance *inst, unsigned char **bgra_data)
580 {
581    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, bgra_data_get, EINA_FALSE, bgra_data);
582 }
583 
584 void
emotion_engine_instance_event_feed(Emotion_Engine_Instance * inst,int event)585 emotion_engine_instance_event_feed(Emotion_Engine_Instance *inst, int event)
586 {
587    EMOTION_ENGINE_INSTANCE_CALL(inst, event_feed, event);
588 }
589 
590 void
emotion_engine_instance_event_mouse_button_feed(Emotion_Engine_Instance * inst,int button,int x,int y)591 emotion_engine_instance_event_mouse_button_feed(Emotion_Engine_Instance *inst, int button, int x, int y)
592 {
593    EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_button_feed, button, x, y);
594 }
595 
596 void
emotion_engine_instance_event_mouse_move_feed(Emotion_Engine_Instance * inst,int x,int y)597 emotion_engine_instance_event_mouse_move_feed(Emotion_Engine_Instance *inst, int x, int y)
598 {
599    EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_move_feed, x, y);
600 }
601 
602 int
emotion_engine_instance_video_channel_count(Emotion_Engine_Instance * inst)603 emotion_engine_instance_video_channel_count(Emotion_Engine_Instance *inst)
604 {
605    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_count, 0);
606 }
607 
608 void
emotion_engine_instance_video_channel_set(Emotion_Engine_Instance * inst,int channel)609 emotion_engine_instance_video_channel_set(Emotion_Engine_Instance *inst, int channel)
610 {
611    EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_set, channel);
612 }
613 
614 int
emotion_engine_instance_video_channel_get(const Emotion_Engine_Instance * inst)615 emotion_engine_instance_video_channel_get(const Emotion_Engine_Instance *inst)
616 {
617    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_get, 0);
618 }
619 
620 void
emotion_engine_instance_video_subtitle_file_set(Emotion_Engine_Instance * inst,const char * filepath)621 emotion_engine_instance_video_subtitle_file_set(Emotion_Engine_Instance *inst, const char *filepath)
622 {
623    EMOTION_ENGINE_INSTANCE_CALL(inst, video_subtitle_file_set, filepath);
624 }
625 
626 const char *
emotion_engine_instance_video_subtitle_file_get(const Emotion_Engine_Instance * inst)627 emotion_engine_instance_video_subtitle_file_get(const Emotion_Engine_Instance *inst)
628 {
629    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_subtitle_file_get, NULL);
630 }
631 
632 const char *
emotion_engine_instance_video_channel_name_get(const Emotion_Engine_Instance * inst,int channel)633 emotion_engine_instance_video_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
634 {
635    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_name_get, NULL, channel);
636 }
637 
638 void
emotion_engine_instance_video_channel_mute_set(Emotion_Engine_Instance * inst,Eina_Bool mute)639 emotion_engine_instance_video_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
640 {
641    EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_mute_set, mute);
642 }
643 
644 Eina_Bool
emotion_engine_instance_video_channel_mute_get(const Emotion_Engine_Instance * inst)645 emotion_engine_instance_video_channel_mute_get(const Emotion_Engine_Instance *inst)
646 {
647    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_mute_get, EINA_FALSE);
648 }
649 
650 int
emotion_engine_instance_audio_channel_count(Emotion_Engine_Instance * inst)651 emotion_engine_instance_audio_channel_count(Emotion_Engine_Instance *inst)
652 {
653    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_count, 0);
654 }
655 
656 void
emotion_engine_instance_audio_channel_set(Emotion_Engine_Instance * inst,int channel)657 emotion_engine_instance_audio_channel_set(Emotion_Engine_Instance *inst, int channel)
658 {
659    EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_set, channel);
660 }
661 
662 int
emotion_engine_instance_audio_channel_get(const Emotion_Engine_Instance * inst)663 emotion_engine_instance_audio_channel_get(const Emotion_Engine_Instance *inst)
664 {
665    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_get, 0);
666 }
667 
668 const char *
emotion_engine_instance_audio_channel_name_get(const Emotion_Engine_Instance * inst,int channel)669 emotion_engine_instance_audio_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
670 {
671    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_name_get, NULL, channel);
672 }
673 
674 void
emotion_engine_instance_audio_channel_mute_set(Emotion_Engine_Instance * inst,Eina_Bool mute)675 emotion_engine_instance_audio_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
676 {
677    EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_mute_set, mute);
678 }
679 
680 Eina_Bool
emotion_engine_instance_audio_channel_mute_get(const Emotion_Engine_Instance * inst)681 emotion_engine_instance_audio_channel_mute_get(const Emotion_Engine_Instance *inst)
682 {
683    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_mute_get, EINA_FALSE);
684 }
685 
686 void
emotion_engine_instance_audio_channel_volume_set(Emotion_Engine_Instance * inst,double vol)687 emotion_engine_instance_audio_channel_volume_set(Emotion_Engine_Instance *inst, double vol)
688 {
689    EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_volume_set, vol);
690 }
691 
692 double
emotion_engine_instance_audio_channel_volume_get(const Emotion_Engine_Instance * inst)693 emotion_engine_instance_audio_channel_volume_get(const Emotion_Engine_Instance *inst)
694 {
695    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_volume_get, 0.0);
696 }
697 
698 int
emotion_engine_instance_spu_channel_count(Emotion_Engine_Instance * inst)699 emotion_engine_instance_spu_channel_count(Emotion_Engine_Instance *inst)
700 {
701    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_count, 0);
702 }
703 
704 void
emotion_engine_instance_spu_channel_set(Emotion_Engine_Instance * inst,int channel)705 emotion_engine_instance_spu_channel_set(Emotion_Engine_Instance *inst, int channel)
706 {
707    EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_set, channel);
708 }
709 
710 int
emotion_engine_instance_spu_channel_get(const Emotion_Engine_Instance * inst)711 emotion_engine_instance_spu_channel_get(const Emotion_Engine_Instance *inst)
712 {
713    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_get, 0);
714 }
715 
716 const char *
emotion_engine_instance_spu_channel_name_get(const Emotion_Engine_Instance * inst,int channel)717 emotion_engine_instance_spu_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
718 {
719    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_name_get, NULL, channel);
720 }
721 
722 void
emotion_engine_instance_spu_channel_mute_set(Emotion_Engine_Instance * inst,Eina_Bool mute)723 emotion_engine_instance_spu_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
724 {
725    EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_mute_set, mute);
726 }
727 
728 Eina_Bool
emotion_engine_instance_spu_channel_mute_get(const Emotion_Engine_Instance * inst)729 emotion_engine_instance_spu_channel_mute_get(const Emotion_Engine_Instance *inst)
730 {
731    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_mute_get, EINA_FALSE);
732 }
733 
734 int
emotion_engine_instance_chapter_count(Emotion_Engine_Instance * inst)735 emotion_engine_instance_chapter_count(Emotion_Engine_Instance *inst)
736 {
737    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_count, 0);
738 }
739 
740 void
emotion_engine_instance_chapter_set(Emotion_Engine_Instance * inst,int chapter)741 emotion_engine_instance_chapter_set(Emotion_Engine_Instance *inst, int chapter)
742 {
743    EMOTION_ENGINE_INSTANCE_CALL(inst, chapter_set, chapter);
744 }
745 
746 int
emotion_engine_instance_chapter_get(const Emotion_Engine_Instance * inst)747 emotion_engine_instance_chapter_get(const Emotion_Engine_Instance *inst)
748 {
749    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_get, 0);
750 }
751 
752 const char *
emotion_engine_instance_chapter_name_get(const Emotion_Engine_Instance * inst,int chapter)753 emotion_engine_instance_chapter_name_get(const Emotion_Engine_Instance *inst, int chapter)
754 {
755    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_name_get, NULL, chapter);
756 }
757 
758 void
emotion_engine_instance_speed_set(Emotion_Engine_Instance * inst,double speed)759 emotion_engine_instance_speed_set(Emotion_Engine_Instance *inst, double speed)
760 {
761    EMOTION_ENGINE_INSTANCE_CALL(inst, speed_set, speed);
762 }
763 
764 double
emotion_engine_instance_speed_get(const Emotion_Engine_Instance * inst)765 emotion_engine_instance_speed_get(const Emotion_Engine_Instance *inst)
766 {
767    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, speed_get, 0.0);
768 }
769 
770 Eina_Bool
emotion_engine_instance_eject(Emotion_Engine_Instance * inst)771 emotion_engine_instance_eject(Emotion_Engine_Instance *inst)
772 {
773    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, eject, EINA_FALSE);
774 }
775 
776 const char *
emotion_engine_instance_meta_get(const Emotion_Engine_Instance * inst,int meta)777 emotion_engine_instance_meta_get(const Emotion_Engine_Instance *inst, int meta)
778 {
779    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meta_get, NULL, meta);
780 }
781 
782 void *
emotion_engine_instance_meta_artwork_get(const Emotion_Engine_Instance * inst,Evas_Object * img,const char * path,Emotion_Artwork_Info type)783 emotion_engine_instance_meta_artwork_get(const Emotion_Engine_Instance *inst, Evas_Object *img, const char *path,  Emotion_Artwork_Info type)
784 {
785    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meta_artwork_get, NULL, img, path, type);
786 }
787 
788 void
emotion_engine_instance_priority_set(Emotion_Engine_Instance * inst,Eina_Bool priority)789 emotion_engine_instance_priority_set(Emotion_Engine_Instance *inst, Eina_Bool priority)
790 {
791    EMOTION_ENGINE_INSTANCE_CALL(inst, priority_set, priority);
792 }
793 
794 Eina_Bool
emotion_engine_instance_priority_get(const Emotion_Engine_Instance * inst)795 emotion_engine_instance_priority_get(const Emotion_Engine_Instance *inst)
796 {
797    EMOTION_ENGINE_INSTANCE_CALL_RET(inst, priority_get, EINA_FALSE);
798 }
799