X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_player_priv.c;h=3689bed668f0c5bdf13a2435a038623deeee1eff;hb=refs%2Ftags%2Faccepted%2Ftizen%2Funified%2F20240219.160358;hp=1925e54df4091de93b597b170b349d90b995c952;hpb=202effe0ecca168973ef34f9049075d8ba9f51a2;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 1925e54..3689bed 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -107,6 +107,8 @@ #define DEFAULT_PCM_OUT_SAMPLERATE 44100 #define DEFAULT_PCM_OUT_CHANNEL 2 +#define MQ_UNLINKED_CACHE_TIME (500 * GST_MSECOND) + /*--------------------------------------------------------------------------- | LOCAL CONSTANT DEFINITIONS: | ---------------------------------------------------------------------------*/ @@ -1038,10 +1040,12 @@ __mmplayer_gst_combiner_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer case GST_EVENT_EOS: { /* in case of gapless, drop eos event not to send it to sink */ + MMPLAYER_RECONFIGURE_LOCK(player); if (player->gapless.reconfigure && !player->msg_posted) { LOGD("[%d] %s:%s EOS received but will be drop", stream_type, GST_DEBUG_PAD_NAME(pad)); ret = GST_PAD_PROBE_DROP; } + MMPLAYER_RECONFIGURE_UNLOCK(player); break; } case GST_EVENT_STREAM_START: @@ -4257,9 +4261,9 @@ __mmplayer_update_subtitle(GstElement *object, GstBuffer *buffer, GstPad *pad, g LOGI("subtitle duration is invalid, subtitle duration change " "GST_CLOCK_TIME_NONE -> %" GST_TIME_FORMAT, GST_TIME_ARGS(duration)); } - msg.subtitle.duration = GST_TIME_AS_MSECONDS(duration); + msg.subtitle.duration = (unsigned long)GST_TIME_AS_MSECONDS(duration); - LOGD("update subtitle : [%ld msec] %s", msg.subtitle.duration, (char *)msg.data); + LOGD("update subtitle : [%lu msec] %s", msg.subtitle.duration, (char *)msg.data); MMPLAYER_POST_MSG(player, MM_MESSAGE_UPDATE_SUBTITLE, &msg); gst_buffer_unmap(buffer, &mapinfo); @@ -4277,17 +4281,13 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp gint64 adjusted_timestamp = 0; GstBuffer *buffer = gst_pad_probe_info_get_buffer(info); - MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE); + MMPLAYER_RETURN_VAL_IF_FAIL(player, GST_PAD_PROBE_DROP); - if (player->set_mode.subtitle_off) { - LOGD("subtitle is OFF."); - return TRUE; - } + if (player->set_mode.subtitle_off) + return GST_PAD_PROBE_OK; - if (player->adjust_subtitle_pos == 0) { - LOGD("nothing to do"); - return TRUE; - } + if (player->adjust_subtitle_pos == 0) + return GST_PAD_PROBE_OK; cur_timestamp = GST_BUFFER_TIMESTAMP(buffer); adjusted_timestamp = (gint64)cur_timestamp + ((gint64)player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000)); @@ -4295,7 +4295,7 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp if (adjusted_timestamp < 0) { LOGD("adjusted_timestamp under zero"); MMPLAYER_FLEAVE(); - return FALSE; + return GST_PAD_PROBE_DROP; } GST_BUFFER_TIMESTAMP(buffer) = (GstClockTime) adjusted_timestamp; @@ -6078,12 +6078,10 @@ _mmplayer_typefind_have_type(GstElement *tf, guint probability, MMPLAYER_RETURN_IF_FAIL(player && tf && caps); - MMPLAYER_LOG_GST_CAPS_TYPE(caps); MMPLAYER_FREEIF(player->type_caps_str); player->type_caps_str = gst_caps_to_string(caps); - if (player->type_caps_str) - LOGD("[handle: %p] media type %s found, probability %d%% / %d", - player, player->type_caps_str, probability, gst_caps_get_size(caps)); + LOGD("[handle: %p] media type %s found, probability %d%% / %d", + player, player->type_caps_str, probability, gst_caps_get_size(caps)); if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (g_strrstr(player->type_caps_str, "audio/x-raw-int"))) { @@ -7893,8 +7891,15 @@ _mmplayer_gst_element_added(GstBin *bin, GstElement *element, gpointer data) } } else if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) && (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue"))) { + LOGD("plugged element is multiqueue. take it %s", GST_ELEMENT_NAME(element)); + /* set mq unlinked cache size to avoid not-linked error */ + gboolean sync_by_running_time = FALSE; + g_object_get(G_OBJECT(element), "sync-by-running-time", &sync_by_running_time, NULL); + if (sync_by_running_time) + g_object_set(G_OBJECT(element), "unlinked-cache-time", MQ_UNLINKED_CACHE_TIME, NULL); + player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER; player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element; @@ -8064,15 +8069,15 @@ __mmplayer_check_subtitle(mmplayer_t *player) /* get subtitle attribute */ attrs = MMPLAYER_GET_ATTRS(player); - if (!attrs) - return FALSE; + MMPLAYER_RETURN_VAL_IF_FAIL(attrs, FALSE); mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri); - if (!subtitle_uri || !strlen(subtitle_uri)) + if (!subtitle_uri || (strlen(subtitle_uri) == 0)) { + MMPLAYER_FLEAVE(); return FALSE; + } SECURE_LOGD("subtitle uri is %s[%zu]", subtitle_uri, strlen(subtitle_uri)); - player->is_external_subtitle_present = TRUE; MMPLAYER_FLEAVE(); @@ -8351,14 +8356,26 @@ _mmplayer_sync_subtitle_pipeline(mmplayer_t *player) LOGD("seek time = %"G_GINT64_FORMAT", rate = %f", time, player->playback_rate); event = gst_event_new_seek(player->playback_rate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1); - if (event) { - _mmplayer_gst_send_event_to_sink(player, event); - } else { + if (!event) { result = MM_ERROR_PLAYER_INTERNAL; LOGE("gst_event_new_seek failed"); /* pipeline will got error and can not be recovered */ goto ERROR; } + if (player->seek_state == MMPLAYER_SEEK_IN_PROGRESS) { + GstElement *text_sink = GST_ELEMENT_CAST(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst); + if (GST_IS_ELEMENT(text_sink)) { + if (gst_element_send_event(text_sink, event)) + LOGD("sending event[%s] to subtitle sink element [%s] success!", + GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(text_sink)); + else + LOGE("sending event[%s] to subtitle sink element [%s] failed!", + GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(text_sink)); + } + } else { + _mmplayer_gst_send_event_to_sink(player, event); + } + /* sync state with current pipeline */ gst_element_sync_state_with_parent(textbin[MMPLAYER_T_BIN].gst); gst_element_sync_state_with_parent(mainbin[MMPLAYER_M_SUBPARSE].gst); @@ -8562,6 +8579,7 @@ _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char *filepath) } MMPLAYER_SUBTITLE_INFO_UNLOCK(player); } + player->is_external_subtitle_present = TRUE; MMPLAYER_FLEAVE(); return result;