mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
Slightly better timestamp handling use pad_query for _tell
Original commit message from CVS: Slightly better timestamp handling use pad_query for _tell
This commit is contained in:
parent
9940947219
commit
e89f26944a
2 changed files with 18 additions and 7 deletions
|
@ -130,15 +130,16 @@ gst_bytestream_get_next_buf (GstByteStream * bs)
|
||||||
bs_print ("get_next_buf: pulling buffer");
|
bs_print ("get_next_buf: pulling buffer");
|
||||||
nextbuf = gst_pad_pull (bs->pad);
|
nextbuf = gst_pad_pull (bs->pad);
|
||||||
|
|
||||||
if (GST_IS_EVENT (nextbuf))
|
if (GST_IS_EVENT (nextbuf)) {
|
||||||
{
|
bs->event = GST_EVENT (nextbuf);
|
||||||
bs->event = GST_EVENT (nextbuf);
|
return FALSE;
|
||||||
return FALSE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!nextbuf)
|
if (!nextbuf)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
bs->last_ts = GST_BUFFER_TIMESTAMP (nextbuf);
|
||||||
|
|
||||||
bs_print ("get_next_buf: got buffer of %d bytes", GST_BUFFER_SIZE (nextbuf));
|
bs_print ("get_next_buf: got buffer of %d bytes", GST_BUFFER_SIZE (nextbuf));
|
||||||
|
|
||||||
/* first see if there are any buffers in the list at all */
|
/* first see if there are any buffers in the list at all */
|
||||||
|
@ -256,7 +257,7 @@ gst_bytestream_peek (GstByteStream * bs, GstBuffer **buf, guint32 len)
|
||||||
retbuf = gst_buffer_new ();
|
retbuf = gst_buffer_new ();
|
||||||
GST_BUFFER_SIZE (retbuf) = len;
|
GST_BUFFER_SIZE (retbuf) = len;
|
||||||
GST_BUFFER_DATA (retbuf) = gst_bytestream_assemble (bs, len);
|
GST_BUFFER_DATA (retbuf) = gst_bytestream_assemble (bs, len);
|
||||||
GST_BUFFER_TIMESTAMP (retbuf) = gst_bytestream_get_timestamp (bs);
|
GST_BUFFER_TIMESTAMP (retbuf) = bs->last_ts;
|
||||||
if (GST_BUFFER_OFFSET (headbuf) != -1)
|
if (GST_BUFFER_OFFSET (headbuf) != -1)
|
||||||
GST_BUFFER_OFFSET (retbuf) = GST_BUFFER_OFFSET (headbuf) + (GST_BUFFER_SIZE (headbuf) - bs->headbufavail);
|
GST_BUFFER_OFFSET (retbuf) = GST_BUFFER_OFFSET (headbuf) + (GST_BUFFER_SIZE (headbuf) - bs->headbufavail);
|
||||||
}
|
}
|
||||||
|
@ -462,8 +463,17 @@ gst_bytestream_seek (GstByteStream *bs, gint64 offset, GstSeekType method)
|
||||||
guint64
|
guint64
|
||||||
gst_bytestream_tell (GstByteStream *bs)
|
gst_bytestream_tell (GstByteStream *bs)
|
||||||
{
|
{
|
||||||
|
GstFormat format;
|
||||||
|
gint64 value;
|
||||||
|
|
||||||
g_return_val_if_fail (bs != NULL, 0);
|
g_return_val_if_fail (bs != NULL, 0);
|
||||||
return bs->offset;
|
|
||||||
|
format = GST_FORMAT_BYTES;
|
||||||
|
|
||||||
|
if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_PAD_QUERY_POSITION, &format, &value))
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct _GstByteStream {
|
||||||
|
|
||||||
/* this is needed for gst_bytestream_tell */
|
/* this is needed for gst_bytestream_tell */
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
|
guint64 last_ts;
|
||||||
|
|
||||||
/* if we are in the seek state (waiting for DISCONT) */
|
/* if we are in the seek state (waiting for DISCONT) */
|
||||||
gboolean in_seek;
|
gboolean in_seek;
|
||||||
|
|
Loading…
Reference in a new issue