aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qsv.c
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2022-01-24 16:24:53 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-01-29 12:02:52 +0800
commit8dd507bf0daa826691ea5960ed5634233518c57c (patch)
tree232be29bb0228e6bf0c94c8078925fa219a73205 /libavcodec/qsv.c
parent80801e570566976195f515216de4403cdcf4f7a3 (diff)
downloadffmpeg-8dd507bf0daa826691ea5960ed5634233518c57c.tar.gz
lavc/qsv: allow to add more parameter buffers to QSV frame
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavcodec/qsv.c')
-rw-r--r--libavcodec/qsv.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 9d08485c92..1a432dbd82 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -828,3 +828,30 @@ int ff_qsv_close_internal_session(QSVSession *qs)
#endif
return 0;
}
+
+void ff_qsv_frame_add_ext_param (AVCodecContext *avctx, QSVFrame *frame,
+ mfxExtBuffer * param)
+{
+ int i;
+
+ for (i = 0; i < frame->num_ext_params; i++) {
+ mfxExtBuffer *ext_buffer = frame->ext_param[i];
+
+ if (ext_buffer->BufferId == param->BufferId) {
+ av_log(avctx, AV_LOG_WARNING, "A buffer with the same type has been "
+ "added\n");
+ return;
+ }
+ }
+
+ if (frame->num_ext_params < QSV_MAX_FRAME_EXT_PARAMS) {
+ frame->ext_param[frame->num_ext_params] = param;
+ frame->num_ext_params++;
+ frame->surface.Data.NumExtParam = frame->num_ext_params;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "Ignore this extra buffer because do not "
+ "have enough space\n");
+ }
+
+
+}