1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

lavfi/qsvvpp: copy metadata fields from src to dst

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
This commit is contained in:
Haihao Xiang
2023-06-12 16:14:44 +08:00
parent 07139b6deb
commit 5189b51939

View File

@@ -474,7 +474,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
} }
/* get the output surface */ /* get the output surface */
static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink) static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink, const AVFrame *in)
{ {
AVFilterContext *ctx = outlink->src; AVFilterContext *ctx = outlink->src;
QSVFrame *out_frame; QSVFrame *out_frame;
@@ -493,6 +493,12 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink)
if (!out_frame->frame) if (!out_frame->frame)
return NULL; return NULL;
ret = av_frame_copy_props(out_frame->frame, in);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to copy metadata fields from src to dst.\n");
return NULL;
}
ret = av_hwframe_get_buffer(outlink->hw_frames_ctx, out_frame->frame, 0); ret = av_hwframe_get_buffer(outlink->hw_frames_ctx, out_frame->frame, 0);
if (ret < 0) { if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Can't allocate a surface.\n"); av_log(ctx, AV_LOG_ERROR, "Can't allocate a surface.\n");
@@ -509,6 +515,12 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink)
if (!out_frame->frame) if (!out_frame->frame)
return NULL; return NULL;
ret = av_frame_copy_props(out_frame->frame, in);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to copy metadata fields from src to dst.\n");
return NULL;
}
ret = map_frame_to_surface(out_frame->frame, ret = map_frame_to_surface(out_frame->frame,
&out_frame->surface); &out_frame->surface);
if (ret < 0) if (ret < 0)
@@ -884,7 +896,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
} }
do { do {
out_frame = query_frame(s, outlink); out_frame = query_frame(s, outlink, in_frame->frame);
if (!out_frame) { if (!out_frame) {
av_log(ctx, AV_LOG_ERROR, "Failed to query an output frame.\n"); av_log(ctx, AV_LOG_ERROR, "Failed to query an output frame.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);