summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/emotion/emotion_smart.c367
-rw-r--r--src/tests/emotion/emotion_test_main.c2
2 files changed, 197 insertions, 172 deletions
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index 16c4c08038..87857fa693 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -21,13 +21,13 @@
21 21
22#define E_SMART_OBJ_GET(smart, o, type) \ 22#define E_SMART_OBJ_GET(smart, o, type) \
23 { \ 23 { \
24 if (!o) return; \ 24 if (!o) return; \
25 if (!eo_isa(o, MY_CLASS)) { \ 25 if (!eo_isa(o, MY_CLASS)) { \
26 ERR("Tried calling on a non-emotion object."); \ 26 ERR("Tried calling on a non-emotion object."); \
27 return; \ 27 return; \
28 } \ 28 } \
29 smart = eo_data_scope_get(o, MY_CLASS); \ 29 smart = eo_data_scope_get(o, MY_CLASS); \
30 if (!smart) return; \ 30 if (!smart) return; \
31 } 31 }
32 32
33#define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \ 33#define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \
@@ -56,6 +56,7 @@ struct _Emotion_Object_Data
56 EINA_REFCOUNT; 56 EINA_REFCOUNT;
57 Emotion_Engine_Instance *engine_instance; 57 Emotion_Engine_Instance *engine_instance;
58 58
59 const char *engine;
59 const char *file; 60 const char *file;
60 Evas_Object *smartobj; 61 Evas_Object *smartobj;
61 Evas_Object *obj; 62 Evas_Object *obj;
@@ -146,6 +147,14 @@ static const char SIG_POSITION_LOAD_SUCCEED[] = "position_load,succeed";
146static const char SIG_POSITION_LOAD_FAILED[] = "position_load,failed"; 147static const char SIG_POSITION_LOAD_FAILED[] = "position_load,failed";
147 148
148static void 149static void
150_engine_init(Eo *obj, Emotion_Object_Data *sd)
151{
152 if (sd->engine_instance) return;
153 sd->engine_instance = emotion_engine_instance_new(sd->engine, obj,
154 &(sd->module_options));
155}
156
157static void
149_emotion_image_data_zero(Evas_Object *img) 158_emotion_image_data_zero(Evas_Object *img)
150{ 159{
151 void *data = NULL; 160 void *data = NULL;
@@ -178,13 +187,13 @@ _smart_data_free(Emotion_Object_Data *sd)
178 if (sd->save_xattr) eio_file_cancel(sd->save_xattr); 187 if (sd->save_xattr) eio_file_cancel(sd->save_xattr);
179 sd->save_xattr = NULL; 188 sd->save_xattr = NULL;
180#endif 189#endif
181 190
182 if (sd->engine_instance) 191 if (sd->engine_instance)
183 { 192 {
184 emotion_engine_instance_file_close(sd->engine_instance); 193 emotion_engine_instance_file_close(sd->engine_instance);
185 emotion_engine_instance_del(sd->engine_instance); 194 emotion_engine_instance_del(sd->engine_instance);
195 sd->engine_instance = NULL;
186 } 196 }
187 sd->engine_instance = NULL;
188 if (sd->obj) evas_object_del(sd->obj); 197 if (sd->obj) evas_object_del(sd->obj);
189 sd->obj = NULL; 198 sd->obj = NULL;
190 if (sd->crop.clipper) evas_object_del(sd->crop.clipper); 199 if (sd->crop.clipper) evas_object_del(sd->crop.clipper);
@@ -201,6 +210,8 @@ _smart_data_free(Emotion_Object_Data *sd)
201 sd->progress.info = NULL; 210 sd->progress.info = NULL;
202 eina_stringshare_del(sd->ref.file); 211 eina_stringshare_del(sd->ref.file);
203 sd->ref.file = NULL; 212 sd->ref.file = NULL;
213 if (sd->file) eina_stringshare_del(sd->engine);
214 sd->engine = NULL;
204 215
205 /* TODO: remove legacy: emotion used to have no shutdown, call automatically */ 216 /* TODO: remove legacy: emotion used to have no shutdown, call automatically */
206 emotion_shutdown(); 217 emotion_shutdown();
@@ -304,18 +315,17 @@ _emotion_object_option_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *pd, const c
304} 315}
305 316
306EOLIAN static Eina_Bool 317EOLIAN static Eina_Bool
307_emotion_object_engine_set(Eo *obj, Emotion_Object_Data *pd, const char *module_filename) 318_emotion_object_engine_set(Eo *obj, Emotion_Object_Data *pd, const char *engine)
308{ 319{
309 Emotion_Object_Data *sd = pd; 320 Emotion_Object_Data *sd = pd;
310 const char *file; 321 const char *file;
311 322
312 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 323 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
313 324
314 if (emotion_engine_instance_name_equal(sd->engine_instance, module_filename)) 325 if (!engine) engine = "gstreamer1";
315 { 326 if (!strcmp(engine, sd->engine)) return EINA_TRUE;
316 DBG("no need to reset engine, already set: %s", module_filename); 327
317 return EINA_TRUE; 328 eina_stringshare_replace(&(sd->engine), engine);
318 }
319 329
320 file = sd->file; 330 file = sd->file;
321 sd->file = NULL; 331 sd->file = NULL;
@@ -341,7 +351,8 @@ _emotion_object_engine_set(Eo *obj, Emotion_Object_Data *pd, const char *module_
341 sd->anim = NULL; 351 sd->anim = NULL;
342 352
343 if (sd->engine_instance) emotion_engine_instance_del(sd->engine_instance); 353 if (sd->engine_instance) emotion_engine_instance_del(sd->engine_instance);
344 sd->engine_instance = emotion_engine_instance_new(module_filename, obj, &(sd->module_options)); 354 sd->engine_instance = NULL;
355 _engine_init(obj, sd);
345 if (!sd->engine_instance) 356 if (!sd->engine_instance)
346 { 357 {
347 sd->file = file; 358 sd->file = file;
@@ -368,12 +379,12 @@ _emotion_object_efl_file_file_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd,
368{ 379{
369 DBG("file=%s", file); 380 DBG("file=%s", file);
370 381
371 if (!eina_stringshare_replace(&sd->file, file)) 382 if (!eina_stringshare_replace(&sd->file, file)) return EINA_TRUE;
372 return EINA_TRUE;
373 383
384 if (!sd->engine_instance) _engine_init(obj, sd);
374 if (!sd->engine_instance) 385 if (!sd->engine_instance)
375 { 386 {
376 WRN("No engine choosen. Call emotion_object_init()?"); 387 WRN("No engine choosen. Please set an engine.");
377 return EINA_FALSE; 388 return EINA_FALSE;
378 } 389 }
379 390
@@ -442,34 +453,34 @@ _emotion_aspect_borders_apply(Evas_Object *obj, Emotion_Object_Data *sd, int w,
442 evas_object_geometry_get(obj, &x, &y, NULL, NULL); 453 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
443 454
444 /* applying calculated borders */ 455 /* applying calculated borders */
445 if (sd->crop.l == 0 && sd->crop.r == 0 && 456 if ((sd->crop.l == 0) && (sd->crop.r == 0) &&
446 sd->crop.t == 0 && sd->crop.b == 0) 457 (sd->crop.t == 0) && (sd->crop.b == 0))
447 { 458 {
448 Evas_Object *old_clipper; 459 Evas_Object *old_clipper;
449 if (sd->crop.clipper) 460 if (sd->crop.clipper)
450 { 461 {
451 old_clipper = evas_object_clip_get(sd->crop.clipper); 462 old_clipper = evas_object_clip_get(sd->crop.clipper);
452 evas_object_clip_unset(sd->obj); 463 evas_object_clip_unset(sd->obj);
453 evas_object_clip_set(sd->obj, old_clipper); 464 evas_object_clip_set(sd->obj, old_clipper);
454 evas_object_del(sd->crop.clipper); 465 evas_object_del(sd->crop.clipper);
455 sd->crop.clipper = NULL; 466 sd->crop.clipper = NULL;
456 } 467 }
457 } 468 }
458 else 469 else
459 { 470 {
460 if (!sd->crop.clipper) 471 if (!sd->crop.clipper)
461 { 472 {
462 Evas_Object *old_clipper; 473 Evas_Object *old_clipper;
463 sd->crop.clipper = evas_object_rectangle_add( 474 sd->crop.clipper = evas_object_rectangle_add
464 evas_object_evas_get(obj)); 475 (evas_object_evas_get(obj));
465 evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255); 476 evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255);
466 evas_object_smart_member_add(sd->crop.clipper, obj); 477 evas_object_smart_member_add(sd->crop.clipper, obj);
467 old_clipper = evas_object_clip_get(sd->obj); 478 old_clipper = evas_object_clip_get(sd->obj);
468 evas_object_clip_set(sd->obj, sd->crop.clipper); 479 evas_object_clip_set(sd->obj, sd->crop.clipper);
469 evas_object_clip_set(sd->crop.clipper, old_clipper); 480 evas_object_clip_set(sd->crop.clipper, old_clipper);
470 if (evas_object_visible_get(sd->obj)) 481 if (evas_object_visible_get(sd->obj))
471 evas_object_show(sd->crop.clipper); 482 evas_object_show(sd->crop.clipper);
472 } 483 }
473 } 484 }
474 _clipper_position_size_update(obj, x, y, w, h, iw, ih); 485 _clipper_position_size_update(obj, x, y, w, h, iw, ih);
475} 486}
@@ -496,64 +507,60 @@ _emotion_object_aspect_border_apply(Evas_Object *obj, Emotion_Object_Data *sd, i
496 */ 507 */
497 if (sd->aspect == EMOTION_ASPECT_KEEP_NONE) 508 if (sd->aspect == EMOTION_ASPECT_KEEP_NONE)
498 { 509 {
499 sd->crop.l = 0; 510 sd->crop.l = 0;
500 sd->crop.r = 0; 511 sd->crop.r = 0;
501 sd->crop.t = 0; 512 sd->crop.t = 0;
502 sd->crop.b = 0; 513 sd->crop.b = 0;
503 aspect_opt = 0; // just ignore keep_aspect 514 aspect_opt = 0; // just ignore keep_aspect
504 } 515 }
505 else if (sd->aspect == EMOTION_ASPECT_KEEP_WIDTH) 516 else if (sd->aspect == EMOTION_ASPECT_KEEP_WIDTH)
506 { 517 {
507 aspect_opt = 1; 518 aspect_opt = 1;
508 } 519 }
509 else if (sd->aspect == EMOTION_ASPECT_KEEP_HEIGHT) 520 else if (sd->aspect == EMOTION_ASPECT_KEEP_HEIGHT)
510 { 521 {
511 aspect_opt = 2; 522 aspect_opt = 2;
512 } 523 }
513 else if (sd->aspect == EMOTION_ASPECT_KEEP_BOTH) 524 else if (sd->aspect == EMOTION_ASPECT_KEEP_BOTH)
514 { 525 {
515 if (ir > r) 526 if (ir > r) aspect_opt = 1;
516 aspect_opt = 1; 527 else aspect_opt = 2;
517 else
518 aspect_opt = 2;
519 } 528 }
520 else if (sd->aspect == EMOTION_ASPECT_CROP) 529 else if (sd->aspect == EMOTION_ASPECT_CROP)
521 { 530 {
522 if (ir > r) 531 if (ir > r) aspect_opt = 2;
523 aspect_opt = 2; 532 else aspect_opt = 1;
524 else
525 aspect_opt = 1;
526 } 533 }
527 else if (sd->aspect == EMOTION_ASPECT_CUSTOM) 534 else if (sd->aspect == EMOTION_ASPECT_CUSTOM)
528 { 535 {
529 // nothing to do, just respect the border settings 536 // nothing to do, just respect the border settings
530 aspect_opt = 0; 537 aspect_opt = 0;
531 } 538 }
532 539
533 /* updating borders based on keep_aspect settings */ 540 /* updating borders based on keep_aspect settings */
534 if (aspect_opt == 1) // keep width 541 if (aspect_opt == 1) // keep width
535 { 542 {
536 int th, dh; 543 int th, dh;
537 double scale; 544 double scale;
538 545
539 sd->crop.l = 0; 546 sd->crop.l = 0;
540 sd->crop.r = 0; 547 sd->crop.r = 0;
541 scale = (double)iw / w; 548 scale = (double)iw / w;
542 th = h * scale; 549 th = h * scale;
543 dh = ih - th; 550 dh = ih - th;
544 sd->crop.t = sd->crop.b = dh / 2; 551 sd->crop.t = sd->crop.b = dh / 2;
545 } 552 }
546 else if (aspect_opt == 2) // keep height 553 else if (aspect_opt == 2) // keep height
547 { 554 {
548 int tw, dw; 555 int tw, dw;
549 double scale; 556 double scale;
550 557
551 sd->crop.t = 0; 558 sd->crop.t = 0;
552 sd->crop.b = 0; 559 sd->crop.b = 0;
553 scale = (double)ih / h; 560 scale = (double)ih / h;
554 tw = w * scale; 561 tw = w * scale;
555 dw = iw - tw; 562 dw = iw - tw;
556 sd->crop.l = sd->crop.r = dw / 2; 563 sd->crop.l = sd->crop.r = dw / 2;
557 } 564 }
558 565
559 _emotion_aspect_borders_apply(obj, sd, w, h, iw, ih); 566 _emotion_aspect_borders_apply(obj, sd, w, h, iw, ih);
@@ -597,13 +604,10 @@ emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a)
597 604
598 evas_object_color_set(sd->bg, r, g, b, a); 605 evas_object_color_set(sd->bg, r, g, b, a);
599 606
600 if (!evas_object_visible_get(obj)) 607 if (!evas_object_visible_get(obj)) return;
601 return;
602 608
603 if (a > 0) 609 if (a > 0) evas_object_show(sd->bg);
604 evas_object_show(sd->bg); 610 else evas_object_hide(sd->bg);
605 else
606 evas_object_hide(sd->bg);
607} 611}
608 612
609EAPI void 613EAPI void
@@ -622,9 +626,7 @@ emotion_object_keep_aspect_set(Evas_Object *obj, Emotion_Aspect a)
622 int w, h; 626 int w, h;
623 627
624 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 628 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
625 629 if (a == sd->aspect) return;
626 if (a == sd->aspect)
627 return;
628 630
629 sd->aspect = a; 631 sd->aspect = a;
630 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 632 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
@@ -637,7 +639,6 @@ emotion_object_keep_aspect_get(const Evas_Object *obj)
637 Emotion_Object_Data *sd; 639 Emotion_Object_Data *sd;
638 640
639 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_ASPECT_KEEP_NONE); 641 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_ASPECT_KEEP_NONE);
640
641 return sd->aspect; 642 return sd->aspect;
642} 643}
643 644
@@ -675,7 +676,6 @@ EOLIAN static Eina_Bool
675_emotion_object_efl_player_play_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) 676_emotion_object_efl_player_play_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd)
676{ 677{
677 if (!sd->engine_instance) return EINA_FALSE; 678 if (!sd->engine_instance) return EINA_FALSE;
678
679 return sd->play; 679 return sd->play;
680} 680}
681 681
@@ -712,6 +712,7 @@ emotion_object_position_get(const Evas_Object *obj)
712EOLIAN static double 712EOLIAN static double
713_emotion_object_efl_player_position_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) 713_emotion_object_efl_player_position_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd)
714{ 714{
715 if (!sd->engine_instance) return 0.0;
715 sd->pos = emotion_engine_instance_pos_get(sd->engine_instance); 716 sd->pos = emotion_engine_instance_pos_get(sd->engine_instance);
716 return sd->pos; 717 return sd->pos;
717} 718}
@@ -722,6 +723,7 @@ emotion_object_buffer_size_get(const Evas_Object *obj)
722 Emotion_Object_Data *sd; 723 Emotion_Object_Data *sd;
723 724
724 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0); 725 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
726 if (!sd->engine_instance) return 0.0;
725 return emotion_engine_instance_buffer_size_get(sd->engine_instance); 727 return emotion_engine_instance_buffer_size_get(sd->engine_instance);
726} 728}
727 729
@@ -731,6 +733,7 @@ emotion_object_seekable_get(const Evas_Object *obj)
731 Emotion_Object_Data *sd; 733 Emotion_Object_Data *sd;
732 734
733 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 735 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
736 if (!sd->engine_instance) return EINA_FALSE;
734 return emotion_engine_instance_seekable(sd->engine_instance); 737 return emotion_engine_instance_seekable(sd->engine_instance);
735} 738}
736 739
@@ -740,6 +743,7 @@ emotion_object_video_handled_get(const Evas_Object *obj)
740 Emotion_Object_Data *sd; 743 Emotion_Object_Data *sd;
741 744
742 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 745 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
746 if (!sd->engine_instance) return EINA_FALSE;
743 return emotion_engine_instance_video_handled(sd->engine_instance); 747 return emotion_engine_instance_video_handled(sd->engine_instance);
744} 748}
745 749
@@ -749,6 +753,7 @@ emotion_object_audio_handled_get(const Evas_Object *obj)
749 Emotion_Object_Data *sd; 753 Emotion_Object_Data *sd;
750 754
751 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 755 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
756 if (!sd->engine_instance) return EINA_FALSE;
752 return emotion_engine_instance_audio_handled(sd->engine_instance); 757 return emotion_engine_instance_audio_handled(sd->engine_instance);
753} 758}
754 759
@@ -758,6 +763,7 @@ emotion_object_play_length_get(const Evas_Object *obj)
758 Emotion_Object_Data *sd; 763 Emotion_Object_Data *sd;
759 764
760 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0); 765 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
766 if (!sd->engine_instance) return 0.0;
761 sd->len = emotion_engine_instance_len_get(sd->engine_instance); 767 sd->len = emotion_engine_instance_len_get(sd->engine_instance);
762 return sd->len; 768 return sd->len;
763} 769}
@@ -824,6 +830,7 @@ emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev)
824 Emotion_Object_Data *sd; 830 Emotion_Object_Data *sd;
825 831
826 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 832 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
833 if (!sd->engine_instance) return;
827 emotion_engine_instance_event_feed(sd->engine_instance, ev); 834 emotion_engine_instance_event_feed(sd->engine_instance, ev);
828} 835}
829 836
@@ -837,6 +844,7 @@ EOLIAN static void
837_emotion_object_efl_player_audio_volume_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd, double vol) 844_emotion_object_efl_player_audio_volume_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd, double vol)
838{ 845{
839 DBG("vol=%f", vol); 846 DBG("vol=%f", vol);
847 if (!sd->engine_instance) return;
840 emotion_engine_instance_audio_channel_volume_set(sd->engine_instance, vol); 848 emotion_engine_instance_audio_channel_volume_set(sd->engine_instance, vol);
841} 849}
842 850
@@ -849,6 +857,7 @@ emotion_object_audio_volume_get(const Evas_Object *obj)
849EOLIAN static double 857EOLIAN static double
850_emotion_object_efl_player_audio_volume_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) 858_emotion_object_efl_player_audio_volume_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd)
851{ 859{
860 if (!sd->engine_instance) return 0.0;
852 return emotion_engine_instance_audio_channel_volume_get(sd->engine_instance); 861 return emotion_engine_instance_audio_channel_volume_get(sd->engine_instance);
853} 862}
854 863
@@ -862,6 +871,7 @@ EOLIAN static void
862_emotion_object_efl_player_audio_mute_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd, Eina_Bool mute) 871_emotion_object_efl_player_audio_mute_set(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd, Eina_Bool mute)
863{ 872{
864 DBG("mute=" FMT_UCHAR, mute); 873 DBG("mute=" FMT_UCHAR, mute);
874 if (!sd->engine_instance) return;
865 emotion_engine_instance_audio_channel_mute_set(sd->engine_instance, mute); 875 emotion_engine_instance_audio_channel_mute_set(sd->engine_instance, mute);
866} 876}
867 877
@@ -874,6 +884,7 @@ emotion_object_audio_mute_get(const Evas_Object *obj)
874EOLIAN static Eina_Bool 884EOLIAN static Eina_Bool
875_emotion_object_efl_player_audio_mute_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) 885_emotion_object_efl_player_audio_mute_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd)
876{ 886{
887 if (!sd->engine_instance) return EINA_FALSE;
877 return emotion_engine_instance_audio_channel_mute_get(sd->engine_instance); 888 return emotion_engine_instance_audio_channel_mute_get(sd->engine_instance);
878} 889}
879 890
@@ -883,6 +894,7 @@ emotion_object_audio_channel_count(const Evas_Object *obj)
883 Emotion_Object_Data *sd; 894 Emotion_Object_Data *sd;
884 895
885 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 896 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
897 if (!sd->engine_instance) return 0;
886 return emotion_engine_instance_audio_channel_count(sd->engine_instance); 898 return emotion_engine_instance_audio_channel_count(sd->engine_instance);
887} 899}
888 900
@@ -892,6 +904,7 @@ emotion_object_audio_channel_name_get(const Evas_Object *obj, int channel)
892 Emotion_Object_Data *sd; 904 Emotion_Object_Data *sd;
893 905
894 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL); 906 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
907 if (!sd->engine_instance) return NULL;
895 return emotion_engine_instance_audio_channel_name_get(sd->engine_instance, channel); 908 return emotion_engine_instance_audio_channel_name_get(sd->engine_instance, channel);
896} 909}
897 910
@@ -902,6 +915,7 @@ emotion_object_audio_channel_set(Evas_Object *obj, int channel)
902 915
903 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 916 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
904 DBG("channel=%d", channel); 917 DBG("channel=%d", channel);
918 if (!sd->engine_instance) return;
905 emotion_engine_instance_audio_channel_set(sd->engine_instance, channel); 919 emotion_engine_instance_audio_channel_set(sd->engine_instance, channel);
906} 920}
907 921
@@ -911,6 +925,7 @@ emotion_object_audio_channel_get(const Evas_Object *obj)
911 Emotion_Object_Data *sd; 925 Emotion_Object_Data *sd;
912 926
913 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 927 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
928 if (!sd->engine_instance) return 0;
914 return emotion_engine_instance_audio_channel_get(sd->engine_instance); 929 return emotion_engine_instance_audio_channel_get(sd->engine_instance);
915} 930}
916 931
@@ -921,6 +936,7 @@ emotion_object_video_mute_set(Evas_Object *obj, Eina_Bool mute)
921 936
922 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 937 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
923 DBG("mute=" FMT_UCHAR, mute); 938 DBG("mute=" FMT_UCHAR, mute);
939 if (!sd->engine_instance) return;
924 emotion_engine_instance_video_channel_mute_set(sd->engine_instance, mute); 940 emotion_engine_instance_video_channel_mute_set(sd->engine_instance, mute);
925} 941}
926 942
@@ -930,6 +946,7 @@ emotion_object_video_mute_get(const Evas_Object *obj)
930 Emotion_Object_Data *sd; 946 Emotion_Object_Data *sd;
931 947
932 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 948 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
949 if (!sd->engine_instance) return EINA_FALSE;
933 return emotion_engine_instance_video_channel_mute_get(sd->engine_instance); 950 return emotion_engine_instance_video_channel_mute_get(sd->engine_instance);
934} 951}
935 952
@@ -940,6 +957,8 @@ emotion_object_video_subtitle_file_set(Evas_Object *obj, const char *filepath)
940 957
941 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 958 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
942 DBG("subtitle=%s", filepath); 959 DBG("subtitle=%s", filepath);
960 if (!sd->engine_instance) _engine_init(obj, sd);
961 if (!sd->engine_instance) return;
943 emotion_engine_instance_video_subtitle_file_set(sd->engine_instance, filepath); 962 emotion_engine_instance_video_subtitle_file_set(sd->engine_instance, filepath);
944} 963}
945 964
@@ -949,6 +968,7 @@ emotion_object_video_subtitle_file_get(const Evas_Object *obj)
949 Emotion_Object_Data *sd; 968 Emotion_Object_Data *sd;
950 969
951 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 970 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
971 if (!sd->engine_instance) return NULL;
952 return emotion_engine_instance_video_subtitle_file_get(sd->engine_instance); 972 return emotion_engine_instance_video_subtitle_file_get(sd->engine_instance);
953} 973}
954 974
@@ -958,6 +978,7 @@ emotion_object_video_channel_count(const Evas_Object *obj)
958 Emotion_Object_Data *sd; 978 Emotion_Object_Data *sd;
959 979
960 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 980 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
981 if (!sd->engine_instance) return 0;
961 return emotion_engine_instance_video_channel_count(sd->engine_instance); 982 return emotion_engine_instance_video_channel_count(sd->engine_instance);
962} 983}
963 984
@@ -967,6 +988,7 @@ emotion_object_video_channel_name_get(const Evas_Object *obj, int channel)
967 Emotion_Object_Data *sd; 988 Emotion_Object_Data *sd;
968 989
969 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL); 990 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
991 if (!sd->engine_instance) return NULL;
970 return emotion_engine_instance_video_channel_name_get(sd->engine_instance, channel); 992 return emotion_engine_instance_video_channel_name_get(sd->engine_instance, channel);
971} 993}
972 994
@@ -977,6 +999,7 @@ emotion_object_video_channel_set(Evas_Object *obj, int channel)
977 999
978 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1000 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
979 DBG("channel=%d", channel); 1001 DBG("channel=%d", channel);
1002 if (!sd->engine_instance) return;
980 emotion_engine_instance_video_channel_set(sd->engine_instance, channel); 1003 emotion_engine_instance_video_channel_set(sd->engine_instance, channel);
981} 1004}
982 1005
@@ -986,6 +1009,7 @@ emotion_object_video_channel_get(const Evas_Object *obj)
986 Emotion_Object_Data *sd; 1009 Emotion_Object_Data *sd;
987 1010
988 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1011 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1012 if (!sd->engine_instance) return 0;
989 return emotion_engine_instance_video_channel_get(sd->engine_instance); 1013 return emotion_engine_instance_video_channel_get(sd->engine_instance);
990} 1014}
991 1015
@@ -996,6 +1020,7 @@ emotion_object_spu_mute_set(Evas_Object *obj, Eina_Bool mute)
996 1020
997 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1021 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
998 DBG("mute=" FMT_UCHAR, mute); 1022 DBG("mute=" FMT_UCHAR, mute);
1023 if (!sd->engine_instance) return;
999 emotion_engine_instance_spu_channel_mute_set(sd->engine_instance, mute); 1024 emotion_engine_instance_spu_channel_mute_set(sd->engine_instance, mute);
1000} 1025}
1001 1026
@@ -1005,6 +1030,7 @@ emotion_object_spu_mute_get(const Evas_Object *obj)
1005 Emotion_Object_Data *sd; 1030 Emotion_Object_Data *sd;
1006 1031
1007 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1032 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1033 if (!sd->engine_instance) return EINA_FALSE;
1008 return emotion_engine_instance_spu_channel_mute_get(sd->engine_instance); 1034 return emotion_engine_instance_spu_channel_mute_get(sd->engine_instance);
1009} 1035}
1010 1036
@@ -1014,6 +1040,7 @@ emotion_object_spu_channel_count(const Evas_Object *obj)
1014 Emotion_Object_Data *sd; 1040 Emotion_Object_Data *sd;
1015 1041
1016 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1042 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1043 if (!sd->engine_instance) return 0;
1017 return emotion_engine_instance_spu_channel_count(sd->engine_instance); 1044 return emotion_engine_instance_spu_channel_count(sd->engine_instance);
1018} 1045}
1019 1046
@@ -1023,6 +1050,7 @@ emotion_object_spu_channel_name_get(const Evas_Object *obj, int channel)
1023 Emotion_Object_Data *sd; 1050 Emotion_Object_Data *sd;
1024 1051
1025 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL); 1052 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1053 if (!sd->engine_instance) return NULL;
1026 return emotion_engine_instance_spu_channel_name_get(sd->engine_instance, channel); 1054 return emotion_engine_instance_spu_channel_name_get(sd->engine_instance, channel);
1027} 1055}
1028 1056
@@ -1033,6 +1061,7 @@ emotion_object_spu_channel_set(Evas_Object *obj, int channel)
1033 1061
1034 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1062 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1035 DBG("channel=%d", channel); 1063 DBG("channel=%d", channel);
1064 if (!sd->engine_instance) return;
1036 emotion_engine_instance_spu_channel_set(sd->engine_instance, channel); 1065 emotion_engine_instance_spu_channel_set(sd->engine_instance, channel);
1037} 1066}
1038 1067
@@ -1042,6 +1071,7 @@ emotion_object_spu_channel_get(const Evas_Object *obj)
1042 Emotion_Object_Data *sd; 1071 Emotion_Object_Data *sd;
1043 1072
1044 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1073 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1074 if (!sd->engine_instance) return 0;
1045 return emotion_engine_instance_spu_channel_get(sd->engine_instance); 1075 return emotion_engine_instance_spu_channel_get(sd->engine_instance);
1046} 1076}
1047 1077
@@ -1051,6 +1081,7 @@ emotion_object_chapter_count(const Evas_Object *obj)
1051 Emotion_Object_Data *sd; 1081 Emotion_Object_Data *sd;
1052 1082
1053 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1083 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1084 if (!sd->engine_instance) return 0;
1054 return emotion_engine_instance_chapter_count(sd->engine_instance); 1085 return emotion_engine_instance_chapter_count(sd->engine_instance);
1055} 1086}
1056 1087
@@ -1061,6 +1092,7 @@ emotion_object_chapter_set(Evas_Object *obj, int chapter)
1061 1092
1062 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1093 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1063 DBG("chapter=%d", chapter); 1094 DBG("chapter=%d", chapter);
1095 if (!sd->engine_instance) return;
1064 emotion_engine_instance_chapter_set(sd->engine_instance, chapter); 1096 emotion_engine_instance_chapter_set(sd->engine_instance, chapter);
1065} 1097}
1066 1098
@@ -1070,6 +1102,7 @@ emotion_object_chapter_get(const Evas_Object *obj)
1070 Emotion_Object_Data *sd; 1102 Emotion_Object_Data *sd;
1071 1103
1072 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1104 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1105 if (!sd->engine_instance) return 0;
1073 return emotion_engine_instance_chapter_get(sd->engine_instance); 1106 return emotion_engine_instance_chapter_get(sd->engine_instance);
1074} 1107}
1075 1108
@@ -1079,6 +1112,7 @@ emotion_object_chapter_name_get(const Evas_Object *obj, int chapter)
1079 Emotion_Object_Data *sd; 1112 Emotion_Object_Data *sd;
1080 1113
1081 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL); 1114 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1115 if (!sd->engine_instance) return NULL;
1082 return emotion_engine_instance_chapter_name_get(sd->engine_instance, chapter); 1116 return emotion_engine_instance_chapter_name_get(sd->engine_instance, chapter);
1083} 1117}
1084 1118
@@ -1089,6 +1123,7 @@ emotion_object_play_speed_set(Evas_Object *obj, double speed)
1089 1123
1090 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1124 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1091 DBG("speed=%f", speed); 1125 DBG("speed=%f", speed);
1126 if (!sd->engine_instance) return;
1092 emotion_engine_instance_speed_set(sd->engine_instance, speed); 1127 emotion_engine_instance_speed_set(sd->engine_instance, speed);
1093} 1128}
1094 1129
@@ -1098,6 +1133,7 @@ emotion_object_play_speed_get(const Evas_Object *obj)
1098 Emotion_Object_Data *sd; 1133 Emotion_Object_Data *sd;
1099 1134
1100 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0); 1135 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
1136 if (!sd->engine_instance) return 0.0;
1101 return emotion_engine_instance_speed_get(sd->engine_instance); 1137 return emotion_engine_instance_speed_get(sd->engine_instance);
1102} 1138}
1103 1139
@@ -1107,6 +1143,7 @@ emotion_object_eject(Evas_Object *obj)
1107 Emotion_Object_Data *sd; 1143 Emotion_Object_Data *sd;
1108 1144
1109 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1145 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1146 if (!sd->engine_instance) return;
1110 emotion_engine_instance_eject(sd->engine_instance); 1147 emotion_engine_instance_eject(sd->engine_instance);
1111} 1148}
1112 1149
@@ -1183,6 +1220,7 @@ emotion_object_meta_info_get(const Evas_Object *obj, Emotion_Meta_Info meta)
1183 int id; 1220 int id;
1184 1221
1185 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL); 1222 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1223 if (!sd->engine_instance) return NULL;
1186 switch (meta) 1224 switch (meta)
1187 { 1225 {
1188 case EMOTION_META_INFO_TRACK_TITLE: 1226 case EMOTION_META_INFO_TRACK_TITLE:
@@ -1221,6 +1259,7 @@ emotion_object_vis_set(Evas_Object *obj, Emotion_Vis visualization)
1221 1259
1222 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1260 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1223 DBG("visualization=%d", visualization); 1261 DBG("visualization=%d", visualization);
1262 if (!sd->engine_instance) return;
1224 emotion_engine_instance_vis_set(sd->engine_instance, visualization); 1263 emotion_engine_instance_vis_set(sd->engine_instance, visualization);
1225} 1264}
1226 1265
@@ -1230,6 +1269,7 @@ emotion_object_vis_get(const Evas_Object *obj)
1230 Emotion_Object_Data *sd; 1269 Emotion_Object_Data *sd;
1231 1270
1232 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_VIS_NONE); 1271 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_VIS_NONE);
1272 if (!sd->engine_instance) return EMOTION_VIS_NONE;
1233 return emotion_engine_instance_vis_get(sd->engine_instance); 1273 return emotion_engine_instance_vis_get(sd->engine_instance);
1234} 1274}
1235 1275
@@ -1238,7 +1278,8 @@ emotion_object_vis_supported(const Evas_Object *obj, Emotion_Vis visualization)
1238{ 1278{
1239 Emotion_Object_Data *sd; 1279 Emotion_Object_Data *sd;
1240 1280
1241 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1281 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE);
1282 if (!sd->engine_instance) return EINA_FALSE;
1242 return emotion_engine_instance_vis_supported(sd->engine_instance, visualization); 1283 return emotion_engine_instance_vis_supported(sd->engine_instance, visualization);
1243} 1284}
1244 1285
@@ -1248,6 +1289,7 @@ emotion_object_priority_set(Evas_Object *obj, Eina_Bool priority)
1248 Emotion_Object_Data *sd; 1289 Emotion_Object_Data *sd;
1249 1290
1250 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1291 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1292 if (!sd->engine_instance) return;
1251 emotion_engine_instance_priority_set(sd->engine_instance, priority); 1293 emotion_engine_instance_priority_set(sd->engine_instance, priority);
1252} 1294}
1253 1295
@@ -1256,7 +1298,8 @@ emotion_object_priority_get(const Evas_Object *obj)
1256{ 1298{
1257 Emotion_Object_Data *sd; 1299 Emotion_Object_Data *sd;
1258 1300
1259 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 1301 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE);
1302 if (!sd->engine_instance) return EINA_FALSE;
1260 return emotion_engine_instance_priority_get(sd->engine_instance); 1303 return emotion_engine_instance_priority_get(sd->engine_instance);
1261} 1304}
1262 1305
@@ -1306,12 +1349,9 @@ emotion_object_last_position_load(Evas_Object *obj)
1306 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1349 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1307 if (!sd->file) return; 1350 if (!sd->file) return;
1308 1351
1309 if (!strncmp(sd->file, "file://", 7)) 1352 if (!strncmp(sd->file, "file://", 7)) tmp = sd->file + 7;
1310 tmp = sd->file + 7; 1353 else if (!strstr(sd->file, "://")) tmp = sd->file;
1311 else if (!strstr(sd->file, "://")) 1354 else return;
1312 tmp = sd->file;
1313 else
1314 return;
1315 1355
1316#ifdef HAVE_EIO 1356#ifdef HAVE_EIO
1317 if (sd->load_xattr) return; 1357 if (sd->load_xattr) return;
@@ -1319,10 +1359,10 @@ emotion_object_last_position_load(Evas_Object *obj)
1319 EINA_REFCOUNT_REF(sd); 1359 EINA_REFCOUNT_REF(sd);
1320 1360
1321 sd->load_xattr = eio_file_xattr_double_get(tmp, 1361 sd->load_xattr = eio_file_xattr_double_get(tmp,
1322 "user.e.time_seek", 1362 "user.e.time_seek",
1323 _eio_load_xattr_done, 1363 _eio_load_xattr_done,
1324 _eio_load_xattr_error, 1364 _eio_load_xattr_error,
1325 sd); 1365 sd);
1326#else 1366#else
1327 if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr)) 1367 if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr))
1328 { 1368 {
@@ -1330,9 +1370,7 @@ emotion_object_last_position_load(Evas_Object *obj)
1330 evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_SUCCEED, NULL); 1370 evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_SUCCEED, NULL);
1331 } 1371 }
1332 else 1372 else
1333 { 1373 evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_FAILED, NULL);
1334 evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_FAILED, NULL);
1335 }
1336#endif 1374#endif
1337} 1375}
1338 1376
@@ -1378,18 +1416,13 @@ emotion_object_last_position_save(Evas_Object *obj)
1378 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1416 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1379 if (!sd->file) return; 1417 if (!sd->file) return;
1380 1418
1381 if (!strncmp(sd->file, "file://", 7)) 1419 if (!strncmp(sd->file, "file://", 7)) tmp = sd->file + 7;
1382 tmp = sd->file + 7; 1420 else if (!strstr(sd->file, "://")) tmp = sd->file;
1383 else if (!strstr(sd->file, "://")) 1421 else return;
1384 tmp = sd->file;
1385 else
1386 return;
1387
1388#ifdef HAVE_EIO 1422#ifdef HAVE_EIO
1389 if (sd->save_xattr) return; 1423 if (sd->save_xattr) return;
1390 1424
1391 EINA_REFCOUNT_REF(sd); 1425 EINA_REFCOUNT_REF(sd);
1392
1393 sd->save_xattr = eio_file_xattr_double_set(tmp, 1426 sd->save_xattr = eio_file_xattr_double_set(tmp,
1394 "user.e.time_seek", 1427 "user.e.time_seek",
1395 emotion_object_position_get(obj), 1428 emotion_object_position_get(obj),
@@ -1424,7 +1457,6 @@ emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state)
1424 default: 1457 default:
1425 break; 1458 break;
1426 } 1459 }
1427
1428 sd->state = state; 1460 sd->state = state;
1429} 1461}
1430 1462
@@ -1461,7 +1493,6 @@ _emotion_frame_anim(void *data)
1461 evas_object_image_pixels_dirty_set(sd->obj, 1); 1493 evas_object_image_pixels_dirty_set(sd->obj, 1);
1462 evas_object_smart_callback_call(obj, SIG_FRAME_DECODE, NULL); 1494 evas_object_smart_callback_call(obj, SIG_FRAME_DECODE, NULL);
1463 sd->anim = NULL; 1495 sd->anim = NULL;
1464
1465 return EINA_FALSE; 1496 return EINA_FALSE;
1466} 1497}
1467 1498
@@ -1471,7 +1502,6 @@ _emotion_frame_new(Evas_Object *obj)
1471 Emotion_Object_Data *sd; 1502 Emotion_Object_Data *sd;
1472 1503
1473 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1504 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1474
1475 if (!sd->anim) sd->anim = ecore_animator_add(_emotion_frame_anim, obj); 1505 if (!sd->anim) sd->anim = ecore_animator_add(_emotion_frame_anim, obj);
1476} 1506}
1477 1507
@@ -1503,22 +1533,22 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
1503 sd->video.w = w; 1533 sd->video.w = w;
1504 sd->video.h = h; 1534 sd->video.h = h;
1505 _emotion_image_data_zero(sd->obj); 1535 _emotion_image_data_zero(sd->obj);
1506 changed = 1; 1536 changed = 1;
1507 } 1537 }
1508 if (h > 0) tmp = (double)w / (double)h; 1538 if (h > 0) tmp = (double)w / (double)h;
1509 else tmp = 1.0; 1539 else tmp = 1.0;
1510 if (ratio != tmp) tmp = ratio; 1540 if (ratio != tmp) tmp = ratio;
1511 if (tmp != sd->ratio) 1541 if (tmp != sd->ratio)
1512 { 1542 {
1513 sd->ratio = tmp; 1543 sd->ratio = tmp;
1514 changed = 1; 1544 changed = 1;
1515 } 1545 }
1516 if (changed) 1546 if (changed)
1517 { 1547 {
1518 evas_object_size_hint_request_set(obj, w, h); 1548 evas_object_size_hint_request_set(obj, w, h);
1519 evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL); 1549 evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
1520 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 1550 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1521 _emotion_object_aspect_border_apply(obj, sd, w, h); 1551 _emotion_object_aspect_border_apply(obj, sd, w, h);
1522 } 1552 }
1523} 1553}
1524 1554
@@ -1539,8 +1569,8 @@ _emotion_decode_stop(Evas_Object *obj)
1539 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1569 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1540 if (sd->play) 1570 if (sd->play)
1541 { 1571 {
1542 sd->play = 0; 1572 sd->play = 0;
1543 evas_object_smart_callback_call(obj, SIG_DECODE_STOP, NULL); 1573 evas_object_smart_callback_call(obj, SIG_DECODE_STOP, NULL);
1544 } 1574 }
1545} 1575}
1546 1576
@@ -1657,28 +1687,26 @@ _emotion_frame_refill(Evas_Object *obj, double w, double h)
1657 Emotion_Object_Data *sd; 1687 Emotion_Object_Data *sd;
1658 1688
1659 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1689 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1660 if (sd->fill.w != w || sd->fill.h != h) 1690 if ((sd->fill.w != w) || (sd->fill.h != h))
1661 { 1691 {
1662 Evas_Coord ow, oh; 1692 Evas_Coord ow, oh;
1663 1693
1664 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); 1694 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
1665 if (w <= 0 || h <= 0) 1695 if ((w <= 0) || (h <= 0))
1666 { 1696 {
1667 double scale_w, scale_h; 1697 double scale_w, scale_h;
1668 1698
1669 sd->fill.w = -1; 1699 sd->fill.w = -1;
1670 sd->fill.h = -1; 1700 sd->fill.h = -1;
1671 1701
1672 scale_w = (double) ow / (double)(sd->video.w - sd->crop.l - sd->crop.r); 1702 scale_w = (double)ow / (double)(sd->video.w - sd->crop.l - sd->crop.r);
1673 scale_h = (double) oh / (double)(sd->video.h - sd->crop.t - sd->crop.b); 1703 scale_h = (double)oh / (double)(sd->video.h - sd->crop.t - sd->crop.b);
1674
1675 evas_object_image_fill_set(sd->obj, 0, 0, scale_w * sd->video.w, scale_h * sd->video.h); 1704 evas_object_image_fill_set(sd->obj, 0, 0, scale_w * sd->video.w, scale_h * sd->video.h);
1676 } 1705 }
1677 else 1706 else
1678 { 1707 {
1679 sd->fill.w = w; 1708 sd->fill.w = w;
1680 sd->fill.h = h; 1709 sd->fill.h = h;
1681
1682 evas_object_image_fill_set(sd->obj, 0, 0, w * ow, h * oh); 1710 evas_object_image_fill_set(sd->obj, 0, 0, w * ow, h * oh);
1683 } 1711 }
1684 } 1712 }
@@ -1698,6 +1726,7 @@ _mouse_move(void *data, Evas *ev EINA_UNUSED, Evas_Object *obj, void *event_info
1698 1726
1699 e = event_info; 1727 e = event_info;
1700 sd = data; 1728 sd = data;
1729 if (!sd->engine_instance) return;
1701 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); 1730 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1702 evas_object_image_size_get(obj, &iw, &ih); 1731 evas_object_image_size_get(obj, &iw, &ih);
1703 if ((iw < 1) || (ih < 1)) return; 1732 if ((iw < 1) || (ih < 1)) return;
@@ -1716,6 +1745,7 @@ _mouse_down(void *data, Evas *ev EINA_UNUSED, Evas_Object *obj, void *event_info
1716 1745
1717 e = event_info; 1746 e = event_info;
1718 sd = data; 1747 sd = data;
1748 if (!sd->engine_instance) return;
1719 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); 1749 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1720 evas_object_image_size_get(obj, &iw, &ih); 1750 evas_object_image_size_get(obj, &iw, &ih);
1721 if ((iw < 1) || (ih < 1)) return; 1751 if ((iw < 1) || (ih < 1)) return;
@@ -1733,12 +1763,13 @@ _pos_set_job(void *data)
1733 obj = data; 1763 obj = data;
1734 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1764 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1735 sd->job = NULL; 1765 sd->job = NULL;
1766 if (!sd->engine_instance) return;
1736 if (sd->seeking) return; 1767 if (sd->seeking) return;
1737 if (sd->seek) 1768 if (sd->seek)
1738 { 1769 {
1739 sd->seeking = 1; 1770 sd->seeking = 1;
1740 emotion_engine_instance_pos_set(sd->engine_instance, sd->seek_pos); 1771 emotion_engine_instance_pos_set(sd->engine_instance, sd->seek_pos);
1741 sd->seek = 0; 1772 sd->seek = 0;
1742 } 1773 }
1743} 1774}
1744 1775
@@ -1752,6 +1783,7 @@ _pixels_get(void *data, Evas_Object *obj)
1752 unsigned char *bgra_data; 1783 unsigned char *bgra_data;
1753 1784
1754 sd = data; 1785 sd = data;
1786 if (!sd->engine_instance) return;
1755 emotion_engine_instance_video_data_size_get(sd->engine_instance, &w, &h); 1787 emotion_engine_instance_video_data_size_get(sd->engine_instance, &w, &h);
1756 w = (w >> 1) << 1; 1788 w = (w >> 1) << 1;
1757 h = (h >> 1) << 1; 1789 h = (h >> 1) << 1;
@@ -1765,37 +1797,37 @@ _pixels_get(void *data, Evas_Object *obj)
1765 if ((iw <= 1) || (ih <= 1)) 1797 if ((iw <= 1) || (ih <= 1))
1766 { 1798 {
1767 _emotion_image_data_zero(sd->obj); 1799 _emotion_image_data_zero(sd->obj);
1768 evas_object_image_pixels_dirty_set(obj, 0); 1800 evas_object_image_pixels_dirty_set(obj, 0);
1769 } 1801 }
1770 else 1802 else
1771 { 1803 {
1772 format = emotion_engine_instance_format_get(sd->engine_instance); 1804 format = emotion_engine_instance_format_get(sd->engine_instance);
1773 if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420)) 1805 if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
1774 { 1806 {
1775 unsigned char **rows; 1807 unsigned char **rows;
1776 1808
1777 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL); 1809 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1778 rows = evas_object_image_data_get(obj, 1); 1810 rows = evas_object_image_data_get(obj, 1);
1779 if (rows) 1811 if (rows)
1780 { 1812 {
1781 if (emotion_engine_instance_yuv_rows_get(sd->engine_instance, iw, ih, 1813 if (emotion_engine_instance_yuv_rows_get(sd->engine_instance, iw, ih,
1782 rows, 1814 rows,
1783 &rows[ih], 1815 &rows[ih],
1784 &rows[ih + (ih / 2)])) 1816 &rows[ih + (ih / 2)]))
1785 evas_object_image_data_update_add(obj, 0, 0, iw, ih); 1817 evas_object_image_data_update_add(obj, 0, 0, iw, ih);
1786 } 1818 }
1787 evas_object_image_data_set(obj, rows); 1819 evas_object_image_data_set(obj, rows);
1788 evas_object_image_pixels_dirty_set(obj, 0); 1820 evas_object_image_pixels_dirty_set(obj, 0);
1789 } 1821 }
1790 else if (format == EMOTION_FORMAT_BGRA) 1822 else if (format == EMOTION_FORMAT_BGRA)
1791 { 1823 {
1792 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_ARGB8888); 1824 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_ARGB8888);
1793 if (emotion_engine_instance_bgra_data_get(sd->engine_instance, &bgra_data)) 1825 if (emotion_engine_instance_bgra_data_get(sd->engine_instance, &bgra_data))
1794 { 1826 {
1795 evas_object_image_data_set(obj, bgra_data); 1827 evas_object_image_data_set(obj, bgra_data);
1796 evas_object_image_pixels_dirty_set(obj, 0); 1828 evas_object_image_pixels_dirty_set(obj, 0);
1797 } 1829 }
1798 } 1830 }
1799 } 1831 }
1800} 1832}
1801 1833
@@ -1816,6 +1848,7 @@ _emotion_object_evas_object_smart_add(Evas_Object *obj, Emotion_Object_Data *sd)
1816 sd->smartobj = obj; 1848 sd->smartobj = obj;
1817 sd->obj = evas_object_image_add(evas_object_evas_get(obj)); 1849 sd->obj = evas_object_image_add(evas_object_evas_get(obj));
1818 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj)); 1850 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj));
1851 sd->engine = eina_stringshare_add("gstreamer1");
1819 evas_object_color_set(sd->bg, 0, 0, 0, 0); 1852 evas_object_color_set(sd->bg, 0, 0, 0, 0);
1820 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd); 1853 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd);
1821 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd); 1854 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd);
@@ -1831,8 +1864,8 @@ _emotion_object_evas_object_smart_add(Evas_Object *obj, Emotion_Object_Data *sd)
1831 pixel = evas_object_image_data_get(sd->obj, 1); 1864 pixel = evas_object_image_data_get(sd->obj, 1);
1832 if (pixel) 1865 if (pixel)
1833 { 1866 {
1834 *pixel = 0xff000000; 1867 *pixel = 0xff000000;
1835 evas_object_image_data_set(obj, pixel); 1868 evas_object_image_data_set(obj, pixel);
1836 } 1869 }
1837 evas_object_smart_data_set(obj, sd); 1870 evas_object_smart_data_set(obj, sd);
1838} 1871}
@@ -1865,8 +1898,7 @@ _emotion_object_evas_object_smart_del(Evas_Object *obj EINA_UNUSED, Emotion_Obje
1865 sd->ref.file = NULL; 1898 sd->ref.file = NULL;
1866 if (sd->smartobj) evas_object_smart_data_set(sd->smartobj, NULL); 1899 if (sd->smartobj) evas_object_smart_data_set(sd->smartobj, NULL);
1867 sd->smartobj = NULL; 1900 sd->smartobj = NULL;
1868 EINA_REFCOUNT_UNREF(sd) 1901 EINA_REFCOUNT_UNREF(sd) _smart_data_free(sd);
1869 _smart_data_free(sd);
1870} 1902}
1871 1903
1872EOLIAN static void 1904EOLIAN static void
@@ -1892,20 +1924,17 @@ _emotion_object_evas_object_smart_show(Evas_Object *obj EINA_UNUSED, Emotion_Obj
1892 int a; 1924 int a;
1893 1925
1894 evas_object_show(sd->obj); 1926 evas_object_show(sd->obj);
1895 if (sd->crop.clipper) 1927 if (sd->crop.clipper) evas_object_show(sd->crop.clipper);
1896 evas_object_show(sd->crop.clipper);
1897 1928
1898 evas_object_color_get(sd->bg, NULL, NULL, NULL, &a); 1929 evas_object_color_get(sd->bg, NULL, NULL, NULL, &a);
1899 if (a > 0) 1930 if (a > 0) evas_object_show(sd->bg);
1900 evas_object_show(sd->bg);
1901} 1931}
1902 1932
1903EOLIAN static void 1933EOLIAN static void
1904_emotion_object_evas_object_smart_hide(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd) 1934_emotion_object_evas_object_smart_hide(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd)
1905{ 1935{
1906 evas_object_hide(sd->obj); 1936 evas_object_hide(sd->obj);
1907 if (sd->crop.clipper) 1937 if (sd->crop.clipper) evas_object_hide(sd->crop.clipper);
1908 evas_object_hide(sd->crop.clipper);
1909 evas_object_hide(sd->bg); 1938 evas_object_hide(sd->bg);
1910} 1939}
1911 1940
@@ -1919,20 +1948,16 @@ _emotion_object_evas_object_smart_color_set(Evas_Object *obj EINA_UNUSED, Emotio
1919EOLIAN static void 1948EOLIAN static void
1920_emotion_object_evas_object_smart_clip_set(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd, Evas_Object * clip) 1949_emotion_object_evas_object_smart_clip_set(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd, Evas_Object * clip)
1921{ 1950{
1922 if (sd->crop.clipper) 1951 if (sd->crop.clipper) evas_object_clip_set(sd->crop.clipper, clip);
1923 evas_object_clip_set(sd->crop.clipper, clip); 1952 else evas_object_clip_set(sd->obj, clip);
1924 else
1925 evas_object_clip_set(sd->obj, clip);
1926 evas_object_clip_set(sd->bg, clip); 1953 evas_object_clip_set(sd->bg, clip);
1927} 1954}
1928 1955
1929EOLIAN static void 1956EOLIAN static void
1930_emotion_object_evas_object_smart_clip_unset(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd) 1957_emotion_object_evas_object_smart_clip_unset(Evas_Object *obj EINA_UNUSED, Emotion_Object_Data *sd)
1931{ 1958{
1932 if (sd->crop.clipper) 1959 if (sd->crop.clipper) evas_object_clip_unset(sd->crop.clipper);
1933 evas_object_clip_unset(sd->crop.clipper); 1960 else evas_object_clip_unset(sd->obj);
1934 else
1935 evas_object_clip_unset(sd->obj);
1936 evas_object_clip_unset(sd->bg); 1961 evas_object_clip_unset(sd->bg);
1937} 1962}
1938 1963
diff --git a/src/tests/emotion/emotion_test_main.c b/src/tests/emotion/emotion_test_main.c
index e435935332..67906840c1 100644
--- a/src/tests/emotion/emotion_test_main.c
+++ b/src/tests/emotion/emotion_test_main.c
@@ -579,7 +579,7 @@ init_video_object(const char *module_filename, const char *filename)
579 579
580 /* basic video object setup */ 580 /* basic video object setup */
581 o = emotion_object_add(evas); 581 o = emotion_object_add(evas);
582 if (!emotion_object_init(o, module_filename)) 582 if ((module_filename) && (!emotion_object_init(o, module_filename)))
583 return; 583 return;
584 emotion_object_vis_set(o, vis); 584 emotion_object_vis_set(o, vis);
585 if (!emotion_object_file_set(o, filename)) 585 if (!emotion_object_file_set(o, filename))