mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
parent
4a8c0be28a
commit
1cf4ccd05b
@ -859,6 +859,18 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsMatroskaFileFast(string fileName)
|
||||||
|
{
|
||||||
|
using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
|
{
|
||||||
|
var buffer = new byte[4];
|
||||||
|
fs.Read(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
|
// 1a 45 df a3
|
||||||
|
return buffer[0] == 0x1a && buffer[1] == 0x45 && buffer[2] == 0xdf && buffer[3] == 0xa3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a file is locked by attempting to open it with exclusive read access.
|
/// Checks if a file is locked by attempting to open it with exclusive read access.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2952,7 +2952,12 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ext == ".mkv" || ext == ".mks")
|
if (ext == ".mkv" || ext == ".mks" ||
|
||||||
|
|
||||||
|
// allow for mkv files with wrong extension
|
||||||
|
((ext == ".mp4" || ext == ".mov" || ext == ".m4v" || ext == ".wmv") && FileUtil.IsMatroskaFileFast(fileName) && FileUtil.IsMatroskaFile(fileName))
|
||||||
|
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ImportSubtitleFromMatroskaFile(fileName);
|
ImportSubtitleFromMatroskaFile(fileName);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user