paramspecs: Add a GParamSpecFlag to indicate the property might not always exists
authorSeungha Yang <seungha.yang@navercorp.com>
Wed, 11 Sep 2019 04:51:04 +0000 (13:51 +0900)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 8 Jun 2020 14:18:09 +0000 (14:18 +0000)
Add new flag for users to notice that the property is not guaranteed
to exist depending on environment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/283>

gst/gstparamspecs.h
tools/gst-inspect.c

index 857cc0f..f93a88d 100644 (file)
@@ -70,6 +70,16 @@ G_BEGIN_DECLS
 #define GST_PARAM_DOC_SHOW_DEFAULT  (1 << (G_PARAM_USER_SHIFT + 5))
 
 /**
+ * GST_PARAM_CONDITIONALLY_AVAILABLE: (value 16384)
+ *
+ * Use this flag on GObject properties of GstObject to indicate that
+ * they might not be available depending on environment such as OS, device, etc,
+ * so such properties will be installed conditionally only if the GstObject is
+ * able to support it.
+ */
+#define GST_PARAM_CONDITIONALLY_AVAILABLE  (1 << (G_PARAM_USER_SHIFT + 6))
+
+/**
  * GST_PARAM_USER_SHIFT: (value 65536)
  *
  * Bits based on GST_PARAM_USER_SHIFT can be used by 3rd party applications.
index 98e1d5e..fdb8b0b 100644 (file)
@@ -340,7 +340,8 @@ flags_to_string (GFlagsValue * vals, guint flags)
   G_PARAM_LAX_VALIDATION |  G_PARAM_STATIC_STRINGS | \
   G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_DEPRECATED | \
   GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | \
-  GST_PARAM_MUTABLE_PAUSED | GST_PARAM_MUTABLE_READY)
+  GST_PARAM_MUTABLE_PAUSED | GST_PARAM_MUTABLE_READY | \
+  GST_PARAM_CONDITIONALLY_AVAILABLE)
 
 static int
 sort_gparamspecs (GParamSpec ** a, GParamSpec ** b)
@@ -415,6 +416,11 @@ print_object_properties_info (GObject * obj, GObjectClass * obj_class,
           RESET_COLOR);
       first_flag = FALSE;
     }
+    if (param->flags & GST_PARAM_CONDITIONALLY_AVAILABLE) {
+      g_print (", %s%s%s", PROP_ATTR_VALUE_COLOR, _("conditionally available"),
+          RESET_COLOR);
+      first_flag = FALSE;
+    }
     if (param->flags & GST_PARAM_MUTABLE_PLAYING) {
       g_print (", %s%s%s", PROP_ATTR_VALUE_COLOR,
           _("changeable in NULL, READY, PAUSED or PLAYING state"), RESET_COLOR);