typefind: Propagate input buffer offset

The initial buffers might have non-default offsets, make sure they get
propagated if present.
This commit is contained in:
Edward Hervey 2014-11-04 19:11:50 +01:00
parent 05092eda8e
commit f1c2cd60c3
2 changed files with 6 additions and 0 deletions

View file

@ -524,6 +524,7 @@ start_typefinding (GstTypeFindElement * typefind)
GST_OBJECT_LOCK (typefind);
if (typefind->caps)
gst_caps_replace (&typefind->caps, NULL);
typefind->initial_offs = (guint64) - 1;
GST_OBJECT_UNLOCK (typefind);
typefind->mode = MODE_TYPEFIND;
@ -559,6 +560,7 @@ stop_typefinding (GstTypeFindElement * typefind)
buffer = gst_adapter_take_buffer (typefind->adapter, avail);
GST_BUFFER_PTS (buffer) = pts;
GST_BUFFER_DTS (buffer) = dts;
GST_BUFFER_OFFSET (buffer) = typefind->initial_offs;
GST_OBJECT_UNLOCK (typefind);
if (!push_cached_buffers) {
@ -839,6 +841,8 @@ gst_type_find_element_chain (GstPad * pad, GstObject * parent,
case MODE_TYPEFIND:
{
GST_OBJECT_LOCK (typefind);
if (typefind->initial_offs == GST_CLOCK_TIME_NONE)
typefind->initial_offs = GST_BUFFER_OFFSET (buffer);
gst_adapter_push (typefind->adapter, buffer);
GST_OBJECT_UNLOCK (typefind);

View file

@ -59,6 +59,8 @@ struct _GstTypeFindElement {
GList * cached_events;
GstCaps * force_caps;
guint64 initial_offs;
/* Only used when driving the pipeline */
gboolean need_segment;
gboolean need_stream_start;