From 17691873289f9281f464bb1136d10cfa3a23b10e Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 11 Sep 2019 13:51:04 +0900 Subject: [PATCH] paramspecs: Add a GParamSpecFlag to indicate the property might not always exists Add new flag for users to notice that the property is not guaranteed to exist depending on environment. Part-of: --- gst/gstparamspecs.h | 10 ++++++++++ tools/gst-inspect.c | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gst/gstparamspecs.h b/gst/gstparamspecs.h index 857cc0fcb4..f93a88db9c 100644 --- a/gst/gstparamspecs.h +++ b/gst/gstparamspecs.h @@ -69,6 +69,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) * diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 98e1d5e3b5..fdb8b0b1da 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -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);