[Ffmpeg-devel] [PATCH] use macros to simplify MXF metadata read
Michael Niedermayer
michaelni
Sun Jan 14 05:41:02 CET 2007
Hi
On Sat, Jan 13, 2007 at 09:39:43PM +0100, Reimar D?ffinger wrote:
> Hello,
> attached patch uses macros to eliminate code duplication in MXF metadata
> read functions.
it eliminates the duplication at source code level but not at object level
may i rather suggest:
typedef struct MXFChunk {
UID uid;
enum MXFMetadataSetType type;
}
static int mxf_read_local_tag(MXFContext *mxf, KLVPacket *klv, int ctx_size, read_child, MXFMetadataSetType type){
ByteIOContext *pb = &mxf->fc->pb;
MXFChunk *ctx = av_mallocz(ctx_size);
uint64_t klv_end= url_ftell(pb) + klv->length;
while (url_ftell(pb) + 4 < klv_end) {
int tag = get_be16(pb);
int size = get_be16(pb); /* KLV specified by 0x53 */
uint64_t next= url_ftell(pb) + 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;
}
if(tag == 0x3C0A)
get_buffer(pb, ctx->uid, 16);
else
read_child(ctx, pb, tag);
url_fseek(pb, next, SEEK_SET);
}
ctx->type = type;
return mxf_add_metadata_set(mxf, ctx);
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070114/cfe4889e/attachment.pgp>
More information about the ffmpeg-devel
mailing list