[0.6.161] remove MMPlayerPosFormatType parameter 83/195683/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 17 Dec 2018 08:09:20 +0000 (17:09 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 17 Dec 2018 08:20:31 +0000 (17:20 +0900)
- remove MMPlayerPosFormatType parameter at _get_buffer_position()
  which is always MM_PLAYER_POS_FORMAT_PERCENT.
- rename paramter of _get_buffer_position() to make clear the meaning

Change-Id: Ib1cd981f1b162c70b97c5af4eb79a682e0ecf2aa

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_gst.h
src/include/mm_player_priv.h
src/mm_player.c
src/mm_player_gst.c
src/mm_player_priv.c

index 029237a..8e8b501 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.160
+Version:    0.6.161
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 2836928..2780433 100644 (file)
@@ -843,12 +843,12 @@ int mm_player_get_duration(MMHandleType player, int64_t *dur);
  * @code
 int start_pos = 0, stop_pos = 0;
 
-mm_player_get_buffer_position(g_player, MM_PLAYER_POS_FORMAT_PERCENT, &start_pos, &stop_pos );
+mm_player_get_buffer_position(g_player, &start_pos, &end_pos );
 
-LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, stop_pos );
+LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, end_pos );
  * @endcode
  */
-int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos);
+int mm_player_get_buffer_position(MMHandleType player, int *start_pos, int *end_pos);
 
 /**
  * This function sets callback function for receiving messages from player.
index b194b12..7fd0d8a 100644 (file)
@@ -73,7 +73,7 @@ gboolean __mmplayer_gst_seek(mm_player_t* player, GstElement * element, gdouble
                        gint64 cur, GstSeekType stop_type, gint64 stop);
 int __mmplayer_gst_set_position(mm_player_t* player, gint64 position, gboolean internal_called);
 int __mmplayer_gst_get_position(mm_player_t* player, gint64* position);
-int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos);
+int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int *end_pos);
 GstElement* __mmplayer_gst_create_source(mm_player_t* player);
 int __mmplayer_gst_build_es_pipeline(mm_player_t* player);
 int __mmplayer_gst_build_pipeline(mm_player_t* player);
index 879b645..9a1895b 100644 (file)
@@ -855,7 +855,7 @@ int _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_ca
 int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent);
 int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int *silent);
 int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char *filepath);
-int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long *start_pos, unsigned long *stop_pos);
+int _mmplayer_get_buffer_position(MMHandleType hplayer, int *start_pos, int *end_pos);
 int _mmplayer_update_video_param(mm_player_t *player, char *param_name);
 int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay);
 int _mmplayer_audio_effect_custom_apply(mm_player_t *player);
index 326f9b3..862fd30 100644 (file)
@@ -445,23 +445,23 @@ int mm_player_get_duration(MMHandleType player, int64_t *dur)
 }
 
 
-int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos)
+int mm_player_get_buffer_position(MMHandleType player, int *start_pos, int *end_pos)
 {
        int result = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && end_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
        MMPLAYER_CMD_LOCK(player);
 
-       result = _mmplayer_get_buffer_position(player, (int)format, start_pos, stop_pos);
+       result = _mmplayer_get_buffer_position(player, start_pos, end_pos);
 
        MMPLAYER_CMD_UNLOCK(player);
 
        return result;
 }
 
-int mm_player_set_external_subtitle_path(MMHandleType player, const charpath)
+int mm_player_set_external_subtitle_path(MMHandleType player, const char *path)
 {
        int result = MM_ERROR_NONE;
 
index 269afa6..291ff62 100644 (file)
@@ -3540,7 +3540,7 @@ __mmplayer_gst_get_position(mm_player_t* player, gint64* position)
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos)
+int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int *end_pos)
 {
 #define STREAMING_IS_FINISHED  0
 #define BUFFERING_MAX_PER      100
@@ -3548,7 +3548,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
 #define CHECK_PERCENT_VALUE(a, min, max)(((a) > (min)) ? (((a) < (max)) ? (a) : (max)) : (min))
 
        MMPlayerGstElement *mainbin = NULL;
-       gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE;
+       gint start_per = DEFAULT_PER_VALUE, end_per = DEFAULT_PER_VALUE;
        gint64 buffered_total = 0;
        gint64 position = 0;
        gint buffered_sec = -1;
@@ -3561,10 +3561,10 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                                                player->pipeline->mainbin,
                                                MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && end_pos, MM_ERROR_INVALID_ARGUMENT);
 
        *start_pos = 0;
-       *stop_pos = 0;
+       *end_pos = 0;
 
        if (!MMPLAYER_IS_HTTP_STREAMING(player)) {
                /* and rtsp is not ready yet. */
