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
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-04-06 12:49:24 +02:00
parent 9aa63e4595
commit 7153b4597d
3 changed files with 13 additions and 6 deletions

View file

@ -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);

View file

@ -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 */

View file

@ -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;