va: Add prediction direction attribute support for H265 encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2036>
This commit is contained in:
He Junyan 2022-04-06 17:06:20 +08:00
parent 4e7eddeafe
commit 9ee657cdee
2 changed files with 41 additions and 0 deletions

View file

@ -642,6 +642,44 @@ gst_va_encoder_get_max_num_reference (GstVaEncoder * self,
return TRUE; return TRUE;
} }
guint
gst_va_encoder_get_prediction_direction (GstVaEncoder * self,
VAProfile profile, VAEntrypoint entrypoint)
{
#if VA_CHECK_VERSION(1,9,0)
VAStatus status;
VADisplay dpy;
VAConfigAttrib attrib = {.type = VAConfigAttribPredictionDirection };
g_return_val_if_fail (GST_IS_VA_ENCODER (self), 0);
if (profile == VAProfileNone)
return 0;
if (entrypoint != self->entrypoint)
return 0;
dpy = gst_va_display_get_va_dpy (self->display);
status = vaGetConfigAttributes (dpy, profile, entrypoint, &attrib, 1);
if (status != VA_STATUS_SUCCESS) {
GST_WARNING_OBJECT (self, "Failed to query prediction direction: %s",
vaErrorStr (status));
return 0;
}
if (attrib.value == VA_ATTRIB_NOT_SUPPORTED) {
GST_WARNING_OBJECT (self, "Driver does not support query"
" prediction direction");
return 0;
}
return attrib.value & (VA_PREDICTION_DIRECTION_PREVIOUS |
VA_PREDICTION_DIRECTION_FUTURE | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY);
#else
return 0;
#endif
}
guint32 guint32
gst_va_encoder_get_rate_control_mode (GstVaEncoder * self, gst_va_encoder_get_rate_control_mode (GstVaEncoder * self,
VAProfile profile, VAEntrypoint entrypoint) VAProfile profile, VAEntrypoint entrypoint)

View file

@ -69,6 +69,9 @@ gboolean gst_va_encoder_get_max_num_reference (GstVaEncoder * self,
VAEntrypoint entrypoint, VAEntrypoint entrypoint,
guint32 * list0, guint32 * list0,
guint32 * list1); guint32 * list1);
guint gst_va_encoder_get_prediction_direction (GstVaEncoder * self,
VAProfile profile,
VAEntrypoint entrypoint);
guint32 gst_va_encoder_get_rate_control_mode (GstVaEncoder * self, guint32 gst_va_encoder_get_rate_control_mode (GstVaEncoder * self,
VAProfile profile, VAProfile profile,
VAEntrypoint entrypoint); VAEntrypoint entrypoint);