@@ -3572,11 +3572,6 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                return MM_ERROR_PLAYER_NO_OP;
        }
 
-       if (format != MM_PLAYER_POS_FORMAT_PERCENT) {
-               LOGW("Time format is not supported yet");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
        if (content_size_time <= 0 || content_size_bytes <= 0) {
                LOGW("there is no content size");
                return MM_ERROR_NONE;
@@ -3614,7 +3609,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                        if (gst_element_query_position(mainbin[MMPLAYER_M_SRC].gst,
                                GST_FORMAT_BYTES, &buffered_total)) {
                                LOGD("buffered_total %"G_GINT64_FORMAT, buffered_total);
-                               stop_per = 100 * buffered_total / content_size_bytes;
+                               end_per = 100 * buffered_total / content_size_bytes;
                        }
                } else {
                        /* GST_BUFFERING_TIMESHIFT or GST_BUFFERING_DOWNLOAD */
@@ -3633,12 +3628,12 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                                        buffered_total += (stop_byte - start_byte);
                                }
                        } else
-                               stop_per = BUFFERING_MAX_PER;
+                               end_per = BUFFERING_MAX_PER;
                }
                gst_query_unref(query);
        }
 
-       if (stop_per == DEFAULT_PER_VALUE) {
+       if (end_per == DEFAULT_PER_VALUE) {
                guint dur_sec = (guint)(content_size_time/GST_SECOND);
                if (dur_sec > 0) {
                        guint avg_byterate = (guint)(content_size_bytes/dur_sec);
@@ -3660,15 +3655,15 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                                buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total)/(gdouble)player->total_bitrate));
 
                        if (buffered_sec >= 0)
-                               stop_per = start_per +(gint)(ceil)(100*(gdouble)buffered_sec/(gdouble)dur_sec);
+                               end_per = start_per +(gint)(ceil)(100*(gdouble)buffered_sec/(gdouble)dur_sec);
                }
        }
 
        *start_pos = CHECK_PERCENT_VALUE(start_per, 0, 100);
-       *stop_pos = CHECK_PERCENT_VALUE(stop_per, *start_pos, 100);
+       *end_pos = CHECK_PERCENT_VALUE(end_per, *start_pos, 100);
 
-       LOGD("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %lu~%lu",
-               buffered_total, buffered_sec, *start_pos, *stop_pos);
+       LOGD("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %d~%d",
+               buffered_total, buffered_sec, *start_pos, *end_pos);
 
        return MM_ERROR_NONE;
 }
index 3c1b0ba..e6cef96 100644 (file)
@@ -1419,7 +1419,6 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
        if (!__mmplayer_create_audio_sink_path(player, audio_selector))
                goto EXIT;
 
-
        /* create text path followed by text-select */
        __mmplayer_create_text_sink_path(player, text_selector);
 
@@ -5561,14 +5560,14 @@ _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration)
 }
 
 int
-_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos)
+_mmplayer_get_buffer_position(MMHandleType hplayer, int *start_pos, int *end_pos)
 {
-       mm_player_tplayer = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t*)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       ret = __mmplayer_gst_get_buffer_position(player, format, start_pos, stop_pos);
+       ret = __mmplayer_gst_get_buffer_position(player, start_pos, end_pos);
 
        return ret;
 }
@@ -8365,7 +8364,6 @@ int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms,
        if (MMPLAYER_CURRENT_STATE(player) !=  MM_PLAYER_STATE_NULL)
                LOGW("buffer_ms will not be applied.");
 
-
        LOGD("set buffering time %d ms / %d ms", buffer_ms, rebuffer_ms);
 
        if (player->streamer == NULL) {