# HG changeset patch # User bcoudurier # Date 1180882375 0 # Node ID f4ad3d82ea64035ffc0df08acc81c1d42556d3ca # Parent 52e2c6a4ccbc542b0673ad459d8867a665e7f50f match uids indenpendantly of the version byte diff -r 52e2c6a4ccbc -r f4ad3d82ea64 mxf.c --- a/mxf.c Sun Jun 03 14:33:57 2007 +0000 +++ b/mxf.c Sun Jun 03 14:52:55 2007 +0000 @@ -637,10 +637,24 @@ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, CODEC_ID_NONE, Frame }, }; +/* + * Match an uid independently of the version byte and up to len common bytes + * Returns: boolean + */ +static int mxf_match_uid(const UID key, const UID uid, int len) +{ + int i; + for (i = 0; i < len; i++) { + if (i != 7 && key[i] != uid[i]) + return 0; + } + return 1; +} + static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) { while (uls->id != CODEC_ID_NONE) { - if(!memcmp(uls->uid, *uid, 16)) + if(mxf_match_uid(uls->uid, *uid, 16)) break; uls++; } @@ -650,7 +664,7 @@ static enum CodecType mxf_get_codec_type(const MXFDataDefinitionUL *uls, UID *uid) { while (uls->type != CODEC_TYPE_DATA) { - if(!memcmp(uls->uid, *uid, 16)) + if(mxf_match_uid(uls->uid, *uid, 16)) break; uls++; }