diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-27 10:21:26 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-31 08:14:04 +0300 |
commit | 120bae7142ad9e43ce1abdff8dfbbb6153ada388 (patch) | |
tree | 9b33f7e1a3c749a722ae492c3a3557ac5f501521 | |
parent | 03f9812196bebd54bd3fd612f8c76cda7fe6cc06 (diff) | |
download | elementary-120bae7142ad9e43ce1abdff8dfbbb6153ada388.tar.gz |
Eolian: Integration of Video
-rw-r--r-- | src/lib/Makefile.am | 10 | ||||
-rw-r--r-- | src/lib/elm_video.c | 407 | ||||
-rw-r--r-- | src/lib/elm_video.eo | 219 | ||||
-rw-r--r-- | src/lib/elm_video_eo.h | 3 | ||||
-rw-r--r-- | src/lib/elm_widget_video.h | 6 |
5 files changed, 302 insertions, 343 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 554ccd67c..b4ccbc8fd 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -658,7 +658,9 @@ BUILT_SOURCES = \ elm_thumb.eo.c \ elm_thumb.eo.h \ elm_toolbar.eo.c \ - elm_toolbar.eo.h + elm_toolbar.eo.h \ + elm_video.eo.c \ + elm_video.eo.h EXTRA_DIST += \ elm_widget.eo \ @@ -727,7 +729,8 @@ EXTRA_DIST += \ elm_systray.eo \ elm_table.eo \ elm_thumb.eo \ - elm_toolbar.eo + elm_toolbar.eo \ + elm_video.eo nodist_includesunstable_HEADERS = \ elm_widget.eo.h \ @@ -796,5 +799,6 @@ nodist_includesunstable_HEADERS = \ elm_systray.eo.h \ elm_table.eo.h \ elm_thumb.eo.h \ - elm_toolbar.eo.h + elm_toolbar.eo.h \ + elm_video.eo.h diff --git a/src/lib/elm_video.c b/src/lib/elm_video.c index d0cf94a26..17e0cfc6c 100644 --- a/src/lib/elm_video.c +++ b/src/lib/elm_video.c @@ -13,8 +13,6 @@ /* TODO: add buffering support to Emotion and display buffering * progress in the theme when needed */ -EAPI Eo_Op ELM_OBJ_VIDEO_BASE_ID = EO_NOOP; - #define MY_CLASS ELM_OBJ_VIDEO_CLASS #define MY_CLASS_NAME "Elm_Video" @@ -26,20 +24,15 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; -static void -_elm_video_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_video_elm_widget_event(Eo *obj, Elm_Video_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info) { - Evas_Object *src = va_arg(*list, Evas_Object *); - Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type); - Evas_Event_Key_Down *ev = va_arg(*list, void *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - - if (ret) *ret = EINA_FALSE; (void) src; + Evas_Event_Key_Down *ev = event_info; - if (elm_widget_disabled_get(obj)) return; - if (type != EVAS_CALLBACK_KEY_DOWN) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; if ((!strcmp(ev->key, "Left")) || ((!strcmp(ev->key, "KP_Left")) && (!ev->string))) @@ -85,17 +78,16 @@ _elm_video_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list) } INF("keyname: '%s' not handled", ev->key); - return; + return EINA_FALSE; success: ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_video_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_elm_layout_sizing_eval(Eo *obj, Elm_Video_Data *sd) { - Elm_Video_Smart_Data *sd = _pd; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); Evas_Coord minw = -1, minh = -1; @@ -211,11 +203,9 @@ _elm_video_check(Evas_Object *video) return EINA_TRUE; } -static void -_elm_video_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_evas_smart_add(Eo *obj, Elm_Video_Data *priv) { - Elm_Video_Smart_Data *priv = _pd; - _elm_emotion_init(); eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); @@ -249,11 +239,9 @@ _elm_video_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) priv->timer = ecore_timer_add(20.0, _suspend_cb, obj); } -static void -_elm_video_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_evas_smart_del(Eo *obj, Elm_Video_Data *sd) { - Elm_Video_Smart_Data *sd = _pd; - ecore_timer_del(sd->timer); if (sd->remember) emotion_object_last_position_save(sd->emotion); @@ -269,8 +257,8 @@ elm_video_add(Evas_Object *parent) return obj; } -static void -_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_eo_base_constructor(Eo *obj, Elm_Video_Data *_pd EINA_UNUSED) { eo_do_super(obj, MY_CLASS, eo_constructor()); eo_do(obj, @@ -278,66 +266,30 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL)); } -EAPI Eina_Bool -elm_video_file_set(Evas_Object *obj, - const char *filename) +EOLIAN static Eina_Bool +_elm_video_file_set(Eo *obj, Elm_Video_Data *sd, const char *filename) { - ELM_VIDEO_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do(obj, elm_obj_video_file_set(filename, &ret)); - return ret; -} - -static void -_file_set(Eo *obj, void *_pd, va_list *list) -{ - const char *filename = va_arg(*list, const char *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_FALSE; - Elm_Video_Smart_Data *sd = _pd; - if (sd->remember) emotion_object_last_position_save(sd->emotion); sd->stop = EINA_FALSE; - if (!emotion_object_file_set(sd->emotion, filename)) return; + if (!emotion_object_file_set(sd->emotion, filename)) return EINA_FALSE; if (filename && ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://")))) emotion_object_last_position_load(sd->emotion); elm_layout_signal_emit(obj, "elm,video,load", "elm"); - if (ret) *ret = EINA_TRUE; -} - -EAPI Evas_Object * -elm_video_emotion_get(const Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj) NULL; - Evas_Object *ret = NULL; - eo_do((Eo *) obj, elm_obj_video_emotion_get(&ret)); - return ret; -} - -static void -_emotion_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Evas_Object **ret = va_arg(*list, Evas_Object **); - *ret = NULL; - Elm_Video_Smart_Data *sd = _pd; - *ret = sd->emotion; + return EINA_TRUE; } -EAPI void -elm_video_play(Evas_Object *obj) +EOLIAN static Evas_Object* +_elm_video_emotion_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_play()); + return sd->emotion; } -static void -_play(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_play(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - Elm_Video_Smart_Data *sd = _pd; - if (emotion_object_play_get(sd->emotion)) return; ELM_SAFE_FREE(sd->timer, ecore_timer_del); @@ -349,18 +301,9 @@ _play(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED) /* FIXME: pause will setup timer and go into sleep or * hibernate after a while without activity. */ -EAPI void -elm_video_pause(Evas_Object *obj) +EOLIAN static void +_elm_video_pause(Eo *obj, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_pause()); -} - -static void -_pause(Eo *obj, void *_pd, va_list *list EINA_UNUSED) -{ - Elm_Video_Smart_Data *sd = _pd; - if (!emotion_object_play_get(sd->emotion)) return; if (!sd->timer) sd->timer = ecore_timer_add(20.0, _suspend_cb, obj); @@ -370,18 +313,9 @@ _pause(Eo *obj, void *_pd, va_list *list EINA_UNUSED) /* FIXME: stop should go into hibernate state directly. */ -EAPI void -elm_video_stop(Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_stop()); -} - -static void -_stop(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_video_stop(Eo *obj, Elm_Video_Data *sd) { - Elm_Video_Smart_Data *sd = _pd; - if (!emotion_object_play_get(sd->emotion) && sd->stop) return; ELM_SAFE_FREE(sd->timer, ecore_timer_del); @@ -392,293 +326,94 @@ _stop(Eo *obj, void *_pd, va_list *list EINA_UNUSED) emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE); } -EAPI Eina_Bool -elm_video_is_playing_get(const Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do((Eo *) obj, elm_obj_video_is_playing_get(&ret)); - return ret; -} - -static void -_is_playing_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_FALSE; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_play_get(sd->emotion); -} - -EAPI Eina_Bool -elm_video_is_seekable_get(const Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do((Eo *) obj, elm_obj_video_is_seekable_get(&ret)); - return ret; -} - -static void -_is_seekable_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_seekable_get(sd->emotion); -} - -EAPI Eina_Bool -elm_video_audio_mute_get(const Evas_Object *obj) +EOLIAN static Eina_Bool +_elm_video_is_playing_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do((Eo *) obj, elm_obj_video_audio_mute_get(&ret)); - return ret; + return emotion_object_play_get(sd->emotion); } -static void -_audio_mute_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elm_video_is_seekable_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_FALSE; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_audio_mute_get(sd->emotion); + return emotion_object_seekable_get(sd->emotion); } -EAPI void -elm_video_audio_mute_set(Evas_Object *obj, - Eina_Bool mute) +EOLIAN static Eina_Bool +_elm_video_audio_mute_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_audio_mute_set(mute)); + return emotion_object_audio_mute_get(sd->emotion); } -static void -_audio_mute_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elm_video_audio_mute_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, Eina_Bool mute) { - Eina_Bool mute = va_arg(*list, int); - Elm_Video_Smart_Data *sd = _pd; emotion_object_audio_mute_set(sd->emotion, mute); } -EAPI double -elm_video_audio_level_get(const Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj) 0.0; - double ret = 0.0; - eo_do((Eo *) obj, elm_obj_video_audio_level_get(&ret)); - return ret; -} - -static void -_audio_level_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static double +_elm_video_audio_level_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - double *ret = va_arg(*list, double *); - *ret = 0.0; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_audio_volume_get(sd->emotion); + return emotion_object_audio_volume_get(sd->emotion); } -EAPI void -elm_video_audio_level_set(Evas_Object *obj, - double volume) +EOLIAN static void +_elm_video_audio_level_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, double volume) { - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_audio_level_set(volume)); -} - -static void -_audio_level_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - double volume = va_arg(*list, double); - Elm_Video_Smart_Data *sd = _pd; emotion_object_audio_volume_set(sd->emotion, volume); } -EAPI double -elm_video_play_position_get(const Evas_Object *obj) +EOLIAN static double +_elm_video_play_position_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj) 0.0; - double ret = 0.0; - eo_do((Eo *) obj, elm_obj_video_play_position_get(&ret)); - return ret; + return emotion_object_position_get(sd->emotion); } -static void -_play_position_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - double *ret = va_arg(*list, double *); - *ret = 0.0; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_position_get(sd->emotion); -} - -EAPI void -elm_video_play_position_set(Evas_Object *obj, - double position) -{ - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_play_position_set(position)); -} - -static void -_play_position_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elm_video_play_position_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, double position) { - double position = va_arg(*list, double); - Elm_Video_Smart_Data *sd = _pd; emotion_object_position_set(sd->emotion, position); } -EAPI double -elm_video_play_length_get(const Evas_Object *obj) +EOLIAN static double +_elm_video_play_length_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj) 0.0; - double ret = 0.0; - eo_do((Eo *) obj, elm_obj_video_play_length_get(&ret)); - return ret; + return emotion_object_play_length_get(sd->emotion); } -static void -_play_length_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - double *ret = va_arg(*list, double *); - *ret = 0.0; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_play_length_get(sd->emotion); -} - -EAPI const char * -elm_video_title_get(const Evas_Object *obj) -{ - ELM_VIDEO_CHECK(obj) NULL; - const char *ret = NULL; - eo_do((Eo *) obj, elm_obj_video_title_get(&ret)); - return ret; -} - -static void -_title_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - const char **ret = va_arg(*list, const char **); - *ret = NULL; - Elm_Video_Smart_Data *sd = _pd; - *ret = emotion_object_title_get(sd->emotion); -} - -EAPI void -elm_video_remember_position_set(Evas_Object *obj, - Eina_Bool remember) +EOLIAN static const char* +_elm_video_title_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj); - eo_do(obj, elm_obj_video_remember_position_set(remember)); + return emotion_object_title_get(sd->emotion); } -static void -_remember_position_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elm_video_remember_position_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, Eina_Bool remember) { - Eina_Bool remember = va_arg(*list, int); - Elm_Video_Smart_Data *sd = _pd; sd->remember = remember; } -EAPI Eina_Bool -elm_video_remember_position_get(const Evas_Object *obj) +EOLIAN static Eina_Bool +_elm_video_remember_position_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd) { - ELM_VIDEO_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do((Eo *) obj, elm_obj_video_remember_position_get(&ret)); - return ret; + return sd->remember; } -static void -_remember_position_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elm_video_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Video_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_FALSE; - Elm_Video_Smart_Data *sd = _pd; - *ret = sd->remember; + return EINA_FALSE; } -static void -_elm_video_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_video_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Video_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_FALSE; + return EINA_FALSE; } -static void -_elm_video_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_elm_video_class_constructor(Eo_Class *klass) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_FALSE; -} - -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), - - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_video_smart_add), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_video_smart_del), - - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_EVENT), _elm_video_smart_event), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_video_smart_focus_next_manager_is), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_video_smart_focus_direction_manager_is), - - EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_video_smart_sizing_eval), - - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_FILE_SET), _file_set), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_EMOTION_GET), _emotion_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_PLAY), _play), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_PAUSE), _pause), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_STOP), _stop), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_IS_PLAYING_GET), _is_playing_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_IS_SEEKABLE_GET), _is_seekable_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_AUDIO_MUTE_GET), _audio_mute_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_AUDIO_MUTE_SET), _audio_mute_set), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_AUDIO_LEVEL_GET), _audio_level_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_AUDIO_LEVEL_SET), _audio_level_set), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_PLAY_POSITION_GET), _play_position_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_PLAY_POSITION_SET), _play_position_set), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_PLAY_LENGTH_GET), _play_length_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_TITLE_GET), _title_get), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_REMEMBER_POSITION_SET), _remember_position_set), - EO_OP_FUNC(ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_REMEMBER_POSITION_GET), _remember_position_get), - EO_OP_FUNC_SENTINEL - }; - eo_class_funcs_set(klass, func_desc); - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_FILE_SET, "Define the file or URI that will be the video source."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_EMOTION_GET, "Get the underlying Emotion object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_PLAY, "Start to play the video."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_PAUSE, "Pause the video."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_STOP, "Stop the video."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_IS_PLAYING_GET, "Is the video actually playing."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_IS_SEEKABLE_GET, "Is it possible to seek inside the video."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_AUDIO_MUTE_GET, "Is the audio muted."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_AUDIO_MUTE_SET, "Change the mute state of the Elm_Video object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_AUDIO_LEVEL_GET, "Get the audio level of the current video ."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_AUDIO_LEVEL_SET, "Set the audio level of an Elm_Video object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_PLAY_POSITION_GET, "Get the current position (in seconds) being played in the Elm_Video object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_PLAY_POSITION_SET, "Set the current position (in seconds) to be played in the Elm_Video object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_PLAY_LENGTH_GET, "Get the total playing time (in seconds) of the Elm_Video object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_TITLE_GET, "Get the title (for instance DVD title) from this emotion object."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_REMEMBER_POSITION_SET, "Set whether the object can remember the last played position."), - EO_OP_DESCRIPTION(ELM_OBJ_VIDEO_SUB_ID_REMEMBER_POSITION_GET, "Set whether the object can remember the last played position."), - EO_OP_DESCRIPTION_SENTINEL -}; -static const Eo_Class_Description class_desc = { - EO_VERSION, - MY_CLASS_NAME, - EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_VIDEO_BASE_ID, op_desc, ELM_OBJ_VIDEO_SUB_ID_LAST), - NULL, - sizeof(Elm_Video_Smart_Data), - _class_constructor, - NULL -}; -EO_DEFINE_CLASS(elm_obj_video_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL); + +#include "elm_video.eo.c" diff --git a/src/lib/elm_video.eo b/src/lib/elm_video.eo new file mode 100644 index 000000000..4d3862684 --- /dev/null +++ b/src/lib/elm_video.eo @@ -0,0 +1,219 @@ +class Elm_Video (Elm_Layout) +{ + eo_prefix: elm_obj_video; + properties { + audio_level { + set { + /*@ + @brief Set the audio level of an Elm_Video object. + + @ingroup Video */ + } + get { + /*@ + @brief Get the audio level of the current video. + + @return the current audio level. + + @ingroup Video */ + } + values { + double volume; /*@ The new audio volume. */ + } + } + remember_position { + set { + /*@ + @brief Set whether the object can remember the last played position. + + @note This API only serves as indication. System support is required. + + @ingroup Video */ + } + get { + /*@ + @brief Set whether the object can remember the last played position. + + @return whether the object remembers the last played position (@c EINA_TRUE) + or not. + + @note This API only serves as indication. System support is required. + + @ingroup Video */ + } + values { + Eina_Bool remember; /*@ the last played position of the Elm_Video object. */ + } + } + play_position { + set { + /*@ + @brief Set the current position (in seconds) to be played in the + Elm_Video object. + + @ingroup Video */ + } + get { + /*@ + @brief Get the current position (in seconds) being played in the + Elm_Video object. + + @return The time (in seconds) since the beginning of the media file. + + @ingroup Video */ + } + values { + double position; /*@ The time (in seconds) since the beginning of the media file. */ + } + } + audio_mute { + set { + /*@ + @brief Change the mute state of the Elm_Video object. + + @ingroup Video */ + } + get { + /*@ + @brief Is the audio muted. + + @return @c EINA_TRUE if the audio is muted. + + @ingroup Video */ + } + values { + Eina_Bool mute; /*@ The new mute state. */ + } + } + file { + set { + /*@ + @brief Define the file or URI that will be the video source. + + @return @c EINA_TRUE on success, @c EINA_FALSE otherwise + + This function will explicitly define a file or URI as a source + for the video of the Elm_Video object. + + @see elm_video_add() + @see elm_player_add() + + @ingroup Video */ + return Eina_Bool; + } + values { + const char *filename; /*@ The file or URI to target. + Local files can be specified using file:// or by using full file paths. + URI could be remote source of video, like http:// or local source like + WebCam (v4l2://). (You can use Emotion API to request and list + the available Webcam on your system). */ + } + } + is_playing { + get { + /*@ + @brief Is the video actually playing. + + @return @c EINA_TRUE if the video is actually playing. + + You should consider watching event on the object instead of polling + the object state. + + @ingroup Video */ + return Eina_Bool; + } + } + play_length { + get { + /*@ + @brief Get the total playing time (in seconds) of the Elm_Video object. + + @return The total duration (in seconds) of the media file. + + @ingroup Video */ + return double; + } + } + emotion { + get { + /*@ + @brief Get the underlying Emotion object. + + @return the underlying Emotion object. + + @ingroup Video */ + return Evas_Object *; + } + } + is_seekable { + get { + /*@ + @brief Is it possible to seek inside the video. + + @return @c EINA_TRUE if is possible to seek inside the video. + + @ingroup Video */ + return Eina_Bool; + } + } + title { + get { + /*@ + @brief Get the title (for instance DVD title) from this emotion object. + + @return A string containing the title. + + This function is only useful when playing a DVD. + + @note Don't change or free the string returned by this function. + + @ingroup Video */ + return const char *; + } + } + } + methods { + play { + /*@ + @brief Start to play the video + + Start to play the video and cancel all suspend state. + + @ingroup Video */ + + } + pause { + /*@ + @brief Pause the video + + Pause the video and start a timer to trigger suspend mode. + + @ingroup Video */ + + } + stop { + /*@ + @brief Stop the video + + Stop the video and put the emotion in deep sleep mode. + + @ingroup Video */ + + } + } + implements { + class::constructor; + Eo_Base::constructor; + Evas_Smart::add; + Evas_Smart::del; + Elm_Widget::focus_next_manager_is; + Elm_Widget::focus_direction_manager_is; + Elm_Widget::event; + Elm_Layout::sizing_eval; + } + events { + focused; + unfocused; + } + +} diff --git a/src/lib/elm_video_eo.h b/src/lib/elm_video_eo.h index 97658dbda..a7583e3f0 100644 --- a/src/lib/elm_video_eo.h +++ b/src/lib/elm_video_eo.h @@ -1,4 +1,5 @@ #include "elc_player.eo.h" +#include "elm_video.eo.h" #if 0 #define ELM_OBJ_PLAYER_CLASS elm_obj_player_class_get() @@ -12,7 +13,6 @@ enum }; #define ELM_OBJ_PLAYER_ID(sub_id) (ELM_OBJ_PLAYER_BASE_ID + sub_id) -#endif /** * ELM_OBJ_VIDEO_CLASS @@ -285,3 +285,4 @@ enum * @ingroup Video */ #define elm_obj_video_remember_position_get(ret) ELM_OBJ_VIDEO_ID(ELM_OBJ_VIDEO_SUB_ID_REMEMBER_POSITION_GET), EO_TYPECHECK(Eina_Bool *, ret) +#endif diff --git a/src/lib/elm_widget_video.h b/src/lib/elm_widget_video.h index c26d18fbb..66deb876a 100644 --- a/src/lib/elm_widget_video.h +++ b/src/lib/elm_widget_video.h @@ -17,8 +17,8 @@ /** * Base layout smart data extended with video instance data. */ -typedef struct _Elm_Video_Smart_Data Elm_Video_Smart_Data; -struct _Elm_Video_Smart_Data +typedef struct _Elm_Video_Data Elm_Video_Data; +struct _Elm_Video_Data { Evas_Object *emotion; Ecore_Timer *timer; @@ -32,7 +32,7 @@ struct _Elm_Video_Smart_Data */ #define ELM_VIDEO_DATA_GET(o, sd) \ - Elm_Video_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_VIDEO_CLASS) + Elm_Video_Data * sd = eo_data_scope_get(o, ELM_OBJ_VIDEO_CLASS) #define ELM_VIDEO_DATA_GET_OR_RETURN(o, ptr) \ ELM_VIDEO_DATA_GET(o, ptr); \ |