[0.6.268] handle seek to eos 62/266562/1 accepted/tizen/6.5/unified/20211117.024249 submit/tizen_6.5/20211115.101113
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 10:09:39 +0000 (19:09 +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 636ba47810a34ec23cdf5cb2d52f3635a5f582c1..60683a4c8fb5900252693fdc5d1c20cb29f61d59 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 79613909d42537b318703fd9bdfd8aa440eaed7e..e5093146f86b5272c54c2a614527cd96744a048c 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;
        }