diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-05-10 18:36:33 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-05-10 18:36:33 +0200 |
commit | cf4fbc005c5c530c2a509a943a05b91d6c9af3fb (patch) | |
tree | 93ae0a18b8929e902c2a5b2d10b29d02ab18eb94 | |
parent | b905c4d21545ac3a3ef8473059e2f8c65f6e30df (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.
-rw-r--r-- | gst/gstbin.c | 36 | ||||
-rw-r--r-- | gst/gstelement.c | 7 | ||||
-rw-r--r-- | gst/gstelement.h | 4 | ||||
-rw-r--r-- | gst/gstghostpad.c | 2 | ||||
-rw-r--r-- | gst/gstpad.c | 14 | ||||
-rw-r--r-- | gst/gstpad.h | 13 | ||||
-rw-r--r-- | gst/gstutils.c | 12 | ||||
-rw-r--r-- | libs/gst/base/gstbaseparse.c | 41 | ||||
-rw-r--r-- | libs/gst/base/gstbasesink.c | 32 | ||||
-rw-r--r-- | libs/gst/base/gstbasesrc.c | 44 | ||||
-rw-r--r-- | libs/gst/base/gstbasesrc.h | 2 | ||||
-rw-r--r-- | libs/gst/base/gstbasetransform.c | 10 | ||||
-rw-r--r-- | plugins/elements/gstfdsink.c | 15 | ||||
-rw-r--r-- | plugins/elements/gstfdsrc.c | 8 | ||||
-rw-r--r-- | plugins/elements/gstfilesink.c | 14 | ||||
-rw-r--r-- | plugins/elements/gstfilesrc.c | 8 | ||||
-rw-r--r-- | plugins/elements/gstinputselector.c | 10 | ||||
-rw-r--r-- | plugins/elements/gstmultiqueue.c | 2 | ||||
-rw-r--r-- | plugins/elements/gstqueue.c | 14 | ||||
-rw-r--r-- | plugins/elements/gstqueue2.c | 26 | ||||
-rw-r--r-- | plugins/elements/gsttypefindelement.c | 13 | ||||
-rw-r--r-- | tests/check/elements/fdsrc.c | 4 | ||||
-rw-r--r-- | tests/check/elements/filesrc.c | 6 | ||||
-rw-r--r-- | tests/check/gst/gstquery.c | 16 |
24 files changed, 189 insertions, 164 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; } diff --git a/gst/gstelement.c b/gst/gstelement.c index 6903285b9..d8afdbbb5 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -128,7 +128,7 @@ static void gst_element_set_bus_func (GstElement * element, GstBus * bus); static gboolean gst_element_default_send_event (GstElement * element, GstEvent * event); static gboolean gst_element_default_query (GstElement * element, - GstQuery * query); + GstQuery ** query); static GstPadTemplate * gst_element_class_get_request_pad_template (GstElementClass * @@ -1628,7 +1628,7 @@ gst_element_get_query_types (GstElement * element) } static gboolean -gst_element_default_query (GstElement * element, GstQuery * query) +gst_element_default_query (GstElement * element, GstQuery ** query) { gboolean result = FALSE; GstPad *pad; @@ -1672,13 +1672,14 @@ gst_element_default_query (GstElement * element, GstQuery * query) * MT safe. */ gboolean -gst_element_query (GstElement * element, GstQuery * query) +gst_element_query (GstElement * element, GstQuery ** query) { GstElementClass *oclass; gboolean result = FALSE; g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); g_return_val_if_fail (query != NULL, FALSE); + g_return_val_if_fail (GST_IS_QUERY (*query), FALSE); oclass = GST_ELEMENT_GET_CLASS (element); diff --git a/gst/gstelement.h b/gst/gstelement.h index d458bbeb9..7bd958c53 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -652,7 +652,7 @@ struct _GstElementClass gboolean (*send_event) (GstElement *element, GstEvent *event); const GstQueryType* (*get_query_types) (GstElement *element); - gboolean (*query) (GstElement *element, GstQuery *query); + gboolean (*query) (GstElement *element, GstQuery **query); /*< private >*/ gpointer _gst_reserved[GST_PADDING]; @@ -763,7 +763,7 @@ gboolean gst_element_seek (GstElement *element, gd GstSeekType stop_type, gint64 stop); G_CONST_RETURN GstQueryType* gst_element_get_query_types (GstElement *element); -gboolean gst_element_query (GstElement *element, GstQuery *query); +gboolean gst_element_query (GstElement *element, GstQuery **query); /* messages */ gboolean gst_element_post_message (GstElement * element, GstMessage * message); diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 28413a122..62beec765 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -111,7 +111,7 @@ gst_proxy_pad_do_event (GstPad * pad, GstEvent * event) } static gboolean -gst_proxy_pad_do_query (GstPad * pad, GstQuery * query) +gst_proxy_pad_do_query (GstPad * pad, GstQuery ** query) { gboolean res = FALSE; GstPad *target = gst_proxy_pad_get_target (pad); diff --git a/gst/gstpad.c b/gst/gstpad.c index e1c329852..6cf6a0c07 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -3223,14 +3223,15 @@ no_iter: * Returns: TRUE if the query could be performed. */ gboolean -gst_pad_query (GstPad * pad, GstQuery * query) +gst_pad_query (GstPad * pad, GstQuery ** query) { GstPadQueryFunction func; g_return_val_if_fail (GST_IS_PAD (pad), FALSE); - g_return_val_if_fail (GST_IS_QUERY (query), FALSE); + g_return_val_if_fail (query != NULL, FALSE); + g_return_val_if_fail (GST_IS_QUERY (*query), FALSE); - GST_DEBUG_OBJECT (pad, "sending query %p", query); + GST_DEBUG_OBJECT (pad, "sending query %p", *query); if ((func = GST_PAD_QUERYFUNC (pad)) == NULL) goto no_func; @@ -3260,13 +3261,14 @@ no_func: * Since: 0.10.15 */ gboolean -gst_pad_peer_query (GstPad * pad, GstQuery * query) +gst_pad_peer_query (GstPad * pad, GstQuery ** query) { GstPad *peerpad; gboolean result; g_return_val_if_fail (GST_IS_PAD (pad), FALSE); - g_return_val_if_fail (GST_IS_QUERY (query), FALSE); + g_return_val_if_fail (query != NULL, FALSE); + g_return_val_if_fail (GST_IS_QUERY (*query), FALSE); GST_OBJECT_LOCK (pad); @@ -3308,7 +3310,7 @@ no_peer: * Returns: TRUE if the query was performed succesfully. */ gboolean -gst_pad_query_default (GstPad * pad, GstQuery * query) +gst_pad_query_default (GstPad * pad, GstQuery ** query) { switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION: diff --git a/gst/gstpad.h b/gst/gstpad.h index 6db9570c1..412c1308d 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -386,13 +386,14 @@ typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad); /** * GstPadQueryFunction: * @pad: the #GstPad to query. - * @query: the #GstQuery object to execute + * @query: a pointer to a #GstQuery object to execute * - * The signature of the query function. + * The signature of the query function. This function takes ownership of the + * query pointed to by @query and might change @query. * * Returns: TRUE if the query could be performed. */ -typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery *query); +typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery **query); /* linking */ @@ -892,10 +893,10 @@ G_CONST_RETURN GstQueryType* G_CONST_RETURN GstQueryType* gst_pad_get_query_types_default (GstPad *pad); -gboolean gst_pad_query (GstPad *pad, GstQuery *query); -gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query); +gboolean gst_pad_query (GstPad *pad, GstQuery **query); +gboolean gst_pad_peer_query (GstPad *pad, GstQuery **query); void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query); -gboolean gst_pad_query_default (GstPad *pad, GstQuery *query); +gboolean gst_pad_query_default (GstPad *pad, GstQuery **query); /* misc helper functions */ gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, diff --git a/gst/gstutils.c b/gst/gstutils.c index 559da7099..73522ba38 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -2252,7 +2252,7 @@ gst_element_query_position (GstElement * element, GstFormat * format, g_return_val_if_fail (format != NULL, FALSE); query = gst_query_new_position (*format); - ret = gst_element_query (element, query); + ret = gst_element_query (element, &query); if (ret) gst_query_parse_position (query, format, cur); @@ -2284,7 +2284,7 @@ gst_element_query_duration (GstElement * element, GstFormat * format, g_return_val_if_fail (format != NULL, FALSE); query = gst_query_new_duration (*format); - ret = gst_element_query (element, query); + ret = gst_element_query (element, &query); if (ret) gst_query_parse_duration (query, format, duration); @@ -2323,7 +2323,7 @@ gst_element_query_convert (GstElement * element, GstFormat src_format, } query = gst_query_new_convert (src_format, src_val, *dest_format); - ret = gst_element_query (element, query); + ret = gst_element_query (element, &query); if (ret) gst_query_parse_convert (query, NULL, NULL, dest_format, dest_val); @@ -2938,7 +2938,7 @@ gst_pad_query_position (GstPad * pad, GstFormat * format, gint64 * cur) g_return_val_if_fail (format != NULL, FALSE); query = gst_query_new_position (*format); - ret = gst_pad_query (pad, query); + ret = gst_pad_query (pad, &query); if (ret) gst_query_parse_position (query, format, cur); @@ -3002,7 +3002,7 @@ gst_pad_query_duration (GstPad * pad, GstFormat * format, gint64 * duration) g_return_val_if_fail (format != NULL, FALSE); query = gst_query_new_duration (*format); - ret = gst_pad_query (pad, query); + ret = gst_pad_query (pad, &query); if (ret) gst_query_parse_duration (query, format, duration); @@ -3074,7 +3074,7 @@ gst_pad_query_convert (GstPad * pad, GstFormat src_format, gint64 src_val, } query = gst_query_new_convert (src_format, src_val, *dest_format); - ret = gst_pad_query (pad, query); + ret = gst_pad_query (pad, &query); if (ret) gst_query_parse_convert (query, NULL, NULL, dest_format, dest_val); diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index a1bd393ee..6f70077f9 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -368,7 +368,7 @@ static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event); static gboolean gst_base_parse_src_event (GstPad * pad, GstEvent * event); static gboolean gst_base_parse_sink_event (GstPad * pad, GstEvent * event); -static gboolean gst_base_parse_query (GstPad * pad, GstQuery * query); +static gboolean gst_base_parse_query (GstPad * pad, GstQuery ** query); static gboolean gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps); static const GstQueryType *gst_base_parse_get_querytypes (GstPad * pad); @@ -1462,7 +1462,7 @@ gst_base_parse_check_seekability (GstBaseParse * parse) guint idx_interval = 0; query = gst_query_new_seeking (GST_FORMAT_BYTES); - if (!gst_pad_peer_query (parse->sinkpad, query)) { + if (!gst_pad_peer_query (parse->sinkpad, &query)) { GST_DEBUG_OBJECT (parse, "seeking query failed"); goto done; } @@ -3067,7 +3067,7 @@ gst_base_parse_get_querytypes (GstPad * pad) } static gboolean -gst_base_parse_query (GstPad * pad, GstQuery * query) +gst_base_parse_query (GstPad * pad, GstQuery ** query) { GstBaseParse *parse; gboolean res = FALSE; @@ -3076,14 +3076,14 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) GST_LOG_OBJECT (parse, "handling query: %" GST_PTR_FORMAT, query); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { gint64 dest_value; GstFormat format; GST_DEBUG_OBJECT (parse, "position query"); - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); GST_OBJECT_LOCK (parse); if (format == GST_FORMAT_BYTES) { @@ -3096,9 +3096,10 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) } GST_OBJECT_UNLOCK (parse); - if (res) - gst_query_set_position (query, format, dest_value); - else { + if (res) { + *query = gst_query_make_writable (*query); + gst_query_set_position (*query, format, dest_value); + } else { res = gst_pad_query_default (pad, query); if (!res) { /* no precise result, upstream no idea either, then best estimate */ @@ -3115,7 +3116,7 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) GstClockTime duration; GST_DEBUG_OBJECT (parse, "duration query"); - gst_query_parse_duration (query, &format, NULL); + gst_query_parse_duration (*query, &format, NULL); /* consult upstream */ res = gst_pad_query_default (pad, query); @@ -3123,8 +3124,10 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) /* otherwise best estimate from us */ if (!res) { res = gst_base_parse_get_duration (parse, format, &duration); - if (res) - gst_query_set_duration (query, format, duration); + if (res) { + *query = gst_query_make_writable (*query); + gst_query_set_duration (*query, format, duration); + } } break; } @@ -3135,14 +3138,14 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) gboolean seekable = FALSE; GST_DEBUG_OBJECT (parse, "seeking query"); - gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); + gst_query_parse_seeking (*query, &fmt, NULL, NULL, NULL); /* consult upstream */ res = gst_pad_query_default (pad, query); /* we may be able to help if in TIME */ if (fmt == GST_FORMAT_TIME && gst_base_parse_is_seekable (parse)) { - gst_query_parse_seeking (query, &fmt, &seekable, NULL, NULL); + gst_query_parse_seeking (*query, &fmt, &seekable, NULL, NULL); /* already OK if upstream takes care */ GST_LOG_OBJECT (parse, "upstream handled %d, seekable %d", res, seekable); @@ -3157,14 +3160,17 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) GST_LOG_OBJECT (parse, "already determine upstream seekabled: %d", seekable); } - gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, duration); + *query = gst_query_make_writable (*query); + gst_query_set_seeking (*query, GST_FORMAT_TIME, seekable, 0, + duration); res = TRUE; } } break; } case GST_QUERY_FORMATS: - gst_query_set_formatsv (query, 3, fmtlist); + *query = gst_query_make_writable (*query); + gst_query_set_formatsv (*query, 3, fmtlist); res = TRUE; break; case GST_QUERY_CONVERT: @@ -3172,13 +3178,14 @@ gst_base_parse_query (GstPad * pad, GstQuery * query) GstFormat src_format, dest_format; gint64 src_value, dest_value; - gst_query_parse_convert (query, &src_format, &src_value, + gst_query_parse_convert (*query, &src_format, &src_value, &dest_format, &dest_value); res = gst_base_parse_convert (parse, src_format, src_value, dest_format, &dest_value); if (res) { - gst_query_set_convert (query, src_format, src_value, + *query = gst_query_make_writable (*query); + gst_query_set_convert (*query, src_format, src_value, dest_format, dest_value); } break; diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 5f1b92da3..9fe4ea711 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -360,7 +360,7 @@ static void gst_base_sink_get_property (GObject * object, guint prop_id, static gboolean gst_base_sink_send_event (GstElement * element, GstEvent * event); -static gboolean gst_base_sink_query (GstElement * element, GstQuery * query); +static gboolean gst_base_sink_query (GstElement * element, GstQuery ** query); static const GstQueryType *gst_base_sink_get_query_types (GstElement * element); static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink); @@ -1090,7 +1090,7 @@ gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live, query = gst_query_new_latency (); /* ask the peer for the latency */ - if ((res = gst_pad_peer_query (sink->sinkpad, query))) { + if ((res = gst_pad_peer_query (sink->sinkpad, &query))) { /* get upstream min and max latency */ gst_query_parse_latency (query, &us_live, &us_min, &us_max); @@ -4724,20 +4724,20 @@ gst_base_sink_get_query_types (GstElement * element) } static gboolean -gst_base_sink_query (GstElement * element, GstQuery * query) +gst_base_sink_query (GstElement * element, GstQuery ** query) { gboolean res = FALSE; GstBaseSink *basesink = GST_BASE_SINK (element); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { gint64 cur = 0; GstFormat format; gboolean upstream = FALSE; - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); GST_DEBUG_OBJECT (basesink, "position query in format %s", gst_format_get_name (format)); @@ -4745,7 +4745,8 @@ gst_base_sink_query (GstElement * element, GstQuery * query) /* first try to get the position based on the clock */ if ((res = gst_base_sink_get_position (basesink, format, &cur, &upstream))) { - gst_query_set_position (query, format, cur); + *query = gst_query_make_writable (*query); + gst_query_set_position (*query, format, cur); } else if (upstream) { /* fallback to peer query */ res = gst_pad_peer_query (basesink->sinkpad, query); @@ -4775,7 +4776,8 @@ gst_base_sink_query (GstElement * element, GstQuery * query) pos = gst_util_uint64_scale (100 * GST_FORMAT_PERCENT_SCALE, cur, dur); - gst_query_set_position (query, GST_FORMAT_PERCENT, pos); + *query = gst_query_make_writable (*query); + gst_query_set_position (*query, GST_FORMAT_PERCENT, pos); } } } @@ -4787,14 +4789,15 @@ gst_base_sink_query (GstElement * element, GstQuery * query) GstFormat format; gboolean upstream = FALSE; - gst_query_parse_duration (query, &format, NULL); + gst_query_parse_duration (*query, &format, NULL); GST_DEBUG_OBJECT (basesink, "duration query in format %s", gst_format_get_name (format)); if ((res = gst_base_sink_get_duration (basesink, format, &dur, &upstream))) { - gst_query_set_duration (query, format, dur); + *query = gst_query_make_writable (*query); + gst_query_set_duration (*query, format, dur); } else if (upstream) { /* fallback to peer query */ res = gst_pad_peer_query (basesink->sinkpad, query); @@ -4802,7 +4805,8 @@ gst_base_sink_query (GstElement * element, GstQuery * query) if (!res) { /* we can handle a few things if upstream failed */ if (format == GST_FORMAT_PERCENT) { - gst_query_set_duration (query, GST_FORMAT_PERCENT, + *query = gst_query_make_writable (*query); + gst_query_set_duration (*query, GST_FORMAT_PERCENT, GST_FORMAT_PERCENT_MAX); res = TRUE; } @@ -4816,7 +4820,8 @@ gst_base_sink_query (GstElement * element, GstQuery * query) if ((res = gst_base_sink_query_latency (basesink, &live, &us_live, &min, &max))) { - gst_query_set_latency (query, live, min, max); + *query = gst_query_make_writable (*query); + gst_query_set_latency (*query, live, min, max); } break; } @@ -4829,7 +4834,8 @@ gst_base_sink_query (GstElement * element, GstQuery * query) case GST_QUERY_SEGMENT: { if (basesink->pad_mode == GST_ACTIVATE_PULL) { - gst_query_set_segment (query, basesink->segment.rate, + *query = gst_query_make_writable (*query); + gst_query_set_segment (*query, basesink->segment.rate, GST_FORMAT_TIME, basesink->segment.start, basesink->segment.stop); res = TRUE; } else { @@ -4845,7 +4851,7 @@ gst_base_sink_query (GstElement * element, GstQuery * query) break; } GST_DEBUG_OBJECT (basesink, "query %s returns %d", - GST_QUERY_TYPE_NAME (query), res); + GST_QUERY_TYPE_NAME (*query), res); return res; } diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 5818b3505..5ab1462ad 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -297,12 +297,13 @@ static gboolean gst_base_src_send_event (GstElement * elem, GstEvent * event); static gboolean gst_base_src_default_event (GstBaseSrc * src, GstEvent * event); static const GstQueryType *gst_base_src_get_query_types (GstElement * element); -static gboolean gst_base_src_query (GstPad * pad, GstQuery * query); +static gboolean gst_base_src_query (GstPad * pad, GstQuery ** query); static gboolean gst_base_src_default_negotiate (GstBaseSrc * basesrc); static gboolean gst_base_src_default_do_seek (GstBaseSrc * src, GstSegment * segment); -static gboolean gst_base_src_default_query (GstBaseSrc * src, GstQuery * query); +static gboolean gst_base_src_default_query (GstBaseSrc * src, + GstQuery ** query); static gboolean gst_base_src_default_prepare_seek_segment (GstBaseSrc * src, GstEvent * event, GstSegment * segment); @@ -844,16 +845,16 @@ gst_base_src_fixate (GstPad * pad, GstCaps * caps) } static gboolean -gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) +gst_base_src_default_query (GstBaseSrc * src, GstQuery ** query) { gboolean res; - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { GstFormat format; - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); GST_DEBUG_OBJECT (src, "position query in format %s", gst_format_get_name (format)); @@ -879,7 +880,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) } else percent = -1; - gst_query_set_position (query, GST_FORMAT_PERCENT, percent); + gst_query_set_position (*query, GST_FORMAT_PERCENT, percent); res = TRUE; break; } @@ -903,7 +904,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) } else res = TRUE; - gst_query_set_position (query, format, position); + gst_query_set_position (*query, format, position); break; } } @@ -913,14 +914,14 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) { GstFormat format; - gst_query_parse_duration (query, &format, NULL); + gst_query_parse_duration (*query, &format, NULL); GST_DEBUG_OBJECT (src, "duration query in format %s", gst_format_get_name (format)); switch (format) { case GST_FORMAT_PERCENT: - gst_query_set_duration (query, GST_FORMAT_PERCENT, + gst_query_set_duration (*query, GST_FORMAT_PERCENT, GST_FORMAT_PERCENT_MAX); res = TRUE; break; @@ -951,7 +952,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) * means that we cannot report the duration at all. */ res = TRUE; } - gst_query_set_duration (query, format, duration); + gst_query_set_duration (*query, format, duration); break; } } @@ -968,9 +969,9 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) seg_format = src->segment.format; GST_OBJECT_UNLOCK (src); - gst_query_parse_seeking (query, &format, NULL, NULL, NULL); + gst_query_parse_seeking (*query, &format, NULL, NULL, NULL); if (format == seg_format) { - gst_query_set_seeking (query, seg_format, + gst_query_set_seeking (*query, seg_format, gst_base_src_seekable (src), 0, duration); res = TRUE; } else { @@ -999,7 +1000,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) stop -= src->segment.time; } - gst_query_set_segment (query, src->segment.rate, src->segment.format, + gst_query_set_segment (*query, src->segment.rate, src->segment.format, start, stop); GST_OBJECT_UNLOCK (src); res = TRUE; @@ -1008,7 +1009,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) case GST_QUERY_FORMATS: { - gst_query_set_formats (query, 3, GST_FORMAT_DEFAULT, + gst_query_set_formats (*query, 3, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES, GST_FORMAT_PERCENT); res = TRUE; break; @@ -1018,7 +1019,8 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) GstFormat src_fmt, dest_fmt; gint64 src_val, dest_val; - gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); + gst_query_parse_convert (*query, &src_fmt, &src_val, &dest_fmt, + &dest_val); /* we can only convert between equal formats... */ if (src_fmt == dest_fmt) { @@ -1027,7 +1029,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) } else res = FALSE; - gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); + gst_query_set_convert (*query, src_fmt, src_val, dest_fmt, dest_val); break; } case GST_QUERY_LATENCY: @@ -1042,7 +1044,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) ", max %" GST_TIME_FORMAT, live, GST_TIME_ARGS (min), GST_TIME_ARGS (max)); - gst_query_set_latency (query, live, min, max); + gst_query_set_latency (*query, live, min, max); break; } case GST_QUERY_JITTER: @@ -1054,7 +1056,7 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) GstFormat format, seg_format; gint64 start, stop, estimated; - gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL); + gst_query_parse_buffering_range (*query, &format, NULL, NULL, NULL); GST_DEBUG_OBJECT (src, "buffering query in format %s", gst_format_get_name (format)); @@ -1088,20 +1090,20 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) res = gst_pad_query_convert (src->srcpad, seg_format, start, &format, &start); - gst_query_set_buffering_range (query, format, start, stop, estimated); + gst_query_set_buffering_range (*query, format, start, stop, estimated); break; } default: res = FALSE; break; } - GST_DEBUG_OBJECT (src, "query %s returns %d", GST_QUERY_TYPE_NAME (query), + GST_DEBUG_OBJECT (src, "query %s returns %d", GST_QUERY_TYPE_NAME (*query), res); return res; } static gboolean -gst_base_src_query (GstPad * pad, GstQuery * query) +gst_base_src_query (GstPad * pad, GstQuery ** query) { GstBaseSrc *src; GstBaseSrcClass *bclass; diff --git a/libs/gst/base/gstbasesrc.h b/libs/gst/base/gstbasesrc.h index a492d105b..3e3891d4a 100644 --- a/libs/gst/base/gstbasesrc.h +++ b/libs/gst/base/gstbasesrc.h @@ -213,7 +213,7 @@ struct _GstBaseSrcClass { gboolean (*unlock_stop) (GstBaseSrc *src); /* notify subclasses of a query */ - gboolean (*query) (GstBaseSrc *src, GstQuery *query); + gboolean (*query) (GstBaseSrc *src, GstQuery ** query); /* notify subclasses of an event */ gboolean (*event) (GstBaseSrc *src, GstEvent *event); diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 1e37b7863..ab00048d7 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -328,7 +328,7 @@ static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps); static gboolean gst_base_transform_setcaps (GstBaseTransform * trans, GstPad * pad, GstCaps * caps, gboolean reconfigure); -static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query); +static gboolean gst_base_transform_query (GstPad * pad, GstQuery ** query); static const GstQueryType *gst_base_transform_query_type (GstPad * pad); /* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */ @@ -1209,7 +1209,7 @@ failed_configure: } static gboolean -gst_base_transform_query (GstPad * pad, GstQuery * query) +gst_base_transform_query (GstPad * pad, GstQuery ** query) { gboolean ret = FALSE; GstBaseTransform *trans; @@ -1220,11 +1220,11 @@ gst_base_transform_query (GstPad * pad, GstQuery * query) return FALSE; otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION:{ GstFormat format; - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); if (format == GST_FORMAT_TIME && trans->segment.format == GST_FORMAT_TIME) { gint64 pos; ret = TRUE; @@ -1238,7 +1238,7 @@ gst_base_transform_query (GstPad * pad, GstQuery * query) pos = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, trans->priv->last_stop_out); } - gst_query_set_position (query, format, pos); + gst_query_set_position (*query, format, pos); } else { ret = gst_pad_peer_query (otherpad, query); } diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index 5dbe3d350..76fe4aa90 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -106,7 +106,7 @@ static void gst_fd_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void gst_fd_sink_dispose (GObject * obj); -static gboolean gst_fd_sink_query (GstPad * pad, GstQuery * query); +static gboolean gst_fd_sink_query (GstPad * pad, GstQuery ** query); static GstFlowReturn gst_fd_sink_render (GstBaseSink * sink, GstBuffer * buffer); static gboolean gst_fd_sink_start (GstBaseSink * basesink); @@ -179,31 +179,32 @@ gst_fd_sink_dispose (GObject * obj) } static gboolean -gst_fd_sink_query (GstPad * pad, GstQuery * query) +gst_fd_sink_query (GstPad * pad, GstQuery ** query) { GstFdSink *fdsink; GstFormat format; fdsink = GST_FD_SINK (GST_PAD_PARENT (pad)); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); switch (format) { case GST_FORMAT_DEFAULT: case GST_FORMAT_BYTES: - gst_query_set_position (query, GST_FORMAT_BYTES, fdsink->current_pos); + gst_query_set_position (*query, GST_FORMAT_BYTES, + fdsink->current_pos); return TRUE; default: return FALSE; } case GST_QUERY_FORMATS: - gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES); + gst_query_set_formats (*query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES); return TRUE; case GST_QUERY_URI: - gst_query_set_uri (query, fdsink->uri); + gst_query_set_uri (*query, fdsink->uri); return TRUE; default: diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index e1180fade..0eef85c07 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -132,7 +132,7 @@ static gboolean gst_fd_src_unlock_stop (GstBaseSrc * bsrc); static gboolean gst_fd_src_is_seekable (GstBaseSrc * bsrc); static gboolean gst_fd_src_get_size (GstBaseSrc * src, guint64 * size); static gboolean gst_fd_src_do_seek (GstBaseSrc * src, GstSegment * segment); -static gboolean gst_fd_src_query (GstBaseSrc * src, GstQuery * query); +static gboolean gst_fd_src_query (GstBaseSrc * src, GstQuery ** query); static GstFlowReturn gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf); @@ -507,14 +507,14 @@ read_error: } static gboolean -gst_fd_src_query (GstBaseSrc * basesrc, GstQuery * query) +gst_fd_src_query (GstBaseSrc * basesrc, GstQuery ** query) { gboolean ret = FALSE; GstFdSrc *src = GST_FD_SRC (basesrc); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_URI: - gst_query_set_uri (query, src->uri); + gst_query_set_uri (*query, src->uri); ret = TRUE; break; default: diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 6df542389..3916dbcad 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -168,7 +168,7 @@ static gboolean gst_file_sink_do_seek (GstFileSink * filesink, static gboolean gst_file_sink_get_current_offset (GstFileSink * filesink, guint64 * p_pos); -static gboolean gst_file_sink_query (GstPad * pad, GstQuery * query); +static gboolean gst_file_sink_query (GstPad * pad, GstQuery ** query); static void gst_file_sink_uri_handler_init (gpointer g_iface, gpointer iface_data); @@ -449,31 +449,31 @@ close_failed: } static gboolean -gst_file_sink_query (GstPad * pad, GstQuery * query) +gst_file_sink_query (GstPad * pad, GstQuery ** query) { GstFileSink *self; GstFormat format; self = GST_FILE_SINK (GST_PAD_PARENT (pad)); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: - gst_query_parse_position (query, &format, NULL); + gst_query_parse_position (*query, &format, NULL); switch (format) { case GST_FORMAT_DEFAULT: case GST_FORMAT_BYTES: - gst_query_set_position (query, GST_FORMAT_BYTES, self->current_pos); + gst_query_set_position (*query, GST_FORMAT_BYTES, self->current_pos); return TRUE; default: return FALSE; } case GST_QUERY_FORMATS: - gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES); + gst_query_set_formats (*query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES); return TRUE; case GST_QUERY_URI: - gst_query_set_uri (query, self->uri); + gst_query_set_uri (*query, self->uri); return TRUE; default: diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 1a65a14be..c10307f02 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -200,7 +200,7 @@ static gboolean gst_file_src_is_seekable (GstBaseSrc * src); static gboolean gst_file_src_get_size (GstBaseSrc * src, guint64 * size); static GstFlowReturn gst_file_src_create (GstBaseSrc * src, guint64 offset, guint length, GstBuffer ** buffer); -static gboolean gst_file_src_query (GstBaseSrc * src, GstQuery * query); +static gboolean gst_file_src_query (GstBaseSrc * src, GstQuery ** query); static void gst_file_src_uri_handler_init (gpointer g_iface, gpointer iface_data); @@ -893,14 +893,14 @@ gst_file_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, } static gboolean -gst_file_src_query (GstBaseSrc * basesrc, GstQuery * query) +gst_file_src_query (GstBaseSrc * basesrc, GstQuery ** query) { gboolean ret = FALSE; GstFileSrc *src = GST_FILE_SRC (basesrc); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_URI: - gst_query_set_uri (query, src->uri); + gst_query_set_uri (*query, src->uri); ret = TRUE; break; default: diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 89497521b..57f5a421d 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -696,7 +696,7 @@ static GstStateChangeReturn gst_input_selector_change_state (GstElement * static GstCaps *gst_input_selector_getcaps (GstPad * pad); static gboolean gst_input_selector_event (GstPad * pad, GstEvent * event); -static gboolean gst_input_selector_query (GstPad * pad, GstQuery * query); +static gboolean gst_input_selector_query (GstPad * pad, GstQuery ** query); static gint64 gst_input_selector_block (GstInputSelector * self); static void gst_input_selector_switch (GstInputSelector * self, GstPad * pad, gint64 stop_time, gint64 start_time); @@ -1112,7 +1112,7 @@ gst_input_selector_event (GstPad * pad, GstEvent * event) /* query on the srcpad. We override this function because by default it will * only forward the query to one random sinkpad */ static gboolean -gst_input_selector_query (GstPad * pad, GstQuery * query) +gst_input_selector_query (GstPad * pad, GstQuery ** query) { gboolean res = TRUE; GstInputSelector *sel; @@ -1124,7 +1124,7 @@ gst_input_selector_query (GstPad * pad, GstQuery * query) otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE); - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_LATENCY: { GList *walk; @@ -1152,7 +1152,7 @@ gst_input_selector_query (GstPad * pad, GstQuery * query) /* one query succeeded, we succeed too */ res = TRUE; - gst_query_parse_latency (query, &live, &min, &max); + gst_query_parse_latency (*query, &live, &min, &max); GST_DEBUG_OBJECT (sinkpad, "peer latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT @@ -1172,7 +1172,7 @@ gst_input_selector_query (GstPad * pad, GstQuery * query) } GST_INPUT_SELECTOR_UNLOCK (sel); if (res) { - gst_query_set_latency (query, reslive, resmin, resmax); + gst_query_set_latency (*query, reslive, resmin, resmax); GST_DEBUG_OBJECT (sel, "total latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 31e936c00..7fe10fa73 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1465,7 +1465,7 @@ gst_multi_queue_src_event (GstPad * pad, GstEvent * event) } static gboolean -gst_multi_queue_src_query (GstPad * pad, GstQuery * query) +gst_multi_queue_src_query (GstPad * pad, GstQuery ** query) { GstSingleQueue *sq = gst_pad_get_element_private (pad); GstPad *peerpad; diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 4130159a6..7db5861c3 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -199,7 +199,7 @@ static void gst_queue_loop (GstPad * pad); static gboolean gst_queue_handle_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_queue_handle_src_query (GstPad * pad, GstQuery * query); +static gboolean gst_queue_handle_src_query (GstPad * pad, GstQuery ** query); static gboolean gst_queue_acceptcaps (GstPad * pad, GstCaps * caps); static GstCaps *gst_queue_getcaps (GstPad * pad); @@ -1293,7 +1293,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event) } static gboolean -gst_queue_handle_src_query (GstPad * pad, GstQuery * query) +gst_queue_handle_src_query (GstPad * pad, GstQuery ** query) { GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad)); GstPad *peer; @@ -1314,14 +1314,14 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query) return FALSE; } - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { gint64 peer_pos; GstFormat format; /* get peer position */ - gst_query_parse_position (query, &format, &peer_pos); + gst_query_parse_position (*query, &format, &peer_pos); /* FIXME: this code assumes that there's no discont in the queue */ switch (format) { @@ -1337,7 +1337,7 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query) return TRUE; } /* set updated position */ - gst_query_set_position (query, format, peer_pos); + gst_query_set_position (*query, format, peer_pos); break; } case GST_QUERY_LATENCY: @@ -1345,7 +1345,7 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query) gboolean live; GstClockTime min, max; - gst_query_parse_latency (query, &live, &min, &max); + gst_query_parse_latency (*query, &live, &min, &max); /* we can delay up to the limit of the queue in time. If we have no time * limit, the best thing we can do is to return an infinite delay. In @@ -1360,7 +1360,7 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query) if (queue->min_threshold.time > 0 && min != -1) min += queue->min_threshold.time; - gst_query_set_latency (query, live, min, max); + gst_query_set_latency (*query, live, min, max); break; } default: diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index b3b9bd325..ca4e87508 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -230,9 +230,9 @@ static void gst_queue2_loop (GstPad * pad); static gboolean gst_queue2_handle_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_queue2_handle_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_queue2_handle_src_query (GstPad * pad, GstQuery * query); +static gboolean gst_queue2_handle_src_query (GstPad * pad, GstQuery ** query); static gboolean gst_queue2_handle_query (GstElement * element, - GstQuery * query); + GstQuery ** query); static GstCaps *gst_queue2_getcaps (GstPad * pad); static gboolean gst_queue2_acceptcaps (GstPad * pad, GstCaps * caps); @@ -2421,7 +2421,7 @@ gst_queue2_handle_src_event (GstPad * pad, GstEvent * event) } static gboolean -gst_queue2_peer_query (GstQueue2 * queue, GstPad * pad, GstQuery * query) +gst_queue2_peer_query (GstQueue2 * queue, GstPad * pad, GstQuery ** query) { gboolean ret = FALSE; GstPad *peer; @@ -2434,7 +2434,7 @@ gst_queue2_peer_query (GstQueue2 * queue, GstPad * pad, GstQuery * query) } static gboolean -gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) +gst_queue2_handle_src_query (GstPad * pad, GstQuery ** query) { GstQueue2 *queue; @@ -2442,7 +2442,7 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) if (G_UNLIKELY (queue == NULL)) return FALSE; - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { gint64 peer_pos; @@ -2452,7 +2452,7 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) goto peer_failed; /* get peer position */ - gst_query_parse_position (query, &format, &peer_pos); + gst_query_parse_position (*query, &format, &peer_pos); /* FIXME: this code assumes that there's no discont in the queue */ switch (format) { @@ -2468,7 +2468,7 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) return FALSE; } /* set updated position */ - gst_query_set_position (query, format, peer_pos); + gst_query_set_position (*query, format, peer_pos); break; } case GST_QUERY_DURATION: @@ -2537,7 +2537,7 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) GST_DEBUG_OBJECT (queue, "estimated %" G_GINT64_FORMAT ", left %" G_GINT64_FORMAT, estimated_total, buffering_left); - gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL); + gst_query_parse_buffering_range (*query, &format, NULL, NULL, NULL); switch (format) { case GST_FORMAT_PERCENT: @@ -2593,13 +2593,13 @@ gst_queue2_handle_src_query (GstPad * pad, GstQuery * query) GST_DEBUG_OBJECT (queue, "range starting at %" G_GINT64_FORMAT " and finishing at %" G_GINT64_FORMAT, range_start, range_stop); - gst_query_add_buffering_range (query, range_start, range_stop); + gst_query_add_buffering_range (*query, range_start, range_stop); } - gst_query_set_buffering_percent (query, is_buffering, percent); - gst_query_set_buffering_range (query, format, start, stop, + gst_query_set_buffering_percent (*query, is_buffering, percent); + gst_query_set_buffering_range (*query, format, start, stop, estimated_total); - gst_query_set_buffering_stats (query, GST_BUFFERING_DOWNLOAD, + gst_query_set_buffering_stats (*query, GST_BUFFERING_DOWNLOAD, byte_in_rate, byte_out_rate, buffering_left); } break; @@ -2624,7 +2624,7 @@ peer_failed: } static gboolean -gst_queue2_handle_query (GstElement * element, GstQuery * query) +gst_queue2_handle_query (GstElement * element, GstQuery ** query) { /* simply forward to the srcpad query function */ return gst_queue2_handle_src_query (GST_QUEUE2_CAST (element)->srcpad, query); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index b34c3bd5b..182324e6e 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -142,7 +142,8 @@ static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad); static gboolean gst_type_find_element_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_type_find_handle_src_query (GstPad * pad, GstQuery * query); +static gboolean gst_type_find_handle_src_query (GstPad * pad, + GstQuery ** query); static gboolean gst_type_find_element_handle_event (GstPad * pad, GstEvent * event); @@ -370,7 +371,7 @@ gst_type_find_element_get_property (GObject * object, guint prop_id, } static gboolean -gst_type_find_handle_src_query (GstPad * pad, GstQuery * query) +gst_type_find_handle_src_query (GstPad * pad, GstQuery ** query) { GstTypeFindElement *typefind; gboolean res = FALSE; @@ -386,13 +387,13 @@ gst_type_find_handle_src_query (GstPad * pad, GstQuery * query) if (!res) goto out; - switch (GST_QUERY_TYPE (query)) { + switch (GST_QUERY_TYPE (*query)) { case GST_QUERY_POSITION: { gint64 peer_pos; GstFormat format; - gst_query_parse_position (query, &format, &peer_pos); + gst_query_parse_position (*query, &format, &peer_pos); GST_OBJECT_LOCK (typefind); /* FIXME: this code assumes that there's no discont in the queue */ @@ -405,7 +406,7 @@ gst_type_find_handle_src_query (GstPad * pad, GstQuery * query) break; } GST_OBJECT_UNLOCK (typefind); - gst_query_set_position (query, format, peer_pos); + gst_query_set_position (*query, format, peer_pos); break; } default: @@ -652,7 +653,7 @@ gst_type_find_get_extension (GstTypeFindElement * typefind, GstPad * pad) query = gst_query_new_uri (); /* try getting the caps with an uri query and from the extension */ - if (!gst_pad_peer_query (pad, query)) + if (!gst_pad_peer_query (pad, &query)) goto peer_query_failed; gst_query_parse_uri (query, &uri); diff --git a/tests/check/elements/fdsrc.c b/tests/check/elements/fdsrc.c index 6c92f6db8..caf88e194 100644 --- a/tests/check/elements/fdsrc.c +++ b/tests/check/elements/fdsrc.c @@ -136,7 +136,7 @@ GST_START_TEST (test_nonseeking) /* Test that fdsrc is non-seekable with a pipe */ fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); + fail_unless (gst_element_query (src, &seeking_query) == TRUE); gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); fail_unless (seekable == FALSE); gst_query_unref (seeking_query); @@ -173,7 +173,7 @@ GST_START_TEST (test_seeking) /* Test that fdsrc is seekable with a file fd */ fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); + fail_unless (gst_element_query (src, &seeking_query) == TRUE); gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); fail_unless (seekable == TRUE); gst_query_unref (seeking_query); diff --git a/tests/check/elements/filesrc.c b/tests/check/elements/filesrc.c index 4c989622c..d4221daf6 100644 --- a/tests/check/elements/filesrc.c +++ b/tests/check/elements/filesrc.c @@ -113,7 +113,7 @@ GST_START_TEST (test_seeking) /* Test that filesrc is seekable with a file fd */ fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); + fail_unless (gst_element_query (src, &seeking_query) == TRUE); gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); fail_unless (seekable == TRUE); gst_query_unref (seeking_query); @@ -197,7 +197,7 @@ GST_START_TEST (test_pull) /* Test that filesrc is seekable with a file fd */ fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); + fail_unless (gst_element_query (src, &seeking_query) == TRUE); /* get the seeking capabilities */ gst_query_parse_seeking (seeking_query, NULL, &seekable, &start, &stop); @@ -399,7 +399,7 @@ check_uri_for_location (GstElement * e, const gchar * location, g_object_set (e, "location", location, NULL); query = gst_query_new_uri (); - fail_unless (gst_element_query (e, query)); + fail_unless (gst_element_query (e, &query)); gst_query_parse_uri (query, &query_uri); gst_query_unref (query); diff --git a/tests/check/gst/gstquery.c b/tests/check/gst/gstquery.c index b37eec221..3195636d4 100644 --- a/tests/check/gst/gstquery.c +++ b/tests/check/gst/gstquery.c @@ -236,28 +236,28 @@ GST_START_TEST (test_queries) gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); /* Query the bin */ - fail_unless (gst_element_query (GST_ELEMENT (bin), pos), + fail_unless (gst_element_query (GST_ELEMENT (bin), &pos), "Could not query pipeline position"); - fail_unless (gst_element_query (GST_ELEMENT (bin), dur), + fail_unless (gst_element_query (GST_ELEMENT (bin), &dur), "Could not query pipeline duration"); /* Query elements */ - fail_unless (gst_element_query (GST_ELEMENT (src), pos), + fail_unless (gst_element_query (GST_ELEMENT (src), &pos), "Could not query position of fakesrc"); - fail_unless (gst_element_query (GST_ELEMENT (src), pos), + fail_unless (gst_element_query (GST_ELEMENT (src), &pos), "Could not query duration of fakesrc"); - fail_unless (gst_element_query (GST_ELEMENT (sink), pos), + fail_unless (gst_element_query (GST_ELEMENT (sink), &pos), "Could not query position of fakesink"); - fail_unless (gst_element_query (GST_ELEMENT (sink), pos), + fail_unless (gst_element_query (GST_ELEMENT (sink), &pos), "Could not query duration of fakesink"); /* Query pads */ fail_unless ((pad = gst_element_get_static_pad (src, "src")) != NULL, "Could not get source pad of fakesrc"); - fail_unless (gst_pad_query (pad, pos), + fail_unless (gst_pad_query (pad, &pos), "Could not query position of fakesrc src pad"); - fail_unless (gst_pad_query (pad, dur), + fail_unless (gst_pad_query (pad, &dur), "Could not query duration of fakesrc src pad"); gst_object_unref (pad); |