libs: encoder: Consider vp9 profiles based on input format.

Only support GST_VAAPI_PROFILE_VP9_0 and GST_VAAPI_PROFILE_VP9_2 now.

Fix: #184
This commit is contained in:
He Junyan 2019-07-18 22:01:01 +08:00 committed by Víctor Manuel Jáquez Leal
parent e48b0a90f1
commit 0afc813123

View file

@ -149,8 +149,20 @@ ensure_bitrate (GstVaapiEncoderVP9 * encoder)
static GstVaapiEncoderStatus
ensure_profile (GstVaapiEncoderVP9 * encoder)
{
/* Always start from "simple" profile for maximum compatibility */
encoder->profile = GST_VAAPI_PROFILE_VP9_0;
/*
Profile Color | Depth Chroma | Subsampling
0 | 8 bit/sample | 4:2:0
1 | 8 bit | 4:2:2, 4:4:4
2 | 10 or 12 bit | 4:2:0
3 | 10 or 12 bit | 4:2:2, 4:4:4 */
const GstVideoFormat format =
GST_VIDEO_INFO_FORMAT (GST_VAAPI_ENCODER_VIDEO_INFO (encoder));
if (format == GST_VIDEO_FORMAT_P010_10LE)
encoder->profile = GST_VAAPI_PROFILE_VP9_2;
else if (format == GST_VIDEO_FORMAT_NV12)
encoder->profile = GST_VAAPI_PROFILE_VP9_0;
else
return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
/* Ensure bitrate if not set already */
ensure_bitrate (encoder);