GstTagList *parser_tags;
GstTagMergeMode parser_tags_merge_mode;
gboolean tags_changed;
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ /* to get pad mode early */
+ GstPadMode expected_pad_mode;
+ /* check first frame in base parser */
+ gboolean first_frame;
+ /* remove zero padding */
+ gint64 remove_from_total;
+ gboolean accurate_index_seek;
+#endif
};
typedef struct _GstBaseParseSeek
parse->priv->pad_mode = GST_PAD_MODE_NONE;
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ parse->priv->expected_pad_mode = GST_PAD_MODE_NONE;
+#endif
+
g_mutex_init (&parse->priv->index_lock);
/* init state */
}
}
-static GstBaseParseFrame *
+GstBaseParseFrame *
gst_base_parse_frame_copy (GstBaseParseFrame * frame)
{
GstBaseParseFrame *copy;
parse->priv->skip = 0;
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ parse->priv->first_frame = TRUE;
+ parse->priv->remove_from_total = 0;
+ parse->priv->accurate_index_seek = TRUE;
+#endif
+
g_list_foreach (parse->priv->pending_events, (GFunc) gst_mini_object_unref,
NULL);
g_list_free (parse->priv->pending_events);
GST_INFO_OBJECT (parse,
"Chose default caps %" GST_PTR_FORMAT " for initial gap", default_caps);
- gst_caps_unref (sinkcaps);
+ if (sinkcaps)
+ gst_caps_unref (sinkcaps);
gst_caps_unref (caps);
return default_caps;
if (!parse->priv->framecount)
goto no_framecount;
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ duration = parse->priv->acc_duration / GST_USECOND;
+#else
duration = parse->priv->acc_duration / GST_MSECOND;
+#endif
bytes = parse->priv->bytecount;
if (G_UNLIKELY (!duration || !bytes))
if (dest_format == GST_FORMAT_TIME) {
/* BYTES -> TIME conversion */
GST_DEBUG_OBJECT (parse, "converting bytes -> time");
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ src_value = src_value - parse->priv->remove_from_total;
+#endif
*dest_value = gst_util_uint64_scale (src_value, duration, bytes);
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ *dest_value /= GST_USECOND;
+#endif
*dest_value *= GST_MSECOND;
GST_DEBUG_OBJECT (parse, "conversion result: %" G_GINT64_FORMAT " ms",
*dest_value / GST_MSECOND);
} else if (src_format == GST_FORMAT_TIME) {
if (dest_format == GST_FORMAT_BYTES) {
GST_DEBUG_OBJECT (parse, "converting time -> bytes");
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ *dest_value = gst_util_uint64_scale (src_value / GST_USECOND, bytes,
+ duration);
+#else
*dest_value = gst_util_uint64_scale (src_value / GST_MSECOND, bytes,
duration);
+#endif
GST_DEBUG_OBJECT (parse,
"time %" G_GINT64_FORMAT " ms in bytes = %" G_GINT64_FORMAT,
src_value / GST_MSECOND, *dest_value);
gst_adapter_push (parse->priv->adapter, buffer);
}
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ /* some one-time start-up */
+ if (G_UNLIKELY (parse->priv->framecount == 0)) {
+ gst_base_parse_check_seekability (parse);
+ gst_base_parse_check_upstream (parse);
+ }
+#endif
+
frame = gst_base_parse_prepare_frame (parse, buffer);
ret = klass->handle_frame (parse, frame, skip);
* we may have new information on frame properties */
gst_base_parse_parse_frame (parse, frame);
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ if (parse->priv->first_frame) {
+ parse->priv->remove_from_total = GST_BUFFER_OFFSET (buffer);
+ GST_DEBUG_OBJECT (parse, "first frame has offset %" G_GINT64_FORMAT ". remove from total",
+ parse->priv->remove_from_total);
+ parse->priv->first_frame = FALSE;
+ }
+#endif
+
parse->priv->next_pts = GST_CLOCK_TIME_NONE;
if (GST_BUFFER_DTS_IS_VALID (buffer) && GST_BUFFER_DURATION_IS_VALID (buffer)) {
parse->priv->next_dts =
buffer = frame->buffer;
+#ifdef TIZEN_PROFILE_TV
+ if (!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer))) {
+ GST_LOG_OBJECT (parse, "invalid pts, set with dts");
+ GST_BUFFER_PTS (buffer) = GST_BUFFER_DTS (buffer);
+ }
+#endif
+
GST_LOG_OBJECT (parse,
"processing buffer of size %" G_GSIZE_FORMAT " with dts %" GST_TIME_FORMAT
", pts %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
if (parse->priv->update_interval < 0)
parse->priv->update_interval = 50;
else if (parse->priv->update_interval > 0 &&
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ ((parse->priv->framecount - 1) % parse->priv->update_interval) == 0)
+#else
(parse->priv->framecount % parse->priv->update_interval) == 0)
+#endif
gst_base_parse_update_duration (parse);
if (GST_BUFFER_PTS_IS_VALID (buffer))
GST_DEBUG_OBJECT (parse, "sink %sactivate in %s mode",
(active) ? "" : "de", gst_pad_mode_get_name (mode));
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ /* to know early what is the mode */
+ parse->priv->expected_pad_mode = active ? mode : GST_PAD_MODE_NONE;
+#endif
+
if (!gst_base_parse_activate (parse, active))
goto activate_failed;
/* maybe we can be accurate for (almost) free */
gst_base_parse_find_offset (parse, seeksegment.position, TRUE, &start_ts);
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+ if (parse->priv->accurate_index_seek) {
+ if (seeksegment.position <= start_ts + TARGET_DIFFERENCE) {
+ GST_DEBUG_OBJECT (parse, "accurate seek possible");
+ accurate = TRUE;
+ }
+ } else {
+ GST_DEBUG_OBJECT (parse, "accurate seek NOT possible");
+ accurate = FALSE;
+ }
+#else
if (seeksegment.position <= start_ts + TARGET_DIFFERENCE) {
GST_DEBUG_OBJECT (parse, "accurate seek possible");
accurate = TRUE;
}
+#endif
if (accurate) {
GstClockTime startpos;
GST_OBJECT_UNLOCK (parse);
}
+
+#ifdef TIZEN_FEATURE_BASEPARSE_MODIFICATION
+void
+gst_base_parse_get_upstream_size (GstBaseParse * parse,
+ gint64 * upstream_size)
+{
+ GST_BASE_PARSE_INDEX_LOCK (parse);
+ *upstream_size = parse->priv->upstream_size;
+ GST_INFO_OBJECT (parse, "get upstream_size for child parser : (%"G_GUINT64_FORMAT")",
+ parse->priv->upstream_size);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
+}
+
+void
+gst_base_parse_get_index_last_offset (GstBaseParse * parse,
+ gint64 * index_last_offset)
+{
+ GST_BASE_PARSE_INDEX_LOCK (parse);
+ *index_last_offset = parse->priv->index_last_offset;
+ GST_INFO_OBJECT (parse, "get index_last_offset for child parser : (%"G_GUINT64_FORMAT")",
+ parse->priv->index_last_offset);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
+}
+
+void
+gst_base_parse_get_index_last_ts (GstBaseParse * parse,
+ GstClockTime * index_last_ts)
+{
+ GST_BASE_PARSE_INDEX_LOCK (parse);
+ *index_last_ts = parse->priv->index_last_ts;
+ GST_INFO_OBJECT (parse, "get index_last_ts for child parser : (%"GST_TIME_FORMAT")",
+ GST_TIME_ARGS(parse->priv->index_last_ts));
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
+}
+
+void
+gst_base_parse_get_pad_mode (GstBaseParse * parse,
+ GstPadMode * pad_mode)
+{
+ GST_BASE_PARSE_INDEX_LOCK (parse);
+ *pad_mode = parse->priv->expected_pad_mode;
+ GST_INFO_OBJECT (parse, "get pad_mode for child parse: mode num (%d)",
+ parse->priv->expected_pad_mode);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
+}
+/*
+ * Checks if accurate seek mode are avilable from sub-parse
+ */
+void
+gst_base_parse_set_seek_mode (GstBaseParse * parse, gboolean seek_mode)
+{
+ g_return_if_fail (parse != NULL);
+ parse->priv->accurate_index_seek = seek_mode;
+ if (seek_mode)
+ GST_INFO_OBJECT (parse, "accurate seek mode ON");
+ else
+ GST_INFO_OBJECT (parse, "accurate seek mode OFF - for HTTP SEEK");
+}
+#endif