diff options
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r-- | libavformat/mux.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index 5a1d6e41cb..c7877c5d98 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -279,6 +279,27 @@ FF_ENABLE_DEPRECATION_WARNINGS break; } +#if FF_API_AVSTREAM_SIDE_DATA +FF_DISABLE_DEPRECATION_WARNINGS + /* if the caller is using the deprecated AVStream side_data API, + * copy its contents to AVStream.codecpar, giving it priority + over existing side data in the latter */ + for (int i = 0; i < st->nb_side_data; i++) { + const AVPacketSideData *sd_src = &st->side_data[i]; + AVPacketSideData *sd_dst; + + sd_dst = av_packet_side_data_new(&st->codecpar->coded_side_data, + &st->codecpar->nb_coded_side_data, + sd_src->type, sd_src->size, 0); + if (!sd_dst) { + ret = AVERROR(ENOMEM); + goto fail; + } + memcpy(sd_dst->data, sd_src->data, sd_src->size); + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + desc = avcodec_descriptor_get(par->codec_id); if (desc && desc->props & AV_CODEC_PROP_REORDER) sti->reorder = 1; |