1 #include "emotion_private.h"
9 #define E_SMART_OBJ_GET(smart, o, type) \
14 smart = evas_object_smart_data_get(o); \
16 _e_smart_str = (char *)evas_object_type_get(o); \
17 if (!_e_smart_str) return; \
18 if (strcmp(_e_smart_str, type)) return; \
21 #define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \
26 smart = evas_object_smart_data_get(o); \
27 if (!smart) return ret; \
28 _e_smart_str = (char *)evas_object_type_get(o); \
29 if (!_e_smart_str) return ret; \
30 if (strcmp(_e_smart_str, type)) return ret; \
33 #define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
34 #define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
35 #define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
36 #define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
37 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
39 #define E_OBJ_NAME "emotion_object"
41 typedef struct _Smart_Data Smart_Data;
46 Emotion_Video_Module *module;
91 Emotion_Module_Options module_options;
93 Emotion_Suspend state;
94 Emotion_Aspect aspect;
98 Eina_Bool remember_play : 1;
100 Eina_Bool seeking : 1;
103 static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info);
104 static void _mouse_down(void *data, Evas *ev, Evas_Object *obj, void *event_info);
105 static void _pos_set_job(void *data);
106 static void _pixels_get(void *data, Evas_Object *obj);
108 static void _smart_init(void);
109 static void _smart_add(Evas_Object * obj);
110 static void _smart_del(Evas_Object * obj);
111 static void _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y);
112 static void _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h);
113 static void _smart_show(Evas_Object * obj);
114 static void _smart_hide(Evas_Object * obj);
115 static void _smart_color_set(Evas_Object * obj, int r, int g, int b, int a);
116 static void _smart_clip_set(Evas_Object * obj, Evas_Object * clip);
117 static void _smart_clip_unset(Evas_Object * obj);
119 /**********************************/
120 /* Globals for the E Video Object */
121 /**********************************/
122 static Evas_Smart *smart = NULL;
123 static Eina_Hash *_backends = NULL;
124 static Eina_Array *_modules = NULL;
125 static int _log_domain = -1;
127 static const char *_backend_priority[] = {
133 static const char SIG_FRAME_DECODE[] = "frame_decode";
134 static const char SIG_POSITION_UPDATE[] = "position_update";
135 static const char SIG_LENGTH_CHANGE[] = "length_change";
136 static const char SIG_FRAME_RESIZE[] = "frame_resize";
137 static const char SIG_DECODE_STOP[] = "decode_stop";
138 static const char SIG_PLAYBACK_STARTED[] = "playback_started";
139 static const char SIG_PLAYBACK_FINISHED[] = "playback_finished";
140 static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change";
141 static const char SIG_CHANNELS_CHANGE[] = "channels_change";
142 static const char SIG_TITLE_CHANGE[] = "title_change";
143 static const char SIG_PROGRESS_CHANGE[] = "progress_change";
144 static const char SIG_REF_CHANGE[] = "ref_change";
145 static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change";
146 static const char SIG_BUTTON_CHANGE[] = "button_change";
147 static const char SIG_OPEN_DONE[] = "open_done";
148 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
149 {SIG_FRAME_DECODE, ""},
150 {SIG_POSITION_UPDATE, ""},
151 {SIG_LENGTH_CHANGE, ""},
152 {SIG_FRAME_RESIZE, ""},
153 {SIG_DECODE_STOP, ""},
154 {SIG_PLAYBACK_STARTED, ""},
155 {SIG_PLAYBACK_FINISHED, ""},
156 {SIG_AUDIO_LEVEL_CHANGE, ""},
157 {SIG_CHANNELS_CHANGE, ""},
158 {SIG_TITLE_CHANGE, ""},
159 {SIG_PROGRESS_CHANGE, ""},
160 {SIG_REF_CHANGE, ""},
161 {SIG_BUTTON_NUM_CHANGE, ""},
162 {SIG_BUTTON_CHANGE, ""},
168 _emotion_image_data_zero(Evas_Object *img)
172 data = evas_object_image_data_get(img, 1);
178 evas_object_image_size_get(img, &w, &h);
179 cs = evas_object_image_colorspace_get(img);
180 if (cs == EVAS_COLORSPACE_ARGB8888)
182 if ((cs == EVAS_COLORSPACE_YCBCR422P601_PL) ||
183 (cs == EVAS_COLORSPACE_YCBCR422P709_PL))
184 sz = h * 2 * sizeof(unsigned char *);
185 if (sz != 0) memset(data, 0, sz);
187 evas_object_image_data_set(img, data);
191 _emotion_module_close(Emotion_Video_Module *mod, void *video)
194 if (mod->plugin->close && video)
195 mod->plugin->close(mod, video);
196 /* FIXME: we can't go dlclosing here as a thread still may be running from
197 * the module - this in theory will leak- but it shouldn't be too bad and
198 * mean that once a module is dlopened() it can't be closed - its refcount
199 * will just keep going up
204 _smart_data_free(Smart_Data *sd)
206 if (sd->video) sd->module->file_close(sd->video);
207 _emotion_module_close(sd->module, sd->video);
208 evas_object_del(sd->obj);
209 evas_object_del(sd->crop.clipper);
210 eina_stringshare_del(sd->file);
211 free(sd->module_name);
212 if (sd->job) ecore_job_del(sd->job);
213 free(sd->progress.info);
221 _emotion_module_register(const char *name, Emotion_Module_Open mod_open, Emotion_Module_Close mod_close)
223 Eina_Emotion_Plugins *plugin;
225 plugin = malloc(sizeof (Eina_Emotion_Plugins));
226 if (!plugin) return EINA_FALSE;
228 plugin->open = mod_open;
229 plugin->close = mod_close;
231 return eina_hash_add(_backends, name, plugin);
235 _emotion_module_unregister(const char *name)
237 return eina_hash_del(_backends, name, NULL);
241 _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
243 Eina_Emotion_Plugins *plugin;
247 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
250 ERR("No backend loaded");
254 if (!name && getenv("EMOTION_ENGINE"))
255 name = getenv("EMOTION_ENGINE");
257 /* FIXME: Always look for a working backend. */
260 name = _backend_priority[i++];
262 plugin = eina_hash_find(_backends, name);
265 if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
268 ERR("No backend loaded");
272 if (plugin->open(obj, (const Emotion_Video_Module **) mod, video, &(sd->module_options)))
276 (*mod)->plugin = plugin;
281 if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
284 ERR("Unable to load module: %s", name);
290 _clipper_position_size_update(Evas_Object *obj, int x, int y, int w, int h, int vid_w, int vid_h)
293 double scale_w, scale_h;
295 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
297 if (vid_w == 0 || vid_h == 0)
299 evas_object_image_fill_set(sd->obj, 0, 0, 0, 0);
300 evas_object_move(sd->obj, x, y);
301 evas_object_resize(sd->obj, 0, 0);
302 evas_object_move(sd->crop.clipper, x, y);
303 evas_object_resize(sd->crop.clipper, 0, 0);
307 evas_object_move(sd->crop.clipper, x, y);
308 scale_w = (double)w / (double)(vid_w - sd->crop.l - sd->crop.r);
309 scale_h = (double)h / (double)(vid_h - sd->crop.t - sd->crop.b);
311 evas_object_image_fill_set(sd->obj, 0, 0, vid_w * scale_w, vid_h * scale_h);
312 evas_object_resize(sd->obj, vid_w * scale_w, vid_h * scale_h);
313 evas_object_move(sd->obj, x - sd->crop.l * scale_w, y - sd->crop.t * scale_h);
314 evas_object_resize(sd->crop.clipper, w, h);
318 /*******************************/
319 /* Externally accessible calls */
320 /*******************************/
325 emotion_object_add(Evas *evas)
328 return evas_object_smart_add(evas, smart);
332 emotion_object_image_get(const Evas_Object *obj)
336 sd = evas_object_smart_data_get(obj);
337 if (!sd) return NULL;
342 emotion_object_module_option_set(Evas_Object *obj, const char *opt, const char *val)
346 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
347 if ((!opt) || (!val)) return;
349 if (!strcmp(opt, "player"))
350 eina_stringshare_replace(&sd->module_options.player, val);
354 emotion_object_init(Evas_Object *obj, const char *module_filename)
359 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
361 if ((sd->module_name) && module_filename && (!strcmp(sd->module_name, module_filename)))
363 free(sd->module_name);
364 sd->module_name = NULL;
371 free(sd->progress.info);
372 sd->progress.info = NULL;
373 sd->progress.stat = 0.0;
377 sd->spu.button_num = 0;
381 sd->remember_jump = 0;
384 sd->remember_play = 0;
386 _emotion_module_close(sd->module, sd->video);
390 module_filename = _emotion_module_open(module_filename, obj, &sd->module, &sd->video);
391 if (!module_filename)
394 sd->module_name = strdup(module_filename);
398 emotion_object_file_set(obj, file);
399 eina_stringshare_del(file);
406 emotion_object_file_set(Evas_Object *obj, const char *file)
410 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE);
412 DBG("file=%s", file);
413 if (!sd->module) return EINA_FALSE;
417 if ((file) && (sd->file) &&
418 ((file == sd->file) || (!strcmp(file, sd->file)))) return EINA_FALSE;
419 if ((file) && (file[0] != 0))
421 eina_stringshare_replace(&sd->file, file);
422 sd->module->file_close(sd->video);
423 evas_object_image_data_set(sd->obj, NULL);
424 evas_object_image_size_set(sd->obj, 1, 1);
425 _emotion_image_data_zero(sd->obj);
427 if (!sd->module->file_open(sd->file, obj, sd->video))
430 if (sd->play) sd->module->play(sd->video, 0.0);
434 if (sd->video && sd->module)
436 sd->module->file_close(sd->video);
437 evas_object_image_data_set(sd->obj, NULL);
438 evas_object_image_size_set(sd->obj, 1, 1);
439 _emotion_image_data_zero(sd->obj);
441 eina_stringshare_replace(&sd->file, NULL);
445 /* Only cancel the load_xattr or we will loose ref to time_seek stringshare */
446 if (sd->load_xattr) eio_file_cancel(sd->load_xattr);
447 sd->load_xattr = NULL;
454 emotion_object_file_get(const Evas_Object *obj)
458 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
463 _emotion_aspect_borders_apply(Evas_Object *obj, Smart_Data *sd, int w, int h, int iw, int ih)
467 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
469 /* applying calculated borders */
470 if (sd->crop.l == 0 && sd->crop.r == 0 &&
471 sd->crop.t == 0 && sd->crop.b == 0)
473 Evas_Object *old_clipper;
474 if (sd->crop.clipper)
476 old_clipper = evas_object_clip_get(sd->crop.clipper);
477 evas_object_clip_unset(sd->obj);
478 evas_object_clip_set(sd->obj, old_clipper);
479 evas_object_del(sd->crop.clipper);
480 sd->crop.clipper = NULL;
485 if (!sd->crop.clipper)
487 Evas_Object *old_clipper;
488 sd->crop.clipper = evas_object_rectangle_add(
489 evas_object_evas_get(obj));
490 evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255);
491 evas_object_smart_member_add(sd->crop.clipper, obj);
492 old_clipper = evas_object_clip_get(sd->obj);
493 evas_object_clip_set(sd->obj, sd->crop.clipper);
494 evas_object_clip_set(sd->crop.clipper, old_clipper);
495 if (evas_object_visible_get(sd->obj))
496 evas_object_show(sd->crop.clipper);
499 _clipper_position_size_update(obj, x, y, w, h, iw, ih);
503 _emotion_object_aspect_border_apply(Evas_Object *obj, Smart_Data *sd, int w, int h)
510 sd->module->video_data_size_get(sd->video, &iw, &ih);
512 ir = (double)iw / ih;
515 /* First check if we should fit the width or height of the video inside the
516 * width/height of the object. This check takes into account the original
517 * aspect ratio and the object aspect ratio, if we are keeping both sizes or
518 * cropping the exceding area.
520 if (sd->aspect == EMOTION_ASPECT_KEEP_NONE)
526 aspect_opt = 0; // just ignore keep_aspect
528 else if (sd->aspect == EMOTION_ASPECT_KEEP_WIDTH)
532 else if (sd->aspect == EMOTION_ASPECT_KEEP_HEIGHT)
536 else if (sd->aspect == EMOTION_ASPECT_KEEP_BOTH)
543 else if (sd->aspect == EMOTION_ASPECT_CROP)
550 else if (sd->aspect == EMOTION_ASPECT_CUSTOM)
552 // nothing to do, just respect the border settings
556 /* updating borders based on keep_aspect settings */
557 if (aspect_opt == 1) // keep width
564 scale = (double)iw / w;
567 sd->crop.t = sd->crop.b = dh / 2;
569 else if (aspect_opt == 2) // keep height
576 scale = (double)ih / h;
579 sd->crop.l = sd->crop.r = dw / 2;
582 _emotion_aspect_borders_apply(obj, sd, w, h, iw, ih);
586 emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b)
591 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
593 sd->aspect = EMOTION_ASPECT_CUSTOM;
598 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
599 _emotion_object_aspect_border_apply(obj, sd, w, h);
603 emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
607 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
615 emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a)
619 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
621 evas_object_color_set(sd->bg, r, g, b, a);
623 if (!evas_object_visible_get(obj))
627 evas_object_show(sd->bg);
629 evas_object_hide(sd->bg);
633 emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
637 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
638 evas_object_color_get(sd->bg, r, g, b, a);
642 emotion_object_keep_aspect_set(Evas_Object *obj, Emotion_Aspect a)
647 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
653 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
654 _emotion_object_aspect_border_apply(obj, sd, w, h);
658 emotion_object_keep_aspect_get(const Evas_Object *obj)
662 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_ASPECT_KEEP_NONE);
668 emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
672 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
673 DBG("play=%hhu, was=%hhu", play, sd->play);
674 if (play == sd->play) return;
675 if (!sd->module) return;
676 if (!sd->video) return;
679 sd->remember_play = play;
683 sd->remember_play = play;
684 if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
685 if (sd->play) sd->module->play(sd->video, sd->pos);
686 else sd->module->stop(sd->video);
690 emotion_object_play_get(const Evas_Object *obj)
694 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
695 if (!sd->video) return EINA_FALSE;
701 emotion_object_position_set(Evas_Object *obj, double sec)
705 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
707 if (!sd->module) return;
708 if (!sd->video) return;
711 sd->remember_jump = sec;
714 sd->remember_jump = 0;
717 sd->pos = sd->seek_pos;
718 if (sd->job) ecore_job_del(sd->job);
719 sd->job = ecore_job_add(_pos_set_job, obj);
723 emotion_object_position_get(const Evas_Object *obj)
727 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
728 if (!sd->module) return 0.0;
729 if (!sd->video) return 0.0;
730 if (!sd->module->pos_get) return 0.0;
731 sd->pos = sd->module->pos_get(sd->video);
736 emotion_object_seekable_get(const Evas_Object *obj)
740 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
741 if (!sd->module) return EINA_FALSE;
742 if (!sd->video) return EINA_FALSE;
743 return sd->module->seekable(sd->video);
747 emotion_object_video_handled_get(const Evas_Object *obj)
751 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
752 if (!sd->module) return EINA_FALSE;
753 if (!sd->video) return EINA_FALSE;
754 return sd->module->video_handled(sd->video);
758 emotion_object_audio_handled_get(const Evas_Object *obj)
762 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
763 if (!sd->module) return EINA_FALSE;
764 if (!sd->video) return EINA_FALSE;
765 return sd->module->audio_handled(sd->video);
769 emotion_object_play_length_get(const Evas_Object *obj)
773 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
774 if (!sd->module) return 0.0;
775 if (!sd->video) return 0.0;
776 sd->len = sd->module->len_get(sd->video);
781 emotion_object_size_get(const Evas_Object *obj, int *iw, int *ih)
787 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
793 emotion_object_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth)
797 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
798 evas_object_image_smooth_scale_set(sd->obj, smooth);
802 emotion_object_smooth_scale_get(const Evas_Object *obj)
806 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
807 return evas_object_image_smooth_scale_get(sd->obj);
811 emotion_object_ratio_get(const Evas_Object *obj)
815 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
816 if (!sd->module) return 0.0;
817 if (!sd->video) return 0.0;
822 * Send a control event to the DVD.
825 emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev)
829 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
830 if (!sd->module) return;
831 if (!sd->video) return;
832 sd->module->event_feed(sd->video, ev);
836 emotion_object_audio_volume_set(Evas_Object *obj, double vol)
840 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
842 if (!sd->module) return;
843 if (!sd->video) return;
844 sd->module->audio_channel_volume_set(sd->video, vol);
848 emotion_object_audio_volume_get(const Evas_Object *obj)
852 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
853 if (!sd->module) return 0.0;
854 if (!sd->video) return 0.0;
855 return sd->module->audio_channel_volume_get(sd->video);
859 emotion_object_audio_mute_set(Evas_Object *obj, Eina_Bool mute)
863 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
864 DBG("mute=%hhu", mute);
865 if (!sd->module) return;
866 if (!sd->video) return;
867 sd->module->audio_channel_mute_set(sd->video, mute);
871 emotion_object_audio_mute_get(const Evas_Object *obj)
875 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
876 if (!sd->module) return EINA_FALSE;
877 if (!sd->video) return EINA_FALSE;
878 return sd->module->audio_channel_mute_get(sd->video);
882 emotion_object_audio_channel_count(const Evas_Object *obj)
886 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
887 if (!sd->module) return 0;
888 if (!sd->video) return 0;
889 return sd->module->audio_channel_count(sd->video);
893 emotion_object_audio_channel_name_get(const Evas_Object *obj, int channel)
897 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
898 if (!sd->module) return NULL;
899 if (!sd->video) return NULL;
900 return sd->module->audio_channel_name_get(sd->video, channel);
904 emotion_object_audio_channel_set(Evas_Object *obj, int channel)
908 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
909 DBG("channel=%d", channel);
910 if (!sd->module) return;
911 if (!sd->video) return;
912 sd->module->audio_channel_set(sd->video, channel);
916 emotion_object_audio_channel_get(const Evas_Object *obj)
920 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
921 if (!sd->module) return 0;
922 if (!sd->video) return 0;
923 return sd->module->audio_channel_get(sd->video);
927 emotion_object_video_mute_set(Evas_Object *obj, Eina_Bool mute)
931 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
932 DBG("mute=%hhu", mute);
933 if (!sd->module) return;
934 if (!sd->video) return;
935 sd->module->video_channel_mute_set(sd->video, mute);
939 emotion_object_video_mute_get(const Evas_Object *obj)
943 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
944 if (!sd->module) return EINA_FALSE;
945 if (!sd->video) return EINA_FALSE;
946 return sd->module->video_channel_mute_get(sd->video);
950 emotion_object_video_channel_count(const Evas_Object *obj)
954 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
955 if (!sd->module) return EINA_FALSE;
956 if (!sd->video) return EINA_FALSE;
957 return sd->module->video_channel_count(sd->video);
961 emotion_object_video_channel_name_get(const Evas_Object *obj, int channel)
965 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
966 if (!sd->module) return NULL;
967 if (!sd->video) return NULL;
968 return sd->module->video_channel_name_get(sd->video, channel);
972 emotion_object_video_channel_set(Evas_Object *obj, int channel)
976 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
977 DBG("channel=%d", channel);
978 if (!sd->module) return;
979 if (!sd->video) return;
980 sd->module->video_channel_set(sd->video, channel);
984 emotion_object_video_channel_get(const Evas_Object *obj)
988 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
989 if (!sd->module) return 0;
990 if (!sd->video) return 0;
991 return sd->module->video_channel_get(sd->video);
995 emotion_object_spu_mute_set(Evas_Object *obj, Eina_Bool mute)
999 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1000 DBG("mute=%hhu", mute);
1001 if (!sd->module) return;
1002 if (!sd->video) return;
1003 sd->module->spu_channel_mute_set(sd->video, mute);
1007 emotion_object_spu_mute_get(const Evas_Object *obj)
1011 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1012 if (!sd->module) return EINA_FALSE;
1013 if (!sd->video) return EINA_FALSE;
1014 return sd->module->spu_channel_mute_get(sd->video);
1018 emotion_object_spu_channel_count(const Evas_Object *obj)
1022 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1023 if (!sd->module) return 0;
1024 if (!sd->video) return 0;
1025 return sd->module->spu_channel_count(sd->video);
1029 emotion_object_spu_channel_name_get(const Evas_Object *obj, int channel)
1033 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1034 if (!sd->module) return NULL;
1035 if (!sd->video) return NULL;
1036 return sd->module->spu_channel_name_get(sd->video, channel);
1040 emotion_object_spu_channel_set(Evas_Object *obj, int channel)
1044 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1045 DBG("channel=%d", channel);
1046 if (!sd->module) return;
1047 if (!sd->video) return;
1048 sd->module->spu_channel_set(sd->video, channel);
1052 emotion_object_spu_channel_get(const Evas_Object *obj)
1056 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1057 if (!sd->module) return 0;
1058 if (!sd->video) return 0;
1059 return sd->module->spu_channel_get(sd->video);
1063 emotion_object_chapter_count(const Evas_Object *obj)
1067 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1068 if (!sd->module) return 0;
1069 if (!sd->video) return 0;
1070 return sd->module->chapter_count(sd->video);
1074 emotion_object_chapter_set(Evas_Object *obj, int chapter)
1078 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1079 DBG("chapter=%d", chapter);
1080 if (!sd->module) return;
1081 if (!sd->video) return;
1082 sd->module->chapter_set(sd->video, chapter);
1086 emotion_object_chapter_get(const Evas_Object *obj)
1090 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1091 if (!sd->module) return 0;
1092 if (!sd->video) return 0;
1093 return sd->module->chapter_get(sd->video);
1097 emotion_object_chapter_name_get(const Evas_Object *obj, int chapter)
1101 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1102 if (!sd->module) return NULL;
1103 if (!sd->video) return NULL;
1104 return sd->module->chapter_name_get(sd->video, chapter);
1108 emotion_object_play_speed_set(Evas_Object *obj, double speed)
1112 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1113 DBG("speed=%f", speed);
1114 if (!sd->module) return;
1115 if (!sd->video) return;
1116 sd->module->speed_set(sd->video, speed);
1120 emotion_object_play_speed_get(const Evas_Object *obj)
1124 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
1125 if (!sd->module) return 0.0;
1126 if (!sd->video) return 0.0;
1127 return sd->module->speed_get(sd->video);
1131 emotion_object_eject(Evas_Object *obj)
1135 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1136 if (!sd->module) return;
1137 if (!sd->video) return;
1138 sd->module->eject(sd->video);
1142 emotion_object_title_get(const Evas_Object *obj)
1146 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1151 emotion_object_progress_info_get(const Evas_Object *obj)
1155 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1156 return sd->progress.info;
1160 emotion_object_progress_status_get(const Evas_Object *obj)
1164 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
1165 return sd->progress.stat;
1169 emotion_object_ref_file_get(const Evas_Object *obj)
1173 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1174 return sd->ref.file;
1178 emotion_object_ref_num_get(const Evas_Object *obj)
1182 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1187 emotion_object_spu_button_count_get(const Evas_Object *obj)
1191 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1192 return sd->spu.button_num;
1196 emotion_object_spu_button_get(const Evas_Object *obj)
1200 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1201 return sd->spu.button;
1205 emotion_object_meta_info_get(const Evas_Object *obj, Emotion_Meta_Info meta)
1209 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1210 if (!sd->module) return NULL;
1211 if (!sd->video) return NULL;
1214 case EMOTION_META_INFO_TRACK_TITLE:
1215 return sd->module->meta_get(sd->video, META_TRACK_TITLE);
1217 case EMOTION_META_INFO_TRACK_ARTIST:
1218 return sd->module->meta_get(sd->video, META_TRACK_ARTIST);
1220 case EMOTION_META_INFO_TRACK_ALBUM:
1221 return sd->module->meta_get(sd->video, META_TRACK_ALBUM);
1223 case EMOTION_META_INFO_TRACK_YEAR:
1224 return sd->module->meta_get(sd->video, META_TRACK_YEAR);
1226 case EMOTION_META_INFO_TRACK_GENRE:
1227 return sd->module->meta_get(sd->video, META_TRACK_GENRE);
1229 case EMOTION_META_INFO_TRACK_COMMENT:
1230 return sd->module->meta_get(sd->video, META_TRACK_COMMENT);
1232 case EMOTION_META_INFO_TRACK_DISC_ID:
1233 return sd->module->meta_get(sd->video, META_TRACK_DISCID);
1242 emotion_object_vis_set(Evas_Object *obj, Emotion_Vis visualization)
1246 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1247 DBG("visualization=%d", visualization);
1248 if (!sd->module) return;
1249 if (!sd->video) return;
1250 if (!sd->module->vis_set) return;
1251 sd->module->vis_set(sd->video, visualization);
1255 emotion_object_vis_get(const Evas_Object *obj)
1259 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_VIS_NONE);
1260 if (!sd->module) return EMOTION_VIS_NONE;
1261 if (!sd->video) return EMOTION_VIS_NONE;
1262 if (!sd->module->vis_get) return EMOTION_VIS_NONE;
1263 return sd->module->vis_get(sd->video);
1267 emotion_object_vis_supported(const Evas_Object *obj, Emotion_Vis visualization)
1271 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1272 if (!sd->module) return EINA_FALSE;
1273 if (!sd->video) return EINA_FALSE;
1274 if (!sd->module->vis_supported) return EINA_FALSE;
1275 return sd->module->vis_supported(sd->video, visualization);
1279 emotion_object_priority_set(Evas_Object *obj, Eina_Bool priority)
1283 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1284 fprintf(stderr, "priority set %p\n", sd->module);
1285 if (!sd->module) return ;
1286 if (!sd->video) return ;
1287 if (!sd->module->priority_set) return ;
1288 fprintf(stderr, "calling\n");
1289 sd->module->priority_set(sd->video, priority);
1293 emotion_object_priority_get(const Evas_Object *obj)
1297 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1298 if (!sd->module) return EINA_FALSE;
1299 if (!sd->video) return EINA_FALSE;
1300 if (!sd->module->priority_get) return EINA_FALSE;
1301 return sd->module->priority_get(sd->video);
1306 _eio_load_xattr_cleanup(Smart_Data *sd, Eio_File *handler)
1308 if (handler == sd->load_xattr) sd->load_xattr = NULL;
1310 EINA_REFCOUNT_UNREF(sd)
1311 _smart_data_free(sd);
1315 _eio_load_xattr_done(void *data, Eio_File *handler, double xattr_double)
1317 Smart_Data *sd = data;
1319 emotion_object_position_set(evas_object_smart_parent_get(sd->obj), xattr_double);
1320 _eio_load_xattr_cleanup(sd, handler);
1324 _eio_load_xattr_error(void *data, Eio_File *handler, int err __UNUSED__)
1326 Smart_Data *sd = data;
1328 _eio_load_xattr_cleanup(sd, handler);
1333 emotion_object_last_position_load(Evas_Object *obj)
1341 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1342 if (!sd->file) return ;
1344 if (!strncmp(sd->file, "file://", 7))
1346 else if (!strstr(sd->file, "://"))
1352 if (sd->load_xattr) return ;
1354 EINA_REFCOUNT_REF(sd);
1356 sd->load_xattr = eio_file_xattr_double_get(tmp,
1358 _eio_load_xattr_done,
1359 _eio_load_xattr_error,
1362 if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr))
1364 emotion_object_position_set(obj, xattr);
1371 _eio_save_xattr_done(void *data __UNUSED__, Eio_File *handler __UNUSED__)
1376 _eio_save_xattr_error(void *data __UNUSED__, Eio_File *handler __UNUSED__, int err __UNUSED__)
1382 emotion_object_last_position_save(Evas_Object *obj)
1387 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1388 if (!sd->file) return ;
1390 if (!strncmp(sd->file, "file://", 7))
1392 else if (!strstr(sd->file, "://"))
1398 eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0,
1399 _eio_save_xattr_done, _eio_save_xattr_error, sd);
1401 eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0);
1406 emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state)
1410 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1413 case EMOTION_WAKEUP:
1414 /* Restore the rendering pipeline, offset and everything back to play again (this will be called automatically by play_set) */
1416 /* This destroy some part of the rendering pipeline */
1417 case EMOTION_DEEP_SLEEP:
1418 /* This destroy all the rendering pipeline and just keep the last rendered image (fullscreen) */
1419 case EMOTION_HIBERNATE:
1420 /* This destroy all the rendering pipeline and keep 1/4 of the last rendered image */
1428 EAPI Emotion_Suspend
1429 motion_object_suspend_get(Evas_Object *obj)
1433 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_WAKEUP);
1437 /*****************************/
1438 /* Utility calls for modules */
1439 /*****************************/
1442 _emotion_video_get(const Evas_Object *obj)
1446 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1451 _emotion_frame_new(Evas_Object *obj)
1455 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1457 // printf("pix get set 1 %p\n", sd->obj);
1458 evas_object_image_pixels_dirty_set(sd->obj, 1);
1459 evas_object_smart_callback_call(obj, SIG_FRAME_DECODE, NULL);
1463 _emotion_video_pos_update(Evas_Object *obj, double pos, double len)
1466 int npos = 0, nlen = 0;
1468 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1469 if (pos != sd->pos) npos = 1;
1470 if (len != sd->len) nlen = 1;
1473 if (npos) evas_object_smart_callback_call(obj, SIG_POSITION_UPDATE, NULL);
1474 if (nlen) evas_object_smart_callback_call(obj, SIG_LENGTH_CHANGE, NULL);
1478 _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
1485 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1486 evas_object_image_size_get(sd->obj, &iw, &ih);
1487 if ((w != iw) || (h != ih))
1491 _emotion_image_data_zero(sd->obj);
1494 if (h > 0) tmp = (double)w / (double)h;
1496 if (ratio != tmp) tmp = ratio;
1497 if (tmp != sd->ratio)
1504 evas_object_size_hint_request_set(obj, w, h);
1505 evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
1506 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1507 _emotion_object_aspect_border_apply(obj, sd, w, h);
1512 _emotion_decode_stop(Evas_Object *obj)
1516 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1520 evas_object_smart_callback_call(obj, SIG_DECODE_STOP, NULL);
1525 _emotion_open_done(Evas_Object *obj)
1529 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1532 if (sd->remember_jump)
1533 emotion_object_position_set(obj, sd->remember_jump);
1534 if (sd->remember_play != sd->play)
1535 emotion_object_play_set(obj, sd->remember_play);
1536 evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL);
1540 _emotion_playback_started(Evas_Object *obj)
1542 evas_object_smart_callback_call(obj, SIG_PLAYBACK_STARTED, NULL);
1546 _emotion_playback_finished(Evas_Object *obj)
1548 evas_object_smart_callback_call(obj, SIG_PLAYBACK_FINISHED, NULL);
1552 _emotion_audio_level_change(Evas_Object *obj)
1554 evas_object_smart_callback_call(obj, SIG_AUDIO_LEVEL_CHANGE, NULL);
1558 _emotion_channels_change(Evas_Object *obj)
1562 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1563 evas_object_smart_callback_call(obj, SIG_CHANNELS_CHANGE, NULL);
1567 _emotion_title_set(Evas_Object *obj, char *title)
1571 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1573 sd->title = strdup(title);
1574 evas_object_smart_callback_call(obj, SIG_TITLE_CHANGE, NULL);
1578 _emotion_progress_set(Evas_Object *obj, char *info, double st)
1582 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1583 free(sd->progress.info);
1584 sd->progress.info = strdup(info);
1585 sd->progress.stat = st;
1586 evas_object_smart_callback_call(obj, SIG_PROGRESS_CHANGE, NULL);
1590 _emotion_file_ref_set(Evas_Object *obj, const char *file, int num)
1594 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1596 sd->ref.file = strdup(file);
1598 evas_object_smart_callback_call(obj, SIG_REF_CHANGE, NULL);
1602 _emotion_spu_button_num_set(Evas_Object *obj, int num)
1606 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1607 sd->spu.button_num = num;
1608 evas_object_smart_callback_call(obj, SIG_BUTTON_NUM_CHANGE, NULL);
1612 _emotion_spu_button_set(Evas_Object *obj, int button)
1616 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1617 sd->spu.button = button;
1618 evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL);
1622 _emotion_seek_done(Evas_Object *obj)
1626 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1630 if (sd->seek) emotion_object_position_set(obj, sd->seek_pos);
1636 /****************************/
1637 /* Internal object routines */
1638 /****************************/
1641 _mouse_move(void *data, Evas *ev __UNUSED__, Evas_Object *obj, void *event_info)
1643 Evas_Event_Mouse_Move *e;
1646 Evas_Coord ox, oy, ow, oh;
1650 if (!sd->module) return;
1651 if (!sd->video) return;
1652 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1653 evas_object_image_size_get(obj, &iw, &ih);
1654 if ((iw < 1) || (ih < 1)) return;
1655 x = (((int)e->cur.canvas.x - ox) * iw) / ow;
1656 y = (((int)e->cur.canvas.y - oy) * ih) / oh;
1657 sd->module->event_mouse_move_feed(sd->video, x, y);
1661 _mouse_down(void *data, Evas *ev __UNUSED__, Evas_Object *obj, void *event_info)
1663 Evas_Event_Mouse_Down *e;
1666 Evas_Coord ox, oy, ow, oh;
1670 if (!sd->module) return;
1671 if (!sd->video) return;
1672 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1673 evas_object_image_size_get(obj, &iw, &ih);
1674 if ((iw < 1) || (ih < 1)) return;
1675 x = (((int)e->canvas.x - ox) * iw) / ow;
1676 y = (((int)e->canvas.y - oy) * ih) / oh;
1677 sd->module->event_mouse_button_feed(sd->video, 1, x, y);
1681 _pos_set_job(void *data)
1687 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1689 if (sd->seeking) return;
1693 sd->module->pos_set(sd->video, sd->seek_pos);
1698 /* called by evas when it needs pixels for the image object */
1700 _pixels_get(void *data, Evas_Object *obj)
1704 Emotion_Format format;
1705 unsigned char *bgra_data;
1708 sd->module->video_data_size_get(sd->video, &w, &h);
1712 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1713 evas_object_image_alpha_set(obj, 0);
1714 evas_object_image_size_set(obj, w, h);
1718 if ((iw <= 1) || (ih <= 1))
1720 _emotion_image_data_zero(sd->obj);
1721 evas_object_image_pixels_dirty_set(obj, 0);
1725 format = sd->module->format_get(sd->video);
1726 if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
1728 unsigned char **rows;
1730 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1731 rows = evas_object_image_data_get(obj, 1);
1734 if (sd->module->yuv_rows_get(sd->video, iw, ih,
1737 &rows[ih + (ih / 2)]))
1738 evas_object_image_data_update_add(obj, 0, 0, iw, ih);
1740 evas_object_image_data_set(obj, rows);
1741 evas_object_image_pixels_dirty_set(obj, 0);
1743 else if (format == EMOTION_FORMAT_BGRA)
1745 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_ARGB8888);
1746 if (sd->module->bgra_data_get(sd->video, &bgra_data))
1748 evas_object_image_data_set(obj, bgra_data);
1749 evas_object_image_pixels_dirty_set(obj, 0);
1755 /*******************************************/
1756 /* Internal smart object required routines */
1757 /*******************************************/
1758 #ifdef EMOTION_STATIC_BUILD_XINE
1759 Eina_Bool xine_module_init(void);
1761 #ifdef EMOTION_STATIC_BUILD_GSTREAMER
1762 Eina_Bool gstreamer_module_init(void);
1764 #ifdef EMOTION_STATIC_BUILD_GENERIC
1765 Eina_Bool generic_module_init(void);
1777 _log_domain = eina_log_domain_register("emotion", EINA_COLOR_LIGHTCYAN);
1778 if (_log_domain < 0)
1780 EINA_LOG_CRIT("Could not register log domain 'emotion'");
1785 _backends = eina_hash_string_small_new(free);
1787 _modules = eina_module_list_get(NULL, PACKAGE_LIB_DIR "/emotion/", 0, NULL, NULL);
1789 path = eina_module_environment_path_get("HOME", "/.emotion/");
1790 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1791 if (path) free(path);
1793 path = eina_module_environment_path_get("EMOTION_MODULES_DIR", "/emotion/");
1794 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1795 if (path) free(path);
1797 path = eina_module_symbol_path_get(emotion_object_add, "/emotion/");
1798 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1799 if (path) free(path);
1803 ERR("No module found!");
1807 eina_module_list_load(_modules);
1809 /* Init static module */
1810 #ifdef EMOTION_STATIC_BUILD_XINE
1813 #ifdef EMOTION_STATIC_BUILD_GSTREAMER
1814 gstreamer_module_init();
1816 #ifdef EMOTION_STATIC_BUILD_GENERIC
1817 generic_module_init();
1820 static Evas_Smart_Class sc =
1821 EVAS_SMART_CLASS_INIT_NAME_VERSION(E_OBJ_NAME);
1824 sc.add = _smart_add;
1825 sc.del = _smart_del;
1826 sc.move = _smart_move;
1827 sc.resize = _smart_resize;
1828 sc.show = _smart_show;
1829 sc.hide = _smart_hide;
1830 sc.color_set = _smart_color_set;
1831 sc.clip_set = _smart_clip_set;
1832 sc.clip_unset = _smart_clip_unset;
1833 sc.callbacks = _smart_callbacks;
1835 smart = evas_smart_class_new(&sc);
1840 _smart_add(Evas_Object * obj)
1843 unsigned int *pixel;
1845 sd = calloc(1, sizeof(Smart_Data));
1847 EINA_REFCOUNT_INIT(sd);
1848 sd->state = EMOTION_WAKEUP;
1849 sd->obj = evas_object_image_add(evas_object_evas_get(obj));
1850 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj));
1851 evas_object_color_set(sd->bg, 0, 0, 0, 0);
1852 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_DOWN, _mouse_down, sd);
1854 evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd);
1855 evas_object_smart_member_add(sd->obj, obj);
1856 evas_object_smart_member_add(sd->bg, obj);
1857 evas_object_lower(sd->bg);
1859 sd->spu.button = -1;
1860 evas_object_image_alpha_set(sd->obj, 0);
1861 pixel = evas_object_image_data_get(sd->obj, 1);
1864 *pixel = 0xff000000;
1865 evas_object_image_data_set(obj, pixel);
1867 evas_object_smart_data_set(obj, sd);
1873 _smart_del(Evas_Object * obj)
1877 sd = evas_object_smart_data_get(obj);
1879 EINA_REFCOUNT_UNREF(sd)
1880 _smart_data_free(sd);
1884 _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
1888 sd = evas_object_smart_data_get(obj);
1891 int vid_w, vid_h, w, h;
1892 sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
1893 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1894 _clipper_position_size_update(obj, x, y, w, h, vid_w, vid_h);
1895 evas_object_move(sd->bg, x, y);
1899 _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
1903 sd = evas_object_smart_data_get(obj);
1908 sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
1909 _emotion_object_aspect_border_apply(obj, sd, w, h);
1910 evas_object_resize(sd->bg, w, h);
1914 _smart_show(Evas_Object * obj)
1919 sd = evas_object_smart_data_get(obj);
1921 evas_object_show(sd->obj);
1922 if (sd->crop.clipper)
1923 evas_object_show(sd->crop.clipper);
1925 evas_object_color_get(sd->bg, NULL, NULL, NULL, &a);
1927 evas_object_show(sd->bg);
1931 _smart_hide(Evas_Object * obj)
1935 sd = evas_object_smart_data_get(obj);
1937 evas_object_hide(sd->obj);
1938 if (sd->crop.clipper)
1939 evas_object_hide(sd->crop.clipper);
1940 evas_object_hide(sd->bg);
1944 _smart_color_set(Evas_Object * obj, int r, int g, int b, int a)
1948 sd = evas_object_smart_data_get(obj);
1950 evas_object_color_set(sd->obj, r, g, b, a);
1951 evas_object_color_set(sd->crop.clipper, r, g, b, a);
1955 _smart_clip_set(Evas_Object * obj, Evas_Object * clip)
1959 sd = evas_object_smart_data_get(obj);
1961 if (sd->crop.clipper)
1962 evas_object_clip_set(sd->crop.clipper, clip);
1964 evas_object_clip_set(sd->obj, clip);
1965 evas_object_clip_set(sd->bg, clip);
1969 _smart_clip_unset(Evas_Object * obj)
1973 sd = evas_object_smart_data_get(obj);
1975 if (sd->crop.clipper)
1976 evas_object_clip_unset(sd->crop.clipper);
1978 evas_object_clip_unset(sd->obj);
1979 evas_object_clip_unset(sd->bg);