diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
commit | 7359bd509afa235acc2ac2f7f95fc9cb5cafd1a4 (patch) | |
tree | b5bb90eeca58fdeb9fde6825f21a25a319823cb4 /src/filters/parser/SSFSplitter | |
parent | d30b15ed4b98c28951d6d45b8928f4c2b6a11129 (diff) |
apply astyle formatting
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2786 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/SSFSplitter')
-rw-r--r-- | src/filters/parser/SSFSplitter/SSFSplitter.cpp | 110 | ||||
-rw-r--r-- | src/filters/parser/SSFSplitter/SSFSplitter.h | 13 | ||||
-rw-r--r-- | src/filters/parser/SSFSplitter/stdafx.cpp | 6 | ||||
-rw-r--r-- | src/filters/parser/SSFSplitter/stdafx.h | 6 |
4 files changed, 69 insertions, 66 deletions
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.cpp b/src/filters/parser/SSFSplitter/SSFSplitter.cpp index 917e35cc0..e581a8a62 100644 --- a/src/filters/parser/SSFSplitter/SSFSplitter.cpp +++ b/src/filters/parser/SSFSplitter/SSFSplitter.cpp @@ -1,4 +1,4 @@ -/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -26,26 +26,22 @@ #ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] = {
{&MEDIATYPE_Stream, &MEDIASUBTYPE_SSF},
{&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
-const AMOVIESETUP_PIN sudpPins[] =
-{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+const AMOVIESETUP_PIN sudpPins[] = {
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CSSFSplitterFilter), L"MPC - SSF Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
{&__uuidof(CSSFSourceFilter), L"MPC - SSF Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSSFSplitterFilter>, NULL, &sudFilter[0]},
{sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSSFSourceFilter>, NULL, &sudFilter[1]},
};
@@ -79,16 +75,18 @@ namespace ssf CBaseSplitterFile* m_pFile;
public:
- InputStreamBSF(CBaseSplitterFile* pFile)
- : m_pFile(pFile)
- {
+ InputStreamBSF(CBaseSplitterFile* pFile)
+ : m_pFile(pFile) {
ASSERT(m_pFile);
}
- int InputStreamBSF::NextByte()
- {
- if(!m_pFile) ThrowError(_T("m_pFile is NULL"));
- if(!m_pFile->GetRemaining()) return EOS;
+ int InputStreamBSF::NextByte() {
+ if(!m_pFile) {
+ ThrowError(_T("m_pFile is NULL"));
+ }
+ if(!m_pFile->GetRemaining()) {
+ return EOS;
+ }
return (int)m_pFile->BitRead(8);
}
};
@@ -98,8 +96,12 @@ int CSSFSplitterFilter::SegmentItemEx::Compare(const void* a, const void* b) {
const SegmentItemEx* si1 = (const SegmentItemEx*)a;
const SegmentItemEx* si2 = (const SegmentItemEx*)b;
- if(si1->start < si2->start) return -1;
- if(si2->start < si1->start) return +1;
+ if(si1->start < si2->start) {
+ return -1;
+ }
+ if(si2->start < si1->start) {
+ return +1;
+ }
return 0;
}
@@ -120,33 +122,36 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr)) {m_pFile.Free(); return hr;}
+ if(!m_pFile) {
+ return E_OUTOFMEMORY;
+ }
+ if(FAILED(hr)) {
+ m_pFile.Free();
+ return hr;
+ }
+
+ try {
+ m_ssf.Parse(ssf::InputStreamBSF(m_pFile));
+ } catch(ssf::Exception&) {
+ return E_FAIL;
+ }
- try {m_ssf.Parse(ssf::InputStreamBSF(m_pFile));}
- catch(ssf::Exception&) {return E_FAIL;}
-
//
m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- if(ssf::Reference* pRootRef = m_ssf.GetRootRef())
- {
+ if(ssf::Reference* pRootRef = m_ssf.GetRootRef()) {
ssf::WCharOutputStream s;
ssf::StringMapW<float> offset;
POSITION pos = pRootRef->m_nodes.GetHeadPosition();
- while(pos)
- {
- if(ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos)))
- {
- try
- {
+ while(pos) {
+ if(ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos))) {
+ try {
ssf::Definition::Time time;
- if(pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue())
- {
+ if(pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue()) {
SegmentItemEx si;
si.pDef = pDef;
si.start = time.start.value;
@@ -157,12 +162,10 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) continue;
}
- }
- catch(ssf::Exception&)
- {
+ } catch(ssf::Exception&) {
}
- pDef->Dump(s);
+ pDef->Dump(s);
}
}
@@ -178,7 +181,9 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) memset(si, 0, sizeof(*si));
si->dwOffset = sizeof(*si);
BYTE* p = (BYTE*)(si+1);
- p[0] = 0xef; p[1] = 0xbb; p[2] = 0xbf;
+ p[0] = 0xef;
+ p[1] = 0xbb;
+ p[2] = 0xbf;
memcpy(&p[3], (LPCSTR)hdr, hdr.GetLength());
mts.Add(mt);
@@ -188,13 +193,16 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAtlArray<SegmentItemEx> subs;
subs.SetCount(m_subs.GetCount());
pos = m_subs.GetHeadPosition();
- for(size_t i = 0; pos; i++) subs.SetAt(i, m_subs.GetNext(pos));
+ for(size_t i = 0; pos; i++) {
+ subs.SetAt(i, m_subs.GetNext(pos));
+ }
qsort(subs.GetData(), subs.GetCount(), sizeof(SegmentItemEx), SegmentItemEx::Compare);
m_subs.RemoveAll();
- for(size_t i = 0; i < subs.GetCount(); i++) m_subs.AddTail(subs[i]);
+ for(size_t i = 0; i < subs.GetCount(); i++) {
+ m_subs.AddTail(subs[i]);
+ }
- if(!m_ssf.m_segments.IsEmpty())
- {
+ if(!m_ssf.m_segments.IsEmpty()) {
m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64*m_ssf.m_segments.GetTail().m_stop;
}
}
@@ -210,11 +218,8 @@ bool CSSFSplitterFilter::DemuxInit() void CSSFSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0)
- {
- }
- else
- {
+ if(rt <= 0) {
+ } else {
// TODO
}
}
@@ -225,8 +230,7 @@ bool CSSFSplitterFilter::DemuxLoop() POSITION pos = m_subs.GetHeadPosition();
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
- {
+ while(pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
SegmentItemEx& si = m_subs.GetNext(pos);
ssf::WCharOutputStream s;
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.h b/src/filters/parser/SSFSplitter/SSFSplitter.h index 35f95c507..de76e1211 100644 --- a/src/filters/parser/SSFSplitter/SSFSplitter.h +++ b/src/filters/parser/SSFSplitter/SSFSplitter.h @@ -1,4 +1,4 @@ -/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -25,14 +25,13 @@ #include "../../../Subtitles/libssf/SubtitleFile.h"
class __declspec(uuid("95C3F9F6-1E05-4C34-8122-504476EACB51"))
-CSSFSplitterFilter : public CBaseSplitterFilter
+ CSSFSplitterFilter : public CBaseSplitterFilter
{
CAutoPtr<CBaseSplitterFile> m_pFile;
ssf::SubtitleFile m_ssf;
- struct SegmentItemEx : public ssf::SubtitleFile::SegmentItem
- {
+ struct SegmentItemEx : public ssf::SubtitleFile::SegmentItem {
static int Compare(const void* a, const void* b);
};
@@ -50,7 +49,7 @@ public: };
class __declspec(uuid("57F46A2A-6DC9-4A9F-B5FA-DFDD62B8BAFB"))
-CSSFSourceFilter : public CSSFSplitterFilter
+ CSSFSourceFilter : public CSSFSplitterFilter
{
public:
CSSFSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
diff --git a/src/filters/parser/SSFSplitter/stdafx.cpp b/src/filters/parser/SSFSplitter/stdafx.cpp index 13934d005..bea3f980a 100644 --- a/src/filters/parser/SSFSplitter/stdafx.cpp +++ b/src/filters/parser/SSFSplitter/stdafx.cpp @@ -1,4 +1,4 @@ -/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/parser/SSFSplitter/stdafx.h b/src/filters/parser/SSFSplitter/stdafx.h index 55763f8a3..432a74d80 100644 --- a/src/filters/parser/SSFSplitter/stdafx.h +++ b/src/filters/parser/SSFSplitter/stdafx.h @@ -1,4 +1,4 @@ -/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|