Require [Script Info] line as first thing in SSA/ASS files. (Probably. This might make VSFilter fail on invalid scripts, oh no!)

Originally committed to SVN as r1406.
This commit is contained in:
Niels Martin Hansen 2007-07-10 21:31:06 +00:00
parent 80fa4bc3a2
commit fae778e45b

View file

@ -1303,6 +1303,7 @@ static bool LoadUUEFont(CTextFile* file)
static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet) static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
{ {
bool fRet = false; bool fRet = false;
bool firstLine = true;
int version = 3, sver = 3; int version = 3, sver = 3;
@ -1323,6 +1324,8 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C
if(entry == L"[script info]") if(entry == L"[script info]")
{ {
// [script info] must be the first line
if (!firstLine) return false;
fRet = true; fRet = true;
} }
else if(entry == L"playresx") else if(entry == L"playresx")
@ -1499,6 +1502,8 @@ if(version >= 6)marginRect.bottom = GetInt(buff);
{ {
LoadUUEFont(file); LoadUUEFont(file);
} }
firstLine = false;
} }
return(fRet); return(fRet);