diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2019-12-06 12:02:50 +0800 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-04-28 08:30:38 +0000 |
commit | b6eca795572d395a9f8bb83cc382c845020d120e (patch) | |
tree | 66c2c6bfae3c492200964c798dccd1dd9da8396c /sys | |
parent | 957034d71aaa075cec327effcaa0696897d02120 (diff) | |
download | gstreamer-plugins-bad-b6eca795572d395a9f8bb83cc382c845020d120e.tar.gz |
msdkdec: allow sub class to add extra parameters for additional configuration
MSDK allows user add extended buffers to a bitstream for additional
configuration. This commit is to support this feature in this plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/909>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/msdk/gstmsdkdec.c | 16 | ||||
-rw-r--r-- | sys/msdk/gstmsdkdec.h | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c index 595a6e952..da91f267f 100644 --- a/sys/msdk/gstmsdkdec.c +++ b/sys/msdk/gstmsdkdec.c @@ -83,6 +83,15 @@ static gboolean gst_msdkdec_drain (GstVideoDecoder * decoder); static gboolean gst_msdkdec_flush (GstVideoDecoder * decoder); static gboolean gst_msdkdec_negotiate (GstMsdkDec * thiz, gboolean hard_reset); +void +gst_msdkdec_add_bs_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param) +{ + if (thiz->num_bs_extra_params < MAX_BS_EXTRA_PARAMS) { + thiz->bs_extra_params[thiz->num_bs_extra_params] = param; + thiz->num_bs_extra_params++; + } +} + static GstVideoCodecFrame * gst_msdkdec_get_oldest_frame (GstVideoDecoder * decoder) { @@ -288,6 +297,7 @@ gst_msdkdec_close_decoder (GstMsdkDec * thiz, gboolean reset_param) if (reset_param) memset (&thiz->param, 0, sizeof (thiz->param)); + thiz->num_bs_extra_params = 0; thiz->initialized = FALSE; gst_adapter_clear (thiz->adapter); } @@ -1034,6 +1044,12 @@ gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) memset (&bitstream, 0, sizeof (bitstream)); + /* Add extended buffers */ + if (thiz->num_bs_extra_params) { + bitstream.NumExtParam = thiz->num_bs_extra_params; + bitstream.ExtParam = thiz->bs_extra_params; + } + if (gst_video_decoder_get_packetized (decoder)) { /* Packetized stream: we prefer to have a parser as a connected upstream * element to the decoder */ diff --git a/sys/msdk/gstmsdkdec.h b/sys/msdk/gstmsdkdec.h index efc5b5a37..7bde77dca 100644 --- a/sys/msdk/gstmsdkdec.h +++ b/sys/msdk/gstmsdkdec.h @@ -54,6 +54,8 @@ G_BEGIN_DECLS #define GST_IS_MSDKDEC_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKDEC)) +#define MAX_BS_EXTRA_PARAMS 8 + typedef struct _GstMsdkDec GstMsdkDec; typedef struct _GstMsdkDecClass GstMsdkDecClass; typedef struct _MsdkDecTask MsdkDecTask; @@ -98,6 +100,9 @@ struct _GstMsdkDec /* element properties */ gboolean hardware; guint async_depth; + + mfxExtBuffer *bs_extra_params[MAX_BS_EXTRA_PARAMS]; + guint num_bs_extra_params; }; struct _GstMsdkDecClass @@ -117,6 +122,9 @@ struct _GstMsdkDecClass GType gst_msdkdec_get_type (void); +void +gst_msdkdec_add_bs_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param); + G_END_DECLS #endif /* __GST_MSDKDEC_H__ */ |