[Ffmpeg-devel] [PATCH] use macros to simplify MXF metadata read
Baptiste Coudurier
baptiste.coudurier
Sat Jan 13 21:55:06 CET 2007
Reimar D?ffinger wrote:
> Hello,
> attached patch uses macros to eliminate code duplication in MXF metadata
> read functions.
>
> Greetings,
> Reimar D?ffinger
>
>
> ------------------------------------------------------------------------
>
> Index: libavformat/mxf.c
> ===================================================================
> --- libavformat/mxf.c (revision 7448)
> +++ libavformat/mxf.c (working copy)
> @@ -359,26 +443,37 @@
> return 0;
> }
>
> +#define MXF_READ_LOCAL_TAGS_START(typename, ctype, name) \
> + ByteIOContext *pb = &mxf->fc->pb;\
> + ctype *name = av_mallocz(sizeof(*name));\
> + int bytes_read = 0;\
> +\
> + while (bytes_read < klv->length) {\
> + int tag = get_be16(pb);\
> + int size = get_be16(pb); /* KLV specified by 0x53 */\
> +\
> + dprintf("tag 0x%04X, size %d\n", tag, size);\
> + if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */\
> + av_log(mxf->fc, AV_LOG_ERROR, "local tag 0x%04X with 0 size\n", tag);\
> + continue;\
> + }\
need to move bytes_read += size + 4 before continue besides that patch
looks ok.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
More information about the ffmpeg-devel
mailing list