libs: encoder: add gst_vaapi_encoder_get_surface_formats()

This method will return the valid surface formats in the current
config. If the are no VAConfig it is created with the information
available.

https://bugzilla.gnome.org/show_bug.cgi?id=769266

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
This commit is contained in:
Hyunjun Ko 2016-12-07 11:26:37 +01:00 committed by Víctor Manuel Jáquez Leal
parent 72e26ed30b
commit 4e2049d108
2 changed files with 31 additions and 0 deletions

View file

@ -1153,6 +1153,35 @@ error:
}
}
static gboolean
gst_vaapi_encoder_ensure_context_config (GstVaapiEncoder * encoder)
{
GstVaapiContextInfo *const cip = &encoder->context_info;
if (encoder->context)
return TRUE;
init_context_info (encoder);
encoder->context = gst_vaapi_context_new (encoder->display, cip);
return (encoder->context != NULL);
}
/**
* gst_vaapi_encoder_get_surface_formats:
* @encoder: a #GstVaapiEncoder instances
*
* Fetches the valid surface formats for the current VAConfig
*
* Returns: a #GArray of valid formats for the current VAConfig
**/
GArray *
gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder)
{
if (!gst_vaapi_encoder_ensure_context_config (encoder))
return NULL;
return gst_vaapi_context_get_surface_formats (encoder->context);
}
/** Returns a GType for the #GstVaapiEncoderTune set */
GType
gst_vaapi_encoder_tune_get_type (void)

View file

@ -173,6 +173,8 @@ gst_vaapi_encoder_get_buffer_with_timeout (GstVaapiEncoder * encoder,
GstVaapiEncoderStatus
gst_vaapi_encoder_flush (GstVaapiEncoder * encoder);
GArray *
gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder);
G_END_DECLS
#endif /* GST_VAAPI_ENCODER_H */