2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-11-12 05:56:05 -08:00
|
|
|
#include <Emotion.h>
|
2013-09-14 10:18:19 -07:00
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
|
|
|
|
2011-07-01 00:41:48 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2011-07-01 00:41:48 -07:00
|
|
|
#include "elm_priv.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2012-08-01 14:02:42 -07:00
|
|
|
#include "elm_widget_video.h"
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
/* TODO: add buffering support to Emotion and display buffering
|
|
|
|
* progress in the theme when needed */
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_VIDEO_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Video"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_video"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-06-09 22:37:47 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2013-06-09 22:37:47 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2015-10-04 03:05:51 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_on_open_done(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
static Eina_Bool
|
|
|
|
_on_playback_started(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
static Eina_Bool
|
|
|
|
_on_playback_finished(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
static Eina_Bool
|
|
|
|
_on_aspect_ratio_updated(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
static Eina_Bool
|
|
|
|
_on_title_changed(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
static Eina_Bool
|
|
|
|
_on_audio_level_changed(void *data,
|
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED);
|
|
|
|
|
2014-04-15 00:09:12 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_play(Evas_Object *obj, const char *params);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-04-15 00:09:12 -07:00
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"play", _key_action_play},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2015-10-04 03:05:51 -07:00
|
|
|
EO_CALLBACKS_ARRAY_DEFINE(_video_cb,
|
|
|
|
{ EMOTION_OBJECT_EVENT_OPEN_DONE, _on_open_done },
|
|
|
|
{ EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _on_playback_started },
|
|
|
|
{ EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, _on_playback_finished },
|
|
|
|
{ EMOTION_OBJECT_EVENT_FRAME_RESIZE, _on_aspect_ratio_updated },
|
|
|
|
{ EMOTION_OBJECT_EVENT_TITLE_CHANGE, _on_title_changed },
|
|
|
|
{ EMOTION_OBJECT_EVENT_AUDIO_LEVEL_CHANGE, _on_audio_level_changed }
|
|
|
|
);
|
|
|
|
|
2014-04-15 00:09:12 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
|
|
|
{
|
|
|
|
const char *dir = params;
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2014-04-15 00:09:12 -07:00
|
|
|
if (!strcmp(dir, "left"))
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
|
|
|
double current, last;
|
|
|
|
|
|
|
|
current = elm_video_play_position_get(obj);
|
|
|
|
last = elm_video_play_length_get(obj);
|
|
|
|
|
|
|
|
if (current < last)
|
|
|
|
{
|
|
|
|
current += last / 100;
|
|
|
|
elm_video_play_position_set(obj, current);
|
|
|
|
}
|
|
|
|
}
|
2014-04-15 00:09:12 -07:00
|
|
|
else if (!strcmp(dir, "right"))
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
|
|
|
double current, last;
|
|
|
|
|
|
|
|
current = elm_video_play_position_get(obj);
|
|
|
|
last = elm_video_play_length_get(obj);
|
|
|
|
|
|
|
|
if (current > 0)
|
|
|
|
{
|
|
|
|
current -= last / 100;
|
|
|
|
if (current < 0) current = 0;
|
|
|
|
elm_video_play_position_set(obj, current);
|
|
|
|
}
|
|
|
|
}
|
2014-04-15 00:09:12 -07:00
|
|
|
else return EINA_FALSE;
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2014-04-15 00:09:12 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-04-15 00:09:12 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_play(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (elm_video_is_playing_get(obj))
|
|
|
|
elm_video_pause(obj);
|
|
|
|
else
|
|
|
|
elm_video_play(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
(void) src;
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
|
2015-12-21 04:55:23 -08:00
|
|
|
if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
|
2014-04-15 00:09:12 -07:00
|
|
|
{
|
|
|
|
INF("keyname: '%s' not handled", ev->key);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-11-12 17:29:30 -08:00
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-27 01:21:26 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_elm_layout_sizing_eval(Eo *obj, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2013-10-05 01:16:02 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2011-07-01 00:41:48 -07:00
|
|
|
|
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2014-04-10 01:02:52 -07:00
|
|
|
Evas_Coord w = 0, h = 0;
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
evas_object_size_hint_request_get(sd->emotion, &minw, &minh);
|
|
|
|
evas_object_size_hint_aspect_set
|
|
|
|
(sd->emotion, EVAS_ASPECT_CONTROL_BOTH, minw, minh);
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &w, &h);
|
2011-07-01 00:41:48 -07:00
|
|
|
|
|
|
|
if (w != 0 && h != 0)
|
|
|
|
{
|
|
|
|
minw = w;
|
|
|
|
minh = h;
|
|
|
|
}
|
2012-05-02 14:14:28 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_BOTH, minw, minh);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_on_size_hints_changed(void *data EINA_UNUSED,
|
|
|
|
Evas *e EINA_UNUSED,
|
2012-10-15 18:25:37 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-10-15 18:25:37 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_open_done(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,video,open", "elm");
|
2015-05-18 04:44:09 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_playback_started(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,video,play", "elm");
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
}
|
2015-10-04 03:05:51 -07:00
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_playback_finished(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2013-07-18 02:28:35 -07:00
|
|
|
ELM_VIDEO_DATA_GET(data, sd);
|
|
|
|
emotion_object_play_set(sd->emotion, EINA_FALSE);
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,video,end", "elm");
|
2015-05-18 04:44:09 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_aspect_ratio_updated(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2015-05-18 04:44:09 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_title_changed(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
|
|
|
const char *title;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_VIDEO_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
title = emotion_object_title_get(sd->emotion);
|
|
|
|
elm_layout_text_set(data, "elm,title", title);
|
|
|
|
elm_layout_signal_emit(data, "elm,video,title", "elm");
|
2015-05-18 04:44:09 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-05-18 04:44:09 -07:00
|
|
|
static Eina_Bool
|
2012-05-03 15:44:21 -07:00
|
|
|
_on_audio_level_changed(void *data,
|
2015-05-18 04:44:09 -07:00
|
|
|
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
(void)data;
|
2015-05-18 04:44:09 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
2011-07-01 01:58:28 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_suspend_cb(void *data)
|
|
|
|
{
|
|
|
|
double interval;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_VIDEO_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
interval = ecore_timer_interval_get(sd->timer);
|
2011-07-01 01:58:28 -07:00
|
|
|
if (interval <= 20)
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_suspend_set(sd->emotion, EMOTION_SLEEP);
|
2011-07-01 01:58:28 -07:00
|
|
|
else if (interval <= 30)
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_suspend_set(sd->emotion, EMOTION_DEEP_SLEEP);
|
2011-07-01 01:58:28 -07:00
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE);
|
|
|
|
sd->timer = NULL;
|
|
|
|
|
2011-07-01 01:58:28 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
ecore_timer_interval_set(sd->timer, interval + 10);
|
2011-07-01 01:58:28 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2011-07-05 07:05:59 -07:00
|
|
|
Eina_Bool
|
|
|
|
_elm_video_check(Evas_Object *video)
|
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_VIDEO_CHECK(video) EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_video_evas_object_smart_add(Eo *obj, Elm_Video_Data *priv)
|
2012-05-02 10:01:43 -07:00
|
|
|
{
|
2012-07-18 14:03:39 -07:00
|
|
|
_elm_emotion_init();
|
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2012-05-03 15:45:01 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
priv->emotion = emotion_object_add(evas_object_evas_get(obj));
|
|
|
|
emotion_object_init(priv->emotion, NULL);
|
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "video", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2013-03-01 18:04:31 -08:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_content_set(obj, "elm.swallow.video", priv->emotion);
|
|
|
|
|
2015-10-04 03:05:51 -07:00
|
|
|
eo_do(priv->emotion, eo_event_callback_array_add(_video_cb(), obj));
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, NULL);
|
|
|
|
|
|
|
|
priv->timer = ecore_timer_add(20.0, _suspend_cb, obj);
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_video_evas_object_smart_del(Eo *obj, Elm_Video_Data *sd)
|
2012-05-03 15:44:21 -07:00
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->timer);
|
2012-05-03 15:44:21 -07:00
|
|
|
if (sd->remember) emotion_object_last_position_save(sd->emotion);
|
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
2012-05-03 15:44:21 -07:00
|
|
|
}
|
2012-05-02 10:01:43 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_video_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
|
|
|
return obj;
|
|
|
|
}
|
2012-05-02 10:01:43 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2014-03-27 01:21:26 -07:00
|
|
|
_elm_video_eo_base_constructor(Eo *obj, Elm_Video_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-05-19 05:34:07 -07:00
|
|
|
obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
2014-06-10 19:07:15 -07:00
|
|
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks),
|
|
|
|
elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_ANIMATION));
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-07-22 08:37:57 -07:00
|
|
|
_elm_video_efl_file_file_set(Eo *obj, Elm_Video_Data *sd, const char *filename, const char *key EINA_UNUSED)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
if (sd->remember) emotion_object_last_position_save(sd->emotion);
|
|
|
|
sd->stop = EINA_FALSE;
|
2014-03-27 01:21:26 -07:00
|
|
|
if (!emotion_object_file_set(sd->emotion, filename)) return EINA_FALSE;
|
2012-02-20 21:52:55 -08:00
|
|
|
|
2012-06-16 19:45:12 -07:00
|
|
|
if (filename && ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://"))))
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_last_position_load(sd->emotion);
|
2012-02-20 21:52:55 -08:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,video,load", "elm");
|
2012-03-06 14:51:40 -08:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2015-03-19 05:08:23 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_efl_file_file_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd EINA_UNUSED, const char **filename, const char **key EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (filename)
|
|
|
|
*filename = emotion_object_file_get(sd->emotion);
|
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Evas_Object*
|
|
|
|
_elm_video_emotion_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return sd->emotion;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_play(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
if (emotion_object_play_get(sd->emotion)) return;
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2013-05-29 05:10:05 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2012-05-03 15:44:21 -07:00
|
|
|
sd->stop = EINA_FALSE;
|
|
|
|
emotion_object_play_set(sd->emotion, EINA_TRUE);
|
2013-07-18 02:28:35 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,video,play", "elm");
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: pause will setup timer and go into sleep or
|
|
|
|
* hibernate after a while without activity.
|
|
|
|
*/
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_pause(Eo *obj, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
if (!emotion_object_play_get(sd->emotion)) return;
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
if (!sd->timer) sd->timer = ecore_timer_add(20.0, _suspend_cb, obj);
|
|
|
|
emotion_object_play_set(sd->emotion, EINA_FALSE);
|
|
|
|
elm_layout_signal_emit(obj, "elm,video,pause", "elm");
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: stop should go into hibernate state directly.
|
|
|
|
*/
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_stop(Eo *obj, Elm_Video_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
if (!emotion_object_play_get(sd->emotion) && sd->stop) return;
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2013-05-29 05:10:05 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
sd->stop = EINA_TRUE;
|
|
|
|
emotion_object_play_set(sd->emotion, EINA_FALSE);
|
|
|
|
elm_layout_signal_emit(obj, "elm,video,stop", "elm");
|
|
|
|
emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_is_playing_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_play_get(sd->emotion);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_is_seekable_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_seekable_get(sd->emotion);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_audio_mute_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_audio_mute_get(sd->emotion);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_audio_mute_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, Eina_Bool mute)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_audio_mute_set(sd->emotion, mute);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_video_audio_level_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_audio_volume_get(sd->emotion);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_audio_level_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, double volume)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_audio_volume_set(sd->emotion, volume);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_video_play_position_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_position_get(sd->emotion);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_play_position_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, double position)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
emotion_object_position_set(sd->emotion, position);
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_video_play_length_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_play_length_get(sd->emotion);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static const char*
|
|
|
|
_elm_video_title_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return emotion_object_title_get(sd->emotion);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_remember_position_set(Eo *obj EINA_UNUSED, Elm_Video_Data *sd, Eina_Bool remember)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
sd->remember = remember;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_remember_position_get(Eo *obj EINA_UNUSED, Elm_Video_Data *sd)
|
2011-07-01 00:41:48 -07:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return sd->remember;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2011-07-01 00:41:48 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Video_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return EINA_FALSE;
|
2011-07-01 00:41:48 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_video_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Video_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-27 01:21:26 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_video_class_constructor(Eo_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-03-27 01:21:26 -07:00
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN const Elm_Atspi_Action *
|
|
|
|
_elm_video_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Video_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "play", "play", NULL, _key_action_play},
|
|
|
|
{ NULL, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-07-22 08:37:57 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_video_file_set(Eo *obj, const char *filename)
|
|
|
|
{
|
2015-02-23 09:12:35 -08:00
|
|
|
Eina_Bool ret;
|
|
|
|
return eo_do_ret((Eo *) obj, ret, efl_file_set(filename, NULL));
|
2014-07-22 08:37:57 -07:00
|
|
|
}
|
|
|
|
|
2015-04-14 13:19:18 -07:00
|
|
|
EAPI void
|
|
|
|
elm_video_file_get(Eo *obj, const char **filename)
|
|
|
|
{
|
|
|
|
eo_do((Eo *) obj, efl_file_get(filename, NULL));
|
|
|
|
}
|
|
|
|
|
2014-07-22 08:37:57 -07:00
|
|
|
|
2014-03-27 01:21:26 -07:00
|
|
|
#include "elm_video.eo.c"
|