From 0e85826a05ce25fffe3907ebbe7cdacd09b4c0ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 17 May 2011 12:47:32 +0200 Subject: [PATCH] encoding-profile: Returns a new reference of caps everywhere instead of const caps --- gst-libs/gst/pbutils/encoding-profile.c | 23 ++++++++++++----------- gst-libs/gst/pbutils/encoding-profile.h | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gst-libs/gst/pbutils/encoding-profile.c b/gst-libs/gst/pbutils/encoding-profile.c index 894822e..710e5bc 100644 --- a/gst-libs/gst/pbutils/encoding-profile.c +++ b/gst-libs/gst/pbutils/encoding-profile.c @@ -248,12 +248,13 @@ gst_encoding_profile_get_description (GstEncodingProfile * profile) * * Since: 0.10.32 * - * Returns: the #GstCaps corresponding to the media format used in the profile. + * Returns: (transfer full): the #GstCaps corresponding to the media format used + * in the profile. Unref after usage. */ -const GstCaps * +GstCaps * gst_encoding_profile_get_format (GstEncodingProfile * profile) { - return profile->format; + return (profile->format ? gst_caps_ref (profile->format) : NULL); } /** @@ -291,17 +292,17 @@ gst_encoding_profile_get_presence (GstEncodingProfile * profile) * * Since: 0.10.32 * - * Returns: The restriction #GstCaps to apply before the encoder + * Returns: (transfer full): The restriction #GstCaps to apply before the encoder * that will be used in the profile. The fields present in restriction caps are * properties of the raw stream (that is before encoding), such as height and * width for video and depth and sampling rate for audio. Does not apply to * #GstEncodingContainerProfile (since there is no corresponding raw stream). - * Can be %NULL. + * Can be %NULL. Unref after usage. */ -const GstCaps * +GstCaps * gst_encoding_profile_get_restriction (GstEncodingProfile * profile) { - return profile->restriction; + return (profile->restriction ? gst_caps_ref (profile->restriction) : NULL); } /** @@ -816,8 +817,8 @@ gst_encoding_profile_is_equal (GstEncodingProfile * a, GstEncodingProfile * b) * * Since: 0.10.32 * - * Returns: The full caps the given @profile can consume. Call gst_caps_unref() - * when you are done with the caps. + * Returns: (transfer full): The full caps the given @profile can consume. Call + * gst_caps_unref() when you are done with the caps. */ GstCaps * gst_encoding_profile_get_input_caps (GstEncodingProfile * profile) @@ -827,7 +828,7 @@ gst_encoding_profile_get_input_caps (GstEncodingProfile * profile) GstStructure *st, *outst; GQuark out_name; guint i, len; - const GstCaps *fcaps; + GstCaps *fcaps; if (GST_IS_ENCODING_CONTAINER_PROFILE (profile)) { GstCaps *res = gst_caps_new_empty (); @@ -844,7 +845,7 @@ gst_encoding_profile_get_input_caps (GstEncodingProfile * profile) /* fast-path */ if ((profile->restriction == NULL) || gst_caps_is_any (profile->restriction)) - return gst_caps_copy (fcaps); + return gst_caps_ref (fcaps); /* Combine the format with the restriction caps */ outst = gst_caps_get_structure (fcaps, 0); diff --git a/gst-libs/gst/pbutils/encoding-profile.h b/gst-libs/gst/pbutils/encoding-profile.h index d019546..6645436 100644 --- a/gst-libs/gst/pbutils/encoding-profile.h +++ b/gst-libs/gst/pbutils/encoding-profile.h @@ -129,10 +129,10 @@ GType gst_encoding_audio_profile_get_type (void); const gchar * gst_encoding_profile_get_name(GstEncodingProfile *profile); const gchar * gst_encoding_profile_get_description(GstEncodingProfile *profile); -const GstCaps * gst_encoding_profile_get_format(GstEncodingProfile *profile); +GstCaps * gst_encoding_profile_get_format(GstEncodingProfile *profile); const gchar * gst_encoding_profile_get_preset(GstEncodingProfile *profile); guint gst_encoding_profile_get_presence(GstEncodingProfile *profile); -const GstCaps * gst_encoding_profile_get_restriction(GstEncodingProfile *profile); +GstCaps * gst_encoding_profile_get_restriction(GstEncodingProfile *profile); void gst_encoding_profile_set_name(GstEncodingProfile *profile, const gchar *name); void gst_encoding_profile_set_description(GstEncodingProfile *profile, const gchar *description); -- 2.7.4