bytestream

bytestream —

Synopsis




struct      GstByteStream;
GstByteStream* gst_bytestream_new           (GstPad *pad);
void        gst_bytestream_destroy          (GstByteStream *bs);
guint32     gst_bytestream_read             (GstByteStream *bs,
                                             GstBuffer **buf,
                                             guint32 len);
guint64     gst_bytestream_tell             (GstByteStream *bs);
guint64     gst_bytestream_length           (GstByteStream *bs);
gboolean    gst_bytestream_size_hint        (GstByteStream *bs,
                                             guint32 size);
gboolean    gst_bytestream_seek             (GstByteStream *bs,
                                             gint64 offset,
                                             GstSeekType type);
guint32     gst_bytestream_peek             (GstByteStream *bs,
                                             GstBuffer **buf,
                                             guint32 len);
guint32     gst_bytestream_peek_bytes       (GstByteStream *bs,
                                             guint8 **data,
                                             guint32 len);
gboolean    gst_bytestream_flush            (GstByteStream *bs,
                                             guint32 len);
void        gst_bytestream_flush_fast       (GstByteStream *bs,
                                             guint32 len);
void        gst_bytestream_get_status       (GstByteStream *bs,
                                             guint32 *avail_out,
                                             GstEvent **event_out);
guint64     gst_bytestream_get_timestamp    (GstByteStream *bs);
void        gst_bytestream_print_status     (GstByteStream *bs);

Description

Details

struct GstByteStream

struct GstByteStream {

  GstPad 	*pad;

  GstEvent 	*event;

  GSList 	*buflist;
  guint32 	 headbufavail;
  guint32 	 listavail;

  /* we keep state of assembled pieces */
  guint8	*assembled;
  guint32	 assembled_len;

  /* this is needed for gst_bytestream_tell */
  guint64	 offset;
  guint64	 last_ts;

  /* if we are in the seek state (waiting for DISCONT) */
  gboolean	 in_seek;
};


gst_bytestream_new ()

GstByteStream* gst_bytestream_new           (GstPad *pad);

creates a bytestream from the given pad

pad : the pad to attach the bytestream to
Returns : a new GstByteStream object

gst_bytestream_destroy ()

void        gst_bytestream_destroy          (GstByteStream *bs);

bs :

gst_bytestream_read ()

guint32     gst_bytestream_read             (GstByteStream *bs,
                                             GstBuffer **buf,
                                             guint32 len);

bs :
buf :
len :
Returns :

gst_bytestream_tell ()

guint64     gst_bytestream_tell             (GstByteStream *bs);

bs :
Returns :

gst_bytestream_length ()

guint64     gst_bytestream_length           (GstByteStream *bs);

bs :
Returns :

gst_bytestream_size_hint ()

gboolean    gst_bytestream_size_hint        (GstByteStream *bs,
                                             guint32 size);

Give a hint that we are going to read chunks of the given size

bs : a bytestream
size : the size to hint
Returns : TRUE if the hint was accepted

gst_bytestream_seek ()

gboolean    gst_bytestream_seek             (GstByteStream *bs,
                                             gint64 offset,
                                             GstSeekType type);

bs :
offset :
type :
Returns :

gst_bytestream_peek ()

guint32     gst_bytestream_peek             (GstByteStream *bs,
                                             GstBuffer **buf,
                                             guint32 len);

bs :
buf :
len :
Returns :

gst_bytestream_peek_bytes ()

guint32     gst_bytestream_peek_bytes       (GstByteStream *bs,
                                             guint8 **data,
                                             guint32 len);

bs :
data :
len :
Returns :

gst_bytestream_flush ()

gboolean    gst_bytestream_flush            (GstByteStream *bs,
                                             guint32 len);

bs :
len :
Returns :

gst_bytestream_flush_fast ()

void        gst_bytestream_flush_fast       (GstByteStream *bs,
                                             guint32 len);

bs :
len :

gst_bytestream_get_status ()

void        gst_bytestream_get_status       (GstByteStream *bs,
                                             guint32 *avail_out,
                                             GstEvent **event_out);

When an event occurs, the bytestream will return NULL. You must retrieve the event using this API before reading more bytes from the stream.

It is possible for the bytestream to return NULL due to running out of buffers, however, this indicates a bug because an EOS event should have been sent.

bs : a bytestream
avail_out : total number of bytes buffered
event_out : an event

gst_bytestream_get_timestamp ()

guint64     gst_bytestream_get_timestamp    (GstByteStream *bs);

Get the timestamp of the first data in the bytestream. If no data exists 1 byte is read to load a new buffer.

This function will not check input buffer boundries. It is possible the next read could span two or more input buffers with different timestamps.

bs : a bytestream
Returns :

gst_bytestream_print_status ()

void        gst_bytestream_print_status     (GstByteStream *bs);

bs :