Detect EBML magic number to skip encoding detection for MKV
MKV loads slow after f733297499
This commit is contained in:
parent
d7139c40c0
commit
bb5090ac3a
1 changed files with 9 additions and 0 deletions
|
@ -34,6 +34,15 @@ std::string Detect(agi::fs::path const& file) {
|
|||
if (fp.size() > 100 * 1024 * 1024)
|
||||
return "binary";
|
||||
|
||||
|
||||
// FIXME: Dirty hack for Matroska. These 4 bytes are the magic
|
||||
// number of EBML which is used by mkv and webm
|
||||
if (fp.size() >= 4) {
|
||||
const char* buf = fp.read(0, 4);
|
||||
if (!strncmp(buf, "\x1a\x45\xdf\xa3", 4))
|
||||
return "binary";
|
||||
}
|
||||
|
||||
uint64_t binaryish = 0;
|
||||
|
||||
#ifdef WITH_UCHARDET
|
||||
|
|
Loading…
Reference in a new issue