mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
track-object: Add method to copy a TrackObject
API: ges_track_object_copy
This commit is contained in:
parent
7b0797c992
commit
efc28fd35e
2 changed files with 50 additions and 0 deletions
|
@ -22,8 +22,12 @@
|
||||||
#define __GES_INTERNAL_H__
|
#define __GES_INTERNAL_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include "ges-track-object.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
|
GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
|
||||||
#define GST_CAT_DEFAULT _ges_debug
|
#define GST_CAT_DEFAULT _ges_debug
|
||||||
|
|
||||||
|
GESTrackObject *
|
||||||
|
ges_track_object_copy (GESTrackObject * object, gboolean deep);
|
||||||
|
|
||||||
#endif /* __GES_INTERNAL_H__ */
|
#endif /* __GES_INTERNAL_H__ */
|
||||||
|
|
|
@ -1498,3 +1498,49 @@ ges_track_object_set_max_duration (GESTrackObject * object, guint64 maxduration)
|
||||||
|
|
||||||
object->priv->maxduration = maxduration;
|
object->priv->maxduration = maxduration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GESTrackObject *
|
||||||
|
ges_track_object_copy (GESTrackObject * object, gboolean deep)
|
||||||
|
{
|
||||||
|
GESTrackObject *ret = NULL;
|
||||||
|
GParameter *params;
|
||||||
|
GParamSpec **specs;
|
||||||
|
guint n, n_specs, n_params;
|
||||||
|
GValue val = { 0 };
|
||||||
|
|
||||||
|
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), NULL);
|
||||||
|
|
||||||
|
specs =
|
||||||
|
g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &n_specs);
|
||||||
|
params = g_new0 (GParameter, n_specs);
|
||||||
|
n_params = 0;
|
||||||
|
|
||||||
|
for (n = 0; n < n_specs; ++n) {
|
||||||
|
if (g_strcmp0 (specs[n]->name, "parent") &&
|
||||||
|
(specs[n]->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE) {
|
||||||
|
params[n_params].name = g_intern_string (specs[n]->name);
|
||||||
|
g_value_init (¶ms[n_params].value, specs[n]->value_type);
|
||||||
|
g_object_get_property (G_OBJECT (object), specs[n]->name,
|
||||||
|
¶ms[n_params].value);
|
||||||
|
++n_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = g_object_newv (G_TYPE_FROM_INSTANCE (object), n_params, params);
|
||||||
|
g_free (specs);
|
||||||
|
g_free (params);
|
||||||
|
|
||||||
|
if (deep == FALSE)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ensure_gnl_object (ret);
|
||||||
|
specs = ges_track_object_list_children_properties (object, &n_specs);
|
||||||
|
for (n = 0; n < n_specs; ++n) {
|
||||||
|
g_value_init (&val, specs[n]->value_type);
|
||||||
|
g_object_get_property (G_OBJECT (object), specs[n]->name, &val);
|
||||||
|
ges_track_object_set_child_property_by_pspec (ret, specs[n], &val);
|
||||||
|
g_value_unset (&val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue