diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-03-22 20:30:53 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-03-28 08:40:01 +0100 |
commit | a3f4670943dfe4455da94901bf57226bab72bde1 (patch) | |
tree | fb2215a486e0ed64d8f2ed6ad1635240feae9d60 /libavcodec/decode.c | |
parent | e1f384adbf6b55523ec6f4d8592f41dee31aec1d (diff) | |
download | ffmpeg-a3f4670943dfe4455da94901bf57226bab72bde1.tar.gz |
lavc/decode: move sd_global_map to avcodec
It will be shared with encoding code.
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 34bcb7cc64..ddb73b6934 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1376,21 +1376,6 @@ static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame) return av_packet_unpack_dictionary(side_metadata, size, frame_md); } -static const struct { - enum AVPacketSideDataType packet; - enum AVFrameSideDataType frame; -} sd_global_map[] = { - { AV_PKT_DATA_REPLAYGAIN , AV_FRAME_DATA_REPLAYGAIN }, - { AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX }, - { AV_PKT_DATA_SPHERICAL, AV_FRAME_DATA_SPHERICAL }, - { AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D }, - { AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, - { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, - { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, - { AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE }, - { AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT }, -}; - int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt) { @@ -1414,13 +1399,13 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - for (int i = 0; i < FF_ARRAY_ELEMS(sd_global_map); i++) { + for (int i = 0; ff_sd_global_map[i].packet < AV_PKT_DATA_NB; i++) { size_t size; - const uint8_t *packet_sd = av_packet_get_side_data(pkt, sd_global_map[i].packet, &size); + const uint8_t *packet_sd = av_packet_get_side_data(pkt, ff_sd_global_map[i].packet, &size); if (packet_sd) { AVFrameSideData *frame_sd; - frame_sd = av_frame_new_side_data(frame, sd_global_map[i].frame, size); + frame_sd = av_frame_new_side_data(frame, ff_sd_global_map[i].frame, size); if (!frame_sd) return AVERROR(ENOMEM); memcpy(frame_sd->data, packet_sd, size); @@ -1461,12 +1446,12 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) { int ret; - for (int i = 0; i < FF_ARRAY_ELEMS(sd_global_map); i++) { + for (int i = 0; ff_sd_global_map[i].packet < AV_PKT_DATA_NB; i++) { const AVPacketSideData *packet_sd = ff_get_coded_side_data(avctx, - sd_global_map[i].packet); + ff_sd_global_map[i].packet); if (packet_sd) { AVFrameSideData *frame_sd = av_frame_new_side_data(frame, - sd_global_map[i].frame, + ff_sd_global_map[i].frame, packet_sd->size); if (!frame_sd) return AVERROR(ENOMEM); @@ -1758,9 +1743,9 @@ int ff_decode_preinit(AVCodecContext *avctx) return AVERROR(EINVAL); } - for (unsigned j = 0; j < FF_ARRAY_ELEMS(sd_global_map); j++) { - if (sd_global_map[j].packet == val) { - val = sd_global_map[j].frame; + for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) { + if (ff_sd_global_map[j].packet == val) { + val = ff_sd_global_map[j].frame; // this code will need to be changed when we have more than // 64 frame side data types |