Commit 6c76e81c authored by He Junyan's avatar He Junyan

libs: encoder: Add a helper function to check the tile support.

Encoding by tiles separation now is a very common feature for all
relative new codecs, such as HEVC, AV1, and VP9. Just make this
check as a common helper function of the encoder base class.

Part-of: <!294>
parent 85bc3550
......@@ -1679,6 +1679,43 @@ gst_vaapi_encoder_ensure_max_num_ref_frames (GstVaapiEncoder * encoder,
return TRUE;
}
/**
* gst_vaapi_encoder_ensure_tile_support:
* @encoder: a #GstVaapiEncoder
* @profile: a #GstVaapiProfile
* @entrypoint: a #GstVaapiEntrypoint
*
* This function will query VAConfigAttribEncTileSupport to check
* whether the encoder support tile.
*
* We need to pass the @profile and the @entrypoint, because at the
* moment the encoder base class, still doesn't have them assigned,
* and this function is meant to be called by the derived classes
* while they are configured.
*
* Returns: %TRUE if supported, %FALSE if not.
**/
gboolean
gst_vaapi_encoder_ensure_tile_support (GstVaapiEncoder * encoder,
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint)
{
guint tile = 0;
#if VA_CHECK_VERSION(1,0,1)
VAProfile va_profile;
VAEntrypoint va_entrypoint;
va_profile = gst_vaapi_profile_get_va_profile (profile);
va_entrypoint = gst_vaapi_entrypoint_get_va_entrypoint (entrypoint);
if (!gst_vaapi_get_config_attribute (encoder->display, va_profile,
va_entrypoint, VAConfigAttribEncTileSupport, &tile))
return FALSE;
#endif
return tile > 0;
}
GstVaapiProfile
gst_vaapi_encoder_get_profile (GstVaapiEncoder * encoder)
{
......
......@@ -384,6 +384,11 @@ gboolean
gst_vaapi_encoder_ensure_max_num_ref_frames (GstVaapiEncoder * encoder,
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
G_GNUC_INTERNAL
gboolean
gst_vaapi_encoder_ensure_tile_support (GstVaapiEncoder * encoder,
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
G_END_DECLS
#endif /* GST_VAAPI_ENCODER_PRIV_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment