demux->priv->strip_start + demux->priv->strip_end)
goto no_data;
- /* 2 - Do typefinding on data */
+ /* 2 - Do typefinding on data, but not if downstream is in charge */
+ if (GST_PAD_MODE (demux->priv->srcpad) == GST_PAD_MODE_PULL)
+ goto skip_typefinding;
+
caps = gst_type_find_helper_get_range (GST_OBJECT (demux), NULL,
(GstTypeFindHelperGetRangeFunction) gst_tag_demux_read_range,
demux->priv->upstream_size
- (demux->priv->strip_start + demux->priv->strip_end), NULL,
&probability);
- GST_DEBUG_OBJECT (demux, "Found type %" GST_PTR_FORMAT " with a "
+ GST_INFO_OBJECT (demux, "Found type %" GST_PTR_FORMAT " with a "
"probability of %u", caps, probability);
/* 3 - If we didn't find the caps, fail */
gst_tag_demux_set_src_caps (demux, caps);
gst_caps_unref (caps);
+skip_typefinding:
+
+ /* set it again, in case we skipped typefinding */
+ demux->priv->state = GST_TAG_DEMUX_STREAMING;
+
return ret;
/* ERRORS */
res = TRUE;
break;
}
+
+ if (active)
+ GST_TAG_DEMUX (parent)->priv->state = GST_TAG_DEMUX_READ_START_TAG;
+
return res;
}
{
GST_DEBUG_OBJECT (demux, "No pull mode. Changing to push, but won't be "
"able to read end tags");
- demux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
}
}
gint64 result;
gboolean res = TRUE;
+ /* FIXME: locking ? */
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_SCHEDULING:
res = gst_pad_peer_query (demux->priv->sinkpad, query);
gst_query_parse_duration (query, &format, &result);
if (format == GST_FORMAT_BYTES) {
+ /* if downstream activated us in pull mode right away, e.g. in case of
+ * filesrc ! id3demux ! xyzparse ! .., read tags here, since we don't
+ * have a streaming thread of our own to do that. We do it here and
+ * not in get_range(), so we can return the right size in bytes.. */
+ if (demux->priv->state == GST_TAG_DEMUX_READ_START_TAG &&
+ GST_PAD_MODE (demux->priv->srcpad) == GST_PAD_MODE_PULL) {
+ GstFlowReturn flow G_GNUC_UNUSED;
+
+ flow = gst_tag_demux_element_find (demux);
+ GST_INFO_OBJECT (demux, "pulled tags: %s", gst_flow_get_name (flow));
+ }
result -= demux->priv->strip_start + demux->priv->strip_end;
+ if (result < 0)
+ result = 0;
gst_query_set_duration (query, format, result);
}
break;