summaryrefslogtreecommitdiff
path: root/src/modules/ethumb
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-01-24 22:58:24 +0100
committerDave Andreoli <dave@gurumeditation.it>2016-01-24 23:00:31 +0100
commitcca830832a9b68757eb83da77aac0294761623b3 (patch)
tree534ffb871834539e2d0913cf18cef5dabebc7e0c /src/modules/ethumb
parentc11764534bb71ec3fbcf5e91389277c730b0f1e9 (diff)
Ethumb: make the emotion plugin correctly use the edje frame if requested.
The emotion plugin was lacking the ability to use the edje frame as expected, this patch add this ability, so now video thumbnail works like the normal ones. This commit is a bit of a new feature, but I consider this a @fix as now the ethumb_frame_set() API works as expected, also the implementation is so simple that I think it can go in without any problems.
Diffstat (limited to 'src/modules/ethumb')
-rw-r--r--src/modules/ethumb/emotion/emotion.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/modules/ethumb/emotion/emotion.c b/src/modules/ethumb/emotion/emotion.c
index 2247318805..ee2cdfedc0 100644
--- a/src/modules/ethumb/emotion/emotion.c
+++ b/src/modules/ethumb/emotion/emotion.c
@@ -41,6 +41,7 @@ struct _emotion_plugin
41 Eina_Bool first; 41 Eina_Bool first;
42 Eet_File *ef; 42 Eet_File *ef;
43 Evas_Object *video; 43 Evas_Object *video;
44 Evas_Object *edje_frame;
44 Ethumb *e; 45 Ethumb *e;
45 int w, h; 46 int w, h;
46}; 47};
@@ -66,8 +67,16 @@ _resize_movie(struct _emotion_plugin *_plugin)
66 67
67 ethumb_plugin_image_resize(e, _plugin->w, _plugin->h); 68 ethumb_plugin_image_resize(e, _plugin->w, _plugin->h);
68 69
69 evas_object_resize(_plugin->video, fw, fh); 70 if (_plugin->edje_frame)
70 evas_object_move(_plugin->video, fx, fy); 71 {
72 evas_object_resize(_plugin->edje_frame, fw, fh);
73 evas_object_move(_plugin->edje_frame, fx, fy);
74 }
75 else
76 {
77 evas_object_resize(_plugin->video, fw, fh);
78 evas_object_move(_plugin->video, fx, fy);
79 }
71 emotion_object_audio_mute_set(_plugin->video, 1); 80 emotion_object_audio_mute_set(_plugin->video, 1);
72} 81}
73 82
@@ -199,6 +208,7 @@ _finish_thumb_obj(void *data)
199{ 208{
200 struct _emotion_plugin *_plugin = data; 209 struct _emotion_plugin *_plugin = data;
201 evas_object_del(_plugin->video); 210 evas_object_del(_plugin->video);
211 if (_plugin->edje_frame) evas_object_del(_plugin->edje_frame);
202 free(_plugin); 212 free(_plugin);
203} 213}
204 214
@@ -260,7 +270,9 @@ _frame_grab_single(void *data)
260 EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resized_cb, _plugin)); 270 EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resized_cb, _plugin));
261 271
262 emotion_object_play_set(_plugin->video, 0); 272 emotion_object_play_set(_plugin->video, 0);
273
263 evas_object_del(_plugin->video); 274 evas_object_del(_plugin->video);
275 if (_plugin->edje_frame) evas_object_del(_plugin->edje_frame);
264 free(_plugin); 276 free(_plugin);
265 277
266 ethumb_finished_callback_call(e, 1); 278 ethumb_finished_callback_call(e, 1);
@@ -368,6 +380,7 @@ _thumb_generate(Ethumb *e)
368 Ethumb_Thumb_Format f; 380 Ethumb_Thumb_Format f;
369 double dv; 381 double dv;
370 struct _emotion_plugin *_plugin = calloc(1, sizeof(struct _emotion_plugin)); 382 struct _emotion_plugin *_plugin = calloc(1, sizeof(struct _emotion_plugin));
383 const char *ffile, *fgroup, *fswallow;
371 384
372 o = emotion_object_add(ethumb_evas_get(e)); 385 o = emotion_object_add(ethumb_evas_get(e));
373 r = emotion_object_init(o, NULL); 386 r = emotion_object_init(o, NULL);
@@ -413,6 +426,32 @@ _thumb_generate(Ethumb *e)
413 emotion_object_play_set(o, 1); 426 emotion_object_play_set(o, 1);
414 evas_object_show(o); 427 evas_object_show(o);
415 428
429 ethumb_frame_get(e, &ffile, &fgroup, &fswallow);
430 if (ffile && fgroup && fswallow)
431 {
432 Evas_Object *ed = edje_object_add(ethumb_evas_get(e));
433 if (!ed)
434 {
435 ERR("could not create edje frame object.");
436 return _plugin;
437 }
438 if (!edje_object_file_set(ed, ffile, fgroup))
439 {
440 ERR("could not load frame theme.");
441 evas_object_del(ed);
442 return _plugin;
443 }
444 edje_object_part_swallow(ed, fswallow, o);
445 if (!edje_object_part_swallow_get(ed, fswallow))
446 {
447 ERR("could not swallow video to edje frame.");
448 evas_object_del(ed);
449 return _plugin;
450 }
451 evas_object_show(ed);
452 _plugin->edje_frame = ed;
453 }
454
416 return _plugin; 455 return _plugin;
417} 456}
418 457
@@ -423,6 +462,7 @@ _thumb_cancel(Ethumb *e EINA_UNUSED, void *data)
423 462
424 if (_plugin->ef) eet_close(_plugin->ef); 463 if (_plugin->ef) eet_close(_plugin->ef);
425 evas_object_del(_plugin->video); 464 evas_object_del(_plugin->video);
465 if (_plugin->edje_frame) evas_object_del(_plugin->edje_frame);
426 free(_plugin); 466 free(_plugin);
427} 467}
428 468