From: Eunhae Choi Date: Thu, 6 Dec 2018 07:28:28 +0000 (+0900) Subject: [0.6.156] remove progressive download path X-Git-Tag: submit/tizen/20181206.101556^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F194609%2F2;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [0.6.156] remove progressive download path Change-Id: Ice47ed6ea334cefcdf664a46fef94242a29a93f4 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 94125e5..1151315 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.155 +Version: 0.6.156 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/Makefile.am b/src/Makefile.am index e5a29ac..04cd36b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,6 @@ libmmfplayer_la_SOURCES = mm_player.c \ mm_player_priv.c \ mm_player_utils.c \ mm_player_capture.c \ - mm_player_pd.c \ mm_player_streaming.c \ mm_player_tracks.c \ mm_player_audioeffect.c \ @@ -45,7 +44,6 @@ noinst_HEADERS = include/mm_player_utils.h \ include/mm_player_priv.h \ include/mm_player_attrs.h \ include/mm_player_capture.h \ - include/mm_player_pd.h \ include/mm_player_tracks.h \ include/mm_player_streaming.h \ include/mm_player_es.h \ diff --git a/src/include/mm_player.h b/src/include/mm_player.h index c3ca597..2836928 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -205,12 +205,6 @@ * track number inside a collection (int) */ #define MM_PLAYER_TAG_TRACK_NUM "tag_track_num" -/** - * MM_PLAYER_PD_MODE - * - * progressive download mode (int) - */ -#define MM_PLAYER_PD_MODE "pd_mode" /** * MM_PLAYER_DRC_MODE @@ -323,15 +317,6 @@ typedef enum { MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */ } MMPlayerAttrsFlag; -/** - * Enumeration for progressive download - */ -typedef enum { - MM_PLAYER_PD_MODE_NONE, - MM_PLAYER_PD_MODE_URI, - MM_PLAYER_PD_MODE_FILE // not tested yet, because of no fixed scenario -} MMPlayerPDMode; - /** * Enumeration of track types */ @@ -1108,60 +1093,6 @@ if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE) { */ int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info); -/** - * This function is to get download position and total size of progressive download - * - * @param player [in] Handle of player. - * @param current_pos [in] Download position currently (bytes) - * @param total_size [in] Total size of file (bytes) - * - * @return This function returns zero on success, or negative value with error code. - * @par Example - * @code -guint64 current_pos = 0LLU; -guint64 total_size = 0LLU; - -if (mm_player_get_pd_status(g_player, ¤t_pos, &total_size, NULL) != MM_ERROR_NONE) -{ - LOGD("current download pos = %llu, total size = %llu\n", current_pos, total_size); -} - * @endcode - */ -int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size); - -/** - * This function sets callback function for receiving messages of PD downloader. - * - * @param player [in] Handle of player. - * @param callback [in] Message callback function. - * @param user_param [in] User parameter which is passed to callback function. - * - * @return This function returns zero on success, or negative value with error code. - * @see - * @remark None - * @par Example - * @code -int msg_callback(int message, MMMessageParamType *param, void *user_param) -{ - switch (message) - { - case MM_MESSAGE_PD_DOWNLOADER_START: - LOGD("Progressive download is started...\n"); - break; - case MM_MESSAGE_PD_DOWNLOADER_END: - LOGD("Progressive download is ended...\n"); - break; - default: - break; - } - return TRUE; -} - -mm_player_set_pd_message_callback(g_player, msg_callback, NULL); - * @endcode - */ -int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param); - /** * This function is to get the track count * diff --git a/src/include/mm_player_gst.h b/src/include/mm_player_gst.h index 229462e..b194b12 100644 --- a/src/include/mm_player_gst.h +++ b/src/include/mm_player_gst.h @@ -76,7 +76,6 @@ 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); GstElement* __mmplayer_gst_create_source(mm_player_t* player); int __mmplayer_gst_build_es_pipeline(mm_player_t* player); -int __mmplayer_gst_build_pd_pipeline(mm_player_t* player); int __mmplayer_gst_build_pipeline(mm_player_t* player); int __mmplayer_gst_add_bus_watch(mm_player_t* player); diff --git a/src/include/mm_player_pd.h b/src/include/mm_player_pd.h deleted file mode 100644 index 2841603..0000000 --- a/src/include/mm_player_pd.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * libmm-player - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: JongHyuk Choi , naveen cherukuri , - * YeJin Cho , YoungHwan An - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef __MM_PLAYER_PD_H__ -#define __MM_PLAYER_PD_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus - extern "C" { -#endif - -typedef struct { - gchar *path_read_from; // path for download and playback - gchar *location_to_save; // path for saving to local - gint64 total_size; // size of file to download (bytes) - GMutex pd_mutex; - GstElement *playback_pipeline_src; // src element of playback pipeline - GstElement *downloader_pipeline; - GstElement *downloader_src; - GstElement *downloader_queue; - GstElement *downloader_sink; -} mm_player_pd_t; - -/** - * This function allocates handle of progressive download. - * - * @return This function returns allocated handle. - * @remarks - * @see _mmplayer_destroy_pd_downloader() - * - */ -mm_player_pd_t * _mmplayer_create_pd_downloader(); -/** - * This function destroy progressive download. - * - * @param[in] handle Handle of player. - * @return This function returns true on success, or false on failure. - * @remarks - * @see _mmplayer_create_pd_downloader() - * - */ -gboolean _mmplayer_destroy_pd_downloader(MMHandleType handle); -/** - * This function realize progressive download. - * - * @param[in] handle Handle of player. - * @param[in] src_uri path to download. - * @param[in] dst_uri path to save in local system. - * @param[in] pushsrc source element of playback pipeline - * @return This function returns true on success, or false on failure. - * @remarks - * @see - * - */ -gboolean _mmplayer_realize_pd_downloader(MMHandleType handle, gchar *src_uri, gchar *dst_uri, GstElement *pushsrc); -/** - * This function unrealize progressive download. - * - * @param[in] handle Handle of player. - * @return This function returns true on success, or false on failure. - * @remarks - * @see _mmplayer_realize_pd_downloader() - * - */ -gboolean _mmplayer_unrealize_pd_downloader(MMHandleType handle); -/** - * This function start progressive download. - * - * @param[in] handle Handle of player. - * @return This function returns true on success, or false on failure. - * @remarks - * @see - * - */ -gboolean _mmplayer_start_pd_downloader(MMHandleType handle); -/** - * This function get pd current status. - * - * @param[in] handle Handle of player. - * @param[out] current_pos current downloaded size - * @param[out] total_size total file size to download - * @return This function returns zero on success, or negative value with error - * @remarks - * @see - * - */ -int _mmplayer_get_pd_downloader_status(MMHandleType handle, guint64 *current_pos, guint64 *total_size); -/** - * This function set message callback of PD downloader. - * - * @param[in] handle Handle of player. - * @param[in] MMMessageCallback Message callback function - * @param[in] user_param User parameter which is passed to callback function. - * @return This function returns true on success, or false on failure. - * @remarks - * @see - * - */ -gint _mm_player_set_pd_downloader_message_cb(MMHandleType player, MMMessageCallback callback, gpointer user_param); - -#ifdef __cplusplus - } -#endif - -#endif diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index 535392d..879b645 100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -44,7 +44,6 @@ #include "mm_message.h" #include "mm_player_ini.h" #include -#include "mm_player_pd.h" #include "mm_player_streaming.h" /*=========================================================================================== @@ -60,12 +59,6 @@ #define MM_PLAYER_STREAM_COUNT_MAX 3 #define MM_PLAYER_CAST(x_player) ((mm_player_t *)(x_player)) -/** - * @x_player: MMHandleType of player - * - * Get the PD downloader of this player. - */ -#define MM_PLAYER_GET_PD(x_player) (MM_PLAYER_CAST(x_player)->pd_downloader) /** * @x_player: MMHandleType of player * @@ -577,11 +570,6 @@ typedef struct { MMMessageCallback msg_cb; void *msg_cb_param; - /* progressive download */ - mm_player_pd_t *pd_downloader; - gchar *pd_file_save_path; - MMPlayerPDMode pd_mode; - /* streaming player */ mm_player_streaming_t *streamer; gchar *http_file_buffering_path; @@ -749,10 +737,6 @@ typedef struct { gboolean play_subtitle; gboolean is_subtitle_force_drop; // set TRUE after bus_cb get EOS - /* PD downloader message callback and param */ - MMMessageCallback pd_msg_cb; - void *pd_msg_cb_param; - /* adjust subtitle position store */ gint64 adjust_subtitle_pos; GList *subtitle_language_list; diff --git a/src/include/mm_player_streaming.h b/src/include/mm_player_streaming.h index 079eb2e..3c01b80 100644 --- a/src/include/mm_player_streaming.h +++ b/src/include/mm_player_streaming.h @@ -136,7 +136,6 @@ typedef struct { MMPlayerBufferingState buffering_state; gboolean is_adaptive_streaming; - gboolean is_pd_mode; gint buffering_percent; guint buffer_max_bitrate; diff --git a/src/include/mm_player_utils.h b/src/include/mm_player_utils.h index f46880b..70a9eab 100644 --- a/src/include/mm_player_utils.h +++ b/src/include/mm_player_utils.h @@ -252,7 +252,6 @@ LOGD("-- prev %s, current %s, pending %s, target %s --", \ #define MMPLAYER_IS_STREAMING(x_player) __is_streaming(x_player) #define MMPLAYER_IS_RTSP_STREAMING(x_player) __is_rtsp_streaming(x_player) #define MMPLAYER_IS_HTTP_STREAMING(x_player) __is_http_streaming(x_player) -#define MMPLAYER_IS_HTTP_PD(x_player) __is_http_progressive_down(x_player) #define MMPLAYER_IS_HTTP_LIVE_STREAMING(x_player) __is_http_live_streaming(x_player) #define MMPLAYER_IS_LIVE_STREAMING(x_player) __is_live_streaming(x_player) #define MMPLAYER_IS_DASH_STREAMING(x_player) __is_dash_streaming(x_player) @@ -280,7 +279,6 @@ gboolean __is_http_streaming(mm_player_t* player); gboolean __is_http_live_streaming(mm_player_t* player); gboolean __is_dash_streaming(mm_player_t* player); gboolean __is_smooth_streaming(mm_player_t* player); -gboolean __is_http_progressive_down(mm_player_t* player); gboolean __is_ms_buff_src(mm_player_t* player); gboolean __has_suffix(mm_player_t* player, const gchar* suffix); diff --git a/src/mm_player.c b/src/mm_player.c index 8001d7d..326f9b3 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -184,17 +184,6 @@ int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callba return result; } -int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param); - - return result; -} - int mm_player_set_audio_stream_callback(MMHandleType player, bool sync, mm_player_audio_stream_callback callback, void *user_param) { int result = MM_ERROR_NONE; @@ -580,19 +569,6 @@ int mm_player_get_attribute_info(MMHandleType player, const char *attribute_nam return result; } -int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT); - MMPLAYER_RETURN_VAL_IF_FAIL(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT); - - result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size); - - return result; -} - int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count) { int result = MM_ERROR_NONE; diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index 3d0454f..24d8415 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -638,24 +638,6 @@ _mmplayer_construct_attribute(MMHandleType handle) 0, MMPLAYER_MAX_INT }, - { - "pd_mode", - MM_ATTRS_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void *) MM_PLAYER_PD_MODE_NONE, - MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_PLAYER_PD_MODE_NONE, - MM_PLAYER_PD_MODE_URI // not tested yet, because of no fixed scenario - }, - { - "pd_location", // location of the file to write - MM_ATTRS_TYPE_STRING, - MM_ATTRS_FLAG_RW, - (void *) NULL, - MM_ATTRS_VALID_TYPE_NONE, - 0, - 0 - }, { "accurate_seek", MM_ATTRS_TYPE_INT, diff --git a/src/mm_player_gst.c b/src/mm_player_gst.c index 11749a6..81066be 100644 --- a/src/mm_player_gst.c +++ b/src/mm_player_gst.c @@ -1488,9 +1488,6 @@ __mmplayer_gst_handle_error_message(mm_player_t* player, GstMessage *msg) LOGE("error debug : %s", debug); } - if (MMPLAYER_IS_HTTP_PD(player)) - _mmplayer_unrealize_pd_downloader((MMHandleType)player); - MMPLAYER_FREEIF(debug); g_error_free(error); @@ -1512,23 +1509,7 @@ __mmplayer_gst_handle_buffering_message(mm_player_t* player, GstMessage *msg) return; } - if (player->pd_mode == MM_PLAYER_PD_MODE_URI) { - if (!MMPLAYER_CMD_TRYLOCK(player)) { - /* skip the playback control by buffering msg while user request is handled. */ - gint per = 0; - - LOGW("[PD mode] can't get cmd lock, only post buffering msg"); - - gst_message_parse_buffering(msg, &per); - LOGD("[PD mode][%s] buffering %d %%....", GST_OBJECT_NAME(GST_MESSAGE_SRC(msg)), per); - - msg_param.connection.buffering = per; - MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param); - return; - } - } else { - MMPLAYER_CMD_LOCK(player); - } + MMPLAYER_CMD_LOCK(player); if (!player->streamer) { LOGW("Pipeline is shutting down"); @@ -3090,7 +3071,7 @@ int __mmplayer_gst_stop(mm_player_t* player) (player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked)) rewind = TRUE; - if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) { + if (player->es_player_push_mode) { /* disable the async state transition because there could be no data in the pipeline */ __mmplayer_gst_set_async(player, FALSE, MMPLAYER_SINK_ALL); } @@ -3098,7 +3079,7 @@ int __mmplayer_gst_stop(mm_player_t* player) /* set gst state */ ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, FALSE, timeout); - if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) { + if (player->es_player_push_mode) { /* enable the async state transition as default operation */ __mmplayer_gst_set_async(player, TRUE, MMPLAYER_SINK_ALL); } @@ -3757,138 +3738,6 @@ int __mmplayer_gst_build_es_pipeline(mm_player_t* player) return MM_ERROR_NONE; } -int __mmplayer_gst_build_pd_pipeline(mm_player_t* player) -{ - MMPlayerGstElement *mainbin = NULL; - GstElement *pd_src = NULL; - GstElement *pd_queue = NULL; - GstElement *pd_decodebin = NULL; - GList* element_bucket = NULL; - MMHandleType attrs = 0; - gchar *path = NULL; - gint pre_buffering_time = player->streamer->buffering_req.prebuffer_time; - - MMPLAYER_FENTER(); - MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && - player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED); - - /* get profile attribute */ - attrs = MMPLAYER_GET_ATTRS(player); - if (!attrs) { - LOGE("failed to get content attribute"); - return MM_ERROR_PLAYER_INTERNAL; - } - - LOGD("http playback with progressive download : %d", player->pd_mode); - - if (player->pd_mode == MM_PLAYER_PD_MODE_URI) { - mm_attrs_get_string_by_name(attrs, "pd_location", &path); - MMPLAYER_FREEIF(player->pd_file_save_path); - - SECURE_LOGD("PD Location : %s", path); - if (!path) { - LOGE("filed to find pd location"); - return MM_ERROR_PLAYER_INTERNAL; - } - - if (!util_get_storage_info(path, &player->storage_info[MMPLAYER_PATH_VOD])) { - LOGE("failed to get storage info"); - return MM_ERROR_PLAYER_INTERNAL; - } - player->pd_file_save_path = g_strdup(path); - } - - pd_src = gst_element_factory_make("pdpushsrc", "PD pushsrc"); - if (!pd_src) { - LOGE("failed to create PD push source"); - return MM_ERROR_PLAYER_INTERNAL; - } - - if (player->pd_mode == MM_PLAYER_PD_MODE_URI) - g_object_set(G_OBJECT(pd_src), "location", player->pd_file_save_path, NULL); - else - g_object_set(G_OBJECT(pd_src), "location", player->profile.uri, NULL); - - mainbin = player->pipeline->mainbin; - - /* take source element */ - mainbin[MMPLAYER_M_SRC].id = MMPLAYER_M_SRC; - mainbin[MMPLAYER_M_SRC].gst = pd_src; - element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_SRC]); - - /* setting queue */ - LOGD("Picked queue2 element(pre buffer : %d ms)", pre_buffering_time); - pd_queue = gst_element_factory_make("queue2", "queue2"); - if (!pd_queue) { - LOGE("failed to create pd buffer element"); - goto ERROR; - } - - /* take queue2 */ - mainbin[MMPLAYER_M_MUXED_S_BUFFER].id = MMPLAYER_M_MUXED_S_BUFFER; - mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = pd_queue; - element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_MUXED_S_BUFFER]); - - pre_buffering_time = (pre_buffering_time > 0) ? (pre_buffering_time) : (player->ini.http_buffering_time); - - player->streamer->is_pd_mode = TRUE; - - __mm_player_streaming_set_queue2(player->streamer, pd_queue, TRUE, - player->ini.http_max_size_bytes, pre_buffering_time, 1.0, - player->ini.http_buffering_limit, MUXED_BUFFER_TYPE_MEM_QUEUE, NULL, 0); - - pd_decodebin = __mmplayer_gst_make_decodebin(player); - if (!pd_decodebin) { - LOGE("failed to create decodebin"); - goto ERROR; - } - - /* default size of mq in decodebin is 2M - * but it can cause blocking issue during seeking depends on content. */ - g_object_set(G_OBJECT(pd_decodebin), "max-size-bytes", (5*1024*1024), NULL); - - mainbin[MMPLAYER_M_AUTOPLUG].id = MMPLAYER_M_AUTOPLUG; - mainbin[MMPLAYER_M_AUTOPLUG].gst = pd_decodebin; - - element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_AUTOPLUG]); - - /* add elements to pipeline */ - if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket)) { - LOGE("failed to add elements to pipeline"); - goto ERROR; - } - - /* linking elements in the bucket by added order. */ - if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) { - LOGE("failed to link some elements"); - goto ERROR; - } - - g_list_free(element_bucket); - - MMPLAYER_FLEAVE(); - return MM_ERROR_NONE; - -ERROR: - MMPLAYER_FREEIF(player->pd_file_save_path); - g_list_free(element_bucket); - - if (mainbin[MMPLAYER_M_SRC].gst) - gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_SRC].gst)); - - if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) - gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)); - - if (mainbin[MMPLAYER_M_AUTOPLUG].gst) - gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_AUTOPLUG].gst)); - - mainbin[MMPLAYER_M_SRC].gst = NULL; - mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = NULL; - mainbin[MMPLAYER_M_AUTOPLUG].gst = NULL; - - return MM_ERROR_PLAYER_INTERNAL; -} - int __mmplayer_gst_build_pipeline(mm_player_t* player) { MMPlayerGstElement *mainbin = NULL; diff --git a/src/mm_player_pd.c b/src/mm_player_pd.c deleted file mode 100644 index 33c172d..0000000 --- a/src/mm_player_pd.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * libmm-player - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: JongHyuk Choi , naveen cherukuri , - * YeJin Cho , YoungHwan An - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include "mm_player_pd.h" -#include "mm_player_utils.h" -#include "mm_player_priv.h" - -#define PD_STATE_CHANGE_TIMEOUT (30 * GST_SECOND) - -/*--------------------------------------------------------------------------------------- -| LOCAL FUNCTION PROTOTYPES: | ----------------------------------------------------------------------------------------*/ - -/* It's callback to process whenever there is some changes in PD downloader. */ -static gboolean __pd_downloader_callback(GstBus *bus, GstMessage *msg, gpointer data); - -/* This function posts messages to application. */ -/* Currently, MM_MESSAGE_PD_DOWNLOADER_START and MM_MESSAGE_PD_DOWNLOADER_END are used. */ -static gboolean __pd_downloader_post_message(mm_player_t * player, enum MMMessageType msgtype, MMMessageParamType* param); - -/*======================================================================================= -| FUNCTION DEFINITIONS | -=======================================================================================*/ -static gboolean -__pd_downloader_callback(GstBus *bus, GstMessage *msg, gpointer data) -{ - mm_player_t * player = NULL; - mm_player_pd_t *pd = NULL; - gboolean bret = TRUE; - - MMPLAYER_FENTER(); - - /* chech player handle */ - MMPLAYER_RETURN_VAL_IF_FAIL(data, MM_ERROR_INVALID_ARGUMENT); - - player = MM_PLAYER_CAST((MMHandleType)data); - - /* get PD downloader handle */ - pd = MM_PLAYER_GET_PD((MMHandleType)data); - - MMPLAYER_RETURN_VAL_IF_FAIL(pd, MM_ERROR_INVALID_ARGUMENT); - -// g_print("%s\n", GST_MESSAGE_TYPE_NAME(msg)); - - switch (GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - { - LOGD("PD Downloader EOS received....\n"); - - g_object_set(G_OBJECT(pd->playback_pipeline_src), "eos", TRUE, NULL); - - /* notify application that download is completed */ - __pd_downloader_post_message(player, MM_MESSAGE_PD_DOWNLOADER_END, NULL); - - #ifdef PD_SELF_DOWNLOAD - _mmplayer_unrealize_pd_downloader((MMHandleType)data); - #endif - } - break; - - case GST_MESSAGE_ERROR: - { - GError *error = NULL; - gchar* debug = NULL; - GstMessage *new_msg = NULL; - - /* get error code */ - gst_message_parse_error(msg, &error, &debug); - LOGE("GST_MESSAGE_ERROR = %s\n", debug); - - new_msg = gst_message_new_error(GST_OBJECT_CAST(pd->playback_pipeline_src), error, debug); - - /* notify application that pd has any error */ - gst_element_post_message(pd->playback_pipeline_src, new_msg); - - _mmplayer_unrealize_pd_downloader((MMHandleType)data); - MMPLAYER_FREEIF(debug); - g_error_free(error); - } - break; - - case GST_MESSAGE_WARNING: - { - char* debug = NULL; - GError* error = NULL; - - gst_message_parse_warning(msg, &error, &debug); - LOGW("warning : %s\n", error->message); - LOGW("debug : %s\n", debug); - - MMPLAYER_FREEIF(debug); - g_error_free(error); - } - break; - - case GST_MESSAGE_STATE_CHANGED: - { - GstState old_state, new_state; - gchar *src_name; - - /* get old and new state */ - gst_message_parse_state_changed(msg, &old_state, &new_state, NULL); - - if (old_state == new_state) - break; - - /* we only care about pipeline state changes */ - if (GST_MESSAGE_SRC(msg) != GST_OBJECT(pd->downloader_pipeline)) - break; - - src_name = gst_object_get_name(msg->src); - LOGD("%s changed state from %s to %s", src_name, - gst_element_state_get_name(old_state), - gst_element_state_get_name(new_state)); - g_free(src_name); - - switch (new_state) { - case GST_STATE_VOID_PENDING: - case GST_STATE_NULL: - case GST_STATE_READY: - case GST_STATE_PAUSED: - break; - - case GST_STATE_PLAYING: - /* notify application that download is stated */ - __pd_downloader_post_message(player, MM_MESSAGE_PD_DOWNLOADER_START, NULL); - break; - - default: - break; - } - } - break; - - case GST_MESSAGE_DURATION: - { - gint64 size = 0LL; - - /* get total size of download file, (bytes) */ - if (!gst_element_query_duration(pd->downloader_pipeline, GST_FORMAT_BYTES, &size)) { - GError *err = NULL; - GstMessage *new_msg = NULL; - - err = g_error_new(GST_STREAM_ERROR, GST_STREAM_ERROR_FAILED, "can't get total size"); - new_msg = gst_message_new_error(GST_OBJECT_CAST(pd->playback_pipeline_src), err, NULL); - gst_element_post_message(pd->playback_pipeline_src, new_msg); - - g_error_free(err); - - // TODO: check if playback pipeline is closed well or not - g_object_set(G_OBJECT(pd->playback_pipeline_src), "eos", TRUE, NULL); - - _mmplayer_unrealize_pd_downloader((MMHandleType)data); - - LOGE("failed to query total size for download\n"); - break; - } - - pd->total_size = size; - - LOGD("PD total size : %"G_GINT64_FORMAT" bytes", size); - } - break; - - default: - LOGW("unhandled message\n"); - break; - } - - MMPLAYER_FLEAVE(); - - return bret; -} - - -gboolean __pd_downloader_post_message(mm_player_t * player, enum MMMessageType msgtype, MMMessageParamType* param) -{ - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - - if (!player->pd_msg_cb) { - LOGW("no msg callback. can't post\n"); - return FALSE; - } - - player->pd_msg_cb(msgtype, param, player->pd_msg_cb_param); - - MMPLAYER_FLEAVE(); - - return TRUE; -} - - -int _mmplayer_get_pd_downloader_status(MMHandleType handle, guint64 *current_pos, guint64 *total_size) -{ - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - guint64 bytes = 0; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_INVALID_ARGUMENT); - - pd = MM_PLAYER_GET_PD(handle); - - MMPLAYER_RETURN_VAL_IF_FAIL(pd, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_RETURN_VAL_IF_FAIL(pd->downloader_pipeline, MM_ERROR_PLAYER_INVALID_STATE); - - if (!pd->total_size) { - LOGW("not ready to get total size\n"); - return MM_ERROR_PLAYER_INTERNAL; - } - - g_object_get(pd->downloader_sink, "current-bytes", &bytes, NULL); - - LOGD("PD status : %"G_GUINT64_FORMAT" / %"G_GINT64_FORMAT, bytes, pd->total_size); - - *current_pos = bytes; - *total_size = pd->total_size; - - MMPLAYER_FLEAVE(); - - return MM_ERROR_NONE; -} - - -mm_player_pd_t * _mmplayer_create_pd_downloader() -{ - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - - /* create PD handle */ - pd = (mm_player_pd_t *) malloc(sizeof(mm_player_pd_t)); - if (!pd) { - LOGE("Failed to create pd downloader handle...\n"); - return FALSE; - } - memset(pd, 0, sizeof(mm_player_pd_t)); - - MMPLAYER_FLEAVE(); - - return pd; -} - - -gboolean _mmplayer_destroy_pd_downloader(MMHandleType handle) -{ - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_INVALID_ARGUMENT); - - pd = MM_PLAYER_GET_PD(handle); - - if (pd && pd->downloader_pipeline) - _mmplayer_unrealize_pd_downloader(handle); - - if (pd) - g_mutex_clear(&pd->pd_mutex); - - /* release PD handle */ - MMPLAYER_FREEIF(pd); - - MMPLAYER_FLEAVE(); - - return TRUE; -} - - -gboolean _mmplayer_realize_pd_downloader(MMHandleType handle, gchar *src_uri, gchar *dst_uri, GstElement *pushsrc) -{ - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_RETURN_VAL_IF_FAIL(src_uri, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_RETURN_VAL_IF_FAIL(dst_uri, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_RETURN_VAL_IF_FAIL(pushsrc, MM_ERROR_INVALID_ARGUMENT); - - pd = MM_PLAYER_GET_PD(handle); - - /* initialize */ - pd->path_read_from = g_strdup(src_uri); - pd->location_to_save = g_strdup(dst_uri); - pd->playback_pipeline_src = pushsrc; - pd->total_size = 0LL; - g_mutex_init(&pd->pd_mutex); - - MMPLAYER_FLEAVE(); - - return TRUE; -} - - -gboolean _mmplayer_start_pd_downloader(MMHandleType handle) -{ - GstBus* bus = NULL; - gboolean bret = FALSE; - GstStateChangeReturn sret = GST_STATE_CHANGE_SUCCESS; - GstState cur_state; - GstState pending_state; - - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_INVALID_ARGUMENT); - - pd = MM_PLAYER_GET_PD(handle); - - /* pipeline */ - pd->downloader_pipeline = gst_pipeline_new("PD Downloader"); - if (NULL == pd->downloader_pipeline) { - LOGE("Can't create PD download pipeline..."); - return FALSE; - } - - /* source */ - pd->downloader_src = gst_element_factory_make("souphttpsrc", "PD HTTP download source"); - if (NULL == pd->downloader_src) { - LOGE("Can't create PD download src..."); - return FALSE; - } - - /* queue */ - pd->downloader_queue = gst_element_factory_make("queue", "PD download queue"); - if (NULL == pd->downloader_queue) { - LOGE("Can't create PD download queue..."); - return FALSE; - } - - /* filesink */ - pd->downloader_sink = gst_element_factory_make("filesink", "PD download sink"); - if (NULL == pd->downloader_sink) { - LOGE("Can't create PD download sink..."); - return FALSE; - } - - g_object_set(pd->downloader_sink, "sync", FALSE, NULL); - - /* Add to bin and link */ - gst_bin_add_many(GST_BIN(pd->downloader_pipeline), - pd->downloader_src, pd->downloader_queue, pd->downloader_sink, - NULL); - - bret = gst_element_link_many(pd->downloader_src, pd->downloader_queue, pd->downloader_sink, NULL); - if (FALSE == bret) { - LOGE("Can't link elements src and sink..."); - return FALSE; - } - - /* Get Bus and set callback to watch */ - bus = gst_pipeline_get_bus(GST_PIPELINE(pd->downloader_pipeline)); - gst_bus_add_watch(bus, __pd_downloader_callback, (gpointer)handle); - gst_object_unref(bus); - - /* Set URI on HTTP source */ - g_object_set(G_OBJECT(pd->downloader_src), "location", pd->path_read_from, NULL); - - /* set file download location on filesink*/ - g_object_set(G_OBJECT(pd->downloader_sink), "location", pd->location_to_save, NULL); - - SECURE_LOGD("src location = %s, save location = %s\n", pd->path_read_from, pd->location_to_save); - - g_mutex_lock(&pd->pd_mutex); - - /* Start to download */ - sret = gst_element_set_state(pd->downloader_pipeline, GST_STATE_PLAYING); - if (GST_STATE_CHANGE_FAILURE == sret) { - LOGE("PD download pipeline failed to go to PLAYING state..."); - g_mutex_unlock(&pd->pd_mutex); - return FALSE; - } - - LOGD("set_state :: sret = %d\n", sret); - - sret = gst_element_get_state(pd->downloader_pipeline, &cur_state, &pending_state, PD_STATE_CHANGE_TIMEOUT); - if (GST_STATE_CHANGE_FAILURE == sret) { - LOGE("PD download pipeline failed to do get_state..."); - g_mutex_unlock(&pd->pd_mutex); - return FALSE; - } - - LOGD("get-state :: sret = %d\n", sret); - - g_mutex_unlock(&pd->pd_mutex); - - MMPLAYER_FLEAVE(); - - return TRUE; -} - - -gboolean _mmplayer_unrealize_pd_downloader(MMHandleType handle) -{ - MMPLAYER_FENTER(); - - mm_player_pd_t * pd = NULL; - GstBus *bus = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, FALSE); - - pd = MM_PLAYER_GET_PD(handle); - - MMPLAYER_RETURN_VAL_IF_FAIL(pd && pd->downloader_pipeline, FALSE); - - g_mutex_lock(&pd->pd_mutex); - - bus = gst_pipeline_get_bus(GST_PIPELINE(pd->downloader_pipeline)); - gst_bus_remove_watch(bus); - gst_object_unref(bus); - - gst_element_set_state(pd->downloader_pipeline, GST_STATE_NULL); - gst_element_get_state(pd->downloader_pipeline, NULL, NULL, PD_STATE_CHANGE_TIMEOUT); - - gst_object_unref(G_OBJECT(pd->downloader_pipeline)); - pd->downloader_pipeline = NULL; - - /* free */ - MMPLAYER_FREEIF(pd->path_read_from); - MMPLAYER_FREEIF(pd->location_to_save); - - g_mutex_unlock(&pd->pd_mutex); - - MMPLAYER_FLEAVE(); - - return TRUE; -} - - -gint _mm_player_set_pd_downloader_message_cb(MMHandleType handle, MMMessageCallback callback, gpointer user_param) -{ - MMPLAYER_FENTER(); - - mm_player_t * player = NULL; - - MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_INVALID_ARGUMENT); - - player = MM_PLAYER_CAST((MMHandleType)handle); - - /* PD callback can be set as soon as player handle is created. - * So, player handle must have it. - */ - player->pd_msg_cb = callback; - player->pd_msg_cb_param = user_param; - - LOGD("msg_cb : %p msg_cb_param : %p\n", callback, user_param); - - MMPLAYER_FLEAVE(); - - return MM_ERROR_NONE; -} diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index e3503e0..da0f0a0 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -99,10 +99,6 @@ #define ADAPTIVE_VARIANT_DEFAULT_VALUE -1 /* auto */ -/* For PD mode */ -#define PLAYER_PD_EXT_MAX_SIZE_BYTE 1024 * 1024 * 3 -#define PLAYER_PD_STATE_CHANGE_TIME 20 /* sec */ - #define PLAYER_SPHERICAL_DEFAULT_YAW 0 /* sync from video360 plugin */ #define PLAYER_SPHERICAL_DEFAULT_PITCH 0 #define PLAYER_SPHERICAL_DEFAULT_H_FOV 120 @@ -177,10 +173,6 @@ static int __mmplayer_gst_adjust_subtitle_position(mm_player_t* player, int for static int __mmplayer_gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param); /* util */ -static int __mmplayer_realize_streaming_ext(mm_player_t* player); -static int __mmplayer_unrealize_streaming_ext(mm_player_t *player); -static int __mmplayer_start_streaming_ext(mm_player_t *player); -static int __mmplayer_destroy_streaming_ext(mm_player_t* player); static gboolean __mmplayer_verify_gapless_play_path(mm_player_t *player); static void __mmplayer_activate_next_source(mm_player_t *player, GstState target); static void __mmplayer_check_pipeline(mm_player_t* player); @@ -1402,8 +1394,7 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data) goto EXIT; } - if ((!MMPLAYER_IS_HTTP_PD(player)) && - (MMPLAYER_IS_HTTP_STREAMING(player)) && + if ((MMPLAYER_IS_HTTP_STREAMING(player)) && (!player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst) && (player->pipeline->mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)) { if (!__mmplayer_gst_set_queue2_buffering(player)) { @@ -3911,7 +3902,6 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) int ret = MM_ERROR_NONE; MMPlayerGstElement *mainbin = NULL; MMHandleType attrs = 0; - gint mode = MM_PLAYER_PD_MODE_NONE; MMPLAYER_FENTER(); MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); @@ -3949,18 +3939,11 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) player->pipeline->mainbin = mainbin; - /* check pd mode */ - mm_attrs_get_int_by_name(attrs, "pd_mode", &mode); - player->pd_mode = mode; - /* create the source and decoder elements */ - if (MMPLAYER_IS_MS_BUFF_SRC(player)) { + if (MMPLAYER_IS_MS_BUFF_SRC(player)) ret = __mmplayer_gst_build_es_pipeline(player); - } else if (MMPLAYER_IS_HTTP_STREAMING(player) && MMPLAYER_IS_HTTP_PD(player)) { - ret = __mmplayer_gst_build_pd_pipeline(player); - } else { + else ret = __mmplayer_gst_build_pipeline(player); - } if (ret != MM_ERROR_NONE) { LOGE("failed to create some elements"); @@ -4446,11 +4429,6 @@ _mmplayer_create_player(MMHandleType handle) goto ERROR; } - if (MMPLAYER_IS_HTTP_PD(player)) { - player->pd_downloader = NULL; - player->pd_file_save_path = NULL; - } - /* create video bo lock and cond */ g_mutex_init(&player->video_bo_mutex); g_cond_init(&player->video_bo_cond); @@ -4648,19 +4626,6 @@ ERROR: return FALSE; } -int -__mmplayer_destroy_streaming_ext(mm_player_t* player) -{ - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - if (player->pd_downloader || MMPLAYER_IS_HTTP_PD(player)) { - _mmplayer_destroy_pd_downloader((MMHandleType)player); - MMPLAYER_FREEIF(player->pd_file_save_path); - } - - return MM_ERROR_NONE; -} - static void __mmplayer_check_async_state_transition(mm_player_t* player) { @@ -4722,8 +4687,6 @@ _mmplayer_destroy(MMHandleType handle) /* check async state transition */ __mmplayer_check_async_state_transition(player); - __mmplayer_destroy_streaming_ext(player); - /* release gapless play thread */ if (player->gapless_play_thread) { MMPLAYER_GAPLESS_PLAY_THREAD_LOCK(player); @@ -4787,35 +4750,6 @@ _mmplayer_destroy(MMHandleType handle) return MM_ERROR_NONE; } -int -__mmplayer_realize_streaming_ext(mm_player_t* player) -{ - int ret = MM_ERROR_NONE; - - MMPLAYER_FENTER(); - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - if (MMPLAYER_IS_HTTP_PD(player)) { - gboolean bret = FALSE; - - player->pd_downloader = _mmplayer_create_pd_downloader(); - if (!player->pd_downloader) { - LOGE("Unable to create PD Downloader..."); - ret = MM_ERROR_PLAYER_NO_FREE_SPACE; - } - - bret = _mmplayer_realize_pd_downloader((MMHandleType)player, player->profile.uri, player->pd_file_save_path, player->pipeline->mainbin[MMPLAYER_M_SRC].gst); - - if (FALSE == bret) { - LOGE("Unable to create PD Downloader..."); - ret = MM_ERROR_PLAYER_NOT_INITIALIZED; - } - } - - MMPLAYER_FLEAVE(); - return ret; -} - int _mmplayer_realize(MMHandleType hplayer) { @@ -4862,9 +4796,7 @@ _mmplayer_realize(MMHandleType hplayer) return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT; } - if (MMPLAYER_IS_HTTP_PD(player)) - MMPLAYER_STATE_CHANGE_TIMEOUT(player) = PLAYER_PD_STATE_CHANGE_TIME; - else if (MMPLAYER_IS_STREAMING(player)) + if (MMPLAYER_IS_STREAMING(player)) MMPLAYER_STATE_CHANGE_TIMEOUT(player) = player->ini.live_state_change_timeout; else MMPLAYER_STATE_CHANGE_TIMEOUT(player) = player->ini.localplayback_state_change_timeout; @@ -4895,8 +4827,6 @@ _mmplayer_realize(MMHandleType hplayer) ret = __mmplayer_gst_realize(player); if (ret != MM_ERROR_NONE) LOGE("fail to realize the player.\n"); - else - ret = __mmplayer_realize_streaming_ext(player); MMPLAYER_BUS_MSG_THREAD_SIGNAL(player); @@ -4905,20 +4835,6 @@ _mmplayer_realize(MMHandleType hplayer) return ret; } -int -__mmplayer_unrealize_streaming_ext(mm_player_t *player) -{ - MMPLAYER_FENTER(); - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - /* destroy can called at anytime */ - if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player)) - _mmplayer_unrealize_pd_downloader((MMHandleType)player); - - MMPLAYER_FLEAVE(); - return MM_ERROR_NONE; -} - int _mmplayer_unrealize(MMHandleType hplayer) { @@ -4941,8 +4857,6 @@ _mmplayer_unrealize(MMHandleType hplayer) /* check async state transition */ __mmplayer_check_async_state_transition(player); - __mmplayer_unrealize_streaming_ext(player); - /* unrealize pipeline */ ret = __mmplayer_gst_unrealize(player); @@ -5219,38 +5133,6 @@ _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callba return MM_ERROR_NONE; } -static int -__mmplayer_start_streaming_ext(mm_player_t *player) -{ - gint ret = MM_ERROR_NONE; - - MMPLAYER_FENTER(); - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - if (MMPLAYER_IS_HTTP_PD(player)) { - if (!player->pd_downloader) { - ret = __mmplayer_realize_streaming_ext(player); - - if (ret != MM_ERROR_NONE) { - LOGE("failed to realize streaming ext\n"); - return ret; - } - } - - if (player->pd_downloader && player->pd_mode == MM_PLAYER_PD_MODE_URI) { - ret = _mmplayer_start_pd_downloader((MMHandleType)player); - if (!ret) { - LOGE("ERROR while starting PD...\n"); - return MM_ERROR_PLAYER_NOT_INITIALIZED; - } - ret = MM_ERROR_NONE; - } - } - - MMPLAYER_FLEAVE(); - return ret; -} - int _mmplayer_start(MMHandleType hplayer) { @@ -5264,13 +5146,6 @@ _mmplayer_start(MMHandleType hplayer) /* check current state */ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_START); - /* PD - start streaming */ - ret = __mmplayer_start_streaming_ext(player); - if (ret != MM_ERROR_NONE) { - LOGE("failed to start streaming ext 0x%X", ret); - return ret; - } - /* start pipeline */ ret = __mmplayer_gst_start(player); if (ret != MM_ERROR_NONE) @@ -5413,8 +5288,6 @@ _mmplayer_stop(MMHandleType hplayer) /* NOTE : application should not wait for EOS after calling STOP */ __mmplayer_cancel_eos_timer(player); - __mmplayer_unrealize_streaming_ext(player); - /* reset */ player->seek_state = MMPLAYER_SEEK_NONE; @@ -5986,7 +5859,7 @@ __mmplayer_gst_create_decoder(mm_player_t* player, GstPad *srcpad, const GstCaps mainbin = player->pipeline->mainbin; - if ((!MMPLAYER_IS_HTTP_PD(player)) && (MMPLAYER_IS_HTTP_STREAMING(player))) { + if (MMPLAYER_IS_HTTP_STREAMING(player)) { if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) { LOGW("need to check: muxed buffer is not null"); @@ -6060,8 +5933,7 @@ __mmplayer_gst_create_decoder(mm_player_t* player, GstPad *srcpad, const GstCaps /* set decodebin property about buffer in streaming playback. * * in case of HLS/DASH, it does not need to have big buffer * * because it is kind of adaptive streaming. */ - if (!MMPLAYER_IS_HTTP_PD(player) && - (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player) || MMPLAYER_IS_DASH_STREAMING(player))) { + if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player) || MMPLAYER_IS_DASH_STREAMING(player)) { gdouble high_percent = 0.0; init_buffering_time = (init_buffering_time != 0) ? (init_buffering_time) : (player->ini.http_buffering_time); @@ -6294,7 +6166,6 @@ __mmplayer_verify_gapless_play_path(mm_player_t *player) #define REPEAT_COUNT_MIN 2 MMHandleType attrs = 0; - gint mode = MM_PLAYER_PD_MODE_NONE; gint video = 0; gint count = 0; gint gapless = 0; @@ -6325,13 +6196,6 @@ __mmplayer_verify_gapless_play_path(mm_player_t *player) goto ERROR; } - if (mm_attrs_get_int_by_name(attrs, "pd_mode", &mode) == MM_ERROR_NONE) { - if (mode == TRUE) { - LOGW("pd mode\n"); - goto ERROR; - } - } - if (mm_attrs_get_int_by_name(attrs, "profile_play_count", &count) != MM_ERROR_NONE) LOGE("failed to get play count"); @@ -7323,10 +7187,9 @@ __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER; player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element; - if (!MMPLAYER_IS_HTTP_PD(player) && - ((MMPLAYER_IS_HTTP_STREAMING(player)) || + if ((MMPLAYER_IS_HTTP_STREAMING(player)) || (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) || - (MMPLAYER_IS_DASH_STREAMING(player)))) { + (MMPLAYER_IS_DASH_STREAMING(player))) { /* in case of multiqueue, max bytes size is defined with fixed value in mm_player_streaming.h*/ __mm_player_streaming_set_multiqueue(player->streamer, element, player->ini.http_buffering_time, 1.0, player->ini.http_buffering_limit); __mm_player_streaming_sync_property(player->streamer, player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst); @@ -8313,22 +8176,19 @@ void _mm_player_video_stream_internal_buffer_unref(void *buffer) int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout) { - mm_player_t* player = (mm_player_t*) hplayer; + mm_player_t *player = (mm_player_t *) hplayer; MMPLAYER_FENTER(); MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT); - if (MMPLAYER_IS_HTTP_PD(player)) - /* consider the timeout both download pipeline and playback pipeline */ - *timeout = player->ini.live_state_change_timeout + PLAYER_PD_STATE_CHANGE_TIME; - else if (MMPLAYER_IS_STREAMING(player)) + if (MMPLAYER_IS_STREAMING(player)) *timeout = player->ini.live_state_change_timeout; else *timeout = player->ini.localplayback_state_change_timeout; - LOGD("timeout = %d\n", *timeout); + LOGD("timeout = %d", *timeout); MMPLAYER_FLEAVE(); return MM_ERROR_NONE; diff --git a/src/mm_player_streaming.c b/src/mm_player_streaming.c index 52ca01e..f759e08 100644 --- a/src/mm_player_streaming.c +++ b/src/mm_player_streaming.c @@ -128,7 +128,6 @@ void __mm_player_streaming_initialize(mm_player_streaming_t* streamer) streamer->buffering_state = MM_PLAYER_BUFFERING_DEFAULT; streamer->is_adaptive_streaming = FALSE; - streamer->is_pd_mode = FALSE; streamer->buffering_percent = -1; streamer->ring_buffer_size = DEFAULT_RING_BUFFER_SIZE; @@ -162,7 +161,6 @@ void __mm_player_streaming_deinitialize(mm_player_streaming_t* streamer) streamer->buffering_state = MM_PLAYER_BUFFERING_DEFAULT; streamer->is_adaptive_streaming = FALSE; - streamer->is_pd_mode = FALSE; streamer->buffering_percent = -1; streamer->ring_buffer_size = DEFAULT_RING_BUFFER_SIZE; @@ -464,7 +462,7 @@ void __mm_player_streaming_set_queue2(mm_player_streaming_t* streamer, if (use_buffering) { streamer->streaming_buffer_type = BUFFER_TYPE_MUXED; - if (content_size > 0 || streamer->is_pd_mode) { + if (content_size > 0) { if (streamer->buffering_req.prebuffer_time > 0) streamer->buffering_req.is_pre_buffering = TRUE; else diff --git a/src/mm_player_utils.c b/src/mm_player_utils.c index 19f4414..dacc032 100644 --- a/src/mm_player_utils.c +++ b/src/mm_player_utils.c @@ -93,7 +93,7 @@ __is_streaming(mm_player_t* player) { MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - return (__is_http_progressive_down(player) || __is_rtsp_streaming(player) || __is_http_streaming(player) + return (__is_rtsp_streaming(player) || __is_http_streaming(player) || __is_http_live_streaming(player) || __is_dash_streaming(player) || __is_smooth_streaming(player)) ? TRUE : FALSE; } @@ -129,15 +129,6 @@ __is_smooth_streaming(mm_player_t* player) return (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) ? TRUE : FALSE; } - -gboolean -__is_http_progressive_down(mm_player_t* player) -{ - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - - return ((player->pd_mode) ? TRUE : FALSE); -} - gboolean __is_ms_buff_src(mm_player_t* player) {