aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/edje_externals/elm_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/edje_externals/elm_video.c')
-rw-r--r--libraries/elementary/src/edje_externals/elm_video.c261
1 files changed, 261 insertions, 0 deletions
diff --git a/libraries/elementary/src/edje_externals/elm_video.c b/libraries/elementary/src/edje_externals/elm_video.c
new file mode 100644
index 0000000..e869afe
--- /dev/null
+++ b/libraries/elementary/src/edje_externals/elm_video.c
@@ -0,0 +1,261 @@
1#include "private.h"
2
3typedef struct _Elm_Params_Video
4{
5 Elm_Params base;
6 const char *file;
7 const char *uri;
8 Eina_Bool play:1;
9 Eina_Bool play_exists:1;
10 Eina_Bool pause:1;
11 Eina_Bool pause_exists:1;
12 Eina_Bool stop:1;
13 Eina_Bool stop_exists:1;
14 Eina_Bool audio_mute:1;
15 Eina_Bool audio_mute_exists:1;
16 double audio_level;
17 Eina_Bool audio_level_exists:1;
18 double play_position;
19 Eina_Bool play_position_exists:1;
20 Eina_Bool remember_position:1;
21 Eina_Bool remember_position_exists:1;
22} Elm_Params_Video;
23
24static void
25external_video_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
26{
27 const Elm_Params_Video *p;
28
29 if (to_params) p = to_params;
30 else if (from_params) p = from_params;
31 else return;
32
33 if (p->file) elm_video_file_set(obj, p->file);
34 if (p->uri) elm_video_file_set(obj, p->uri);
35 if (p->play_exists && p->play) elm_video_play(obj);
36 if (p->pause_exists && p->pause) elm_video_pause(obj);
37 if (p->stop_exists && p->stop) elm_video_stop(obj);
38 if (p->audio_mute_exists) elm_video_audio_mute_set(obj, p->audio_mute);
39 if (p->audio_level_exists) elm_video_audio_level_set(obj, p->audio_level);
40 if (p->play_position_exists)
41 elm_video_play_position_set(obj, p->play_position);
42 if (p->remember_position_exists)
43 elm_video_remember_position_set(obj, p->remember_position);
44}
45
46static Eina_Bool
47external_video_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
48{
49 if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
50 && (!strcmp(param->name, "file")))
51 {
52 elm_video_file_set(obj, param->s);
53 return EINA_TRUE;
54 }
55 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
56 && (!strcmp(param->name, "uri")))
57 {
58 elm_video_file_set(obj, param->s);
59 return EINA_TRUE;
60 }
61 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
62 && (!strcmp(param->name, "play")))
63 {
64 if (param->i)
65 elm_video_play(obj);
66 return EINA_TRUE;
67 }
68 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
69 && (!strcmp(param->name, "pause")))
70 {
71 if (param->i)
72 elm_video_pause(obj);
73 return EINA_TRUE;
74 }
75 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
76 && (!strcmp(param->name, "stop")))
77 {
78 if (param->i)
79 elm_video_stop(obj);
80 return EINA_TRUE;
81 }
82 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
83 && (!strcmp(param->name, "audio mute")))
84 {
85 elm_video_audio_mute_set(obj, param->i);
86 return EINA_TRUE;
87 }
88 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
89 && (!strcmp(param->name, "audio level")))
90 {
91 elm_video_audio_level_set(obj, param->d);
92 return EINA_TRUE;
93 }
94 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
95 && (!strcmp(param->name, "play position")))
96 {
97 elm_video_play_position_set(obj, param->d);
98 return EINA_TRUE;
99 }
100 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
101 && (!strcmp(param->name, "remember position")))
102 {
103 elm_video_remember_position_set(obj, param->i);
104 return EINA_TRUE;
105 }
106
107 ERR("unknown parameter '%s' of type '%s'",
108 param->name, edje_external_param_type_str(param->type));
109
110 return EINA_FALSE;
111}
112
113static Eina_Bool
114external_video_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
115{
116 if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
117 && (!strcmp(param->name, "file")))
118 {
119 // param->s = elm_video_file_get(obj);
120 // return EINA_TRUE;
121 return EINA_FALSE;
122 }
123 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
124 && (!strcmp(param->name, "uri")))
125 {
126 // elm_video_uri_get(obj, param->s);
127 // return EINA_TRUE;
128 return EINA_FALSE;
129 }
130 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
131 && (!strcmp(param->name, "play")))
132 {
133 // param->i = elm_video_play_get(obj); return EINA_TRUE;
134 return EINA_FALSE;
135 }
136 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
137 && (!strcmp(param->name, "pause")))
138 {
139 // param->i = elm_video_pause_get(obj); return EINA_TRUE;
140 return EINA_FALSE;
141 }
142 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
143 && (!strcmp(param->name, "stop")))
144 {
145 // param->i = elm_video_stop_get(obj); return EINA_TRUE;
146 return EINA_FALSE;
147 }
148 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
149 && (!strcmp(param->name, "audio mute")))
150 {
151 param->i = elm_video_audio_mute_get(obj);
152 return EINA_TRUE;
153 }
154 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) &&
155 (!strcmp(param->name, "audio level")))
156 {
157 param->d = elm_video_audio_level_get(obj);
158 return EINA_TRUE;
159 }
160 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
161 && (!strcmp(param->name, "play position")))
162 {
163 param->d = elm_video_play_position_get(obj);
164 return EINA_TRUE;
165 }
166 else if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
167 && (!strcmp(param->name, "remember position")))
168 {
169 param->i = elm_video_remember_position_get(obj);
170 return EINA_TRUE;
171 }
172
173 ERR("unknown parameter '%s' of type '%s'", param->name,
174 edje_external_param_type_str(param->type));
175
176 return EINA_FALSE; }
177
178static void * external_video_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
179{
180 Elm_Params_Video *mem;
181 Edje_External_Param *param;
182 const Eina_List *l;
183
184 mem = calloc(1, sizeof(Elm_Params_Video));
185 if (!mem) return NULL;
186
187 EINA_LIST_FOREACH(params, l, param)
188 {
189 if (!strcmp(param->name, "file"))
190 mem->file = eina_stringshare_add(param->s);
191 else if (!strcmp(param->name, "uri"))
192 mem->uri = eina_stringshare_add(param->s);
193 else if (!strcmp(param->name, "play"))
194 {
195 mem->play = param->i;
196 mem->play_exists = EINA_TRUE;
197 }
198 else if (!strcmp(param->name, "pause"))
199 {
200 mem->pause = param->i;
201 mem->pause_exists = EINA_TRUE;
202 }
203 else if (!strcmp(param->name, "stop"))
204 {
205 mem->stop = param->i;
206 mem->stop_exists = EINA_TRUE;
207 }
208 else if (!strcmp(param->name, "audio mute"))
209 {
210 mem->audio_mute = param->i;
211 mem->audio_mute_exists = EINA_TRUE;
212 }
213 else if (!strcmp(param->name, "audio level"))
214 {
215 mem->audio_level = param->d;
216 mem->audio_level_exists = EINA_TRUE;
217 }
218 else if (!strcmp(param->name, "play position"))
219 {
220 mem->play_position = param->d;
221 mem->play_position_exists = EINA_TRUE;
222 }
223 else if (!strcmp(param->name, "remember position"))
224 {
225 mem->remember_position = param->i;
226 mem->remember_position = EINA_TRUE;
227 }
228 }
229 return mem;
230}
231
232static Evas_Object *external_video_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
233{
234 ERR("No content.");
235 return NULL;
236}
237
238static void external_video_params_free(void *params)
239{
240 Elm_Params_Video *mem = params;
241
242 if (mem->file) eina_stringshare_del(mem->file);
243 if (mem->uri) eina_stringshare_del(mem->uri);
244 free(params);
245}
246
247static Edje_External_Param_Info external_video_params[] = {
248 DEFINE_EXTERNAL_COMMON_PARAMS, EDJE_EXTERNAL_PARAM_INFO_STRING("file"),
249 EDJE_EXTERNAL_PARAM_INFO_STRING("uri"),
250 EDJE_EXTERNAL_PARAM_INFO_BOOL("play"),
251 EDJE_EXTERNAL_PARAM_INFO_BOOL("pause"),
252 EDJE_EXTERNAL_PARAM_INFO_BOOL("stop"),
253 EDJE_EXTERNAL_PARAM_INFO_BOOL("audio mute"),
254 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("audio level"),
255 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("play position"),
256 EDJE_EXTERNAL_PARAM_INFO_BOOL("remember position"),
257 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
258};
259
260DEFINE_EXTERNAL_ICON_ADD(video, "video");
261DEFINE_EXTERNAL_TYPE_SIMPLE(video, "Video");