aboutsummaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer2007-07-27 11:36:17 +0000
committerMichael Niedermayer2007-07-27 11:36:17 +0000
commit41415d28560fa450eac44618f4d5f4b6251bf876 (patch)
tree5e32f372d595754b0e60f68542cb7136e68c23c8 /libavformat
parent60ff1c448153bb4fab3bb182dc5b68fbf0aaf9ed (diff)
try exact match before case insensitive match in codec_get_id
Originally committed as revision 9808 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c8243ef058..3d4c6cf86d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1671,13 +1671,17 @@ unsigned int codec_get_tag(const AVCodecTag *tags, int id)
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;
}