ges: Handle g_object_newv deprecation in latest GLib

This commit is contained in:
Thibault Saunier 2017-06-23 16:04:01 -04:00
parent cc703228fb
commit 88a5894fbd
2 changed files with 51 additions and 2 deletions

View file

@ -86,6 +86,8 @@
#include "ges.h" #include "ges.h"
#include "ges-internal.h" #include "ges-internal.h"
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst.h> #include <gst/gst.h>
GST_DEBUG_CATEGORY_STATIC (ges_asset_debug); GST_DEBUG_CATEGORY_STATIC (ges_asset_debug);
@ -288,15 +290,38 @@ ges_asset_extract_default (GESAsset * asset, GError ** error)
GESAssetPrivate *priv = asset->priv; GESAssetPrivate *priv = asset->priv;
GESExtractable *n_extractable; GESExtractable *n_extractable;
params = ges_extractable_type_get_parameters_from_id (priv->extractable_type, params = ges_extractable_type_get_parameters_from_id (priv->extractable_type,
priv->id, &n_params); priv->id, &n_params);
#if GLIB_CHECK_VERSION(2, 53, 1)
{
gint i;
GValue *values;
const gchar **names;
values = g_malloc0 (sizeof (GValue) * n_params);
names = g_malloc0 (sizeof (gchar **) * n_params);
for (i = 0; i < n_params; i++) {
values[i] = params[i].value;
names[i] = params[i].name;
}
n_extractable =
GES_EXTRACTABLE (g_object_new_with_properties (priv->extractable_type,
n_params, names, values));
g_free (names);
g_free (values);
}
#else
n_extractable = g_object_newv (priv->extractable_type, n_params, params); n_extractable = g_object_newv (priv->extractable_type, n_params, params);
#endif
while (n_params--) while (n_params--)
g_value_unset (&params[n_params].value); g_value_unset (&params[n_params].value);
if (params)
g_free (params); g_free (params);
return n_extractable; return n_extractable;
} }

View file

@ -1132,7 +1132,31 @@ ges_timeline_element_copy (GESTimelineElement * self, gboolean deep)
} }
} }
#if GLIB_CHECK_VERSION(2, 53, 1)
{
gint i;
GValue *values;
const gchar **names;
values = g_malloc0 (sizeof (GValue) * n_specs);
names = g_malloc0 (sizeof (gchar **) * n_specs);
for (i = 0; i < n_params; i++) {
values[i] = params[i].value;
names[i] = params[i].name;
}
ret =
GES_TIMELINE_ELEMENT (g_object_new_with_properties (G_OBJECT_TYPE
(self), n_params, names, values));
g_free (names);
g_free (values);
}
#else
ret = g_object_newv (G_OBJECT_TYPE (self), n_params, params); ret = g_object_newv (G_OBJECT_TYPE (self), n_params, params);
#endif
while (n_params--)
g_value_unset (&params[n_params].value);
g_free (specs); g_free (specs);
g_free (params); g_free (params);