changeset 2115:f4ad3d82ea64 libavformat

match uids indenpendantly of the version byte
author bcoudurier
date Sun, 03 Jun 2007 14:52:55 +0000
parents 52e2c6a4ccbc
children a56cef4f6091
files mxf.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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++;
     }