msdkdec: add post_configure virtual method

A post_configure virtual method is added to allow
codec subclasses to adjust the initialized parameters
after MFXVideoDECODE_DecodeHeader is called from the
gstmsdkdec::gst_msdkdec_handle_frame function.

This is useful if codecs want to adjust the output
parameters based on the codec-specific decoding
options that are present in the mfxInfoMFX structure
after MFXVideoDECODE_DecodeHeader initializes them.
This commit is contained in:
U. Artie Eoff 2019-06-21 18:12:48 -07:00 committed by Víctor Manuel Jáquez Leal
parent 6117a2c6bc
commit 70bfd34b41
2 changed files with 16 additions and 0 deletions

View file

@ -926,6 +926,11 @@ gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
goto done;
}
if (!klass->post_configure (thiz)) {
flow = GST_FLOW_ERROR;
goto error;
}
if (!thiz->initialized)
hard_reset = TRUE;
else if (thiz->allocation_caps) {
@ -1453,6 +1458,13 @@ gst_msdkdec_finalize (GObject * object)
g_object_unref (thiz->adapter);
}
static gboolean
gst_msdkdec_post_configure (GstMsdkDec * decoder)
{
/* Do nothing */
return TRUE;
}
static gboolean
gst_msdkdec_preinit_decoder (GstMsdkDec * decoder)
{
@ -1503,6 +1515,7 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
decoder_class->flush = GST_DEBUG_FUNCPTR (gst_msdkdec_flush);
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_msdkdec_drain);
klass->post_configure = GST_DEBUG_FUNCPTR (gst_msdkdec_post_configure);
klass->preinit_decoder = GST_DEBUG_FUNCPTR (gst_msdkdec_preinit_decoder);
klass->postinit_decoder = GST_DEBUG_FUNCPTR (gst_msdkdec_postinit_decoder);

View file

@ -108,6 +108,9 @@ struct _GstMsdkDecClass
gboolean (*configure) (GstMsdkDec * decoder);
/* adjust mfx parameters per codec after decode header */
gboolean (*post_configure) (GstMsdkDec * decoder);
/* reset mfx parameters per codec */
gboolean (*preinit_decoder) (GstMsdkDec * decoder);
/* adjust mfx parameters per codec */