typefind: code and comment cleanups

Make code two places of the code the pushes the buffer store more similar. More
comments and debug logging.
This commit is contained in:
Stefan Kost 2011-01-12 16:03:57 +02:00
parent 43c9eb2791
commit eed2a350cb

View file

@ -53,6 +53,9 @@
* is assumed that the peer element is happy with whatever format we * is assumed that the peer element is happy with whatever format we
* eventually read. * eventually read.
* *
* By default it tries to do pull based typefinding (this avoid joining received
* buffers and holding them back in store.)
*
* When the element has no connected srcpad, and the sinkpad can operate in * When the element has no connected srcpad, and the sinkpad can operate in
* getrange based mode, the element starts its own task to figure out the * getrange based mode, the element starts its own task to figure out the
* type of the stream. * type of the stream.
@ -646,15 +649,14 @@ gst_type_find_element_setcaps (GstPad * pad, GstCaps * caps)
gst_type_find_element_send_cached_events (typefind); gst_type_find_element_send_cached_events (typefind);
GST_OBJECT_LOCK (typefind); GST_OBJECT_LOCK (typefind);
if (typefind->store) { if (typefind->store) {
GstBuffer *store = typefind->store; GstBuffer *store;
store = gst_buffer_make_metadata_writable (typefind->store);
typefind->store = NULL; typefind->store = NULL;
GST_DEBUG_OBJECT (typefind, "Pushing store: %d", GST_BUFFER_SIZE (store));
store = gst_buffer_make_metadata_writable (store);
gst_buffer_set_caps (store, typefind->caps); gst_buffer_set_caps (store, typefind->caps);
GST_OBJECT_UNLOCK (typefind); GST_OBJECT_UNLOCK (typefind);
GST_DEBUG_OBJECT (typefind, "Pushing store: %d", GST_BUFFER_SIZE (store));
gst_pad_push (typefind->src, store); gst_pad_push (typefind->src, store);
} else { } else {
GST_OBJECT_UNLOCK (typefind); GST_OBJECT_UNLOCK (typefind);
@ -927,6 +929,8 @@ gst_type_find_element_activate (GstPad * pad)
return gst_pad_activate_push (pad, TRUE); return gst_pad_activate_push (pad, TRUE);
} }
GST_DEBUG_OBJECT (typefind, "find type in pull mode");
/* 2 */ /* 2 */
{ {
GstPad *peer; GstPad *peer;