summaryrefslogtreecommitdiff
path: root/src/lib/emotion/emotion_modules.c
blob: 3aa0f0643f22fe775fa5949448cfb277b4501e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "emotion_private.h"
#include <unistd.h>

#ifdef EMOTION_STATIC_BUILD_XINE
Eina_Bool xine_module_init(void);
void      xine_module_shutdown(void);
#endif
#if defined(EMOTION_STATIC_BUILD_GSTREAMER) || defined(EMOTION_STATIC_BUILD_GSTREAMER1)
Eina_Bool gstreamer_module_init(void);
void      gstreamer_module_shutdown(void);
#endif
#ifdef EMOTION_STATIC_BUILD_LIBVLC
Eina_Bool libvlc_module_init(void);
void      libvlc_module_shutdown(void);
#endif
#ifdef EMOTION_STATIC_BUILD_GENERIC
Eina_Bool generic_module_init(void);
void      generic_module_shutdown(void);
#endif

typedef struct _Emotion_Engine_Registry_Entry
{
   const Emotion_Engine *engine;
   int priority;
} Emotion_Engine_Registry_Entry;

static Eina_List *_emotion_engine_registry = NULL;
static Eina_Array *_emotion_modules = NULL;
static Eina_Bool _emotion_modules_loaded = EINA_FALSE;

static void
_emotion_engine_registry_entry_free(Emotion_Engine_Registry_Entry *re)
{
   free(re);
}

static int
_emotion_engine_registry_entry_cmp(const void *pa, const void *pb)
{
   const Emotion_Engine_Registry_Entry *a = pa, *b = pb;
   int r = b->priority - a->priority;

   if (r == 0)
     r = b->engine->priority - a->engine->priority;

   if (r == 0)
     /* guarantee some order to ease debug */
     r = strcmp(b->engine->name, a->engine->name);

   return r;
}

static void
_emotion_modules_load(void)
{
   char buf[PATH_MAX];

   if (_emotion_modules_loaded) return;
   _emotion_modules_loaded = EINA_TRUE;

#ifdef NEED_RUN_IN_TREE
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
   if (getuid() == geteuid())
#endif
     {
        if (getenv("EFL_RUN_IN_TREE"))
          {
             struct stat st;
             snprintf(buf, sizeof(buf), "%s/src/modules/emotion",
                      PACKAGE_BUILD_DIR);
             if (stat(buf, &st) == 0)
               {
                  const char *built_modules[] = {
#ifdef EMOTION_BUILD_GSTREAMER
                     "gstreamer",
#endif
#ifdef EMOTION_BUILD_GSTREAMER1
                     "gstreamer1",
#endif
#ifdef EMOTION_BUILD_XINE
                     "xine",
#endif
#ifdef EMOTION_BUILD_LIBVLC
                     "libvlc",
#endif
                     NULL
                  };
                  const char **itr;
                  for (itr = built_modules; *itr != NULL; itr++)
                    {
                       snprintf(buf, sizeof(buf),
                                "%s/src/modules/emotion/%s/.libs",
                                PACKAGE_BUILD_DIR, *itr);
                       _emotion_modules = eina_module_list_get(_emotion_modules, buf,
                                                               EINA_FALSE, NULL, NULL);
                    }
                  return;
               }
          }
     }
#endif

   snprintf(buf, sizeof(buf), "%s/emotion/modules", eina_prefix_lib_get(_emotion_pfx));
   _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH);
// no - this is dumb. load ALL modules we find - force ALL the code pages of
// every lib a module MAY depend on and need to execute some init code into
// memory even if we never use it? not a good idea! the point of modules was
// to avoid such cost until a module is EXPLICITLY asked for.
//load:
//   if (_emotion_modules)
//     eina_module_list_load(_emotion_modules);
//
//   if (!_emotion_engine_registry)
//     ERR("Couldn't find any emotion engine.");
}

