summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am11
-rw-r--r--src/lib/emix.c144
-rw-r--r--src/lib/emix.h96
3 files changed, 250 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 290c76f..b53efe8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,16 @@ MAINTAINERCLEANFILES = \
24EXTRA_DIST = 24EXTRA_DIST =
25 25
26lib_LTLIBRARIES = \ 26lib_LTLIBRARIES = \
27 src/lib/libepulse.la 27 src/lib/libepulse.la \
28 src/lib/libemix.la
29
30src_lib_libemix_la_SOURCES = \
31 src/lib/emix.h \
32 src/lib/emix.c
33
34src_lib_libemix_la_LIBADD = @EFL_LIBS@
35src_lib_libemix_la_LDFLAGS = -no-undefined -avoid-version
36src_lib_libemix_la_LIBTOOLFLAGS = --tag=disable-static
28 37
29src_lib_libepulse_la_SOURCES = \ 38src_lib_libepulse_la_SOURCES = \
30 src/lib/common.c \ 39 src/lib/common.c \
diff --git a/src/lib/emix.c b/src/lib/emix.c
new file mode 100644
index 0000000..2b6e518
--- /dev/null
+++ b/src/lib/emix.c
@@ -0,0 +1,144 @@
1#include "emix.h"
2
3#include <common.h>
4
5typedef struct Context {
6 Eina_List *backends_available;
7 Emix_Backend *loaded;
8} Context;
9
10static int _init_count = 0;
11static Context *ctx = NULL;
12
13int EMIX_SINK_ADDED = 0;
14int EMIX_SINK_CHANGED = 0;
15int EMIX_SINK_DEFAULT = 0;
16int EMIX_SINK_REMOVED = 0;
17int EMIX_SINK_INPUT_ADDED = 0;
18int EMIX_SINK_INPUT_CHANGED = 0;
19int EMIX_SINK_INPUT_REMOVED = 0;
20int EMIX_SOURCE_ADDED = 0;
21int EMIX_SOURCE_CHANGED = 0;
22int EMIX_SOURCE_REMOVED = 0;
23int EMIX_SOURCE_INPUT_ADDED = 0;
24int EMIX_SOURCE_INPUT_REMOVED = 0;
25int EMIX_DISCONNECTED = 0;
26
27void
28emix_init(void)
29{
30 if (_init_count > 0)
31 goto end;
32
33 ctx = calloc(1, sizeof(Context));
34 if (!ctx)
35 {
36 ERR("Could not create Epulse Context");
37 return 0;
38 }
39
40 EMIX_DISCONNECTED = ecore_event_type_new();
41 EMIX_SINK_ADDED = ecore_event_type_new();
42 EMIX_SINK_CHANGED = ecore_event_type_new();
43 EMIX_SINK_DEFAULT = ecore_event_type_new();
44 EMIX_SINK_REMOVED = ecore_event_type_new();
45 EMIX_SINK_INPUT_ADDED = ecore_event_type_new();
46 EMIX_SINK_INPUT_CHANGED = ecore_event_type_new();
47 EMIX_SINK_INPUT_REMOVED = ecore_event_type_new();
48 EMIX_SOURCE_ADDED = ecore_event_type_new();
49 EMIX_SOURCE_CHANGED = ecore_event_type_new();
50 EMIX_SOURCE_REMOVED = ecore_event_type_new();
51 EMIX_SOURCE_INPUT_ADDED = ecore_event_type_new();
52 EMIX_SOURCE_INPUT_REMOVED = ecore_event_type_new();
53 /* init(); */
54
55 end:
56 _init_count++;
57 return _init_count;
58}
59
60void
61emix_shutdown()
62{
63 if (_init_count == 0)
64 return;
65
66 _init_count--;
67 if (_init_count > 0)
68 return;
69
70 free(ctx);
71 ctx = NULL;
72 /* shutdown(); */
73}
74
75const Emix_Volume *
76emix_volume_get(Emix_Sink* sink)
77{
78 return NULL;
79}
80
81void
82emix_volume_set(Emix_Sink* sink, Emix_Volume* volume)
83{
84}
85
86Eina_Bool
87emix_mute_get(Emix_Sink *sink)
88{
89 return EINA_TRUE;
90}
91
92void
93emix_mute_set(Emix_Sink *sink, Eina_Bool mute)
94{
95}
96
97Emix_Sink*
98emix_sink_default_get(void)
99{
100 return NULL; //TODO load this from eet
101}
102
103void
104emix_sink_default_set(Emix_Sink* sink)
105{
106 return; //TODO save this in eet
107}
108
109Emix_Source*
110emix_source_default_get(void)
111{
112 return NULL; //TODO load this from eet
113}
114
115void
116emix_source_default_set(Emix_Source* source)
117{
118 return; //TODO save this in eet
119}
120
121Eina_Bool
122emix_change_sink_support(void)
123{
124 return EINA_FALSE;
125}
126
127void
128emix_change_sink(Emix_Playback *playback, Emix_Sink *sink)
129{
130 /* ebackend_change_sink(playback, sink); */
131}
132
133Eina_Bool
134emix_change_source_support(void)
135{
136 /* return ebackend_change_source_support(); */
137 return EINA_FALSE;
138}
139
140void
141emix_change_source(Emix_Playback *playback, Emix_Source *source)
142{
143 /* ebackend_change_source(playback, source); */
144}
diff --git a/src/lib/emix.h b/src/lib/emix.h
new file mode 100644
index 0000000..0a8d1ee
--- /dev/null
+++ b/src/lib/emix.h
@@ -0,0 +1,96 @@
1#ifndef EMIX_H
2#define EMIX_H
3
4#include <Eina.h>
5
6EAPI extern int EMIX_DISCONNECTED;
7EAPI extern int EMIX_SINK_ADDED;
8EAPI extern int EMIX_SINK_CHANGED;
9EAPI extern int EMIX_SINK_DEFAULT;
10EAPI extern int EMIX_SINK_REMOVED;
11EAPI extern int EMIX_SINK_INPUT_ADDED;
12EAPI extern int EMIX_SINK_INPUT_CHANGED;
13EAPI extern int EMIX_SINK_INPUT_REMOVED;
14EAPI extern int EMIX_SOURCE_ADDED;
15EAPI extern int EMIX_SOURCE_CHANGED;
16EAPI extern int EMIX_SOURCE_REMOVED;
17EAPI extern int EMIX_SOURCE_INPUT_ADDED;
18EAPI extern int EMIX_SOURCE_INPUT_REMOVED;
19
20typedef struct _Emix_Volume {
21 int channel_count;
22 // the index of the field is the id of the channel, the value the volume
23 int* volumes;
24} Emix_Volume;
25
26typedef struct _Emix_Sink {
27 const char *name;
28 void *b_data;
29} Emix_Sink;
30
31typedef struct _Emix_Playback {
32 const char *name;
33 void *b_data;
34} Emix_Playback;
35
36typedef struct _Emix_Source {
37 void *b_data;
38 const char *name;
39} Emix_Source;
40
41typedef struct _Emix_Source_Input {
42 const char *name;
43 void *b_data;
44} Emix_Source_Input;
45
46
47typedef struct _Emix_Backend {
48 void (*ebackend_init)(void);
49 void (*ebackend_shutdown)(void);
50
51 const Emix_Volume* (*ebackend_volume_get)(Emix_Sink* sink);
52 void (*ebackend_volume_set)(Emix_Sink* sink,
53 Emix_Volume volume);
54 Eina_Bool (*ebackend_mute_get)(Emix_Sink *sink);
55 void (*ebackend_mute_set)(Emix_Sink *sink, Eina_Bool bool);
56
57 Eina_Bool (*ebackend_sink_default_support)(void);
58 const Emix_Sink* (*ebackend_sink_default_get)(void);
59 void (*ebackend_sink_default_set)(Emix_Sink* sink);
60
61 Eina_Bool (*ebackend_source_default_support)(void);
62 void (*ebackend_source_default_set)(Emix_Source* source);
63 Eina_Bool (*ebackend_change_sink_support)(void);
64 void (*ebackend_change_sink)(Emix_Playback *playback,
65 Emix_Sink *sink);
66
67 Eina_Bool (*ebackend_change_source_support)(void);
68 void (*ebackend_change_source)(Emix_Playback *playback,
69 Emix_Source *source);
70} Emix_Backend;
71
72EAPI void emix_init(void);
73EAPI void emix_shutdown(void);
74
75EAPI const Emix_Volume* emix_volume_get(Emix_Sink* sink);
76EAPI void emix_volume_set(Emix_Sink* sink, Emix_Volume* volume);
77EAPI Eina_Bool emix_mute_get(Emix_Sink *sink);
78EAPI void emix_mute_set(Emix_Sink *sink, Eina_Bool);
79
80EAPI Eina_Bool emix_sink_default_support(void);
81EAPI Emix_Sink* emix_sink_default_get(void);
82EAPI void emix_sink_default_set(Emix_Sink* sink);
83
84EAPI Eina_Bool emix_source_default_support(void);
85EAPI Emix_Source* emix_source_default_get(void);
86EAPI void emix_source_default_set(Emix_Source* source);
87
88EAPI Eina_Bool emix_change_sink_support(void);
89EAPI void emix_change_sink(Emix_Playback *playback,
90 Emix_Sink *sink);
91
92EAPI Eina_Bool emix_change_source_support(void);
93EAPI void emix_change_source(Emix_Playback *playback,
94 Emix_Source *source);
95
96#endif /* EMIX_H */