mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
validate: fix build with older GLib versions
g_enum_to_string() is only available in newer ones. Add compatibility workaround for the time being to decouple this from the decision whether to bump the GLib requirement and what to bump it to. https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/199 Fixes #45
This commit is contained in:
parent
7c255a9015
commit
d8d35241fe
1 changed files with 29 additions and 0 deletions
|
@ -187,6 +187,35 @@ typedef struct KeyFileGroupName
|
|||
|
||||
#define NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE 1
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,54,0)
|
||||
#define g_enum_to_string gst_validate_g_enum_to_string
|
||||
static gchar *
|
||||
gst_validate_g_enum_to_string (GType g_enum_type, gint value)
|
||||
{
|
||||
gchar *result;
|
||||
GEnumClass *enum_class;
|
||||
GEnumValue *enum_value;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_ENUM (g_enum_type), NULL);
|
||||
|
||||
enum_class = g_type_class_ref (g_enum_type);
|
||||
|
||||
/* Already warned */
|
||||
if (enum_class == NULL)
|
||||
return g_strdup_printf ("%d", value);
|
||||
|
||||
enum_value = g_enum_get_value (enum_class, value);
|
||||
|
||||
if (enum_value == NULL)
|
||||
result = g_strdup_printf ("%d", value);
|
||||
else
|
||||
result = g_strdup (enum_value->value_name);
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static GstValidateInterceptionReturn
|
||||
gst_validate_scenario_intercept_report (GstValidateReporter * reporter,
|
||||
GstValidateReport * report)
|
||||
|
|
Loading…
Reference in a new issue