Eina_Bool
emotion_modules_init(void)
{
#ifdef EMOTION_STATIC_BUILD_XINE
   xine_module_init();
#endif
#if defined(EMOTION_STATIC_BUILD_GSTREAMER) || defined(EMOTION_STATIC_BUILD_GSTREAMER1)
   gstreamer_module_init();
#endif
#ifdef EMOTION_STATIC_BUILD_LIBVLC
   libvlc_module_init();
#endif
#ifdef EMOTION_STATIC_BUILD_GENERIC
   generic_module_init();
#endif

   return EINA_TRUE;
}

void
emotion_modules_shutdown(void)
{
   Emotion_Engine_Registry_Entry *re;

#ifdef EMOTION_STATIC_BUILD_XINE
   xine_module_shutdown();
#endif
#if defined(EMOTION_STATIC_BUILD_GSTREAMER) || defined(EMOTION_STATIC_BUILD_GSTREAMER1)
   gstreamer_module_shutdown();
#endif
#ifdef EMOTION_STATIC_BUILD_LIBVLC
   libvlc_module_shutdown();
#endif
#ifdef EMOTION_STATIC_BUILD_GENERIC
   generic_module_shutdown();
#endif

   if (_emotion_modules)
     {
        eina_module_list_free(_emotion_modules);
        eina_array_free(_emotion_modules);
        _emotion_modules = NULL;
     }

   EINA_LIST_FREE(_emotion_engine_registry, re)
     {
        WRN("Engine was not unregistered: %p", re->engine);
        _emotion_engine_registry_entry_free(re);
     }

   _emotion_modules_loaded = EINA_FALSE;
}

EAPI Eina_Bool
_emotion_module_register(const Emotion_Engine *api)
{
   Emotion_Engine_Registry_Entry *re;

   EINA_SAFETY_ON_NULL_RETURN_VAL(api, EINA_FALSE);

   if (api->version != EMOTION_ENGINE_API_VERSION)
     {
        ERR("Module '%p' uses api version=%u while %u was expected",
            api, api->version, EMOTION_ENGINE_API_VERSION);
        return EINA_FALSE;
     }

   EINA_SAFETY_ON_NULL_RETURN_VAL(api->name, EINA_FALSE);

   INF("register name=%s, version=%u, priority=%d, api=%p",
       api->name, api->version, api->priority, api);

   re = calloc(1, sizeof(Emotion_Engine_Registry_Entry));
   EINA_SAFETY_ON_NULL_RETURN_VAL(re, EINA_FALSE);

   re->engine = api;
   re->priority = api->priority; // TODO: use user-priority from file as weel.

   _emotion_engine_registry = eina_list_sorted_insert
     (_emotion_engine_registry, _emotion_engine_registry_entry_cmp, re);

   return EINA_TRUE;
}

EAPI Eina_Bool
_emotion_module_unregister(const Emotion_Engine *api)
{
   Eina_List *n;
   Emotion_Engine_Registry_Entry *re;

   EINA_SAFETY_ON_NULL_RETURN_VAL(api, EINA_FALSE);
   if (api->version != EMOTION_ENGINE_API_VERSION)
     {
        ERR("Module '%p' uses api version=%u while %u was expected",
            api, api->version, EMOTION_ENGINE_API_VERSION);
        return EINA_FALSE;
     }

   INF("unregister name=%s, api=%p", api->name, api);

   EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
     {
        if (re->engine == api)
          {
             _emotion_engine_registry_entry_free(re);
             _emotion_engine_registry = eina_list_remove_list
               (_emotion_engine_registry, n);
             return EINA_TRUE;
          }
     }

   ERR("module not registered name=%s, api=%p", api->name, api);
   return EINA_FALSE;
}

struct _Emotion_Engine_Instance
{
   const Emotion_Engine *api;
   Evas_Object *obj;
   void *data;
};

