From 000666ed43a9bed8e1c70ca8fbade11e7b260b0f Mon Sep 17 00:00:00 2001 From: Jonathan Matthew Date: Wed, 27 Jul 2016 22:19:49 +1000 Subject: [PATCH] media-types: add a helper for getting the encoder caps for a profile --- lib/rb-gst-media-types.c | 17 ++++++++++++++++- lib/rb-gst-media-types.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/rb-gst-media-types.c b/lib/rb-gst-media-types.c index 3e00554ce..36cec8d68 100644 --- a/lib/rb-gst-media-types.c +++ b/lib/rb-gst-media-types.c @@ -379,7 +379,6 @@ get_audio_encoder_factory (GstEncodingProfile *profile) if (fl != NULL) { f = gst_object_ref (fl->data); } else { - g_warning ("no encoder factory for profile %s", gst_encoding_profile_get_name (profile)); f = NULL; } gst_plugin_feature_list_free (l); @@ -488,6 +487,22 @@ rb_gst_encoding_profile_get_encoder (GstEncodingProfile *profile) return gst_element_factory_create (factory, NULL); } +/** + * rb_gst_encoding_profile_get_encoder_caps: + * @profile: a #GstEncodingProfile + * + * Return value: (transfer full): output caps for the encoder + */ +GstCaps * +rb_gst_encoding_profile_get_encoder_caps (GstEncodingProfile *profile) +{ + GstEncodingProfile *p = get_audio_encoding_profile (profile); + if (p != NULL) + return gst_encoding_profile_get_format (p); + + return NULL; +} + /** * rb_gst_encoding_profile_get_presets: * @profile: profile to return presets for diff --git a/lib/rb-gst-media-types.h b/lib/rb-gst-media-types.h index 56e438031..439b49a01 100644 --- a/lib/rb-gst-media-types.h +++ b/lib/rb-gst-media-types.h @@ -80,6 +80,7 @@ void rb_gst_encoding_profile_set_preset (GstEncodingProfile *profile, const cha gboolean rb_gst_encoder_set_encoding_style (GstElement *element, const char *style); GstElement * rb_gst_encoding_profile_get_encoder (GstEncodingProfile *profile); +GstCaps * rb_gst_encoding_profile_get_encoder_caps (GstEncodingProfile *profile); G_END_DECLS