Mercurial > libavformat.hg
comparison matroskadec.c @ 6030:fd82ce3c4e65 libavformat
matroskadec: Allow unknown EBML doctype
author | conrad |
---|---|
date | Sat, 22 May 2010 01:41:35 +0000 |
parents | 7e9deb9f0234 |
children | 7b764d7a2938 |
comparison
equal
deleted
inserted
replaced
6029:7e9deb9f0234 | 6030:fd82ce3c4e65 |
---|---|
858 for (n = 4+size; n <= 4+size+total-probelen; n++) | 858 for (n = 4+size; n <= 4+size+total-probelen; n++) |
859 if (!memcmp(p->buf+n, matroska_doctypes[i], probelen)) | 859 if (!memcmp(p->buf+n, matroska_doctypes[i], probelen)) |
860 return AVPROBE_SCORE_MAX; | 860 return AVPROBE_SCORE_MAX; |
861 } | 861 } |
862 | 862 |
863 return 0; | 863 // probably valid EBML header but no recognized doctype |
864 return AVPROBE_SCORE_MAX/2; | |
864 } | 865 } |
865 | 866 |
866 static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska, | 867 static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska, |
867 int num) | 868 int num) |
868 { | 869 { |
1155 } | 1156 } |
1156 for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) | 1157 for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) |
1157 if (!strcmp(ebml.doctype, matroska_doctypes[i])) | 1158 if (!strcmp(ebml.doctype, matroska_doctypes[i])) |
1158 break; | 1159 break; |
1159 if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) { | 1160 if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) { |
1160 av_log(s, AV_LOG_ERROR, "Unknown EBML doctype '%s'\n", ebml.doctype); | 1161 av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype); |
1161 ebml_free(ebml_syntax, &ebml); | |
1162 return AVERROR_PATCHWELCOME; | |
1163 } | 1162 } |
1164 av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0); | 1163 av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0); |
1165 ebml_free(ebml_syntax, &ebml); | 1164 ebml_free(ebml_syntax, &ebml); |
1166 | 1165 |
1167 /* The next thing is a segment. */ | 1166 /* The next thing is a segment. */ |