mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 15:02:35 +01:00
Try to allow one more subtitle type in mp4 - thx Erki :)
This commit is contained in:
parent
1cc25a43b1
commit
9166cb569b
@ -34,8 +34,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
return false;
|
||||
}
|
||||
|
||||
// ftypisml, ftypdash, ftyppiff, stypiso6 or ?
|
||||
var str = Encoding.ASCII.GetString(buffer, 4, 8);
|
||||
if (!str.StartsWith("ftyp", StringComparison.Ordinal)) // ftypisml, ftypdash, ftyppiff or ?
|
||||
if (!str.StartsWith("ftyp", StringComparison.Ordinal) && !str.StartsWith("styp", StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -106,11 +106,29 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var subtitles = new List<Subtitle>();
|
||||
for (int k = 0; k < _fileNamesToJoin.Count; k++)
|
||||
{
|
||||
string fileName = _fileNamesToJoin[k];
|
||||
var fileName = _fileNamesToJoin[k];
|
||||
try
|
||||
{
|
||||
var sub = new Subtitle();
|
||||
SubtitleFormat format;
|
||||
SubtitleFormat format = null;
|
||||
|
||||
if (fileName.EndsWith(".ismt", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
fileName.EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
fileName.EndsWith(".m4v", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
fileName.EndsWith(".3gp", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
format = new IsmtDfxp();
|
||||
if (format.IsMine(null, fileName))
|
||||
{
|
||||
var s = new Subtitle();
|
||||
format.LoadSubtitle(s, null, fileName);
|
||||
if (s.Paragraphs.Count > 0)
|
||||
{
|
||||
lastFormat = format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lines = FileUtil.ReadAllLinesShared(fileName, LanguageAutoDetect.GetEncodingFromFile(fileName));
|
||||
if (lastFormat != null && lastFormat.IsMine(lines, fileName))
|
||||
{
|
||||
@ -118,7 +136,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
format.LoadSubtitle(sub, lines, fileName);
|
||||
}
|
||||
|
||||
format = sub.LoadSubtitle(fileName, out _, null);
|
||||
if (sub.Paragraphs.Count == 0 || format == null)
|
||||
{
|
||||
format = sub.LoadSubtitle(fileName, out _, null);
|
||||
}
|
||||
|
||||
if (format == null)
|
||||
{
|
||||
|
@ -2557,7 +2557,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if ((ext == ".mp4" || ext == ".m4v" || ext == ".3gp") && file.Length > 10000)
|
||||
if ((ext == ".mp4" || ext == ".m4v" || ext == ".3gp") && file.Length > 2000)
|
||||
{
|
||||
if (!new IsmtDfxp().IsMine(null, fileName))
|
||||
{
|
||||
@ -2641,7 +2641,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (ext == ".ismt")
|
||||
if (ext == ".ismt" || ext == ".mp4" || ext == ".m4v" || ext == ".3gp")
|
||||
{
|
||||
var f = new IsmtDfxp();
|
||||
if (f.IsMine(null, fileName))
|
||||
|
Loading…
Reference in New Issue
Block a user