mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Make the queue event aware and make it do something usefull with the events.
Original commit message from CVS: Make the queue event aware and make it do something usefull with the events.
This commit is contained in:
parent
fa78165bcd
commit
2f60d799a4
2 changed files with 28 additions and 16 deletions
|
@ -161,6 +161,7 @@ gst_queue_init (GstQueue *queue)
|
||||||
{
|
{
|
||||||
// scheduling on this kind of element is, well, interesting
|
// scheduling on this kind of element is, well, interesting
|
||||||
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
|
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
|
||||||
|
GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||||
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR(gst_queue_chain));
|
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR(gst_queue_chain));
|
||||||
|
@ -223,7 +224,10 @@ static void
|
||||||
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
||||||
{
|
{
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
|
||||||
gst_buffer_unref (GST_BUFFER (data));
|
|
||||||
|
if (GST_IS_BUFFER (data)) {
|
||||||
|
gst_buffer_unref (GST_BUFFER (data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -246,6 +250,7 @@ gst_queue_flush (GstQueue *queue)
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
|
@ -261,20 +266,21 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
reader = FALSE;
|
reader = FALSE;
|
||||||
|
|
||||||
/* we have to lock the queue since we span threads */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
|
||||||
g_mutex_lock (queue->qlock);
|
g_mutex_lock (queue->qlock);
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
|
||||||
|
|
||||||
if (GST_IS_EVENT(buf)) {
|
if (GST_IS_EVENT (buf)) {
|
||||||
GstEvent *event = GST_EVENT(buf);
|
switch (GST_EVENT_TYPE (buf)) {
|
||||||
switch (GST_EVENT_TYPE(event)) {
|
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "flushing queue\n");
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n");
|
||||||
gst_queue_locked_flush (queue);
|
gst_queue_locked_flush (queue);
|
||||||
break;
|
break;
|
||||||
|
case GST_EVENT_EOS:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
gst_pad_event_default (pad, GST_EVENT (buf));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ gst_queue_init (GstQueue *queue)
|
||||||
{
|
{
|
||||||
// scheduling on this kind of element is, well, interesting
|
// scheduling on this kind of element is, well, interesting
|
||||||
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
|
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
|
||||||
|
GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||||
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR(gst_queue_chain));
|
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR(gst_queue_chain));
|
||||||
|
@ -223,7 +224,10 @@ static void
|
||||||
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
||||||
{
|
{
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
|
||||||
gst_buffer_unref (GST_BUFFER (data));
|
|
||||||
|
if (GST_IS_BUFFER (data)) {
|
||||||
|
gst_buffer_unref (GST_BUFFER (data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -246,6 +250,7 @@ gst_queue_flush (GstQueue *queue)
|
||||||
g_mutex_unlock (queue->qlock);
|
g_mutex_unlock (queue->qlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
|
@ -261,20 +266,21 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
reader = FALSE;
|
reader = FALSE;
|
||||||
|
|
||||||
/* we have to lock the queue since we span threads */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
|
||||||
g_mutex_lock (queue->qlock);
|
g_mutex_lock (queue->qlock);
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
|
||||||
|
|
||||||
if (GST_IS_EVENT(buf)) {
|
if (GST_IS_EVENT (buf)) {
|
||||||
GstEvent *event = GST_EVENT(buf);
|
switch (GST_EVENT_TYPE (buf)) {
|
||||||
switch (GST_EVENT_TYPE(event)) {
|
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "flushing queue\n");
|
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n");
|
||||||
gst_queue_locked_flush (queue);
|
gst_queue_locked_flush (queue);
|
||||||
break;
|
break;
|
||||||
|
case GST_EVENT_EOS:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
gst_pad_event_default (pad, GST_EVENT (buf));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue