mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gst/elements/gsttypefindelement.c (do_pull_typefind): Query the file size, pass it on to the type find helper.
Original commit message from CVS: 2005-06-02 Andy Wingo <wingo@pobox.com> * gst/elements/gsttypefindelement.c (do_pull_typefind): Query the file size, pass it on to the type find helper. * gst/base/gstbasesrc.c (gst_basesrc_do_seek): Set the segment_start and segment_end properly according to the seek method. Segment_end is still a bit flaky because offset can be negative for CUR and END cases, but it takes -1 as an "unset" value.
This commit is contained in:
parent
d3edbe1718
commit
26a1c2c663
7 changed files with 85 additions and 68 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2005-06-02 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* gst/elements/gsttypefindelement.c (do_pull_typefind): Query the
|
||||
file size, pass it on to the type find helper.
|
||||
|
||||
* gst/base/gstbasesrc.c (gst_basesrc_do_seek): Set the
|
||||
segment_start and segment_end properly according to the seek
|
||||
method. Segment_end is still a bit flaky because offset can be
|
||||
negative for CUR and END cases, but it takes -1 as an "unset"
|
||||
value.
|
||||
|
||||
2005-06-02 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/base/gstbasesink.c: (gst_basesink_pad_buffer_alloc),
|
||||
|
|
|
@ -78,7 +78,6 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
|||
@manager:
|
||||
@bus:
|
||||
@scheduler:
|
||||
@sched_private:
|
||||
@clock:
|
||||
@base_time:
|
||||
@numpads:
|
||||
|
|
|
@ -36,15 +36,6 @@ against the GstElementStateReturn value.
|
|||
@GST_STATE_SUCCESS: the state of the element has already be changed
|
||||
@GST_STATE_ASYNC: the state of the element will change in the near future
|
||||
|
||||
<!-- ##### ENUM GstResult ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GST_RESULT_OK:
|
||||
@GST_RESULT_NOK:
|
||||
@GST_RESULT_NOT_IMPL:
|
||||
|
||||
<!-- ##### ENUM GstRank ##### -->
|
||||
<para>
|
||||
Element priority ranks. Defines the order in which the autoplugger (or similar
|
||||
|
|
|
@ -280,10 +280,40 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
|
||||
/* get seek positions */
|
||||
offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
src->segment_start = offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
src->segment_loop = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset < 0)
|
||||
goto error;
|
||||
src->offset = MIN (offset, src->size);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = MIN (GST_EVENT_SEEK_ENDOFFSET (event), src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
offset += src->offset;
|
||||
src->offset = CLAMP (offset, 0, src->size);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (offset > 0)
|
||||
goto error;
|
||||
offset = src->size + offset;
|
||||
src->offset = MAX (0, offset);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* send flush start */
|
||||
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
|
||||
|
||||
|
@ -293,31 +323,6 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
/* grab streaming lock */
|
||||
GST_STREAM_LOCK (src->srcpad);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset < 0)
|
||||
goto error;
|
||||
src->offset = MIN (offset, src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
offset += src->offset;
|
||||
src->offset = CLAMP (offset, 0, src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (offset > 0)
|
||||
goto error;
|
||||
offset = src->size + offset;
|
||||
src->offset = MAX (0, offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
/* send flush end */
|
||||
gst_pad_push_event (src->srcpad, gst_event_new_flush (TRUE));
|
||||
|
||||
|
@ -345,7 +350,6 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
error:
|
||||
{
|
||||
GST_DEBUG_OBJECT (src, "seek error");
|
||||
GST_STREAM_UNLOCK (src->srcpad);
|
||||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -758,7 +758,11 @@ do_pull_typefind (GstTypeFindElement * typefind)
|
|||
peer = gst_pad_get_peer (typefind->sink);
|
||||
if (peer) {
|
||||
if (gst_pad_peer_set_active (typefind->sink, GST_ACTIVATE_PULL)) {
|
||||
caps = gst_type_find_helper (peer, 0);
|
||||
gint64 size;
|
||||
GstFormat format = GST_FORMAT_BYTES;
|
||||
|
||||
gst_pad_query_position (peer, &format, NULL, &size);
|
||||
caps = gst_type_find_helper (peer, (guint64) size);
|
||||
if (caps) {
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
||||
0, 100, caps);
|
||||
|
|
|
@ -280,10 +280,40 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
|
||||
/* get seek positions */
|
||||
offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
src->segment_start = offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
src->segment_loop = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset < 0)
|
||||
goto error;
|
||||
src->offset = MIN (offset, src->size);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = MIN (GST_EVENT_SEEK_ENDOFFSET (event), src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
offset += src->offset;
|
||||
src->offset = CLAMP (offset, 0, src->size);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (offset > 0)
|
||||
goto error;
|
||||
offset = src->size + offset;
|
||||
src->offset = MAX (0, offset);
|
||||
src->segment_start = src->offset;
|
||||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* send flush start */
|
||||
gst_pad_push_event (src->srcpad, gst_event_new_flush (FALSE));
|
||||
|
||||
|
@ -293,31 +323,6 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
/* grab streaming lock */
|
||||
GST_STREAM_LOCK (src->srcpad);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset < 0)
|
||||
goto error;
|
||||
src->offset = MIN (offset, src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
offset += src->offset;
|
||||
src->offset = CLAMP (offset, 0, src->size);
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (offset > 0)
|
||||
goto error;
|
||||
offset = src->size + offset;
|
||||
src->offset = MAX (0, offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->offset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
/* send flush end */
|
||||
gst_pad_push_event (src->srcpad, gst_event_new_flush (TRUE));
|
||||
|
||||
|
@ -345,7 +350,6 @@ gst_basesrc_do_seek (GstBaseSrc * src, GstEvent * event)
|
|||
error:
|
||||
{
|
||||
GST_DEBUG_OBJECT (src, "seek error");
|
||||
GST_STREAM_UNLOCK (src->srcpad);
|
||||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -758,7 +758,11 @@ do_pull_typefind (GstTypeFindElement * typefind)
|
|||
peer = gst_pad_get_peer (typefind->sink);
|
||||
if (peer) {
|
||||
if (gst_pad_peer_set_active (typefind->sink, GST_ACTIVATE_PULL)) {
|
||||
caps = gst_type_find_helper (peer, 0);
|
||||
gint64 size;
|
||||
GstFormat format = GST_FORMAT_BYTES;
|
||||
|
||||
gst_pad_query_position (peer, &format, NULL, &size);
|
||||
caps = gst_type_find_helper (peer, (guint64) size);
|
||||
if (caps) {
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
||||
0, 100, caps);
|
||||
|
|
Loading…
Reference in a new issue