mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-08 16:35:40 +00:00
gst/gstqueue.c: Subtract current queue contents from position queries.
Original commit message from CVS: * gst/gstqueue.c: (gst_queue_init), (gst_queue_handle_src_query): Subtract current queue contents from position queries.
This commit is contained in:
parent
970da8b0f9
commit
c36f2f830a
3 changed files with 71 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-10-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/gstqueue.c: (gst_queue_init), (gst_queue_handle_src_query):
|
||||
Subtract current queue contents from position queries.
|
||||
|
||||
2004-10-11 Johan Dahlin <johan@gnome.org>
|
||||
|
||||
* gst/gsturi.c (gst_uri_get_location): unescape string
|
||||
|
|
|
@ -116,6 +116,8 @@ static void gst_queue_chain (GstPad * pad, GstData * data);
|
|||
static GstData *gst_queue_get (GstPad * pad);
|
||||
|
||||
static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_queue_handle_src_query (GstPad * pad,
|
||||
GstQueryType type, GstFormat * fmt, gint64 * value);
|
||||
|
||||
static GstCaps *gst_queue_getcaps (GstPad * pad);
|
||||
static GstPadLinkReturn gst_queue_link (GstPad * pad, const GstCaps * caps);
|
||||
|
@ -301,6 +303,8 @@ gst_queue_init (GstQueue * queue)
|
|||
GST_DEBUG_FUNCPTR (gst_queue_getcaps));
|
||||
gst_pad_set_event_function (queue->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
|
||||
gst_pad_set_query_function (queue->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_query));
|
||||
gst_pad_set_active (queue->srcpad, TRUE);
|
||||
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
|
@ -902,6 +906,35 @@ handled:
|
|||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_handle_src_query (GstPad * pad,
|
||||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||
gboolean res;
|
||||
|
||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
||||
if (!res)
|
||||
return FALSE;
|
||||
|
||||
if (type == GST_QUERY_POSITION) {
|
||||
/* FIXME: this code assumes that there's no discont in the queue */
|
||||
switch (*fmt) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*value -= queue->cur_level.bytes;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
*value -= queue->cur_level.time;
|
||||
break;
|
||||
default:
|
||||
/* FIXME */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_release_locks (GstElement * element)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,8 @@ static void gst_queue_chain (GstPad * pad, GstData * data);
|
|||
static GstData *gst_queue_get (GstPad * pad);
|
||||
|
||||
static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_queue_handle_src_query (GstPad * pad,
|
||||
GstQueryType type, GstFormat * fmt, gint64 * value);
|
||||
|
||||
static GstCaps *gst_queue_getcaps (GstPad * pad);
|
||||
static GstPadLinkReturn gst_queue_link (GstPad * pad, const GstCaps * caps);
|
||||
|
@ -301,6 +303,8 @@ gst_queue_init (GstQueue * queue)
|
|||
GST_DEBUG_FUNCPTR (gst_queue_getcaps));
|
||||
gst_pad_set_event_function (queue->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
|
||||
gst_pad_set_query_function (queue->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_query));
|
||||
gst_pad_set_active (queue->srcpad, TRUE);
|
||||
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
|
@ -902,6 +906,35 @@ handled:
|
|||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_handle_src_query (GstPad * pad,
|
||||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||
gboolean res;
|
||||
|
||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
||||
if (!res)
|
||||
return FALSE;
|
||||
|
||||
if (type == GST_QUERY_POSITION) {
|
||||
/* FIXME: this code assumes that there's no discont in the queue */
|
||||
switch (*fmt) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*value -= queue->cur_level.bytes;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
*value -= queue->cur_level.time;
|
||||
break;
|
||||
default:
|
||||
/* FIXME */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_queue_release_locks (GstElement * element)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue