From: Eunhye Choi Date: Mon, 15 Nov 2021 07:52:36 +0000 (+0900) Subject: [0.6.268] handle seek to eos X-Git-Tag: accepted/tizen/unified/20211116.130447^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git;a=commitdiff_plain;h=16b50a06357d2b92f92c9282b37fc4aaf1f8ae74 [0.6.268] handle seek to eos - skip to seek to end of stream if the current pos is already eos Change-Id: I6be9b88d0d3f3e002521a099732718dbb5816072 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 636ba47..60683a4 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.267 +Version: 0.6.268 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_gst.c b/src/mm_player_gst.c index 7961390..e509314 100644 --- a/src/mm_player_gst.c +++ b/src/mm_player_gst.c @@ -3410,9 +3410,10 @@ static gpointer __mmplayer_gst_bus_msg_thread(gpointer data) } static int -__mmplayer_gst_check_duration(mmplayer_t *player, gint64 position) +__mmplayer_gst_check_position(mmplayer_t *player, gint64 position) { gint64 dur_nsec = 0; + gint64 pos_nsec = 0; MMPLAYER_FENTER(); MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED); @@ -3447,6 +3448,15 @@ __mmplayer_gst_check_duration(mmplayer_t *player, gint64 position) return MM_ERROR_INVALID_ARGUMENT; } + if (gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec)) { + if ((pos_nsec == player->duration) && /* current pos is end of stream */ + ((position / GST_MSECOND) == (player->duration / GST_MSECOND))) { + MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL); + player->seek_state = MMPLAYER_SEEK_NONE; + return MM_ERROR_PLAYER_NO_OP; + } + } + MMPLAYER_FLEAVE(); return MM_ERROR_NONE; } @@ -3941,9 +3951,9 @@ _mmplayer_gst_set_position(mmplayer_t *player, gint64 position, gboolean interna && (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED)) goto PENDING; - ret = __mmplayer_gst_check_duration(player, position); + ret = __mmplayer_gst_check_position(player, position); if (ret != MM_ERROR_NONE) { - LOGE("failed to check duration 0x%X", ret); + LOGW("result of check position info 0x%X", ret); return (ret == MM_ERROR_PLAYER_NO_OP) ? MM_ERROR_NONE : ret; }