#define EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, ...)  \
  do                                                    \
    {                                                   \
       if (!inst)                                       \
         {                                              \
            DBG("no instance to call "#meth);           \
            return __VA_ARGS__;                         \
         }                                              \
       if (!inst->api->meth)                            \
         {                                              \
            DBG("no "#meth" in instance=%p", inst);     \
            return __VA_ARGS__;                         \
         }                                              \
    }                                                   \
  while (0)

#define EMOTION_ENGINE_INSTANCE_CALL(inst, meth, ...)   \
  do                                                    \
    {                                                   \
       EMOTION_ENGINE_INSTANCE_CHECK(inst, meth);       \
       inst->api->meth(inst->data, ## __VA_ARGS__);     \
    }                                                   \
  while (0)

#define EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meth, retval, ...)       \
  do                                                                    \
    {                                                                   \
       EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, retval);               \
       return inst->api->meth(inst->data, ## __VA_ARGS__);              \
    }                                                                   \
  while (0)


static const Emotion_Engine *
_emotion_engine_registry_find(const char *name)
{
   const Eina_List *n;
   const Emotion_Engine_Registry_Entry *re;
   EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
     {
        if (strcmp(re->engine->name, name) == 0)
          return re->engine;
     }
   return NULL;
}

static Emotion_Engine_Instance *
_emotion_engine_instance_new(const Emotion_Engine *engine, Evas_Object *obj, void *data)
{
   Emotion_Engine_Instance *inst = calloc(1, sizeof(Emotion_Engine_Instance));
   EINA_SAFETY_ON_NULL_GOTO(inst, error);
   inst->api = engine;
   inst->obj = obj;
   inst->data = data;
   return inst;

 error:
   engine->del(data);
   return NULL;
}

static Eina_Module *
_find_mod(const char *name)
{
   Eina_Array_Iterator iterator;
   Eina_Module *m;
   unsigned int i;
   int inlen;

   if (!name || !_emotion_modules) return NULL;
   inlen = strlen(name);
   EINA_ARRAY_ITER_NEXT(_emotion_modules, i, m, iterator)
     {
        const char *path = eina_module_file_get(m);
        const char *p, *p1, *p2;
        int found, len;

        if ((!path) || (!path[0])) continue;
        // path is /*/modulename/ARCH/module.* - we want "modulename"
        found = 0;
        p1 = p2 = NULL;
        for (p = path + strlen(path) - 1;
             p > path;
             p--)
          {
             if (*p == '/')
               {
                  found++;
                  // found == 1 -> p = /module.*
                  // found == 2 -> p = /ARCH/module.*
                  // found == 3 -> p = /modulename/ARCH/module.*
                  if (found == 2) p2 = p;
                  if (found == 3)
                    {
                       p1 = p;
                       break;
                    }
               }
          }
        if (p1)
          {
             p1++;
             len = p2 - p1;
             if (len == inlen)
               {
                  if (!strncmp(p1, name, len)) return m;
               }
          }
     }
   return NULL;
}

Emotion_Engine_Instance *
emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_Options *opts)
{
   const Eina_List *n;
   const Emotion_Engine_Registry_Entry *re;
   const Emotion_Engine *engine;
   void *data;
   Eina_Module *m;
   char *disp = NULL;

   _emotion_modules_load();

   if ((!name) && getenv("EMOTION_ENGINE"))
     {
        name = getenv("EMOTION_ENGINE");
        DBG("using EMOTION_ENGINE=%s", name);
     }

   if (getenv("WAYLAND_DISPLAY"))
     {
        disp = eina_strdup(getenv("DISPLAY"));
        unsetenv("DISPLAY");
     }


   if (name)
     {
        m = _find_mod(name);
        if (m)
          {
             if (!eina_module_load(m))
               ERR("Cannot load module %s", eina_module_file_get(m));
          }
     }

   if (!_emotion_engine_registry)
     {
        m = _find_mod("generic");
        if (!m) m = _find_mod("xine");
        if (!m) m = _find_mod("gstreamer");
        if (!m) m = _find_mod("gstreamer1");
        if (!m) m = _find_mod("libvlc");
        if (!eina_module_load(m))
          ERR("Cannot load module %s", eina_module_file_get(m));
     }

   if (name)
     {
        engine = _emotion_engine_registry_find(name);
        if (!engine)
          ERR("Couldn't find requested engine: %s. Try fallback", name);
        else
          {
             data = engine->add(engine, obj, opts);
             if (data)
               {
                  INF("Using requested engine %s, data=%p", name, data);
                  if (disp) setenv("DISPLAY", disp, 1);
                  free(disp);
                  return _emotion_engine_instance_new(engine, obj, data);
               }

             ERR("Requested engine '%s' could not be used. Try fallback", name);
          }
     }

   EINA_LIST_FOREACH(_emotion_engine_registry, n, re)
     {
        engine = re->engine;
        DBG("Trying engine %s, priority=%d (%d)",
            engine->name, re->priority, engine->priority);

        data = engine->add(engine, obj, opts);
        if (data)
          {
             INF("Using fallback engine %s, data=%p", engine->name, data);
             if (disp) setenv("DISPLAY", disp, 1);
             free(disp);
             return _emotion_engine_instance_new(engine, obj, data);
          }
     }

   ERR("No engine worked");
   if (disp) setenv("DISPLAY", disp, 1);
   free(disp);
   return NULL;
}

void
emotion_engine_instance_del(Emotion_Engine_Instance *inst)
{
   EINA_SAFETY_ON_NULL_RETURN(inst);
   inst->api->del(inst->data);
   free(inst);
}

Eina_Bool
emotion_engine_instance_name_equal(const Emotion_Engine_Instance *inst, const char *name)
{
   /* these are valid, no safety macros here */
   if (!name) return EINA_FALSE;
   if (!inst) return EINA_FALSE;
   return strcmp(name, inst->api->name) == 0;
}

void *
emotion_engine_instance_data_get(const Emotion_Engine_Instance *inst)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(inst, NULL);
   return inst->data;
}

Eina_Bool
emotion_engine_instance_file_open(Emotion_Engine_Instance *inst, const char *file)
{
   EMOTION_ENGINE_INSTANCE_CHECK(inst, file_open, EINA_FALSE);
   return inst->api->file_open(inst->data, file);
}

void
emotion_engine_instance_file_close(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, file_close);
}

