From: Eunhae Choi Date: Mon, 25 Jun 2018 09:25:56 +0000 (+0900) Subject: [0.6.116] use nsec unit instead of msec X-Git-Tag: submit/tizen/20180626.021828^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d57e7255266ee3f0439d58e7667622c210b7e49;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [0.6.116] use nsec unit instead of msec - nsec API will be added for set/get position and get duration - if libmm-player use nsec as a base time unit, it can cover msec and nsec without adding new internal mm api. - remove deadcode about _adjust_video_position - remove needless _get_position code in select_track Change-Id: I74d250be365ba8e6a75f5cc100add3d8cd348a07 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index cd5e144..0db010a 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.115 +Version: 0.6.116 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 643e9ef..224e523 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -53,14 +53,6 @@ * */ #define MM_PLAYER_CONTENT_URI "profile_uri" -/** - * MM_PLAYER_CONTENT_DURATION: - * - * get the duration (int) as millisecond, It's guaranteed after calling mm_player_start() or - * receiving MM_MESSAGE_BEGIN_OF_STREAM. - * - */ -#define MM_PLAYER_CONTENT_DURATION "content_duration" /** * MM_PLAYER_VIDEO_ROTATION * @@ -857,17 +849,8 @@ int mm_player_resume(MMHandleType player); * @return This function returns zero on success, or negative value with error code. * @see MMPlayerPosFormatType, mm_player_get_position * @remark the unit of time-based format is millisecond and other case is percent. - * @par Example - * @code -int position = 1000; //1sec - -if (mm_player_set_position(g_player, MM_PLAYER_POS_FORMAT_TIME, position) != MM_ERROR_NONE) -{ - LOGE("failed to set position\n"); -} - * @endcode */ -int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos); +int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int64_t pos); /** * This function is to get current position of playback content. @@ -879,19 +862,13 @@ int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, in * @return This function returns zero on success, or negative value with errors * @see MMPlayerPosFormatType, mm_player_set_position * @remark the unit of time-based format is millisecond and other case is percent. - * @par Example - * @code -int position = 0; -int duration = 0; - -mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position); - -mm_player_get_attribute(g_player, &g_err_name, "content_duration", &duration, NULL); + */ +int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int64_t *pos); -LOGD("pos: [%d/%d] msec\n", position, duration); - * @endcode +/** + * This function is to get the content time duration. */ -int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *pos); +int mm_player_get_duration(MMHandleType player, int64_t *dur); /** * This function is to get current buffer position of playback content. @@ -1053,14 +1030,6 @@ if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos); -/** - * This function is to set the offset in timestamps of video so as to bring the a/v sync - * @param player Handle of player - * @param offset offset to be set in milliseconds(can be positive or negative both) - * postive offset to make video lag - * negative offset to make video lead - */ -int mm_player_adjust_video_position(MMHandleType player, int offset); /** * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n @@ -1160,15 +1129,6 @@ int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const ch * @see mm_player_set_attribute * @remark This function must be terminated by NULL argument. * And, if this function is failed, err_attr_name param must be free. - * @par Example - * @code -char *g_err_attr_name = NULL; - -if (mm_player_get_attribute(g_player, &g_err_attr_name, "content_duration", &duration, NULL) != MM_ERROR_NONE) { - LOGW("failed to set %s attribute\n", g_err_attr_name); - free(g_err_attr_name); -} - * @endcode */ int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED; @@ -1372,7 +1332,7 @@ int mm_player_set_external_subtitle_path(MMHandleType player, const char* path); * @param audio_time [in] audio timestamp information * @return This function returns zero on success, or negative value with error code. */ -int mm_player_set_video_share_master_clock(MMHandleType player, long long clock, long long clock_delta, long long video_time, long long media_clock, long long audio_time); +int mm_player_set_video_share_master_clock(MMHandleType player, int64_t clock, int64_t clock_delta, int64_t video_time, int64_t media_clock, int64_t audio_time); /** * This function is to get the master clock * @@ -1382,7 +1342,7 @@ int mm_player_set_video_share_master_clock(MMHandleType player, long long clock, * @param audio_time [out] audio timestamp information * @return This function returns zero on success, or negative value with error code. */ -int mm_player_get_video_share_master_clock(MMHandleType player, long long *video_time, long long *media_clock, long long *audio_time); +int mm_player_get_video_share_master_clock(MMHandleType player, int64_t *video_time, int64_t *media_clock, int64_t *audio_time); /** * This function is to set download mode of video hub diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index 1e58ffa..aafd45c 100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -432,7 +432,7 @@ typedef struct { typedef struct { bool is_pending; MMPlayerPosFormatType format; - unsigned long pos; + gint64 pos; } MMPlayerPendingSeek; typedef struct { @@ -684,7 +684,7 @@ typedef struct { /* timer for sending delayed EOS */ guint eos_timer; - /* last point (msec) that player is paused or seeking */ + /* last point that player is paused or seeking */ gint64 last_position; /* duration */ @@ -890,10 +890,10 @@ int _mmplayer_start(MMHandleType hplayer); int _mmplayer_stop(MMHandleType hplayer); int _mmplayer_pause(MMHandleType hplayer); int _mmplayer_resume(MMHandleType hplayer); -int _mmplayer_set_position(MMHandleType hplayer, int format, int pos); -int _mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *pos); +int _mmplayer_set_position(MMHandleType hplayer, int format, gint64 pos); +int _mmplayer_get_position(MMHandleType hplayer, int format, gint64 *pos); +int _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration); int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int pos); -int _mmplayer_adjust_video_postion(MMHandleType hplayer, int offset); int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming); int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, void *user_param); int _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param); @@ -921,8 +921,8 @@ int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type int _mmplayer_sync_subtitle_pipeline(mm_player_t* player); int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode); int _mmplayer_use_system_clock(MMHandleType hplayer); -int _mmplayer_set_video_share_master_clock(MMHandleType hplayer, long long clock, long long clock_delta, long long video_time, long long media_clock, long long audio_time); -int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, long long *video_time, long long *media_clock, long long *audio_time); +int _mmplayer_set_video_share_master_clock(MMHandleType hplayer, gint64 clock, gint64 clock_delta, gint64 video_time, gint64 media_clock, gint64 audio_time); +int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, gint64 *video_time, gint64 *media_clock, gint64 *audio_time); int _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable); int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path); int _mmplayer_set_uri(MMHandleType hplayer, const char* uri); diff --git a/src/mm_player.c b/src/mm_player.c index 4de2262..9fc969d 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -408,7 +408,7 @@ int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming) return result; } -int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos) +int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int64_t pos) { int result = MM_ERROR_NONE; @@ -428,7 +428,7 @@ int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, in return result; } -int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *pos) +int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int64_t *pos) { int result = MM_ERROR_NONE; @@ -449,6 +449,23 @@ int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, un return result; } +int mm_player_get_duration(MMHandleType player, int64_t *dur) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(dur, MM_ERROR_COMMON_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_duration(player, dur); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + + int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos) { int result = MM_ERROR_NONE; @@ -499,19 +516,6 @@ int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatTyp return result; } -int mm_player_adjust_video_position(MMHandleType player, int offset) -{ - int result = MM_ERROR_NONE; - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK(player); - - result = _mmplayer_adjust_video_postion(player, offset); - - MMPLAYER_CMD_UNLOCK(player); - - return result; -} - int mm_player_set_subtitle_silent(MMHandleType player, int silent) { int result = MM_ERROR_NONE; @@ -692,12 +696,8 @@ int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType ty return result; } -int mm_player_set_video_share_master_clock(MMHandleType player, - long long clock, - long long clock_delta, - long long video_time, - long long media_clock, - long long audio_time) +int mm_player_set_video_share_master_clock(MMHandleType player, int64_t clock, int64_t clock_delta, + int64_t video_time, int64_t media_clock, int64_t audio_time) { int result = MM_ERROR_NONE; @@ -712,10 +712,7 @@ int mm_player_set_video_share_master_clock(MMHandleType player, return result; } -int mm_player_get_video_share_master_clock(MMHandleType player, - long long *video_time, - long long *media_clock, - long long *audio_time) +int mm_player_get_video_share_master_clock(MMHandleType player, int64_t *video_time, int64_t *media_clock, int64_t *audio_time) { int result = MM_ERROR_NONE; diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index cc67ea5..656df1e 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -299,15 +299,6 @@ _mmplayer_construct_attribute(MMHandleType handle) 0, 0 }, - { - "content_duration", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) 0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - MMPLAYER_MAX_INT - }, { "content_bitrate", MM_ATTRS_TYPE_INT, diff --git a/src/mm_player_es.c b/src/mm_player_es.c index dd09bf8..0474967 100644 --- a/src/mm_player_es.c +++ b/src/mm_player_es.c @@ -390,7 +390,7 @@ __mmplayer_check_buffer_level(mm_player_t *player, GstElement* element, MMPlayer g_object_get(G_OBJECT(element), "current-level-bytes", ¤t_level_bytes, NULL); if (max_bytes <= current_level_bytes) { - LOGE("no available buffer space. type %d, max %lld, curr %lld", type, max_bytes, current_level_bytes); + LOGE("no available buffer space. type %d, max %"G_GUINT64_FORMAT", curr %"G_GUINT64_FORMAT, type, max_bytes, current_level_bytes); return MM_ERROR_PLAYER_BUFFER_SPACE; } @@ -403,7 +403,7 @@ __mmplayer_check_buffer_level(mm_player_t *player, GstElement* element, MMPlayer current_level_per = (guint)(gst_util_guint64_to_gdouble(current_level_bytes)/gst_util_guint64_to_gdouble(max_bytes)*100); - LOGD("type %d, min_per %u, curr_per %u max %lld cur %lld\n", + LOGD("type %d, min_per %u, curr_per %u max %"G_GUINT64_FORMAT" cur %"G_GUINT64_FORMAT, type, player->media_stream_buffer_min_percent[type], current_level_per, player->media_stream_buffer_max_size[type], diff --git a/src/mm_player_pd.c b/src/mm_player_pd.c index 8c9511b..33c172d 100644 --- a/src/mm_player_pd.c +++ b/src/mm_player_pd.c @@ -178,7 +178,7 @@ __pd_downloader_callback(GstBus *bus, GstMessage *msg, gpointer data) pd->total_size = size; - LOGD("PD total size : %lld bytes\n", size); + LOGD("PD total size : %"G_GINT64_FORMAT" bytes", size); } break; @@ -233,7 +233,7 @@ int _mmplayer_get_pd_downloader_status(MMHandleType handle, guint64 *current_pos g_object_get(pd->downloader_sink, "current-bytes", &bytes, NULL); - LOGD("PD status : %lld / %lld\n", bytes, pd->total_size); + LOGD("PD status : %"G_GUINT64_FORMAT" / %"G_GINT64_FORMAT, bytes, pd->total_size); *current_pos = bytes; *total_size = pd->total_size; diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index e164e2f..8c32bf7 100755 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -205,8 +205,8 @@ static gboolean __gst_seek(mm_player_t* player, GstElement * element, gdouble ra gint64 cur, GstSeekType stop_type, gint64 stop); static int __gst_pending_seek(mm_player_t* player); -static int __gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called); -static int __gst_get_position(mm_player_t* player, int format, unsigned long *position); +static int __gst_set_position(mm_player_t* player, int format, gint64 position, gboolean internal_called); +static int __gst_get_position(mm_player_t* player, int format, gint64 *position); static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos); static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int position); static int __gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param); @@ -344,17 +344,18 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) missing_only = FALSE; } - if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all) { + if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all) { LOGD("try to update duration"); has_duration = FALSE; - if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) { + if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec) && (dur_nsec > 0)) { player->duration = dur_nsec; - LOGW("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec)); + LOGW("duration : %"G_GINT64_FORMAT" msec", GST_TIME_AS_MSECONDS(dur_nsec)); + has_duration = TRUE; } if (player->duration < 0) { - LOGW("duration : %lld is Non-Initialized !!! \n", player->duration); + LOGW("duration is Non-Initialized !!!"); player->duration = 0; } @@ -364,11 +365,7 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) /* check duration is OK */ if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player)) { /* FIXIT : find another way to get duration here. */ - LOGE("finally it's failed to get duration from pipeline. progressbar will not work correctely!"); - } else { - /*update duration */ - mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(dur_nsec)); - has_duration = TRUE; + LOGW("finally it's failed to get duration from pipeline. progressbar will not work correctely!"); } } @@ -465,8 +462,9 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) LOGD("no negitiated caps from videosink"); gst_object_unref(pad); pad = NULL; - } else + } else { LOGD("no videosink sink pad"); + } } } @@ -486,7 +484,7 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) } else if (MMPLAYER_IS_HTTP_STREAMING(player)) { data_size = player->http_content_size; } - LOGD("try to update bitrate : data_size = %lld", data_size); + LOGD("try to update bitrate : data_size = %"G_GUINT64_FORMAT, data_size); if (data_size) { guint64 bitrate = 0; @@ -748,12 +746,12 @@ __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg) MMHandleType attrs = 0; guint64 data_size = 0; gchar* path = NULL; - unsigned long pos_msec = 0; + gint64 pos_nsec = 0; struct stat sb; MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin); - __gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_msec); // update last_position + __gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_nsec); /* to update player->last_position */ attrs = MMPLAYER_GET_ATTRS(player); if (!attrs) { @@ -1296,7 +1294,7 @@ __mmplayer_gst_callback(GstMessage *msg, gpointer data) if ((MMPLAYER_IS_LIVE_STREAMING(player)) && (MMPLAYER_IS_RTSP_STREAMING(player))) { - LOGD("player->last_position=%lld , player->streamer->buffering_percent=%d \n", + LOGD("player->last_position=%"G_GINT64_FORMAT" , player->streamer->buffering_percent=%d \n", GST_TIME_AS_SECONDS(player->last_position), player->streamer->buffering_percent); if ((GST_TIME_AS_SECONDS(player->last_position) <= 0) && (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)) { @@ -1358,7 +1356,7 @@ __mmplayer_gst_callback(GstMessage *msg, gpointer data) if ((MMPLAYER_IS_RTSP_STREAMING(player)) && (player->pending_seek.is_pending)) { int retVal = MM_ERROR_NONE; - LOGD("trying to play from (%lu) pending position\n", player->pending_seek.pos); + LOGD("trying to play from (%"G_GINT64_FORMAT") pending position\n", player->pending_seek.pos); retVal = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, TRUE); @@ -1608,9 +1606,8 @@ __mmplayer_gst_callback(GstMessage *msg, gpointer data) gchar *video_frame_size = NULL; gst_structure_get(gst_message_get_structure(msg), "rtsp_duration", G_TYPE_UINT64, &player->duration, NULL); - LOGD("rtsp duration : %lld msec", GST_TIME_AS_MSECONDS(player->duration)); + LOGD("rtsp duration : %"G_GINT64_FORMAT" msec", GST_TIME_AS_MSECONDS(player->duration)); player->streaming_type = __mmplayer_get_stream_service_type(player); - mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(player->duration)); gst_structure_get(gst_message_get_structure(msg), "rtsp_audio_codec", G_TYPE_STRING, &audio_codec, NULL); LOGD("rtsp_audio_codec : %s", audio_codec); @@ -1744,7 +1741,7 @@ __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg) LOGD("msg src : [%s]", GST_ELEMENT_NAME(GST_ELEMENT_CAST(msg->src))); if (gst_element_query_duration(GST_ELEMENT_CAST(msg->src), GST_FORMAT_BYTES, &bytes)) { - LOGD("data total size of http content: %lld", bytes); + LOGD("data total size of http content: %"G_GINT64_FORMAT, bytes); player->http_content_size = (bytes > 0) ? (bytes) : (0); } } else @@ -4192,7 +4189,7 @@ __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all) mm_player_audio_stream_buff_t *tmp = (mm_player_audio_stream_buff_t *)l->data; if (tmp) { if (send_all) { - LOGD("[%lld] send remained data.", tmp->channel_mask); + LOGD("[%"G_GUINT64_FORMAT"] send remained data.", tmp->channel_mask); __mmplayer_audio_stream_send_data(player, tmp); } if (tmp->pcm_data) @@ -4223,7 +4220,7 @@ __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_bu audio_stream.data_size = a_buffer->data_size; audio_stream.data = a_buffer->pcm_data; - /* LOGD("[%lld] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param); */ + /* LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param); */ player->audio_stream_render_cb_ex(&audio_stream, player->audio_stream_cb_user_param); MMPLAYER_FLEAVE(); @@ -4270,7 +4267,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer, mm_player_audio_stream_buff_t *tmp = (mm_player_audio_stream_buff_t *)l->data; if (tmp) { if (channel_mask == tmp->channel_mask) { - /* LOGD("[%lld] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size); */ + /* LOGD("[%"G_GUINT64_FORMAT"] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size); */ if (tmp->data_size + a_size < tmp->buff_size) { memcpy(tmp->pcm_data + tmp->data_size, a_data, a_size); tmp->data_size += a_size; @@ -4279,7 +4276,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer, __mmplayer_audio_stream_send_data(player, tmp); if (a_size > tmp->buff_size) { - LOGD("[%lld] adj buffer size %d -> %d", channel_mask, tmp->buff_size, a_size); + LOGD("[%"G_GUINT64_FORMAT"] adj buffer size %d -> %d", channel_mask, tmp->buff_size, a_size); tmp->pcm_data = g_realloc(tmp->pcm_data, a_size); if (tmp->pcm_data == NULL) { LOGE("failed to realloc data."); @@ -4323,7 +4320,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer, goto DONE; } memcpy(a_buffer->pcm_data, a_data, a_size); - /* LOGD("new [%lld] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size); */ + /* LOGD("new [%"G_GUINT64_FORMAT"] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size); */ player->audio_stream_buff_list = g_list_append(player->audio_stream_buff_list, a_buffer); } else { /* If sync is TRUE, send data directly. */ @@ -5062,7 +5059,7 @@ __mmplayer_video_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer, /* set size and timestamp */ dataBlock = gst_buffer_peek_memory(buffer, 0); stream->length_total = gst_memory_get_sizes(dataBlock, NULL, NULL); - stream->timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano sec -> mili sec */ + stream->timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/GST_MSECOND); /* nano sec -> mili sec */ /* check zero-copy */ if (player->set_mode.video_zc && @@ -6027,39 +6024,6 @@ static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int p return MM_ERROR_NONE; } -static int __gst_adjust_video_position(mm_player_t* player, int offset) -{ - MMPLAYER_FENTER(); - LOGD("adjusting video_pos in player") ; - int current_pos = 0; - /* check player and videobin are created */ - MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED); - if (!player->pipeline->videobin || - !player->pipeline->videobin[MMPLAYER_V_SINK].gst) { - LOGD("no video pipeline or sink is there"); - return MM_ERROR_PLAYER_INVALID_STATE ; - } - if (offset == 0) { - LOGD("nothing to do\n"); - MMPLAYER_FLEAVE(); - return MM_ERROR_NONE; - } - if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)¤t_pos) != MM_ERROR_NONE) { - LOGD("failed to get current position"); - return MM_ERROR_PLAYER_INTERNAL; - } - if ((current_pos - offset) < GST_TIME_AS_MSECONDS(player->duration)) { - LOGD("enter video delay is valid"); - } else { - LOGD("enter video delay is crossing content boundary"); - return MM_ERROR_INVALID_ARGUMENT ; - } - g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "ts-offset", ((gint64) offset * G_GINT64_CONSTANT(1000000)), NULL); - LOGD("video delay has been done"); - MMPLAYER_FLEAVE(); - - return MM_ERROR_NONE; -} static void __gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data) @@ -6695,7 +6659,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) __mm_player_streaming_set_queue2(player->streamer, element, TRUE, - player->ini.http_max_size_bytes + PLAYER_PD_EXT_MAX_SIZE_BYTE, + player->ini.http_max_size_bytes, // + PLAYER_PD_EXT_MAX_SIZE_BYTE, pre_buffering_time, 1.0, player->ini.http_buffering_limit, @@ -7184,7 +7148,7 @@ static int __gst_pending_seek(mm_player_t* player) return ret; } - LOGD("trying to play from(%lu) pending position\n", player->pending_seek.pos); + LOGD("trying to play from(%"G_GINT64_FORMAT") pending position\n", player->pending_seek.pos); ret = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, FALSE); @@ -7480,9 +7444,8 @@ int __gst_resume(mm_player_t* player, gboolean async) } static int -__gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called) +__gst_set_position(mm_player_t* player, int format, gint64 position, gboolean internal_called) { - unsigned long dur_msec = 0; gint64 dur_nsec = 0; gint64 pos_nsec = 0; gboolean ret = TRUE; @@ -7502,7 +7465,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo /* NOTE : duration cannot be zero except live streaming. * Since some element could have some timing problemn with quering duration, try again. */ - if (!player->duration) { + if (player->duration == 0) { if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) { /* For RTSP Streaming , duration is not returned in READY state. So seek to the previous position does not work properly. * Added a patch to postpone the actual seek when state changes to PLAY. Sending a fake SEEK_COMPLETED event to finish the current request. */ @@ -7519,13 +7482,6 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo } player->duration = dur_nsec; } - - if (player->duration) { - dur_msec = GST_TIME_AS_MSECONDS(player->duration); - } else { - LOGE("could not get the duration. fail to seek.\n"); - goto SEEK_ERROR; - } } LOGD("playback rate: %f\n", player->playback_rate); @@ -7544,7 +7500,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo gboolean seekable = FALSE; /* check position is valid or not */ - if (position > dur_msec) + if (position > player->duration) goto INVALID_ARGS; query = gst_query_new_seeking(GST_FORMAT_TIME); @@ -7562,7 +7518,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo gst_query_unref(query); /* keep seeking operation */ } - LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec); + LOGD("seeking to(%"G_GINT64_FORMAT") nsec, duration is %"G_GINT64_FORMAT" nsec\n", position, player->duration); /* For rtspsrc stack , npt-start value coming from server is used for finding the current position. But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing. @@ -7586,8 +7542,6 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo if (!internal_called) player->doing_seek = TRUE; - pos_nsec = position * G_GINT64_CONSTANT(1000000); - if ((MMPLAYER_IS_HTTP_STREAMING(player)) && (!player->videodec_linked)) { gint64 cur_time = 0; @@ -7607,6 +7561,8 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo __gst_pause(player, FALSE); } + pos_nsec = position; + /* rtsp streaming case, there is no sink after READY TO PAUSE state(no preroll state change). that's why set position through property. */ if ((MMPLAYER_IS_RTSP_STREAMING(player)) && @@ -7626,7 +7582,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo } if (!ret) { - LOGE("failed to set position. dur[%lu] pos[%lu] pos_msec[%llu]\n", dur_msec, position, pos_nsec); + LOGE("failed to set position."); goto SEEK_ERROR; } } @@ -7634,7 +7590,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo case MM_PLAYER_POS_FORMAT_PERCENT: { - LOGD("seeking to(%lu)%% \n", position); + LOGD("seeking to %"G_GINT64_FORMAT"%%", position); if (player->doing_seek) { LOGD("not completed seek"); @@ -7650,7 +7606,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo GST_FORMAT_TIME, seek_flags, GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); if (!ret) { - LOGE("failed to set position. dur[%lud] pos[%lud] pos_msec[%"G_GUINT64_FORMAT"]\n", dur_msec, position, pos_nsec); + LOGE("failed to set position. pos[%"G_GINT64_FORMAT"] dur[%"G_GINT64_FORMAT"] ", pos_nsec, player->duration); goto SEEK_ERROR; } } @@ -7677,13 +7633,15 @@ PENDING: player->pending_seek.format = format; player->pending_seek.pos = position; - LOGW("player current-state : %s, pending-state : %s, just preserve pending position(%lu).\n", - MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(player)), player->pending_seek.pos); + LOGW("player current-state : %s, pending-state : %s, just preserve pending position(%"G_GINT64_FORMAT").\n", + MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), + MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(player)), + player->pending_seek.pos); return MM_ERROR_NONE; INVALID_ARGS: - LOGE("invalid arguments, position : %ld dur : %ld format : %d \n", position, dur_msec, format); + LOGE("invalid arguments, position: %"G_GINT64_FORMAT" dur : %"G_GINT64_FORMAT" format : %d \n", position, player->duration, format); return MM_ERROR_INVALID_ARGUMENT; SEEK_ERROR: @@ -7694,10 +7652,10 @@ SEEK_ERROR: #define TRICKPLAY_OFFSET GST_MSECOND static int -__gst_get_position(mm_player_t* player, int format, unsigned long* position) +__gst_get_position(mm_player_t* player, int format, gint64* position) { MMPlayerStateType current_state = MM_PLAYER_STATE_NONE; - gint64 pos_msec = 0; + gint64 pos_nsec = 0; gboolean ret = TRUE; MMPLAYER_RETURN_VAL_IF_FAIL(player && position && player->pipeline && player->pipeline->mainbin, @@ -7709,47 +7667,47 @@ __gst_get_position(mm_player_t* player, int format, unsigned long* position) * please refer to below comments in details */ if (current_state != MM_PLAYER_STATE_PAUSED) - ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec); + ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec); /* NOTE : get last point to overcome some bad operation of some elements *(returning zero when getting current position in paused state * and when failed to get postion during seeking */ if ((current_state == MM_PLAYER_STATE_PAUSED) || (!ret)) { - LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state); + LOGD("pos_nsec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_nsec), ret, current_state); if (player->playback_rate < 0.0) - pos_msec = player->last_position - TRICKPLAY_OFFSET; + pos_nsec = player->last_position - TRICKPLAY_OFFSET; else - pos_msec = player->last_position; + pos_nsec = player->last_position; if (!ret) - pos_msec = player->last_position; + pos_nsec = player->last_position; else - player->last_position = pos_msec; + player->last_position = pos_nsec; - LOGD("returning last point : %"GST_TIME_FORMAT, GST_TIME_ARGS(pos_msec)); + LOGD("returning last point : %"GST_TIME_FORMAT, GST_TIME_ARGS(pos_nsec)); } else { - if (player->duration > 0 && pos_msec > player->duration) - pos_msec = player->duration; + if (player->duration > 0 && pos_nsec > player->duration) + pos_nsec = player->duration; - player->last_position = pos_msec; + player->last_position = pos_nsec; } switch (format) { case MM_PLAYER_POS_FORMAT_TIME: - *position = GST_TIME_AS_MSECONDS(pos_msec); + *position = pos_nsec; break; case MM_PLAYER_POS_FORMAT_PERCENT: { if (player->duration <= 0) { - LOGD("duration is [%lld], so returning position 0\n", player->duration); + LOGD("duration is [%"G_GINT64_FORMAT"], so returning position 0\n", player->duration); *position = 0; } else { - LOGD("postion is [%lld] msec , duration is [%lld] msec", pos_msec, player->duration); - *position = pos_msec * 100 / player->duration; + LOGD("position is [%"G_GINT64_FORMAT"] nsec , duration is [%"G_GINT64_FORMAT"] nsec", pos_nsec, player->duration); + *position = (gint64)(pos_nsec * 100 / player->duration); } break; } @@ -7771,7 +7729,7 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned l MMPlayerGstElement *mainbin = NULL; gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE; gint64 buffered_total = 0; - unsigned long position = 0; + gint64 position = 0; gint buffered_sec = -1; GstBufferingMode mode = GST_BUFFERING_STREAM; gint64 content_size_time = player->duration; @@ -7808,11 +7766,11 @@ static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned l return MM_ERROR_NONE; } - LOGD("pos %d ms, dur %d sec, len %"G_GUINT64_FORMAT" bytes", - position, (guint)(content_size_time/GST_SECOND), content_size_bytes); + LOGD("pos %"G_GINT64_FORMAT" msec, dur %d sec, len %"G_GUINT64_FORMAT" bytes", + GST_TIME_AS_MSECONDS(position), (guint)GST_TIME_AS_SECONDS(content_size_time), content_size_bytes); mainbin = player->pipeline->mainbin; - start_per = (gint)(floor(100 *(gdouble)(position*GST_MSECOND) / (gdouble)content_size_time)); + start_per = (gint)(floor(100 *(gdouble)position / (gdouble)content_size_time)); if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) { GstQuery *query = NULL; @@ -8171,7 +8129,7 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, LOGW("no need to interrupt, so leave"); } else { MMMessageParamType msg = {0, }; - unsigned long pos = 0; + gint64 pos = 0; player->interrupted_by_resource = TRUE; @@ -8180,7 +8138,7 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, LOGW("failed to get play position."); } else { msg.union_type = MM_MSG_UNION_TIME; - msg.time.elapsed = (unsigned int)pos; + msg.time.elapsed = pos; MMPLAYER_POST_MSG(player, MM_MESSAGE_PLAY_POSITION, &msg); } LOGD("video resource conflict so, resource will be freed by unrealizing"); @@ -9282,7 +9240,7 @@ int _mmplayer_pause(MMHandleType hplayer) { mm_player_t* player = (mm_player_t*)hplayer; - gint64 pos_msec = 0; + gint64 pos_nsec = 0; gboolean async = FALSE; gint ret = MM_ERROR_NONE; @@ -9319,10 +9277,10 @@ _mmplayer_pause(MMHandleType hplayer) *(returning zero when getting current position in paused state) of some * elements */ - if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec)) + if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec)) LOGW("getting current position failed in paused\n"); - player->last_position = pos_msec; + player->last_position = pos_nsec; /* For rtspsrc stack , npt-start value coming from server is used for finding the current position. But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing. @@ -9457,7 +9415,7 @@ int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming) { mm_player_t* player = (mm_player_t*)hplayer; - gint64 pos_msec = 0; + gint64 pos_nsec = 0; int ret = MM_ERROR_NONE; int mute = FALSE; signed long long start = 0, stop = 0; @@ -9485,22 +9443,22 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming) current_state = MMPLAYER_CURRENT_STATE(player); if (current_state != MM_PLAYER_STATE_PAUSED) - ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec); + ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec); - LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state); + LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_nsec), ret, current_state); if ((current_state == MM_PLAYER_STATE_PAUSED) || (!ret) /*|| (player->last_position != 0 && pos_msec == 0)*/) { - LOGW("returning last point : %lld\n", player->last_position); - pos_msec = player->last_position; + LOGW("returning last point : %"G_GINT64_FORMAT, player->last_position); + pos_nsec = player->last_position; } if (rate >= 0) { - start = pos_msec; + start = pos_nsec; stop = GST_CLOCK_TIME_NONE; } else { start = GST_CLOCK_TIME_NONE; - stop = pos_msec; + stop = pos_nsec; } if (!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, @@ -9521,7 +9479,7 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming) } int -_mmplayer_set_position(MMHandleType hplayer, int format, int position) +_mmplayer_set_position(MMHandleType hplayer, int format, gint64 position) { mm_player_t* player = (mm_player_t*)hplayer; int ret = MM_ERROR_NONE; @@ -9533,7 +9491,7 @@ _mmplayer_set_position(MMHandleType hplayer, int format, int position) /* check pipline building state */ __mmplayer_check_pipeline(player); - ret = __gst_set_position(player, format, (unsigned long)position, FALSE); + ret = __gst_set_position(player, format, position, FALSE); MMPLAYER_FLEAVE(); @@ -9541,7 +9499,7 @@ _mmplayer_set_position(MMHandleType hplayer, int format, int position) } int -_mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *position) +_mmplayer_get_position(MMHandleType hplayer, int format, gint64 *position) { mm_player_t* player = (mm_player_t*)hplayer; int ret = MM_ERROR_NONE; @@ -9554,36 +9512,33 @@ _mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *position } int -_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos) +_mmplayer_get_duration(MMHandleType hplayer, gint64 *duration) { mm_player_t* player = (mm_player_t*)hplayer; int ret = MM_ERROR_NONE; MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(duration, MM_ERROR_COMMON_INVALID_ARGUMENT); - ret = __gst_get_buffer_position(player, format, start_pos, stop_pos); - + *duration = player->duration; return ret; } int -_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position) +_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos) { mm_player_t* player = (mm_player_t*)hplayer; int ret = MM_ERROR_NONE; - MMPLAYER_FENTER(); - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - ret = __gst_adjust_subtitle_position(player, format, position); - - MMPLAYER_FLEAVE(); + ret = __gst_get_buffer_position(player, format, start_pos, stop_pos); return ret; } + int -_mmplayer_adjust_video_postion(MMHandleType hplayer, int offset) +_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position) { mm_player_t* player = (mm_player_t*)hplayer; int ret = MM_ERROR_NONE; @@ -9592,7 +9547,7 @@ _mmplayer_adjust_video_postion(MMHandleType hplayer, int offset) MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - ret = __gst_adjust_video_position(player, offset); + ret = __gst_adjust_subtitle_position(player, format, position); MMPLAYER_FLEAVE(); @@ -9829,14 +9784,14 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC qsrcpad = gst_element_get_static_pad(queue2, "src"); if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) { - LOGE("failed to link buffering queue\n"); + LOGE("failed to link buffering queue"); goto ERROR; } if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes)) - LOGE("fail to get duration.\n"); + LOGE("fail to get duration"); - LOGD("dur_bytes = %lld\n", dur_bytes); + LOGD("dur_bytes = %"G_GINT64_FORMAT, dur_bytes); muxed_buffer_type_e type = MUXED_BUFFER_TYPE_MEM_QUEUE; @@ -9855,9 +9810,9 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC // if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux")) if (!g_strrstr(player->type, "video/mpegts")) { max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE) ? (player->ini.http_max_size_bytes) : (5*1024*1024); - LOGD("max_buffer_size_bytes = %d\n", max_buffer_size_bytes); + LOGD("max_buffer_size_bytes = %d", max_buffer_size_bytes); - // FIXME : pass ini setting directly. is this ok? + /* FIXME : pass ini setting directly. is this ok? */ __mm_player_streaming_set_queue2(player->streamer, queue2, FALSE, @@ -12419,8 +12374,7 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c /* do get/set position for new videosink plugin */ { - unsigned long position = 0; - gint64 pos_msec = 0; + gint64 position = 0; LOGD("do get/set position for new videosink plugin"); if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position)) { @@ -12435,10 +12389,9 @@ __mmplayer_do_change_videosink(mm_player_t* player, const int dec_index, const c } #else /* key unit seek */ - pos_msec = position * G_GINT64_CONSTANT(1000000); ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, 1.0, GST_FORMAT_TIME, (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), - GST_SEEK_TYPE_SET, pos_msec, + GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); if (!ret) { LOGE("failed to set position"); @@ -12544,7 +12497,7 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player) goto ERROR; } - LOGD("seek time = %lld, rate = %f\n", time, player->playback_rate); + LOGD("seek time = %"G_GINT64_FORMAT", rate = %f", time, player->playback_rate); event = gst_event_new_seek(player->playback_rate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1); if (event) { __gst_send_event_to_sink(player, event); @@ -12989,12 +12942,8 @@ _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable) } int -_mmplayer_set_video_share_master_clock(MMHandleType hplayer, - long long clock, - long long clock_delta, - long long video_time, - long long media_clock, - long long audio_time) +_mmplayer_set_video_share_master_clock(MMHandleType hplayer, gint64 clock, gint64 clock_delta, + gint64 video_time, gint64 media_clock, gint64 audio_time) { mm_player_t* player = (mm_player_t*) hplayer; MMPlayerGstElement* mainbin = NULL; @@ -13015,10 +12964,11 @@ _mmplayer_set_video_share_master_clock(MMHandleType hplayer, MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED); MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED); - // LOGD("in(us) : %lld, %lld, %lld, %lld, %lld", clock, clock_delta, video_time, media_clock, audio_time); + /* LOGD("in(us) : %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT, + clock, clock_delta, video_time, media_clock, audio_time); */ if ((video_time < 0) || (player->doing_seek)) { - LOGD("skip setting master clock. %lld", video_time); + LOGD("skip setting master clock. %lld", video_time); goto EXIT; } @@ -13035,7 +12985,7 @@ _mmplayer_set_video_share_master_clock(MMHandleType hplayer, if ((current_state != MM_PLAYER_STATE_PLAYING) || (!query_ret)) { position = player->last_position; - LOGD("query fail. %lld", position); + LOGD("query fail. %"G_GINT64_FORMAT, position); } clock *= GST_USECOND; @@ -13054,7 +13004,7 @@ _mmplayer_set_video_share_master_clock(MMHandleType hplayer, position_delta *= GST_USECOND; adj_base_time = position_delta; - LOGD("video_share_clock_delta = %lld, adj = %lld", player->video_share_clock_delta, adj_base_time); + LOGD("video_share_clock_delta = %"G_GINT64_FORMAT", adj = %"G_GINT64_FORMAT, player->video_share_clock_delta, adj_base_time); } else { gint64 new_play_time = 0; @@ -13067,7 +13017,8 @@ _mmplayer_set_video_share_master_clock(MMHandleType hplayer, adj_base_time = position - new_play_time; - LOGD("%lld(delay) = %lld - %lld / %lld(adj) = %lld(slave_pos) - %lld(master_pos) - %lld(delay)", + LOGD("%"G_GINT64_FORMAT"(delay) = %"G_GINT64_FORMAT" - %"G_GINT64_FORMAT" / %"G_GINT64_FORMAT + "(adj) = %"G_GINT64_FORMAT"(slave_pos) - %"G_GINT64_FORMAT"(master_pos) - %"G_GINT64_FORMAT"(delay)", network_delay, clock_delta, player->video_share_clock_delta, adj_base_time, position, video_time, network_delay); } @@ -13118,10 +13069,7 @@ EXIT: } int -_mmplayer_get_video_share_master_clock(MMHandleType hplayer, - long long *video_time, - long long *media_clock, - long long *audio_time) +_mmplayer_get_video_share_master_clock(MMHandleType hplayer, gint64 *video_time, gint64 *media_clock, gint64 *audio_time) { mm_player_t* player = (mm_player_t*) hplayer; MMPlayerGstElement* mainbin = NULL; @@ -13155,7 +13103,7 @@ _mmplayer_get_video_share_master_clock(MMHandleType hplayer, *media_clock = *video_time = *audio_time = (position/GST_USECOND); - LOGD("media_clock: %lld, video_time: %lld(us)", *media_clock, *video_time); + LOGD("media_clock: %"G_GINT64_FORMAT", video_time: %"G_GINT64_FORMAT"(us)", *media_clock, *video_time); if (curr_clock) gst_object_unref(curr_clock); diff --git a/src/mm_player_streaming.c b/src/mm_player_streaming.c index 30ad6d8..2393461 100644 --- a/src/mm_player_streaming.c +++ b/src/mm_player_streaming.c @@ -316,8 +316,8 @@ static void streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, muxed_buffer_type_e type, gchar * file_path, guint64 content_size) { streaming_buffer_t* buffer_handle = NULL; - guint64 storage_available_size = 0L; //bytes - guint64 buffer_size = 0L; //bytes + guint64 storage_available_size = 0; //bytes + guint64 buffer_size = 0; //bytes gchar file_buffer_name[MM_MAX_URL_LEN] = {0}; struct statfs buf = {0}; gchar* factory_name = NULL; @@ -384,7 +384,7 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, muxed_buffer_ty buffer_size = (guint64)((streamer->ring_buffer_size > 0) ? (streamer->ring_buffer_size) : DEFAULT_RING_BUFFER_SIZE); } - LOGW("[Queue2] set ring buffer size: %lld\n", buffer_size); + LOGW("[Queue2] set ring buffer size: %"G_GUINT64_FORMAT, buffer_size); g_object_set(G_OBJECT(buffer_handle->buffer), "ring-buffer-max-size", buffer_size, NULL); MMPLAYER_FLEAVE(); @@ -597,7 +597,7 @@ streaming_get_current_bitrate_info(mm_player_streaming_t* streamer, gst_message_parse_buffering_stats(buffering_msg, &mode, &in_rate, &out_rate, &buffering_left); } - LOGD("Streaming Info : in %d, out %d, left %lld\n", in_rate, out_rate, buffering_left); + LOGD("Streaming Info : in %d, out %d, left %"G_GINT64_FORMAT, in_rate, out_rate, buffering_left); if ((content_info.content_size > 0) && (content_info.duration > 0) && ((content_info.duration/GST_SECOND) > 0)) estimated_content_bitrate = GET_BIT_FROM_BYTE((guint)(content_info.content_size / (content_info.duration/GST_SECOND))); @@ -700,7 +700,7 @@ streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer, MMPLAYER_RETURN_IF_FAIL(streamer); MMPLAYER_RETURN_IF_FAIL(buffer_info); - LOGD("pos %lld, dur %lld, size %lld, in/out:%d/%d, buffer_criteria:%d, time_rate:%d, need:%d ms\n", + LOGD("pos %"G_GINT64_FORMAT", dur %"G_GINT64_FORMAT", size %"G_GUINT64_FORMAT", in/out:%d/%d, buffer_criteria:%d, time_rate:%d, need:%d ms\n", content_info.position, content_info.duration, content_info.content_size, bitrate_info.byte_in_rate, bitrate_info.byte_out_rate, bitrate_info.buffer_criteria, bitrate_info.time_rate, expected_play_time); @@ -773,7 +773,7 @@ streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer, static void streaming_update_buffer_setting(mm_player_streaming_t* streamer, - GstMessage *buffering_msg, // can be null + GstMessage *buffering_msg, /* can be null */ guint64 content_size, gint64 position, gint64 duration) @@ -892,9 +892,9 @@ streaming_adjust_min_threshold(mm_player_streaming_t* streamer, gint64 position) playing_time = (gint)((position - streamer->default_val.prev_pos) / GST_MSECOND); - LOGD("buffering monitor = %s\n", (streamer->default_val.buffering_monitor) ? "ON" : "OFF"); - LOGD("playing_time (%d ms) = %lld - %lld \n", playing_time, position, streamer->default_val.prev_pos); - LOGD("default time : %d, prev buffering t : %d\n", + LOGD("buffering monitor = %s", (streamer->default_val.buffering_monitor) ? "ON" : "OFF"); + LOGD("playing_time (%d ms) = %"G_GINT64_FORMAT" - %"G_GINT64_FORMAT, playing_time, position, streamer->default_val.prev_pos); + LOGD("default time : %d, prev buffering t : %d", streamer->default_val.buffering_time, streamer->buffer_handle[streamer->streaming_buffer_type].buffering_time); if ((streamer->default_val.buffering_monitor) && (playing_time <= streamer->default_val.buffering_time)) { @@ -969,18 +969,15 @@ void __mm_player_streaming_buffering(mm_player_streaming_t* streamer, MMPLAYER_RETURN_IF_FAIL(GST_IS_MESSAGE(buffering_msg)); MMPLAYER_RETURN_IF_FAIL((GST_MESSAGE_TYPE(buffering_msg) == GST_MESSAGE_BUFFERING)); - if (buffering_msg) { - if (position > (gint64)(streamer->buffering_req.prebuffer_time * GST_MSECOND)) - streamer->buffering_req.is_pre_buffering = FALSE; - - streaming_update_buffering_status(streamer, buffering_msg, position); + if (position > (gint64)(streamer->buffering_req.prebuffer_time * GST_MSECOND)) + streamer->buffering_req.is_pre_buffering = FALSE; - if (!streamer->need_update) - return; + streaming_update_buffering_status(streamer, buffering_msg, position); - streamer->need_update = FALSE; - } + if (!streamer->need_update) + return; + streamer->need_update = FALSE; streaming_update_buffer_setting(streamer, buffering_msg, content_size, position, duration); return; diff --git a/src/mm_player_tracks.c b/src/mm_player_tracks.c index 5001bee..69553b2 100644 --- a/src/mm_player_tracks.c +++ b/src/mm_player_tracks.c @@ -93,7 +93,6 @@ int _mmplayer_select_track(MMHandleType hplayer, MMPlayerTrackType type, int ind if (type == MM_PLAYER_TRACK_TYPE_TEXT && player->subtitle_language_list) { GstElement *subparse = NULL; MMPlayerLangStruct *temp = NULL; - unsigned long cur_time = 0; guint num_of_list = 0; if (!player->pipeline || !player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst) { @@ -108,7 +107,6 @@ int _mmplayer_select_track(MMHandleType hplayer, MMPlayerTrackType type, int ind goto EXIT; } - _mmplayer_get_position(hplayer, MM_PLAYER_POS_FORMAT_TIME, &cur_time); temp = g_list_nth_data(player->subtitle_language_list, index); if (!temp) { LOGE("fail to get lang from list");