#define DEFAULT_PCM_OUT_SAMPLERATE 44100
#define DEFAULT_PCM_OUT_CHANNEL 2
+#define MQ_UNLINKED_CACHE_TIME (500 * GST_MSECOND)
+
/*---------------------------------------------------------------------------
| LOCAL CONSTANT DEFINITIONS: |
---------------------------------------------------------------------------*/
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:
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);
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));
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;
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"))) {
}
} 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;
/* 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();
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);
}
MMPLAYER_SUBTITLE_INFO_UNLOCK(player);
}
+ player->is_external_subtitle_present = TRUE;
MMPLAYER_FLEAVE();
return result;
player = (mmplayer_t *)hplayer;
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(type < MM_PLAYER_TRACK_TYPE_MAX, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (!player->pipeline) {
LOGE("Track %d pre setting -> %d", type, index);