From e717b71589e920329d43444da0b650d0c59b6d48 Mon Sep 17 00:00:00 2001 From: Wonguk Jeong Date: Thu, 24 Apr 2014 18:10:28 +0900 Subject: [PATCH] terminology: restore movie play state when the media block is reactivated. Summary: first phase to resolve T1075 With D786, the paused video would be in paused state even if the media block is reactivated. But the problem is.... every backend except "gstreamer1" doesn't show any image on screen when the video is loaded in paused state. (it's working perfectly with gstreamer1) maybe the root cause is that frame decoding is never happened yet. This need to be investigated, in the next phase (maybe in emotion or emotion modules?) @fix Test Plan: terminology -> tycat -> pause video -> page down enought until the video block is deactivated -> page up -> check whether the video is in paused state or not Reviewers: raster, billiob CC: seoz Maniphest Tasks: T1075 Differential Revision: https://phab.enlightenment.org/D787 --- src/bin/media.c | 11 ++++++++++- src/bin/media.h | 1 + src/bin/termio.c | 25 +++++++++++++++---------- src/bin/termpty.h | 2 ++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/bin/media.c b/src/bin/media.c index c8da116f..ae28bd32 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -716,6 +716,8 @@ _type_mov_init(Evas_Object *obj) if (((sd->mode & MEDIA_OPTIONS_MASK) & MEDIA_RECOVER) && (sd->type == TYPE_MOV) && (sd->o_img)) emotion_object_last_position_load(sd->o_img); + else + media_position_set(obj, 0.0); evas_object_smart_member_add(o, obj); evas_object_clip_set(o, sd->clip); evas_object_raise(sd->o_event); @@ -742,7 +744,6 @@ _type_mov_init(Evas_Object *obj) * */ evas_object_show(o); - media_position_set(obj, 0.0); media_play_set(obj, EINA_TRUE); if (sd->config->mute) media_mute_set(obj, EINA_TRUE); } @@ -1264,6 +1265,14 @@ media_play_set(Evas_Object *obj, Eina_Bool play) edje_object_signal_emit(sd->o_ctrl, "pause,set", "terminology"); } +Eina_Bool +media_play_get(Evas_Object *obj) +{ + Media *sd = evas_object_smart_data_get(obj); + if ((!sd) || (sd->type != TYPE_MOV)) return EINA_FALSE; + return emotion_object_play_get(sd->o_img); +} + void media_stop(Evas_Object *obj) { diff --git a/src/bin/media.h b/src/bin/media.h index 5ecb0710..deb4f239 100644 --- a/src/bin/media.h +++ b/src/bin/media.h @@ -25,6 +25,7 @@ Evas_Object *media_add(Evas_Object *parent, const char *src, const Config *config, int mode, int *type); void media_mute_set(Evas_Object *obj, Eina_Bool mute); void media_play_set(Evas_Object *obj, Eina_Bool play); +Eina_Bool media_play_get(Evas_Object *obj); void media_position_set(Evas_Object *obj, double pos); void media_volume_set(Evas_Object *obj, double vol); void media_stop(Evas_Object *obj); diff --git a/src/bin/termio.c b/src/bin/termio.c index 1c31424a..41e3e2c8 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -1273,6 +1273,7 @@ _block_media_activate(Evas_Object *obj, Termblock *blk) if (!blk->was_active_before) media |= MEDIA_SAVE; else media |= MEDIA_RECOVER | MEDIA_SAVE; blk->obj = media_add(obj, blk->path, sd->config, media, &type); + if (type == TYPE_MOV) media_play_set(blk->obj, !blk->mov_paused); evas_object_event_callback_add (blk->obj, EVAS_CALLBACK_DEL, _smart_media_del, blk); blk->type = type; @@ -1301,6 +1302,19 @@ _block_activate(Evas_Object *obj, Termblock *blk) sd->pty->block.active = eina_list_append(sd->pty->block.active, blk); } +static void +_block_obj_del(Termblock *blk) +{ + if (!blk->obj) return; + + blk->mov_paused = !media_play_get(blk->obj); + evas_object_event_callback_del_full + (blk->obj, EVAS_CALLBACK_DEL, + _smart_media_del, blk); + evas_object_del(blk->obj); + blk->obj = NULL; +} + static void _smart_apply(Evas_Object *obj) { @@ -1504,16 +1518,7 @@ _smart_apply(Evas_Object *obj) if (!blk->active) { blk->was_active = EINA_FALSE; - // XXX: move to func - if (blk->obj) - { - // XXX: handle if edje not media - evas_object_event_callback_del_full - (blk->obj, EVAS_CALLBACK_DEL, - _smart_media_del, blk); - evas_object_del(blk->obj); - blk->obj = NULL; - } + _block_obj_del(blk); sd->pty->block.active = eina_list_remove_list (sd->pty->block.active, l); } diff --git a/src/bin/termpty.h b/src/bin/termpty.h index e2e05e26..42afd464 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -196,6 +196,8 @@ struct _Termblock Eina_Bool active : 1; Eina_Bool was_active : 1; Eina_Bool was_active_before : 1; + + Eina_Bool mov_paused : 1; // movie paused state marker }; struct _Termexp