2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-11-15 18:31:26 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
|
|
|
|
|
|
|
#include <Emotion.h>
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2011-07-05 07:05:59 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2012-07-31 15:07:23 -07:00
|
|
|
#include "elm_widget_player.h"
|
2011-07-05 07:05:59 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_player_part.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_PLAYER_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Player"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_player"
|
2011-07-05 07:05:59 -07:00
|
|
|
|
|
|
|
static const char SIG_FORWARD_CLICKED[] = "forward,clicked";
|
|
|
|
static const char SIG_INFO_CLICKED[] = "info,clicked";
|
|
|
|
static const char SIG_NEXT_CLICKED[] = "next,clicked";
|
|
|
|
static const char SIG_PAUSE_CLICKED[] = "pause,clicked";
|
|
|
|
static const char SIG_PLAY_CLICKED[] = "play,clicked";
|
|
|
|
static const char SIG_PREV_CLICKED[] = "prev,clicked";
|
|
|
|
static const char SIG_REWIND_CLICKED[] = "rewind,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "stop,clicked";
|
2013-07-25 02:29:59 -07:00
|
|
|
static const char SIG_EJECT_CLICKED[] = "eject,clicked";
|
|
|
|
static const char SIG_VOLUME_CLICKED[] = "volume,clicked";
|
|
|
|
static const char SIG_MUTE_CLICKED[] = "mute,clicked";
|
|
|
|
/*
|
2013-07-18 01:19:13 -07:00
|
|
|
static const char SIG_STOP_CLICKED[] = "repeat,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "shuffle,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "record,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "replay,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "power,clicked";
|
2013-07-18 05:24:17 -07:00
|
|
|
static const char SIG_STOP_CLICKED[] = "fullscreen,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "normal,clicked";
|
|
|
|
static const char SIG_STOP_CLICKED[] = "quality,clicked";
|
2013-07-18 01:19:13 -07:00
|
|
|
*/
|
2013-06-09 02:54:43 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|
|
|
{ SIG_FORWARD_CLICKED, "" },
|
|
|
|
{ SIG_INFO_CLICKED, "" },
|
|
|
|
{ SIG_NEXT_CLICKED, "" },
|
|
|
|
{ SIG_PAUSE_CLICKED, "" },
|
|
|
|
{ SIG_PLAY_CLICKED, "" },
|
|
|
|
{ SIG_PREV_CLICKED, "" },
|
|
|
|
{ SIG_REWIND_CLICKED, "" },
|
|
|
|
{ SIG_STOP_CLICKED, "" },
|
2013-07-25 02:29:59 -07:00
|
|
|
{ SIG_EJECT_CLICKED, "" },
|
|
|
|
{ SIG_VOLUME_CLICKED, "" },
|
|
|
|
{ SIG_MUTE_CLICKED, "" },
|
2014-01-23 03:07:20 -08:00
|
|
|
{ SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{ SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{ SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2012-05-03 15:44:21 -07:00
|
|
|
{ NULL, NULL }
|
2011-07-05 07:05:59 -07:00
|
|
|
};
|
|
|
|
|
2016-08-30 05:34:10 -07:00
|
|
|
static void _update_frame(void *data, const Efl_Event *event);
|
|
|
|
static void _update_slider(void *data, const Efl_Event *event);
|
|
|
|
static void _play_started(void *data, const Efl_Event *event);
|
|
|
|
static void _play_finished(void *data, const Efl_Event *event);
|
|
|
|
static void _update_position(void *data, const Efl_Event *event);
|
|
|
|
static void _drag_start(void *data, const Efl_Event *event);
|
|
|
|
static void _drag_stop(void *data, const Efl_Event *event);
|
2015-09-23 15:23:11 -07:00
|
|
|
|
2014-04-14 22:46:39 -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);
|
2013-10-28 07:06:14 -07:00
|
|
|
|
2014-04-14 22:46:39 -07:00
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"play", _key_action_play},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(_emotion_cb,
|
2016-09-21 10:37:59 -07:00
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_FRAME_DECODE, _update_frame },
|
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_FRAME_RESIZE, _update_slider },
|
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_LENGTH_CHANGE, _update_slider },
|
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_POSITION_CHANGE, _update_frame },
|
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_PLAYBACK_START, _play_started },
|
|
|
|
{ EFL_CANVAS_VIDEO_EVENT_PLAYBACK_STOP, _play_finished }
|
2015-09-23 15:23:11 -07:00
|
|
|
);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(_slider_cb,
|
2019-07-22 03:27:20 -07:00
|
|
|
{ EFL_UI_RANGE_EVENT_CHANGED, _update_position },
|
2017-06-12 00:06:22 -07:00
|
|
|
{ EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, _drag_start },
|
|
|
|
{ EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, _drag_stop }
|
2015-09-23 15:23:11 -07:00
|
|
|
);
|
|
|
|
|
2014-04-14 22:46:39 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->video) return EINA_FALSE;
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2014-04-14 22:46:39 -07:00
|
|
|
if (!strcmp(dir, "left"))
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
|
|
|
double current, last;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
current = elm_video_play_position_get(sd->video);
|
|
|
|
last = elm_video_play_length_get(sd->video);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
|
|
|
if (current < last)
|
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
current -= last / 100;
|
|
|
|
elm_video_play_position_set(sd->video, current);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-14 22:46:39 -07:00
|
|
|
else if (!strcmp(dir, "right"))
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
|
|
|
double current, last;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
current = elm_video_play_position_get(sd->video);
|
|
|
|
last = elm_video_play_length_get(sd->video);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
|
|
|
if (current > 0)
|
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
current += last / 100;
|
2011-07-05 07:05:59 -07:00
|
|
|
if (current < 0) current = 0;
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_video_play_position_set(sd->video, current);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-14 22:46:39 -07:00
|
|
|
else return EINA_FALSE;
|
2013-11-12 17:29:30 -08:00
|
|
|
|
2014-04-14 22:46:39 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_play(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(obj, sd);
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->video) return EINA_FALSE;
|
2014-04-14 22:46:39 -07:00
|
|
|
if (elm_video_is_playing_get(sd->video))
|
|
|
|
elm_video_pause(sd->video);
|
|
|
|
else
|
|
|
|
elm_video_play(sd->video);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-07-23 03:15:50 -07:00
|
|
|
static void
|
|
|
|
_update_theme_button(Evas_Object *obj, Evas_Object *bt, const char *name)
|
|
|
|
{
|
|
|
|
Evas_Object *ic;
|
|
|
|
char buf[256];
|
2013-07-23 05:56:02 -07:00
|
|
|
|
|
|
|
if (!bt) return;
|
2013-07-23 03:15:50 -07:00
|
|
|
ic = evas_object_data_get(bt, "icon");
|
2013-07-23 05:56:02 -07:00
|
|
|
if (ic)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_icon_standard_set(ic, buf);
|
|
|
|
}
|
2013-07-23 03:15:50 -07:00
|
|
|
snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(bt, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name);
|
|
|
|
if (!elm_layout_content_set(obj, buf, bt))
|
|
|
|
evas_object_hide(bt);
|
|
|
|
elm_object_disabled_set(bt, elm_widget_disabled_get(obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-25 02:29:59 -07:00
|
|
|
_update_theme_slider(Evas_Object *obj, Evas_Object *sl, const char *name, const char *name2)
|
2013-07-23 03:15:50 -07:00
|
|
|
{
|
|
|
|
char buf[256];
|
2013-07-23 05:56:02 -07:00
|
|
|
|
|
|
|
if (!sl) return;
|
2013-07-23 03:15:50 -07:00
|
|
|
snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(sl, buf);
|
2013-07-25 02:29:59 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name2);
|
2013-07-23 03:15:50 -07:00
|
|
|
if (!elm_layout_content_set(obj, buf, sl))
|
|
|
|
evas_object_hide(sl);
|
|
|
|
elm_object_disabled_set(sl, elm_widget_disabled_get(obj));
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_player_efl_ui_widget_theme_apply(Eo *obj, Elm_Player_Data *sd)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2014-03-25 04:33:53 -07:00
|
|
|
|
2013-07-23 03:15:50 -07:00
|
|
|
_update_theme_button(obj, sd->forward, "forward");
|
|
|
|
_update_theme_button(obj, sd->info, "info");
|
|
|
|
_update_theme_button(obj, sd->next, "next");
|
|
|
|
_update_theme_button(obj, sd->pause, "pause");
|
|
|
|
_update_theme_button(obj, sd->play, "play");
|
|
|
|
_update_theme_button(obj, sd->prev, "prev");
|
|
|
|
_update_theme_button(obj, sd->rewind, "rewind");
|
|
|
|
_update_theme_button(obj, sd->next, "next");
|
|
|
|
_update_theme_button(obj, sd->stop, "stop");
|
2013-07-25 02:29:59 -07:00
|
|
|
_update_theme_button(obj, sd->eject, "eject");
|
|
|
|
_update_theme_button(obj, sd->volume, "volume");
|
|
|
|
_update_theme_button(obj, sd->mute, "mute");
|
|
|
|
_update_theme_slider(obj, sd->slider, "position", "positionslider");
|
|
|
|
_update_theme_slider(obj, sd->vslider, "volume", "volumeslider");
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_update_slider(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
|
|
|
double pos, length;
|
|
|
|
Eina_Bool seekable;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!sd) return;
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
seekable = elm_video_is_seekable_get(sd->video);
|
|
|
|
length = elm_video_play_length_get(sd->video);
|
|
|
|
pos = elm_video_play_position_get(sd->video);
|
|
|
|
|
2013-09-30 03:21:31 -07:00
|
|
|
elm_object_disabled_set(sd->slider,
|
2013-07-23 03:15:50 -07:00
|
|
|
(!seekable) | elm_widget_disabled_get(data));
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_slider_min_max_set(sd->slider, 0, length);
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((!EINA_DBL_EQ(elm_slider_value_get(sd->slider), pos)) &&
|
2013-07-18 07:10:34 -07:00
|
|
|
(!sd->dragging))
|
|
|
|
elm_slider_value_set(sd->slider, pos);
|
2013-02-12 03:10:55 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_update_frame(void *data, const Efl_Event *event)
|
2013-02-12 03:10:55 -08:00
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2016-06-20 07:31:31 -07:00
|
|
|
if (!sd) return;
|
2016-02-29 03:32:52 -08:00
|
|
|
_update_slider(data, event);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_update_position(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2013-07-18 07:10:34 -07:00
|
|
|
double pos;
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2013-07-18 07:10:34 -07:00
|
|
|
pos = elm_slider_value_get(sd->slider);
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_FLT_EQ(pos, elm_video_play_position_get(sd->video)))
|
2013-07-18 07:10:34 -07:00
|
|
|
elm_video_play_position_set(sd->video, pos);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_drag_start(void *data, const Efl_Event *event EINA_UNUSED)
|
2013-07-17 03:29:30 -07:00
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
|
|
|
sd->dragging = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_drag_stop(void *data, const Efl_Event *event EINA_UNUSED)
|
2013-07-17 03:29:30 -07:00
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
|
|
|
sd->dragging = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_update_volume(void *data, const Efl_Event *event EINA_UNUSED)
|
2013-07-25 02:29:59 -07:00
|
|
|
{
|
|
|
|
double vol;
|
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
vol = elm_slider_value_get(sd->vslider) / 100.0;
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(vol, elm_video_audio_level_get(sd->video)))
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_video_audio_level_set(sd->video, vol);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_forward(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
|
|
|
double pos, length;
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
length = elm_video_play_length_get(sd->video);
|
2013-07-23 03:15:50 -07:00
|
|
|
pos = elm_video_play_position_get(sd->video);
|
|
|
|
pos += 30.0;
|
|
|
|
if (pos > length) pos = length;
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_video_play_position_set(sd->video, pos);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,forward", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_FORWARD_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_info(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,info", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_INFO_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_next(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,next", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_NEXT_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_pause(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,player,pause", "elm");
|
|
|
|
elm_video_pause(sd->video);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_PAUSE_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_play(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2013-02-12 03:22:05 -08:00
|
|
|
elm_layout_signal_emit(data, "elm,player,play", "elm");
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_video_play(sd->video);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_PLAY_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_PREV_CLICKED, NULL);
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,prev", "elm");
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_rewind(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2013-07-23 03:15:50 -07:00
|
|
|
double pos;
|
2012-05-03 15:44:21 -07:00
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2011-07-05 07:05:59 -07:00
|
|
|
|
2013-07-23 03:15:50 -07:00
|
|
|
pos = elm_video_play_position_get(sd->video);
|
|
|
|
pos -= 30.0;
|
|
|
|
if (pos < 0.0) pos = 0.0;
|
|
|
|
elm_video_play_position_set(sd->video, pos);
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,rewind", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_REWIND_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_stop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,stop", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_QUALITY_CLICKED, NULL);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_eject(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2013-07-25 02:29:59 -07:00
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(data, sd);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,button,eject", "elm");
|
|
|
|
emotion_object_eject(elm_video_emotion_get(sd->video));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_EJECT_CLICKED, NULL);
|
2013-07-25 02:29:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mute_toggle(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_PLAYER_DATA_GET(obj, sd);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-07-25 02:29:59 -07:00
|
|
|
if (!elm_video_audio_mute_get(sd->video))
|
|
|
|
{
|
|
|
|
elm_video_audio_mute_set(sd->video, EINA_TRUE);
|
|
|
|
elm_layout_signal_emit(obj, "elm,player,mute", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_video_audio_mute_set(sd->video, EINA_FALSE);
|
|
|
|
elm_layout_signal_emit(obj, "elm,player,unmute", "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_volume(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2013-07-25 02:29:59 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(data, "elm,button,volume", "elm");
|
|
|
|
_mute_toggle(data);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_VOLUME_CLICKED, NULL);
|
2013-07-25 02:29:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-05-13 12:14:13 -07:00
|
|
|
_mute(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2013-07-25 02:29:59 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(data, "elm,button,mute", "elm");
|
|
|
|
_mute_toggle(data);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_PLAYER_EVENT_MUTE_CLICKED, NULL);
|
2013-07-25 02:29:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_play_started(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,player,play", "elm");
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_play_finished(void *data, const Efl_Event *event EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,player,pause", "elm");
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-17 15:06:28 -07:00
|
|
|
_on_video_del(Elm_Player_Data *sd)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_object_disabled_set(sd->forward, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->info, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->next, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->pause, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->play, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->prev, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->rewind, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->next, EINA_TRUE);
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_object_disabled_set(sd->stop, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->volume, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->mute, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->slider, EINA_TRUE);
|
|
|
|
elm_object_disabled_set(sd->vslider, EINA_TRUE);
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
sd->video = NULL;
|
|
|
|
sd->emotion = NULL;
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-17 15:06:28 -07:00
|
|
|
_video_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2017-04-17 15:06:28 -07:00
|
|
|
_on_video_del(data);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2012-05-03 15:44:21 -07:00
|
|
|
_player_button_add(Evas_Object *obj,
|
|
|
|
const char *name,
|
2019-05-13 12:14:13 -07:00
|
|
|
Evas_Smart_Cb func)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
|
|
|
Evas_Object *ic;
|
|
|
|
Evas_Object *bt;
|
2013-07-23 06:10:54 -07:00
|
|
|
char buf[256];
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
ic = elm_icon_add(obj);
|
2013-07-23 03:15:50 -07:00
|
|
|
snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_icon_standard_set(ic, buf);
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
bt = elm_button_add(obj);
|
2013-07-23 05:56:02 -07:00
|
|
|
if (ic) evas_object_data_set(bt, "icon", ic);
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
|
2013-07-23 03:15:50 -07:00
|
|
|
elm_object_content_set(bt, ic);
|
|
|
|
evas_object_show(ic);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-07-23 03:15:50 -07:00
|
|
|
snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(bt, buf);
|
2019-05-13 12:14:13 -07:00
|
|
|
evas_object_smart_callback_add(bt, "clicked", func, obj);
|
|
|
|
|
2013-07-23 03:15:50 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name);
|
|
|
|
if (!elm_layout_content_set(obj, buf, bt))
|
2012-05-03 15:44:21 -07:00
|
|
|
{
|
|
|
|
elm_widget_sub_object_add(obj, bt);
|
|
|
|
evas_object_hide(bt);
|
|
|
|
}
|
2013-07-23 03:15:50 -07:00
|
|
|
evas_object_show(bt);
|
2011-07-05 07:05:59 -07:00
|
|
|
return bt;
|
|
|
|
}
|
|
|
|
|
2012-03-28 01:42:13 -07:00
|
|
|
static char *
|
2011-07-05 07:05:59 -07:00
|
|
|
_double_to_time(double value)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
int ph, pm, ps, pf;
|
|
|
|
|
|
|
|
ph = value / 3600;
|
|
|
|
pm = value / 60 - (ph * 60);
|
2013-02-12 03:22:05 -08:00
|
|
|
ps = value - (pm * 60) - (ph * 3600);
|
2011-07-05 07:05:59 -07:00
|
|
|
pf = value * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100);
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2011-07-05 07:05:59 -07:00
|
|
|
if (ph)
|
|
|
|
snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i",
|
|
|
|
ph, pm, ps, pf);
|
|
|
|
else if (pm)
|
|
|
|
snprintf(buf, sizeof(buf), "%02i:%02i.%02i",
|
|
|
|
pm, ps, pf);
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%02i.%02i",
|
|
|
|
ps, pf);
|
2012-03-28 01:42:13 -07:00
|
|
|
return (char *)eina_stringshare_add(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:44:21 -07:00
|
|
|
_str_free(char *data)
|
2012-03-28 01:42:13 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(data);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
/* a video object is never parented by a player one, just tracked.
|
|
|
|
* treating this special case here and delegating other objects to own
|
|
|
|
* layout */
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_player_content_set(Eo *obj, Elm_Player_Data *sd, const char *part, Evas_Object *content)
|
2011-10-30 20:58:44 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2011-10-30 20:58:44 -07:00
|
|
|
double pos, length;
|
|
|
|
Eina_Bool seekable;
|
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
if (part && strcmp(part, "video"))
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
|
2014-03-25 04:33:53 -07:00
|
|
|
return int_ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2013-07-23 03:15:50 -07:00
|
|
|
if ((!part) || (!strcmp(part, "video"))) part = "elm.swallow.content";
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2014-03-25 04:33:53 -07:00
|
|
|
if (!_elm_video_check(content)) return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
if (sd->video == content) goto end;
|
2012-05-02 10:01:43 -07:00
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(sd->video);
|
2012-05-03 15:44:21 -07:00
|
|
|
sd->video = content;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (!content) goto end;
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
elm_object_disabled_set(sd->forward, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->info, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->next, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->pause, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->play, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->prev, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->rewind, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->next, EINA_FALSE);
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_object_disabled_set(sd->stop, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->volume, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->mute, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->slider, EINA_FALSE);
|
|
|
|
elm_object_disabled_set(sd->vslider, EINA_FALSE);
|
2012-05-02 10:01:43 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
sd->emotion = elm_video_emotion_get(sd->video);
|
|
|
|
emotion_object_priority_set(sd->emotion, EINA_TRUE);
|
|
|
|
evas_object_event_callback_add
|
2017-04-17 15:06:28 -07:00
|
|
|
(sd->video, EVAS_CALLBACK_DEL, _video_del, sd);
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
seekable = elm_video_is_seekable_get(sd->video);
|
|
|
|
length = elm_video_play_length_get(sd->video);
|
|
|
|
pos = elm_video_play_position_get(sd->video);
|
|
|
|
|
|
|
|
elm_object_disabled_set(sd->slider, !seekable);
|
|
|
|
elm_slider_min_max_set(sd->slider, 0, length);
|
|
|
|
elm_slider_value_set(sd->slider, pos);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_slider_value_set(sd->vslider,
|
|
|
|
elm_video_audio_level_get(sd->video) * 100.0);
|
|
|
|
// XXX: get mute
|
2012-05-03 15:44:21 -07:00
|
|
|
|
|
|
|
if (elm_video_is_playing_get(sd->video))
|
|
|
|
elm_layout_signal_emit(obj, "elm,player,play", "elm");
|
|
|
|
else elm_layout_signal_emit(obj, "elm,player,pause", "elm");
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_add(sd->emotion, _emotion_cb(), obj);
|
2011-10-30 20:58:44 -07:00
|
|
|
|
|
|
|
/* FIXME: track info from video */
|
2012-11-25 22:32:53 -08:00
|
|
|
end:
|
2014-03-25 04:33:53 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-30 20:58:44 -07:00
|
|
|
}
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2014-03-25 04:33:53 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_player_efl_canvas_group_group_add(Eo *obj, Elm_Player_Data *priv)
|
2012-05-03 15:44:21 -07:00
|
|
|
{
|
2013-07-23 06:10:54 -07:00
|
|
|
char buf[256];
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "player", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2019-07-30 10:11:48 -07:00
|
|
|
efl_ui_layout_finger_size_multiplier_set(obj, 0, 0);
|
2013-07-23 03:15:50 -07:00
|
|
|
priv->forward = _player_button_add(obj, "forward", _forward);
|
|
|
|
priv->info = _player_button_add(obj, "info", _info);
|
|
|
|
priv->next = _player_button_add(obj, "next", _next);
|
|
|
|
priv->pause = _player_button_add(obj, "pause", _pause);
|
|
|
|
priv->play = _player_button_add(obj, "play", _play);
|
|
|
|
priv->prev = _player_button_add(obj, "prev", _prev);
|
|
|
|
priv->rewind = _player_button_add(obj, "rewind", _rewind);
|
|
|
|
priv->stop = _player_button_add(obj, "stop", _stop);
|
2013-07-25 02:29:59 -07:00
|
|
|
priv->eject = _player_button_add(obj, "eject", _eject);
|
|
|
|
priv->volume = _player_button_add(obj, "volume", _volume);
|
|
|
|
priv->mute = _player_button_add(obj, "mute", _mute);
|
2013-07-23 06:10:54 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
priv->slider = elm_slider_add(obj);
|
2013-07-23 06:10:54 -07:00
|
|
|
snprintf(buf, sizeof(buf), "media_player/position/%s",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(priv->slider, buf);
|
2013-07-18 06:19:44 -07:00
|
|
|
elm_slider_indicator_show_set(priv->slider, EINA_TRUE);
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_slider_indicator_format_function_set
|
|
|
|
(priv->slider, _double_to_time, _str_free);
|
|
|
|
elm_slider_units_format_function_set
|
|
|
|
(priv->slider, _double_to_time, _str_free);
|
|
|
|
elm_slider_value_set(priv->slider, 0);
|
|
|
|
elm_object_disabled_set(priv->slider, EINA_TRUE);
|
|
|
|
evas_object_size_hint_align_set(priv->slider, EVAS_HINT_FILL, 0.5);
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(priv->slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2013-07-25 02:29:59 -07:00
|
|
|
elm_layout_content_set(obj, "elm.swallow.media_player.positionslider",
|
2013-07-23 03:15:50 -07:00
|
|
|
priv->slider);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_array_add(priv->slider, _slider_cb(), obj);
|
2012-05-03 15:44:21 -07:00
|
|
|
|
2013-07-25 02:29:59 -07:00
|
|
|
priv->vslider = elm_slider_add(obj);
|
|
|
|
elm_slider_indicator_show_set(priv->vslider, EINA_FALSE);
|
|
|
|
snprintf(buf, sizeof(buf), "media_player/volume/%s",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(priv->vslider, buf);
|
|
|
|
elm_slider_min_max_set(priv->vslider, 0, 100);
|
|
|
|
elm_slider_value_set(priv->vslider, 100);
|
|
|
|
elm_slider_horizontal_set(priv->vslider, EINA_FALSE);
|
|
|
|
elm_slider_inverted_set(priv->vslider, EINA_TRUE);
|
|
|
|
evas_object_size_hint_align_set(priv->vslider, 0.5, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(priv->vslider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
elm_layout_content_set(obj, "elm.swallow.media_player.volumeslider",
|
|
|
|
priv->vslider);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2019-07-22 03:27:20 -07:00
|
|
|
(priv->vslider, EFL_UI_RANGE_EVENT_CHANGED, _update_volume, obj);
|
2013-07-25 02:29:59 -07:00
|
|
|
|
2012-05-03 15:44:21 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2014-03-25 04:33:53 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_player_efl_canvas_group_group_del(Eo *obj, Elm_Player_Data *sd EINA_UNUSED)
|
2013-02-12 03:10:55 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2013-02-12 03:10:55 -08:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_player_add(Evas_Object *parent)
|
2012-05-03 15:44:21 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-05-03 15:44:21 -07:00
|
|
|
}
|
2011-10-30 20:58:44 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_player_efl_object_constructor(Eo *obj, Elm_Player_Data *sd EINA_UNUSED)
|
2012-07-31 15:07:23 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ANIMATION);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2012-07-31 15:07:23 -07:00
|
|
|
}
|
|
|
|
|
2014-03-25 04:33:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_player_class_constructor(Efl_Class *klass)
|
2011-07-05 07:05:59 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2011-07-05 07:05:59 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_player_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Player_Data *pd EINA_UNUSED)
|
2014-07-25 01:33:19 -07:00
|
|
|
{
|
2017-11-15 18:55:06 -08:00
|
|
|
static Efl_Access_Action_Data atspi_actions[] = {
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "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];
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_player, Elm_Player_Data)
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part implementation */
|
|
|
|
|
2017-09-19 04:02:26 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_player, ELM_PLAYER, Elm_Player_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(elm_player, ELM_PLAYER, Elm_Player_Data)
|
2017-11-28 20:43:21 -08:00
|
|
|
ELM_PART_CONTENT_DEFAULT_GET(elm_player, "video")
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_player_part.eo.c"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
/* End of Efl.Part */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_PLAYER_EXTRA_OPS \
|
2017-06-29 04:02:59 -07:00
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(elm_player), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_player)
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_player_eo.c"
|