guint min_frame_size;
gboolean passthrough;
gboolean pts_interpolate;
+ gboolean infer_ts;
gboolean syncable;
gboolean has_timing_info;
guint fps_num, fps_den;
parse->priv->syncable = TRUE;
parse->priv->passthrough = FALSE;
parse->priv->pts_interpolate = TRUE;
+ parse->priv->infer_ts = TRUE;
parse->priv->has_timing_info = FALSE;
parse->priv->post_min_bitrate = TRUE;
parse->priv->post_avg_bitrate = TRUE;
parse->priv->next_dts = next_dts;
parse->priv->last_pts = GST_CLOCK_TIME_NONE;
parse->priv->last_dts = GST_CLOCK_TIME_NONE;
+ parse->priv->prev_pts = GST_CLOCK_TIME_NONE;
+ parse->priv->prev_dts = GST_CLOCK_TIME_NONE;
parse->priv->discont = TRUE;
parse->priv->seen_keyframe = FALSE;
break;
/* interpolating and no valid pts yet,
* start with dts and carry on from there */
- if (parse->priv->pts_interpolate &&
- !GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts))
+ if (parse->priv->infer_ts && !GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts))
parse->priv->next_pts = parse->priv->next_dts;
/* again use default handler to add missing metadata;
if (GST_CLOCK_TIME_IS_VALID (dts) && (parse->priv->prev_dts != dts))
parse->priv->prev_dts = parse->priv->next_dts = dts;
+ /* we can mess with, erm interpolate, timestamps,
+ * and incoming stuff has PTS but no DTS seen so far,
+ * then pick up DTS from PTS and hope for the best ... */
+ if (parse->priv->infer_ts &&
+ !GST_CLOCK_TIME_IS_VALID (dts) &&
+ !GST_CLOCK_TIME_IS_VALID (parse->priv->prev_dts) &&
+ GST_CLOCK_TIME_IS_VALID (pts))
+ parse->priv->next_dts = pts;
+
/* always pass all available data */
data = gst_adapter_map (parse->priv->adapter, av);
/* arrange for actual data to be copied if subclass tries to,
}
/**
+ * gst_base_parse_set_infer_ts:
+ * @parse: a #GstBaseParse
+ * @infer_ts: %TRUE if parser should infer DTS/PTS from each other
+ *
+ * By default, the base class might try to infer PTS from DTS and vice
+ * versa. While this is generally correct for audio data, it may not
+ * be otherwise. Sub-classes implementing such formats should disable
+ * timestamp infering.
+ */
+void
+gst_base_parse_set_infer_ts (GstBaseParse * parse, gboolean infer_ts)
+{
+ parse->priv->infer_ts = infer_ts;
+ GST_INFO_OBJECT (parse, "TS infering: %s", (infer_ts) ? "yes" : "no");
+}
+
+/**
* gst_base_parse_set_latency:
* @parse: a #GstBaseParse
* @min_latency: minimum parse latency