diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2015-08-31 17:16:18 +0900 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2015-08-31 17:16:18 +0900 |
commit | ace9214f748faeeff547097ec79b01b7f565121b (patch) | |
tree | c93eecf163e664a42d46f9472b7d81c06469204f | |
parent | 2402daa162b8e90309fe03482bc1d8a5dd640dfa (diff) | |
download | air_mediahub-ace9214f748faeeff547097ec79b01b7f565121b.tar.gz air_mediahub-ace9214f748faeeff547097ec79b01b7f565121b.tar.bz2 air_mediahub-ace9214f748faeeff547097ec79b01b7f565121b.zip |
viewer: set to 0 played_position if movie is almost done
Change-Id: I7e4cbccbf2f52bfce1298419535e37a529f85545
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
-rw-r--r-- | src/view/viewer.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/view/viewer.c b/src/view/viewer.c index a29d1d8..f91a8ab 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -37,6 +37,7 @@ #define STYLE_VIEWER_BTN "viewer_btn" #define PART_VIEWER_BTN "control_btn" +#define POSITION_MARGIN 500 #define VIEWER_TIMEOUT 3.0 #define VIEWER_SEPARATOR "/ " #define VIDEO_COPYRIGHT "Unknown" @@ -394,12 +395,23 @@ static const char *_get_current_media_id(struct _priv *priv) return mi->media_id; } -static void _set_played_position(struct _priv *priv, int position) +static void _set_played_position(struct _priv *priv) { video_meta_h video; app_media *am; + int position; + int duration; int r; + if (priv->viewer.cur != VIEWER_MOVIE) + return; + + position = playermgr_get_position(priv->player); + duration = playermgr_get_duration(priv->player); + + if (position > duration - POSITION_MARGIN) + position = 0; + am = eina_list_nth(priv->playlist.list, priv->playlist.cur); if (!am) { _ERR("failed to get app_media"); @@ -433,6 +445,9 @@ static void _set_image_orientation(struct _priv *priv) app_media_info *mi; Evas_Object *image, *obj; + if (priv->viewer.cur != VIEWER_PHOTO) + return; + am = eina_list_nth(priv->playlist.list, priv->playlist.cur); if (!am) { _ERR("failed to get app_media"); @@ -808,12 +823,8 @@ static void _player_pause(struct _priv *priv) static void _player_stop(struct _priv *priv) { struct controller *ctl; - int position; - if (priv->viewer.cur == VIEWER_MOVIE) { - position = playermgr_get_position(priv->player); - _set_played_position(priv, position); - } + _set_played_position(priv); progressbar_stop(priv->progress); playermgr_stop(priv->player); @@ -831,8 +842,6 @@ static void _player_complete_cb(void *data) priv = data; - _set_played_position(priv, 0); - if (priv->viewer.cur == VIEWER_MOVIE) { _pop_view(priv); } else if (priv->viewer.cur == VIEWER_VIDEO) { |