Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslydiman <slydiman@mail.ru>2015-12-08 23:10:13 +0300
committerKacper Michajłow <kasper93@gmail.com>2015-12-22 23:13:52 +0300
commit04f914f92c894b43fdead49f7ce50c023826b43b (patch)
tree83ca65e8bba5dcfb275372f75bbf9a3a04d55448 /src/Subtitles
parent768298db1ad597c38f195922c874ed37b93c93d6 (diff)
Changed the Subtitles library timestamp to REFERENCE_TIME.
Resolves #157.
Diffstat (limited to 'src/Subtitles')
-rw-r--r--src/Subtitles/RTS.cpp18
-rw-r--r--src/Subtitles/STS.cpp95
-rw-r--r--src/Subtitles/STS.h24
-rw-r--r--src/Subtitles/SubtitleHelpers.h6
-rw-r--r--src/Subtitles/SubtitleInputPin.cpp10
5 files changed, 78 insertions, 75 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp
index ecce8ec72..4d125267a 100644
--- a/src/Subtitles/RTS.cpp
+++ b/src/Subtitles/RTS.cpp
@@ -2854,7 +2854,7 @@ STDMETHODIMP CRenderedTextSubtitle::NonDelegatingQueryInterface(REFIID riid, voi
STDMETHODIMP_(POSITION) CRenderedTextSubtitle::GetStartPosition(REFERENCE_TIME rt, double fps)
{
int iSegment = -1;
- SearchSubs((int)(rt / 10000), fps, &iSegment, nullptr);
+ SearchSubs(rt, fps, &iSegment, nullptr);
if (iSegment < 0) {
iSegment = 0;
@@ -2878,12 +2878,12 @@ STDMETHODIMP_(POSITION) CRenderedTextSubtitle::GetNext(POSITION pos)
STDMETHODIMP_(REFERENCE_TIME) CRenderedTextSubtitle::GetStart(POSITION pos, double fps)
{
- return (10000i64 * TranslateSegmentStart((int)pos - 1, fps));
+ return TranslateSegmentStart((int)pos - 1, fps);
}
STDMETHODIMP_(REFERENCE_TIME) CRenderedTextSubtitle::GetStop(POSITION pos, double fps)
{
- return (10000i64 * TranslateSegmentEnd((int)pos - 1, fps));
+ return TranslateSegmentEnd((int)pos - 1, fps);
}
STDMETHODIMP_(bool) CRenderedTextSubtitle::IsAnimated(POSITION pos)
@@ -2924,10 +2924,8 @@ STDMETHODIMP CRenderedTextSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, d
Init(CSize(spd.w, spd.h), spd.vidrect);
}
- int time = (int)(rt / 10000);
-
int segment;
- const STSSegment* stss = SearchSubs(time, fps, &segment);
+ const STSSegment* stss = SearchSubs(rt, fps, &segment);
if (!stss) {
return S_FALSE;
}
@@ -2941,7 +2939,7 @@ STDMETHODIMP CRenderedTextSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, d
m_subtitleCache.GetNextAssoc(pos, entry, pSub);
STSEntry& stse = GetAt(entry);
- if (stse.end < time) {
+ if (stse.end < rt) {
delete pSub;
m_subtitleCache.RemoveKey(entry);
}
@@ -2968,9 +2966,9 @@ STDMETHODIMP CRenderedTextSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, d
STSEntry stse = GetAt(entry);
{
- int start = TranslateStart(entry, fps);
- m_time = time - start;
- m_delay = TranslateEnd(entry, fps) - start;
+ REFERENCE_TIME start = TranslateStart(entry, fps);
+ m_time = (int)RT2MS(rt - start);
+ m_delay = (int)RT2MS(TranslateEnd(entry, fps) - start);
}
CSubtitle* s = GetSubtitle(entry);
diff --git a/src/Subtitles/STS.cpp b/src/Subtitles/STS.cpp
index 701a51535..80e0289ee 100644
--- a/src/Subtitles/STS.cpp
+++ b/src/Subtitles/STS.cpp
@@ -519,8 +519,8 @@ static bool OpenSubRipper(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet
ret.Add(SubRipper2SSA(str, CharSet),
file->IsUnicode(),
- (((hh1 * 60 + mm1) * 60) + ss1) * 1000 + ms1,
- (((hh2 * 60 + mm2) * 60) + ss2) * 1000 + ms2);
+ MS2RT((((hh1 * 60i64 + mm1) * 60i64) + ss1) * 1000i64 + ms1),
+ MS2RT((((hh2 * 60i64 + mm2) * 60i64) + ss2) * 1000i64 + ms2));
} else {
return false;
}
@@ -555,8 +555,8 @@ static bool OpenOldSubRipper(CTextFile* file, CSimpleTextSubtitle& ret, int Char
ret.Add(
buff.Mid(buff.Find('}', buff.Find('}') + 1) + 1),
file->IsUnicode(),
- (((hh1 * 60 + mm1) * 60) + ss1) * 1000,
- (((hh2 * 60 + mm2) * 60) + ss2) * 1000);
+ MS2RT((((hh1 * 60i64 + mm1) * 60i64) + ss1) * 1000i64),
+ MS2RT((((hh2 * 60i64 + mm2) * 60i64) + ss2) * 1000i64));
} else if (c != EOF) { // might be another format
return false;
}
@@ -665,8 +665,8 @@ static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet
ret.Add(str,
file->IsUnicode(),
- (((hh1 * 60 + mm1) * 60) + ss1) * 1000 + hs1 * 10,
- (((hh2 * 60 + mm2) * 60) + ss2) * 1000 + hs2 * 10);
+ MS2RT((((hh1 * 60i64 + mm1) * 60i64) + ss1) * 1000i64 + hs1 * 10i64),
+ MS2RT((((hh2 * 60i64 + mm2) * 60i64) + ss2) * 1000i64 + hs2 * 10i64));
} else if (c != EOF) { // might be another format
return false;
}
@@ -942,14 +942,14 @@ static bool OpenMicroDVD(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
if (c == 2) {
if (fCheck2 && ret.GetCount()) {
STSEntry& stse = ret[ret.GetCount() - 1];
- stse.end = std::min(stse.end, start);
+ stse.end = std::min(stse.end, MS2RT(start));
fCheck2 = false;
}
ret.Add(
MicroDVD2SSA(buff.Mid(buff.Find('}', buff.Find('}') + 1) + 1), file->IsUnicode(), CharSet),
file->IsUnicode(),
- start, end,
+ MS2RT(start), MS2RT(end),
style);
if (fCheck) {
@@ -1123,7 +1123,7 @@ static bool OpenSami(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
ret.Add(
SMI2SSA(caption, CharSet),
file->IsUnicode(),
- start_time, time);
+ MS2RT(start_time), MS2RT(time));
start_time = time;
caption.Empty();
@@ -1140,7 +1140,7 @@ static bool OpenSami(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
ret.Add(
SMI2SSA(caption, CharSet),
file->IsUnicode(),
- start_time, MAXLONG);
+ MS2RT(start_time), LONGLONG_MAX);
return true;
}
@@ -1168,8 +1168,8 @@ static bool OpenVPlayer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
CStringW str = buff.Mid(buff.Find(':', buff.Find(':', buff.Find(':') + 1) + 1) + 1);
ret.Add(str,
file->IsUnicode(),
- (((hh * 60 + mm) * 60) + ss) * 1000,
- (((hh * 60 + mm) * 60) + ss) * 1000 + 1000 + 50 * str.GetLength());
+ MS2RT((((hh * 60i64 + mm) * 60i64) + ss) * 1000i64),
+ MS2RT((((hh * 60i64 + mm) * 60i64) + ss) * 1000i64 + 1000i64 + 50i64 * str.GetLength()));
} else if (c != EOF) { // might be another format
return false;
}
@@ -1429,8 +1429,8 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C
ret.Add(pszBuff,
file->IsUnicode(),
- (((hh1 * 60 + mm1) * 60) + ss1) * 1000 + ms1_div10 * 10,
- (((hh2 * 60 + mm2) * 60) + ss2) * 1000 + ms2_div10 * 10,
+ MS2RT((((hh1 * 60i64 + mm1) * 60i64) + ss1) * 1000i64 + ms1_div10 * 10i64),
+ MS2RT((((hh2 * 60i64 + mm2) * 60i64) + ss2) * 1000i64 + ms2_div10 * 10i64),
style, actor, effect,
marginRect,
layer);
@@ -1715,8 +1715,8 @@ static bool OpenXombieSub(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet
ret.Add(pszBuff,
file->IsUnicode(),
- (((hh1 * 60 + mm1) * 60) + ss1) * 1000 + ms1,
- (((hh2 * 60 + mm2) * 60) + ss2) * 1000 + ms2,
+ MS2RT((((hh1 * 60i64 + mm1) * 60i64) + ss1) * 1000i64 + ms1),
+ MS2RT((((hh2 * 60i64 + mm2) * 60i64) + ss2) * 1000i64 + ms2),
style, actor, _T(""),
marginRect,
layer);
@@ -1775,7 +1775,8 @@ static bool OpenMPL2(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
ret.Add(
MPL22SSA(buff.Mid(buff.Find(']', buff.Find(']') + 1) + 1), file->IsUnicode(), CharSet),
file->IsUnicode(),
- start * 100, end * 100);
+ MS2RT(start * 100i64),
+ MS2RT(end * 100i64));
} else if (c != EOF) { // might be another format
return false;
}
@@ -1866,7 +1867,7 @@ void CSimpleTextSubtitle::Copy(CSimpleTextSubtitle& sts)
}
}
-void CSimpleTextSubtitle::Append(CSimpleTextSubtitle& sts, int timeoff)
+void CSimpleTextSubtitle::Append(CSimpleTextSubtitle& sts, REFERENCE_TIME timeoff)
{
if (timeoff < 0) {
timeoff = !IsEmpty() ? GetAt(GetCount() - 1).end : 0;
@@ -1938,12 +1939,12 @@ void CSimpleTextSubtitle::Empty()
RemoveAll();
}
-static bool SegmentCompStart(const STSSegment& segment, int start)
+static bool SegmentCompStart(const STSSegment& segment, REFERENCE_TIME start)
{
return (segment.start < start);
}
-void CSimpleTextSubtitle::Add(CStringW str, bool fUnicode, int start, int end, CString style, CString actor, CString effect, const CRect& marginRect, int layer, int readorder)
+void CSimpleTextSubtitle::Add(CStringW str, bool fUnicode, REFERENCE_TIME start, REFERENCE_TIME end, CString style, CString actor, CString effect, const CRect& marginRect, int layer, int readorder)
{
FastTrim(str);
if (str.IsEmpty() || start > end) {
@@ -2008,7 +2009,7 @@ void CSimpleTextSubtitle::Add(CStringW str, bool fUnicode, int start, int end, C
i++;
}
- int lastEnd = INT_MAX;
+ REFERENCE_TIME lastEnd = _I64_MAX;
for (; i < m_segments.GetCount() && m_segments[i].start < end; i++) {
STSSegment& s = m_segments[i];
@@ -2186,8 +2187,8 @@ void CSimpleTextSubtitle::ConvertToTimeBased(double fps)
for (size_t i = 0, j = GetCount(); i < j; i++) {
STSEntry& stse = (*this)[i];
- stse.start = (int)(stse.start * 1000.0 / fps + 0.5);
- stse.end = (int)(stse.end * 1000.0 / fps + 0.5);
+ stse.start = std::llround(stse.start * UNITS_FLOAT / fps);
+ stse.end = std::llround(stse.end * UNITS_FLOAT / fps);
}
m_mode = TIME;
@@ -2203,8 +2204,8 @@ void CSimpleTextSubtitle::ConvertToFrameBased(double fps)
for (size_t i = 0, j = GetCount(); i < j; i++) {
STSEntry& stse = (*this)[i];
- stse.start = (int)(stse.start * fps / 1000 + 0.5);
- stse.end = (int)(stse.end * fps / 1000 + 0.5);
+ stse.start = std::llround(stse.start * fps / UNITS);
+ stse.end = std::llround(stse.end * fps / UNITS);
}
m_mode = FRAME;
@@ -2212,7 +2213,7 @@ void CSimpleTextSubtitle::ConvertToFrameBased(double fps)
CreateSegments();
}
-int CSimpleTextSubtitle::SearchSub(int t, double fps)
+int CSimpleTextSubtitle::SearchSub(REFERENCE_TIME t, double fps)
{
int i = 0, j = (int)GetCount() - 1, ret = -1;
@@ -2223,7 +2224,7 @@ int CSimpleTextSubtitle::SearchSub(int t, double fps)
while (i < j) {
int mid = (i + j) >> 1;
- int midt = TranslateStart(mid, fps);
+ REFERENCE_TIME midt = TranslateStart(mid, fps);
if (t == midt) {
while (mid > 0 && t == TranslateStart(mid - 1, fps)) {
@@ -2249,7 +2250,7 @@ int CSimpleTextSubtitle::SearchSub(int t, double fps)
return ret;
}
-const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ int* iSegment, int* nSegments)
+const STSSegment* CSimpleTextSubtitle::SearchSubs(REFERENCE_TIME t, double fps, /*[out]*/ int* iSegment, int* nSegments)
{
int i = 0, j = (int)m_segments.GetCount() - 1, ret = -1;
@@ -2284,7 +2285,7 @@ const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ i
while (i < j) {
int mid = (i + j) >> 1;
- int midt = TranslateSegmentStart(mid, fps);
+ REFERENCE_TIME midt = TranslateSegmentStart(mid, fps);
if (t == midt) {
ret = mid;
@@ -2319,35 +2320,35 @@ const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ i
return nullptr;
}
-int CSimpleTextSubtitle::TranslateStart(int i, double fps)
+REFERENCE_TIME CSimpleTextSubtitle::TranslateStart(int i, double fps)
{
return (i < 0 || GetCount() <= (size_t)i ? -1 :
m_mode == TIME ? GetAt(i).start :
- m_mode == FRAME ? (int)(GetAt(i).start * 1000 / fps) :
+ m_mode == FRAME ? std::llround(GetAt(i).start * UNITS_FLOAT / fps) :
0);
}
-int CSimpleTextSubtitle::TranslateEnd(int i, double fps)
+REFERENCE_TIME CSimpleTextSubtitle::TranslateEnd(int i, double fps)
{
return (i < 0 || GetCount() <= (size_t)i ? -1 :
m_mode == TIME ? GetAt(i).end :
- m_mode == FRAME ? (int)(GetAt(i).end * 1000 / fps) :
+ m_mode == FRAME ? std::llround(GetAt(i).end * UNITS_FLOAT / fps) :
0);
}
-int CSimpleTextSubtitle::TranslateSegmentStart(int i, double fps)
+REFERENCE_TIME CSimpleTextSubtitle::TranslateSegmentStart(int i, double fps)
{
return (i < 0 || m_segments.GetCount() <= (size_t)i ? -1 :
m_mode == TIME ? m_segments[i].start :
- m_mode == FRAME ? (int)(m_segments[i].start * 1000 / fps) :
+ m_mode == FRAME ? std::llround(m_segments[i].start * UNITS_FLOAT / fps) :
0);
}
-int CSimpleTextSubtitle::TranslateSegmentEnd(int i, double fps)
+REFERENCE_TIME CSimpleTextSubtitle::TranslateSegmentEnd(int i, double fps)
{
return (i < 0 || m_segments.GetCount() <= (size_t)i ? -1 :
m_mode == TIME ? m_segments[i].end :
- m_mode == FRAME ? (int)(m_segments[i].end * 1000 / fps) :
+ m_mode == FRAME ? std::llround(m_segments[i].end * UNITS_FLOAT / fps) :
0);
}
@@ -2518,7 +2519,7 @@ void CSimpleTextSubtitle::SetStr(int i, CStringW str, bool fUnicode)
static int comp1(const void* a, const void* b)
{
- int ret = ((STSEntry*)a)->start - ((STSEntry*)b)->start;
+ int ret = SGN(((STSEntry*)a)->start - ((STSEntry*)b)->start);
if (ret == 0) {
ret = ((STSEntry*)a)->layer - ((STSEntry*)b)->layer;
}
@@ -2540,10 +2541,10 @@ void CSimpleTextSubtitle::Sort(bool fRestoreReadorder)
}
struct Breakpoint {
- int t;
+ REFERENCE_TIME t;
bool isStart;
- Breakpoint(int t, bool isStart) : t(t), isStart(isStart) {};
+ Breakpoint(REFERENCE_TIME t, bool isStart) : t(t), isStart(isStart) {};
};
static int BreakpointComp(const void* e1, const void* e2)
@@ -2551,7 +2552,7 @@ static int BreakpointComp(const void* e1, const void* e2)
const Breakpoint* bp1 = (const Breakpoint*)e1;
const Breakpoint* bp2 = (const Breakpoint*)e2;
- return (bp1->t - bp2->t);
+ return SGN(bp1->t - bp2->t);
}
void CSimpleTextSubtitle::CreateSegments()
@@ -2713,7 +2714,7 @@ bool CSimpleTextSubtitle::Open(BYTE* data, int len, int CharSet, CString name)
}
bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type,
- double fps /*= -1*/, int delay /*= 0*/,
+ double fps /*= -1*/, LONGLONG delay /*= 0*/,
CTextFile::enc e /*= CTextFile::DEFAULT_ENCODING*/, bool bCreateExternalStyleFile /*= true*/)
{
LPCTSTR ext = Subtitle::GetSubtitleFileExt(type);
@@ -2840,19 +2841,19 @@ bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type,
// Sort(true);
if (m_mode == FRAME) {
- delay = int(delay * fps / 1000);
+ delay = std::lround(delay * fps / 1000.0);
}
for (int i = 0, j = (int)GetCount(), k = 0; i < j; i++) {
STSEntry& stse = GetAt(i);
- int t1 = TranslateStart(i, fps) + delay;
+ int t1 = (int)(RT2MS(TranslateStart(i, fps)) + delay);
if (t1 < 0) {
k++;
continue;
}
- int t2 = TranslateEnd(i, fps) + delay;
+ int t2 = (int)(RT2MS(TranslateEnd(i, fps)) + delay);
int hh1 = (t1 / 60 / 60 / 1000);
int mm1 = (t1 / 60 / 1000) % 60;
@@ -3163,8 +3164,8 @@ static bool OpenRealText(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
ret.Add(
SubRipper2SSA(i->second.c_str(), CharSet),
file->IsUnicode(),
- i->first.first,
- i->first.second);
+ MS2RT(i->first.first),
+ MS2RT(i->first.second));
}
return !ret.IsEmpty();
diff --git a/src/Subtitles/STS.h b/src/Subtitles/STS.h
index b927b7052..b5fab63f0 100644
--- a/src/Subtitles/STS.h
+++ b/src/Subtitles/STS.h
@@ -93,20 +93,20 @@ struct STSEntry {
CString style, actor, effect;
CRect marginRect;
int layer;
- int start, end;
+ REFERENCE_TIME start, end;
int readorder;
};
class STSSegment
{
public:
- int start, end;
+ REFERENCE_TIME start, end;
CAtlArray<int> subs;
STSSegment()
: start(0)
, end(0) {}
- STSSegment(int s, int e) {
+ STSSegment(REFERENCE_TIME s, REFERENCE_TIME e) {
start = s;
end = e;
}
@@ -170,14 +170,14 @@ public:
void Sort(bool fRestoreReadorder = false);
void CreateSegments();
- void Append(CSimpleTextSubtitle& sts, int timeoff = -1);
+ void Append(CSimpleTextSubtitle& sts, REFERENCE_TIME timeoff = -1);
bool Open(CString fn, int CharSet, CString name = _T(""), CString videoName = _T(""));
bool Open(CTextFile* f, int CharSet, CString name);
bool Open(BYTE* data, int len, int CharSet, CString name);
- bool SaveAs(CString fn, Subtitle::SubType type, double fps = -1, int delay = 0, CTextFile::enc e = CTextFile::DEFAULT_ENCODING, bool bCreateExternalStyleFile = true);
+ bool SaveAs(CString fn, Subtitle::SubType type, double fps = -1, LONGLONG delay = 0, CTextFile::enc e = CTextFile::DEFAULT_ENCODING, bool bCreateExternalStyleFile = true);
- void Add(CStringW str, bool fUnicode, int start, int end, CString style = _T("Default"), CString actor = _T(""), CString effect = _T(""), const CRect& marginRect = CRect(0, 0, 0, 0), int layer = 0, int readorder = -1);
+ void Add(CStringW str, bool fUnicode, REFERENCE_TIME start, REFERENCE_TIME end, CString style = _T("Default"), CString actor = _T(""), CString effect = _T(""), const CRect& marginRect = CRect(0, 0, 0, 0), int layer = 0, int readorder = -1);
STSStyle* CreateDefaultStyle(int CharSet);
void ChangeUnknownStylesToDefault();
void AddStyle(CString name, STSStyle* style); // style will be stored and freed in Empty() later
@@ -189,13 +189,13 @@ public:
void ConvertToTimeBased(double fps);
void ConvertToFrameBased(double fps);
- int TranslateStart(int i, double fps);
- int TranslateEnd(int i, double fps);
- int SearchSub(int t, double fps);
+ REFERENCE_TIME TranslateStart(int i, double fps);
+ REFERENCE_TIME TranslateEnd(int i, double fps);
+ int SearchSub(REFERENCE_TIME t, double fps);
- int TranslateSegmentStart(int i, double fps);
- int TranslateSegmentEnd(int i, double fps);
- const STSSegment* SearchSubs(int t, double fps, /*[out]*/ int* iSegment = nullptr, int* nSegments = nullptr);
+ REFERENCE_TIME TranslateSegmentStart(int i, double fps);
+ REFERENCE_TIME TranslateSegmentEnd(int i, double fps);
+ const STSSegment* SearchSubs(REFERENCE_TIME t, double fps, /*[out]*/ int* iSegment = nullptr, int* nSegments = nullptr);
const STSSegment* GetSegment(int iSegment) {
return iSegment >= 0 && iSegment < (int)m_segments.GetCount() ? &m_segments[iSegment] : nullptr;
}
diff --git a/src/Subtitles/SubtitleHelpers.h b/src/Subtitles/SubtitleHelpers.h
index d004cae67..cf691e5fb 100644
--- a/src/Subtitles/SubtitleHelpers.h
+++ b/src/Subtitles/SubtitleHelpers.h
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2015 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -24,6 +24,10 @@
#include <afx.h>
#include <atlcoll.h>
+#define MS2RT(t) (10000i64 * (t))
+#define RT2MS(t) ((t) / 10000)
+#define UNITS_FLOAT (10000000.0)
+
namespace Subtitle
{
enum SubType {
diff --git a/src/Subtitles/SubtitleInputPin.cpp b/src/Subtitles/SubtitleInputPin.cpp
index a7cf216ec..0d4272cc7 100644
--- a/src/Subtitles/SubtitleInputPin.cpp
+++ b/src/Subtitles/SubtitleInputPin.cpp
@@ -379,12 +379,12 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam
if (tag == __GAB1_LANGUAGE__) {
pRTS->m_name = CString(ptr);
} else if (tag == __GAB1_ENTRY__) {
- pRTS->Add(AToW(&ptr[8]), false, *(int*)ptr, *(int*)(ptr + 4));
+ pRTS->Add(AToW(&ptr[8]), false, MS2RT(*(int*)ptr), MS2RT(*(int*)(ptr + 4)));
bInvalidate = true;
} else if (tag == __GAB1_LANGUAGE_UNICODE__) {
pRTS->m_name = (WCHAR*)ptr;
} else if (tag == __GAB1_ENTRY_UNICODE__) {
- pRTS->Add((WCHAR*)(ptr + 8), true, *(int*)ptr, *(int*)(ptr + 4));
+ pRTS->Add((WCHAR*)(ptr + 8), true, MS2RT(*(int*)ptr), MS2RT(*(int*)(ptr + 4)));
bInvalidate = true;
}
@@ -416,7 +416,7 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam
str.Trim();
if (!str.IsEmpty()) {
- pRTS->Add(AToW(str), false, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000));
+ pRTS->Add(AToW(str), false, pSample->rtStart, pSample->rtStop);
bInvalidate = true;
}
}
@@ -426,7 +426,7 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam
CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())).Trim();
if (!str.IsEmpty()) {
- pRTS->Add(str, true, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000));
+ pRTS->Add(str, true, pSample->rtStart, pSample->rtStop);
bInvalidate = true;
}
} else if (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2) {
@@ -456,7 +456,7 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam
}
if (!stse.str.IsEmpty()) {
- pRTS->Add(stse.str, true, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000),
+ pRTS->Add(stse.str, true, pSample->rtStart, pSample->rtStop,
stse.style, stse.actor, stse.effect, stse.marginRect, stse.layer, stse.readorder);
bInvalidate = true;
}