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:
Diffstat (limited to 'src/filters/parser/MpaSplitter')
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitter.cpp74
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitter.h12
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitterFile.cpp199
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitterFile.h22
-rw-r--r--src/filters/parser/MpaSplitter/stdafx.cpp6
-rw-r--r--src/filters/parser/MpaSplitter/stdafx.h6
6 files changed, 170 insertions, 149 deletions
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.cpp b/src/filters/parser/MpaSplitter/MpaSplitter.cpp
index fef3f7d1a..11f7322c9 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitter.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitter.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.
@@ -27,26 +27,22 @@
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] = {
{&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio},
{&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
};
-const AMOVIESETUP_PIN sudpPins[] =
-{
+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(CMpaSplitterFilter), L"MPC - Mpa Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
{&__uuidof(CMpaSourceFilter), L"MPC - Mpa Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpaSplitterFilter>, NULL, &sudFilter[0]},
{sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpaSourceFilter>, NULL, &sudFilter[1]},
};
@@ -85,9 +81,9 @@ CMpaSplitterFilter::CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
STDMETHODIMP CMpaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
+ return
__super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -100,8 +96,13 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CMpaSplitterFile(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;
+ }
CAtlArray<CMediaType> mts;
mts.Add(m_pFile->GetMediaType());
@@ -113,12 +114,24 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
CStringW str, title;
- if(m_pFile->m_tags.Lookup('TIT2', str)) title = str;
- if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) title += L" (" + str + L")";
- if(!title.IsEmpty()) SetProperty(L"TITL", title);
- if(m_pFile->m_tags.Lookup('TPE1', str)) SetProperty(L"AUTH", str);
- if(m_pFile->m_tags.Lookup('TCOP', str)) SetProperty(L"CPYR", str);
- if(m_pFile->m_tags.Lookup('COMM', str)) SetProperty(L"DESC", str);
+ if(m_pFile->m_tags.Lookup('TIT2', str)) {
+ title = str;
+ }
+ if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) {
+ title += L" (" + str + L")";
+ }
+ if(!title.IsEmpty()) {
+ SetProperty(L"TITL", title);
+ }
+ if(m_pFile->m_tags.Lookup('TPE1', str)) {
+ SetProperty(L"AUTH", str);
+ }
+ if(m_pFile->m_tags.Lookup('TCOP', str)) {
+ SetProperty(L"CPYR", str);
+ }
+ if(m_pFile->m_tags.Lookup('COMM', str)) {
+ SetProperty(L"DESC", str);
+ }
return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
@@ -136,7 +149,9 @@ STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration)
bool CMpaSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CMpaSplitterFilter");
- if(!m_pFile) return(false);
+ if(!m_pFile) {
+ return(false);
+ }
// TODO
@@ -148,13 +163,10 @@ void CMpaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
__int64 startpos = m_pFile->GetStartPos();
__int64 endpos = m_pFile->GetEndPos();
- if(rt <= 0 || m_pFile->GetDuration() <= 0)
- {
+ if(rt <= 0 || m_pFile->GetDuration() <= 0) {
m_pFile->Seek(startpos);
m_rtStart = 0;
- }
- else
- {
+ } else {
m_pFile->Seek(startpos + (__int64)((1.0 * rt / m_pFile->GetDuration()) * (endpos - startpos)));
m_rtStart = rt;
}
@@ -168,9 +180,11 @@ bool CMpaSplitterFilter::DemuxLoop()
int FrameSize;
REFERENCE_TIME rtDuration;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9)
- {
- if(!m_pFile->Sync(FrameSize, rtDuration)) {Sleep(1); continue;}
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9) {
+ if(!m_pFile->Sync(FrameSize, rtDuration)) {
+ Sleep(1);
+ continue;
+ }
CAutoPtr<Packet> p(DNew Packet());
p->SetCount(FrameSize);
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.h b/src/filters/parser/MpaSplitter/MpaSplitter.h
index cae3c8b9a..064a91d36 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitter.h
+++ b/src/filters/parser/MpaSplitter/MpaSplitter.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,7 +25,7 @@
#include "MpaSplitterFile.h"
class __declspec(uuid("0E9D4BF7-CBCB-46C7-BD80-4EF223A3DC2B"))
-CMpaSplitterFilter : public CBaseSplitterFilter
+ CMpaSplitterFilter : public CBaseSplitterFilter
{
REFERENCE_TIME m_rtStart;
@@ -43,11 +43,11 @@ public:
CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
class __declspec(uuid("59A0DB73-0287-4C9A-9D3C-8CFF39F8E5DB"))
-CMpaSourceFilter : public CMpaSplitterFilter
+ CMpaSourceFilter : public CMpaSplitterFilter
{
public:
CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
index fc5f8399c..d26b70bb7 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.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.
@@ -28,43 +28,42 @@
//
-static const LPCTSTR s_genre[] =
-{
+static const LPCTSTR s_genre[] = {
_T("Blues"), _T("Classic Rock"), _T("Country"), _T("Dance"),
_T("Disco"), _T("Funk"), _T("Grunge"), _T("Hip-Hop"),
- _T("Jazz"), _T("Metal"), _T("New Age"), _T("Oldies"),
+ _T("Jazz"), _T("Metal"), _T("New Age"), _T("Oldies"),
_T("Other"), _T("Pop"), _T("R&B"), _T("Rap"),
- _T("Reggae"), _T("Rock"), _T("Techno"), _T("Industrial"),
+ _T("Reggae"), _T("Rock"), _T("Techno"), _T("Industrial"),
_T("Alternative"), _T("Ska"), _T("Death Metal"), _T("Pranks"),
_T("Soundtrack"), _T("Euro-Techno"), _T("Ambient"), _T("Trip-Hop"),
_T("Vocal"), _T("Jazz+Funk"), _T("Fusion"), _T("Trance"),
- _T("Classical"), _T("Instrumental"), _T("Acid"), _T("House"),
+ _T("Classical"), _T("Instrumental"), _T("Acid"), _T("House"),
_T("Game"), _T("Sound Clip"), _T("Gospel"), _T("Noise"),
- _T("Alternative Rock"), _T("Bass"), _T("Soul"), _T("Punk"),
+ _T("Alternative Rock"), _T("Bass"), _T("Soul"), _T("Punk"),
_T("Space"), _T("Meditative"), _T("Instrumental Pop"), _T("Instrumental Rock"),
_T("Ethnic"), _T("Gothic"), _T("Darkwave"), _T("Techno-Industrial"),
_T("Electronic"), _T("Pop-Folk"), _T("Eurodance"), _T("Dream"),
_T("Southern Rock"), _T("Comedy"), _T("Cult"), _T("Gangsta"),
_T("Top 40"), _T("Christian Rap"), _T("Pop/Funk"), _T("Jungle"),
- _T("Native US"), _T("Cabaret"), _T("New Wave"), _T("Psychadelic"),
+ _T("Native US"), _T("Cabaret"), _T("New Wave"), _T("Psychadelic"),
_T("Rave"), _T("Showtunes"), _T("Trailer"), _T("Lo-Fi"),
_T("Tribal"), _T("Acid Punk"), _T("Acid Jazz"), _T("Polka"),
_T("Retro"), _T("Musical"), _T("Rock & Roll"), _T("Hard Rock"),
_T("Folk"), _T("Folk-Rock"), _T("National Folk"), _T("Swing"),
_T("Fast Fusion"), _T("Bebob"), _T("Latin"), _T("Revival"),
- _T("Celtic"), _T("Bluegrass"), _T("Avantgarde"), _T("Gothic Rock"),
+ _T("Celtic"), _T("Bluegrass"), _T("Avantgarde"), _T("Gothic Rock"),
_T("Progressive Rock"), _T("Psychedelic Rock"), _T("Symphonic Rock"), _T("Slow Rock"),
_T("Big Band"), _T("Chorus"), _T("Easy Listening"), _T("Acoustic"),
- _T("Humour"), _T("Speech"), _T("Chanson"), _T("Opera"),
- _T("Chamber Music"), _T("Sonata"), _T("Symphony"), _T("Booty Bass"),
+ _T("Humour"), _T("Speech"), _T("Chanson"), _T("Opera"),
+ _T("Chamber Music"), _T("Sonata"), _T("Symphony"), _T("Booty Bass"),
_T("Primus"), _T("Porn Groove"), _T("Satire"), _T("Slow Jam"),
- _T("Club"), _T("Tango"), _T("Samba"), _T("Folklore"),
+ _T("Club"), _T("Tango"), _T("Samba"), _T("Folklore"),
_T("Ballad"), _T("Power Ballad"), _T("Rhytmic Soul"), _T("Freestyle"),
- _T("Duet"), _T("Punk Rock"), _T("Drum Solo"), _T("Acapella"),
+ _T("Duet"), _T("Punk Rock"), _T("Drum Solo"), _T("Acapella"),
_T("Euro-House"), _T("Dance Hall"), _T("Goa"), _T("Drum & Bass"),
_T("Club-House"), _T("Hardcore"), _T("Terror"), _T("Indie"),
_T("BritPop"), _T("Negerpunk"), _T("Polsk Punk"), _T("Beat"),
- _T("Christian Gangsta"), _T("Heavy Metal"), _T("Black Metal"),
+ _T("Christian Gangsta"), _T("Heavy Metal"), _T("Black Metal"),
_T("Crossover"), _T("Contemporary C"), _T("Christian Rock"), _T("Merengue"), _T("Salsa"),
_T("Thrash Metal"), _T("Anime"), _T("JPop"), _T("SynthPop"),
};
@@ -79,7 +78,9 @@ CMpaSplitterFile::CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
, m_endpos(0)
, m_totalbps(0)
{
- if(SUCCEEDED(hr)) hr = Init();
+ if(SUCCEEDED(hr)) {
+ hr = Init();
+ }
}
HRESULT CMpaSplitterFile::Init()
@@ -89,19 +90,18 @@ HRESULT CMpaSplitterFile::Init()
Seek(0);
- if(BitRead(24, true) == 0x000001)
+ if(BitRead(24, true) == 0x000001) {
return E_FAIL;
+ }
- if(m_endpos > 128 && IsRandomAccess())
- {
+ if(m_endpos > 128 && IsRandomAccess()) {
Seek(m_endpos - 128);
- if(BitRead(24) == 'TAG')
- {
+ if(BitRead(24) == 'TAG') {
m_endpos -= 128;
CStringA str;
-
+
// title
ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
m_tags['TIT2'] = CStringW(str).Trim();
@@ -120,17 +120,19 @@ HRESULT CMpaSplitterFile::Init()
// comment
ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
- m_tags['COMM'] = CStringW(str).Trim();
+ m_tags['COMM'] = CStringW(str).Trim();
// track
LPCSTR s = str;
- if(s[28] == 0 && s[29] != 0)
- m_tags['TRCK'].Format(L"%d", s[29]);
+ if(s[28] == 0 && s[29] != 0) {
+ m_tags['TRCK'].Format(L"%d", s[29]);
+ }
// genre
BYTE genre = (BYTE)BitRead(8);
- if(genre < countof(s_genre))
+ if(genre < countof(s_genre)) {
m_tags['TCON'] = CStringW(s_genre[genre]);
+ }
}
}
@@ -138,8 +140,7 @@ HRESULT CMpaSplitterFile::Init()
bool MP3_find = false;
- while(BitRead(24, true) == 'ID3')
- {
+ while(BitRead(24, true) == 'ID3') {
MP3_find = true;
BitRead(24);
@@ -151,25 +152,31 @@ HRESULT CMpaSplitterFile::Init()
BYTE flags = (BYTE)BitRead(8);
UNUSED_ALWAYS(flags);
DWORD size = 0;
- if(BitRead(1) != 0) return E_FAIL;
+ if(BitRead(1) != 0) {
+ return E_FAIL;
+ }
size |= BitRead(7) << 21;
- if(BitRead(1) != 0) return E_FAIL;
+ if(BitRead(1) != 0) {
+ return E_FAIL;
+ }
size |= BitRead(7) << 14;
- if(BitRead(1) != 0) return E_FAIL;
+ if(BitRead(1) != 0) {
+ return E_FAIL;
+ }
size |= BitRead(7) << 7;
- if(BitRead(1) != 0) return E_FAIL;
+ if(BitRead(1) != 0) {
+ return E_FAIL;
+ }
size |= BitRead(7);
m_startpos = GetPos() + size;
// TODO: read extended header
- if(major <= 4)
- {
+ if(major <= 4) {
__int64 pos = GetPos();
- while(pos < m_startpos)
- {
+ while(pos < m_startpos) {
Seek(pos);
DWORD tag = (DWORD)BitRead(32);
@@ -183,16 +190,16 @@ HRESULT CMpaSplitterFile::Init()
pos += 4+4+2+size;
- if(!size || pos >= m_startpos)
+ if(!size || pos >= m_startpos) {
break;
+ }
if(tag == 'TIT2'
- || tag == 'TPE1'
- || tag == 'TALB'
- || tag == 'TYER'
- || tag == 'COMM'
- || tag == 'TRCK')
- {
+ || tag == 'TPE1'
+ || tag == 'TALB'
+ || tag == 'TYER'
+ || tag == 'COMM'
+ || tag == 'TRCK') {
BYTE encoding = (BYTE)BitRead(8);
size--;
@@ -201,45 +208,41 @@ HRESULT CMpaSplitterFile::Init()
CStringA str;
CStringW wstr;
- if(encoding > 0 && size >= 2 && bom == 0xfffe)
- {
- BitRead(16);
+ if(encoding > 0 && size >= 2 && bom == 0xfffe) {
+ BitRead(16);
size = (size - 2) / 2;
ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
m_tags[tag] = wstr.Trim();
- }
- else if(encoding > 0 && size >= 2 && bom == 0xfeff)
- {
+ } else if(encoding > 0 && size >= 2 && bom == 0xfeff) {
BitRead(16);
size = (size - 2) / 2;
ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
- for(int i = 0, j = wstr.GetLength(); i < j; i++) wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
+ for(int i = 0, j = wstr.GetLength(); i < j; i++) {
+ wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
+ }
m_tags[tag] = wstr.Trim();
- }
- else
- {
+ } else {
ByteRead((BYTE*)str.GetBufferSetLength(size), size);
m_tags[tag] = (encoding > 0 ? UTF8To16(str) : CStringW(str)).Trim();
- }
+ }
}
}
}
Seek(m_startpos);
- for(int i = 0; i < (1<<20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++)
+ for(int i = 0; i < (1<<20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++) {
BitRead(8), m_startpos++;
+ }
}
__int64 searchlen;
__int64 startpos;
__int64 syncpos;
- if(MP3_find)
- {
+ if(MP3_find) {
__int64 startpos_mp3 = m_startpos;
- while (m_mode == none)
- {
+ while (m_mode == none) {
searchlen = min(m_endpos - startpos_mp3, 0x200);
Seek(startpos_mp3);
@@ -247,45 +250,48 @@ HRESULT CMpaSplitterFile::Init()
syncpos = startpos_mp3 + searchlen;
// Check for a valid MPA header
- if(Read(m_mpahdr, searchlen, true, &m_mt))
- {
+ if(Read(m_mpahdr, searchlen, true, &m_mt)) {
m_mode = mpa;
syncpos = GetPos();
startpos = syncpos - 4;
-
+
// make sure the first frame is followed by another of the same kind (validates m_mpahdr basically)
Seek(startpos + m_mpahdr.FrameSize);
- if(!Sync(4))
+ if(!Sync(4)) {
m_mode = none;
- else
+ } else {
break;
+ }
}
// If we have enough room to search for a valid header, then skip ahead and try again
- if (m_endpos - syncpos >= 8)
+ if (m_endpos - syncpos >= 8) {
startpos_mp3 = syncpos;
- else
+ } else {
break;
+ }
}
}
searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
Seek(m_startpos);
- if(m_mode == none && Read(m_aachdr, searchlen, &m_mt))
- {
+ if(m_mode == none && Read(m_aachdr, searchlen, &m_mt)) {
m_mode = mp4a;
startpos = GetPos() - (m_aachdr.fcrc?7:9);
// make sure the first frame is followed by another of the same kind (validates m_aachdr basically)
Seek(startpos + m_aachdr.aac_frame_length);
- if(!Sync(9)) m_mode = none;
+ if(!Sync(9)) {
+ m_mode = none;
+ }
}
- if(m_mode == none)
+ if(m_mode == none) {
return E_FAIL;
+ }
m_startpos = startpos;
@@ -293,12 +299,13 @@ HRESULT CMpaSplitterFile::Init()
REFERENCE_TIME rtFrameDur, rtPrevDur = -1;
clock_t start = clock();
int i = 0;
- while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC)
- {
+ while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC) {
TRACE(_T("%I64d\n"), m_rtDuration);
Seek(GetPos() + FrameSize);
i = rtPrevDur == m_rtDuration ? i+1 : 0;
- if(i == 10) break;
+ if(i == 10) {
+ break;
+ }
rtPrevDur = m_rtDuration;
}
@@ -316,18 +323,14 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi
{
__int64 endpos = min(m_endpos, GetPos() + limit);
- if(m_mode == mpa)
- {
- while(GetPos() <= endpos - 4)
- {
+ if(m_mode == mpa) {
+ while(GetPos() <= endpos - 4) {
mpahdr h;
- if(Read(h, endpos - GetPos(), true))
- {
+ if(Read(h, endpos - GetPos(), true)) {
if (m_mpahdr.version == h.version
- && m_mpahdr.layer == h.layer
- && m_mpahdr.channels == h.channels)
- {
+ && m_mpahdr.layer == h.layer
+ && m_mpahdr.channels == h.channels) {
Seek(GetPos() - 4);
AdjustDuration(h.nBytesPerSec);
@@ -336,23 +339,18 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi
return true;
}
- }
- else
+ } else {
break;
+ }
}
- }
- else if(m_mode == mp4a)
- {
- while(GetPos() <= endpos - 9)
- {
+ } else if(m_mode == mp4a) {
+ while(GetPos() <= endpos - 9) {
aachdr h;
- if(Read(h, endpos - GetPos()))
- {
+ if(Read(h, endpos - GetPos())) {
if (m_aachdr.version == h.version
- && m_aachdr.layer == h.layer
- && m_aachdr.channels == h.channels)
- {
+ && m_aachdr.layer == h.layer
+ && m_aachdr.channels == h.channels) {
Seek(GetPos() - (h.fcrc?7:9));
AdjustDuration(h.nBytesPerSec);
Seek(GetPos() + (h.fcrc?7:9));
@@ -362,9 +360,9 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi
return true;
}
- }
- else
+ } else {
break;
+ }
}
}
@@ -376,10 +374,11 @@ void CMpaSplitterFile::AdjustDuration(int nBytesPerSec)
ASSERT(nBytesPerSec);
int rValue;
- if(!m_pos2bps.Lookup(GetPos(), rValue))
- {
+ if(!m_pos2bps.Lookup(GetPos(), rValue)) {
m_totalbps += nBytesPerSec;
- if(!m_totalbps) return;
+ if(!m_totalbps) {
+ return;
+ }
m_pos2bps.SetAt(GetPos(), nBytesPerSec);
__int64 avgbps = m_totalbps / m_pos2bps.GetCount();
m_rtDuration = 10000000i64 * (m_endpos - m_startpos) / avgbps;
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.h b/src/filters/parser/MpaSplitter/MpaSplitterFile.h
index 2bd3a9a40..2c95f4af7 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitterFile.h
+++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.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.
@@ -45,11 +45,19 @@ public:
CAtlMap<DWORD, CStringW> m_tags;
- const CMediaType& GetMediaType() {return m_mt;}
- REFERENCE_TIME GetDuration() {return IsRandomAccess() ? m_rtDuration : 0;}
+ const CMediaType& GetMediaType() {
+ return m_mt;
+ }
+ REFERENCE_TIME GetDuration() {
+ return IsRandomAccess() ? m_rtDuration : 0;
+ }
- __int64 GetStartPos() {return m_startpos;}
- __int64 GetEndPos() {return m_endpos;}
+ __int64 GetStartPos() {
+ return m_startpos;
+ }
+ __int64 GetEndPos() {
+ return m_endpos;
+ }
bool Sync(int limit = 0x2000);
bool Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit = 0x2000);
diff --git a/src/filters/parser/MpaSplitter/stdafx.cpp b/src/filters/parser/MpaSplitter/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/parser/MpaSplitter/stdafx.cpp
+++ b/src/filters/parser/MpaSplitter/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/MpaSplitter/stdafx.h b/src/filters/parser/MpaSplitter/stdafx.h
index 7fbf4d9ac..114712db9 100644
--- a/src/filters/parser/MpaSplitter/stdafx.h
+++ b/src/filters/parser/MpaSplitter/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.