diff options
author | clsid2 <clsid2@users.sourceforge.net> | 2008-07-25 16:07:13 +0400 |
---|---|---|
committer | clsid2 <clsid2@users.sourceforge.net> | 2008-07-25 16:07:13 +0400 |
commit | 857e71a007ffd6ea0bcc4e85e89e6f8267439c93 (patch) | |
tree | 8c09a8e08155c76e633a5946d294a7432624548b /src/subtitles/STS.cpp | |
parent | 89c192cc8dcc275b1fe3716d360df5232bfa880c (diff) |
Some VSFilter changes:
- Added RealText support
- PAR correction option (for anamorphic video)
- Fix rare seeking issue with VobSubs
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@686 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/STS.cpp')
-rw-r--r-- | src/subtitles/STS.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp index 6f435a104..071124019 100644 --- a/src/subtitles/STS.cpp +++ b/src/subtitles/STS.cpp @@ -1,4 +1,4 @@ -/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -23,6 +23,9 @@ #include "STS.h"
#include <atlbase.h>
+#include "RealTextParser.h"
+#include <fstream>
+
// gathered from http://www.netwave.or.jp/~shikai/shikai/shcolor.htm
struct htmlcolor {TCHAR* name; DWORD color;} hmtlcolors[] =
@@ -1720,6 +1723,8 @@ static bool OpenMPL2(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet) typedef bool (*STSOpenFunct)(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet);
+static bool OpenRealText(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet);
+
typedef struct {STSOpenFunct open; tmode mode; exttype type; } OpenFunctStruct;
static OpenFunctStruct OpenFuncts[] =
@@ -1734,6 +1739,7 @@ static OpenFunctStruct OpenFuncts[] = OpenXombieSub, TIME, EXTXSS,
OpenUSF, TIME, EXTUSF,
OpenMPL2, TIME, EXTSRT,
+ OpenRealText, TIME, EXTRT,
};
static int nOpenFuncts = countof(OpenFuncts);
@@ -1749,6 +1755,8 @@ CSimpleTextSubtitle::CSimpleTextSubtitle() m_fScaledBAS = false;
m_encoding = CTextFile::ASCII;
m_lcid = 0;
+ m_ePARCompensationType = EPCTDisabled;
+ m_dPARCompensation = 1.0;
}
CSimpleTextSubtitle::~CSimpleTextSubtitle()
@@ -3031,4 +3039,38 @@ STSStyle& operator <<= (STSStyle& s, CString& style) return(s);
}
+static bool OpenRealText(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ wstring szFile;
+
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ szFile += CStringW(_T("\n")) + buff.GetBuffer();
+ }
+
+ CRealTextParser RealTextParser;
+ if (!RealTextParser.ParseRealText(szFile))
+ return false;
+
+ CRealTextParser::Subtitles crRealText = RealTextParser.GetParsedSubtitles();
+
+ for (map<pair<int, int>, wstring>::const_iterator i = crRealText.m_mapLines.begin();
+ i != crRealText.m_mapLines.end();
+ ++i)
+ {
+ ret.Add(
+ SubRipper2SSA(i->second.c_str(), CharSet),
+ file->IsUnicode(),
+ i->first.first,
+ i->first.second);
+ }
+
+// std::wofstream wofsOut(L"c:/zzz.srt");
+// RealTextParser.OutputSRT(wofsOut);
+ return(ret.GetCount() > 0);
+}
|