[FFmpeg-cvslog] r9808 - trunk/libavformat/utils.c

michael subversion
Fri Jul 27 13:36:17 CEST 2007


Author: michael
Date: Fri Jul 27 13:36:17 2007
New Revision: 9808

Log:
try exact match before case insensitive match in codec_get_id


Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Fri Jul 27 13:36:17 2007
@@ -1671,13 +1671,17 @@ unsigned int codec_get_tag(const AVCodec
 
 enum CodecID codec_get_id(const AVCodecTag *tags, unsigned int tag)
 {
-    while (tags->id != CODEC_ID_NONE) {
-        if(   toupper((tag >> 0)&0xFF) == toupper((tags->tag >> 0)&0xFF)
-           && toupper((tag >> 8)&0xFF) == toupper((tags->tag >> 8)&0xFF)
-           && toupper((tag >>16)&0xFF) == toupper((tags->tag >>16)&0xFF)
-           && toupper((tag >>24)&0xFF) == toupper((tags->tag >>24)&0xFF))
-            return tags->id;
-        tags++;
+    int i;
+    for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
+        if(tag == tags[i].tag)
+            return tags[i].id;
+    }
+    for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
+        if(   toupper((tag >> 0)&0xFF) == toupper((tags[i].tag >> 0)&0xFF)
+           && toupper((tag >> 8)&0xFF) == toupper((tags[i].tag >> 8)&0xFF)
+           && toupper((tag >>16)&0xFF) == toupper((tags[i].tag >>16)&0xFF)
+           && toupper((tag >>24)&0xFF) == toupper((tags[i].tag >>24)&0xFF))
+            return tags[i].id;
     }
     return CODEC_ID_NONE;
 }




More information about the ffmpeg-cvslog mailing list