From: Víctor Manuel Jáquez Leal Date: Thu, 6 Apr 2017 10:49:24 +0000 (+0200) Subject: libs: encoder: pass profile to get_surface_formats() X-Git-Tag: 1.19.3~503^2~1058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7153b4597d24af67508b0f20c20f34c8a56b1675;p=platform%2Fupstream%2Fgstreamer.git libs: encoder: pass profile to get_surface_formats() In order to get the supported surface formats within a specific profile this patch adds the GstVaapiProfile as property to gst_vaapi_encoder_get_surface_formats(). Currently the extracted formats are only those related with the default profile of the element's codec. https://bugzilla.gnome.org/show_bug.cgi?id=771291 --- diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 3ecd2c4..cfbdfc8 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -1161,7 +1161,7 @@ error: } static GstVaapiContext * -create_test_context_config (GstVaapiEncoder * encoder) +create_test_context_config (GstVaapiEncoder * encoder, GstVaapiProfile profile) { GstVaapiContextInfo cip = { 0, }; GstVaapiContext *ctxt; @@ -1169,7 +1169,11 @@ create_test_context_config (GstVaapiEncoder * encoder) if (encoder->context) return gst_vaapi_object_ref (encoder->context); - init_context_info (encoder, &cip, get_profile (encoder)); + /* if there is no profile, let's figure out one */ + if (profile == GST_VAAPI_PROFILE_UNKNOWN) + profile = get_profile (encoder); + + init_context_info (encoder, &cip, profile); ctxt = gst_vaapi_context_new (encoder->display, &cip); return ctxt; } @@ -1183,12 +1187,13 @@ create_test_context_config (GstVaapiEncoder * encoder) * Returns: a #GArray of valid formats for the current VAConfig **/ GArray * -gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder) +gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder, + GstVaapiProfile profile) { GstVaapiContext *ctxt; GArray *formats; - ctxt = create_test_context_config (encoder); + ctxt = create_test_context_config (encoder, profile); if (!ctxt) return NULL; formats = gst_vaapi_context_get_surface_formats (ctxt); diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.h b/gst-libs/gst/vaapi/gstvaapiencoder.h index 3160036..1c7cd47 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.h +++ b/gst-libs/gst/vaapi/gstvaapiencoder.h @@ -174,7 +174,8 @@ GstVaapiEncoderStatus gst_vaapi_encoder_flush (GstVaapiEncoder * encoder); GArray * -gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder); +gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder, + GstVaapiProfile profile); G_END_DECLS #endif /* GST_VAAPI_ENCODER_H */ diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index cc460a4..ff7154d 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -362,7 +362,8 @@ ensure_allowed_sinkpad_caps (GstVaapiEncode * encode) if (!out_caps) goto failed_create_va_caps; - formats = gst_vaapi_encoder_get_surface_formats (encode->encoder); + formats = gst_vaapi_encoder_get_surface_formats (encode->encoder, + GST_VAAPI_PROFILE_UNKNOWN); if (!formats) goto failed_get_formats;