summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/gstbin.c36
-rw-r--r--gst/gstelement.c7
-rw-r--r--gst/gstelement.h4
-rw-r--r--gst/gstghostpad.c2
-rw-r--r--gst/gstpad.c14
-rw-r--r--gst/gstpad.h13
-rw-r--r--gst/gstutils.c12
7 files changed, 48 insertions, 40 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);