finish everything typefinding related (like seeking to correct offset) _before_ pushing the first buffer

Original commit message from CVS:
finish everything typefinding related (like seeking to correct offset) _before_ pushing the first buffer
This commit is contained in:
Benjamin Otte 2003-12-07 19:02:30 +00:00
parent 103c22dee3
commit b9d7ea92ed
4 changed files with 24 additions and 20 deletions

View file

@ -366,16 +366,17 @@ stop_typefinding (GstTypeFindElement *typefind)
if (push_cached_buffers) { if (push_cached_buffers) {
GstBuffer *buffer; GstBuffer *buffer;
guint size = gst_buffer_store_get_size (typefind->store, 0); guint size = gst_buffer_store_get_size (typefind->store, 0);
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
GST_LOG_OBJECT (typefind, "seeking back to current position %u", size); GST_LOG_OBJECT (typefind, "seeking back to current position %u", size);
if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink), if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink),
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) { gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) {
GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size); GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size);
} }
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
} }
gst_buffer_store_clear (typefind->store); gst_buffer_store_clear (typefind->store);
} }

View file

@ -366,16 +366,17 @@ stop_typefinding (GstTypeFindElement *typefind)
if (push_cached_buffers) { if (push_cached_buffers) {
GstBuffer *buffer; GstBuffer *buffer;
guint size = gst_buffer_store_get_size (typefind->store, 0); guint size = gst_buffer_store_get_size (typefind->store, 0);
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
GST_LOG_OBJECT (typefind, "seeking back to current position %u", size); GST_LOG_OBJECT (typefind, "seeking back to current position %u", size);
if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink), if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink),
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) { gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) {
GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size); GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size);
} }
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
} }
gst_buffer_store_clear (typefind->store); gst_buffer_store_clear (typefind->store);
} }

View file

@ -366,16 +366,17 @@ stop_typefinding (GstTypeFindElement *typefind)
if (push_cached_buffers) { if (push_cached_buffers) {
GstBuffer *buffer; GstBuffer *buffer;
guint size = gst_buffer_store_get_size (typefind->store, 0); guint size = gst_buffer_store_get_size (typefind->store, 0);
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
GST_LOG_OBJECT (typefind, "seeking back to current position %u", size); GST_LOG_OBJECT (typefind, "seeking back to current position %u", size);
if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink), if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink),
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) { gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) {
GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size); GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size);
} }
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
} }
gst_buffer_store_clear (typefind->store); gst_buffer_store_clear (typefind->store);
} }

View file

@ -366,16 +366,17 @@ stop_typefinding (GstTypeFindElement *typefind)
if (push_cached_buffers) { if (push_cached_buffers) {
GstBuffer *buffer; GstBuffer *buffer;
guint size = gst_buffer_store_get_size (typefind->store, 0); guint size = gst_buffer_store_get_size (typefind->store, 0);
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
GST_LOG_OBJECT (typefind, "seeking back to current position %u", size); GST_LOG_OBJECT (typefind, "seeking back to current position %u", size);
if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink), if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink),
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) { gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, size))) {
GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size); GST_WARNING_OBJECT (typefind, "could not seek to required position %u, hope for the best", size);
} }
if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
gst_pad_push (typefind->src, GST_DATA (buffer));
} else {
size = 0;
}
} }
gst_buffer_store_clear (typefind->store); gst_buffer_store_clear (typefind->store);
} }