Patch from vishnu:

Original commit message from CVS:
Patch from vishnu:

The attached patch adds event support to bytestream.  Here's how it
works:  When bytestream encounters an event, the event is saved and
it returns NULL.  Then you must call a new API to retrieve the event
and handle it:

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

Whatever is necessary to handle the event is left up to the plugin.
Once the event is retrieved then the bytestream continues as usual.
This commit is contained in:
Wim Taymans 2001-10-22 19:00:52 +00:00
parent eb2791d210
commit 14de4f27da
2 changed files with 30 additions and 2 deletions

View file

@ -52,7 +52,7 @@ gst_bytestream_new (GstPad * pad)
GstByteStream *bs = g_new (GstByteStream, 1);
bs->pad = pad;
bs->event = NULL;
bs->buflist = NULL;
bs->headbufavail = 0;
bs->listavail = 0;
@ -66,6 +66,9 @@ gst_bytestream_destroy (GstByteStream * bs)
{
GSList *walk;
if (bs->event)
gst_event_free (bs->event);
walk = bs->buflist;
while (walk) {
gst_buffer_unref (GST_BUFFER (walk->data));
@ -116,9 +119,17 @@ gst_bytestream_get_next_buf (GstByteStream * bs)
GstBuffer *nextbuf, *lastbuf;
GSList *end;
g_assert (!bs->event);
bs_print ("get_next_buf: pulling buffer\n");
nextbuf = gst_pad_pull (bs->pad);
if (GST_IS_EVENT (nextbuf))
{
bs->event = GST_EVENT (nextbuf);
return FALSE;
}
if (!nextbuf)
return FALSE;
@ -172,7 +183,6 @@ gst_bytestream_get_next_buf (GstByteStream * bs)
return TRUE;
}
static gboolean
gst_bytestream_fill_bytes (GstByteStream * bs, guint32 len)
{
@ -397,6 +407,21 @@ gst_bytestream_read (GstByteStream * bs, guint32 len)
return buf;
}
void
gst_bytestream_get_status (GstByteStream *bs,
guint32 *avail_out,
GstEvent **event_out)
{
if (avail_out)
*avail_out = bs->listavail;
if (event_out)
{
*event_out = bs->event;
bs->event = NULL;
}
}
void
gst_bytestream_print_status (GstByteStream * bs)
{

View file

@ -31,6 +31,8 @@ typedef struct _GstByteStream GstByteStream;
struct _GstByteStream {
GstPad *pad;
GstEvent * event;
GSList *buflist;
guint32 headbufavail;
guint32 listavail;
@ -48,6 +50,7 @@ GstBuffer* gst_bytestream_peek (GstByteStream *bs, guint32 len);
guint8* gst_bytestream_peek_bytes (GstByteStream *bs, 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);
void gst_bytestream_print_status (GstByteStream *bs);