void
emotion_engine_instance_play(Emotion_Engine_Instance *inst, double pos)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, play, pos);
}

void
emotion_engine_instance_stop(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, stop);
}

void
emotion_engine_instance_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, size_get, w, h);
}

void
emotion_engine_instance_pos_set(Emotion_Engine_Instance *inst, double pos)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, pos_set, pos);
}

double
emotion_engine_instance_len_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, len_get, 0.0);
}

double
emotion_engine_instance_buffer_size_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, buffer_size_get, 1.0);
}

int
emotion_engine_instance_fps_num_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_num_get, 1);
}

int
emotion_engine_instance_fps_den_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_den_get, 1);
}

double
emotion_engine_instance_fps_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_get, 1.0);
}

double
emotion_engine_instance_pos_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, pos_get, 0.0);
}

void
emotion_engine_instance_vis_set(Emotion_Engine_Instance *inst, Emotion_Vis vis)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, vis_set, vis);
}

Emotion_Vis
emotion_engine_instance_vis_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_get, EMOTION_VIS_NONE);
}

Eina_Bool
emotion_engine_instance_vis_supported(Emotion_Engine_Instance *inst, Emotion_Vis vis)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_supported, EINA_FALSE, vis);
}

double
emotion_engine_instance_ratio_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, ratio_get, 0.0);
}

Eina_Bool
emotion_engine_instance_video_handled(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_handled, EINA_FALSE);
}

Eina_Bool
emotion_engine_instance_audio_handled(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_handled, EINA_FALSE);
}

Eina_Bool
emotion_engine_instance_seekable(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, seekable, EINA_FALSE);
}

void
emotion_engine_instance_frame_done(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, frame_done);
}

Emotion_Format
emotion_engine_instance_format_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, format_get, EMOTION_FORMAT_NONE);
}

void
emotion_engine_instance_video_data_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, video_data_size_get, w, h);
}

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)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, yuv_rows_get, EINA_FALSE, w, h, yrows, urows, vrows);
}

