FEI: libs: Add virtual method for secondary context creation.

Add a new vitrual method ensure_secondary_context to the
base encoder which is only required for the FEI entrypoint, that too
only when user configures the ENC+PAK mode. ENC+PAK mode is not something
supported directly by libva or driver, but this can be enabled
from the middleware.

Original Author of this idea: Leilei Shang <leilei.shang@intel.com>

Signed-off-by: Leilei Shang <leilei.shang@intel.com>
Signed-off-by: xiaominc <xiaomin.chen@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785712
https://bugzilla.gnome.org/show_bug.cgi?id=784667
This commit is contained in:
Sreerenj Balachandran 2017-08-09 14:10:16 -07:00 committed by Víctor Manuel Jáquez Leal
parent ac1de3d39a
commit 94483de40f
2 changed files with 15 additions and 0 deletions

View file

@ -843,6 +843,13 @@ gst_vaapi_encoder_reconfigure_internal (GstVaapiEncoder * encoder)
if (!gst_vaapi_encoder_ensure_context (encoder))
goto error_reset_context;
/* Currently only FEI entrypoint needed this.
* FEI ENC+PAK requires two contexts where the first one is for ENC
* and the second one is for PAK */
if (klass->ensure_secondary_context
&& !klass->ensure_secondary_context (encoder))
goto error_reset_secondary_context;
#if VA_CHECK_VERSION(0,36,0)
if (get_config_attribute (encoder, VAConfigAttribEncQualityRange,
&quality_level_max) && quality_level_max > 0) {
@ -879,6 +886,11 @@ error_reset_context:
GST_ERROR ("failed to update VA context");
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
}
error_reset_secondary_context:
{
GST_ERROR ("failed to create/update secondary VA context");
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
}
}
/**

View file

@ -357,6 +357,9 @@ struct _GstVaapiEncoderClass
/* get_codec_data can be NULL */
GstVaapiEncoderStatus (*get_codec_data) (GstVaapiEncoder * encoder,
GstBuffer ** codec_data);
/* To create a secondary context for a single base encoder */
gboolean (*ensure_secondary_context) (GstVaapiEncoder * encoder);
};
#define GST_VAAPI_ENCODER_CLASS_HOOK(codec, func) \