From 6982462f50947e3ce71e734f3794f3140245e551 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Sun, 3 Jun 2007 14:52:55 +0000 Subject: match uids indenpendantly of the version byte Originally committed as revision 9184 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mxf.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 070054b9b3..5c361dcefc 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -637,10 +637,24 @@ static const MXFCodecUL mxf_sound_essence_container_uls[] = { { { 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 const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid) 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++; } -- cgit v1.2.3