summaryrefslogtreecommitdiff
path: root/gst/gstbin.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-05-10 18:36:33 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2011-05-10 18:36:33 +0200
commitcf4fbc005c5c530c2a509a943a05b91d6c9af3fb (patch)
tree93ae0a18b8929e902c2a5b2d10b29d02ab18eb94 /gst/gstbin.c
parentb905c4d21545ac3a3ef8473059e2f8c65f6e30df (diff)
query: allow _make_writable on query handlers
Pass a GstQuery ** to the query handlers so that they can make the query writable before using a setter on it. Port code to new API.
Diffstat (limited to 'gst/gstbin.c')
-rw-r--r--gst/gstbin.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 487745ef7..22eab34e2 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -243,7 +243,7 @@ static void gst_bin_handle_message_func (GstBin * bin, GstMessage * message);
static gboolean gst_bin_send_event (GstElement * element, GstEvent * event);
static GstBusSyncReply bin_bus_handler (GstBus * bus,
GstMessage * message, GstBin * bin);
-static gboolean gst_bin_query (GstElement * element, GstQuery * query);
+static gboolean gst_bin_query (GstElement * element, GstQuery ** query);
static gboolean gst_bin_do_latency_func (GstBin * bin);
@@ -2349,7 +2349,7 @@ gst_bin_do_latency_func (GstBin * bin)
GST_DEBUG_OBJECT (element, "querying latency");
query = gst_query_new_latency ();
- if ((res = gst_element_query (element, query))) {
+ if ((res = gst_element_query (element, &query))) {
gboolean live;
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
@@ -3412,7 +3412,7 @@ forward:
/* generic struct passed to all query fold methods */
typedef struct
{
- GstQuery *query;
+ GstQuery **query;
gint64 min;
gint64 max;
gboolean live;
@@ -3441,7 +3441,7 @@ bin_query_duration_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
g_value_set_boolean (ret, TRUE);
- gst_query_parse_duration (fold->query, NULL, &duration);
+ gst_query_parse_duration (*fold->query, NULL, &duration);
GST_DEBUG_OBJECT (item, "got duration %" G_GINT64_FORMAT, duration);
@@ -3457,9 +3457,10 @@ bin_query_duration_done (GstBin * bin, QueryFold * fold)
{
GstFormat format;
- gst_query_parse_duration (fold->query, &format, NULL);
+ gst_query_parse_duration (*fold->query, &format, NULL);
+ *fold->query = gst_query_make_writable (*fold->query);
/* store max in query result */
- gst_query_set_duration (fold->query, format, fold->max);
+ gst_query_set_duration (*fold->query, format, fold->max);
GST_DEBUG_OBJECT (bin, "max duration %" G_GINT64_FORMAT, fold->max);
@@ -3480,7 +3481,7 @@ bin_query_position_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
g_value_set_boolean (ret, TRUE);
- gst_query_parse_position (fold->query, NULL, &position);
+ gst_query_parse_position (*fold->query, NULL, &position);
GST_DEBUG_OBJECT (item, "got position %" G_GINT64_FORMAT, position);
@@ -3496,9 +3497,10 @@ bin_query_position_done (GstBin * bin, QueryFold * fold)
{
GstFormat format;
- gst_query_parse_position (fold->query, &format, NULL);
+ gst_query_parse_position (*fold->query, &format, NULL);
+ *fold->query = gst_query_make_writable (*fold->query);
/* store max in query result */
- gst_query_set_position (fold->query, format, fold->max);
+ gst_query_set_position (*fold->query, format, fold->max);
GST_DEBUG_OBJECT (bin, "max position %" G_GINT64_FORMAT, fold->max);
}
@@ -3512,7 +3514,7 @@ bin_query_latency_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
GstClockTime min, max;
gboolean live;
- gst_query_parse_latency (fold->query, &live, &min, &max);
+ gst_query_parse_latency (*fold->query, &live, &min, &max);
GST_DEBUG_OBJECT (item,
"got latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
@@ -3542,7 +3544,8 @@ static void
bin_query_latency_done (GstBin * bin, QueryFold * fold)
{
/* store max in query result */
- gst_query_set_latency (fold->query, fold->live, fold->min, fold->max);
+ *fold->query = gst_query_make_writable (*fold->query);
+ gst_query_set_latency (*fold->query, fold->live, fold->min, fold->max);
GST_DEBUG_OBJECT (bin,
"latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
@@ -3559,7 +3562,7 @@ bin_query_generic_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
if ((res = gst_element_query (item, fold->query))) {
g_value_set_boolean (ret, TRUE);
- GST_DEBUG_OBJECT (item, "answered query %p", fold->query);
+ GST_DEBUG_OBJECT (item, "answered query %" GST_PTR_FORMAT, *fold->query);
}
/* and stop as soon as we have a valid result */
@@ -3567,7 +3570,7 @@ bin_query_generic_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
}
static gboolean
-gst_bin_query (GstElement * element, GstQuery * query)
+gst_bin_query (GstElement * element, GstQuery ** query)
{
GstBin *bin = GST_BIN_CAST (element);
GstIterator *iter;
@@ -3578,13 +3581,13 @@ gst_bin_query (GstElement * element, GstQuery * query)
QueryFold fold_data;
GValue ret = { 0 };
- switch (GST_QUERY_TYPE (query)) {
+ switch (GST_QUERY_TYPE (*query)) {
case GST_QUERY_DURATION:
{
GList *cached;
GstFormat qformat;
- gst_query_parse_duration (query, &qformat, NULL);
+ gst_query_parse_duration (*query, &qformat, NULL);
/* find cached duration query */
GST_OBJECT_LOCK (bin);
@@ -3604,7 +3607,8 @@ gst_bin_query (GstElement * element, GstQuery * query)
duration);
GST_OBJECT_UNLOCK (bin);
- gst_query_set_duration (query, qformat, duration);
+ *query = gst_query_make_writable (*query);
+ gst_query_set_duration (*query, qformat, duration);
res = TRUE;
goto exit;
}