diff options
author | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-08-29 19:12:50 +0900 |
---|---|---|
committer | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-08-29 19:12:50 +0900 |
commit | 57d7768c9781986a3c7bdb9974287a63e6e69bba (patch) | |
tree | d273151e6e115282687aefedf3f8ef67c44711a5 | |
parent | 7f2ae6cab1938250175d28d74f94abdc53da1b56 (diff) | |
download | libmm-player-57d7768c9781986a3c7bdb9974287a63e6e69bba.tar.gz libmm-player-57d7768c9781986a3c7bdb9974287a63e6e69bba.tar.bz2 libmm-player-57d7768c9781986a3c7bdb9974287a63e6e69bba.zip |
[0.6.64] remove dead code
Change-Id: I8023d6e37b1d07dd872b46aaf6359574227748df
-rw-r--r-- | packaging/libmm-player.spec | 2 | ||||
-rw-r--r-- | src/include/mm_player.h | 32 | ||||
-rw-r--r-- | src/include/mm_player_priv.h | 13 | ||||
-rw-r--r-- | src/include/mm_player_utils.h | 27 | ||||
-rw-r--r-- | src/mm_player.c | 31 | ||||
-rw-r--r-- | src/mm_player_common_priv.c | 10 | ||||
-rw-r--r-- | src/mm_player_priv.c | 1498 |
7 files changed, 17 insertions, 1596 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 9184264..d7894d4 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.63 +Version: 0.6.64 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 7431abb..8ba8298 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -1867,38 +1867,6 @@ int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType ty int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index); /** - * This function is to set the start position of zoom - * - * @param player [in] handle of player - * @param level [in] level of zoom - * @param x [in] start x position - * @param y [in] start y position - * - * @return This function returns zero on success, or negative value with error - * code. - * - * @see - * @remark None - */ -int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y); - -/** - * This function is to get the start position of zoom - * - * @param player [in] handle of player - * @param type [out] current level of zoom - * @param x [out] start x position - * @param y [out] start y position - * - * @return This function returns zero on success, or negative value with error - * code. - * - * @see - * @remark None - */ -int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y); - -/** * This function is to set the subtitle path * * @param player [in] handle of player diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index a22c7e4..51aafe8 100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -121,7 +121,6 @@ enum alassink_sync { enum MMPlayerUriType { MM_PLAYER_URI_TYPE_NONE, /**< Player URI type None */ MM_PLAYER_URI_TYPE_URL_RTSP, /**< Player URI type RTSP */ - MM_PLAYER_URI_TYPE_URL_WFD, /**< Player URI type WFD */ MM_PLAYER_URI_TYPE_URL_HTTP, /**< Player URI type HTTP */ MM_PLAYER_URI_TYPE_URL_MMS, /**< Player URI type MMS */ MM_PLAYER_URI_TYPE_MEM, /**< Player URI type Mem */ @@ -702,8 +701,6 @@ typedef struct { guint resume_event_id; guint resumable_cancel_id; - gboolean keep_detecting_vcodec; - gboolean play_subtitle; gboolean is_subtitle_force_drop; // set TRUE after bus_cb get EOS @@ -731,16 +728,9 @@ typedef struct { MMPlayerSetMode set_mode; - /* decodbin usage */ - gboolean use_decodebin; - /* initialize values */ mm_player_ini_t ini; - /* check to use h/w codec */ - GstCaps* state_tune_caps; - gboolean ignore_asyncdone; - /* video share sync */ gint64 video_share_api_delta; gint64 video_share_clock_delta; @@ -850,8 +840,6 @@ gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index); int _mmplayer_sync_subtitle_pipeline(mm_player_t* player); -int _mmplayer_set_display_zoom(MMHandleType hplayer, float level, int x, int y); -int _mmplayer_get_display_zoom(MMHandleType hplayer, float *level, int *x, int *y); 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); @@ -879,7 +867,6 @@ const gchar * __get_state_name(int state); gboolean __mmplayer_can_do_interrupt(mm_player_t *player); gboolean __is_streaming(mm_player_t* player); gboolean __is_rtsp_streaming(mm_player_t* player); -gboolean __is_wfd_streaming(mm_player_t* player); gboolean __is_live_streaming(mm_player_t* player); gboolean __is_http_streaming(mm_player_t* player); gboolean __is_http_live_streaming(mm_player_t* player); diff --git a/src/include/mm_player_utils.h b/src/include/mm_player_utils.h index cf4d2ac..f6bbf3f 100644 --- a/src/include/mm_player_utils.h +++ b/src/include/mm_player_utils.h @@ -199,12 +199,6 @@ if (!x_var) { \ goto ERROR; \ } -#define MMPLAYER_CHECK_CMD_IF_EXIT(x_player) \ -if (x_player->cmd == MMPLAYER_COMMAND_UNREALIZE || x_player->cmd == MMPLAYER_COMMAND_DESTROY) { \ - LOGD("it's exit state...\n");\ - goto ERROR; \ -} - /* generating dot */ #define MMPLAYER_GENERATE_DOT_IF_ENABLED(x_player, x_name) \ if (x_player->ini.generate_dot) { \ @@ -260,7 +254,6 @@ LOGD("-- prev %s, current %s, pending %s, target %s --\n", \ /* streaming */ #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_WFD_STREAMING(x_player) __is_wfd_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) @@ -272,26 +265,6 @@ LOGD("-- prev %s, current %s, pending %s, target %s --\n", \ #define MMPLAYER_URL_HAS_DASH_SUFFIX(x_player) __has_suffix(x_player, "mpd") #define MMPLAYER_URL_HAS_HLS_SUFFIX(x_player) __has_suffix(x_player, "m3u8") -/* etc */ -#define MMF_PLAYER_FILE_BACKUP_PATH "/tmp/media_temp." -#define MMPLAYER_PT_IS_AUDIO(x_pt) (strstr(x_pt, "_97") || strstr(x_pt, "audio")) -#define MMPLAYER_PT_IS_VIDEO(x_pt) (strstr(x_pt, "_96") || strstr(x_pt, "video")) - -#define MMPLAYER_VIDEO_SINK_CHECK(x_player) \ -do { \ - MMPLAYER_RETURN_VAL_IF_FAIL(x_player && \ - x_player->pipeline && \ - x_player->pipeline->videobin && \ - x_player->pipeline->videobin[MMPLAYER_V_SINK].gst, \ - MM_ERROR_PLAYER_NOT_INITIALIZED); \ -} while (0) - -enum { - MMPLAYER_DISPLAY_NULL = 0, - MMPLAYER_DISPLAY_HDMI_ACTIVE, - MMPLAYER_DISPLAY_MIRRORING_ACTIVE, -}; - bool util_is_sdp_file(const char *path); int util_get_rank_increase(const char *factory_class); int util_factory_rank_compare(GstPluginFeature *f1, GstPluginFeature *f2); // @ diff --git a/src/mm_player.c b/src/mm_player.c index 01612b3..7459154 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -758,37 +758,6 @@ int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType ty return result; } -int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_set_display_zoom(player, level, x, y); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - -int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y) -{ - int result = MM_ERROR_NONE; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_COMMON_INVALID_ARGUMENT); - - MMPLAYER_CMD_LOCK( player ); - - result = _mmplayer_get_display_zoom(player, level, x, y); - - MMPLAYER_CMD_UNLOCK( player ); - - return result; -} - int mm_player_set_video_share_master_clock(MMHandleType player, long long clock, long long clock_delta, diff --git a/src/mm_player_common_priv.c b/src/mm_player_common_priv.c index 6e1fede..5de645f 100644 --- a/src/mm_player_common_priv.c +++ b/src/mm_player_common_priv.c @@ -425,14 +425,6 @@ __is_rtsp_streaming(mm_player_t* player) } gboolean -__is_wfd_streaming(mm_player_t* player) -{ - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - - return (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_WFD) ? TRUE : FALSE; -} - -gboolean __is_http_streaming(mm_player_t* player) { MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); @@ -445,7 +437,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_wfd_streaming(player) || __is_http_streaming(player) + return (__is_http_progressive_down(player) || __is_rtsp_streaming(player) || __is_http_streaming(player) || __is_http_live_streaming(player) || __is_dash_streaming(player) || __is_smooth_streaming(player)) ? TRUE : FALSE; } diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index b02a294..10ce600 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -85,27 +85,14 @@ */ #define MM_PLAYER_FADEOUT_TIME_DEFAULT 0 -#define MM_PLAYER_MPEG_VNAME "mpegversion" -#define MM_PLAYER_DIVX_VNAME "divxversion" -#define MM_PLAYER_WMV_VNAME "wmvversion" -#define MM_PLAYER_WMA_VNAME "wmaversion" - #define DEFAULT_PLAYBACK_RATE 1.0 -#define PLAYBACK_RATE_EX_AUDIO_MIN 0.5 -#define PLAYBACK_RATE_EX_AUDIO_MAX 2.0 -#define PLAYBACK_RATE_EX_VIDEO_MIN 0.5 -#define PLAYBACK_RATE_EX_VIDEO_MAX 1.5 #define DEFAULT_NUM_OF_V_OUT_BUFFER 3 -#define GST_QUEUE_DEFAULT_TIME 4 -#define GST_QUEUE_HLS_TIME 8 - #define MMPLAYER_USE_FILE_FOR_BUFFERING(player) \ (((player)->profile.uri_type != MM_PLAYER_URI_TYPE_HLS) && \ (player->ini.http_use_file_buffer) && \ (player->http_file_buffering_path) && \ (strlen(player->http_file_buffering_path) > 0)) -#define MM_PLAYER_NAME "mmplayer" #define PLAYER_DISPLAY_MODE_DST_ROI 5 @@ -145,44 +132,28 @@ static void __mmplayer_gst_decode_callback(GstElement *decodebin, GstPad *pad, static void __mmplayer_gst_decode_unknown_type(GstElement *elem, GstPad* pad, GstCaps *caps, gpointer data); static gboolean __mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad* pad, GstCaps * caps, gpointer data); static gint __mmplayer_gst_decode_autoplug_select(GstElement *bin, GstPad* pad, GstCaps * caps, GstElementFactory* factory, gpointer data); -//static GValueArray* __mmplayer_gst_decode_autoplug_factories(GstElement *bin, GstPad* pad, GstCaps * caps, gpointer data); static void __mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad* new_pad, gpointer data); static void __mmplayer_gst_decode_drained(GstElement *bin, gpointer data); static void __mmplayer_gst_element_added(GstElement* bin, GstElement* element, gpointer data); static GstElement * __mmplayer_create_decodebin(mm_player_t* player); static gboolean __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstCaps *caps); - static void __mmplayer_typefind_have_type(GstElement *tf, guint probability, GstCaps *caps, gpointer data); -static gboolean __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps); static void __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data); static gboolean __mmplayer_is_midi_type(gchar* str_caps); static gboolean __mmplayer_is_only_mp3_type(gchar *str_caps); static void __mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps); -//static void __mmplayer_check_video_zero_cpoy(mm_player_t* player, GstElementFactory* factory); - -static gboolean __mmplayer_close_link(mm_player_t* player, GstPad *srcpad, GstElement *sinkelement, const char *padname, const GList *templlist); -static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data); -static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer data); static void __mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data); -//static void __mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data); static void __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data); static gboolean __mmplayer_get_stream_service_type(mm_player_t* player); static gboolean __mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data); - - -static void __mmplayer_init_factories(mm_player_t* player); -static void __mmplayer_release_factories(mm_player_t* player); static void __mmplayer_release_misc(mm_player_t* player); static void __mmplayer_release_misc_post(mm_player_t* player); static gboolean __mmplayer_init_gstreamer(mm_player_t* player); static GstBusSyncReply __mmplayer_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer data); static gboolean __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data); - static gboolean __mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage *msg); static gboolean __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg); - -int __mmplayer_switch_audio_sink(mm_player_t* player); static gboolean __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink); static GstPadProbeReturn __mmplayer_audio_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data); static void __mmplayer_video_stream_decoded_preroll_cb(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data); @@ -195,8 +166,6 @@ static gboolean __mmplayer_handle_streaming_error(mm_player_t* player, GstMessag static void __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms); static void __mmplayer_cancel_eos_timer(mm_player_t* player); static gboolean __mmplayer_eos_timer_cb(gpointer u_data); -static gboolean __mmplayer_link_decoder(mm_player_t* player, GstPad *srcpad); -static gboolean __mmplayer_link_sink(mm_player_t* player, GstPad *srcpad); static int __mmplayer_handle_missed_plugin(mm_player_t* player); static int __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime); static gboolean __mmplayer_configure_audio_callback(mm_player_t* player); @@ -207,7 +176,6 @@ static gpointer __mmplayer_next_play_thread(gpointer data); static gpointer __mmplayer_repeat_thread(gpointer data); static gboolean _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag); - static gboolean __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element); static GstPadProbeReturn __mmplayer_dump_buffer_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer u_data); static void __mmplayer_release_dump_list(GList *dump_list); @@ -238,9 +206,6 @@ static gboolean __mmplayer_can_extract_pcm(mm_player_t* player); static void __mmplayer_do_sound_fadedown(mm_player_t* player, unsigned int time); static void __mmplayer_undo_sound_fadedown(mm_player_t* player); -static void __mmplayer_add_new_caps(GstPad* pad, GParamSpec* unused, gpointer data); -static void __mmplayer_set_unlinked_mime_type(mm_player_t* player, GstCaps *caps); - /* util */ static gboolean __is_ms_buff_src(mm_player_t* player); static gboolean __has_suffix(mm_player_t * player, const gchar * suffix); @@ -256,9 +221,6 @@ static void __mmplayer_activate_next_source(mm_player_t *player, GstState target static void __mmplayer_check_pipeline(mm_player_t* player); static gboolean __mmplayer_deactivate_selector(mm_player_t *player, MMPlayerTrackType type); static void __mmplayer_deactivate_old_path(mm_player_t *player); -#if 0 // We'll need this in future. -static int __mmplayer_gst_switching_element(mm_player_t *player, GstElement *search_from, const gchar *removal_name, const gchar *new_element_name); -#endif static void __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg); static GstElement *__mmplayer_element_create_and_link(mm_player_t *player, GstPad* pad, const char* name); @@ -2247,140 +2209,6 @@ ERROR: */ } - - -/* FIXIT : check indent */ -#if 0 -static void -__mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) -{ - GstPad *sinkpad = NULL; - GstCaps* caps = NULL; - GstElement* new_element = NULL; - enum MainElementID element_id = MMPLAYER_M_NUM; - - mm_player_t* player = (mm_player_t*) data; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_IF_FAIL(element && pad); - MMPLAYER_RETURN_IF_FAIL(player && - player->pipeline && - player->pipeline->mainbin); - - LOGD("stream count inc : %d\n", player->num_dynamic_pad); - - { - LOGD("using pad caps to autopluging instead of doing typefind\n"); - caps = gst_pad_query_caps(pad); - MMPLAYER_CHECK_NULL(caps); - /* clear previous result*/ - player->have_dynamic_pad = FALSE; - new_element = gst_element_factory_make("rtpmp2tdepay", "wfd_rtp_depay"); - if (!new_element) { - LOGE("failed to create wfd rtp depay element\n"); - goto ERROR; - } - MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY); - /* add new element to the pipeline */ - if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) { - LOGD("failed to add autoplug element to bin\n"); - goto ERROR; - } - /* get pad from element */ - sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink"); - if (!sinkpad) { - LOGD("failed to get sinkpad from autoplug element\n"); - goto ERROR; - } - /* link it */ - if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) { - LOGD("failed to link autoplug element\n"); - goto ERROR; - } - gst_object_unref(sinkpad); - sinkpad = NULL; - pad = gst_element_get_static_pad(GST_ELEMENT(new_element), "src"); - caps = gst_pad_query_caps(pad); - MMPLAYER_CHECK_NULL(caps); - MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING); - /* create typefind */ - new_element = gst_element_factory_make("typefind", NULL); - if (!new_element) { - LOGD("failed to create typefind\n"); - goto ERROR; - } - - MMPLAYER_SIGNAL_CONNECT(player, - G_OBJECT(new_element), - MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, - "have-type", - G_CALLBACK(__mmplayer_typefind_have_type), - (gpointer)player); - - player->have_dynamic_pad = FALSE; - } - - /* excute new_element if created*/ - if (new_element) { - LOGD("adding new element to pipeline\n"); - - /* set state to READY before add to bin */ - MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY); - - /* add new element to the pipeline */ - if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) { - LOGD("failed to add autoplug element to bin\n"); - goto ERROR; - } - - /* get pad from element */ - sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink"); - if (!sinkpad) { - LOGD("failed to get sinkpad from autoplug element\n"); - goto ERROR; - } - - /* link it */ - if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) { - LOGD("failed to link autoplug element\n"); - goto ERROR; - } - - gst_object_unref(sinkpad); - sinkpad = NULL; - - /* run. setting PLAYING here since streamming source is live source */ - MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING); - } - - /* store handle to futher manipulation */ - player->pipeline->mainbin[element_id].id = element_id; - player->pipeline->mainbin[element_id].gst = new_element; - - MMPLAYER_FLEAVE(); - - return; - -STATE_CHANGE_FAILED: -ERROR: - /* FIXIT : take care if new_element has already added to pipeline */ - if (new_element) - gst_object_unref(GST_OBJECT(new_element)); - - if (sinkpad) - gst_object_unref(GST_OBJECT(sinkpad)); - - if (caps) - gst_object_unref(GST_OBJECT(caps)); - - /* FIXIT : how to inform this error to MSL ????? */ - /* FIXIT : I think we'd better to use g_idle_add() to destroy pipeline and - * then post an error to application - */ -} -#endif - static GstPadProbeReturn __mmplayer_gst_selector_blocked(GstPad* pad, GstPadProbeInfo *info, gpointer data) { @@ -3671,10 +3499,6 @@ __mmplayer_gst_decode_callback(GstElement *elem, GstPad *pad, gpointer data) if ((player->no_more_pad) && (player->num_dynamic_pad == 0)) __mmplayer_pipeline_complete(NULL, player); - /* FIXIT : please leave a note why this code is needed */ - if (MMPLAYER_IS_WFD_STREAMING(player)) - player->no_more_pad = TRUE; - ERROR: MMPLAYER_FREEIF(caps_str); @@ -6311,8 +6135,6 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) G_CALLBACK(__mmplayer_gst_rtp_dynamic_pad), player); MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(element), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads", G_CALLBACK(__mmplayer_gst_rtp_no_more_pads), player); - - player->use_decodebin = FALSE; } break; @@ -6724,13 +6546,11 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) /* create autoplugging element if src element is not a rtsp src */ if ((player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_RTSP) && - (player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_WFD) && (player->profile.uri_type != MM_PLAYER_URI_TYPE_MS_BUFF)) { element = NULL; enum MainElementID elemId = MMPLAYER_M_NUM; - if ((player->use_decodebin) && - ((MMPLAYER_IS_HTTP_PD(player)) || + if (((MMPLAYER_IS_HTTP_PD(player)) || (!MMPLAYER_IS_HTTP_STREAMING(player)))) { elemId = MMPLAYER_M_AUTOPLUG; element = __mmplayer_create_decodebin(player); @@ -7343,13 +7163,9 @@ int __gst_pause(mm_player_t* player, gboolean async) MMPLAYER_PRINT_STATE(player); /* set pipeline status to PAUSED */ - player->ignore_asyncdone = TRUE; - ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player)); - player->ignore_asyncdone = FALSE; - if (FALSE == async) { if (ret != MM_ERROR_NONE) { GstMessage *msg = NULL; @@ -7932,16 +7748,9 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse } } else if ((path = strstr(uri, "rtsp://"))) { if (strlen(path)) { - if ((path = strstr(uri, "/wfd1.0/"))) { - strncpy(data->uri, uri, MM_MAX_URL_LEN-1); - data->uri_type = MM_PLAYER_URI_TYPE_URL_WFD; - ret = MM_ERROR_NONE; - LOGD("uri is actually a wfd client path. giving it to wfdrtspsrc\n"); - } else { - strncpy(data->uri, uri, MM_MAX_URL_LEN-1); - data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP; - ret = MM_ERROR_NONE; - } + strncpy(data->uri, uri, MM_MAX_URL_LEN-1); + data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP; + ret = MM_ERROR_NONE; } } else if ((path = strstr(uri, "http://")) || (path = strstr(uri, "https://"))) { if (strlen(path)) { @@ -8471,10 +8280,6 @@ _mmplayer_create_player(MMHandleType handle) return ret; } - /* initialize factories if not using decodebin */ - if (player->factories == NULL) - __mmplayer_init_factories(player); - /* create lock. note that g_tread_init() has already called in gst_init() */ g_mutex_init(&player->fsink_lock); @@ -8552,8 +8357,6 @@ _mmplayer_create_player(MMHandleType handle) player->play_subtitle = FALSE; player->play_count = 0; - player->use_decodebin = TRUE; - player->ignore_asyncdone = FALSE; player->use_deinterleave = FALSE; player->max_audio_channels = 0; player->video_share_api_delta = 0; @@ -8883,9 +8686,6 @@ _mmplayer_destroy(MMHandleType handle) /* release attributes */ _mmplayer_deconstruct_attribute(handle); - /* release factories */ - __mmplayer_release_factories(player); - /* release lock */ g_mutex_clear(&player->fsink_lock); @@ -9054,10 +8854,6 @@ _mmplayer_realize(MMHandleType hplayer) if (update_registry) { LOGD("updating registry...\n"); gst_update_registry(); - - /* then we have to rebuild factories */ - __mmplayer_release_factories(player); - __mmplayer_init_factories(player); } /* realize pipeline */ @@ -10153,8 +9949,7 @@ GstCaps *caps, gpointer data) if (player->type) LOGD("meida type %s found, probability %d%% / %d\n", player->type, probability, gst_caps_get_size(caps)); - if ((!MMPLAYER_IS_WFD_STREAMING(player)) && - (!MMPLAYER_IS_RTSP_STREAMING(player)) && + if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (g_strrstr(player->type, "audio/x-raw-int"))) { LOGE("not support media format\n"); @@ -10179,37 +9974,16 @@ GstCaps *caps, gpointer data) return; } - if (player->use_decodebin) { - if (!__mmplayer_try_to_plug_decodebin(player, pad, caps)) { - gboolean async = FALSE; - LOGE("failed to autoplug %s\n", player->type); - - mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async); - - if (async && player->msg_posted == FALSE) - __mmplayer_handle_missed_plugin(player); - - goto DONE; - } - } else { - /* try to plug */ - if (!__mmplayer_try_to_plug(player, pad, caps)) { - gboolean async = FALSE; - LOGE("failed to autoplug %s\n", player->type); - - mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async); + if (!__mmplayer_try_to_plug_decodebin(player, pad, caps)) { + gboolean async = FALSE; + LOGE("failed to autoplug %s\n", player->type); - if (async && player->msg_posted == FALSE) - __mmplayer_handle_missed_plugin(player); + mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async); - goto DONE; - } + if (async && player->msg_posted == FALSE) + __mmplayer_handle_missed_plugin(player); - /* finish autopluging if no dynamic pad waiting */ - if ((!player->have_dynamic_pad) && (!player->has_many_types)) { - if (!MMPLAYER_IS_RTSP_STREAMING(player)) - __mmplayer_pipeline_complete(NULL, (gpointer)player); - } + goto DONE; } DONE: @@ -10341,6 +10115,7 @@ __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstC 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); + // FIXME : pass ini setting directly. is this ok? __mm_player_streaming_set_queue2(player->streamer, queue2, FALSE, @@ -10467,381 +10242,6 @@ ERROR: return FALSE; } -/* it will return first created element */ -static gboolean -__mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) -{ - MMPlayerGstElement* mainbin = NULL; - const char* mime = NULL; - const GList* item = NULL; - const gchar* klass = NULL; - GstCaps* res = NULL; - gboolean skip = FALSE; - GstPad* queue_pad = NULL; - GstElement* queue = NULL; - GstElement *element = NULL; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && player->pipeline->mainbin, FALSE); - - mainbin = player->pipeline->mainbin; - - mime = gst_structure_get_name(gst_caps_get_structure(caps, 0)); - - /* return if we got raw output */ - if (g_str_has_prefix(mime, "video/x-raw") || g_str_has_prefix(mime, "audio/x-raw") - || g_str_has_prefix(mime, "text/plain") || g_str_has_prefix(mime, "text/x-pango-markup")) { - - element = (GstElement*)gst_pad_get_parent(pad); -/* NOTE : When no decoder has added during autoplugging. like a simple wave playback. - * No queue will be added. I think it can caused breaking sound when playing raw audio - * frames but there's no different. Decodebin also doesn't add with those wav fils. - * Anyway, currentely raw-queue seems not necessary. - */ -#if 1 - /* NOTE : check if previously linked element is demuxer/depayloader/parse means no decoder - * has linked. if so, we need to add queue for quality of output. note that - * decodebin also has same problem. - */ - klass = gst_element_factory_get_metadata(gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS); - - /* add queue if needed */ - if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Depayloader") - || g_strrstr(klass, "Parse")) && !g_str_has_prefix(mime, "text")) { - LOGD("adding raw queue\n"); - - queue = gst_element_factory_make("queue", NULL); - if (!queue) { - LOGW("failed to create queue\n"); - goto ERROR; - } - - /* warmup */ - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY)) { - LOGW("failed to set state READY to queue\n"); - goto ERROR; - } - - /* add to pipeline */ - if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue)) { - LOGW("failed to add queue\n"); - goto ERROR; - } - - /* link queue */ - queue_pad = gst_element_get_static_pad(queue, "sink"); - - if (GST_PAD_LINK_OK != gst_pad_link(pad, queue_pad)) { - LOGW("failed to link queue\n"); - goto ERROR; - } - gst_object_unref(GST_OBJECT(queue_pad)); - queue_pad = NULL; - - /* running */ - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED)) { - LOGW("failed to set state PAUSED to queue\n"); - goto ERROR; - } - - /* replace given pad to queue:src */ - pad = gst_element_get_static_pad(queue, "src"); - if (!pad) { - LOGW("failed to get pad from queue\n"); - goto ERROR; - } - } -#endif - /* check if player can do start continually */ - MMPLAYER_CHECK_CMD_IF_EXIT(player); - - if (__mmplayer_link_sink(player, pad)) - __mmplayer_gst_decode_callback(element, pad, player); - - gst_object_unref(GST_OBJECT(element)); - element = NULL; - - return TRUE; - } - - item = player->factories; - for (; item != NULL; item = item->next) { - GstElementFactory *factory = GST_ELEMENT_FACTORY(item->data); - const GList *pads; - gint idx = 0; - - skip = FALSE; - - /* filtering exclude keyword */ - for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++) { - if (g_strrstr(GST_OBJECT_NAME(factory), - player->ini.exclude_element_keyword[idx])) { - LOGW("skipping [%s] by exculde keyword [%s]\n", - GST_OBJECT_NAME(factory), - player->ini.exclude_element_keyword[idx]); - - skip = TRUE; - break; - } - } - - if (MMPLAYER_IS_RTSP_STREAMING(player) && g_strrstr(GST_OBJECT_NAME(factory), "omx_mpeg4dec")) { - // omx decoder can not support mpeg4video data partitioned - // rtsp streaming didn't know mpeg4video data partitioned format - // so, if rtsp playback, player will skip omx_mpeg4dec. - LOGW("skipping [%s] when rtsp streaming \n", - GST_OBJECT_NAME(factory)); - - skip = TRUE; - } - - if (skip) continue; - - /* check factory class for filtering */ - klass = gst_element_factory_get_metadata(GST_ELEMENT_FACTORY(factory), GST_ELEMENT_METADATA_KLASS); - - /*parsers are not required in case of external feeder*/ - if (g_strrstr(klass, "Codec/Parser") && MMPLAYER_IS_MS_BUFF_SRC(player)) - continue; - - /* NOTE : msl don't need to use image plugins. - * So, those plugins should be skipped for error handling. - */ - if (g_strrstr(klass, "Codec/Decoder/Image")) { - LOGD("skipping [%s] by not required\n", GST_OBJECT_NAME(factory)); - continue; - } - - /* check pad compatability */ - for (pads = gst_element_factory_get_static_pad_templates(factory); - pads != NULL; pads = pads->next) { - GstStaticPadTemplate *temp1 = pads->data; - GstCaps* static_caps = NULL; - - if (temp1->direction != GST_PAD_SINK - || temp1->presence != GST_PAD_ALWAYS) - continue; - - /* using existing caps */ - if (GST_IS_CAPS(&temp1->static_caps.caps)) - static_caps = gst_caps_ref(temp1->static_caps.caps); - /* create one */ - else - static_caps = gst_caps_from_string(temp1->static_caps.string); - - res = gst_caps_intersect((GstCaps*)caps, static_caps); - gst_caps_unref(static_caps); - static_caps = NULL; - - if (res && !gst_caps_is_empty(res)) { - GstElement *new_element; - GList *elements = player->parsers; - char *name_template = g_strdup(temp1->name_template); - gchar *name_to_plug = GST_OBJECT_NAME(factory); - gst_caps_unref(res); - - /* check ALP Codec can be used or not */ - if ((g_strrstr(klass, "Codec/Decoder/Audio"))) { - /* consider mp3 audio only */ - if (!MMPLAYER_IS_STREAMING(player) && __mmplayer_is_only_mp3_type(player->type)) { - /* try to use ALP decoder first instead of selected decoder */ - GstElement *element = NULL; - GstElementFactory * element_facory; - gchar *path = NULL; - guint64 data_size = 0; - #define MIN_THRESHOLD_SIZE 320 * 1024 // 320K - struct stat sb; - - mm_attrs_get_string_by_name(player->attrs, "profile_uri", &path); - - if (stat(path, &sb) == 0) - data_size = (guint64)sb.st_size; - LOGD("file size : %u", data_size); - - if (data_size > MIN_THRESHOLD_SIZE) { - LOGD("checking if ALP can be used or not"); - element = gst_element_factory_make("omx_mp3dec", "omx mp3 decoder"); - if (element) { - /* check availability because multi-instance is not supported */ - GstStateChangeReturn ret = gst_element_set_state(element, GST_STATE_READY); - - if (ret != GST_STATE_CHANGE_SUCCESS) { - // use just selected decoder - gst_object_unref(element); - } else if (ret == GST_STATE_CHANGE_SUCCESS) { - // replace facotry to use omx - /* clean */ - gst_element_set_state(element, GST_STATE_NULL); - gst_object_unref(element); - - element_facory = gst_element_factory_find("omx_mp3dec"); - /* replace, otherwise use selected thing instead */ - if (element_facory) { - factory = element_facory; - name_to_plug = GST_OBJECT_NAME(factory); - } - } - } - } - } - } else if ((g_strrstr(klass, "Codec/Decoder/Video"))) { - if (g_strrstr(GST_OBJECT_NAME(factory), "omx_")) { - char *env = getenv("MM_PLAYER_HW_CODEC_DISABLE"); - if (env != NULL) { - if (strncasecmp(env, "yes", 3) == 0) { - LOGD("skipping [%s] by disabled\n", name_to_plug); - MMPLAYER_FREEIF(name_template); - continue; - } - } - } - } - - LOGD("found %s to plug\n", name_to_plug); - - new_element = gst_element_factory_create(GST_ELEMENT_FACTORY(factory), NULL); - if (!new_element) { - LOGE("failed to create element [%s]. continue with next.\n", - GST_OBJECT_NAME(factory)); - - MMPLAYER_FREEIF(name_template); - - continue; - } - - /* check and skip it if it was already used. Otherwise, it can be an infinite loop - * because parser can accept its own output as input. - */ - if (g_strrstr(klass, "Parser")) { - gchar *selected = NULL; - - for (; elements; elements = g_list_next(elements)) { - gchar *element_name = elements->data; - - if (g_strrstr(element_name, name_to_plug)) { - LOGD("but, %s already linked, so skipping it\n", name_to_plug); - skip = TRUE; - } - } - - if (skip) { - MMPLAYER_FREEIF(name_template); - continue; - } - - selected = g_strdup(name_to_plug); - player->parsers = g_list_append(player->parsers, selected); - } - - /* store specific handles for futher control */ - if (g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) { - /* FIXIT : first value will be overwritten if there's more - * than 1 demuxer/parser - */ - LOGD("plugged element is demuxer. take it\n"); - mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX; - mainbin[MMPLAYER_M_DEMUX].gst = new_element; - - /*Added for multi audio support */ - if (g_strrstr(klass, "Demux")) { - mainbin[MMPLAYER_M_DEMUX_EX].id = MMPLAYER_M_DEMUX_EX; - mainbin[MMPLAYER_M_DEMUX_EX].gst = new_element; - - /* NOTE : workaround for bug in mpegtsdemux since doesn't emit - no-more-pad signal. this may cause wrong content attributes at PAUSED state - this code should be removed after mpegtsdemux is fixed */ - if (g_strrstr(GST_OBJECT_NAME(factory), "mpegtsdemux")) { - LOGW("force no-more-pad to TRUE since mpegtsdemux os not giving no-more-pad signal. content attributes may wrong"); - player->no_more_pad = TRUE; - } - } - if (g_strrstr(name_to_plug, "asfdemux")) // to support trust-zone only - g_object_set(mainbin[MMPLAYER_M_DEMUX_EX].gst, "file-location", player->profile.uri, NULL); - } else if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player, pad)) { - if (mainbin[MMPLAYER_M_DEC1].gst == NULL) { - LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC1]\n"); - mainbin[MMPLAYER_M_DEC1].id = MMPLAYER_M_DEC1; - mainbin[MMPLAYER_M_DEC1].gst = new_element; - } else if (mainbin[MMPLAYER_M_DEC2].gst == NULL) { - LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC2]\n"); - mainbin[MMPLAYER_M_DEC2].id = MMPLAYER_M_DEC2; - mainbin[MMPLAYER_M_DEC2].gst = new_element; - } - /* NOTE : IF one codec is found, add it to supported_codec and remove from - * missing plugin. Both of them are used to check what's supported codec - * before returning result of play start. And, missing plugin should be - * updated here for multi track files. - */ - if (g_str_has_prefix(mime, "video")) { - GstPad *src_pad = NULL; - GstPadTemplate *pad_templ = NULL; - GstCaps *caps = NULL; - gchar *caps_str = NULL; - - LOGD("found VIDEO decoder\n"); - player->not_supported_codec &= MISSING_PLUGIN_AUDIO; - player->can_support_codec |= FOUND_PLUGIN_VIDEO; - - src_pad = gst_element_get_static_pad(new_element, "src"); - pad_templ = gst_pad_get_pad_template(src_pad); - caps = GST_PAD_TEMPLATE_CAPS(pad_templ); - - caps_str = gst_caps_to_string(caps); - - /* clean */ - MMPLAYER_FREEIF(caps_str); - gst_object_unref(src_pad); - } else if (g_str_has_prefix(mime, "audio")) { - LOGD("found AUDIO decoder\n"); - player->not_supported_codec &= MISSING_PLUGIN_VIDEO; - player->can_support_codec |= FOUND_PLUGIN_AUDIO; - } - } - - if (!__mmplayer_close_link(player, pad, new_element, - name_template, gst_element_factory_get_static_pad_templates(factory))) { - MMPLAYER_FREEIF(name_template); - if (player->keep_detecting_vcodec) - continue; - - /* Link is failed even though a supportable codec is found. */ - __mmplayer_check_not_supported_codec(player, klass, mime); - - LOGE("failed to call _close_link\n"); - return FALSE; - } - - MMPLAYER_FREEIF(name_template); - return TRUE; - } - - gst_caps_unref(res); - break; - } - } - - /* There is no available codec. */ - __mmplayer_check_not_supported_codec(player, klass, mime); - - MMPLAYER_FLEAVE(); - return FALSE; - -ERROR: - /* release */ - if (queue) - gst_object_unref(queue); - - if (queue_pad) - gst_object_unref(queue_pad); - - if (element) - gst_object_unref(element); - - return FALSE; -} - - static int __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime) { @@ -10878,6 +10278,7 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c } else { LOGW("add VIDEO to missing plugin\n"); player->not_supported_codec |= MISSING_PLUGIN_VIDEO; + player->unlinked_video_mime = g_strdup_printf("%s", mime); } } else if (g_str_has_prefix(mime, "audio")) { if ((player->can_support_codec & FOUND_PLUGIN_AUDIO) && (player->audiodec_linked)) { @@ -10885,6 +10286,7 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c } else { LOGW("add AUDIO to missing plugin\n"); player->not_supported_codec |= MISSING_PLUGIN_AUDIO; + player->unlinked_audio_mime = g_strdup_printf("%s", mime); } } } @@ -11877,8 +11279,6 @@ GstCaps* caps, GstElementFactory* factory, gpointer data) mime = gst_structure_get_name(gst_caps_get_structure(caps, 0)); if (g_str_has_prefix(mime, "video")) { - // __mmplayer_check_video_zero_cpoy(player, factory); - player->not_supported_codec &= MISSING_PLUGIN_AUDIO; player->can_support_codec |= FOUND_PLUGIN_VIDEO; @@ -11897,22 +11297,6 @@ DONE: return result; } - -#if 0 -static GValueArray* -__mmplayer_gst_decode_autoplug_factories(GstElement *bin, GstPad* pad, -GstCaps * caps, gpointer data) -{ - //mm_player_t* player = (mm_player_t*)data; - - LOGD("decodebin is requesting factories for caps [%s] from element[%s]", - gst_caps_to_string(caps), - GST_ELEMENT_NAME(GST_PAD_PARENT(pad))); - - return NULL; -} -#endif - static void __mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad* new_pad, gpointer data) @@ -12160,30 +11544,6 @@ static gboolean __mmplayer_configure_audio_callback(mm_player_t* player) } static void -__mmplayer_init_factories(mm_player_t* player) -{ - MMPLAYER_RETURN_IF_FAIL(player); - - player->factories = gst_registry_feature_filter(gst_registry_get(), - (GstPluginFeatureFilter)__mmplayer_feature_filter, FALSE, NULL); - player->factories = g_list_sort(player->factories, (GCompareFunc)util_factory_rank_compare); -} - -static void -__mmplayer_release_factories(mm_player_t* player) -{ - MMPLAYER_FENTER(); - MMPLAYER_RETURN_IF_FAIL(player); - - if (player->factories) { - gst_plugin_feature_list_free(player->factories); - player->factories = NULL; - } - - MMPLAYER_FLEAVE(); -} - -static void __mmplayer_release_misc(mm_player_t* player) { int i; @@ -12263,11 +11623,6 @@ __mmplayer_release_misc(mm_player_t* player) /* free memory related to audio effect */ MMPLAYER_FREEIF(player->audio_effect_info.custom_ext_level_for_plugin); - if (player->state_tune_caps) { - gst_caps_unref(player->state_tune_caps); - player->state_tune_caps = NULL; - } - if (player->adaptive_info.var_list) { g_list_free_full(player->adaptive_info.var_list, g_free); player->adaptive_info.var_list = NULL; @@ -12393,673 +11748,6 @@ static GstElement *__mmplayer_element_create_and_link(mm_player_t *player, GstPa return element; } -static gboolean -__mmplayer_close_link(mm_player_t* player, GstPad *srcpad, GstElement *sinkelement, -const char *padname, const GList *templlist) -{ - GstPad *pad = NULL; - gboolean has_dynamic_pads = FALSE; - gboolean has_many_types = FALSE; - const char *klass = NULL; - GstStaticPadTemplate *padtemplate = NULL; - GstElementFactory *factory = NULL; - GstElement* queue = NULL; - GstElement* parser = NULL; - GstPad *pssrcpad = NULL; - GstPad *qsrcpad = NULL, *qsinkpad = NULL; - MMPlayerGstElement *mainbin = NULL; - GstStructure* str = NULL; - GstCaps* srccaps = NULL; - GstState target_state = GST_STATE_READY; - gboolean isvideo_decoder = FALSE; - guint q_max_size_time = 0; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL(player && - player->pipeline && - player->pipeline->mainbin, - FALSE); - - mainbin = player->pipeline->mainbin; - - LOGD("plugging pad %s:%s to newly create %s:%s\n", - GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)), - GST_PAD_NAME(srcpad), - GST_ELEMENT_NAME(sinkelement), - padname); - - factory = gst_element_get_factory(sinkelement); - klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS); - - /* check if player can do start continually */ - MMPLAYER_CHECK_CMD_IF_EXIT(player); - - /* need it to warm up omx before linking to pipeline */ - if (g_strrstr(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)), "demux")) { - LOGD("get demux caps.\n"); - if (player->state_tune_caps) { - gst_caps_unref(player->state_tune_caps); - player->state_tune_caps = NULL; - } - player->state_tune_caps = gst_caps_copy(gst_pad_get_current_caps(srcpad)); - } - - /* NOTE : OMX Codec can check if resource is available or not at this state. */ - if (g_strrstr(GST_ELEMENT_NAME(sinkelement), "omx")) { - if (player->state_tune_caps != NULL) { - LOGD("set demux's caps to omx codec if resource is available"); - if (gst_pad_set_caps(gst_element_get_static_pad(sinkelement, "sink"), player->state_tune_caps)) { - target_state = GST_STATE_PAUSED; - isvideo_decoder = TRUE; - g_object_set(G_OBJECT(sinkelement), "state-tuning", TRUE, NULL); - } else - LOGW("failed to set caps for state tuning"); - } - gst_caps_unref(player->state_tune_caps); - player->state_tune_caps = NULL; - } - - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, target_state)) { - LOGE("failed to set %d state to %s\n", target_state, GST_ELEMENT_NAME(sinkelement)); - if (isvideo_decoder) { - gst_element_set_state(sinkelement, GST_STATE_NULL); - gst_object_unref(G_OBJECT(sinkelement)); - player->keep_detecting_vcodec = TRUE; - } - goto ERROR; - } - - /* add to pipeline */ - if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), sinkelement)) { - LOGE("failed to add %s to mainbin\n", GST_ELEMENT_NAME(sinkelement)); - goto ERROR; - } - - LOGD("element klass : %s\n", klass); - - /* added to support multi track files */ - /* only decoder case and any of the video/audio still need to link*/ - if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player, srcpad)) { - gchar *name = g_strdup(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad))); - - if (g_strrstr(name, "mpegtsdemux") || g_strrstr(name, "mssdemux")) { - gchar *src_demux_caps_str = NULL; - gchar *needed_parser = NULL; - GstCaps *src_demux_caps = NULL; - gboolean smooth_streaming = FALSE; - - src_demux_caps = gst_pad_query_caps(srcpad, NULL); - src_demux_caps_str = gst_caps_to_string(src_demux_caps); - - gst_caps_unref(src_demux_caps); - - if (g_strrstr(src_demux_caps_str, "video/x-h264")) { - if (g_strrstr(name, "mssdemux")) { - needed_parser = g_strdup("legacyh264parse"); - smooth_streaming = TRUE; - } else - needed_parser = g_strdup("h264parse"); - } else if (g_strrstr(src_demux_caps_str, "video/mpeg")) - needed_parser = g_strdup("mpeg4videoparse"); - - MMPLAYER_FREEIF(src_demux_caps_str); - - if (needed_parser) { - parser = __mmplayer_element_create_and_link(player, srcpad, needed_parser); - MMPLAYER_FREEIF(needed_parser); - - if (!parser) { - LOGE("failed to create parser\n"); - } else { - if (smooth_streaming) - g_object_set(parser, "output-format", 1, NULL); /* NALU/Byte Stream format */ - - /* update srcpad if parser is created */ - pssrcpad = gst_element_get_static_pad(parser, "src"); - srcpad = pssrcpad; - } - } - } - MMPLAYER_FREEIF(name); - - queue = __mmplayer_element_create_and_link(player, srcpad, "queue"); // parser - queue or demuxer - queue - if (!queue) { - LOGE("failed to create queue\n"); - goto ERROR; - } - - /* update srcpad to link with decoder */ - qsrcpad = gst_element_get_static_pad(queue, "src"); - srcpad = qsrcpad; - - q_max_size_time = GST_QUEUE_DEFAULT_TIME; - - /* assigning queue handle for futher manipulation purpose */ - /* FIXIT : make it some kind of list so that msl can support more then two stream(text, data, etc...) */ - if (mainbin[MMPLAYER_M_Q1].gst == NULL) { - mainbin[MMPLAYER_M_Q1].id = MMPLAYER_M_Q1; - mainbin[MMPLAYER_M_Q1].gst = queue; - - if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) { - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", 0 , NULL); - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-buffers", 2, NULL); - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-bytes", 0, NULL); - } else { - if (!MMPLAYER_IS_RTSP_STREAMING(player)) - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL); - } - } else if (mainbin[MMPLAYER_M_Q2].gst == NULL) { - mainbin[MMPLAYER_M_Q2].id = MMPLAYER_M_Q2; - mainbin[MMPLAYER_M_Q2].gst = queue; - - if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) { - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", 0 , NULL); - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-buffers", 2, NULL); - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-bytes", 0, NULL); - } else { - if (!MMPLAYER_IS_RTSP_STREAMING(player)) - g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL); - } - } else { - LOGE("Not supporting more then two elementary stream\n"); - g_assert(1); - } - - pad = gst_element_get_static_pad(sinkelement, padname); - - if (!pad) { - LOGW("failed to get pad(%s) from %s. retrying with [sink]\n", - padname, GST_ELEMENT_NAME(sinkelement)); - - pad = gst_element_get_static_pad(sinkelement, "sink"); - if (!pad) { - LOGE("failed to get pad(sink) from %s. \n", - GST_ELEMENT_NAME(sinkelement)); - goto ERROR; - } - } - - /* to check the video/audio type set the proper flag*/ - const gchar *mime_type = NULL; - srccaps = gst_pad_query_caps(srcpad, NULL); - if (!srccaps) - goto ERROR; - str = gst_caps_get_structure(srccaps, 0); - if (!str) - goto ERROR; - mime_type = gst_structure_get_name(str); - if (!mime_type) - goto ERROR; - - /* link queue and decoder. so, it will be queue - decoder. */ - if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad)) { - gst_object_unref(GST_OBJECT(pad)); - LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname); - - /* reconstitute supportable codec */ - if (strstr(mime_type, "video")) - player->can_support_codec ^= FOUND_PLUGIN_VIDEO; - else if (strstr(mime_type, "audio")) - player->can_support_codec ^= FOUND_PLUGIN_AUDIO; - goto ERROR; - } - - if (strstr(mime_type, "video")) { - player->videodec_linked = 1; - LOGI("player->videodec_linked set to 1\n"); - - } else if (strstr(mime_type, "audio")) { - player->audiodec_linked = 1; - LOGI("player->auddiodec_linked set to 1\n"); - } - - gst_object_unref(GST_OBJECT(pad)); - gst_caps_unref(GST_CAPS(srccaps)); - srccaps = NULL; - } - - if (!MMPLAYER_IS_HTTP_PD(player)) { - if ((g_strrstr(klass, "Demux") && !g_strrstr(klass, "Metadata")) || (g_strrstr(klass, "Parser"))) { - if (MMPLAYER_IS_HTTP_STREAMING(player)) { - gint64 dur_bytes = 0L; - muxed_buffer_type_e type = MUXED_BUFFER_TYPE_MEM_QUEUE; - - if (!mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) { - LOGD("creating http streaming buffering queue\n"); - - queue = gst_element_factory_make("queue2", "queue2"); - if (!queue) { - LOGE("failed to create buffering queue element\n"); - goto ERROR; - } - - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY)) { - LOGE("failed to set state READY to buffering queue\n"); - goto ERROR; - } - - if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue)) { - LOGE("failed to add buffering queue\n"); - goto ERROR; - } - - qsinkpad = gst_element_get_static_pad(queue, "sink"); - qsrcpad = gst_element_get_static_pad(queue, "src"); - - if (GST_PAD_LINK_OK != gst_pad_link(srcpad, qsinkpad)) { - LOGE("failed to link buffering queue\n"); - goto ERROR; - } - srcpad = qsrcpad; - - - mainbin[MMPLAYER_M_MUXED_S_BUFFER].id = MMPLAYER_M_MUXED_S_BUFFER; - mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = queue; - - if (!MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) { - if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes)) - LOGE("fail to get duration.\n"); - - if (dur_bytes > 0) { - if (MMPLAYER_USE_FILE_FOR_BUFFERING(player)) { - type = MUXED_BUFFER_TYPE_FILE; - } else { - type = MUXED_BUFFER_TYPE_MEM_RING_BUFFER; - if (player->streamer) - player->streamer->ring_buffer_size = player->ini.http_ring_buffer_size; - } - } else { - dur_bytes = 0; - } - } - - /* NOTE : we cannot get any duration info from ts container in case of streaming */ - if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux")) { - __mm_player_streaming_set_queue2(player->streamer, - queue, - TRUE, - player->ini.http_max_size_bytes, - player->ini.http_buffering_time, - 1.0, - player->ini.http_buffering_limit, - type, - player->http_file_buffering_path, - (guint64)dur_bytes); - } - } - } - } - } - /* if it is not decoder or */ - /* in decoder case any of the video/audio still need to link*/ - if (!g_strrstr(klass, "Decoder")) { - pad = gst_element_get_static_pad(sinkelement, padname); - if (!pad) { - LOGW("failed to get pad(%s) from %s. retrying with [sink]\n", - padname, GST_ELEMENT_NAME(sinkelement)); - - pad = gst_element_get_static_pad(sinkelement, "sink"); - - if (!pad) { - LOGE("failed to get pad(sink) from %s. \n", - GST_ELEMENT_NAME(sinkelement)); - goto ERROR; - } - } - - if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad)) { - gst_object_unref(GST_OBJECT(pad)); - LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname); - goto ERROR; - } - - gst_object_unref(GST_OBJECT(pad)); - } - - for (; templlist != NULL; templlist = templlist->next) { - padtemplate = templlist->data; - - LOGD("director = [%d], presence = [%d]\n", padtemplate->direction, padtemplate->presence); - - if (padtemplate->direction != GST_PAD_SRC || - padtemplate->presence == GST_PAD_REQUEST) - continue; - - switch (padtemplate->presence) { - case GST_PAD_ALWAYS: - { - GstPad *srcpad = gst_element_get_static_pad(sinkelement, "src"); - GstCaps *caps = gst_pad_query_caps(srcpad, NULL); - - /* Check whether caps has many types */ - if (!gst_caps_is_fixed(caps)) { - LOGD("always pad but, caps has many types"); - MMPLAYER_LOG_GST_CAPS_TYPE(caps); - has_many_types = TRUE; - break; - } - - if (!__mmplayer_try_to_plug(player, srcpad, caps)) { - gst_object_unref(GST_OBJECT(srcpad)); - gst_caps_unref(GST_CAPS(caps)); - - LOGE("failed to plug something after %s\n", GST_ELEMENT_NAME(sinkelement)); - goto ERROR; - } - - gst_caps_unref(GST_CAPS(caps)); - gst_object_unref(GST_OBJECT(srcpad)); - - } - break; - - - case GST_PAD_SOMETIMES: - has_dynamic_pads = TRUE; - break; - - default: - break; - } - } - - /* check if player can do start continually */ - MMPLAYER_CHECK_CMD_IF_EXIT(player); - - if (has_dynamic_pads) { - player->have_dynamic_pad = TRUE; - MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added", - G_CALLBACK(__mmplayer_add_new_pad), player); - - /* for streaming, more then one typefind will used for each elementary stream - * so this doesn't mean the whole pipeline completion - */ - if (!MMPLAYER_IS_RTSP_STREAMING(player)) { - MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads", - G_CALLBACK(__mmplayer_pipeline_complete), player); - } - } - - if (has_many_types) { - GstPad *pad = NULL; - - player->has_many_types = has_many_types; - - pad = gst_element_get_static_pad(sinkelement, "src"); - MMPLAYER_SIGNAL_CONNECT(player, pad, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "notify::caps", G_CALLBACK(__mmplayer_add_new_caps), player); - gst_object_unref(GST_OBJECT(pad)); - } - - - /* check if player can do start continually */ - MMPLAYER_CHECK_CMD_IF_EXIT(player); - - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, GST_STATE_PAUSED)) { - LOGE("failed to set state PAUSED to %s\n", GST_ELEMENT_NAME(sinkelement)); - goto ERROR; - } - - if (queue) { - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED)) { - LOGE("failed to set state PAUSED to queue\n"); - goto ERROR; - } - - queue = NULL; - - gst_object_unref(GST_OBJECT(qsrcpad)); - qsrcpad = NULL; - } - - if (parser) { - if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(parser, GST_STATE_PAUSED)) { - LOGE("failed to set state PAUSED to queue\n"); - goto ERROR; - } - - parser = NULL; - - gst_object_unref(GST_OBJECT(pssrcpad)); - pssrcpad = NULL; - } - - MMPLAYER_FLEAVE(); - - return TRUE; - -ERROR: - - if (queue) { - gst_object_unref(GST_OBJECT(qsrcpad)); - - /* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state. - * You need to explicitly set elements to the NULL state before - * dropping the final reference, to allow them to clean up. - */ - gst_element_set_state(queue, GST_STATE_NULL); - /* And, it still has a parent "player". - * You need to let the parent manage the object instead of unreffing the object directly. - */ - - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue); - //gst_object_unref(queue); - } - - if (srccaps) - gst_caps_unref(GST_CAPS(srccaps)); - - return FALSE; -} - -static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data) -{ - const gchar *klass; - - /* we only care about element factories */ - if (!GST_IS_ELEMENT_FACTORY(feature)) - return FALSE; - - /* only parsers, demuxers and decoders */ - klass = gst_element_factory_get_metadata(GST_ELEMENT_FACTORY(feature), GST_ELEMENT_METADATA_KLASS); - - if (g_strrstr(klass, "Demux") == NULL && - g_strrstr(klass, "Codec/Decoder") == NULL && - g_strrstr(klass, "Depayloader") == NULL && - g_strrstr(klass, "Parse") == NULL) - return FALSE; - return TRUE; -} - - -static void __mmplayer_add_new_caps(GstPad* pad, GParamSpec* unused, gpointer data) -{ - mm_player_t* player = (mm_player_t*) data; - GstCaps *caps = NULL; - GstStructure *str = NULL; - const char *name; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_IF_FAIL(pad) - MMPLAYER_RETURN_IF_FAIL(unused) - MMPLAYER_RETURN_IF_FAIL(data) - - caps = gst_pad_query_caps(pad, NULL); - if (!caps) - return; - - str = gst_caps_get_structure(caps, 0); - if (!str) - return; - - name = gst_structure_get_name(str); - if (!name) - return; - LOGD("name=%s\n", name); - - if (!__mmplayer_try_to_plug(player, pad, caps)) { - LOGE("failed to autoplug for type(%s)\n", name); - gst_caps_unref(caps); - return; - } - - gst_caps_unref(caps); - - __mmplayer_pipeline_complete(NULL, (gpointer)player); - - MMPLAYER_FLEAVE(); - - return; -} - -static void __mmplayer_set_unlinked_mime_type(mm_player_t* player, GstCaps *caps) -{ - GstStructure *str; - gint version = 0; - const char *stream_type; - gchar *version_field = NULL; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_IF_FAIL(player); - MMPLAYER_RETURN_IF_FAIL(caps); - - str = gst_caps_get_structure(caps, 0); - if (!str) - return; - - stream_type = gst_structure_get_name(str); - if (!stream_type) - return; - - - /* set unlinked mime type for downloadable codec */ - if (g_str_has_prefix(stream_type, "video/")) { - if (g_str_has_prefix(stream_type, "video/mpeg")) { - gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version); - version_field = MM_PLAYER_MPEG_VNAME; - } else if (g_str_has_prefix(stream_type, "video/x-wmv")) { - gst_structure_get_int(str, MM_PLAYER_WMV_VNAME, &version); - version_field = MM_PLAYER_WMV_VNAME; - - } else if (g_str_has_prefix(stream_type, "video/x-divx")) { - gst_structure_get_int(str, MM_PLAYER_DIVX_VNAME, &version); - version_field = MM_PLAYER_DIVX_VNAME; - } - - if (version) - player->unlinked_video_mime = g_strdup_printf("%s, %s=%d", stream_type, version_field, version); - else - player->unlinked_video_mime = g_strdup_printf("%s", stream_type); - } else if (g_str_has_prefix(stream_type, "audio/")) { - if (g_str_has_prefix(stream_type, "audio/mpeg")) { - // mp3 or aac - gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version); - version_field = MM_PLAYER_MPEG_VNAME; - } else if (g_str_has_prefix(stream_type, "audio/x-wma")) { - gst_structure_get_int(str, MM_PLAYER_WMA_VNAME, &version); - version_field = MM_PLAYER_WMA_VNAME; - } - - if (version) - player->unlinked_audio_mime = g_strdup_printf("%s, %s=%d", stream_type, version_field, version); - else - player->unlinked_audio_mime = g_strdup_printf("%s", stream_type); - } - - MMPLAYER_FLEAVE(); -} - -static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer data) -{ - mm_player_t* player = (mm_player_t*) data; - GstCaps *caps = NULL; - GstStructure *str = NULL; - const char *name; - - MMPLAYER_FENTER(); - MMPLAYER_RETURN_IF_FAIL(player); - MMPLAYER_RETURN_IF_FAIL(pad); - - GST_OBJECT_LOCK(pad); - if ((caps = gst_pad_get_current_caps(pad))) - gst_caps_ref(caps); - GST_OBJECT_UNLOCK(pad); - - if (NULL == caps) { - caps = gst_pad_query_caps(pad, NULL); - if (!caps) return; - } - - MMPLAYER_LOG_GST_CAPS_TYPE(caps); - - str = gst_caps_get_structure(caps, 0); - if (!str) - return; - - name = gst_structure_get_name(str); - if (!name) - return; - - player->num_dynamic_pad++; - LOGD("stream count inc : %d\n", player->num_dynamic_pad); - - /* Note : If the stream is the subtitle, we try not to play it. Just close the demuxer subtitle pad. - * If want to play it, remove this code. - */ - if (g_strrstr(name, "application")) { - if (g_strrstr(name, "x-id3") || g_strrstr(name, "x-apetag")) { - /* If id3/ape tag comes, keep going */ - LOGD("application mime exception : id3/ape tag"); - } else { - /* Otherwise, we assume that this stream is subtile. */ - LOGD(" application mime type pad is closed."); - return; - } - } else if (g_strrstr(name, "audio")) { - gint samplerate = 0, channels = 0; - - if (player->audiodec_linked) { - gst_caps_unref(caps); - LOGD("multi tracks. skip to plug"); - return; - } - - /* set stream information */ - /* if possible, set it here because the caps is not distrubed by resampler. */ - gst_structure_get_int(str, "rate", &samplerate); - mm_attrs_set_int_by_name(player->attrs, "content_audio_samplerate", samplerate); - - gst_structure_get_int(str, "channels", &channels); - mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels); - - LOGD("audio samplerate : %d channels : %d", samplerate, channels); - } else if (g_strrstr(name, "video")) { - gint stype; - mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype); - - /* don't make video because of not required */ - if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE) { - LOGD("no video because it's not required"); - return; - } - - player->v_stream_caps = gst_caps_copy(caps); //if needed, video caps is required when videobin is created - } - - if (!__mmplayer_try_to_plug(player, pad, caps)) { - LOGE("failed to autoplug for type(%s)", name); - - __mmplayer_set_unlinked_mime_type(player, caps); - } - - gst_caps_unref(caps); - - MMPLAYER_FLEAVE(); - return; -} - gboolean __mmplayer_check_subtitle(mm_player_t* player) { @@ -13392,116 +12080,6 @@ __mmplayer_eos_timer_cb(gpointer u_data) return FALSE; } -static gboolean -__mmplayer_link_decoder(mm_player_t* player, GstPad *srcpad) -{ - const gchar* name = NULL; - GstStructure* str = NULL; - GstCaps* srccaps = NULL; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - MMPLAYER_RETURN_VAL_IF_FAIL(srcpad, FALSE); - - /* to check any of the decoder(video/audio) need to be linked to parser*/ - srccaps = gst_pad_query_caps(srcpad, NULL); - if (!srccaps) - goto ERROR; - - str = gst_caps_get_structure(srccaps, 0); - if (!str) - goto ERROR; - - name = gst_structure_get_name(str); - if (!name) - goto ERROR; - - if (strstr(name, "video")) { - if (player->videodec_linked) { - LOGI("Video decoder already linked\n"); - return FALSE; - } - } - if (strstr(name, "audio")) { - if (player->audiodec_linked) { - LOGI("Audio decoder already linked\n"); - return FALSE; - } - } - - gst_caps_unref(srccaps); - - MMPLAYER_FLEAVE(); - - return TRUE; - -ERROR: - if (srccaps) - gst_caps_unref(srccaps); - - return FALSE; -} - -static gboolean -__mmplayer_link_sink(mm_player_t* player , GstPad *srcpad) -{ - const gchar* name = NULL; - GstStructure* str = NULL; - GstCaps* srccaps = NULL; - - MMPLAYER_FENTER(); - - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); - MMPLAYER_RETURN_VAL_IF_FAIL(srcpad, FALSE); - - /* to check any of the decoder(video/audio) need to be linked to parser*/ - srccaps = gst_pad_query_caps(srcpad, NULL); - if (!srccaps) - goto ERROR; - - str = gst_caps_get_structure(srccaps, 0); - if (!str) - goto ERROR; - - name = gst_structure_get_name(str); - if (!name) - goto ERROR; - - if (strstr(name, "video")) { - if (player->videosink_linked) { - LOGI("Video Sink already linked\n"); - return FALSE; - } - } - if (strstr(name, "audio")) { - if (player->audiosink_linked) { - LOGI("Audio Sink already linked\n"); - return FALSE; - } - } - if (strstr(name, "text")) { - if (player->textsink_linked) { - LOGI("Text Sink already linked\n"); - return FALSE; - } - } - - gst_caps_unref(srccaps); - - MMPLAYER_FLEAVE(); - - //return (!player->videosink_linked || !player->audiosink_linked); - return TRUE; - -ERROR: - if (srccaps) - gst_caps_unref(srccaps); - - return FALSE; -} - - /* sending event to one of sinkelements */ static gboolean __gst_send_event_to_sink(mm_player_t* player, GstEvent* event) @@ -13565,13 +12143,6 @@ __gst_send_event_to_sink(mm_player_t* player, GstEvent* event) sinks = g_list_next(sinks); } -#if 0 - if (internal_sub) - request pad name = sink0; - else - request pad name = sink1; // external -#endif - /* Note : Textbin is not linked to the video or audio bin. * It needs to send the event to the text sink seperatelly. */ @@ -14581,45 +13152,6 @@ __has_suffix(mm_player_t* player, const gchar* suffix) } int -_mmplayer_set_display_zoom(MMHandleType hplayer, float level, int x, int y) -{ - mm_player_t* player = (mm_player_t*) hplayer; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_VIDEO_SINK_CHECK(player); - - LOGD("setting display zoom level = %f, offset = %d, %d", level, x, y); - - g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "zoom", level, "zoom-pos-x", x, "zoom-pos-y", y, NULL); - - return MM_ERROR_NONE; -} -int -_mmplayer_get_display_zoom(MMHandleType hplayer, float *level, int *x, int *y) -{ - - mm_player_t* player = (mm_player_t*) hplayer; - float _level = 0.0; - int _x = 0; - int _y = 0; - - MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - MMPLAYER_VIDEO_SINK_CHECK(player); - - g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "zoom", &_level, "zoom-pos-x", &_x, "zoom-pos-y", &_y, NULL); - - LOGD("display zoom level = %f, start off x = %d, y = %d", _level, _x, _y); - - *level = _level; - *x = _x; - *y = _y; - - return MM_ERROR_NONE; -} - -int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode) { mm_player_t* player = (mm_player_t*) hplayer; |