forked from enlightenment/efl
elementary: add suspend infra inside elm_video.
SVN revision: 60910
This commit is contained in:
parent
65e431dc6e
commit
6f8eb1acf9
|
@ -22,6 +22,8 @@ struct _Widget_Data
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *emotion;
|
Evas_Object *emotion;
|
||||||
|
|
||||||
|
Ecore_Timer *timer;
|
||||||
|
|
||||||
Eina_Bool stop : 1;
|
Eina_Bool stop : 1;
|
||||||
Eina_Bool remember : 1;
|
Eina_Bool remember : 1;
|
||||||
};
|
};
|
||||||
|
@ -224,6 +226,28 @@ _audio_level_change(void *data, Evas_Object *obj __UNUSED__, void *event_info __
|
||||||
{
|
{
|
||||||
(void) data;
|
(void) data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_suspend_cb(void *data)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(data);
|
||||||
|
double interval;
|
||||||
|
|
||||||
|
interval = ecore_timer_interval_get(wd->timer);
|
||||||
|
if (interval <= 20)
|
||||||
|
emotion_object_suspend_set(wd->emotion, EMOTION_SLEEP);
|
||||||
|
else if (interval <= 30)
|
||||||
|
emotion_object_suspend_set(wd->emotion, EMOTION_DEEP_SLEEP);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emotion_object_suspend_set(wd->emotion, EMOTION_HIBERNATE);
|
||||||
|
wd->timer = NULL;
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_timer_interval_set(wd->timer, interval + 10);
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
|
@ -273,6 +297,9 @@ elm_video_add(Evas_Object *parent)
|
||||||
|
|
||||||
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
|
|
||||||
|
wd->timer = ecore_timer_add(20.0, _suspend_cb, obj);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
#else
|
#else
|
||||||
(void) parent;
|
(void) parent;
|
||||||
|
@ -338,6 +365,8 @@ elm_video_play(Evas_Object *video)
|
||||||
|
|
||||||
if (emotion_object_play_get(wd->emotion)) return ;
|
if (emotion_object_play_get(wd->emotion)) return ;
|
||||||
|
|
||||||
|
ecore_timer_del(wd->timer);
|
||||||
|
wd->timer = NULL;
|
||||||
wd->stop = EINA_FALSE;
|
wd->stop = EINA_FALSE;
|
||||||
emotion_object_play_set(wd->emotion, EINA_TRUE);
|
emotion_object_play_set(wd->emotion, EINA_TRUE);
|
||||||
#else
|
#else
|
||||||
|
@ -358,6 +387,7 @@ elm_video_pause(Evas_Object *video)
|
||||||
|
|
||||||
if (!emotion_object_play_get(wd->emotion)) return ;
|
if (!emotion_object_play_get(wd->emotion)) return ;
|
||||||
|
|
||||||
|
if (!wd->timer) wd->timer = ecore_timer_add(20.0, _suspend_cb, video);
|
||||||
emotion_object_play_set(wd->emotion, EINA_FALSE);
|
emotion_object_play_set(wd->emotion, EINA_FALSE);
|
||||||
edje_object_signal_emit(wd->layout, "elm,video,pause", "elm");
|
edje_object_signal_emit(wd->layout, "elm,video,pause", "elm");
|
||||||
#else
|
#else
|
||||||
|
@ -376,9 +406,12 @@ elm_video_stop(Evas_Object *video)
|
||||||
|
|
||||||
if (!emotion_object_play_get(wd->emotion) && wd->stop) return ;
|
if (!emotion_object_play_get(wd->emotion) && wd->stop) return ;
|
||||||
|
|
||||||
|
ecore_timer_del(wd->timer);
|
||||||
|
wd->timer = NULL;
|
||||||
wd->stop = EINA_TRUE;
|
wd->stop = EINA_TRUE;
|
||||||
emotion_object_play_set(wd->emotion, EINA_FALSE);
|
emotion_object_play_set(wd->emotion, EINA_FALSE);
|
||||||
edje_object_signal_emit(wd->layout, "elm,video,stop", "elm");
|
edje_object_signal_emit(wd->layout, "elm,video,stop", "elm");
|
||||||
|
emotion_object_suspend_set(wd->emotion, EMOTION_HIBERNATE);
|
||||||
#else
|
#else
|
||||||
(void) video;
|
(void) video;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue