1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

fftools/ffmpeg: propagate decoded_side_data from decoded streams to the filterchain

Global side data as exported by a decoder may no longer apply if a filter in
the chain altered the frames in some form, like changing color, dimensions,
or channel layout information.
After this change, any such changes in side data will be taken into account by
the encoder futher in the process.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2024-03-24 17:26:20 -03:00
parent 6707d970c0
commit e61b9d4094
3 changed files with 86 additions and 0 deletions

View File

@@ -788,6 +788,11 @@ static int packet_decode(DecoderPriv *dp, AVPacket *pkt, AVFrame *frame)
frame->time_base = dec->pkt_timebase;
ret = clone_side_data(&frame->side_data, &frame->nb_side_data,
dec->decoded_side_data, dec->nb_decoded_side_data, 0);
if (ret < 0)
return ret;
if (dec->codec_type == AVMEDIA_TYPE_AUDIO) {
dp->dec.samples_decoded += frame->nb_samples;
@@ -1638,6 +1643,11 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
param_out->color_range = dp->dec_ctx->color_range;
}
av_frame_side_data_free(&param_out->side_data, &param_out->nb_side_data);
ret = clone_side_data(&param_out->side_data, &param_out->nb_side_data,
dp->dec_ctx->decoded_side_data, dp->dec_ctx->nb_decoded_side_data, 0);
if (ret < 0)
return ret;
param_out->time_base = dp->dec_ctx->pkt_timebase;
}