1 #include "emotion_private.h"
10 # include <sys/xattr.h>
14 #define E_SMART_OBJ_GET(smart, o, type) \
19 smart = evas_object_smart_data_get(o); \
21 _e_smart_str = (char *)evas_object_type_get(o); \
22 if (!_e_smart_str) return; \
23 if (strcmp(_e_smart_str, type)) return; \
26 #define E_SMART_OBJ_GET_RETURN(smart, o, type, ret) \
31 smart = evas_object_smart_data_get(o); \
32 if (!smart) return ret; \
33 _e_smart_str = (char *)evas_object_type_get(o); \
34 if (!_e_smart_str) return ret; \
35 if (strcmp(_e_smart_str, type)) return ret; \
38 #define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
39 #define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
40 #define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
41 #define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
42 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
44 #define E_OBJ_NAME "emotion_object"
46 typedef struct _Smart_Data Smart_Data;
51 Emotion_Video_Module *module;
94 Emotion_Module_Options module_options;
96 Emotion_Suspend state;
97 Emotion_Aspect aspect;
101 Eina_Bool remember_play : 1;
103 Eina_Bool seeking : 1;
106 static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info);
107 static void _mouse_down(void *data, Evas *ev, Evas_Object *obj, void *event_info);
108 static void _pos_set_job(void *data);
109 static void _pixels_get(void *data, Evas_Object *obj);
111 static void _smart_init(void);
112 static void _smart_add(Evas_Object * obj);
113 static void _smart_del(Evas_Object * obj);
114 static void _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y);
115 static void _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h);
116 static void _smart_show(Evas_Object * obj);
117 static void _smart_hide(Evas_Object * obj);
118 static void _smart_color_set(Evas_Object * obj, int r, int g, int b, int a);
119 static void _smart_clip_set(Evas_Object * obj, Evas_Object * clip);
120 static void _smart_clip_unset(Evas_Object * obj);
122 /**********************************/
123 /* Globals for the E Video Object */
124 /**********************************/
125 static Evas_Smart *smart = NULL;
126 static Eina_Hash *_backends = NULL;
127 static Eina_Array *_modules = NULL;
128 static int _log_domain = -1;
130 static const char *_backend_priority[] = {
136 static const char SIG_FRAME_DECODE[] = "frame_decode";
137 static const char SIG_POSITION_UPDATE[] = "position_update";
138 static const char SIG_LENGTH_CHANGE[] = "length_change";
139 static const char SIG_FRAME_RESIZE[] = "frame_resize";
140 static const char SIG_DECODE_STOP[] = "decode_stop";
141 static const char SIG_PLAYBACK_STARTED[] = "playback_started";
142 static const char SIG_PLAYBACK_FINISHED[] = "playback_finished";
143 static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change";
144 static const char SIG_CHANNELS_CHANGE[] = "channels_change";
145 static const char SIG_TITLE_CHANGE[] = "title_change";
146 static const char SIG_PROGRESS_CHANGE[] = "progress_change";
147 static const char SIG_REF_CHANGE[] = "ref_change";
148 static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change";
149 static const char SIG_BUTTON_CHANGE[] = "button_change";
150 static const char SIG_OPEN_DONE[] = "open_done";
151 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
152 {SIG_FRAME_DECODE, ""},
153 {SIG_POSITION_UPDATE, ""},
154 {SIG_LENGTH_CHANGE, ""},
155 {SIG_FRAME_RESIZE, ""},
156 {SIG_DECODE_STOP, ""},
157 {SIG_PLAYBACK_STARTED, ""},
158 {SIG_PLAYBACK_FINISHED, ""},
159 {SIG_AUDIO_LEVEL_CHANGE, ""},
160 {SIG_CHANNELS_CHANGE, ""},
161 {SIG_TITLE_CHANGE, ""},
162 {SIG_PROGRESS_CHANGE, ""},
163 {SIG_REF_CHANGE, ""},
164 {SIG_BUTTON_NUM_CHANGE, ""},
165 {SIG_BUTTON_CHANGE, ""},
171 _emotion_image_data_zero(Evas_Object *img)
175 data = evas_object_image_data_get(img, 1);
181 evas_object_image_size_get(img, &w, &h);
182 cs = evas_object_image_colorspace_get(img);
183 if (cs == EVAS_COLORSPACE_ARGB8888)
185 if ((cs == EVAS_COLORSPACE_YCBCR422P601_PL) ||
186 (cs == EVAS_COLORSPACE_YCBCR422P709_PL))
187 sz = h * 2 * sizeof(unsigned char *);
188 if (sz != 0) memset(data, 0, sz);
190 evas_object_image_data_set(img, data);
194 _emotion_module_close(Emotion_Video_Module *mod, void *video)
197 if (mod->plugin->close && video)
198 mod->plugin->close(mod, video);
199 /* FIXME: we can't go dlclosing here as a thread still may be running from
200 * the module - this in theory will leak- but it shouldn't be too bad and
201 * mean that once a module is dlopened() it can't be closed - its refcount
202 * will just keep going up
207 _smart_data_free(Smart_Data *sd)
209 if (sd->video) sd->module->file_close(sd->video);
210 _emotion_module_close(sd->module, sd->video);
211 evas_object_del(sd->obj);
212 evas_object_del(sd->crop.clipper);
213 eina_stringshare_del(sd->file);
214 free(sd->module_name);
215 if (sd->job) ecore_job_del(sd->job);
216 free(sd->progress.info);
224 _emotion_module_register(const char *name, Emotion_Module_Open mod_open, Emotion_Module_Close mod_close)
226 Eina_Emotion_Plugins *plugin;
228 plugin = malloc(sizeof (Eina_Emotion_Plugins));
229 if (!plugin) return EINA_FALSE;
231 plugin->open = mod_open;
232 plugin->close = mod_close;
234 return eina_hash_add(_backends, name, plugin);
238 _emotion_module_unregister(const char *name)
240 return eina_hash_del(_backends, name, NULL);
244 _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
246 Eina_Emotion_Plugins *plugin;
250 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
253 ERR("No backend loaded");
257 if (!name && getenv("EMOTION_ENGINE"))
258 name = getenv("EMOTION_ENGINE");
260 /* FIXME: Always look for a working backend. */
263 name = _backend_priority[i++];
265 plugin = eina_hash_find(_backends, name);
268 if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
271 ERR("No backend loaded");
275 if (plugin->open(obj, (const Emotion_Video_Module **) mod, video, &(sd->module_options)))
279 (*mod)->plugin = plugin;
284 if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
287 ERR("Unable to load module: %s", name);
293 _clipper_position_size_update(Evas_Object *obj, int w, int h, int vid_w, int vid_h)
296 double scale_w, scale_h;
299 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
301 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
302 evas_object_move(sd->crop.clipper, x, y);
303 scale_w = (double)w / (double)(vid_w - sd->crop.l - sd->crop.r);
304 scale_h = (double)h / (double)(vid_h - sd->crop.t - sd->crop.b);
306 evas_object_image_fill_set(sd->obj, 0, 0, vid_w * scale_w, vid_h * scale_h);
307 evas_object_resize(sd->obj, vid_w * scale_w, vid_h * scale_h);
308 evas_object_move(sd->obj, x - sd->crop.l * scale_w, y - sd->crop.t * scale_h);
309 evas_object_resize(sd->crop.clipper, w, h);
312 /*******************************/
313 /* Externally accessible calls */
314 /*******************************/
319 emotion_object_add(Evas *evas)
322 return evas_object_smart_add(evas, smart);
326 emotion_object_image_get(const Evas_Object *obj)
330 sd = evas_object_smart_data_get(obj);
331 if (!sd) return NULL;
336 emotion_object_module_option_set(Evas_Object *obj, const char *opt, const char *val)
340 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
341 if ((!opt) || (!val)) return;
343 if (!strcmp(opt, "player"))
344 eina_stringshare_replace(&sd->module_options.player, val);
348 emotion_object_init(Evas_Object *obj, const char *module_filename)
353 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
355 if ((sd->module_name) && module_filename && (!strcmp(sd->module_name, module_filename)))
357 free(sd->module_name);
358 sd->module_name = NULL;
365 free(sd->progress.info);
366 sd->progress.info = NULL;
367 sd->progress.stat = 0.0;
371 sd->spu.button_num = 0;
375 sd->remember_jump = 0;
378 sd->remember_play = 0;
380 _emotion_module_close(sd->module, sd->video);
384 module_filename = _emotion_module_open(module_filename, obj, &sd->module, &sd->video);
385 if (!module_filename)
388 sd->module_name = strdup(module_filename);
392 emotion_object_file_set(obj, file);
393 eina_stringshare_del(file);
400 emotion_object_file_set(Evas_Object *obj, const char *file)
404 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE);
406 DBG("file=%s", file);
407 if (!sd->module) return EINA_FALSE;
409 if ((file) && (sd->file) && (file == sd->file || !strcmp(file, sd->file))) return EINA_FALSE;
410 if ((file) && (file[0] != 0))
412 eina_stringshare_replace(&sd->file, file);
413 sd->module->file_close(sd->video);
414 evas_object_image_data_set(sd->obj, NULL);
415 evas_object_image_size_set(sd->obj, 1, 1);
416 _emotion_image_data_zero(sd->obj);
418 if (!sd->module->file_open(sd->file, obj, sd->video))
421 if (sd->play) sd->module->play(sd->video, 0.0);
425 if (sd->video && sd->module)
427 sd->module->file_close(sd->video);
428 evas_object_image_data_set(sd->obj, NULL);
429 evas_object_image_size_set(sd->obj, 1, 1);
430 _emotion_image_data_zero(sd->obj);
432 eina_stringshare_replace(&sd->file, NULL);
436 /* Only cancel the load_xattr or we will loose ref to time_seek stringshare */
437 if (sd->load_xattr) eio_file_cancel(sd->load_xattr);
438 sd->load_xattr = NULL;
445 emotion_object_file_get(const Evas_Object *obj)
449 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
454 _emotion_aspect_borders_apply(Evas_Object *obj, Smart_Data *sd, int w, int h, int iw, int ih)
456 /* applying calculated borders */
457 if (sd->crop.l == 0 && sd->crop.r == 0 &&
458 sd->crop.t == 0 && sd->crop.b == 0)
460 Evas_Object *old_clipper;
461 if (sd->crop.clipper)
463 old_clipper = evas_object_clip_get(sd->crop.clipper);
464 evas_object_clip_unset(sd->obj);
465 evas_object_clip_set(sd->obj, old_clipper);
466 evas_object_del(sd->crop.clipper);
467 sd->crop.clipper = NULL;
472 if (!sd->crop.clipper)
474 Evas_Object *old_clipper;
475 sd->crop.clipper = evas_object_rectangle_add(
476 evas_object_evas_get(obj));
477 evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255);
478 evas_object_smart_member_add(sd->crop.clipper, obj);
479 old_clipper = evas_object_clip_get(sd->obj);
480 evas_object_clip_set(sd->obj, sd->crop.clipper);
481 evas_object_clip_set(sd->crop.clipper, old_clipper);
482 if (evas_object_visible_get(sd->obj))
483 evas_object_show(sd->crop.clipper);
486 _clipper_position_size_update(obj, w, h, iw, ih);
490 _emotion_object_aspect_border_apply(Evas_Object *obj, Smart_Data *sd, int w, int h)
497 sd->module->video_data_size_get(sd->video, &iw, &ih);
499 ir = (double)iw / ih;
502 /* First check if we should fit the width or height of the video inside the
503 * width/height of the object. This check takes into account the original
504 * aspect ratio and the object aspect ratio, if we are keeping both sizes or
505 * cropping the exceding area.
507 if (sd->aspect == EMOTION_ASPECT_KEEP_NONE)
513 aspect_opt = 0; // just ignore keep_aspect
515 else if (sd->aspect == EMOTION_ASPECT_KEEP_WIDTH)
519 else if (sd->aspect == EMOTION_ASPECT_KEEP_HEIGHT)
523 else if (sd->aspect == EMOTION_ASPECT_KEEP_BOTH)
530 else if (sd->aspect == EMOTION_ASPECT_CROP)
537 else if (sd->aspect == EMOTION_ASPECT_CUSTOM)
539 // nothing to do, just respect the border settings
543 /* updating borders based on keep_aspect settings */
544 if (aspect_opt == 1) // keep width
551 scale = (double)iw / w;
554 sd->crop.t = sd->crop.b = dh / 2;
556 else if (aspect_opt == 2) // keep height
563 scale = (double)ih / h;
566 sd->crop.l = sd->crop.r = dw / 2;
569 _emotion_aspect_borders_apply(obj, sd, w, h, iw, ih);
573 emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b)
578 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
580 sd->aspect = EMOTION_ASPECT_CUSTOM;
585 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
586 _emotion_object_aspect_border_apply(obj, sd, w, h);
590 emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b)
594 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
602 emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a)
606 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
608 evas_object_color_set(sd->bg, r, g, b, a);
610 if (!evas_object_visible_get(obj))
614 evas_object_show(sd->bg);
616 evas_object_hide(sd->bg);
620 emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
624 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
625 evas_object_color_get(sd->bg, r, g, b, a);
629 emotion_object_keep_aspect_set(Evas_Object *obj, Emotion_Aspect a)
634 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
640 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
641 _emotion_object_aspect_border_apply(obj, sd, w, h);
645 emotion_object_keep_aspect_get(const Evas_Object *obj)
649 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_ASPECT_KEEP_NONE);
655 emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
659 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
660 DBG("play=%hhu, was=%hhu", play, sd->play);
661 if (play == sd->play) return;
662 if (!sd->module) return;
663 if (!sd->video) return;
666 sd->remember_play = play;
670 sd->remember_play = play;
671 if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
672 if (sd->play) sd->module->play(sd->video, sd->pos);
673 else sd->module->stop(sd->video);
677 emotion_object_play_get(const Evas_Object *obj)
681 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
682 if (!sd->video) return EINA_FALSE;
688 emotion_object_position_set(Evas_Object *obj, double sec)
692 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
694 if (!sd->module) return;
695 if (!sd->video) return;
698 sd->remember_jump = sec;
701 sd->remember_jump = 0;
704 sd->pos = sd->seek_pos;
705 if (sd->job) ecore_job_del(sd->job);
706 sd->job = ecore_job_add(_pos_set_job, obj);
710 emotion_object_position_get(const Evas_Object *obj)
714 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
715 if (!sd->module) return 0.0;
716 if (!sd->video) return 0.0;
717 if (!sd->module->pos_get) return 0.0;
718 sd->pos = sd->module->pos_get(sd->video);
723 emotion_object_seekable_get(const Evas_Object *obj)
727 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
728 if (!sd->module) return EINA_FALSE;
729 if (!sd->video) return EINA_FALSE;
730 return sd->module->seekable(sd->video);
734 emotion_object_video_handled_get(const Evas_Object *obj)
738 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
739 if (!sd->module) return EINA_FALSE;
740 if (!sd->video) return EINA_FALSE;
741 return sd->module->video_handled(sd->video);
745 emotion_object_audio_handled_get(const Evas_Object *obj)
749 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
750 if (!sd->module) return EINA_FALSE;
751 if (!sd->video) return EINA_FALSE;
752 return sd->module->audio_handled(sd->video);
756 emotion_object_play_length_get(const Evas_Object *obj)
760 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
761 if (!sd->module) return 0.0;
762 if (!sd->video) return 0.0;
763 sd->len = sd->module->len_get(sd->video);
768 emotion_object_size_get(const Evas_Object *obj, int *iw, int *ih)
774 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
775 evas_object_image_size_get(sd->obj, iw, ih);
779 emotion_object_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth)
783 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
784 evas_object_image_smooth_scale_set(sd->obj, smooth);
788 emotion_object_smooth_scale_get(const Evas_Object *obj)
792 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
793 return evas_object_image_smooth_scale_get(sd->obj);
797 emotion_object_ratio_get(const Evas_Object *obj)
801 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
802 if (!sd->module) return 0.0;
803 if (!sd->video) return 0.0;
808 * Send a control event to the DVD.
811 emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev)
815 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
816 if (!sd->module) return;
817 if (!sd->video) return;
818 sd->module->event_feed(sd->video, ev);
822 emotion_object_audio_volume_set(Evas_Object *obj, double vol)
826 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
828 if (!sd->module) return;
829 if (!sd->video) return;
830 sd->module->audio_channel_volume_set(sd->video, vol);
834 emotion_object_audio_volume_get(const Evas_Object *obj)
838 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
839 if (!sd->module) return 0.0;
840 if (!sd->video) return 0.0;
841 return sd->module->audio_channel_volume_get(sd->video);
845 emotion_object_audio_mute_set(Evas_Object *obj, Eina_Bool mute)
849 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
850 DBG("mute=%hhu", mute);
851 if (!sd->module) return;
852 if (!sd->video) return;
853 sd->module->audio_channel_mute_set(sd->video, mute);
857 emotion_object_audio_mute_get(const Evas_Object *obj)
861 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
862 if (!sd->module) return EINA_FALSE;
863 if (!sd->video) return EINA_FALSE;
864 return sd->module->audio_channel_mute_get(sd->video);
868 emotion_object_audio_channel_count(const Evas_Object *obj)
872 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
873 if (!sd->module) return 0;
874 if (!sd->video) return 0;
875 return sd->module->audio_channel_count(sd->video);
879 emotion_object_audio_channel_name_get(const Evas_Object *obj, int channel)
883 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
884 if (!sd->module) return NULL;
885 if (!sd->video) return NULL;
886 return sd->module->audio_channel_name_get(sd->video, channel);
890 emotion_object_audio_channel_set(Evas_Object *obj, int channel)
894 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
895 DBG("channel=%d", channel);
896 if (!sd->module) return;
897 if (!sd->video) return;
898 sd->module->audio_channel_set(sd->video, channel);
902 emotion_object_audio_channel_get(const Evas_Object *obj)
906 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
907 if (!sd->module) return 0;
908 if (!sd->video) return 0;
909 return sd->module->audio_channel_get(sd->video);
913 emotion_object_video_mute_set(Evas_Object *obj, Eina_Bool mute)
917 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
918 DBG("mute=%hhu", mute);
919 if (!sd->module) return;
920 if (!sd->video) return;
921 sd->module->video_channel_mute_set(sd->video, mute);
925 emotion_object_video_mute_get(const Evas_Object *obj)
929 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
930 if (!sd->module) return EINA_FALSE;
931 if (!sd->video) return EINA_FALSE;
932 return sd->module->video_channel_mute_get(sd->video);
936 emotion_object_video_channel_count(const Evas_Object *obj)
940 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
941 if (!sd->module) return EINA_FALSE;
942 if (!sd->video) return EINA_FALSE;
943 return sd->module->video_channel_count(sd->video);
947 emotion_object_video_channel_name_get(const Evas_Object *obj, int channel)
951 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
952 if (!sd->module) return NULL;
953 if (!sd->video) return NULL;
954 return sd->module->video_channel_name_get(sd->video, channel);
958 emotion_object_video_channel_set(Evas_Object *obj, int channel)
962 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
963 DBG("channel=%d", channel);
964 if (!sd->module) return;
965 if (!sd->video) return;
966 sd->module->video_channel_set(sd->video, channel);
970 emotion_object_video_channel_get(const Evas_Object *obj)
974 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
975 if (!sd->module) return 0;
976 if (!sd->video) return 0;
977 return sd->module->video_channel_get(sd->video);
981 emotion_object_spu_mute_set(Evas_Object *obj, Eina_Bool mute)
985 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
986 DBG("mute=%hhu", mute);
987 if (!sd->module) return;
988 if (!sd->video) return;
989 sd->module->spu_channel_mute_set(sd->video, mute);
993 emotion_object_spu_mute_get(const Evas_Object *obj)
997 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
998 if (!sd->module) return EINA_FALSE;
999 if (!sd->video) return EINA_FALSE;
1000 return sd->module->spu_channel_mute_get(sd->video);
1004 emotion_object_spu_channel_count(const Evas_Object *obj)
1008 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1009 if (!sd->module) return 0;
1010 if (!sd->video) return 0;
1011 return sd->module->spu_channel_count(sd->video);
1015 emotion_object_spu_channel_name_get(const Evas_Object *obj, int channel)
1019 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1020 if (!sd->module) return NULL;
1021 if (!sd->video) return NULL;
1022 return sd->module->spu_channel_name_get(sd->video, channel);
1026 emotion_object_spu_channel_set(Evas_Object *obj, int channel)
1030 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1031 DBG("channel=%d", channel);
1032 if (!sd->module) return;
1033 if (!sd->video) return;
1034 sd->module->spu_channel_set(sd->video, channel);
1038 emotion_object_spu_channel_get(const Evas_Object *obj)
1042 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1043 if (!sd->module) return 0;
1044 if (!sd->video) return 0;
1045 return sd->module->spu_channel_get(sd->video);
1049 emotion_object_chapter_count(const Evas_Object *obj)
1053 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1054 if (!sd->module) return 0;
1055 if (!sd->video) return 0;
1056 return sd->module->chapter_count(sd->video);
1060 emotion_object_chapter_set(Evas_Object *obj, int chapter)
1064 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1065 DBG("chapter=%d", chapter);
1066 if (!sd->module) return;
1067 if (!sd->video) return;
1068 sd->module->chapter_set(sd->video, chapter);
1072 emotion_object_chapter_get(const Evas_Object *obj)
1076 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1077 if (!sd->module) return 0;
1078 if (!sd->video) return 0;
1079 return sd->module->chapter_get(sd->video);
1083 emotion_object_chapter_name_get(const Evas_Object *obj, int chapter)
1087 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1088 if (!sd->module) return NULL;
1089 if (!sd->video) return NULL;
1090 return sd->module->chapter_name_get(sd->video, chapter);
1094 emotion_object_play_speed_set(Evas_Object *obj, double speed)
1098 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1099 DBG("speed=%f", speed);
1100 if (!sd->module) return;
1101 if (!sd->video) return;
1102 sd->module->speed_set(sd->video, speed);
1106 emotion_object_play_speed_get(const Evas_Object *obj)
1110 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
1111 if (!sd->module) return 0.0;
1112 if (!sd->video) return 0.0;
1113 return sd->module->speed_get(sd->video);
1117 emotion_object_eject(Evas_Object *obj)
1121 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1122 if (!sd->module) return;
1123 if (!sd->video) return;
1124 sd->module->eject(sd->video);
1128 emotion_object_title_get(const Evas_Object *obj)
1132 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1137 emotion_object_progress_info_get(const Evas_Object *obj)
1141 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1142 return sd->progress.info;
1146 emotion_object_progress_status_get(const Evas_Object *obj)
1150 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
1151 return sd->progress.stat;
1155 emotion_object_ref_file_get(const Evas_Object *obj)
1159 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1160 return sd->ref.file;
1164 emotion_object_ref_num_get(const Evas_Object *obj)
1168 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1173 emotion_object_spu_button_count_get(const Evas_Object *obj)
1177 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1178 return sd->spu.button_num;
1182 emotion_object_spu_button_get(const Evas_Object *obj)
1186 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1187 return sd->spu.button;
1191 emotion_object_meta_info_get(const Evas_Object *obj, Emotion_Meta_Info meta)
1195 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1196 if (!sd->module) return NULL;
1197 if (!sd->video) return NULL;
1200 case EMOTION_META_INFO_TRACK_TITLE:
1201 return sd->module->meta_get(sd->video, META_TRACK_TITLE);
1203 case EMOTION_META_INFO_TRACK_ARTIST:
1204 return sd->module->meta_get(sd->video, META_TRACK_ARTIST);
1206 case EMOTION_META_INFO_TRACK_ALBUM:
1207 return sd->module->meta_get(sd->video, META_TRACK_ALBUM);
1209 case EMOTION_META_INFO_TRACK_YEAR:
1210 return sd->module->meta_get(sd->video, META_TRACK_YEAR);
1212 case EMOTION_META_INFO_TRACK_GENRE:
1213 return sd->module->meta_get(sd->video, META_TRACK_GENRE);
1215 case EMOTION_META_INFO_TRACK_COMMENT:
1216 return sd->module->meta_get(sd->video, META_TRACK_COMMENT);
1218 case EMOTION_META_INFO_TRACK_DISC_ID:
1219 return sd->module->meta_get(sd->video, META_TRACK_DISCID);
1228 emotion_object_vis_set(Evas_Object *obj, Emotion_Vis visualization)
1232 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1233 DBG("visualization=%d", visualization);
1234 if (!sd->module) return;
1235 if (!sd->video) return;
1236 if (!sd->module->vis_set) return;
1237 sd->module->vis_set(sd->video, visualization);
1241 emotion_object_vis_get(const Evas_Object *obj)
1245 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_VIS_NONE);
1246 if (!sd->module) return EMOTION_VIS_NONE;
1247 if (!sd->video) return EMOTION_VIS_NONE;
1248 if (!sd->module->vis_get) return EMOTION_VIS_NONE;
1249 return sd->module->vis_get(sd->video);
1253 emotion_object_vis_supported(const Evas_Object *obj, Emotion_Vis visualization)
1257 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
1258 if (!sd->module) return EINA_FALSE;
1259 if (!sd->video) return EINA_FALSE;
1260 if (!sd->module->vis_supported) return EINA_FALSE;
1261 return sd->module->vis_supported(sd->video, visualization);
1266 _eio_load_xattr_cleanup(Smart_Data *sd, Eio_File *handler)
1268 if (handler == sd->load_xattr) sd->load_xattr = NULL;
1270 EINA_REFCOUNT_UNREF(sd)
1271 _smart_data_free(sd);
1275 _eio_load_xattr_done(void *data, Eio_File *handler, const char *xattr_data, unsigned int xattr_size)
1277 Smart_Data *sd = data;
1279 if (xattr_size < 128 && xattr_data[xattr_size - 1] == '\0')
1281 long long int m = 0;
1284 eina_convert_atod(xattr_data, xattr_size, &m, &e);
1285 emotion_object_position_set(evas_object_smart_parent_get(sd->obj), ldexp((double)m, e));
1288 _eio_load_xattr_cleanup(sd, handler);
1292 _eio_load_xattr_error(void *data, Eio_File *handler, int err __UNUSED__)
1294 Smart_Data *sd = data;
1296 _eio_load_xattr_cleanup(sd, handler);
1301 emotion_object_last_position_load(Evas_Object *obj)
1306 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1307 if (!sd->file) return ;
1309 if (!strncmp(sd->file, "file://", 7))
1311 else if (!strstr(sd->file, "://"))
1317 if (sd->load_xattr) return ;
1319 EINA_REFCOUNT_REF(sd);
1321 sd->load_xattr = eio_file_xattr_get(tmp,
1323 _eio_load_xattr_done,
1324 _eio_load_xattr_error,
1329 char double_to_string[128];
1331 long long int m = 0;
1334 sz = getxattr(tmp, "user.e.time_seek", double_to_string, 128);
1335 if (sz <= 0 || sz > 128 || double_to_string[sz] != '\0')
1338 eina_convert_atod(double_to_string, 128, &m, &e);
1339 emotion_object_position_set(obj, ldexp((double)m, e));
1347 _eio_save_xattr_done(void *data __UNUSED__, Eio_File *handler __UNUSED__)
1352 _eio_save_xattr_error(void *data __UNUSED__, Eio_File *handler __UNUSED__, int err __UNUSED__)
1358 emotion_object_last_position_save(Evas_Object *obj)
1362 char double_to_string[128];
1364 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1365 if (!sd->file) return ;
1367 if (!strncmp(sd->file, "file://", 7))
1369 else if (!strstr(sd->file, "://"))
1374 eina_convert_dtoa(emotion_object_position_get(obj), double_to_string);
1377 eio_file_xattr_set(tmp, "user.e.time_seek",
1378 double_to_string, strlen(double_to_string) + 1, 0,
1379 _eio_save_xattr_done, _eio_save_xattr_error, sd);
1382 setxattr(tmp, "user.e.time_seek", double_to_string, strlen(double_to_string), 0);
1388 emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state)
1392 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1395 case EMOTION_WAKEUP:
1396 /* Restore the rendering pipeline, offset and everything back to play again (this will be called automatically by play_set) */
1398 /* This destroy some part of the rendering pipeline */
1399 case EMOTION_DEEP_SLEEP:
1400 /* This destroy all the rendering pipeline and just keep the last rendered image (fullscreen) */
1401 case EMOTION_HIBERNATE:
1402 /* This destroy all the rendering pipeline and keep 1/4 of the last rendered image */
1410 EAPI Emotion_Suspend
1411 motion_object_suspend_get(Evas_Object *obj)
1415 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_WAKEUP);
1419 /*****************************/
1420 /* Utility calls for modules */
1421 /*****************************/
1424 _emotion_video_get(const Evas_Object *obj)
1428 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
1433 _emotion_frame_new(Evas_Object *obj)
1437 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1438 // printf("pix get set 1 %p\n", sd->obj);
1439 evas_object_image_pixels_dirty_set(sd->obj, 1);
1440 evas_object_smart_callback_call(obj, SIG_FRAME_DECODE, NULL);
1444 _emotion_video_pos_update(Evas_Object *obj, double pos, double len)
1447 int npos = 0, nlen = 0;
1449 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1450 if (pos != sd->pos) npos = 1;
1451 if (len != sd->len) nlen = 1;
1454 if (npos) evas_object_smart_callback_call(obj, SIG_POSITION_UPDATE, NULL);
1455 if (nlen) evas_object_smart_callback_call(obj, SIG_LENGTH_CHANGE, NULL);
1459 _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
1466 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1467 evas_object_image_size_get(sd->obj, &iw, &ih);
1468 if ((w != iw) || (h != ih))
1470 _emotion_image_data_zero(sd->obj);
1473 if (h > 0) tmp = (double)w / (double)h;
1475 if (ratio != tmp) tmp = ratio;
1476 if (tmp != sd->ratio)
1483 evas_object_size_hint_request_set(obj, w, h);
1484 evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
1485 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1486 _emotion_object_aspect_border_apply(obj, sd, w, h);
1491 _emotion_decode_stop(Evas_Object *obj)
1495 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1499 evas_object_smart_callback_call(obj, SIG_DECODE_STOP, NULL);
1504 _emotion_open_done(Evas_Object *obj)
1508 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1511 if (sd->remember_jump)
1512 emotion_object_position_set(obj, sd->remember_jump);
1513 if (sd->remember_play != sd->play)
1514 emotion_object_play_set(obj, sd->remember_play);
1515 evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL);
1519 _emotion_playback_started(Evas_Object *obj)
1521 evas_object_smart_callback_call(obj, SIG_PLAYBACK_STARTED, NULL);
1525 _emotion_playback_finished(Evas_Object *obj)
1527 evas_object_smart_callback_call(obj, SIG_PLAYBACK_FINISHED, NULL);
1531 _emotion_audio_level_change(Evas_Object *obj)
1533 evas_object_smart_callback_call(obj, SIG_AUDIO_LEVEL_CHANGE, NULL);
1537 _emotion_channels_change(Evas_Object *obj)
1541 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1542 evas_object_smart_callback_call(obj, SIG_CHANNELS_CHANGE, NULL);
1546 _emotion_title_set(Evas_Object *obj, char *title)
1550 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1552 sd->title = strdup(title);
1553 evas_object_smart_callback_call(obj, SIG_TITLE_CHANGE, NULL);
1557 _emotion_progress_set(Evas_Object *obj, char *info, double st)
1561 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1562 free(sd->progress.info);
1563 sd->progress.info = strdup(info);
1564 sd->progress.stat = st;
1565 evas_object_smart_callback_call(obj, SIG_PROGRESS_CHANGE, NULL);
1569 _emotion_file_ref_set(Evas_Object *obj, const char *file, int num)
1573 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1575 sd->ref.file = strdup(file);
1577 evas_object_smart_callback_call(obj, SIG_REF_CHANGE, NULL);
1581 _emotion_spu_button_num_set(Evas_Object *obj, int num)
1585 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1586 sd->spu.button_num = num;
1587 evas_object_smart_callback_call(obj, SIG_BUTTON_NUM_CHANGE, NULL);
1591 _emotion_spu_button_set(Evas_Object *obj, int button)
1595 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1596 sd->spu.button = button;
1597 evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL);
1601 _emotion_seek_done(Evas_Object *obj)
1605 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1609 if (sd->seek) emotion_object_position_set(obj, sd->seek_pos);
1615 /****************************/
1616 /* Internal object routines */
1617 /****************************/
1620 _mouse_move(void *data, Evas *ev __UNUSED__, Evas_Object *obj, void *event_info)
1622 Evas_Event_Mouse_Move *e;
1625 Evas_Coord ox, oy, ow, oh;
1629 if (!sd->module) return;
1630 if (!sd->video) return;
1631 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1632 evas_object_image_size_get(obj, &iw, &ih);
1633 if ((iw < 1) || (ih < 1)) return;
1634 x = (((int)e->cur.canvas.x - ox) * iw) / ow;
1635 y = (((int)e->cur.canvas.y - oy) * ih) / oh;
1636 sd->module->event_mouse_move_feed(sd->video, x, y);
1640 _mouse_down(void *data, Evas *ev __UNUSED__, Evas_Object *obj, void *event_info)
1642 Evas_Event_Mouse_Down *e;
1645 Evas_Coord ox, oy, ow, oh;
1649 if (!sd->module) return;
1650 if (!sd->video) return;
1651 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
1652 evas_object_image_size_get(obj, &iw, &ih);
1653 if ((iw < 1) || (ih < 1)) return;
1654 x = (((int)e->canvas.x - ox) * iw) / ow;
1655 y = (((int)e->canvas.y - oy) * ih) / oh;
1656 sd->module->event_mouse_button_feed(sd->video, 1, x, y);
1660 _pos_set_job(void *data)
1666 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1668 if (sd->seeking) return;
1672 sd->module->pos_set(sd->video, sd->seek_pos);
1677 /* called by evas when it needs pixels for the image object */
1679 _pixels_get(void *data, Evas_Object *obj)
1683 Emotion_Format format;
1684 unsigned char *bgra_data;
1687 sd->module->video_data_size_get(sd->video, &w, &h);
1691 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1692 evas_object_image_alpha_set(obj, 0);
1693 evas_object_image_size_set(obj, w, h);
1697 if ((iw <= 1) || (ih <= 1))
1699 _emotion_image_data_zero(sd->obj);
1700 evas_object_image_pixels_dirty_set(obj, 0);
1704 format = sd->module->format_get(sd->video);
1705 if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
1707 unsigned char **rows;
1709 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1710 rows = evas_object_image_data_get(obj, 1);
1713 if (sd->module->yuv_rows_get(sd->video, iw, ih,
1716 &rows[ih + (ih / 2)]))
1717 evas_object_image_data_update_add(obj, 0, 0, iw, ih);
1719 evas_object_image_data_set(obj, rows);
1720 evas_object_image_pixels_dirty_set(obj, 0);
1722 else if (format == EMOTION_FORMAT_BGRA)
1724 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_ARGB8888);
1725 if (sd->module->bgra_data_get(sd->video, &bgra_data))
1727 evas_object_image_data_set(obj, bgra_data);
1728 evas_object_image_pixels_dirty_set(obj, 0);
1734 /*******************************************/
1735 /* Internal smart object required routines */
1736 /*******************************************/
1737 #ifdef EMOTION_STATIC_BUILD_XINE
1738 Eina_Bool xine_module_init(void);
1740 #ifdef EMOTION_STATIC_BUILD_GSTREAMER
1741 Eina_Bool gstreamer_module_init(void);
1743 #ifdef EMOTION_STATIC_BUILD_GENERIC
1744 Eina_Bool generic_module_init(void);
1756 _log_domain = eina_log_domain_register("emotion", EINA_COLOR_LIGHTCYAN);
1757 if (_log_domain < 0)
1759 EINA_LOG_CRIT("Could not register log domain 'emotion'");
1764 _backends = eina_hash_string_small_new(free);
1766 _modules = eina_module_list_get(NULL, PACKAGE_LIB_DIR "/emotion/", 0, NULL, NULL);
1768 path = eina_module_environment_path_get("HOME", "/.emotion/");
1769 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1770 if (path) free(path);
1772 path = eina_module_environment_path_get("EMOTION_MODULES_DIR", "/emotion/");
1773 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1774 if (path) free(path);
1776 path = eina_module_symbol_path_get(emotion_object_add, "/emotion/");
1777 _modules = eina_module_list_get(_modules, path, 0, NULL, NULL);
1778 if (path) free(path);
1782 ERR("No module found!");
1786 eina_module_list_load(_modules);
1788 /* Init static module */
1789 #ifdef EMOTION_STATIC_BUILD_XINE
1792 #ifdef EMOTION_STATIC_BUILD_GSTREAMER
1793 gstreamer_module_init();
1795 #ifdef EMOTION_STATIC_BUILD_GENERIC
1796 generic_module_init();
1799 static Evas_Smart_Class sc =
1800 EVAS_SMART_CLASS_INIT_NAME_VERSION(E_OBJ_NAME);
1803 sc.add = _smart_add;
1804 sc.del = _smart_del;
1805 sc.move = _smart_move;
1806 sc.resize = _smart_resize;
1807 sc.show = _smart_show;
1808 sc.hide = _smart_hide;
1809 sc.color_set = _smart_color_set;
1810 sc.clip_set = _smart_clip_set;
1811 sc.clip_unset = _smart_clip_unset;
1812 sc.callbacks = _smart_callbacks;
1814 smart = evas_smart_class_new(&sc);
1819 _smart_add(Evas_Object * obj)
1822 unsigned int *pixel;
1824 sd = calloc(1, sizeof(Smart_Data));
1826 EINA_REFCOUNT_INIT(sd);
1827 sd->state = EMOTION_WAKEUP;
1828 sd->obj = evas_object_image_add(evas_object_evas_get(obj));
1829 sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj));
1830 evas_object_color_set(sd->bg, 0, 0, 0, 0);
1831 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd);
1832 evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd);
1833 evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd);
1834 evas_object_smart_member_add(sd->obj, obj);
1835 evas_object_smart_member_add(sd->bg, obj);
1836 evas_object_lower(sd->bg);
1838 sd->spu.button = -1;
1839 evas_object_image_alpha_set(sd->obj, 0);
1840 pixel = evas_object_image_data_get(sd->obj, 1);
1843 *pixel = 0xff000000;
1844 evas_object_image_data_set(obj, pixel);
1846 evas_object_smart_data_set(obj, sd);
1852 _smart_del(Evas_Object * obj)
1856 sd = evas_object_smart_data_get(obj);
1858 EINA_REFCOUNT_UNREF(sd)
1859 _smart_data_free(sd);
1863 _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
1867 sd = evas_object_smart_data_get(obj);
1870 int vid_w, vid_h, w, h;
1871 sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
1872 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1873 _clipper_position_size_update(obj, w, h, vid_w, vid_h);
1874 evas_object_move(sd->bg, x, y);
1878 _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
1882 sd = evas_object_smart_data_get(obj);
1887 sd->module->video_data_size_get(sd->video, &vid_w, &vid_h);
1888 _emotion_object_aspect_border_apply(obj, sd, w, h);
1889 evas_object_resize(sd->bg, w, h);
1893 _smart_show(Evas_Object * obj)
1898 sd = evas_object_smart_data_get(obj);
1900 evas_object_show(sd->obj);
1901 if (sd->crop.clipper)
1902 evas_object_show(sd->crop.clipper);
1904 evas_object_color_get(sd->bg, NULL, NULL, NULL, &a);
1906 evas_object_show(sd->bg);
1910 _smart_hide(Evas_Object * obj)
1914 sd = evas_object_smart_data_get(obj);
1916 evas_object_hide(sd->obj);
1917 if (sd->crop.clipper)
1918 evas_object_hide(sd->crop.clipper);
1919 evas_object_hide(sd->bg);
1923 _smart_color_set(Evas_Object * obj, int r, int g, int b, int a)
1927 sd = evas_object_smart_data_get(obj);
1929 evas_object_color_set(sd->obj, r, g, b, a);
1930 evas_object_color_set(sd->crop.clipper, r, g, b, a);
1934 _smart_clip_set(Evas_Object * obj, Evas_Object * clip)
1938 sd = evas_object_smart_data_get(obj);
1940 if (sd->crop.clipper)
1941 evas_object_clip_set(sd->crop.clipper, clip);
1943 evas_object_clip_set(sd->obj, clip);
1944 evas_object_clip_set(sd->bg, clip);
1948 _smart_clip_unset(Evas_Object * obj)
1952 sd = evas_object_smart_data_get(obj);
1954 if (sd->crop.clipper)
1955 evas_object_clip_unset(sd->crop.clipper);
1957 evas_object_clip_unset(sd->obj);
1958 evas_object_clip_unset(sd->bg);