[0.6.268] handle seek to eos 46/266546/2 accepted/tizen/unified/20211116.130447 submit/tizen/20211115.101120
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 15 Nov 2021 07:52:36 +0000 (16:52 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 15 Nov 2021 08:38:25 +0000 (17:38 +0900)
- skip to seek to end of stream
  if the current pos is already eos

Change-Id: I6be9b88d0d3f3e002521a099732718dbb5816072

packaging/libmm-player.spec
src/mm_player_gst.c

index 636ba47..60683a4 100644 (file)
@@ -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
index 7961390..e509314 100644 (file)
@@ -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;
        }