diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2017-12-06 13:36:30 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-12-06 16:39:43 +0200 |
commit | f76ec3de25039cb59e66d2ae61e39b8c19454142 (patch) | |
tree | ce326ab453c86e0df5a6e91b280e8ac8ac34c5e3 | |
parent | 3ef7a5999b981d43f513d9a884ad52a2417404a3 (diff) |
query: Add an empty structure in writable_structure() if there is none yet
This is consistent with how it works for GstEvent already.
-rw-r--r-- | gst/gstquery.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gst/gstquery.c b/gst/gstquery.c index ad03f9ff03..3982dfea94 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -731,10 +731,21 @@ gst_query_get_structure (GstQuery * query) GstStructure * gst_query_writable_structure (GstQuery * query) { + GstStructure *structure; + g_return_val_if_fail (GST_IS_QUERY (query), NULL); g_return_val_if_fail (gst_query_is_writable (query), NULL); - return GST_QUERY_STRUCTURE (query); + structure = GST_QUERY_STRUCTURE (query); + + if (structure == NULL) { + structure = + gst_structure_new_id_empty (gst_query_type_to_quark (GST_QUERY_TYPE + (query))); + gst_structure_set_parent_refcount (structure, &query->mini_object.refcount); + GST_QUERY_STRUCTURE (query) = structure; + } + return structure; } /** |