From 8578459813359aa760fae80ae4dafed3035b1fd8 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 1 Jul 2011 08:57:54 +0000 Subject: [PATCH] emotion: add empty infrastructure for suspending the pipeline. SVN revision: 60909 --- legacy/emotion/src/lib/Emotion.h | 13 ++++- legacy/emotion/src/lib/emotion_smart.c | 66 ++++++++++++++++++++------ 2 files changed, 64 insertions(+), 15 deletions(-) diff --git a/legacy/emotion/src/lib/Emotion.h b/legacy/emotion/src/lib/Emotion.h index 742cefe1cb..83c68a4c4e 100644 --- a/legacy/emotion/src/lib/Emotion.h +++ b/legacy/emotion/src/lib/Emotion.h @@ -109,6 +109,14 @@ enum _Emotion_Vis EMOTION_VIS_LAST /* sentinel */ }; +typedef enum +{ + EMOTION_WAKEUP, + EMOTION_SLEEP, + EMOTION_DEEP_SLEEP, + EMOTION_HIBERNATE +} Emotion_Suspend; + typedef enum _Emotion_Module Emotion_Module; typedef enum _Emotion_Event Emotion_Event; typedef enum _Emotion_Meta_Info Emotion_Meta_Info; @@ -120,7 +128,7 @@ typedef enum _Emotion_Vis Emotion_Vis; #ifdef __cplusplus extern "C" { #endif - + /* api calls available */ /** @@ -501,6 +509,9 @@ EAPI Eina_Bool emotion_object_vis_supported (const Evas_Object *obj, EAPI void emotion_object_last_position_load (Evas_Object *obj); EAPI void emotion_object_last_position_save (Evas_Object *obj); +EAPI void emotion_object_suspend_set (Evas_Object *obj, Emotion_Suspend state); +EAPI Emotion_Suspend emotion_object_suspend_get (Evas_Object *obj); + EAPI Eina_Bool emotion_object_extension_can_play_get(const Evas_Object *obj, const char *file); EAPI Eina_Bool emotion_object_extension_can_play_fast_get(const Evas_Object *obj, const char *file); diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index a4a2fb9ea9..648c0116af 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c @@ -55,18 +55,18 @@ struct _Smart_Data const char *file; Evas_Object *obj; - double ratio; - double pos; - double seek_pos; - double len; Ecore_Job *job; - unsigned char play : 1; - unsigned char seek : 1; - unsigned char seeking : 1; - char *title; + +#ifdef HAVE_EIO + Eio_File *load_xattr; + Eio_File *save_xattr; + + const char *time_seek; +#endif + struct { char *info; double stat; @@ -80,14 +80,18 @@ struct _Smart_Data int button; } spu; -#ifdef HAVE_EIO - Eio_File *load_xattr; - Eio_File *save_xattr; - - const char *time_seek; -#endif + double ratio; + double pos; + double seek_pos; + double len; Emotion_Module_Options module_options; + + Emotion_Suspend state; + + Eina_Bool play : 1; + Eina_Bool seek : 1; + Eina_Bool seeking : 1; }; static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info); @@ -424,6 +428,7 @@ emotion_object_play_set(Evas_Object *obj, Eina_Bool play) if (!sd->module) return; if (!sd->video) return; sd->play = play; + if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); if (sd->play) sd->module->play(sd->video, sd->pos); else sd->module->stop(sd->video); } @@ -1214,6 +1219,38 @@ emotion_object_extension_may_play_get(const char *file) return result; } +EAPI void +emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state) +{ + Smart_Data *sd; + + E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); + switch (state) + { + case EMOTION_WAKEUP: + /* Restore the rendering pipeline, offset and everything back to play again (this will be called automatically by play_set) */ + case EMOTION_SLEEP: + /* This destroy some part of the rendering pipeline */ + case EMOTION_DEEP_SLEEP: + /* This destroy all the rendering pipeline and just keep the last rendered image (fullscreen) */ + case EMOTION_HIBERNATE: + /* This destroy all the rendering pipeline and keep 1/4 of the last rendered image */ + default: + break; + } + + sd->state = state; +} + +EAPI Emotion_Suspend +motion_object_suspend_get(Evas_Object *obj) +{ + Smart_Data *sd; + + E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_WAKEUP); + return sd->state; +} + /*****************************/ /* Utility calls for modules */ /*****************************/ @@ -1748,6 +1785,7 @@ _smart_add(Evas_Object * obj) sd = calloc(1, sizeof(Smart_Data)); if (!sd) return; EINA_REFCOUNT_INIT(sd); + sd->state = EMOTION_WAKEUP; sd->obj = evas_object_image_add(evas_object_evas_get(obj)); evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd); evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd);