[vala/0.50] gstreamer-1.0: Fix direction of GLib.Value typed parameters



commit def2207c58dcbfbf448e061bb0801854bf8d46e1
Author: Chris White <cxwembedded gmail com>
Date:   Thu Dec 10 12:40:30 2020 -0500

    gstreamer-1.0: Fix direction of GLib.Value typed parameters
    
    Use `out` for functions that take an uninitialized GLib.Value.
    Use `ref` for functions that take a GLib.Value initialized with
    a particular type.
    
    Remove unused Gst.ControlBindingConvert
    
    Note that the destination is nullable, but not expressly marked as such,
    in gst_value_intersect, gst_value_subtract and
    gst_message_parse_property_notify.
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/1014

 vapi/gstreamer-1.0.vapi                  | 66 ++++++++++++++++----------------
 vapi/gstreamer-controller-1.0.vapi       |  2 +-
 vapi/metadata/Gst-1.0.metadata           | 41 ++++++++++++++++++++
 vapi/metadata/GstController-1.0.metadata |  3 ++
 4 files changed, 77 insertions(+), 35 deletions(-)
---
diff --git a/vapi/gstreamer-1.0.vapi b/vapi/gstreamer-1.0.vapi
index 855080843..526badecf 100644
--- a/vapi/gstreamer-1.0.vapi
+++ b/vapi/gstreamer-1.0.vapi
@@ -447,7 +447,7 @@ namespace Gst {
                [Version (since = "1.12")]
                public static bool set_object_array (GLib.Object object, string name, GLib.ValueArray array);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_value_from_string (out GLib.Value value, string value_str);
+               public static void set_value_from_string (ref GLib.Value value, string value_str);
                [CCode (cheader_filename = "gst/gst.h")]
                public static uint64 uint64_scale (uint64 val, uint64 num, uint64 denom);
                [CCode (cheader_filename = "gst/gst.h")]
@@ -473,16 +473,16 @@ namespace Gst {
                [CCode (cheader_filename = "gst/gst.h")]
                public static int compare (GLib.Value value1, GLib.Value value2);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static bool deserialize (out GLib.Value dest, string src);
+               public static bool deserialize (ref GLib.Value dest, string src);
                [CCode (cheader_filename = "gst/gst.h")]
                [Version (since = "1.20")]
-               public static bool deserialize_with_pspec (out GLib.Value dest, string src, GLib.ParamSpec? 
pspec);
+               public static bool deserialize_with_pspec (ref GLib.Value dest, string src, GLib.ParamSpec? 
pspec);
                [CCode (cheader_filename = "gst/gst.h")]
                public static bool fixate (GLib.Value dest, GLib.Value src);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static bool fraction_multiply (GLib.Value product, GLib.Value factor1, GLib.Value 
factor2);
+               public static bool fraction_multiply (ref GLib.Value product, GLib.Value factor1, GLib.Value 
factor2);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static bool fraction_subtract (GLib.Value dest, GLib.Value minuend, GLib.Value 
subtrahend);
+               public static bool fraction_subtract (ref GLib.Value dest, GLib.Value minuend, GLib.Value 
subtrahend);
                [CCode (cheader_filename = "gst/gst.h")]
                public static uint64 get_bitmask (GLib.Value value);
                [CCode (cheader_filename = "gst/gst.h")]
@@ -522,7 +522,7 @@ namespace Gst {
                [CCode (cheader_filename = "gst/gst.h")]
                public static unowned Gst.Structure get_structure (GLib.Value value);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void init_and_copy (out GLib.Value dest, GLib.Value src);
+               public static void init_and_copy (ref GLib.Value dest, GLib.Value src);
                [CCode (cheader_filename = "gst/gst.h")]
                public static bool intersect (out GLib.Value dest, GLib.Value value1, GLib.Value value2);
                [CCode (cheader_filename = "gst/gst.h")]
@@ -534,32 +534,32 @@ namespace Gst {
                [CCode (cheader_filename = "gst/gst.h")]
                public static string? serialize (GLib.Value value);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_bitmask (GLib.Value value, uint64 bitmask);
+               public static void set_bitmask (ref GLib.Value value, uint64 bitmask);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_caps (GLib.Value value, Gst.Caps caps);
+               public static void set_caps (ref GLib.Value value, Gst.Caps caps);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_caps_features (GLib.Value value, Gst.CapsFeatures features);
+               public static void set_caps_features (ref GLib.Value value, Gst.CapsFeatures features);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_double_range (GLib.Value value, double start, double end);
+               public static void set_double_range (ref GLib.Value value, double start, double end);
                [CCode (cheader_filename = "gst/gst.h")]
                [Version (since = "1.6")]
-               public static void set_flagset (GLib.Value value, uint flags, uint mask);
+               public static void set_flagset (ref GLib.Value value, uint flags, uint mask);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_fraction (GLib.Value value, int numerator, int denominator);
+               public static void set_fraction (ref GLib.Value value, int numerator, int denominator);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_fraction_range (GLib.Value value, GLib.Value start, GLib.Value end);
+               public static void set_fraction_range (ref GLib.Value value, GLib.Value start, GLib.Value 
end);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_fraction_range_full (GLib.Value value, int numerator_start, int 
denominator_start, int numerator_end, int denominator_end);
+               public static void set_fraction_range_full (ref GLib.Value value, int numerator_start, int 
denominator_start, int numerator_end, int denominator_end);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_int64_range (GLib.Value value, int64 start, int64 end);
+               public static void set_int64_range (ref GLib.Value value, int64 start, int64 end);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_int64_range_step (GLib.Value value, int64 start, int64 end, int64 
step);
+               public static void set_int64_range_step (ref GLib.Value value, int64 start, int64 end, int64 
step);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_int_range (GLib.Value value, int start, int end);
+               public static void set_int_range (ref GLib.Value value, int start, int end);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_int_range_step (GLib.Value value, int start, int end, int step);
+               public static void set_int_range_step (ref GLib.Value value, int start, int end, int step);
                [CCode (cheader_filename = "gst/gst.h")]
-               public static void set_structure (GLib.Value value, Gst.Structure structure);
+               public static void set_structure (ref GLib.Value value, Gst.Structure structure);
                [CCode (cheader_filename = "gst/gst.h")]
                public static bool subtract (out GLib.Value dest, GLib.Value minuend, GLib.Value subtrahend);
                [CCode (cheader_filename = "gst/gst.h")]
@@ -2759,28 +2759,28 @@ namespace Gst {
                [CCode (has_construct_function = false)]
                protected ValueArray ();
                [Version (since = "1.2")]
-               public static void append_and_take_value (GLib.Value value, owned GLib.Value append_value);
-               public static void append_value (GLib.Value value, GLib.Value append_value);
+               public static void append_and_take_value (ref GLib.Value value, owned GLib.Value 
append_value);
+               public static void append_value (ref GLib.Value value, GLib.Value append_value);
                public static uint get_size (GLib.Value value);
                public static unowned GLib.Value? get_value (GLib.Value value, uint index);
                [Version (since = "1.18")]
                public static unowned GLib.Value? init (GLib.Value value, uint prealloc);
-               public static void prepend_value (GLib.Value value, GLib.Value prepend_value);
+               public static void prepend_value (ref GLib.Value value, GLib.Value prepend_value);
        }
        [CCode (cheader_filename = "gst/gst.h", type_id = "gst_value_list_get_type ()")]
        public class ValueList {
                [CCode (has_construct_function = false)]
                protected ValueList ();
                [Version (since = "1.2")]
-               public static void append_and_take_value (GLib.Value value, owned GLib.Value append_value);
-               public static void append_value (GLib.Value value, GLib.Value append_value);
+               public static void append_and_take_value (ref GLib.Value value, owned GLib.Value 
append_value);
+               public static void append_value (ref GLib.Value value, GLib.Value append_value);
                public static void concat (out GLib.Value dest, GLib.Value value1, GLib.Value value2);
                public static uint get_size (GLib.Value value);
                public static unowned GLib.Value? get_value (GLib.Value value, uint index);
                [Version (since = "1.18")]
                public static unowned GLib.Value? init (GLib.Value value, uint prealloc);
                public static void merge (out GLib.Value dest, GLib.Value value1, GLib.Value value2);
-               public static void prepend_value (GLib.Value value, GLib.Value prepend_value);
+               public static void prepend_value (ref GLib.Value value, GLib.Value prepend_value);
        }
        [CCode (cheader_filename = "gst/gst.h", type_cname = "GstChildProxyInterface", type_id = 
"gst_child_proxy_get_type ()")]
        public interface ChildProxy : GLib.Object {
@@ -2788,7 +2788,7 @@ namespace Gst {
                public abstract GLib.Object? get_child_by_index (uint index);
                public abstract GLib.Object? get_child_by_name (string name);
                public abstract uint get_children_count ();
-               public GLib.Value get_property (string name);
+               public void get_property (string name, ref GLib.Value value);
                public void get_valist (string first_property_name, va_list var_args);
                public bool lookup (string name, out GLib.Object target, out unowned GLib.ParamSpec pspec);
                public void @set (...);
@@ -3953,8 +3953,6 @@ namespace Gst {
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 3.9)]
        public delegate bool ClockCallback (Gst.Clock clock, Gst.ClockTime time, Gst.ClockID id);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
-       public delegate void ControlBindingConvert (Gst.ControlBinding binding, double src_value, GLib.Value 
dest_value);
-       [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate bool ControlSourceGetValue (Gst.ControlSource self, Gst.ClockTime timestamp, double 
value);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate bool ControlSourceGetValueArray (Gst.ControlSource self, Gst.ClockTime timestamp, 
Gst.ClockTime interval, uint n_values, double values);
@@ -3971,7 +3969,7 @@ namespace Gst {
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate void IteratorCopyFunction (Gst.Iterator it, Gst.Iterator copy);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 2.9)]
-       public delegate bool IteratorFoldFunction (GLib.Value item, GLib.Value ret);
+       public delegate bool IteratorFoldFunction (GLib.Value item, ref GLib.Value ret);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 1.9)]
        public delegate void IteratorForeachFunction (GLib.Value item);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
@@ -3979,7 +3977,7 @@ namespace Gst {
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate Gst.IteratorItem IteratorItemFunction (Gst.Iterator it, GLib.Value item);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
-       public delegate Gst.IteratorResult IteratorNextFunction (Gst.Iterator it, GLib.Value result);
+       public delegate Gst.IteratorResult IteratorNextFunction (Gst.Iterator it, ref GLib.Value result);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate void IteratorResyncFunction (Gst.Iterator it);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 7.9)]
@@ -4051,15 +4049,15 @@ namespace Gst {
        [Version (since = "1.14")]
        public delegate void PromiseChangeFunc (Gst.Promise promise);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 2.9)]
-       public delegate bool StructureFilterMapFunc (GLib.Quark field_id, GLib.Value value);
+       public delegate bool StructureFilterMapFunc (GLib.Quark field_id, ref GLib.Value value);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 2.9)]
        public delegate bool StructureForeachFunc (GLib.Quark field_id, GLib.Value value);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 2.9)]
-       public delegate bool StructureMapFunc (GLib.Quark field_id, GLib.Value value);
+       public delegate bool StructureMapFunc (GLib.Quark field_id, ref GLib.Value value);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 2.9)]
        public delegate void TagForeachFunc (Gst.TagList list, string tag);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
-       public delegate void TagMergeFunc (GLib.Value dest, GLib.Value src);
+       public delegate void TagMergeFunc (out GLib.Value dest, GLib.Value src);
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 0.9)]
        public delegate void TaskFunction ();
        [CCode (cheader_filename = "gst/gst.h", instance_pos = 0.9)]
@@ -4071,7 +4069,7 @@ namespace Gst {
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        public delegate int ValueCompareFunc (GLib.Value value1, GLib.Value value2);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
-       public delegate bool ValueDeserializeFunc (GLib.Value dest, string s);
+       public delegate bool ValueDeserializeFunc (ref GLib.Value dest, string s);
        [CCode (cheader_filename = "gst/gst.h", has_target = false)]
        [Version (since = "1.20")]
        public delegate bool ValueDeserializeWithPSpecFunc (GLib.Value dest, string s, GLib.ParamSpec pspec);
diff --git a/vapi/gstreamer-controller-1.0.vapi b/vapi/gstreamer-controller-1.0.vapi
index 63a103c43..889249955 100644
--- a/vapi/gstreamer-controller-1.0.vapi
+++ b/vapi/gstreamer-controller-1.0.vapi
@@ -131,7 +131,7 @@ namespace Gst {
                        TRIANGLE
                }
                [CCode (cheader_filename = "gst/controller/controller.h", cname = 
"GstDirectControlBindingConvertGValue", has_target = false)]
-               public delegate void DirectControlBindingConvertGValue (Gst.Controller.DirectControlBinding 
self, double src_value, GLib.Value dest_value);
+               public delegate void DirectControlBindingConvertGValue (Gst.Controller.DirectControlBinding 
self, double src_value, ref GLib.Value dest_value);
                [CCode (cheader_filename = "gst/controller/controller.h", cname = 
"GstDirectControlBindingConvertValue", has_target = false)]
                public delegate void DirectControlBindingConvertValue (Gst.Controller.DirectControlBinding 
self, double src_value, void* dest_value);
                [CCode (cheader_filename = "gst/controller/controller.h", cname = 
"gst_timed_value_control_invalidate_cache")]
diff --git a/vapi/metadata/Gst-1.0.metadata b/vapi/metadata/Gst-1.0.metadata
index 9c23a04b3..a88dbf8b9 100644
--- a/vapi/metadata/Gst-1.0.metadata
+++ b/vapi/metadata/Gst-1.0.metadata
@@ -104,6 +104,43 @@ Structure
 Query
   .set_formats skip
 
+// GValue is bound as struct in vala
+util_set_value_from_string.value ref
+value_deserialize.dest ref
+value_deserialize_with_pspec.dest ref
+value_fraction_multiply.product ref
+value_fraction_subtract.dest ref
+value_init_and_copy.dest ref
+value_set_bitmask.value ref
+value_set_caps.value ref
+value_set_caps_features.value ref
+value_set_double_range.value ref
+value_set_flagset.value ref
+value_set_fraction.value ref
+value_set_fraction_range.value ref
+value_set_fraction_range_full.value ref
+value_set_int64_range.value ref
+value_set_int64_range_step.value ref
+value_set_int_range.value ref
+value_set_int_range_step.value ref
+value_set_structure.value ref
+ChildProxy
+  .get_property.value ref
+ValueArray
+  .append_and_take_value.value ref
+  .append_value.value ref
+  .prepend_value.value ref
+ValueList
+  .append_and_take_value.value ref
+  .append_value.value ref
+  .prepend_value.value ref
+IteratorFoldFunction.ret ref
+IteratorNextFunction.result ref
+StructureFilterMapFunc.value ref
+StructureMapFunc.value ref
+TagMergeFunc.dest out
+ValueDeserializeFunc.dest ref
+
 // Generics
 AtomicQueue
   .peek skip
@@ -256,6 +293,10 @@ Pipeline
 // Upstream
 ///////////
 
+// Not used internally and not meant to be used
+// https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/58980426
+ControlBindingConvert skip
+
 URIHandler
   .get_protocols abstract
   .get_uri_type abstract vfunc_name="get_type"
diff --git a/vapi/metadata/GstController-1.0.metadata b/vapi/metadata/GstController-1.0.metadata
index c2708eec2..4196f1d24 100644
--- a/vapi/metadata/GstController-1.0.metadata
+++ b/vapi/metadata/GstController-1.0.metadata
@@ -11,3 +11,6 @@ DirectControlBinding
 TimedValueControlSource
   .find_control_point_iter skip=false
   .values type="GLib.Sequence<Gst.Controller.ControlPoint?>"
+
+// GValue is bound as struct in vala
+DirectControlBindingConvertGValue.dest_value ref


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]