diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c index e116da6bfc..4729d62a3e 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c @@ -1216,6 +1216,40 @@ gst_msdkdec_error_report (GstMsdkDec * thiz) if (thiz->error_report.ErrorTypes & MFX_ERROR_FRAME_GAP) GST_ELEMENT_WARNING (thiz, STREAM, DECODE, ("[Error] Frame Gap Error detected!"), (NULL)); + +#ifdef ONEVPL_EXPERIMENTAL + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_APP0_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] APP0 unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_APP14_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] APP14 unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_DQT_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] DQT unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_SOF0_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] SOF0 unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_DHT_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] DHT unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_DRI_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] DRI unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_SOS_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] SOS unknown marker detected!"), (NULL)); + + if (thiz->error_report.ErrorTypes & MFX_ERROR_JPEG_UNKNOWN_MARKER) + GST_ELEMENT_WARNING (thiz, STREAM, DECODE, + ("[Error] Error unknown marker detected!"), (NULL)); +#endif } #endif } diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkmjpegdec.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkmjpegdec.c index 620c6b60c5..6d515167ff 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkmjpegdec.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkmjpegdec.c @@ -89,6 +89,16 @@ gst_msdkmjpegdec_configure (GstMsdkDec * decoder) of Interleaved samples, so let's hardcode it for now */ decoder->param.mfx.InterleavedDec = MFX_SCANTYPE_NONINTERLEAVED; +#if (MFX_VERSION >= 2006) + if (decoder->report_error) { + decoder->error_report.Header.BufferId = MFX_EXTBUFF_DECODE_ERROR_REPORT; + decoder->error_report.Header.BufferSz = sizeof (decoder->error_report); + decoder->error_report.ErrorTypes = 0; + gst_msdkdec_add_bs_extra_param (decoder, + (mfxExtBuffer *) & decoder->error_report); + } +#endif + return TRUE; } @@ -109,15 +119,75 @@ gst_msdkmjpegdec_post_configure (GstMsdkDec * decoder) return TRUE; } +static void +gst_msdkdec_mjpeg_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstMsdkMJPEGDec *thiz = GST_MSDKMJPEGDEC (object); +#if (MFX_VERSION >= 2006) + GstMsdkDec *dec = GST_MSDKDEC (object); +#endif + GstState state; + + GST_OBJECT_LOCK (thiz); + state = GST_STATE (thiz); + + if (!gst_msdkdec_prop_check_state (state, pspec)) { + GST_WARNING_OBJECT (thiz, "setting property in wrong state"); + GST_OBJECT_UNLOCK (thiz); + return; + } + switch (prop_id) { +#if (MFX_VERSION >= 2006) + case GST_MSDKDEC_PROP_ERROR_REPORT: + dec->report_error = g_value_get_boolean (value); + break; +#endif + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + GST_OBJECT_UNLOCK (thiz); + return; +} + +static void +gst_msdkdec_mjpeg_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstMsdkMJPEGDec *thiz = GST_MSDKMJPEGDEC (object); +#if (MFX_VERSION >= 2006) + GstMsdkDec *dec = GST_MSDKDEC (object); +#endif + + GST_OBJECT_LOCK (thiz); + switch (prop_id) { +#if (MFX_VERSION >= 2006) + case GST_MSDKDEC_PROP_ERROR_REPORT: + g_value_set_boolean (value, dec->report_error); + break; +#endif + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + GST_OBJECT_UNLOCK (thiz); +} + static void gst_msdkmjpegdec_class_init (GstMsdkMJPEGDecClass * klass) { + GObjectClass *gobject_class; GstElementClass *element_class; GstMsdkDecClass *decoder_class; + gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); decoder_class = GST_MSDKDEC_CLASS (klass); + gobject_class->set_property = gst_msdkdec_mjpeg_set_property; + gobject_class->get_property = gst_msdkdec_mjpeg_get_property; + decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkmjpegdec_configure); decoder_class->post_configure = GST_DEBUG_FUNCPTR (gst_msdkmjpegdec_post_configure); @@ -128,6 +198,10 @@ gst_msdkmjpegdec_class_init (GstMsdkMJPEGDecClass * klass) "MJPEG video decoder based on " MFX_API_SDK, "Scott D Phillips "); +#if (MFX_VERSION >= 2006) + gst_msdkdec_prop_install_error_report_property (gobject_class); +#endif + gst_element_class_add_static_pad_template (element_class, &sink_factory); gst_element_class_add_static_pad_template (element_class, &src_factory); } diff --git a/subprojects/gst-plugins-bad/sys/msdk/meson.build b/subprojects/gst-plugins-bad/sys/msdk/meson.build index 0e725fadbf..9e5150f07b 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/meson.build +++ b/subprojects/gst-plugins-bad/sys/msdk/meson.build @@ -28,6 +28,7 @@ have_msdk = false msdk_dep = [] use_msdk = false use_onevpl = false +onevpl_extra_args = [] msdk_option = get_option('msdk') if msdk_option.disabled() @@ -97,6 +98,7 @@ endif # Check oneVPL firstly if use_onevpl + onevpl_extra_args += ['-DONEVPL_EXPERIMENTAL'] mfx_incdir = join_paths([mfx_incdir, 'vpl']) mfx_inc = include_directories(mfx_incdir) elif cxx.has_header('mfx/mfxdefs.h', args: '-I' + mfx_incdir) @@ -186,7 +188,7 @@ if msdk_deps_found gstmsdktag = library('gstmsdk', msdk_sources, - c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], + c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'] + onevpl_extra_args, include_directories : [configinc, mfx_inc], dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, gstallocators_dep, gstcodecparsers_dep, mfx_dep, msdk_deps], install : true,