diff options
author | James Almer <jamrial@gmail.com> | 2023-07-16 17:57:26 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-10-06 10:03:57 -0300 |
commit | 5432d2aacad5fa7420fe2d9369ed061d521e92d6 (patch) | |
tree | 9c1bf0307108a16ed652261d590042e5944e288d /libavformat/mxfdec.c | |
parent | 21d7cc6fa9a26e94965fa71b25655d07568450fe (diff) | |
download | ffmpeg-5432d2aacad5fa7420fe2d9369ed061d521e92d6.tar.gz |
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>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r-- | libavformat/mxfdec.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 5fa2473e81..68939091e6 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2587,10 +2587,13 @@ static int parse_mca_labels(MXFContext *mxf, MXFTrack *source_track, MXFDescript if (service_type != AV_AUDIO_SERVICE_TYPE_NB && service_type != AV_AUDIO_SERVICE_TYPE_MAIN && !ambigous_service_type) { enum AVAudioServiceType *ast; - uint8_t* side_data = av_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); + AVPacketSideData *side_data = av_packet_side_data_new(&st->codecpar->coded_side_data, + &st->codecpar->nb_coded_side_data, + AV_PKT_DATA_AUDIO_SERVICE_TYPE, + sizeof(*ast), 0); if (!side_data) return AVERROR(ENOMEM); - ast = (enum AVAudioServiceType*)side_data; + ast = (enum AVAudioServiceType*)side_data->data; *ast = service_type; } @@ -2990,19 +2993,21 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->codecpar->color_trc = mxf_get_codec_ul(ff_mxf_color_trc_uls, &descriptor->color_trc_ul)->id; st->codecpar->color_space = mxf_get_codec_ul(ff_mxf_color_space_uls, &descriptor->color_space_ul)->id; if (descriptor->mastering) { - ret = av_stream_add_side_data(st, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, - (uint8_t *)descriptor->mastering, - sizeof(*descriptor->mastering)); - if (ret < 0) + if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data, + AV_PKT_DATA_MASTERING_DISPLAY_METADATA, + (uint8_t *)descriptor->mastering, sizeof(*descriptor->mastering), 0)) { + ret = AVERROR(ENOMEM); goto fail_and_free; + } descriptor->mastering = NULL; } if (descriptor->coll) { - ret = av_stream_add_side_data(st, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, - (uint8_t *)descriptor->coll, - descriptor->coll_size); - if (ret < 0) + if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data, + AV_PKT_DATA_CONTENT_LIGHT_LEVEL, + (uint8_t *)descriptor->coll, descriptor->coll_size, 0)) { + ret = AVERROR(ENOMEM); goto fail_and_free; + } descriptor->coll = NULL; } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { |