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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/283>
This commit is contained in:
Seungha Yang 2019-09-11 13:51:04 +09:00 committed by GStreamer Merge Bot
parent 58859c8ee9
commit 1769187328
2 changed files with 17 additions and 1 deletions

View file

@ -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)
*

View 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);