mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavc/encode: map AVCodecContext.decoded_side_data to coded_side_data
This way it can be automagically propagated through the encoder to muxing.
This commit is contained in:
parent
a3f4670943
commit
e0de84ad2e
@ -782,6 +782,29 @@ int ff_encode_preinit(AVCodecContext *avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
for (int i = 0; ff_sd_global_map[i].packet < AV_PKT_DATA_NB; i++) {
|
||||
const enum AVPacketSideDataType type_packet = ff_sd_global_map[i].packet;
|
||||
const enum AVFrameSideDataType type_frame = ff_sd_global_map[i].frame;
|
||||
const AVFrameSideData *sd_frame;
|
||||
AVPacketSideData *sd_packet;
|
||||
|
||||
sd_frame = av_frame_side_data_get(avctx->decoded_side_data,
|
||||
avctx->nb_decoded_side_data,
|
||||
type_frame);
|
||||
if (!sd_frame ||
|
||||
av_packet_side_data_get(avctx->coded_side_data, avctx->nb_coded_side_data,
|
||||
type_packet))
|
||||
|
||||
continue;
|
||||
|
||||
sd_packet = av_packet_side_data_new(&avctx->coded_side_data, &avctx->nb_coded_side_data,
|
||||
type_packet, sd_frame->size, 0);
|
||||
if (!sd_packet)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
|
||||
}
|
||||
|
||||
if (CONFIG_FRAME_THREAD_ENCODER) {
|
||||
ret = ff_frame_thread_encoder_init(avctx);
|
||||
if (ret < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user