msdkdec: add postinit_decoder

The workaround for https://github.com/Intel-Media-SDK/MediaSDK/issues/1139
is required for vp8 only, so move this workaround to the corresponding
postinit_decoder function

The pipeline below works with this change

gst-launch-1.0 filesrc location=SA10104.vc1 ! \
'video/x-wmv,profile=(string)advanced',width=720,height=480,framerate=14/1 ! \
msdkvc1dec ! fakesink
This commit is contained in:
Haihao Xiang 2019-03-29 13:22:55 +08:00
parent 01051e7dfd
commit 8e4d7c3642
3 changed files with 26 additions and 6 deletions

View file

@ -338,12 +338,7 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
msdk_status_to_string (status)); msdk_status_to_string (status));
} }
/* Force the structure to MFX_PICSTRUCT_PROGRESSIVE if it is unknow to klass->postinit_decoder (thiz);
* work-around MSDK issue:
* https://github.com/Intel-Media-SDK/MediaSDK/issues/1139
*/
if (thiz->param.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_UNKNOWN)
thiz->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
status = MFXVideoDECODE_QueryIOSurf (session, &thiz->param, &request); status = MFXVideoDECODE_QueryIOSurf (session, &thiz->param, &request);
if (status < MFX_ERR_NONE) { if (status < MFX_ERR_NONE) {
@ -1472,6 +1467,13 @@ gst_msdkdec_preinit_decoder (GstMsdkDec * decoder)
return TRUE; return TRUE;
} }
static gboolean
gst_msdkdec_postinit_decoder (GstMsdkDec * decoder)
{
/* Do nothing */
return TRUE;
}
static void static void
gst_msdkdec_class_init (GstMsdkDecClass * klass) gst_msdkdec_class_init (GstMsdkDecClass * klass)
{ {
@ -1501,6 +1503,7 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_msdkdec_drain); decoder_class->drain = GST_DEBUG_FUNCPTR (gst_msdkdec_drain);
klass->preinit_decoder = GST_DEBUG_FUNCPTR (gst_msdkdec_preinit_decoder); klass->preinit_decoder = GST_DEBUG_FUNCPTR (gst_msdkdec_preinit_decoder);
klass->postinit_decoder = GST_DEBUG_FUNCPTR (gst_msdkdec_postinit_decoder);
g_object_class_install_property (gobject_class, GST_MSDKDEC_PROP_HARDWARE, g_object_class_install_property (gobject_class, GST_MSDKDEC_PROP_HARDWARE,
g_param_spec_boolean ("hardware", "Hardware", "Enable hardware decoders", g_param_spec_boolean ("hardware", "Hardware", "Enable hardware decoders",

View file

@ -110,6 +110,8 @@ struct _GstMsdkDecClass
/* reset mfx parameters per codec */ /* reset mfx parameters per codec */
gboolean (*preinit_decoder) (GstMsdkDec * decoder); gboolean (*preinit_decoder) (GstMsdkDec * decoder);
/* adjust mfx parameters per codec */
gboolean (*postinit_decoder) (GstMsdkDec * decoder);
}; };
struct _MsdkDecTask struct _MsdkDecTask

View file

@ -147,6 +147,19 @@ gst_msdkvp8dec_preinit_decoder (GstMsdkDec * decoder)
return TRUE; return TRUE;
} }
static gboolean
gst_msdkvp8dec_postinit_decoder (GstMsdkDec * decoder)
{
/* Force the structure to MFX_PICSTRUCT_PROGRESSIVE if it is unknow to
* work-around MSDK issue:
* https://github.com/Intel-Media-SDK/MediaSDK/issues/1139
*/
if (decoder->param.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_UNKNOWN)
decoder->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
return TRUE;
}
static void static void
gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass) gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
{ {
@ -164,6 +177,8 @@ gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkvp8dec_configure); decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkvp8dec_configure);
decoder_class->preinit_decoder = decoder_class->preinit_decoder =
GST_DEBUG_FUNCPTR (gst_msdkvp8dec_preinit_decoder); GST_DEBUG_FUNCPTR (gst_msdkvp8dec_preinit_decoder);
decoder_class->postinit_decoder =
GST_DEBUG_FUNCPTR (gst_msdkvp8dec_postinit_decoder);
gst_element_class_set_static_metadata (element_class, gst_element_class_set_static_metadata (element_class,
"Intel MSDK VP8 decoder", "Intel MSDK VP8 decoder",