diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2013-11-17 20:36:30 -0500 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-20 18:23:24 +0100 |
commit | 34b7c82dd3d75dae115310ccdc6c15f70304bcc1 (patch) | |
tree | 6bf8e07345fee7d92a1c50983ad52315c8ffd0cb /libavcodec/utils.c | |
parent | fcb1b0078d3810aa2d9270e1095c8b5835fc5667 (diff) | |
download | ffmpeg-34b7c82dd3d75dae115310ccdc6c15f70304bcc1.tar.gz |
avcodec/utils: use the unpack_dictionary function
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9c4c154c8a..0bb26661af 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2012,32 +2012,15 @@ fail: static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame) { - int size, ret = 0; + int size; const uint8_t *side_metadata; const uint8_t *end; + AVDictionary **frame_md = avpriv_frame_get_metadatap(frame); + side_metadata = av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_STRINGS_METADATA, &size); - if (!side_metadata) - goto end; - end = side_metadata + size; - if (size && end[-1]) - return AVERROR_INVALIDDATA; - while (side_metadata < end) { - const uint8_t *key = side_metadata; - const uint8_t *val = side_metadata + strlen(key) + 1; - int ret; - - if (val >= end) - return AVERROR_INVALIDDATA; - - ret = av_dict_set(avpriv_frame_get_metadatap(frame), key, val, 0); - if (ret < 0) - break; - side_metadata = val + strlen(val) + 1; - } -end: - return ret; + return av_packet_unpack_dictionary(side_metadata, size, frame_md); } int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, |