diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-06-03 14:52:55 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-06-03 14:52:55 +0000 |
commit | 6982462f50947e3ce71e734f3794f3140245e551 (patch) | |
tree | c611ecadc5a7af90621ef788f30d1a0d67df8001 /libavformat/mxf.c | |
parent | 3c6b46d3a56f3f583c3d01d861aa0f5b5237008d (diff) | |
download | ffmpeg-streaming-6982462f50947e3ce71e734f3794f3140245e551.zip ffmpeg-streaming-6982462f50947e3ce71e734f3794f3140245e551.tar.gz |
match uids indenpendantly of the version byte
Originally committed as revision 9184 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mxf.c')
-rw-r--r-- | libavformat/mxf.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 070054b..5c361dc 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++; } |