diff --git a/girs/GstPbutils-1.0.gir b/girs/GstPbutils-1.0.gir index fbeb669fdc..3d9895e514 100644 --- a/girs/GstPbutils-1.0.gir +++ b/girs/GstPbutils-1.0.gir @@ -1733,6 +1733,23 @@ subtitles), are currently ignored. + + Converts a string in the "encoding profile serialization format" into a +GstEncodingProfile. Refer to the encoding-profile documentation for details +on the format. + + + A newly created GstEncodingProfile or NULL if the +input string is not a valid encoding profile serialization format. + + + + + The string to convert into a GstEncodingProfile. + + + + Makes a deep copy of @self @@ -2175,6 +2192,22 @@ single segment before the encoder, #FALSE otherwise. + + Converts a GstEncodingProfile to a string in the "Encoding Profile +serialization format". + + + A string representation of the GstEncodingProfile, + or NULL if the input is invalid. + + + + + The GstEncodingProfile to convert. + + + + A #GstStructure defining the properties to be set to the element the profile represents. diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c index 390f9e171b..e0283895d2 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c @@ -2068,8 +2068,21 @@ error: goto done; } -static GstEncodingProfile * -profile_from_string (const gchar * string) +/** + * gst_encoding_profile_from_string: + * @string: The string to convert into a GstEncodingProfile. + * + * Converts a string in the "encoding profile serialization format" into a + * GstEncodingProfile. Refer to the encoding-profile documentation for details + * on the format. + * + * Since: 1.26 + * + * Returns: (transfer full): A newly created GstEncodingProfile or NULL if the + * input string is not a valid encoding profile serialization format. + */ +GstEncodingProfile * +gst_encoding_profile_from_string (const gchar * string) { GstEncodingProfile *profile; gchar *filename_end; @@ -2117,7 +2130,7 @@ string_to_profile_transform (const GValue * src_value, GValue * dest_value) profilename = g_value_get_string (src_value); - profile = profile_from_string (profilename); + profile = gst_encoding_profile_from_string (profilename); if (profile) g_value_take_object (dest_value, (GObject *) profile); @@ -2156,23 +2169,45 @@ serialize_profile (GString * res, GstEncodingProfile * profile) } } -static gchar * -gst_encoding_profile_serialize_valfunc (GValue * value) +/** + * gst_encoding_profile_to_string: + * @profile: (transfer none): The GstEncodingProfile to convert. + * + * Converts a GstEncodingProfile to a string in the "Encoding Profile + * serialization format". + * + * Since: 1.26 + * + * Returns: (transfer full): A string representation of the GstEncodingProfile, + * or NULL if the input is invalid. + */ +gchar * +gst_encoding_profile_to_string (GstEncodingProfile * profile) { - GString *res = g_string_new (NULL); - GstEncodingProfile *profile = g_value_get_object (value); + GString *res; + + g_return_val_if_fail (profile != NULL, NULL); + + res = g_string_new (NULL); serialize_profile (res, profile); return g_string_free (res, FALSE); } +static gchar * +gst_encoding_profile_serialize_valfunc (GValue * value) +{ + GstEncodingProfile *profile = g_value_get_object (value); + return gst_encoding_profile_to_string (profile); +} + static gboolean gst_encoding_profile_deserialize_valfunc (GValue * value, const gchar * s) { GstEncodingProfile *profile; - profile = profile_from_string (s); + profile = gst_encoding_profile_from_string (s); if (profile) { g_value_take_object (value, (GObject *) profile); diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h index ad97d01f0b..966cc226f5 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h @@ -266,6 +266,12 @@ GstEncodingProfile * gst_encoding_profile_from_discoverer (GstDiscovererInfo *in GST_PBUTILS_API GstEncodingProfile * gst_encoding_profile_copy (GstEncodingProfile *self); +GST_PBUTILS_API +GstEncodingProfile * gst_encoding_profile_from_string (const gchar *string); + +GST_PBUTILS_API +gchar * gst_encoding_profile_to_string (GstEncodingProfile *profile); + GST_PBUTILS_API void gst_encoding_profile_set_element_properties (GstEncodingProfile *self, GstStructure *element_properties);