Eina_Bool
emotion_engine_instance_bgra_data_get(const Emotion_Engine_Instance *inst, unsigned char **bgra_data)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, bgra_data_get, EINA_FALSE, bgra_data);
}

void
emotion_engine_instance_event_feed(Emotion_Engine_Instance *inst, int event)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, event_feed, event);
}

void
emotion_engine_instance_event_mouse_button_feed(Emotion_Engine_Instance *inst, int button, int x, int y)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_button_feed, button, x, y);
}

void
emotion_engine_instance_event_mouse_move_feed(Emotion_Engine_Instance *inst, int x, int y)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_move_feed, x, y);
}

int
emotion_engine_instance_video_channel_count(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_count, 0);
}

void
emotion_engine_instance_video_channel_set(Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_set, channel);
}

int
emotion_engine_instance_video_channel_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_get, 0);
}

void
emotion_engine_instance_video_subtitle_file_set(Emotion_Engine_Instance *inst, const char *filepath)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, video_subtitle_file_set, filepath);
}

const char *
emotion_engine_instance_video_subtitle_file_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_subtitle_file_get, NULL);
}

const char *
emotion_engine_instance_video_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_name_get, NULL, channel);
}

void
emotion_engine_instance_video_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_mute_set, mute);
}

Eina_Bool
emotion_engine_instance_video_channel_mute_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_mute_get, EINA_FALSE);
}

int
emotion_engine_instance_audio_channel_count(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_count, 0);
}

void
emotion_engine_instance_audio_channel_set(Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_set, channel);
}

int
emotion_engine_instance_audio_channel_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_get, 0);
}

const char *
emotion_engine_instance_audio_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_name_get, NULL, channel);
}

void
emotion_engine_instance_audio_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_mute_set, mute);
}

Eina_Bool
emotion_engine_instance_audio_channel_mute_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_mute_get, EINA_FALSE);
}

void
emotion_engine_instance_audio_channel_volume_set(Emotion_Engine_Instance *inst, double vol)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_volume_set, vol);
}

double
emotion_engine_instance_audio_channel_volume_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_volume_get, 0.0);
}

int
emotion_engine_instance_spu_channel_count(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_count, 0);
}

void
emotion_engine_instance_spu_channel_set(Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_set, channel);
}

int
emotion_engine_instance_spu_channel_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_get, 0);
}

const char *
emotion_engine_instance_spu_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_name_get, NULL, channel);
}

void
emotion_engine_instance_spu_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_mute_set, mute);
}

Eina_Bool
emotion_engine_instance_spu_channel_mute_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_mute_get, EINA_FALSE);
}

int
emotion_engine_instance_chapter_count(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_count, 0);
}

void
emotion_engine_instance_chapter_set(Emotion_Engine_Instance *inst, int chapter)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, chapter_set, chapter);
}

int
emotion_engine_instance_chapter_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_get, 0);
}

const char *
emotion_engine_instance_chapter_name_get(const Emotion_Engine_Instance *inst, int chapter)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_name_get, NULL, chapter);
}

void
emotion_engine_instance_speed_set(Emotion_Engine_Instance *inst, double speed)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, speed_set, speed);
}

double
emotion_engine_instance_speed_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, speed_get, 0.0);
}

Eina_Bool
emotion_engine_instance_eject(Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, eject, EINA_FALSE);
}

const char *
emotion_engine_instance_meta_get(const Emotion_Engine_Instance *inst, int meta)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meta_get, NULL, meta);
}

void *
emotion_engine_instance_meta_artwork_get(const Emotion_Engine_Instance *inst, Evas_Object *img, const char *path,  Emotion_Artwork_Info type)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meta_artwork_get, NULL, img, path, type);
}

void
emotion_engine_instance_priority_set(Emotion_Engine_Instance *inst, Eina_Bool priority)
{
   EMOTION_ENGINE_INSTANCE_CALL(inst, priority_set, priority);
}

Eina_Bool
emotion_engine_instance_priority_get(const Emotion_Engine_Instance *inst)
{
   EMOTION_ENGINE_INSTANCE_CALL_RET(inst, priority_get, EINA_FALSE);
}