avformat/avformat: use the side data from AVStream.codecpar

Deprecate AVStream.side_data and its helpers in favor of the AVStream's
codecpar.coded_side_data.

This will considerably simplify the propagation of global side data to decoders
and from encoders. Instead of having to do it inside packets, it will be
available during init().
Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2023-07-16 17:57:26 -03:00
parent 21d7cc6fa9
commit 5432d2aaca
27 changed files with 339 additions and 253 deletions

View File

@@ -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;