mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 19:06:33 +00:00
encoding-profile: Add a way to copy an encoding profile
It is often usefull to make sure that you get a full copy of a profile. For example you want to let the user modify it in the user interface but still keep an unchanged version for later use. API: gst_encoding_profile_copy
This commit is contained in:
parent
b01f8891f4
commit
46b424a38b
3 changed files with 62 additions and 0 deletions
|
@ -2308,6 +2308,7 @@ gst_encoding_profile_is_equal
|
|||
gst_encoding_profile_is_enabled
|
||||
gst_encoding_profile_get_input_caps
|
||||
gst_encoding_profile_get_type_nick
|
||||
gst_encoding_profile_copy
|
||||
<SUBSECTION container>
|
||||
GstEncodingContainerProfile
|
||||
gst_encoding_container_profile_new
|
||||
|
|
|
@ -355,6 +355,8 @@ struct _GstEncodingProfile
|
|||
struct _GstEncodingProfileClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*copy) (GstEncodingProfile * self, GstEncodingProfile * copy);
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -815,12 +817,28 @@ gst_encoding_container_profile_finalize (GObject * object)
|
|||
((GObject *) prof);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_encoding_container_profile_copy (GstEncodingProfile * profile,
|
||||
GstEncodingProfile * copy_profile)
|
||||
{
|
||||
GstEncodingContainerProfile *self = GST_ENCODING_CONTAINER_PROFILE (profile),
|
||||
*copy = GST_ENCODING_CONTAINER_PROFILE (copy_profile);
|
||||
GList *tmp;
|
||||
|
||||
for (tmp = self->encodingprofiles; tmp; tmp = tmp->next) {
|
||||
gst_encoding_container_profile_add_profile (copy,
|
||||
gst_encoding_profile_copy (tmp->data));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_encoding_container_profile_class_init (GstEncodingContainerProfileClass * k)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) k;
|
||||
|
||||
gobject_class->finalize = gst_encoding_container_profile_finalize;
|
||||
|
||||
((GstEncodingProfileClass *) k)->copy = gst_encoding_container_profile_copy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -857,6 +875,17 @@ struct _GstEncodingVideoProfileClass
|
|||
G_DEFINE_TYPE (GstEncodingVideoProfile, gst_encoding_video_profile,
|
||||
GST_TYPE_ENCODING_PROFILE);
|
||||
|
||||
static void
|
||||
gst_encoding_video_profile_copy (GstEncodingProfile * profile,
|
||||
GstEncodingProfile * copy_profile)
|
||||
{
|
||||
GstEncodingVideoProfile *self = GST_ENCODING_VIDEO_PROFILE (profile),
|
||||
*copy = GST_ENCODING_VIDEO_PROFILE (copy_profile);
|
||||
|
||||
copy->pass = self->pass;
|
||||
copy->variableframerate = self->variableframerate;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_encoding_video_profile_init (GstEncodingVideoProfile * prof)
|
||||
{
|
||||
|
@ -866,6 +895,7 @@ gst_encoding_video_profile_init (GstEncodingVideoProfile * prof)
|
|||
static void
|
||||
gst_encoding_video_profile_class_init (GstEncodingVideoProfileClass * klass)
|
||||
{
|
||||
((GstEncodingProfileClass *) klass)->copy = gst_encoding_video_profile_copy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1903,3 +1933,33 @@ gst_encoding_profile_from_discoverer (GstDiscovererInfo * info)
|
|||
|
||||
return (GstEncodingProfile *) profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_encoding_profile_copy:
|
||||
* @self: The #GstEncodingProfile to copy
|
||||
*
|
||||
* Makes a deep copy of @self
|
||||
*
|
||||
* Returns: (transfer full): The copy of @self
|
||||
*
|
||||
* Since 1.12
|
||||
*/
|
||||
GstEncodingProfile *
|
||||
gst_encoding_profile_copy (GstEncodingProfile * self)
|
||||
{
|
||||
GstEncodingProfileClass *klass =
|
||||
(GstEncodingProfileClass *) G_OBJECT_GET_CLASS (self);
|
||||
GstEncodingProfile *copy =
|
||||
common_creation (G_OBJECT_TYPE (self), self->format, self->preset,
|
||||
self->name, self->description, self->restriction, self->presence);
|
||||
|
||||
copy->enabled = self->enabled;
|
||||
copy->allow_dynamic_output = self->allow_dynamic_output;
|
||||
gst_encoding_profile_set_preset_name (copy, self->preset_name);
|
||||
gst_encoding_profile_set_description (copy, self->description);
|
||||
|
||||
if (klass->copy)
|
||||
klass->copy (self, copy);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ void gst_encoding_video_profile_set_variableframerate (GstEncodingVideoProfi
|
|||
gboolean variableframerate);
|
||||
|
||||
GstEncodingProfile * gst_encoding_profile_from_discoverer (GstDiscovererInfo *info);
|
||||
GstEncodingProfile * gst_encoding_profile_copy (GstEncodingProfile *self);
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingAudioProfile, gst_object_unref)
|
||||
|
|
Loading…
Reference in a new issue