diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-02-05 13:27:07 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-02-05 13:27:07 +0400 |
commit | 6cb2939b677159a85147c6500835c194ee1ccf86 (patch) | |
tree | 54994b57d8df3203b276d15ee73c46d227ea6826 /src/filters/parser | |
parent | e736ccc10964dfcd571d1b0f07327819c31a63a9 (diff) |
apply astyle
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4039 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser')
31 files changed, 2362 insertions, 2364 deletions
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp index 20583dc7e..27957bc18 100644 --- a/src/filters/parser/AviSplitter/AviFile.cpp +++ b/src/filters/parser/AviSplitter/AviFile.cpp @@ -30,7 +30,7 @@ CAviFile::CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
m_isamv = false;
@@ -41,7 +41,7 @@ HRESULT CAviFile::Init() {
Seek(0);
DWORD dw[3];
- if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV '))) {
+ if (S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV '))) {
return E_FAIL;
}
@@ -49,25 +49,25 @@ HRESULT CAviFile::Init() Seek(0);
HRESULT hr = Parse(0, GetLength());
UNUSED_ALWAYS(hr);
- if(m_movis.GetCount() == 0) { // FAILED(hr) is allowed as long as there was a movi chunk found
+ if (m_movis.GetCount() == 0) { // FAILED(hr) is allowed as long as there was a movi chunk found
return E_FAIL;
}
- if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0) {
+ if (m_avih.dwStreams == 0 && m_strms.GetCount() > 0) {
m_avih.dwStreams = m_strms.GetCount();
}
- if(m_avih.dwStreams != m_strms.GetCount()) {
+ if (m_avih.dwStreams != m_strms.GetCount()) {
return E_FAIL;
}
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
- if(s->strh.fccType != FCC('auds')) {
+ if (s->strh.fccType != FCC('auds')) {
continue;
}
WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
- if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
+ if (wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
&& s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec) {
// correcting encoder bugs...
s->strh.dwScale = 1152;
@@ -89,7 +89,7 @@ HRESULT CAviFile::BuildAMVIndex() DWORD ulSize;
memset (&NewChunk, 0, sizeof(strm_t::chunk));
- while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK)) {
+ while ((Read(ulType) == S_OK) && (Read(ulSize) == S_OK)) {
switch (ulType) {
case FCC('00dc'): // 01bw : JPeg
NewChunk.size = ulSize;
@@ -119,16 +119,16 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) CAutoPtr<strm_t> strm;
- while(S_OK == hr && GetPos() < end) {
+ while (S_OK == hr && GetPos() < end) {
UINT64 pos = GetPos();
DWORD id = 0, size;
- if(S_OK != Read(id) || id == 0) {
+ if (S_OK != Read(id) || id == 0) {
return E_FAIL;
}
- if(id == FCC('RIFF') || id == FCC('LIST')) {
- if(S_OK != Read(size) || S_OK != Read(id)) {
+ if (id == FCC('RIFF') || id == FCC('LIST')) {
+ if (S_OK != Read(size) || S_OK != Read(id)) {
return E_FAIL;
}
@@ -143,7 +143,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) TCHAR((id>>16)&0xff),
TCHAR((id>>24)&0xff));
- if(id == FCC('movi')) {
+ if (id == FCC('movi')) {
m_movis.AddTail(pos);
if (m_isamv) {
BuildAMVIndex();
@@ -152,7 +152,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) hr = Parse(id, pos + size);
}
} else {
- if(S_OK != Read(size)) {
+ if (S_OK != Read(size)) {
return E_FAIL;
}
@@ -162,8 +162,8 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) TCHAR((id>>16)&0xff),
TCHAR((id>>24)&0xff));
- if(parentid == FCC('INFO') && size > 0) {
- switch(id) {
+ if (parentid == FCC('INFO') && size > 0) {
+ switch (id) {
case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
@@ -188,7 +188,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
case FCC('ITCH'): { // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
CStringA str;
- if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) {
+ if (S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) {
return E_FAIL;
}
m_info[id] = str;
@@ -197,22 +197,22 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) }
}
- switch(id) {
+ switch (id) {
case FCC('amvh'):
case FCC('avih'):
m_avih.fcc = id;
m_avih.cb = size;
- if(S_OK != Read(m_avih, 8)) {
+ if (S_OK != Read(m_avih, 8)) {
return E_FAIL;
}
break;
case FCC('strh'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
strm->strh.fcc = FCC('strh');
strm->strh.cb = size;
- if(S_OK != Read(strm->strh, 8)) {
+ if (S_OK != Read(strm->strh, 8)) {
return E_FAIL;
}
if (m_isamv) {
@@ -223,16 +223,16 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) }
break;
case FCC('strn'):
- if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) {
+ if (S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) {
return E_FAIL;
}
break;
case FCC('strf'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
strm->strf.SetCount(size);
- if(S_OK != ByteRead(strm->strf.GetData(), size)) {
+ if (S_OK != ByteRead(strm->strf.GetData(), size)) {
return E_FAIL;
}
if (m_isamv) {
@@ -252,7 +252,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) break;
case FCC('indx'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
ASSERT(strm->indx == NULL);
@@ -270,7 +270,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) strm->indx.Attach(pSuperIndex);
strm->indx->fcc = FCC('indx');
strm->indx->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) {
+ if (S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) {
return E_FAIL;
}
ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
@@ -278,7 +278,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) }
break;
case FCC('dmlh'):
- if(S_OK != Read(m_dmlh)) {
+ if (S_OK != Read(m_dmlh)) {
return E_FAIL;
}
break;
@@ -290,7 +290,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
m_idx1->fcc = FCC('idx1');
m_idx1->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) {
+ if (S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) {
return E_FAIL;
}
break;
@@ -309,7 +309,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) Seek(pos + size);
}
- if(strm) {
+ if (strm) {
m_strms.Add(strm);
}
@@ -320,13 +320,13 @@ REFERENCE_TIME CAviFile::GetTotalTime() {
REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
t = max(t, t2);
}
- if(t == 0) {
+ if (t == 0) {
t = 10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames;
}
@@ -339,26 +339,26 @@ HRESULT CAviFile::BuildIndex() DWORD nSuperIndexes = 0;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
- if(s->indx && s->indx->nEntriesInUse > 0) {
+ if (s->indx && s->indx->nEntriesInUse > 0) {
++nSuperIndexes;
}
}
- if(nSuperIndexes == m_avih.dwStreams) {
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ if (nSuperIndexes == m_avih.dwStreams) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
DWORD nEntriesInUse = 0;
- for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
+ for (DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
AVISTDINDEX stdidx;
- if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex))) {
+ if (S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex))) {
EmptyIndex();
return E_FAIL;
}
@@ -371,16 +371,16 @@ HRESULT CAviFile::BuildIndex() DWORD frame = 0;
UINT64 size = 0;
- for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
+ for (DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
- if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize) || p->qwBaseOffset >= GetLength()) {
+ if (!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize) || p->qwBaseOffset >= GetLength()) {
EmptyIndex();
return E_FAIL;
}
- for(DWORD k = 0; k < p->nEntriesInUse; ++k) {
+ for (DWORD k = 0; k < p->nEntriesInUse; ++k) {
s->cs[frame].size = size;
s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
@@ -388,7 +388,7 @@ HRESULT CAviFile::BuildIndex() s->cs[frame].fChunkHdr = false;
s->cs[frame].orgsize = p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK;
- if(m_idx1) {
+ if (m_idx1) {
s->cs[frame].filepos -= 8;
s->cs[frame].fChunkHdr = true;
}
@@ -400,29 +400,29 @@ HRESULT CAviFile::BuildIndex() s->totalsize = size;
}
- } else if(AVIOLDINDEX* idx = m_idx1) {
+ } else if (AVIOLDINDEX* idx = m_idx1) {
DWORD len = idx->cb / sizeof(idx->aIndex[0]);
UINT64 offset = m_movis.GetHead() + 8;
//detect absolute chunk addressing (TODO: read AVI specification and make it better)
- if(idx->aIndex[0].dwOffset > offset) {
+ if (idx->aIndex[0].dwOffset > offset) {
DWORD id;
Seek(offset + idx->aIndex[0].dwOffset);
Read(id);
- if(id != idx->aIndex[0].dwChunkId) {
+ if (id != idx->aIndex[0].dwChunkId) {
TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
offset = 0;
}
}
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
// calculate the number of frames and set index size before using it
DWORD nFrames = 0;
- for(DWORD j = 0; j < len; ++j) {
- if(TRACKNUM(idx->aIndex[j].dwChunkId) == i) {
+ for (DWORD j = 0; j < len; ++j) {
+ if (TRACKNUM(idx->aIndex[j].dwChunkId) == i) {
++nFrames;
}
}
@@ -431,10 +431,10 @@ HRESULT CAviFile::BuildIndex() //read index
DWORD frame = 0;
UINT64 size = 0;
- for(DWORD j = 0; j < len; ++j) {
+ for (DWORD j = 0; j < len; ++j) {
DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
- if(TrackNumber == i) {
+ if (TrackNumber == i) {
s->cs[frame].size = size;
s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags&AVIIF_KEYFRAME)
@@ -453,7 +453,7 @@ HRESULT CAviFile::BuildIndex() }
m_idx1.Free();
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->indx.Free();
}
@@ -462,7 +462,7 @@ HRESULT CAviFile::BuildIndex() void CAviFile::EmptyIndex()
{
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
s->cs.RemoveAll();
s->totalsize = 0;
@@ -471,14 +471,14 @@ void CAviFile::EmptyIndex() bool CAviFile::IsInterleaved(bool fKeepInfo)
{
- if(m_strms.GetCount() < 2) {
+ if (m_strms.GetCount() < 2) {
return true;
}
/*
if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
return true;
*/
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
}
@@ -490,23 +490,23 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) int end = 0;
- while(1) {
+ while (1) {
UINT64 fpmin = _I64_MAX;
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
- if(curchunk >= cs.GetCount()) {
+ if (curchunk >= cs.GetCount()) {
continue;
}
UINT64 fp = cs[curchunk].filepos;
- if(fp < fpmin) {
+ if (fp < fpmin) {
fpmin = fp;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
@@ -514,7 +514,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) DWORD& curchunk = curchunks[n];
UINT64& cursize = cursizes[n];
- if(!s->IsRawSubtitleStream()) {
+ if (!s->IsRawSubtitleStream()) {
strm_t::chunk2& cs2 = s->cs2[curchunk];
cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)>>13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
//cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)/10000);
@@ -531,28 +531,28 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) bool fInterleaved = true;
- while(fInterleaved) {
+ while (fInterleaved) {
strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
- if(curchunk >= m_strms[i]->cs2.GetCount()) {
+ if (curchunk >= m_strms[i]->cs2.GetCount()) {
continue;
}
strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t) {
+ if (cs2.t < cs2min.t) {
cs2min = cs2;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
++curchunks[n];
- if(cs2last.t != (DWORD)-1 && abs((int)cs2min.n - (int)cs2last.n) >= 1000) {
+ if (cs2last.t != (DWORD)-1 && abs((int)cs2min.n - (int)cs2last.n) >= 1000) {
fInterleaved = false;
}
@@ -562,9 +562,9 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) delete [] curchunks;
delete [] cursizes;
- if(fInterleaved && !fKeepInfo) {
+ if (fInterleaved && !fKeepInfo) {
// this is not needed anymore, let's save a little memory then
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.RemoveAll();
}
}
@@ -577,7 +577,7 @@ REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size) if (frame == 0 || strh.dwRate == 0) {
return 0;
}
- if(strh.fccType == FCC('auds')) {
+ if (strh.fccType == FCC('auds')) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
if (wfe->nBlockAlign == 0) {
return 0;
@@ -589,22 +589,22 @@ REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size) return (REFERENCE_TIME)ceil(10000000.0 * frame * strh.dwScale / strh.dwRate);
// need calculate in double, because the (10000000ui64 * frame * strh.dwScale) can give overflow (verified in practice)
// "ceil" is necessary to compensate for framenumber->reftime->framenumber conversion
-}
+}
DWORD CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
{
DWORD frame;
if (strh.dwScale == 0 || rt <= 0 || cs.GetCount() == 0) {
- frame = 0;
- } else if (strh.fccType == FCC('auds')) {
+ frame = 0;
+ } else if (strh.fccType == FCC('auds')) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
UINT64 size = (UINT64)(double(rt) * wfe->nBlockAlign * strh.dwRate / (strh.dwScale * 10000000.0));
// need calculate in double, because the (rt * wfe->nBlockAlign * strh.dwRate) can give overflow
frame = 1;
- for(; frame < cs.GetCount(); ++frame) {
- if(cs[frame].size > size) {
+ for (; frame < cs.GetCount(); ++frame) {
+ if (cs[frame].size > size) {
break;
}
}
@@ -623,8 +623,8 @@ DWORD CAviFile::strm_t::GetFrame(REFERENCE_TIME rt) DWORD CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
{
DWORD i = GetFrame(rt);
- for(; i > 0; i--) {
- if(cs[i].fKeyFrame) {
+ for (; i > 0; i--) {
+ if (cs[i].fKeyFrame) {
break;
}
}
@@ -633,7 +633,7 @@ DWORD CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt) DWORD CAviFile::strm_t::GetChunkSize(DWORD size)
{
- if(strh.fccType == FCC('auds')) {
+ if (strh.fccType == FCC('auds')) {
WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
size = nBlockAlign ? (size + (nBlockAlign-1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
}
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp index d7d8a3a16..9802ff28e 100644 --- a/src/filters/parser/AviSplitter/AviReportWnd.cpp +++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp @@ -15,9 +15,9 @@ bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningT m_nChunks = 0;
m_rtDur = 0;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
unsigned int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt == 0) {
+ if (cnt == 0) {
continue;
}
CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
@@ -77,7 +77,7 @@ bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningT //
- if(!fShowWarningText) {
+ if (!fShowWarningText) {
m_message.ShowWindow(SW_HIDE);
m_checkbox.ShowWindow(SW_HIDE);
r = cr;
@@ -122,7 +122,7 @@ void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p) r.bottom -= GRAPHFOOTER;
r2.top = r.bottom;
- if(r.PtInRect(p)) {
+ if (r.PtInRect(p)) {
SetCapture();
int x = p.x - r.left;
@@ -143,18 +143,18 @@ void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p) CString str;
str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
SetWindowText(str);
- } else if(r2.PtInRect(p)) {
+ } else if (r2.PtInRect(p)) {
SetCapture();
int dist = m_graph.GetChunkDist(p.x - r2.left);
CString str;
str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
- if(dist >= 1000) {
+ if (dist >= 1000) {
str += _T(" - over the limit!");
}
str += ")";
SetWindowText(str);
- } else if(GetCapture() == this) {
+ } else if (GetCapture() == this) {
SetWindowText(TITLE);
ReleaseCapture();
@@ -171,7 +171,7 @@ CAviPlotterWnd::CAviPlotterWnd() bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
{
- if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0)) {
+ if (!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0)) {
return false;
}
@@ -191,15 +191,15 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) {
CPen pen(PS_DOT, 1, 0x008000);
CPen* pOldPen = m_dc.SelectObject(&pen);
- for(int y = 0, dy = max(h/10,1); y < h; y += dy) {
- if(y == 0) {
+ for (int y = 0, dy = max(h/10,1); y < h; y += dy) {
+ if (y == 0) {
continue;
}
m_dc.MoveTo(0, y);
m_dc.LineTo(w, y);
}
- for(int x = 0, dx = max(w/10,1); x < w; x += dx) {
- if(x == 0) {
+ for (int x = 0, dx = max(w/10,1); x < w; x += dx) {
+ if (x == 0) {
continue;
}
m_dc.MoveTo(x, 0);
@@ -232,7 +232,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
- for(DWORD i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < pAF->m_avih.dwStreams; ++i, y += dy) {
+ for (DWORD i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < pAF->m_avih.dwStreams; ++i, y += dy) {
m_dc.SetTextColor(clr[i % pAF->m_avih.dwStreams]);
m_dc.SetBkMode(TRANSPARENT);
CString str;
@@ -242,9 +242,9 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) DWORD nmax = 0, tmax = 0;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
unsigned int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt == 0) {
+ if (cnt == 0) {
continue;
}
CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
@@ -252,16 +252,16 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) tmax = max(tmax, c2.t);
}
- if(nmax > 0 && tmax > 0) {
+ if (nmax > 0 && tmax > 0) {
CAtlArray<CPen> pen;
pen.SetCount(pAF->m_avih.dwStreams);
- for(size_t i = 0; i < pen.GetCount(); ++i) {
+ for (size_t i = 0; i < pen.GetCount(); ++i) {
pen[i].CreatePen(PS_SOLID, 2, clr[i]);
}
CAtlArray<CPoint> pp;
pp.SetCount(pAF->m_avih.dwStreams);
- for(size_t i = 0; i < pen.GetCount(); ++i) {
+ for (size_t i = 0; i < pen.GetCount(); ++i) {
pp[i].SetPoint(-1, -1);
}
@@ -273,22 +273,22 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) CAviFile::strm_t::chunk2 cs2last = {(DWORD)-1, 0};
- while(1) {
+ while (1) {
CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
- if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) {
+ if (curchunk >= pAF->m_strms[i]->cs2.GetCount()) {
continue;
}
CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t) {
+ if (cs2.t < cs2min.t) {
cs2min = cs2;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
@@ -296,9 +296,9 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) CPoint p;
p.x = (int)(1.0 * w * cs2min.t / tmax);
p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
- if(pp[n] != p) {
+ if (pp[n] != p) {
CPen* pOldPen = m_dc.SelectObject(&pen[n]);
- if(pp[n] == CPoint(-1, -1)) {
+ if (pp[n] == CPoint(-1, -1)) {
m_dc.MoveTo(p);
} else {
m_dc.MoveTo(pp[n]);
@@ -310,8 +310,8 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) int dist = abs((int)cs2min.n - (int)cs2last.n);
- if(cs2last.t != (DWORD)-1 /*&& dist >= 1000*/) {
- if(p.x >= 0 && p.x < w) {
+ if (cs2last.t != (DWORD)-1 /*&& dist >= 1000*/) {
+ if (p.x >= 0 && p.x < w) {
m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
}
}
@@ -323,7 +323,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) CPen red(PS_SOLID, 1, 0x0000ff);
CPen green(PS_SOLID, 1, 0x00ff00);
- for(int x = 0; x < w; ++x) {
+ for (int x = 0; x < w; ++x) {
CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
m_dc.MoveTo(x, h);
m_dc.LineTo(x, h + GRAPHFOOTER);
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp index 7022434cd..517a02e5d 100644 --- a/src/filters/parser/AviSplitter/AviSplitter.cpp +++ b/src/filters/parser/AviSplitter/AviSplitter.cpp @@ -80,7 +80,7 @@ public: CAviSplitterApp() {}
BOOL InitInstance() {
- if(!__super::InitInstance()) {
+ if (!__super::InitInstance()) {
return FALSE;
}
DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
@@ -137,7 +137,7 @@ STDMETHODIMP CAviSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, AviSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -154,20 +154,20 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_tFrame.Free();
m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
- if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown)) {
+ if (SUCCEEDED(hr) && (fShowWarningText || fShiftDown)) {
#ifdef REGISTER_FILTER
AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
- if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown) {
+ if (!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown) {
CAviReportWnd wnd;
fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
@@ -179,7 +179,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) */
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -189,15 +189,15 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool fHasIndex = false;
- for(unsigned int i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); ++i)
- if(m_pFile->m_strms[i]->cs.GetCount() > 0) {
+ for (unsigned int i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); ++i)
+ if (m_pFile->m_strms[i]->cs.GetCount() > 0) {
fHasIndex = true;
}
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(fHasIndex && s->cs.GetCount() == 0) {
+ if (fHasIndex && s->cs.GetCount() == 0) {
continue;
}
@@ -206,7 +206,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CStringW name, label;
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
label = L"Video";
ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
@@ -214,7 +214,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
mt.majortype = MEDIATYPE_Video;
- switch(pbmi->biCompression) {
+ switch (pbmi->biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -239,13 +239,13 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
memset(mt.Format(), 0, mt.FormatLength());
memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
- if(s->strh.dwRate > 0) {
+ if (s->strh.dwRate > 0) {
pvih->AvgTimePerFrame = 10000000ui64 * s->strh.dwScale / s->strh.dwRate;
}
- if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0) {
+ if (s->cs.GetCount() && pvih->AvgTimePerFrame > 0) {
UINT64 size = 0;
- for(unsigned int i = 0; i < s->cs.GetCount(); ++i) {
+ for (unsigned int i = 0; i < s->cs.GetCount(); ++i) {
size += s->cs[i].orgsize;
}
pvih->dwBitRate = (DWORD)(10000000.0 * size * 8 / (s->cs.GetCount() * pvih->AvgTimePerFrame) + 0.5);
@@ -256,7 +256,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ? s->strh.dwSuggestedBufferSize*3/2
: (pvih->bmiHeader.biWidth*pvih->bmiHeader.biHeight*4));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva')) {
+ } else if (s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva')) {
label = L"Audio";
ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
@@ -264,7 +264,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) WAVEFORMATEX* pwfe = (WAVEFORMATEX*)s->strf.GetData();
- if(pwfe->nBlockAlign == 0) {
+ if (pwfe->nBlockAlign == 0) {
continue;
}
@@ -277,20 +277,20 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mt.formattype = FORMAT_WaveFormatEx;
mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
pwfe = (WAVEFORMATEX*)mt.Format();
- if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) {
+ if (s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) {
pwfe->cbSize = 0;
}
- if(pwfe->wFormatTag == WAVE_FORMAT_PCM) {
+ if (pwfe->wFormatTag == WAVE_FORMAT_PCM) {
pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
}
- if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
+ if (pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
}
mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
? s->strh.dwSuggestedBufferSize*3/2
: (pwfe->nChannels*pwfe->nSamplesPerSec*32>>3));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('mids')) {
+ } else if (s->strh.fccType == FCC('mids')) {
label = L"Midi";
mt.majortype = MEDIATYPE_Midi;
@@ -300,7 +300,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ? s->strh.dwSuggestedBufferSize*3/2
: (1024*1024));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('txts')) {
+ } else if (s->strh.fccType == FCC('txts')) {
label = L"Text";
mt.majortype = MEDIATYPE_Text;
@@ -310,7 +310,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ? s->strh.dwSuggestedBufferSize*3/2
: (1024*1024));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('iavs')) {
+ } else if (s->strh.fccType == FCC('iavs')) {
label = L"Interleaved";
ASSERT(s->strh.fccHandler == FCC('dvsd'));
@@ -325,7 +325,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
continue;
}
@@ -333,7 +333,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) //Put filename at front sometime(eg. ~temp.avi) will cause filter graph
//stop check this pin. Not sure the reason exactly. but it happens.
//If you know why, please emailto: tomasen@gmail.com
- if(s->strn.IsEmpty()) {
+ if (s->strn.IsEmpty()) {
name.Format(L"%s %u", label, i);
} else {
name.Format(L"%s (%s %u)", CStringW(s->strn), label, i);
@@ -346,12 +346,12 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
POSITION pos = m_pFile->m_info.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD fcc;
CStringA value;
m_pFile->m_info.GetNextAssoc(pos, fcc, value);
- switch(fcc) {
+ switch (fcc) {
case FCC('INAM'):
SetProperty(L"TITL", CStringW(value));
break;
@@ -376,7 +376,7 @@ bool CAviSplitterFilter::DemuxInit() {
SetThreadName((DWORD)-1, "CAviSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -384,13 +384,13 @@ bool CAviSplitterFilter::DemuxInit() bool fReIndex = false;
- for(DWORD i = 0; i < m_pFile->m_avih.dwStreams && !fReIndex; ++i) {
- if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i)) {
+ for (DWORD i = 0; i < m_pFile->m_avih.dwStreams && !fReIndex; ++i) {
+ if (m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i)) {
fReIndex = true;
}
}
- if(fReIndex) {
+ if (fReIndex) {
m_pFile->EmptyIndex();
m_fAbort = false;
@@ -404,7 +404,7 @@ bool CAviSplitterFilter::DemuxInit() m_pFile->Seek(0);
ReIndex(m_pFile->GetLength(), pSize);
- if(m_fAbort) {
+ if (m_fAbort) {
m_pFile->EmptyIndex();
}
@@ -419,37 +419,37 @@ HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize) {
HRESULT hr = S_OK;
- while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort) {
+ while (S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort) {
__int64 pos = m_pFile->GetPos();
DWORD id = 0, size;
- if(S_OK != m_pFile->Read(id) || id == 0) {
+ if (S_OK != m_pFile->Read(id) || id == 0) {
return E_FAIL;
}
- if(id == FCC('RIFF') || id == FCC('LIST')) {
- if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id)) {
+ if (id == FCC('RIFF') || id == FCC('LIST')) {
+ if (S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id)) {
return E_FAIL;
}
size += (size&1) + 8;
- if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec ')) {
+ if (id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec ')) {
hr = ReIndex(pos + size, pSize);
}
} else {
- if(S_OK != m_pFile->Read(size)) {
+ if (S_OK != m_pFile->Read(size)) {
return E_FAIL;
}
DWORD TrackNumber = TRACKNUM(id);
- if(TrackNumber < m_pFile->m_strms.GetCount()) {
+ if (TrackNumber < m_pFile->m_strms.GetCount()) {
CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
WORD type = TRACKTYPE(id);
- if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
+ if (type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
|| type == 'iv' || type == '__' || type == 'xx') {
CAviFile::strm_t::chunk c;
c.filepos = pos;
@@ -474,8 +474,8 @@ HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize) m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
@@ -493,26 +493,26 @@ void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt) DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt/10000));
- if(rt > 0) {
+ if (rt > 0) {
UINT64 minfp = _I64_MAX;
- for(unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
+ for (unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
DWORD f = s->GetKeyFrame(rt);
UINT64 fp = s->cs[f].filepos;
- if(!s->IsRawSubtitleStream()) {
+ if (!s->IsRawSubtitleStream()) {
minfp = min(minfp, fp);
}
}
- for(unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
+ for (unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
- for(unsigned int i = 0; i < s->cs.GetCount(); ++i) {
+ for (unsigned int i = 0; i < s->cs.GetCount(); ++i) {
CAviFile::strm_t::chunk& c = s->cs[i];
- if(c.filepos >= minfp) {
+ if (c.filepos >= minfp) {
m_tFrame[j] = i;
break;
}
@@ -532,31 +532,31 @@ bool CAviSplitterFilter::DemuxLoop() fDiscontinuity.SetCount(nTracks);
memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
unsigned int minTrack = nTracks;
UINT64 minFilePos = _I64_MAX;
- for(unsigned int i = 0; i < nTracks; ++i) {
+ for (unsigned int i = 0; i < nTracks; ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
DWORD f = m_tFrame[i];
- if(f >= (DWORD)s->cs.GetCount()) {
+ if (f >= (DWORD)s->cs.GetCount()) {
continue;
}
bool fUrgent = s->IsRawSubtitleStream();
- if(fUrgent || s->cs[f].filepos < minFilePos) {
+ if (fUrgent || s->cs[f].filepos < minFilePos) {
minTrack = i;
minFilePos = s->cs[f].filepos;
}
- if(fUrgent) {
+ if (fUrgent) {
break;
}
}
- if(minTrack == nTracks) {
+ if (minTrack == nTracks) {
break;
}
@@ -569,9 +569,9 @@ bool CAviSplitterFilter::DemuxLoop() DWORD size = 0;
- if(s->cs[f].fChunkHdr) {
+ if (s->cs[f].fChunkHdr) {
DWORD id = 0;
- if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
+ if (S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
|| S_OK != m_pFile->Read(size)) {
fDiscontinuity[minTrack] = true;
break;
@@ -582,7 +582,7 @@ bool CAviSplitterFilter::DemuxLoop() ? s->cs[f+1].size - s->cs[f].size
: s->totalsize - s->cs[f].size;
- if(expectedsize != s->GetChunkSize(size)) {
+ if (expectedsize != s->GetChunkSize(size)) {
fDiscontinuity[minTrack] = true;
//ASSERT(0);
break;
@@ -600,7 +600,7 @@ bool CAviSplitterFilter::DemuxLoop() p->rtStop = s->GetRefTime(f+1, f+1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
p->SetCount(size);
- if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount()))) {
+ if (S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount()))) {
return true; // break;
}
/*
@@ -613,7 +613,7 @@ bool CAviSplitterFilter::DemuxLoop() hr = DeliverPacket(p);
fDiscontinuity[minTrack] = false;
- } while(0);
+ } while (0);
++f;
}
@@ -628,10 +628,10 @@ STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration) CheckPointer(pDuration, E_POINTER);
CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
- if(m_timeformat == TIME_FORMAT_FRAME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ if (m_timeformat == TIME_FORMAT_FRAME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
*pDuration = s->cs.GetCount();
return S_OK;
}
@@ -649,7 +649,7 @@ STDMETHODIMP CAviSplitterFilter::IsFormatSupported(const GUID* pFormat) {
CheckPointer(pFormat, E_POINTER);
HRESULT hr = __super::IsFormatSupported(pFormat);
- if(S_OK == hr) {
+ if (S_OK == hr) {
return hr;
}
return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
@@ -671,7 +671,7 @@ STDMETHODIMP CAviSplitterFilter::IsUsingTimeFormat(const GUID* pFormat) STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
{
CheckPointer(pFormat, E_POINTER);
- if(S_OK != IsFormatSupported(pFormat)) {
+ if (S_OK != IsFormatSupported(pFormat)) {
return E_FAIL;
}
m_timeformat = *pFormat;
@@ -681,14 +681,14 @@ STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat) STDMETHODIMP CAviSplitterFilter::GetStopPosition(LONGLONG* pStop)
{
CheckPointer(pStop, E_POINTER);
- if(FAILED(__super::GetStopPosition(pStop))) {
+ if (FAILED(__super::GetStopPosition(pStop))) {
return E_FAIL;
}
- if(m_timeformat == TIME_FORMAT_MEDIA_TIME) {
+ if (m_timeformat == TIME_FORMAT_MEDIA_TIME) {
return S_OK;
}
LONGLONG rt = *pStop;
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) {
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
return S_OK;
@@ -701,22 +701,22 @@ STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
- if(TargetFormat == SourceFormat) {
+ if (TargetFormat == SourceFormat) {
*pTarget = Source;
return S_OK;
- } else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ } else if (TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
*pTarget = s->GetFrame(Source);
return S_OK;
}
}
- } else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ } else if (TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
- if(Source < 0 || Source >= s->cs.GetCount()) {
+ if (s->strh.fccType == FCC('vids')) {
+ if (Source < 0 || Source >= s->cs.GetCount()) {
return E_FAIL;
}
CAviFile::strm_t::chunk& c = s->cs[(size_t)Source];
@@ -732,16 +732,16 @@ STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
HRESULT hr;
- if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME) {
+ if (FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME) {
return hr;
}
- if(pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) {
+ if (pCurrent)
+ if (FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if(pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) {
+ if (pStop)
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
@@ -750,11 +750,11 @@ STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pSto HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- if(m_timeformat != TIME_FORMAT_FRAME) {
+ if (m_timeformat != TIME_FORMAT_FRAME) {
return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
- if(!pCurrent && !pStop
+ if (!pCurrent && !pStop
|| (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
&& (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) {
return S_OK;
@@ -764,17 +764,17 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D rtCurrent = m_rtCurrent,
rtStop = m_rtStop;
- if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
&& FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwStopFlags&AM_SEEKING_PositioningBitsMask)
&& FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if(pCurrent)
- switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pCurrent)
+ switch (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -788,8 +788,8 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D break;
}
- if(pStop)
- switch(dwStopFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pStop)
+ switch (dwStopFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -803,14 +803,14 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D break;
}
- if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
&& pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) {
+ if (FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) {
return E_FAIL;
}
- if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwStopFlags&AM_SEEKING_PositioningBitsMask)
&& pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) {
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) {
return E_FAIL;
}
@@ -821,7 +821,7 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
@@ -829,20 +829,20 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs) nKFs = 0;
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) {
+ if (s->strh.fccType != FCC('vids')) {
continue;
}
- for(unsigned int j = 0; j < s->cs.GetCount(); ++j) {
+ for (unsigned int j = 0; j < s->cs.GetCount(); ++j) {
CAviFile::strm_t::chunk& c = s->cs[j];
- if(c.fKeyFrame) {
+ if (c.fKeyFrame) {
++nKFs;
}
}
- if(nKFs == s->cs.GetCount()) {
+ if (nKFs == s->cs.GetCount()) {
hr = S_FALSE;
}
@@ -857,25 +857,25 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) {
+ if (s->strh.fccType != FCC('vids')) {
continue;
}
bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
- for(unsigned int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; ++j) {
- if(s->cs[j].fKeyFrame) {
+ for (unsigned int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; ++j) {
+ if (s->cs[j].fKeyFrame) {
pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
}
}
@@ -912,13 +912,13 @@ HRESULT CAviSplitterOutputPin::CheckConnect(IPin* pPin) {
int iPosition = 0;
CMediaType mt;
- while(S_OK == GetMediaType(iPosition++, &mt)) {
- if(mt.majortype == MEDIATYPE_Video
+ while (S_OK == GetMediaType(iPosition++, &mt)) {
+ if (mt.majortype == MEDIATYPE_Video
&& (mt.subtype == FOURCCMap(FCC('IV32'))
|| mt.subtype == FOURCCMap(FCC('IV31'))
|| mt.subtype == FOURCCMap(FCC('IF09')))) {
CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
- if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer) {
+ if (clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer) {
return E_FAIL;
}
}
diff --git a/src/filters/parser/BaseSplitter/AsyncReader.cpp b/src/filters/parser/BaseSplitter/AsyncReader.cpp index c0217ae4d..42be1f26c 100644 --- a/src/filters/parser/BaseSplitter/AsyncReader.cpp +++ b/src/filters/parser/BaseSplitter/AsyncReader.cpp @@ -37,7 +37,7 @@ CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr) , m_lOsError(0)
{
hr = Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_len = GetLength();
}
}
@@ -49,7 +49,7 @@ CAsyncFileReader::CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items, , m_lOsError(0)
{
hr = OpenFiles(Items, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_len = GetLength();
}
}
@@ -71,44 +71,44 @@ STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE* {
do {
try {
- if((ULONGLONG)llPosition+lLength > GetLength()) {
+ if ((ULONGLONG)llPosition+lLength > GetLength()) {
return E_FAIL; // strange, but the Seek below can return llPosition even if the file is not that big (?)
}
- if((ULONGLONG)llPosition != Seek(llPosition, begin)) {
+ if ((ULONGLONG)llPosition != Seek(llPosition, begin)) {
return E_FAIL;
}
- if((UINT)lLength < Read(pBuffer, lLength)) {
+ if ((UINT)lLength < Read(pBuffer, lLength)) {
return E_FAIL;
}
#if 0 // def DEBUG
static __int64 s_total = 0, s_laststoppos = 0;
s_total += lLength;
- if(s_laststoppos > llPosition) {
+ if (s_laststoppos > llPosition) {
TRACE(_T("[%I64d - %I64d] %d (%I64d)\n"), llPosition, llPosition + lLength, lLength, s_total);
}
s_laststoppos = llPosition + lLength;
#endif
return S_OK;
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
m_lOsError = e->m_lOsError;
e->Delete();
Sleep(1);
CString fn = m_strFileName;
try {
Close();
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
e->Delete();
}
try {
Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan);
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
e->Delete();
}
m_strFileName = fn;
}
- } while(m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
+ } while (m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
return E_FAIL;
}
@@ -116,10 +116,10 @@ STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE* STDMETHODIMP CAsyncFileReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
LONGLONG len = m_len >= 0 ? m_len : GetLength();
- if(pTotal) {
+ if (pTotal) {
*pTotal = len;
}
- if(pAvailable) {
+ if (pAvailable) {
*pAvailable = len;
}
return S_OK;
@@ -144,13 +144,13 @@ STDMETHODIMP_(LPCTSTR) CAsyncFileReader::GetFileName() CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
: CAsyncFileReader(url, hr)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
return;
}
m_url = url;
- if(CAMThread::Create()) {
+ if (CAMThread::Create()) {
CallWorker(CMD_INIT);
}
@@ -160,11 +160,11 @@ CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr) CAsyncUrlReader::~CAsyncUrlReader()
{
- if(ThreadExists()) {
+ if (ThreadExists()) {
CallWorker(CMD_EXIT);
}
- if(!m_fn.IsEmpty()) {
+ if (!m_fn.IsEmpty()) {
CMultiFiles::Close();
DeleteFile(m_fn);
}
@@ -174,7 +174,7 @@ CAsyncUrlReader::~CAsyncUrlReader() STDMETHODIMP CAsyncUrlReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
- if(pTotal) {
+ if (pTotal) {
*pTotal = 0;
}
return __super::Length(NULL, pAvailable);
@@ -187,7 +187,7 @@ DWORD CAsyncUrlReader::ThreadProc() AfxSocketInit(NULL);
DWORD cmd = GetRequest();
- if(cmd != CMD_INIT) {
+ if (cmd != CMD_INIT) {
Reply((DWORD)E_FAIL);
return (DWORD)-1;
}
@@ -198,21 +198,21 @@ DWORD CAsyncUrlReader::ThreadProc() TCHAR path[_MAX_PATH], fn[_MAX_PATH];
CFile fout;
- if(GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
+ if (GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
&& fout.Open(fn, modeCreate|modeWrite|shareDenyWrite|typeBinary)) {
m_fn = fn;
char buff[1024];
int len = fin->Read(buff, sizeof(buff));
- if(len > 0) {
+ if (len > 0) {
fout.Write(buff, len);
}
Reply(S_OK);
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
int len = fin->Read(buff, sizeof(buff));
- if(len > 0) {
+ if (len > 0) {
fout.Write(buff, len);
}
}
@@ -221,7 +221,7 @@ DWORD CAsyncUrlReader::ThreadProc() }
fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
- } catch(CInternetException* ie) {
+ } catch (CInternetException* ie) {
ie->Delete();
Reply((DWORD)E_FAIL);
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.cpp b/src/filters/parser/BaseSplitter/BaseSplitter.cpp index 589dd2d2f..6c621ff2d 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitter.cpp @@ -44,10 +44,10 @@ void CPacketQueue::Add(CAutoPtr<Packet> p) {
CAutoLock cAutoLock(this);
- if(p) {
+ if (p) {
m_size += p->GetDataSize();
- if(p->bAppendable && !p->bDiscontinuity && !p->pmt
+ if (p->bAppendable && !p->bDiscontinuity && !p->pmt
&& p->rtStart == Packet::INVALID_TIME
&& !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME) {
Packet* tail = GetTail();
@@ -70,7 +70,7 @@ CAutoPtr<Packet> CPacketQueue::Remove() CAutoLock cAutoLock(this);
ASSERT(__super::GetCount() > 0);
CAutoPtr<Packet> p = RemoveHead();
- if(p) {
+ if (p) {
m_size -= p->GetDataSize();
}
return p;
@@ -138,7 +138,7 @@ HRESULT CBaseSplitterInputPin::CheckMediaType(const CMediaType* pmt) HRESULT CBaseSplitterInputPin::CheckConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
@@ -149,11 +149,11 @@ HRESULT CBaseSplitterInputPin::BreakConnect() {
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this))) {
+ if (FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this))) {
return hr;
}
@@ -166,7 +166,7 @@ HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin) {
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
@@ -174,7 +174,7 @@ HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin) m_pAsyncReader = pPin;
CheckPointer(m_pAsyncReader, E_NOINTERFACE);
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this))) {
+ if (FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this))) {
return hr;
}
@@ -239,7 +239,7 @@ STDMETHODIMP CBaseSplitterOutputPin::NonDelegatingQueryInterface(REFIID riid, vo HRESULT CBaseSplitterOutputPin::SetName(LPCWSTR pName)
{
CheckPointer(pName, E_POINTER);
- if(m_pName) {
+ if (m_pName) {
delete [] m_pName;
}
m_pName = DNew WCHAR[wcslen(pName)+1];
@@ -259,17 +259,17 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO pProperties->cbBuffer = max(m_mt.lSampleSize, 1);
// TODO: is this still needed ?
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat) {
+ if (m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat) {
// oh great, the oggds vorbis decoder assumes there will be two at least, stupid thing...
pProperties->cBuffers = max(pProperties->cBuffers, 2);
}
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -279,8 +279,8 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO HRESULT CBaseSplitterOutputPin::CheckMediaType(const CMediaType* pmt)
{
- for(size_t i = 0; i < m_mts.GetCount(); i++) {
- if(*pmt == m_mts[i]) {
+ for (size_t i = 0; i < m_mts.GetCount(); i++) {
+ if (*pmt == m_mts[i]) {
return S_OK;
}
}
@@ -292,10 +292,10 @@ HRESULT CBaseSplitterOutputPin::GetMediaType(int iPosition, CMediaType* pmt) {
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if((size_t)iPosition >= m_mts.GetCount()) {
+ if ((size_t)iPosition >= m_mts.GetCount()) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -315,7 +315,7 @@ HRESULT CBaseSplitterOutputPin::Active() {
CAutoLock cAutoLock(m_pLock);
- if(m_Connected) {
+ if (m_Connected) {
Create();
}
@@ -326,7 +326,7 @@ HRESULT CBaseSplitterOutputPin::Inactive() {
CAutoLock cAutoLock(m_pLock);
- if(ThreadExists()) {
+ if (ThreadExists()) {
CallWorker(CMD_EXIT);
}
@@ -341,7 +341,7 @@ HRESULT CBaseSplitterOutputPin::DeliverBeginFlush() m_hrDeliver = S_FALSE;
m_queue.RemoveAll();
HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
- if(S_OK != hr) {
+ if (S_OK != hr) {
m_eEndFlush.Set();
}
return(hr);
@@ -349,7 +349,7 @@ HRESULT CBaseSplitterOutputPin::DeliverBeginFlush() HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
{
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
@@ -363,15 +363,15 @@ HRESULT CBaseSplitterOutputPin::DeliverEndFlush() HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
- if(m_fFlushing) {
+ if (m_fFlushing) {
return S_FALSE;
}
m_rtStart = tStart;
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
MakeISCRHappy();
@@ -395,17 +395,17 @@ HRESULT CBaseSplitterOutputPin::QueueEndOfStream() HRESULT CBaseSplitterOutputPin::QueuePacket(CAutoPtr<Packet> p)
{
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
- while(S_OK == m_hrDeliver
+ while (S_OK == m_hrDeliver
&& (!(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()
|| m_queue.GetSize() > MAXPACKETSIZE*100)) {
Sleep(1);
}
- if(S_OK != m_hrDeliver) {
+ if (S_OK != m_hrDeliver) {
return m_hrDeliver;
}
@@ -430,11 +430,11 @@ bool CBaseSplitterOutputPin::IsActive() do {
CComPtr<IPin> pPinTo;
CComQIPtr<IStreamSwitcherInputPin> pSSIP;
- if(S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive()) {
+ if (S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive()) {
return false;
}
pPin = GetFirstPin(GetFilterFromPin(pPinTo), PINDIR_OUTPUT);
- } while(pPin);
+ } while (pPin);
return true;
}
@@ -449,25 +449,25 @@ DWORD CBaseSplitterOutputPin::ThreadProc() // fix for Microsoft DTV-DVD Video Decoder - video freeze after STOP/PLAY
bool iHaaliRenderConnect = false;
CComPtr<IPin> pPinTo = this, pTmp;
- while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
+ while (pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
pTmp = NULL;
CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
- if(GetCLSID(pBF) == CLSID_DXR) { // Haali Renderer
+ if (GetCLSID(pBF) == CLSID_DXR) { // Haali Renderer
iHaaliRenderConnect = true;
break;
}
pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
}
- if(IsConnected() && !iHaaliRenderConnect) {
+ if (IsConnected() && !iHaaliRenderConnect) {
GetConnected()->BeginFlush();
GetConnected()->EndFlush();
}
- while(1) {
+ while (1) {
Sleep(1);
DWORD cmd;
- if(CheckRequest(&cmd)) {
+ if (CheckRequest(&cmd)) {
m_hThread = NULL;
cmd = GetRequest();
Reply(S_OK);
@@ -481,12 +481,12 @@ DWORD CBaseSplitterOutputPin::ThreadProc() {
CAutoLock cAutoLock(&m_queue);
- if((cnt = m_queue.GetCount()) > 0) {
+ if ((cnt = m_queue.GetCount()) > 0) {
p = m_queue.Remove();
}
}
- if(S_OK == m_hrDeliver && cnt > 0) {
+ if (S_OK == m_hrDeliver && cnt > 0) {
ASSERT(!m_fFlushing);
m_fFlushed = false;
@@ -499,13 +499,13 @@ DWORD CBaseSplitterOutputPin::ThreadProc() m_eEndFlush.Wait(); // .. so we have to wait until it is done
- if(hr != S_OK && !m_fFlushed) { // and only report the error in m_hrDeliver if we didn't flush the stream
+ if (hr != S_OK && !m_fFlushed) { // and only report the error in m_hrDeliver if we didn't flush the stream
// CAutoLock cAutoLock(&m_csQueueLock);
m_hrDeliver = hr;
break;
}
}
- } while(--cnt > 0);
+ } while (--cnt > 0);
}
}
@@ -515,19 +515,19 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) INT_PTR nBytes = p->GetCount();
- if(nBytes == 0) {
+ if (nBytes == 0) {
return S_OK;
}
m_brs.nBytesSinceLastDeliverTime += nBytes;
- if(p->rtStart != Packet::INVALID_TIME) {
- if(m_brs.rtLastDeliverTime == Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
+ if (m_brs.rtLastDeliverTime == Packet::INVALID_TIME) {
m_brs.rtLastDeliverTime = p->rtStart;
m_brs.nBytesSinceLastDeliverTime = 0;
}
- if(m_brs.rtLastDeliverTime + 10000000 < p->rtStart) {
+ if (m_brs.rtLastDeliverTime + 10000000 < p->rtStart) {
REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
double secs, bits;
@@ -554,7 +554,7 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
double dRate = 1.0;
- if(SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate))) {
+ if (SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate))) {
p->rtStart = (REFERENCE_TIME)((double)p->rtStart / dRate);
p->rtStop = (REFERENCE_TIME)((double)p->rtStop / dRate);
}
@@ -562,43 +562,43 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) do {
CComPtr<IMediaSample> pSample;
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
+ if (S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
break;
}
- if(nBytes > pSample->GetSize()) {
+ if (nBytes > pSample->GetSize()) {
pSample.Release();
ALLOCATOR_PROPERTIES props, actual;
- if(S_OK != (hr = m_pAllocator->GetProperties(&props))) {
+ if (S_OK != (hr = m_pAllocator->GetProperties(&props))) {
break;
}
props.cbBuffer = nBytes*3/2;
- if(props.cBuffers > 1) {
- if(S_OK != (hr = __super::DeliverBeginFlush())) {
+ if (props.cBuffers > 1) {
+ if (S_OK != (hr = __super::DeliverBeginFlush())) {
break;
}
- if(S_OK != (hr = __super::DeliverEndFlush())) {
+ if (S_OK != (hr = __super::DeliverEndFlush())) {
break;
}
}
- if(S_OK != (hr = m_pAllocator->Decommit())) {
+ if (S_OK != (hr = m_pAllocator->Decommit())) {
break;
}
- if(S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) {
+ if (S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) {
break;
}
- if(S_OK != (hr = m_pAllocator->Commit())) {
+ if (S_OK != (hr = m_pAllocator->Commit())) {
break;
}
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
+ if (S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
break;
}
}
- if(p->pmt) {
+ if (p->pmt) {
pSample->SetMediaType(p->pmt);
p->bDiscontinuity = true;
@@ -619,32 +619,32 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) ASSERT(!p->bSyncPoint || fTimeValid);
BYTE* pData = NULL;
- if(S_OK != (hr = pSample->GetPointer(&pData)) || !pData) {
+ if (S_OK != (hr = pSample->GetPointer(&pData)) || !pData) {
break;
}
memcpy(pData, p->GetData(), nBytes);
- if(S_OK != (hr = pSample->SetActualDataLength(nBytes))) {
+ if (S_OK != (hr = pSample->SetActualDataLength(nBytes))) {
break;
}
- if(S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) {
+ if (S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) {
break;
}
- if(S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) {
+ if (S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) {
break;
}
- if(S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) {
+ if (S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) {
break;
}
- if(S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) {
+ if (S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) {
break;
}
- if(S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) {
+ if (S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) {
break;
}
- if(S_OK != (hr = Deliver(pSample))) {
+ if (S_OK != (hr = Deliver(pSample))) {
break;
}
- } while(false);
+ } while (false);
return hr;
}
@@ -652,12 +652,12 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) void CBaseSplitterOutputPin::MakeISCRHappy()
{
CComPtr<IPin> pPinTo = this, pTmp;
- while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
+ while (pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
pTmp = NULL;
CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
- if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) { // ISCR
+ if (GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) { // ISCR
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)-1;
p->rtStart = -1;
@@ -783,7 +783,7 @@ CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* , m_rtLastStop(_I64_MIN)
, m_priority(THREAD_PRIORITY_NORMAL)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -804,7 +804,7 @@ STDMETHODIMP CBaseSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void* *ppv = NULL;
- if(m_pInput && riid == __uuidof(IFileSourceFilter)) {
+ if (m_pInput && riid == __uuidof(IFileSourceFilter)) {
return E_NOINTERFACE;
}
@@ -838,11 +838,11 @@ DWORD CBaseSplitterFilter::GetOutputTrackNum(CBaseSplitterOutputPin* pPin) CAutoLock cAutoLock(&m_csPinMap);
POSITION pos = m_pPinMap.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNum;
CBaseSplitterOutputPin* pPinTmp;
m_pPinMap.GetNextAssoc(pos, TrackNum, pPinTmp);
- if(pPinTmp == pPin) {
+ if (pPinTmp == pPin) {
return TrackNum;
}
}
@@ -855,9 +855,9 @@ HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDs CAutoLock cAutoLock(&m_csPinMap);
CBaseSplitterOutputPin* pPin;
- if(m_pPinMap.Lookup(TrackNumSrc, pPin)) {
- if(CComQIPtr<IPin> pPinTo = pPin->GetConnected()) {
- if(pmt && S_OK != pPinTo->QueryAccept(pmt)) {
+ if (m_pPinMap.Lookup(TrackNumSrc, pPin)) {
+ if (CComQIPtr<IPin> pPinTo = pPin->GetConnected()) {
+ if (pmt && S_OK != pPinTo->QueryAccept(pmt)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -865,7 +865,7 @@ HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDs m_pPinMap.RemoveKey(TrackNumSrc);
m_pPinMap[TrackNumDst] = pPin;
- if(pmt) {
+ if (pmt) {
CAutoLock cAutoLock(&m_csmtnew);
m_mtnew[TrackNumDst] = *pmt;
}
@@ -880,7 +880,7 @@ HRESULT CBaseSplitterFilter::AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitter {
CAutoLock cAutoLock(&m_csPinMap);
- if(!pPin) {
+ if (!pPin) {
return E_INVALIDARG;
}
m_pPinMap[TrackNum] = pPin;
@@ -895,13 +895,13 @@ HRESULT CBaseSplitterFilter::DeleteOutputs() m_pRetiredOutputs.RemoveAll();
CAutoLock cAutoLockF(this);
- if(m_State != State_Stopped) {
+ if (m_State != State_Stopped) {
return VFW_E_NOT_STOPPED;
}
- while(m_pOutputs.GetCount()) {
+ while (m_pOutputs.GetCount()) {
CAutoPtr<CBaseSplitterOutputPin> pPin = m_pOutputs.RemoveHead();
- if(IPin* pPinTo = pPin->GetConnected()) {
+ if (IPin* pPinTo = pPin->GetConnected()) {
pPinTo->Disconnect();
}
pPin->Disconnect();
@@ -930,7 +930,7 @@ void CBaseSplitterFilter::DeliverBeginFlush() {
m_fFlushing = true;
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->DeliverBeginFlush();
}
}
@@ -938,7 +938,7 @@ void CBaseSplitterFilter::DeliverBeginFlush() void CBaseSplitterFilter::DeliverEndFlush()
{
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->DeliverEndFlush();
}
m_fFlushing = false;
@@ -947,18 +947,18 @@ void CBaseSplitterFilter::DeliverEndFlush() DWORD CBaseSplitterFilter::ThreadProc()
{
- if(m_pSyncReader) {
+ if (m_pSyncReader) {
m_pSyncReader->SetBreakEvent(GetRequestHandle());
}
- if(!DemuxInit()) {
- while(1) {
+ if (!DemuxInit()) {
+ while (1) {
DWORD cmd = GetRequest();
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
CAMThread::m_hThread = NULL;
}
Reply(S_OK);
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
return 0;
}
}
@@ -967,8 +967,8 @@ DWORD CBaseSplitterFilter::ThreadProc() m_eEndFlush.Set();
m_fFlushing = false;
- for(DWORD cmd = (DWORD)-1; ; cmd = GetRequest()) {
- if(cmd == CMD_EXIT) {
+ for (DWORD cmd = (DWORD)-1; ; cmd = GetRequest()) {
+ if (cmd == CMD_EXIT) {
m_hThread = NULL;
Reply(S_OK);
return 0;
@@ -981,7 +981,7 @@ DWORD CBaseSplitterFilter::ThreadProc() DemuxSeek(m_rtStart);
- if(cmd != (DWORD)-1) {
+ if (cmd != (DWORD)-1) {
Reply(S_OK);
}
@@ -990,9 +990,9 @@ DWORD CBaseSplitterFilter::ThreadProc() m_pActivePins.RemoveAll();
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !m_fFlushing) {
+ while (pos && !m_fFlushing) {
CBaseSplitterOutputPin* pPin = m_pOutputs.GetNext(pos);
- if(pPin->IsConnected() && pPin->IsActive()) {
+ if (pPin->IsConnected() && pPin->IsActive()) {
m_pActivePins.AddTail(pPin);
pPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
}
@@ -1000,10 +1000,10 @@ DWORD CBaseSplitterFilter::ThreadProc() do {
m_bDiscontinuitySent.RemoveAll();
- } while(!DemuxLoop());
+ } while (!DemuxLoop());
pos = m_pActivePins.GetHeadPosition();
- while(pos && !CheckRequest(&cmd)) {
+ while (pos && !CheckRequest(&cmd)) {
m_pActivePins.GetNext(pos)->QueueEndOfStream();
}
}
@@ -1019,11 +1019,11 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p) HRESULT hr = S_FALSE;
CBaseSplitterOutputPin* pPin = GetOutputPin(p->TrackNumber);
- if(!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin)) {
+ if (!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin)) {
return S_FALSE;
}
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_rtCurrent = p->rtStart;
p->rtStart -= m_rtStart;
@@ -1036,13 +1036,13 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p) CAutoLock cAutoLock(&m_csmtnew);
CMediaType mt;
- if(m_mtnew.Lookup(p->TrackNumber, mt)) {
+ if (m_mtnew.Lookup(p->TrackNumber, mt)) {
p->pmt = CreateMediaType(&mt);
m_mtnew.RemoveKey(p->TrackNumber);
}
}
- if(!m_bDiscontinuitySent.Find(p->TrackNumber)) {
+ if (!m_bDiscontinuitySent.Find(p->TrackNumber)) {
p->bDiscontinuity = TRUE;
}
@@ -1059,19 +1059,19 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p) hr = pPin->QueuePacket(p);
- if(S_OK != hr) {
- if(POSITION pos = m_pActivePins.Find(pPin)) {
+ if (S_OK != hr) {
+ if (POSITION pos = m_pActivePins.Find(pPin)) {
m_pActivePins.RemoveAt(pos);
}
- if(!m_pActivePins.IsEmpty()) { // only die when all pins are down
+ if (!m_pActivePins.IsEmpty()) { // only die when all pins are down
hr = S_OK;
}
return hr;
}
- if(bDiscontinuity) {
+ if (bDiscontinuity) {
m_bDiscontinuitySent.AddTail(TrackNumber);
}
@@ -1083,16 +1083,16 @@ bool CBaseSplitterFilter::IsAnyPinDrying() int totalcount = 0, totalsize = 0;
POSITION pos = m_pActivePins.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos);
int count = pPin->QueueCount();
int size = pPin->QueueSize();
- if(!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE)) {
+ if (!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE)) {
// if(m_priority != THREAD_PRIORITY_ABOVE_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
- if(m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3)) {
+ if (m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3)) {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
}
m_priority = THREAD_PRIORITY_BELOW_NORMAL;
@@ -1103,16 +1103,16 @@ bool CBaseSplitterFilter::IsAnyPinDrying() totalsize += size;
}
- if(m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
+ if (m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL);
}
m_priority = THREAD_PRIORITY_NORMAL;
}
- if(totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE) {
+ if (totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE) {
return true;
}
@@ -1123,9 +1123,9 @@ HRESULT CBaseSplitterFilter::BreakConnect(PIN_DIRECTION dir, CBasePin* pPin) {
CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
DeleteOutputs();
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
} else {
return E_UNEXPECTED;
}
@@ -1137,13 +1137,13 @@ HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin) {
CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CBaseSplitterInputPin* pIn = static_cast<CBaseSplitterInputPin*>(pPin);
HRESULT hr;
CComPtr<IAsyncReader> pAsyncReader;
- if(FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
+ if (FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
|| FAILED(hr = DeleteOutputs())
|| FAILED(hr = CreateOutputs(pAsyncReader))) {
return hr;
@@ -1152,7 +1152,7 @@ HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin) ChapSort();
m_pSyncReader = pAsyncReader;
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
m_pRetiredOutputs.RemoveAll();
} else {
return E_UNEXPECTED;
@@ -1170,13 +1170,13 @@ CBasePin* CBaseSplitterFilter::GetPin(int n) {
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pOutputs.GetCount()) {
- if(POSITION pos = m_pOutputs.FindIndex(n)) {
+ if (n >= 0 && n < (int)m_pOutputs.GetCount()) {
+ if (POSITION pos = m_pOutputs.FindIndex(n)) {
return m_pOutputs.GetAt(pos);
}
}
- if(n == (int)m_pOutputs.GetCount() && m_pInput) {
+ if (n == (int)m_pOutputs.GetCount() && m_pInput) {
return m_pInput;
}
@@ -1192,7 +1192,7 @@ STDMETHODIMP CBaseSplitterFilter::Stop() DeliverEndFlush();
HRESULT hr;
- if(FAILED(hr = __super::Stop())) {
+ if (FAILED(hr = __super::Stop())) {
return hr;
}
@@ -1206,11 +1206,11 @@ STDMETHODIMP CBaseSplitterFilter::Pause() FILTER_STATE fs = m_State;
HRESULT hr;
- if(FAILED(hr = __super::Pause())) {
+ if (FAILED(hr = __super::Pause())) {
return hr;
}
- if(fs == State_Stopped) {
+ if (fs == State_Stopped) {
Create();
}
@@ -1222,7 +1222,7 @@ STDMETHODIMP CBaseSplitterFilter::Run(REFERENCE_TIME tStart) CAutoLock cAutoLock(this);
HRESULT hr;
- if(FAILED(hr = __super::Run(tStart))) {
+ if (FAILED(hr = __super::Run(tStart))) {
return hr;
}
@@ -1243,10 +1243,10 @@ STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYP if (BuildPlaylist (pszFileName, Items))
pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(Items, hr);
- else
+ else
pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
- if(FAILED(hr)
+ if (FAILED(hr)
|| FAILED(hr = DeleteOutputs())
|| FAILED(hr = CreateOutputs(pAsyncReader)))
{
@@ -1258,7 +1258,7 @@ STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYP {
POSITION pos = Chapters.GetHeadPosition();
int i = 1;
- while(pos)
+ while (pos)
{
CString str;
CHdmvClipInfo::PlaylistChapter& chap = Chapters.GetNext(pos);
@@ -1282,7 +1282,7 @@ STDMETHODIMP CBaseSplitterFilter::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TY {
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
wcscpy(*ppszFileName, m_fn);
@@ -1310,15 +1310,15 @@ STDMETHODIMP CBaseSplitterFilter::GetCapabilities(DWORD* pCapabilities) STDMETHODIMP CBaseSplitterFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
DWORD caps;
GetCapabilities(&caps);
- if((caps&*pCapabilities) == 0) {
+ if ((caps&*pCapabilities) == 0) {
return E_FAIL;
}
- if(caps == *pCapabilities) {
+ if (caps == *pCapabilities) {
return S_OK;
}
return S_FALSE;
@@ -1378,10 +1378,10 @@ STDMETHODIMP CBaseSplitterFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurre STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- if(pCurrent) {
+ if (pCurrent) {
*pCurrent = m_rtCurrent;
}
- if(pStop) {
+ if (pStop) {
*pStop = m_rtStop;
}
return S_OK;
@@ -1389,7 +1389,7 @@ STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pSt STDMETHODIMP CBaseSplitterFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
{
- if(pEarliest) {
+ if (pEarliest) {
*pEarliest = 0;
}
return GetDuration(pLatest);
@@ -1414,7 +1414,7 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, {
CAutoLock cAutoLock(this);
- if(!pCurrent && !pStop
+ if (!pCurrent && !pStop
|| (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
&& (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) {
return S_OK;
@@ -1424,8 +1424,8 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, rtCurrent = m_rtCurrent,
rtStop = m_rtStop;
- if(pCurrent)
- switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pCurrent)
+ switch (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -1439,8 +1439,8 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, break;
}
- if(pStop)
- switch(dwStopFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pStop)
+ switch (dwStopFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -1454,11 +1454,11 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, break;
}
- if(m_rtCurrent == rtCurrent && m_rtStop == rtStop) {
+ if (m_rtCurrent == rtCurrent && m_rtStop == rtStop) {
return S_OK;
}
- if(m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id)) {
+ if (m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id)) {
m_LastSeekers.AddTail(id);
return S_OK;
}
@@ -1473,7 +1473,7 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, m_rtNewStart = m_rtCurrent = rtCurrent;
m_rtNewStop = rtStop;
- if(ThreadExists()) {
+ if (ThreadExists()) {
DeliverBeginFlush();
CallWorker(CMD_SEEK);
DeliverEndFlush();
@@ -1536,7 +1536,7 @@ STDMETHODIMP CBaseSplitterFilter::get_ExSeekCapabilities(long* pExCapabilities) {
CheckPointer(pExCapabilities, E_POINTER);
*pExCapabilities = AM_EXSEEK_CANSEEK;
- if(ChapGetCount()) {
+ if (ChapGetCount()) {
*pExCapabilities |= AM_EXSEEK_MARKERSEEK;
}
return S_OK;
@@ -1554,7 +1554,7 @@ STDMETHODIMP CBaseSplitterFilter::get_CurrentMarker(long* pCurrentMarker) CheckPointer(pCurrentMarker, E_POINTER);
REFERENCE_TIME rt = m_rtCurrent;
long i = ChapLookup(&rt);
- if(i < 0) {
+ if (i < 0) {
return E_FAIL;
}
*pCurrentMarker = i+1;
@@ -1565,7 +1565,7 @@ STDMETHODIMP CBaseSplitterFilter::GetMarkerTime(long MarkerNum, double* pMarkerT {
CheckPointer(pMarkerTime, E_POINTER);
REFERENCE_TIME rt;
- if(FAILED(ChapGet((int)MarkerNum-1, &rt))) {
+ if (FAILED(ChapGet((int)MarkerNum-1, &rt))) {
return E_FAIL;
}
*pMarkerTime = (double)rt / 10000000;
@@ -1602,7 +1602,7 @@ STDMETHODIMP CBaseSplitterFilter::GetStatus(int i, int& samples, int& size) {
CAutoLock cAutoLock(m_pLock);
- if(POSITION pos = m_pOutputs.FindIndex(i)) {
+ if (POSITION pos = m_pOutputs.FindIndex(i)) {
CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos);
samples = pPin->QueueCount();
size = pPin->QueueSize();
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.h b/src/filters/parser/BaseSplitter/BaseSplitter.h index 6916cb760..b35e16f91 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.h +++ b/src/filters/parser/BaseSplitter/BaseSplitter.h @@ -33,66 +33,66 @@ #include "../../../DSUtil/FontInstaller.h"
enum {
- /* various PCM "codecs" */
- FF_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
- FF_CODEC_ID_PCM_S16LE= 0x10000,
- FF_CODEC_ID_PCM_S16BE,
- FF_CODEC_ID_PCM_U16LE,
- FF_CODEC_ID_PCM_U16BE,
- FF_CODEC_ID_PCM_S8,
- FF_CODEC_ID_PCM_U8,
- FF_CODEC_ID_PCM_MULAW,
- FF_CODEC_ID_PCM_ALAW,
- FF_CODEC_ID_PCM_S32LE,
- FF_CODEC_ID_PCM_S32BE,
- FF_CODEC_ID_PCM_U32LE,
- FF_CODEC_ID_PCM_U32BE,
- FF_CODEC_ID_PCM_S24LE,
- FF_CODEC_ID_PCM_S24BE,
- FF_CODEC_ID_PCM_U24LE,
- FF_CODEC_ID_PCM_U24BE,
- FF_CODEC_ID_PCM_S24DAUD,
- FF_CODEC_ID_PCM_ZORK,
- FF_CODEC_ID_PCM_S16LE_PLANAR,
- FF_CODEC_ID_PCM_DVD,
- FF_CODEC_ID_PCM_F32BE,
- FF_CODEC_ID_PCM_F32LE,
- FF_CODEC_ID_PCM_F64BE,
- FF_CODEC_ID_PCM_F64LE,
- FF_CODEC_ID_PCM_BLURAY,
- FF_CODEC_ID_PCM_LXF,
- FF_CODEC_ID_S302M,
-
- /* various ADPCM codecs */
- FF_CODEC_ID_ADPCM_IMA_QT= 0x11000,
- FF_CODEC_ID_ADPCM_IMA_WAV,
- FF_CODEC_ID_ADPCM_IMA_DK3,
- FF_CODEC_ID_ADPCM_IMA_DK4,
- FF_CODEC_ID_ADPCM_IMA_WS,
- FF_CODEC_ID_ADPCM_IMA_SMJPEG,
- FF_CODEC_ID_ADPCM_MS,
- FF_CODEC_ID_ADPCM_4XM,
- FF_CODEC_ID_ADPCM_XA,
- FF_CODEC_ID_ADPCM_ADX,
- FF_CODEC_ID_ADPCM_EA,
- FF_CODEC_ID_ADPCM_G726,
- FF_CODEC_ID_ADPCM_CT,
- FF_CODEC_ID_ADPCM_SWF,
- FF_CODEC_ID_ADPCM_YAMAHA,
- FF_CODEC_ID_ADPCM_SBPRO_4,
- FF_CODEC_ID_ADPCM_SBPRO_3,
- FF_CODEC_ID_ADPCM_SBPRO_2,
- FF_CODEC_ID_ADPCM_THP,
- FF_CODEC_ID_ADPCM_IMA_AMV,
- FF_CODEC_ID_ADPCM_EA_R1,
- FF_CODEC_ID_ADPCM_EA_R3,
- FF_CODEC_ID_ADPCM_EA_R2,
- FF_CODEC_ID_ADPCM_IMA_EA_SEAD,
- FF_CODEC_ID_ADPCM_IMA_EA_EACS,
- FF_CODEC_ID_ADPCM_EA_XAS,
- FF_CODEC_ID_ADPCM_EA_MAXIS_XA,
- FF_CODEC_ID_ADPCM_IMA_ISS,
- FF_CODEC_ID_ADPCM_G722,
+ /* various PCM "codecs" */
+ FF_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ FF_CODEC_ID_PCM_S16LE= 0x10000,
+ FF_CODEC_ID_PCM_S16BE,
+ FF_CODEC_ID_PCM_U16LE,
+ FF_CODEC_ID_PCM_U16BE,
+ FF_CODEC_ID_PCM_S8,
+ FF_CODEC_ID_PCM_U8,
+ FF_CODEC_ID_PCM_MULAW,
+ FF_CODEC_ID_PCM_ALAW,
+ FF_CODEC_ID_PCM_S32LE,
+ FF_CODEC_ID_PCM_S32BE,
+ FF_CODEC_ID_PCM_U32LE,
+ FF_CODEC_ID_PCM_U32BE,
+ FF_CODEC_ID_PCM_S24LE,
+ FF_CODEC_ID_PCM_S24BE,
+ FF_CODEC_ID_PCM_U24LE,
+ FF_CODEC_ID_PCM_U24BE,
+ FF_CODEC_ID_PCM_S24DAUD,
+ FF_CODEC_ID_PCM_ZORK,
+ FF_CODEC_ID_PCM_S16LE_PLANAR,
+ FF_CODEC_ID_PCM_DVD,
+ FF_CODEC_ID_PCM_F32BE,
+ FF_CODEC_ID_PCM_F32LE,
+ FF_CODEC_ID_PCM_F64BE,
+ FF_CODEC_ID_PCM_F64LE,
+ FF_CODEC_ID_PCM_BLURAY,
+ FF_CODEC_ID_PCM_LXF,
+ FF_CODEC_ID_S302M,
+
+ /* various ADPCM codecs */
+ FF_CODEC_ID_ADPCM_IMA_QT= 0x11000,
+ FF_CODEC_ID_ADPCM_IMA_WAV,
+ FF_CODEC_ID_ADPCM_IMA_DK3,
+ FF_CODEC_ID_ADPCM_IMA_DK4,
+ FF_CODEC_ID_ADPCM_IMA_WS,
+ FF_CODEC_ID_ADPCM_IMA_SMJPEG,
+ FF_CODEC_ID_ADPCM_MS,
+ FF_CODEC_ID_ADPCM_4XM,
+ FF_CODEC_ID_ADPCM_XA,
+ FF_CODEC_ID_ADPCM_ADX,
+ FF_CODEC_ID_ADPCM_EA,
+ FF_CODEC_ID_ADPCM_G726,
+ FF_CODEC_ID_ADPCM_CT,
+ FF_CODEC_ID_ADPCM_SWF,
+ FF_CODEC_ID_ADPCM_YAMAHA,
+ FF_CODEC_ID_ADPCM_SBPRO_4,
+ FF_CODEC_ID_ADPCM_SBPRO_3,
+ FF_CODEC_ID_ADPCM_SBPRO_2,
+ FF_CODEC_ID_ADPCM_THP,
+ FF_CODEC_ID_ADPCM_IMA_AMV,
+ FF_CODEC_ID_ADPCM_EA_R1,
+ FF_CODEC_ID_ADPCM_EA_R3,
+ FF_CODEC_ID_ADPCM_EA_R2,
+ FF_CODEC_ID_ADPCM_IMA_EA_SEAD,
+ FF_CODEC_ID_ADPCM_IMA_EA_EACS,
+ FF_CODEC_ID_ADPCM_EA_XAS,
+ FF_CODEC_ID_ADPCM_EA_MAXIS_XA,
+ FF_CODEC_ID_ADPCM_IMA_ISS,
+ FF_CODEC_ID_ADPCM_G722,
};
class Packet : public CAtlArray<BYTE>
@@ -108,7 +108,7 @@ public: bDiscontinuity = bAppendable = FALSE;
}
virtual ~Packet() {
- if(pmt) {
+ if (pmt) {
DeleteMediaType(pmt);
}
}
@@ -254,7 +254,7 @@ public: return m_hThread;
}
void SetThreadPriority(int nPriority) {
- if(m_hThread) {
+ if (m_hThread) {
::SetThreadPriority(m_hThread, nPriority);
}
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp index 4e8f55d5a..568952518 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp @@ -35,7 +35,7 @@ CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, in , m_bitbuff(0), m_bitlen(0)
, m_cachepos(0), m_cachelen(0)
{
- if(!m_pAsyncReader) {
+ if (!m_pAsyncReader) {
hr = E_UNEXPECTED;
return;
}
@@ -47,12 +47,12 @@ CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, in m_fRandomAccess = total > 0 && total == available;
m_len = total;
- if(FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0) {
+ if (FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0) {
hr = E_FAIL;
return;
}
- if(!SetCacheSize(cachelen)) {
+ if (!SetCacheSize(cachelen)) {
hr = E_OUTOFMEMORY;
return;
}
@@ -65,7 +65,7 @@ bool CBaseSplitterFile::SetCacheSize(int cachelen) m_pCache.Free();
m_cachetotal = 0;
m_pCache.Allocate((size_t)cachelen);
- if(!m_pCache) {
+ if (!m_pCache) {
return false;
}
m_cachetotal = cachelen;
@@ -87,9 +87,9 @@ __int64 CBaseSplitterFile::GetAvailable() __int64 CBaseSplitterFile::GetLength(bool fUpdate)
{
- if(m_fStreaming) {
+ if (m_fStreaming) {
m_len = GetAvailable();
- } else if(fUpdate) {
+ } else if (fUpdate) {
LONGLONG total = 0, available;
m_pAsyncReader->Length(&total, &available);
m_len = total;
@@ -111,16 +111,16 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len) HRESULT hr = S_OK;
- if(!m_fRandomAccess) {
+ if (!m_fRandomAccess) {
LONGLONG total = 0, available = -1;
m_pAsyncReader->Length(&total, &available);
- if(total == available) {
+ if (total == available) {
m_fRandomAccess = true;
OnComplete();
}
}
- if(m_cachetotal == 0 || !m_pCache) {
+ if (m_cachetotal == 0 || !m_pCache) {
hr = m_pAsyncReader->SyncRead(m_pos, (long)len, pData);
m_pos += len;
return hr;
@@ -128,7 +128,7 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len) BYTE* pCache = m_pCache;
- if(m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen) {
+ if (m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen) {
__int64 minlen = min(len, m_cachelen - (m_pos - m_cachepos));
memcpy(pData, &pCache[m_pos - m_cachepos], (size_t)minlen);
@@ -138,9 +138,9 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len) pData += minlen;
}
- while(len > m_cachetotal) {
+ while (len > m_cachetotal) {
hr = m_pAsyncReader->SyncRead(m_pos, (long)m_cachetotal, pData);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -149,16 +149,16 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len) pData += m_cachetotal;
}
- while(len > 0) {
+ while (len > 0) {
__int64 tmplen = GetLength();
__int64 maxlen = min(tmplen - m_pos, m_cachetotal);
__int64 minlen = min(len, maxlen);
- if(minlen <= 0) {
+ if (minlen <= 0) {
return S_FALSE;
}
hr = m_pAsyncReader->SyncRead(m_pos, (long)maxlen, pCache);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -179,9 +179,9 @@ UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek) {
ASSERT(nBits >= 0 && nBits <= 64);
- while(m_bitlen < nBits) {
+ while (m_bitlen < nBits) {
m_bitbuff <<= 8;
- if(S_OK != Read((BYTE*)&m_bitbuff, 1)) {
+ if (S_OK != Read((BYTE*)&m_bitbuff, 1)) {
return 0; // EOF? // ASSERT(0);
}
m_bitlen += 8;
@@ -191,7 +191,7 @@ UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek) UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
- if(!fPeek) {
+ if (!fPeek) {
m_bitbuff &= ((1ui64 << bitlen) - 1);
m_bitlen = bitlen;
}
@@ -218,7 +218,7 @@ HRESULT CBaseSplitterFile::ByteRead(BYTE* pData, __int64 len) UINT64 CBaseSplitterFile::UExpGolombRead()
{
int n = -1;
- for(BYTE b = 0; !b; n++) {
+ for (BYTE b = 0; !b; n++) {
b = BitRead(1);
}
return (1ui64 << n) - 1 + BitRead(n);
@@ -234,12 +234,12 @@ HRESULT CBaseSplitterFile::HasMoreData(__int64 len, DWORD ms) {
__int64 available = GetLength() - GetPos();
- if(!m_fStreaming) {
+ if (!m_fStreaming) {
return available < 1 ? E_FAIL : S_OK;
}
- if(available < len) {
- if(ms > 0) {
+ if (available < len) {
+ if (ms > 0) {
Sleep(ms);
}
return S_FALSE;
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp index 7a318a9fb..b6ea8fb10 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp @@ -50,11 +50,11 @@ bool CBaseSplitterFileEx::NextMpegStartCode(BYTE& code, __int64 len) BitByteAlign();
DWORD dw = (DWORD)-1;
do {
- if(len-- == 0 || !GetRemaining()) {
+ if (len-- == 0 || !GetRemaining()) {
return false;
}
dw = (dw << 8) | (BYTE)BitRead(8);
- } while((dw&0xffffff00) != 0x00000100);
+ } while ((dw&0xffffff00) != 0x00000100);
code = (BYTE)(dw&0xff);
return true;
}
@@ -69,7 +69,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h) BYTE b = (BYTE)BitRead(8, true);
- if((b&0xf1) == 0x21) {
+ if ((b&0xf1) == 0x21) {
h.type = mpeg1;
EXECUTE_ASSERT(BitRead(4) == 2);
@@ -84,7 +84,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h) MARKER; // 14..0
h.bitrate = BitRead(22);
MARKER;
- } else if((b&0xc4) == 0x44) {
+ } else if ((b&0xc4) == 0x44) {
h.type = mpeg2;
EXECUTE_ASSERT(BitRead(2) == 1);
@@ -103,7 +103,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h) MARKER;
BitRead(5); // reserved
UINT64 stuffing = BitRead(3);
- while(stuffing-- > 0) {
+ while (stuffing-- > 0) {
EXECUTE_ASSERT(BitRead(8) == 0xff);
}
} else {
@@ -133,7 +133,7 @@ bool CBaseSplitterFileEx::Read(pssyshdr& h) EXECUTE_ASSERT((BitRead(8)&0x7f) == 0x7f); // reserved (should be 0xff, but not in reality)
- for(len -= 6; len > 3; len -= 3) { // TODO: also store these, somewhere, if needed
+ for (len -= 6; len > 3; len -= 3) { // TODO: also store these, somewhere, if needed
UINT64 stream_id = BitRead(8);
UNUSED_ALWAYS(stream_id);
EXECUTE_ASSERT(BitRead(2) == 3);
@@ -148,42 +148,42 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code) {
memset(&h, 0, sizeof(h));
- if(!(code >= 0xbd && code < 0xf0 || code == 0xfd)) { // 0xfd => blu-ray (.m2ts)
+ if (!(code >= 0xbd && code < 0xf0 || code == 0xfd)) { // 0xfd => blu-ray (.m2ts)
return false;
}
h.len = (WORD)BitRead(16);
- if(code == 0xbe || code == 0xbf) {
+ if (code == 0xbe || code == 0xbf) {
return true;
}
// mpeg1 stuffing (ff ff .. , max 16x)
- for(int i = 0; i < 16 && BitRead(8, true) == 0xff; i++) {
+ for (int i = 0; i < 16 && BitRead(8, true) == 0xff; i++) {
BitRead(8);
- if(h.len) {
+ if (h.len) {
h.len--;
}
}
h.type = (BYTE)BitRead(2, true) == mpeg2 ? mpeg2 : mpeg1;
- if(h.type == mpeg1) {
+ if (h.type == mpeg1) {
BYTE b = (BYTE)BitRead(2);
- if(b == 1) {
+ if (b == 1) {
h.std_buff_size = (BitRead(1)?1024:128)*BitRead(13);
- if(h.len) {
+ if (h.len) {
h.len -= 2;
}
b = (BYTE)BitRead(2);
}
- if(b == 0) {
+ if (b == 0) {
h.fpts = (BYTE)BitRead(1);
h.fdts = (BYTE)BitRead(1);
}
- } else if(h.type == mpeg2) {
+ } else if (h.type == mpeg2) {
EXECUTE_ASSERT(BitRead(2) == mpeg2);
h.scrambling = (BYTE)BitRead(2);
h.priority = (BYTE)BitRead(1);
@@ -200,16 +200,16 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code) h.extension = (BYTE)BitRead(1);
h.hdrlen = (BYTE)BitRead(8);
} else {
- if(h.len) while(h.len-- > 0) {
+ if (h.len) while (h.len-- > 0) {
BitRead(8);
}
return false;
}
- if(h.fpts) {
- if(h.type == mpeg2) {
+ if (h.fpts) {
+ if (h.type == mpeg2) {
BYTE b = (BYTE)BitRead(4);
- if(!(h.fdts && b == 3 || !h.fdts && b == 2)) {/*ASSERT(0); */return false;}
+ if (!(h.fdts && b == 3 || !h.fdts && b == 2)) {/*ASSERT(0); */return false;}
}
h.pts = 0;
@@ -222,8 +222,8 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code) h.pts = 10000*h.pts/90 + m_rtPTSOffset;
}
- if(h.fdts) {
- if((BYTE)BitRead(4) != 1) {/*ASSERT(0); */return false;}
+ if (h.fdts) {
+ if ((BYTE)BitRead(4) != 1) {/*ASSERT(0); */return false;}
h.dts = 0;
h.dts |= BitRead(3) << 30;
@@ -237,35 +237,35 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code) // skip to the end of header
- if(h.type == mpeg1) {
- if(!h.fpts && !h.fdts && BitRead(4) != 0xf) {
+ if (h.type == mpeg1) {
+ if (!h.fpts && !h.fdts && BitRead(4) != 0xf) {
/*ASSERT(0);*/ return false;
}
- if(h.len) {
+ if (h.len) {
h.len--;
- if(h.pts) {
+ if (h.pts) {
h.len -= 4;
}
- if(h.dts) {
+ if (h.dts) {
h.len -= 5;
}
}
}
- if(h.type == mpeg2) {
- if(h.len) {
+ if (h.type == mpeg2) {
+ if (h.len) {
h.len -= 3+h.hdrlen;
}
int left = h.hdrlen;
- if(h.fpts) {
+ if (h.fpts) {
left -= 5;
}
- if(h.fdts) {
+ if (h.fdts) {
left -= 5;
}
- while(left-- > 0) {
+ while (left-- > 0) {
BitRead(8);
}
/*
@@ -289,13 +289,13 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) BYTE id = 0;
- while(GetPos() < endpos && id != 0xb3) {
- if(!NextMpegStartCode(id, len)) {
+ while (GetPos() < endpos && id != 0xb3) {
+ if (!NextMpegStartCode(id, len)) {
return false;
}
}
- if(id != 0xb3) {
+ if (id != 0xb3) {
return false;
}
@@ -312,14 +312,14 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) h.constrained = BitRead(1);
h.fiqm = BitRead(1);
- if(h.fiqm)
- for(int i = 0; i < countof(h.iqm); i++) {
+ if (h.fiqm)
+ for (int i = 0; i < countof(h.iqm); i++) {
h.iqm[i] = (BYTE)BitRead(8);
}
h.fniqm = BitRead(1);
- if(h.fniqm)
- for(int i = 0; i < countof(h.niqm); i++) {
+ if (h.fniqm)
+ for (int i = 0; i < countof(h.niqm); i++) {
h.niqm[i] = (BYTE)BitRead(8);
}
@@ -337,7 +337,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) __int64 shextpos = 0, shextlen = 0;
- if(NextMpegStartCode(id, 8) && id == 0xb5) { // sequence header ext
+ if (NextMpegStartCode(id, 8) && id == 0xb5) { // sequence header ext
shextpos = GetPos() - 4;
h.startcodeid = BitRead(4);
@@ -370,22 +370,22 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) h.bitrate = h.bitrate == (1<<30)-1 ? 0 : h.bitrate * 400;
DWORD a = h.arx, b = h.ary;
- while(a) {
+ while (a) {
DWORD tmp = a;
a = b % tmp;
b = tmp;
}
- if(b) {
+ if (b) {
h.arx /= b, h.ary /= b;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
pmt->majortype = MEDIATYPE_Video;
- if(type == mpeg1) {
+ if (type == mpeg1) {
pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
pmt->formattype = FORMAT_MPEGVideo;
int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
@@ -401,13 +401,13 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) vi->cbSequenceHeader = shlen + shextlen;
Seek(shpos);
ByteRead((BYTE*)&vi->bSequenceHeader[0], shlen);
- if(shextpos && shextlen) {
+ if (shextpos && shextlen) {
Seek(shextpos);
}
ByteRead((BYTE*)&vi->bSequenceHeader[0] + shlen, shextlen);
pmt->SetFormat((BYTE*)vi, len);
delete [] vi;
- } else if(type == mpeg2) {
+ } else if (type == mpeg2) {
pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
pmt->formattype = FORMAT_MPEG2_VIDEO;
int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
@@ -425,7 +425,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) vi->cbSequenceHeader = shlen + shextlen;
Seek(shpos);
ByteRead((BYTE*)&vi->dwSequenceHeader[0], shlen);
- if(shextpos && shextlen) {
+ if (shextpos && shextlen) {
Seek(shextpos);
}
ByteRead((BYTE*)&vi->dwSequenceHeader[0] + shlen, shextlen);
@@ -444,11 +444,11 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p int syncbits = fAllowV25 ? 11 : 12;
- for(; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--) {
+ for (; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--) {
BitRead(8);
}
- if(len < 4) {
+ if (len < 4) {
return false;
}
@@ -466,12 +466,12 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p h.original = BitRead(1);
h.emphasis = BitRead(2);
- if(h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2) {
+ if (h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2) {
return false;
}
- if(h.version == 3 && h.layer == 2) {
- if((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
+ if (h.version == 3 && h.layer == 2) {
+ if ((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
&& (h.bitrate >= 11 && h.bitrate <= 14) && h.channels == 3) {
return false;
}
@@ -502,7 +502,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p static int brtblcol[][4] = {{0,3,4,4},{0,0,1,2}};
int bitrate = 1000*brtbl[h.bitrate][brtblcol[h.version&1][h.layer]];
- if(bitrate == 0) {
+ if (bitrate == 0) {
return false;
}
@@ -517,7 +517,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p h.rtDuration = 10000000i64 * (h.layer == 1 ? 384 : l3ext ? 576 : 1152) / h.nSamplesPerSec;// / (h.channels == 3 ? 1 : 2);
h.nBytesPerSec = bitrate / 8;
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -528,7 +528,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p memset(wfe, 0, len);
wfe->cbSize = len - sizeof(WAVEFORMATEX);
- if(h.layer == 3) {
+ if (h.layer == 3) {
wfe->wFormatTag = WAVE_FORMAT_MP3;
/* MPEGLAYER3WAVEFORMAT* f = (MPEGLAYER3WAVEFORMAT*)wfe;
@@ -542,19 +542,19 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p f->fwHeadMode = 1 << h.channels;
f->fwHeadModeExt = 1 << h.modeext;
f->wHeadEmphasis = h.emphasis+1;
- if(h.privatebit) {
+ if (h.privatebit) {
f->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
}
- if(h.copyright) {
+ if (h.copyright) {
f->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
}
- if(h.original) {
+ if (h.original) {
f->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
}
- if(h.crc == 0) {
+ if (h.crc == 0) {
f->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
}
- if(h.version == 3) {
+ if (h.version == 3) {
f->fwHeadFlags |= ACM_MPEG_ID_MPEG1;
}
f->fwHeadLayer = 1 << (h.layer-1);
@@ -580,11 +580,11 @@ bool CBaseSplitterFileEx::Read(latm_aachdr& h, int len, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- for(; len >= 3 && BitRead(11, true) != 0x2b7; len--) {
+ for (; len >= 3 && BitRead(11, true) != 0x2b7; len--) {
BitRead(8);
}
-
- if(len < 3) {
+
+ if (len < 3) {
return false;
}
@@ -597,14 +597,14 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt) memset(&h, 0, sizeof(h));
__int64 pos = 0;
- int found_fake_sync = 0;
+ int found_fake_sync = 0;
- for(;;) {
- for(; len >= 7 && BitRead(12, true) != 0xfff; len--) {
+ for (;;) {
+ for (; len >= 7 && BitRead(12, true) != 0xfff; len--) {
BitRead(8);
}
- if(len < 7) {
+ if (len < 7) {
return false;
}
@@ -627,12 +627,12 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt) h.adts_buffer_fullness = BitRead(11);
h.no_raw_data_blocks_in_frame = BitRead(2);
- if(h.fcrc == 0) {
+ if (h.fcrc == 0) {
h.crc = BitRead(16);
}
- if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
- if(found_fake_sync) // skip only one "fake" sync. TODO - find better way to detect and skip "fake" sync
+ if (h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
+ if (found_fake_sync) // skip only one "fake" sync. TODO - find better way to detect and skip "fake" sync
return false;
found_fake_sync++;
Seek(pos + 1);
@@ -645,7 +645,7 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt) h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -676,11 +676,11 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy bool e_ac3 = false;
__int64 startpos = GetPos();
-
+
memset(&h, 0, sizeof(h));
// Parse TrueHD header
- if(!AC3CoreOnly) {
+ if (!AC3CoreOnly) {
BYTE buf[20];
int m_channels;
int m_samplerate;
@@ -688,11 +688,11 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy int fsize = 0;
ByteRead(buf, 20);
-
+
fsize = ParseTrueHDHeader(buf, &m_samplerate, &m_channels, &m_framelength);
- if(fsize) {
+ if (fsize) {
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -701,7 +701,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = MEDIASUBTYPE_DOLBY_TRUEHD;
pmt->formattype = FORMAT_WaveFormatEx;
-
+
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
wfe->wFormatTag = WAVE_FORMAT_UNKNOWN;
wfe->nChannels = m_channels;
@@ -718,18 +718,18 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy Seek(startpos);
- if(find_sync) {
- for(; len >= 7 && BitRead(16, true) != 0x0b77; len--) {
+ if (find_sync) {
+ for (; len >= 7 && BitRead(16, true) != 0x0b77; len--) {
BitRead(8);
}
}
- if(len < 7) {
+ if (len < 7) {
return false;
}
h.sync = (WORD)BitRead(16);
- if(h.sync != 0x0B77) {
+ if (h.sync != 0x0B77) {
return false;
}
@@ -738,26 +738,26 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy h.fscod = BitRead(2);
h.frmsizecod = BitRead(6);
h.bsid = BitRead(5);
- if(h.bsid > 16) {
+ if (h.bsid > 16) {
return false;
}
- if(h.bsid <= 10) {
+ if (h.bsid <= 10) {
/* Normal AC-3 */
- if(h.fscod == 3) {
+ if (h.fscod == 3) {
return false;
}
- if(h.frmsizecod > 37) {
+ if (h.frmsizecod > 37) {
return false;
}
h.bsmod = BitRead(3);
h.acmod = BitRead(3);
- if(h.acmod == 2) {
+ if (h.acmod == 2) {
h.dsurmod = BitRead(2);
}
- if((h.acmod & 1) && h.acmod != 1) {
+ if ((h.acmod & 1) && h.acmod != 1) {
h.cmixlev = BitRead(2);
}
- if(h.acmod & 4) {
+ if (h.acmod & 4) {
h.surmixlev = BitRead(2);
}
h.lfeon = BitRead(1);
@@ -768,17 +768,17 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy Seek(pos);
h.frame_type = BitRead(2);
h.substreamid = BitRead(3);
- if(h.frame_type || h.substreamid) {
+ if (h.frame_type || h.substreamid) {
return false;
}
h.frame_size = (BitRead(11) + 1) << 1;
- if(h.frame_size < 7) {
+ if (h.frame_size < 7) {
return false;
}
h.sr_code = BitRead(2);
- if(h.sr_code == 3) {
+ if (h.sr_code == 3) {
int sr_code2 = BitRead(2);
- if(sr_code2 == 3) {
+ if (sr_code2 == 3) {
return false;
}
h.sample_rate = freq[sr_code2] / 2;
@@ -793,7 +793,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy h.lfeon = BitRead(1);
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -804,7 +804,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
wfe.nChannels = channels[h.acmod] + h.lfeon;
- if(!e_ac3) {
+ if (!e_ac3) {
wfe.nSamplesPerSec = freq[h.fscod] >> h.sr_shift;
static int rate[] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 768, 896, 1024, 1152, 1280};
wfe.nAvgBytesPerSec = ((rate[h.frmsizecod>>1] * 1000) >> h.sr_shift) / 8;
@@ -816,7 +816,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy wfe.nBlockAlign = (WORD)(1536 * wfe.nAvgBytesPerSec / wfe.nSamplesPerSec);
pmt->majortype = MEDIATYPE_Audio;
- if(e_ac3) {
+ if (e_ac3) {
pmt->subtype = MEDIASUBTYPE_DOLBY_DDPLUS;
} else {
pmt->subtype = MEDIASUBTYPE_DOLBY_AC3;
@@ -831,18 +831,18 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy {
memset(&h, 0, sizeof(h));
- if(find_sync) {
- for(; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--) {
+ if (find_sync) {
+ for (; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--) {
BitRead(8);
}
}
- if(len < 10) {
+ if (len < 10) {
return false;
}
h.sync = (DWORD)BitRead(32);
- if(h.sync != 0x7ffe8001) {
+ if (h.sync != 0x7ffe8001) {
return false;
}
@@ -867,7 +867,7 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy h.predictor_history = BitRead(1);
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -877,7 +877,7 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy static int channels[] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
- if(h.amode < countof(channels)) {
+ if (h.amode < countof(channels)) {
wfe.nChannels = channels[h.amode];
if (h.lfe > 0) {
++wfe.nChannels;
@@ -927,7 +927,7 @@ bool CBaseSplitterFileEx::Read(hdmvlpcmhdr& h, CMediaType* pmt) return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -969,11 +969,11 @@ bool CBaseSplitterFileEx::Read(lpcmhdr& h, CMediaType* pmt) h.channels = BitRead(3);
h.drc = (BYTE)BitRead(8);
- if(h.quantwordlen == 3 || h.reserved1 || h.reserved2) {
+ if (h.quantwordlen == 3 || h.reserved1 || h.reserved2) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1011,7 +1011,7 @@ bool CBaseSplitterFileEx::Read(dvdspuhdr& h, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1026,7 +1026,7 @@ bool CBaseSplitterFileEx::Read(hdmvsubhdr& h, CMediaType* pmt, const char* langu {
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1047,7 +1047,7 @@ bool CBaseSplitterFileEx::Read(svcdspuhdr& h, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1062,7 +1062,7 @@ bool CBaseSplitterFileEx::Read(cvdspuhdr& h, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1077,23 +1077,23 @@ bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- if(BitRead(16, true) != 'SS') {
+ if (BitRead(16, true) != 'SS') {
return false;
}
__int64 pos = GetPos();
- while(BitRead(16, true) == 'SS') {
+ while (BitRead(16, true) == 'SS') {
DWORD tag = (DWORD)BitRead(32, true);
DWORD size = 0;
- if(tag == 'SShd') {
+ if (tag == 'SShd') {
BitRead(32);
ByteRead((BYTE*)&size, sizeof(size));
ASSERT(size == 0x18);
Seek(GetPos());
ByteRead((BYTE*)&h, sizeof(h));
- } else if(tag == 'SSbd') {
+ } else if (tag == 'SSbd') {
BitRead(32);
ByteRead((BYTE*)&size, sizeof(size));
break;
@@ -1102,7 +1102,7 @@ bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt) Seek(pos);
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1130,7 +1130,7 @@ bool CBaseSplitterFileEx::Read(ps2subhdr& h, CMediaType* pmt) {
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1147,19 +1147,19 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) BitByteAlign();
- if(m_tslen == 0) {
+ if (m_tslen == 0) {
__int64 pos = GetPos();
- for(int i = 0; i < 192; i++) {
- if(BitRead(8, true) == 0x47) {
+ for (int i = 0; i < 192; i++) {
+ if (BitRead(8, true) == 0x47) {
__int64 pos = GetPos();
Seek(pos + 188);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
m_tslen = 188; // TS stream
break;
}
Seek(pos + 192);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
m_tslen = 192; // M2TS stream
break;
}
@@ -1170,19 +1170,19 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) Seek(pos);
- if(m_tslen == 0) {
+ if (m_tslen == 0) {
return false;
}
}
- if(fSync) {
- for(int i = 0; i < m_tslen; i++) {
- if(BitRead(8, true) == 0x47) {
- if(i == 0) {
+ if (fSync) {
+ for (int i = 0; i < m_tslen; i++) {
+ if (BitRead(8, true) == 0x47) {
+ if (i == 0) {
break;
}
Seek(GetPos()+m_tslen);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
Seek(GetPos()-m_tslen);
break;
}
@@ -1190,13 +1190,13 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) BitRead(8);
- if(i == m_tslen-1) {
+ if (i == m_tslen-1) {
return false;
}
}
}
- if(BitRead(8, true) != 0x47) {
+ if (BitRead(8, true) != 0x47) {
return false;
}
@@ -1214,10 +1214,10 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) h.bytes = 188 - 4;
- if(h.adapfield) {
+ if (h.adapfield) {
h.length = (BYTE)BitRead(8);
- if(h.length > 0) {
+ if (h.length > 0) {
h.discontinuity = BitRead(1);
h.randomaccess = BitRead(1);
h.priority = BitRead(1);
@@ -1229,7 +1229,7 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) int i = 1;
- if(h.fPCR) {
+ if (h.fPCR) {
h.PCR = BitRead(33);
BitRead(6);
UINT64 PCRExt = BitRead(9);
@@ -1239,14 +1239,14 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync) ASSERT(i <= h.length);
- for(; i < h.length; i++) {
+ for (; i < h.length; i++) {
BitRead(8);
}
}
h.bytes -= h.length+1;
- if(h.bytes < 0) {
+ if (h.bytes < 0) {
ASSERT(0);
return false;
}
@@ -1259,7 +1259,7 @@ bool CBaseSplitterFileEx::Read(trsechdr& h) memset(&h, 0, sizeof(h));
BYTE pointer_field = BitRead(8);
- while(pointer_field-- > 0) {
+ while (pointer_field-- > 0) {
BitRead(8);
}
h.table_id = BitRead(8);
@@ -1282,16 +1282,16 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync) BitByteAlign();
- if(fSync) {
- for(int i = 0; i < 65536; i++) {
- if((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64) {
+ if (fSync) {
+ for (int i = 0; i < 65536; i++) {
+ if ((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64) {
break;
}
BitRead(8);
}
}
- if((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64) {
+ if ((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64) {
return false;
}
@@ -1305,26 +1305,26 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync) h.prebytes = BitRead(2);
h.length = (WORD)BitRead(16);
- if(h.length > 6136) {
+ if (h.length > 6136) {
return false;
}
__int64 pos = GetPos();
- if(h.streamid == 1 && h.fpts) {
+ if (h.streamid == 1 && h.fpts) {
h.pts = 10000*BitRead(32)/90 + m_rtPTSOffset;
- } else if(h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0)) {
+ } else if (h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0)) {
BYTE b;
- if(!NextMpegStartCode(b, 4)) {
+ if (!NextMpegStartCode(b, 4)) {
return false;
}
peshdr h2;
- if(!Read(h2, b)) {
+ if (!Read(h2, b)) {
return false;
}
// Maybe bug, code before: if(h.fpts = h2.fpts) h.pts = h2.pts;
h.fpts = h2.fpts;
- if(h.fpts) {
+ if (h.fpts) {
h.pts = h2.pts;
}
}
@@ -1339,12 +1339,12 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync) int CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
{
unsigned int cnt = gb.UExpGolombRead(); // cpb_cnt_minus1
- if(cnt > 32U)
+ if (cnt > 32U)
return -1;
gb.BitRead(4); // bit_rate_scale
gb.BitRead(4); // cpb_size_scale
- for(unsigned int i = 0; i <= cnt; i++ ) {
+ for (unsigned int i = 0; i <= cnt; i++ ) {
gb.UExpGolombRead(); // bit_rate_value_minus1
gb.UExpGolombRead(); // cpb_size_value_minus1
gb.BitRead(1); // cbr_flag
@@ -1354,7 +1354,7 @@ int CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb) gb.BitRead(5); // cpb_removal_delay_length_minus1
gb.BitRead(5); // dpb_output_delay_length_minus1
gb.BitRead(5); // time_offset_length
-
+
return 0;
}
@@ -1362,13 +1362,13 @@ void CBaseSplitterFileEx::RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length) {
int si=0;
int di=0;
- while(si+2<length) {
+ while (si+2<length) {
//remove escapes (very rare 1:2^22)
- if(src[si+2]>3) {
+ if (src[si+2]>3) {
dst[di++]= src[si++];
dst[di++]= src[si++];
- } else if(src[si]==0 && src[si+1]==0) {
- if(src[si+2]==3) { //escape
+ } else if (src[si]==0 && src[si+1]==0) {
+ if (src[si+2]==3) { //escape
dst[di++]= 0;
dst[di++]= 0;
si+=3;
@@ -1391,23 +1391,23 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) // First try search for the start code
DWORD _dwStartCode = BitRead(32, true);
- while(GetPos() < endpos+4 &&
+ while (GetPos() < endpos+4 &&
(_dwStartCode & 0xFFFFFF1F) != 0x101 && // Coded slide of a non-IDR
(_dwStartCode & 0xFFFFFF1F) != 0x105 && // Coded slide of an IDR
(_dwStartCode & 0xFFFFFF1F) != 0x107 && // Sequence Parameter Set
(_dwStartCode & 0xFFFFFF1F) != 0x108 && // Picture Parameter Set
(_dwStartCode & 0xFFFFFF1F) != 0x109 && // Access Unit Delimiter
(_dwStartCode & 0xFFFFFF1F) != 0x10f // Subset Sequence Parameter Set (MVC)
- ) {
+ ) {
BitRead(8);
_dwStartCode = BitRead(32, true);
}
- if(GetPos() >= endpos+4) {
+ if (GetPos() >= endpos+4) {
return false;
}
// At least a SPS (normal or subset) and a PPS is required
- while(GetPos() < endpos+4 && (!(h.spspps[index_sps].complete || h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat))
+ while (GetPos() < endpos+4 && (!(h.spspps[index_sps].complete || h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat))
{
BYTE id = h.lastid;
repeat = false;
@@ -1415,19 +1415,19 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) // Get array index from NAL unit type
spsppsindex index = index_unknown;
- if((id&0x60) != 0) {
- if((id&0x9f) == 0x07) {
+ if ((id&0x60) != 0) {
+ if ((id&0x9f) == 0x07) {
index = index_sps;
- } else if((id&0x9f) == 0x0F) {
+ } else if ((id&0x9f) == 0x0F) {
index = index_subsetsps;
- } else if((id&0x9f) == 0x08) {
+ } else if ((id&0x9f) == 0x08) {
index = h.spspps[index_pps1].complete ? index_pps2 : index_pps1;
}
}
// Search for next start code
DWORD dwStartCode = BitRead(32, true);
- while(GetPos() < endpos+4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100) {
+ while (GetPos() < endpos+4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100) {
BitRead(8);
dwStartCode = BitRead(32, true);
}
@@ -1436,7 +1436,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) // Skip start code
__int64 pos;
- if(GetPos() < endpos+4) {
+ if (GetPos() < endpos+4) {
if (dwStartCode == 0x00000001)
BitRead(32);
else
@@ -1449,11 +1449,11 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) }
// The SPS or PPS might be fragmented, copy data into buffer until NAL is complete
- if(index >= 0) {
- if(h.spspps[index].complete) {
+ if (index >= 0) {
+ if (h.spspps[index].complete) {
// Don't handle SPS/PPS twice
continue;
- } else if(pos > nalstartpos) {
+ } else if (pos > nalstartpos) {
// Copy into buffer
Seek(nalstartpos);
unsigned int bufsize = countof(h.spspps[index].buffer);
@@ -1464,7 +1464,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) //ASSERT(h.spspps[index].size < bufsize); // disable for better debug ...
- if(h.spspps[index].size >= bufsize || dwStartCode == 0x00000001 || (dwStartCode & 0xFFFFFF00) == 0x00000100) {
+ if (h.spspps[index].size >= bufsize || dwStartCode == 0x00000001 || (dwStartCode & 0xFFFFFF00) == 0x00000100) {
if (Read(h, index)) {
h.spspps[index].complete = true;
h.spspps[index].size -= 4;
@@ -1481,20 +1481,20 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) }
// Exit and wait for next packet if there is no SPS and PPS yet
- if((!h.spspps[index_sps].complete && !h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat) {
+ if ((!h.spspps[index_sps].complete && !h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
{
// Calculate size of extra data
int extra = 0;
- for(int i = 0; i < 4; i++) {
- if(h.spspps[i].complete)
+ for (int i = 0; i < 4; i++) {
+ if (h.spspps[i].complete)
extra += 2+(h.spspps[i].size);
}
@@ -1513,15 +1513,15 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) memset(vi, 0, len);
// vi->hdr.dwBitRate = ;
vi->hdr.AvgTimePerFrame = h.AvgTimePerFrame;
- if(!h.sar.num) h.sar.num = 1;
- if(!h.sar.den) h.sar.den = 1;
+ if (!h.sar.num) h.sar.num = 1;
+ if (!h.sar.den) h.sar.den = 1;
CSize aspect(h.width * h.sar.num, h.height * h.sar.den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
- if(aspect.cx * 2 < aspect.cy) {
+ if (aspect.cx * 2 < aspect.cy) {
delete[] vi;
return false;
}
@@ -1545,8 +1545,8 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) // Copy extra data
BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
- for(int i = 0; i < 4; i++) {
- if(h.spspps[i].complete) {
+ for (int i = 0; i < 4; i++) {
+ if (h.spspps[i].complete) {
*p++ = (h.spspps[i].size) >> 8;
*p++ = (h.spspps[i].size) & 0xff;
memcpy(p, h.spspps[i].buffer, h.spspps[i].size);
@@ -1567,7 +1567,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) static BYTE levels[] = {10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51};
// Only care about SPS and subset SPS
- if(index != index_sps && index != index_subsetsps)
+ if (index != index_sps && index != index_subsetsps)
return true;
// Manage escape codes
@@ -1578,35 +1578,35 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) gb.BitRead(8); // nal_unit_type
h.profile = (BYTE)gb.BitRead(8);
bool b_ident = false;
- for(int i = 0; i<sizeof(profiles); i++) {
- if(h.profile == profiles[i]) {
+ for (int i = 0; i<sizeof(profiles); i++) {
+ if (h.profile == profiles[i]) {
b_ident = true;
break;
}
}
- if(!b_ident)
+ if (!b_ident)
return false;
gb.BitRead(8);
h.level = (BYTE)gb.BitRead(8);
b_ident = false;
- for(int i = 0; i<sizeof(levels); i++) {
- if(h.level == levels[i]) {
+ for (int i = 0; i<sizeof(levels); i++) {
+ if (h.level == levels[i]) {
b_ident = true;
break;
}
}
- if(!b_ident)
+ if (!b_ident)
return false;
unsigned int sps_id = gb.UExpGolombRead(); // seq_parameter_set_id
- if(sps_id >= 32)
+ if (sps_id >= 32)
return false;
UINT64 chroma_format_idc = 0;
- if(h.profile >= 100) { // high profile
+ if (h.profile >= 100) { // high profile
chroma_format_idc = gb.UExpGolombRead();
- if(chroma_format_idc == 3) { // chroma_format_idc
+ if (chroma_format_idc == 3) { // chroma_format_idc
gb.BitRead(1); // residue_transform_flag
}
@@ -1615,10 +1615,10 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) gb.BitRead(1); // qpprime_y_zero_transform_bypass_flag
- if(gb.BitRead(1)) { // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++) {
- if(gb.BitRead(1)) { // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
+ if (gb.BitRead(1)) { // seq_scaling_matrix_present_flag
+ for (int i = 0; i < 8; i++) {
+ if (gb.BitRead(1)) { // seq_scaling_list_present_flag
+ for (int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
next = (next + gb.SExpGolombRead() + 256) & 255;
}
}
@@ -1630,24 +1630,24 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) UINT64 pic_order_cnt_type = gb.UExpGolombRead();
- if(pic_order_cnt_type == 0) {
+ if (pic_order_cnt_type == 0) {
gb.UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- } else if(pic_order_cnt_type == 1) {
+ } else if (pic_order_cnt_type == 1) {
gb.BitRead(1); // delta_pic_order_always_zero_flag
gb.SExpGolombRead(); // offset_for_non_ref_pic
gb.SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
- if(num_ref_frames_in_pic_order_cnt_cycle >= 256)
+ if (num_ref_frames_in_pic_order_cnt_cycle >= 256)
return false;
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
+ for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
gb.SExpGolombRead(); // offset_for_ref_frame[i]
}
- } else if(pic_order_cnt_type != 2) {
+ } else if (pic_order_cnt_type != 2) {
return false;
}
UINT64 ref_frame_count = gb.UExpGolombRead(); // num_ref_frames
- if (ref_frame_count > 30)
+ if (ref_frame_count > 30)
return false;
gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
@@ -1655,29 +1655,29 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) UINT64 pic_height_in_map_units_minus1 = gb.UExpGolombRead();
BYTE frame_mbs_only_flag = (BYTE)gb.BitRead(1);
- if(!frame_mbs_only_flag) {
+ if (!frame_mbs_only_flag) {
gb.BitRead(1); // mb_adaptive_frame_field_flag
}
BYTE direct_8x8_inference_flag = (BYTE)gb.BitRead(1); // direct_8x8_inference_flag
- if(!frame_mbs_only_flag && !direct_8x8_inference_flag) {
+ if (!frame_mbs_only_flag && !direct_8x8_inference_flag) {
return false;
}
- if(gb.BitRead(1)) { // frame_cropping_flag
+ if (gb.BitRead(1)) { // frame_cropping_flag
h.crop_left = gb.UExpGolombRead(); // frame_cropping_rect_left_offset
h.crop_right = gb.UExpGolombRead(); // frame_cropping_rect_right_offset
h.crop_top = gb.UExpGolombRead(); // frame_cropping_rect_top_offset
h.crop_bottom = gb.UExpGolombRead(); // frame_cropping_rect_bottom_offset
}
- if(gb.BitRead(1)) { // vui_parameters_present_flag
- if(gb.BitRead(1)) { // aspect_ratio_info_present_flag
+ if (gb.BitRead(1)) { // vui_parameters_present_flag
+ if (gb.BitRead(1)) { // aspect_ratio_info_present_flag
BYTE aspect_ratio_idc = gb.BitRead(8); // aspect_ratio_idc
- if(255==(BYTE)aspect_ratio_idc) {
+ if (255==(BYTE)aspect_ratio_idc) {
h.sar.num = gb.BitRead(16); // sar_width
h.sar.den = gb.BitRead(16); // sar_height
- } else if(aspect_ratio_idc < 17) {
+ } else if (aspect_ratio_idc < 17) {
h.sar.num = pixel_aspect[aspect_ratio_idc][0];
h.sar.den = pixel_aspect[aspect_ratio_idc][1];
} else {
@@ -1688,24 +1688,24 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) h.sar.den = 1;
}
- if(gb.BitRead(1)) { // overscan_info_present_flag
+ if (gb.BitRead(1)) { // overscan_info_present_flag
gb.BitRead(1); // overscan_appropriate_flag
}
- if(gb.BitRead(1)) { // video_signal_type_present_flag
+ if (gb.BitRead(1)) { // video_signal_type_present_flag
gb.BitRead(3); // video_format
gb.BitRead(1); // video_full_range_flag
- if(gb.BitRead(1)) { // colour_description_present_flag
+ if (gb.BitRead(1)) { // colour_description_present_flag
gb.BitRead(8); // colour_primaries
gb.BitRead(8); // transfer_characteristics
gb.BitRead(8); // matrix_coefficients
}
}
- if(gb.BitRead(1)) { // chroma_location_info_present_flag
+ if (gb.BitRead(1)) { // chroma_location_info_present_flag
gb.UExpGolombRead(); // chroma_sample_loc_type_top_field
gb.UExpGolombRead(); // chroma_sample_loc_type_bottom_field
}
- if(gb.BitRead(1)) { // timing_info_present_flag
+ if (gb.BitRead(1)) { // timing_info_present_flag
__int64 num_units_in_tick = gb.BitRead(32);
__int64 time_scale = gb.BitRead(32);
/*long fixed_frame_rate_flag = */gb.BitRead(1);
@@ -1728,21 +1728,21 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) }
bool nalflag = !!gb.BitRead(1); // nal_hrd_parameters_present_flag
- if(nalflag) {
- if(HrdParameters(gb)<0)
+ if (nalflag) {
+ if (HrdParameters(gb)<0)
return false;
}
bool vlcflag = !!gb.BitRead(1); // vlc_hrd_parameters_present_flag
- if(vlcflag) {
- if(HrdParameters(gb)<0)
+ if (vlcflag) {
+ if (HrdParameters(gb)<0)
return false;
}
- if(nalflag || vlcflag) {
- gb.BitRead(1); // low_delay_hrd_flag
+ if (nalflag || vlcflag) {
+ gb.BitRead(1); // low_delay_hrd_flag
}
gb.BitRead(1); // pic_struct_present_flag
- if(gb.BitRead(1)) { // bitstream_restriction_flag
+ if (gb.BitRead(1)) { // bitstream_restriction_flag
gb.BitRead(1); // motion_vectors_over_pic_boundaries_flag
gb.UExpGolombRead(); // max_bytes_per_pic_denom
gb.UExpGolombRead(); // max_bits_per_mb_denom
@@ -1751,19 +1751,19 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) UINT64 num_reorder_frames = gb.UExpGolombRead(); // num_reorder_frames
gb.UExpGolombRead(); // max_dec_frame_buffering
- if(gb.GetSize() < gb.GetPos()){
+ if (gb.GetSize() < gb.GetPos()) {
num_reorder_frames = 0;
}
- if(num_reorder_frames > 16U)
+ if (num_reorder_frames > 16U)
return false;
}
}
- if(index == index_subsetsps) {
- if(h.profile == 83 || h.profile == 86) {
+ if (index == index_subsetsps) {
+ if (h.profile == 83 || h.profile == 86) {
// TODO: SVC extensions
return false;
- } else if(h.profile == 118 || h.profile == 128) {
+ } else if (h.profile == 118 || h.profile == 128) {
gb.BitRead(1); // bit_equal_to_one
// seq_parameter_set_mvc_extension
@@ -1838,18 +1838,18 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index) BYTE CHROMA444 = (chroma_format_idc == 3);
h.width = 16 * mb_Width - (2>>CHROMA444) * min(h.crop_right, (8<<CHROMA444)-1);
- if(frame_mbs_only_flag) {
+ if (frame_mbs_only_flag) {
h.height = 16 * mb_Height - (2>>CHROMA444) * min(h.crop_bottom, (8<<CHROMA444)-1);
} else {
h.height = 16 * mb_Height - (4>>CHROMA444) * min(h.crop_bottom, (8<<CHROMA444)-1);
}
- if(h.height<100 || h.width<100) {
+ if (h.height<100 || h.width<100) {
return false;
}
- if(h.height == 1088) {
- h.height = 1080; // Prevent blur lines
+ if (h.height == 1088) {
+ h.height = 1080; // Prevent blur lines
}
return true;
@@ -1893,17 +1893,17 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla h.finterpflag = BitRead (1);
BitRead (1); // reserved
h.psf = BitRead (1);
- if(BitRead (1)) {
+ if (BitRead (1)) {
int ar = 0;
BitRead (14);
BitRead (14);
- if(BitRead (1)) {
+ if (BitRead (1)) {
ar = BitRead (4);
}
- if(ar && ar < 14) {
+ if (ar && ar < 14) {
h.sar.num = pixel_aspect[ar][0];
h.sar.den = pixel_aspect[ar][1];
- } else if(ar == 15) {
+ } else if (ar == 15) {
h.sar.num = BitRead (8);
h.sar.den = BitRead (8);
}
@@ -1912,15 +1912,15 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
ff_vc1_fps_dr[2] = { 1000, 1001 };
- if(BitRead (1)) {
- if(BitRead (1)) {
+ if (BitRead (1)) {
+ if (BitRead (1)) {
nFrameRateNum = 32;
nFrameRateDen = BitRead (16) + 1;
} else {
int nr, dr;
nr = BitRead (8);
dr = BitRead (4);
- if(nr && nr < 8 && dr && dr < 3) {
+ if (nr && nr < 8 && dr && dr < 3) {
nFrameRateNum = ff_vc1_fps_dr[dr - 1];
nFrameRateDen = ff_vc1_fps_nr[nr - 1] * 1000;
}
@@ -1939,11 +1939,11 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla }
}
- if(!extrapos || !extralen) {
+ if (!extrapos || !extralen) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1963,14 +1963,14 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla memset(vi, 0, len);
vi->AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
- if(!h.sar.num) h.sar.num = 1;
- if(!h.sar.den) h.sar.den = 1;
+ if (!h.sar.num) h.sar.num = 1;
+ if (!h.sar.den) h.sar.den = 1;
CSize aspect = CSize(h.width * h.sar.num, h.height * h.sar.den);
- if(h.width == h.sar.num && h.height == h.sar.den) {
+ if (h.width == h.sar.num && h.height == h.sar.den) {
aspect = CSize(h.width, h.height);
}
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h index 9866c1891..52b1bab04 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h +++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h @@ -26,7 +26,7 @@ #define MAX_SPSPPS 256 // Max size for a SPS/PPS packet
class CGolombBuffer;
-static const byte pixel_aspect[17][2]={
+static const byte pixel_aspect[17][2]= {
{0, 1},
{1, 1},
{12, 11},
@@ -369,10 +369,10 @@ public: UINT64 crop_left, crop_right, crop_top, crop_bottom;
__int64 AvgTimePerFrame;
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
spsppsdata spspps[4];
BYTE lastid;
@@ -399,10 +399,10 @@ public: BYTE finterpflag;
BYTE psf;
unsigned int width, height;
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
};
struct dvbsub {
diff --git a/src/filters/parser/BaseSplitter/MultiFiles.cpp b/src/filters/parser/BaseSplitter/MultiFiles.cpp index cd08aec72..ca0a5c8cd 100644 --- a/src/filters/parser/BaseSplitter/MultiFiles.cpp +++ b/src/filters/parser/BaseSplitter/MultiFiles.cpp @@ -59,7 +59,7 @@ BOOL CMultiFiles::OpenFiles(CAtlList<CHdmvClipInfo::PlaylistItem>& files, UINT n REFERENCE_TIME rtDur = 0;
Reset();
- while(pos) {
+ while (pos) {
CHdmvClipInfo::PlaylistItem& s = files.GetNext(pos);
m_strFiles.Add(s.m_strFileName);
if (!OpenPart(nPos)) {
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.cpp b/src/filters/parser/DSMSplitter/DSMSplitter.cpp index 8ec453c3f..3ed71b3b3 100644 --- a/src/filters/parser/DSMSplitter/DSMSplitter.cpp +++ b/src/filters/parser/DSMSplitter/DSMSplitter.cpp @@ -101,7 +101,7 @@ STDMETHODIMP CDSMSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, DSMSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -121,10 +121,10 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CDSMSplitterFile(pAsyncReader, hr, *this, *this));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -135,7 +135,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAtlArray<BYTE> ids;
POSITION pos = m_pFile->m_mts.GetStartPosition();
- while(pos) {
+ while (pos) {
BYTE id;
CMediaType mt;
m_pFile->m_mts.GetNextAssoc(pos, id, mt);
@@ -144,7 +144,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) qsort(ids.GetData(), ids.GetCount(), sizeof(BYTE), compare_id);
- for(size_t i = 0; i < ids.GetCount(); i++) {
+ for (size_t i = 0; i < ids.GetCount(); i++) {
BYTE id = ids[i];
CMediaType& mt = m_pFile->m_mts[id];
@@ -159,26 +159,26 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) name.Empty();
pos = m_pFile->m_sim[id].GetStartPosition();
- while(pos) {
+ while (pos) {
CStringA key;
CStringW value;
m_pFile->m_sim[id].GetNextAssoc(pos, key, value);
pPinOut->SetProperty(CStringW(key), value);
- if(key == "NAME") {
+ if (key == "NAME") {
name = value;
}
- if(key == "LANG") if((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
+ if (key == "LANG") if ((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
lang = value;
}
}
- if(!name.IsEmpty() || !lang.IsEmpty()) {
- if(!name.IsEmpty()) {
- if(!lang.IsEmpty()) {
+ if (!name.IsEmpty() || !lang.IsEmpty()) {
+ if (!name.IsEmpty()) {
+ if (!lang.IsEmpty()) {
name += L" (" + lang + L")";
}
- } else if(!lang.IsEmpty()) {
+ } else if (!lang.IsEmpty()) {
name = lang;
}
pPinOut->SetName(name);
@@ -188,18 +188,18 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
pos = m_pFile->m_fim.GetStartPosition();
- while(pos) {
+ while (pos) {
CStringA key;
CStringW value;
m_pFile->m_fim.GetNextAssoc(pos, key, value);
SetProperty(CStringW(key), value);
}
- for(size_t i = 0; i < m_resources.GetCount(); i++) {
+ for (size_t i = 0; i < m_resources.GetCount(); i++) {
const CDSMResource& r = m_resources[i];
- if(r.mime == "application/x-truetype-font" ||
- r.mime == "application/x-font-ttf" ||
- r.mime == "application/vnd.ms-opentype") {
+ if (r.mime == "application/x-truetype-font" ||
+ r.mime == "application/x-font-ttf" ||
+ r.mime == "application/vnd.ms-opentype") {
//m_fontinst.InstallFont(r.data);
m_fontinst.InstallFontMemory(r.data.GetData(), r.data.GetCount());
}
@@ -223,20 +223,20 @@ bool CDSMSplitterFilter::DemuxLoop() {
HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
dsmp_t type;
UINT64 len;
- if(!m_pFile->Sync(type, len)) {
+ if (!m_pFile->Sync(type, len)) {
continue;
}
__int64 pos = m_pFile->GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
CAutoPtr<Packet> p(DNew Packet());
- if(m_pFile->Read(len, p)) {
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (m_pFile->Read(len, p)) {
+ if (p->rtStart != Packet::INVALID_TIME) {
p->rtStart -= m_pFile->m_rtFirst;
p->rtStop -= m_pFile->m_rtFirst;
}
@@ -266,12 +266,12 @@ STDMETHODIMP CDSMSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM CheckPointer(pKFs, E_POINTER);
CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
// these aren't really the keyframes, but quicky accessable points in the stream
- for(nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++) {
+ for (nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++) {
pKFs[nKFs] = m_pFile->m_sps[nKFs].rt;
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp index 2219844c0..715864b87 100644 --- a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp +++ b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp @@ -8,7 +8,7 @@ CDSMSplitterFile::CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResou , m_rtFirst(0)
, m_rtDuration(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
@@ -19,7 +19,7 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha {
Seek(0);
- if(BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO) {
+ if (BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO) {
return E_FAIL;
}
@@ -38,64 +38,64 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha // examine the beginning of the file ...
- while(Sync(type, len, 0)) {
+ while (Sync(type, len, 0)) {
__int64 pos = GetPos();
- if(type == DSMP_MEDIATYPE) {
+ if (type == DSMP_MEDIATYPE) {
BYTE id;
CMediaType mt;
- if(Read(len, id, mt)) {
+ if (Read(len, id, mt)) {
m_mts[id] = mt;
}
- } else if(type == DSMP_SAMPLE) {
+ } else if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
m_rtFirst = p.rtStart;
break;
}
- } else if(type == DSMP_FILEINFO) {
- if((BYTE)BitRead(8) > DSMF_VERSION) {
+ } else if (type == DSMP_FILEINFO) {
+ if ((BYTE)BitRead(8) > DSMF_VERSION) {
return E_FAIL;
}
Read(len-1, m_fim);
- } else if(type == DSMP_STREAMINFO) {
+ } else if (type == DSMP_STREAMINFO) {
Read(len-1, m_sim[(BYTE)BitRead(8)]);
- } else if(type == DSMP_SYNCPOINTS) {
+ } else if (type == DSMP_SYNCPOINTS) {
Read(len, m_sps);
- } else if(type == DSMP_RESOURCE) {
+ } else if (type == DSMP_RESOURCE) {
Read(len, res);
- } else if(type == DSMP_CHAPTERS) {
+ } else if (type == DSMP_CHAPTERS) {
Read(len, chap);
}
Seek(pos + len);
}
- if(type != DSMP_SAMPLE) {
+ if (type != DSMP_SAMPLE) {
return E_FAIL;
}
// ... and the end
- if(IsRandomAccess())
- for(int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++) {
+ if (IsRandomAccess())
+ for (int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++) {
__int64 seekpos = max(0, (__int64)GetLength()-i*limit);
Seek(seekpos);
- while(Sync(type, len, limit) && GetPos() < seekpos+limit) {
+ while (Sync(type, len, limit) && GetPos() < seekpos+limit) {
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
m_rtDuration = max(m_rtDuration, p.rtStop - m_rtFirst); // max isn't really needed, only for safety
i = j;
}
- } else if(type == DSMP_SYNCPOINTS) {
+ } else if (type == DSMP_SYNCPOINTS) {
Read(len, m_sps);
- } else if(type == DSMP_RESOURCE) {
+ } else if (type == DSMP_RESOURCE) {
Read(len, res);
- } else if(type == DSMP_CHAPTERS) {
+ } else if (type == DSMP_CHAPTERS) {
Read(len, chap);
}
@@ -103,7 +103,7 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha }
}
- if(m_rtFirst < 0) {
+ if (m_rtFirst < 0) {
m_rtDuration += m_rtFirst;
m_rtFirst = 0;
}
@@ -123,8 +123,8 @@ bool CDSMSplitterFile::Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit += DSMSW_SIZE;
- for(UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8)) {
- if(limit-- <= 0 || GetRemaining() <= 2) {
+ for (UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8)) {
+ if (limit-- <= 0 || GetRemaining() <= 2) {
return false;
}
}
@@ -147,7 +147,7 @@ bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt) ByteRead((BYTE*)&mt.formattype, sizeof(mt.formattype));
len -= 5 + sizeof(GUID)*3;
ASSERT(len >= 0);
- if(len > 0) {
+ if (len > 0) {
mt.AllocFormatBuffer((LONG)len);
ByteRead(mt.Format(), mt.FormatLength());
} else {
@@ -158,7 +158,7 @@ bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt) bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
{
- if(!p) {
+ if (!p) {
return false;
}
@@ -168,7 +168,7 @@ bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData) int iTimeStamp = (int)BitRead(3);
int iDuration = (int)BitRead(3);
- if(fSign && !iTimeStamp) {
+ if (fSign && !iTimeStamp) {
ASSERT(!iDuration);
p->rtStart = Packet::INVALID_TIME;
p->rtStop = Packet::INVALID_TIME + 1;
@@ -177,7 +177,7 @@ bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData) p->rtStop = p->rtStart + BitRead(iDuration<<3);
}
- if(fData) {
+ if (fData) {
p->SetCount((INT_PTR)len - (2 + iTimeStamp + iDuration));
ByteRead(p->GetData(), p->GetCount());
}
@@ -190,7 +190,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps) SyncPoint sp = {0, 0};
sps.RemoveAll();
- while(len > 0) {
+ while (len > 0) {
bool fSign = !!BitRead(1);
int iTimeStamp = (int)BitRead(3);
int iFilePos = (int)BitRead(3);
@@ -203,7 +203,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps) len -= 1 + iTimeStamp + iFilePos;
}
- if(len != 0) {
+ if (len != 0) {
sps.RemoveAll();
return false;
}
@@ -215,7 +215,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps) bool CDSMSplitterFile::Read(__int64 len, CStreamInfoMap& im)
{
- while(len >= 5) {
+ while (len >= 5) {
CStringA key;
ByteRead((BYTE*)key.GetBufferSetLength(4), 4);
len -= 4;
@@ -237,7 +237,7 @@ bool CDSMSplitterFile::Read(__int64 len, IDSMResourceBagImpl& res) len -= Read(len, r.desc);
len -= Read(len, r.mime);
- if(compression != 0) {
+ if (compression != 0) {
return false; // TODO
}
@@ -253,7 +253,7 @@ bool CDSMSplitterFile::Read(__int64 len, IDSMChapterBagImpl& chap) {
CDSMChapter c(0, L"");
- while(len > 0) {
+ while (len > 0) {
bool fSign = !!BitRead(1);
int iTimeStamp = (int)BitRead(3);
BitRead(4); // reserved
@@ -276,7 +276,7 @@ __int64 CDSMSplitterFile::Read(__int64 len, CStringW& str) char c;
CStringA s;
__int64 i = 0;
- while(i++ < len && (c = (char)BitRead(8)) != 0) {
+ while (i++ < len && (c = (char)BitRead(8)) != 0) {
s += c;
}
str = UTF8To16(s);
@@ -285,12 +285,12 @@ __int64 CDSMSplitterFile::Read(__int64 len, CStringW& str) __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
{
- if(/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1) {
+ if (/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1) {
int i = range_bsearch(m_sps, m_rtFirst + rt);
return i >= 0 ? m_sps[i].fp : 0;
}
- if(m_rtDuration <= 0 || rt <= m_rtFirst) {
+ if (m_rtDuration <= 0 || rt <= m_rtFirst) {
return 0;
}
@@ -303,21 +303,21 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt) __int64 minpos = 0, maxpos = GetLength();
- for(int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++) {
+ for (int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++) {
Seek((minpos + maxpos) / 2);
- while(GetPos() < maxpos) {
- if(!Sync(syncpos, type, len)) {
+ while (GetPos() < maxpos) {
+ if (!Sync(syncpos, type, len)) {
continue;
}
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0) {
+ if (dt >= 0) {
maxpos = max((__int64)syncpos - 65536, minpos);
} else {
minpos = syncpos;
@@ -334,18 +334,18 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt) Seek(minpos);
- while(GetRemaining()) {
- if(!Sync(syncpos, type, len)) {
+ while (GetRemaining()) {
+ if (!Sync(syncpos, type, len)) {
continue;
}
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0) {
+ if (dt >= 0) {
maxpos = (__int64)syncpos;
break;
}
@@ -361,11 +361,11 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt) {
POSITION pos = m_mts.GetStartPosition();
- while(pos) {
+ while (pos) {
BYTE id;
CMediaType mt;
m_mts.GetNextAssoc(pos, id, mt);
- if(mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
+ if (mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
ids[id] = 0;
}
}
@@ -373,19 +373,19 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt) __int64 ret = maxpos;
- while(maxpos > 0 && !ids.IsEmpty()) {
+ while (maxpos > 0 && !ids.IsEmpty()) {
minpos = max(0, maxpos - 65536);
Seek(minpos);
- while(Sync(syncpos, type, len) && GetPos() < maxpos) {
+ while (Sync(syncpos, type, len) && GetPos() < maxpos) {
UINT64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint) {
BYTE id = (BYTE)p.TrackNumber, tmp;
- if(ids.Lookup(id, tmp)) {
+ if (ids.Lookup(id, tmp)) {
ids.RemoveKey((BYTE)p.TrackNumber);
ret = min(ret, (__int64)syncpos);
}
diff --git a/src/filters/parser/FLVSplitter/FLVSplitter.cpp b/src/filters/parser/FLVSplitter/FLVSplitter.cpp index ccc0ee1b9..d56aade66 100644 --- a/src/filters/parser/FLVSplitter/FLVSplitter.cpp +++ b/src/filters/parser/FLVSplitter/FLVSplitter.cpp @@ -27,12 +27,12 @@ #include <moreuuids.h>
enum {
- FLV_CODECID_H263 = 2,
- FLV_CODECID_SCREEN = 3,
- FLV_CODECID_VP6 = 4,
- FLV_CODECID_VP6A = 5,
- FLV_CODECID_SCREEN2 = 6,
- FLV_CODECID_H264 = 7,
+ FLV_CODECID_H263 = 2,
+ FLV_CODECID_SCREEN = 3,
+ FLV_CODECID_VP6 = 4,
+ FLV_CODECID_VP6A = 5,
+ FLV_CODECID_SCREEN2 = 6,
+ FLV_CODECID_H264 = 7,
};
#ifdef REGISTER_FILTER
@@ -105,7 +105,7 @@ STDMETHODIMP CFLVSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, FlvSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -114,7 +114,7 @@ STDMETHODIMP CFLVSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) bool CFLVSplitterFilter::ReadTag(Tag& t)
{
- if(m_pFile->GetRemaining() < 15) {
+ if (m_pFile->GetRemaining() < 15) {
return false;
}
@@ -130,7 +130,7 @@ bool CFLVSplitterFilter::ReadTag(Tag& t) bool CFLVSplitterFilter::ReadTag(AudioTag& at)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -144,7 +144,7 @@ bool CFLVSplitterFilter::ReadTag(AudioTag& at) bool CFLVSplitterFilter::ReadTag(VideoTag& vt)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -157,7 +157,7 @@ bool CFLVSplitterFilter::ReadTag(VideoTag& vt) #ifndef NOVIDEOTWEAK
bool CFLVSplitterFilter::ReadTag(VideoTweak& vt)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -172,7 +172,7 @@ bool CFLVSplitterFilter::Sync(__int64& pos) {
m_pFile->Seek(pos);
- while(m_pFile->GetRemaining() >= 15) {
+ while (m_pFile->GetRemaining() >= 15) {
__int64 limit = m_pFile->GetRemaining();
while (true) {
BYTE b = m_pFile->BitRead(8);
@@ -190,7 +190,7 @@ bool CFLVSplitterFilter::Sync(__int64& pos) Tag ct;
if (ReadTag(ct)) {
__int64 next = m_pFile->GetPos() + ct.DataSize;
- if(next == m_pFile->GetLength() - 4) {
+ if (next == m_pFile->GetLength() - 4) {
m_pFile->Seek(pos);
return true;
} else if (next <= m_pFile->GetLength() - 19) {
@@ -222,10 +222,10 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -233,7 +233,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- if(m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1) {
+ if (m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1) {
return E_FAIL;
}
@@ -255,8 +255,8 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(m_DataOffset);
- for(int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio); i++) {
- if(!t.DataSize) continue; // skip empty Tag
+ for (int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio); i++) {
+ if (!t.DataSize) continue; // skip empty Tag
UINT64 next = m_pFile->GetPos() + t.DataSize;
@@ -272,12 +272,12 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
prevTagSize = t.DataSize + 11;
- if(t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio) {
+ if (t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio) {
UNREFERENCED_PARAMETER(at);
AudioTag at;
name = L"Audio";
- if(ReadTag(at)) {
+ if (ReadTag(at)) {
int dataSize = t.DataSize - 1;
fTypeFlagsAudio = false;
@@ -290,7 +290,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) wfe->wBitsPerSample = 8*(at.SoundSize+1);
wfe->nChannels = at.SoundType+1;
- switch(at.SoundFormat) {
+ switch (at.SoundFormat) {
case 0: // FLV_CODECID_PCM_BE
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_PCM);
name += L" PCM";
@@ -316,11 +316,11 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) case 2: // FLV_CODECID_MP3
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
name += L" MP3";
-
+
{
CBaseSplitterFileEx::mpahdr h;
CMediaType mt2;
- if(m_pFile->Read(h, 4, false, &mt2)) {
+ if (m_pFile->Read(h, 4, false, &mt2)) {
mt = mt2;
}
}
@@ -386,10 +386,10 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- } else if(t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo) {
+ } else if (t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo) {
UNREFERENCED_PARAMETER(vt);
VideoTag vt;
- if(ReadTag(vt) && vt.FrameType == 1) {
+ if (ReadTag(vt) && vt.FrameType == 1) {
int dataSize = t.DataSize - 1;
fTypeFlagsVideo = false;
@@ -404,15 +404,15 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) int w, h, arx, ary;
- switch(vt.CodecID) {
+ switch (vt.CodecID) {
case FLV_CODECID_H263: // H.263
- if(m_pFile->BitRead(17) != 1) {
+ if (m_pFile->BitRead(17) != 1) {
break;
}
m_pFile->BitRead(13); // Version (5), TemporalReference (8)
- switch(BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) { // w00t
+ switch (BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) { // w00t
case 0:
case 1:
vih->bmiHeader.biWidth = (WORD)m_pFile->BitRead(8*(PictureSize+1));
@@ -432,7 +432,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) break;
}
- if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
+ if (!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
break;
}
@@ -446,7 +446,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->BitRead(4);
vih->bmiHeader.biHeight = m_pFile->BitRead(12);
- if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
+ if (!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
break;
}
@@ -490,7 +490,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ary = m_pFile->BitRead(8) * 16;
arx = m_pFile->BitRead(8) * 16;
- if(arx && arx != w || ary && ary != h) {
+ if (arx && arx != w || ary && ary != h) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
vih2->dwPictAspectRatioX = arx;
@@ -540,31 +540,31 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) vih->dwLevel = (BYTE)m_pFile->BitRead(8);
m_pFile->UExpGolombRead(); // seq_parameter_set_id
UINT64 chroma_format_idc = 0;
- if(vih->dwProfile >= 100) { // high profile
+ if (vih->dwProfile >= 100) { // high profile
chroma_format_idc = m_pFile->UExpGolombRead();
- if(chroma_format_idc == 3) { // chroma_format_idc
+ if (chroma_format_idc == 3) { // chroma_format_idc
m_pFile->BitRead(1); // residue_transform_flag
}
m_pFile->UExpGolombRead(); // bit_depth_luma_minus8
m_pFile->UExpGolombRead(); // bit_depth_chroma_minus8
m_pFile->BitRead(1); // qpprime_y_zero_transform_bypass_flag
- if(m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++)
- if(m_pFile->BitRead(1)) // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
+ if (m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
+ for (int i = 0; i < 8; i++)
+ if (m_pFile->BitRead(1)) // seq_scaling_list_present_flag
+ for (int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
next = (next + m_pFile->SExpGolombRead() + 256) & 255;
}
}
m_pFile->UExpGolombRead(); // log2_max_frame_num_minus4
UINT64 pic_order_cnt_type = m_pFile->UExpGolombRead();
- if(pic_order_cnt_type == 0) {
+ if (pic_order_cnt_type == 0) {
m_pFile->UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- } else if(pic_order_cnt_type == 1) {
+ } else if (pic_order_cnt_type == 1) {
m_pFile->BitRead(1); // delta_pic_order_always_zero_flag
m_pFile->SExpGolombRead(); // offset_for_non_ref_pic
m_pFile->SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = m_pFile->UExpGolombRead();
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
+ for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
m_pFile->SExpGolombRead(); // offset_for_ref_frame[i]
}
}
@@ -573,7 +573,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) UINT64 pic_width_in_mbs_minus1 = m_pFile->UExpGolombRead();
UINT64 pic_height_in_map_units_minus1 = m_pFile->UExpGolombRead();
BYTE frame_mbs_only_flag = (BYTE)m_pFile->BitRead(1);
- if(!frame_mbs_only_flag) {
+ if (!frame_mbs_only_flag) {
m_pFile->BitRead(1); // mb_adaptive_frame_field_flag
}
m_pFile->BitRead(1); // direct_8x8_inference_flag
@@ -583,24 +583,24 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) UINT64 crop_top = 0;
UINT64 crop_bottom = 0;
- if(crop) {
+ if (crop) {
crop_left = m_pFile->UExpGolombRead(); // frame_cropping_rect_left_offset
crop_right = m_pFile->UExpGolombRead(); // frame_cropping_rect_right_offset
crop_top = m_pFile->UExpGolombRead(); // frame_cropping_rect_top_offset
crop_bottom = m_pFile->UExpGolombRead(); // frame_cropping_rect_bottom_offset
}
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
- if(m_pFile->BitRead(1)) { // vui_parameters_present_flag
- if(m_pFile->BitRead(1)) { // aspect_ratio_info_present_flag
+ if (m_pFile->BitRead(1)) { // vui_parameters_present_flag
+ if (m_pFile->BitRead(1)) { // aspect_ratio_info_present_flag
BYTE aspect_ratio_idc = m_pFile->BitRead(8); // aspect_ratio_idc
- if(255==(BYTE)aspect_ratio_idc) {
+ if (255==(BYTE)aspect_ratio_idc) {
sar.num = m_pFile->BitRead(16); // sar_width
sar.den = m_pFile->BitRead(16); // sar_height
- } else if(aspect_ratio_idc < 17) {
+ } else if (aspect_ratio_idc < 17) {
sar.num = pixel_aspect[aspect_ratio_idc][0];
sar.den = pixel_aspect[aspect_ratio_idc][1];
} else {
@@ -617,16 +617,16 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) UINT64 Width, Height;
Width = 16 * mb_Width - (2>>CHROMA444) * min(crop_right, (8<<CHROMA444)-1);
- if(frame_mbs_only_flag) {
+ if (frame_mbs_only_flag) {
Height = 16 * mb_Height - (2>>CHROMA444) * min(crop_bottom, (8<<CHROMA444)-1);
} else {
Height = 16 * mb_Height - (4>>CHROMA444) * min(crop_bottom, (8<<CHROMA444)-1);
}
- if(!sar.num) sar.num = 1;
- if(!sar.den) sar.den = 1;
+ if (!sar.num) sar.num = 1;
+ if (!sar.den) sar.den = 1;
CSize aspect(Width * sar.num, Height * sar.den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
@@ -659,7 +659,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end) {
+ if (src + len > src_end || dst + len > dst_end) {
ASSERT(0);
break;
}
@@ -682,9 +682,9 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- if(mt.subtype != GUID_NULL) {
+ if (mt.subtype != GUID_NULL) {
CAtlArray<CMediaType> mts;
- if(mt.subtype == FOURCCMap(MAKEFOURCC('A','S','W','F'))) {
+ if (mt.subtype == FOURCCMap(MAKEFOURCC('A','S','W','F'))) {
mts.InsertAt(0, ff_mtype);
}
mts.Add(mt);
@@ -695,18 +695,18 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(next);
}
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
__int64 pos = max(m_DataOffset, m_pFile->GetLength() - 256 * 1024);
- if(Sync(pos)) {
+ if (Sync(pos)) {
Tag t;
AudioTag at;
VideoTag vt;
- while(ReadTag(t)) {
+ while (ReadTag(t)) {
UINT64 next = m_pFile->GetPos() + t.DataSize;
- if(t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)) {
+ if (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)) {
m_rtDuration = max(m_rtDuration, 10000i64 * t.TimeStamp);
}
@@ -728,7 +728,7 @@ bool CFLVSplitterFilter::DemuxInit() void CFLVSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(!m_rtDuration || rt <= 0) {
+ if (!m_rtDuration || rt <= 0) {
m_pFile->Seek(m_DataOffset);
} else if (!m_IgnorePrevSizes) {
NormalSeek(rt);
@@ -744,7 +744,7 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt) __int64 pos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
- if(!Sync(pos)) {
+ if (!Sync(pos)) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
return;
@@ -754,8 +754,8 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt) AudioTag at;
VideoTag vt;
- while(ReadTag(t)) {
- if(10000i64 * t.TimeStamp >= rt) {
+ while (ReadTag(t)) {
+ if (10000i64 * t.TimeStamp >= rt) {
m_pFile->Seek(m_pFile->GetPos() - 15);
break;
}
@@ -763,13 +763,13 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt) m_pFile->Seek(m_pFile->GetPos() + t.DataSize);
}
- while(m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t)) {
+ while (m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t)) {
UINT64 prev = m_pFile->GetPos() - 15 - t.PreviousTagSize - 4;
- if(10000i64 * t.TimeStamp <= rt) {
- if(t.TagType == 8 && ReadTag(at)) {
+ if (10000i64 * t.TimeStamp <= rt) {
+ if (t.TagType == 8 && ReadTag(at)) {
fAudio = false;
- } else if(t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
+ } else if (t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
fVideo = false;
}
}
@@ -777,7 +777,7 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt) m_pFile->Seek(prev);
}
- if(fAudio || fVideo) {
+ if (fAudio || fVideo) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
}
@@ -844,24 +844,24 @@ bool CFLVSplitterFilter::DemuxLoop() AudioTag at = {};
VideoTag vt = {};
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
- if(!ReadTag(t)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ if (!ReadTag(t)) {
break;
}
__int64 next = m_pFile->GetPos() + t.DataSize;
- if((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))) {
+ if ((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))) {
UINT32 tsOffset = 0;
- if(t.TagType == 9) {
- if(vt.FrameType == 5) {
+ if (t.TagType == 9) {
+ if (vt.FrameType == 5) {
goto NextTag; // video info/command frame
}
- if(vt.CodecID == 4) {
+ if (vt.CodecID == 4) {
m_pFile->BitRead(8);
- } else if(vt.CodecID == 5) {
+ } else if (vt.CodecID == 5) {
m_pFile->BitRead(32);
- } else if(vt.CodecID == 7) {
+ } else if (vt.CodecID == 7) {
if (m_pFile->BitRead(8) != 1) {
goto NextTag;
}
@@ -870,7 +870,7 @@ bool CFLVSplitterFilter::DemuxLoop() tsOffset = (tsOffset + 0xff800000) ^ 0xff800000; // sign extension
}
}
- if(t.TagType == 8 && at.SoundFormat == 10) {
+ if (t.TagType == 8 && at.SoundFormat == 10) {
if (m_pFile->BitRead(8) != 1) {
goto NextTag;
}
diff --git a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp index 4e42bf718..2824094a2 100644 --- a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp +++ b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp @@ -22,7 +22,7 @@ void AP4_AsyncReaderStream::AddReference() void AP4_AsyncReaderStream::Release()
{
ASSERT(m_refs > 0);
- if(--m_refs == 0) {
+ if (--m_refs == 0) {
delete this;
}
}
@@ -31,25 +31,25 @@ AP4_Result AP4_AsyncReaderStream::Read(void* buffer, AP4_Size bytesToRead, AP4_S {
__int64 bytesAvail = m_pFile->GetRemaining();
- if(bytesAvail < (long long)bytesToRead) {
- if(bytesRead) {
+ if (bytesAvail < (long long)bytesToRead) {
+ if (bytesRead) {
*bytesRead = bytesAvail;
}
bytesToRead = bytesAvail;
}
- if(bytesAvail == 0) {
+ if (bytesAvail == 0) {
return AP4_ERROR_EOS;
}
- if(FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead))) {
- if(bytesRead) {
+ if (FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead))) {
+ if (bytesRead) {
*bytesRead = 0;
}
return AP4_ERROR_READ_FAILED;
}
- if(bytesRead) {
+ if (bytesRead) {
*bytesRead = bytesToRead;
}
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp index f88de531b..62d46bd18 100644 --- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp +++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp @@ -150,7 +150,7 @@ STDMETHODIMP CMP4SplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, MP4SourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -159,7 +159,7 @@ STDMETHODIMP CMP4SplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) void SetTrackName(CString *TrackName, CString Suffix)
{
- if(TrackName->IsEmpty()) {
+ if (TrackName->IsEmpty()) {
*TrackName = Suffix;
} else {
*TrackName += _T(" - ");
@@ -179,10 +179,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CMP4SplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -192,26 +192,26 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_framesize.SetSize(640, 480);
- if(AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie()) {
- for(AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
+ if (AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie()) {
+ for (AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
item;
item = item->GetNext()) {
AP4_Track* track = item->GetData();
- if(track->GetType() != AP4_Track::TYPE_VIDEO
+ if (track->GetType() != AP4_Track::TYPE_VIDEO
&& track->GetType() != AP4_Track::TYPE_AUDIO
&& track->GetType() != AP4_Track::TYPE_TEXT
&& track->GetType() != AP4_Track::TYPE_SUBP) {
continue;
}
- if(b_HasVideo && track->GetType() == AP4_Track::TYPE_VIDEO) {
+ if (b_HasVideo && track->GetType() == AP4_Track::TYPE_VIDEO) {
continue;
}
AP4_Sample sample;
- if(!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF) {
+ if (!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF) {
continue;
}
@@ -231,41 +231,41 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) AP4_DataBuffer empty;
- if(AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex())) {
+ if (AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex())) {
AP4_MpegSampleDescription* mpeg_desc = NULL;
- if(desc->GetType() == AP4_SampleDescription::TYPE_MPEG) {
+ if (desc->GetType() == AP4_SampleDescription::TYPE_MPEG) {
mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
- } else if(desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
+ } else if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc);
mpeg_desc = isma_desc->GetOriginalSampleDescription();
}
- if(mpeg_desc) {
+ if (mpeg_desc) {
CStringW TypeString = CStringW(mpeg_desc->GetObjectTypeString(mpeg_desc->GetObjectTypeId()));
- if((TypeString.Find(_T("UNKNOWN")) == -1) && (TypeString.Find(_T("INVALID")) == -1)) {
+ if ((TypeString.Find(_T("UNKNOWN")) == -1) && (TypeString.Find(_T("INVALID")) == -1)) {
SetTrackName(&TrackName, TypeString);
}
}
- if(AP4_MpegVideoSampleDescription* video_desc =
+ if (AP4_MpegVideoSampleDescription* video_desc =
dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc)) {
const AP4_DataBuffer* di = video_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = ∅
}
LONG biWidth = (LONG)video_desc->GetWidth();
LONG biHeight = (LONG)video_desc->GetHeight();
- if(!biWidth || !biHeight) {
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (!biWidth || !biHeight) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
biWidth = tkhd->GetWidth()>>16;
biHeight = tkhd->GetHeight()>>16;
}
}
- if(!biWidth || !biHeight) {
+ if (!biWidth || !biHeight) {
continue;
}
@@ -279,7 +279,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) vih->bmiHeader.biHeight = biHeight;
memcpy(vih + 1, di->GetData(), di->GetDataSize());
- switch(video_desc->GetObjectTypeId()) {
+ switch (video_desc->GetObjectTypeId()) {
case AP4_MPEG4_VISUAL_OTI:
mt.subtype = FOURCCMap('v4pm');
mt.formattype = FORMAT_MPEG2Video;
@@ -333,7 +333,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::seqhdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -345,7 +345,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::seqhdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -353,13 +353,13 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown video OBI: %02x\n"), video_desc->GetObjectTypeId());
}
- } else if(AP4_MpegAudioSampleDescription* audio_desc =
- dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc)) {
+ } else if (AP4_MpegAudioSampleDescription* audio_desc =
+ dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc)) {
const AP4_DataBuffer* di = audio_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = ∅
}
@@ -377,13 +377,13 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) memcpy(wfe + 1, di->GetData(), di->GetDataSize());
- switch(audio_desc->GetObjectTypeId()) {
+ switch (audio_desc->GetObjectTypeId()) {
case AP4_MPEG4_AUDIO_OTI:
case AP4_MPEG2_AAC_AUDIO_MAIN_OTI: // ???
case AP4_MPEG2_AAC_AUDIO_LC_OTI: // ???
case AP4_MPEG2_AAC_AUDIO_SSRP_OTI: // ???
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- if(wfe->cbSize >= 2 && wfe->nChannels < 8) {
+ if (wfe->cbSize >= 2 && wfe->nChannels < 8) {
wfe->nChannels = (((BYTE*)(wfe+1))[1]>>3) & 0xf;
wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
}
@@ -396,7 +396,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::mpahdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), false, &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), false, &mt2)) {
mt = mt2;
}
}
@@ -410,7 +410,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::dtshdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -418,28 +418,28 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown audio OBI: %02x\n"), audio_desc->GetObjectTypeId());
}
- } else if(AP4_MpegSystemSampleDescription* system_desc =
- dynamic_cast<AP4_MpegSystemSampleDescription*>(desc)) {
+ } else if (AP4_MpegSystemSampleDescription* system_desc =
+ dynamic_cast<AP4_MpegSystemSampleDescription*>(desc)) {
const AP4_DataBuffer* di = system_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = ∅
}
- switch(system_desc->GetObjectTypeId()) {
+ switch (system_desc->GetObjectTypeId()) {
case AP4_NERO_VOBSUB:
- if(di->GetDataSize() >= 16*4) {
+ if (di->GetDataSize() >= 16*4) {
CSize size(720, 576);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
size.cx = tkhd->GetWidth()>>16;
size.cy = tkhd->GetHeight()>>16;
}
const AP4_Byte* pal = di->GetData();
CAtlList<CStringA> sl;
- for(int i = 0; i < 16*4; i += 4) {
+ for (int i = 0; i < 16*4; i += 4) {
BYTE y = (pal[i+1]-16)*255/219;
BYTE u = pal[i+2];
BYTE v = pal[i+3];
@@ -473,14 +473,14 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown audio OBI: %02x\n"), system_desc->GetObjectTypeId());
}
- } else if(AP4_UnknownSampleDescription* unknown_desc =
- dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
+ } else if (AP4_UnknownSampleDescription* unknown_desc =
+ dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
- if(dynamic_cast<AP4_TextSampleEntry*>(sample_entry)
+ if (dynamic_cast<AP4_TextSampleEntry*>(sample_entry)
|| dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
mt.majortype = MEDIATYPE_Subtitle;
mt.subtype = MEDIASUBTYPE_ASS2;
@@ -506,22 +506,22 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
}
}
- } else if(AP4_Avc1SampleEntry* avc1 = dynamic_cast<AP4_Avc1SampleEntry*>(
+ } else if (AP4_Avc1SampleEntry* avc1 = dynamic_cast<AP4_Avc1SampleEntry*>(
track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd/avc1"))) {
- if(AP4_AvcCAtom* avcC = dynamic_cast<AP4_AvcCAtom*>(avc1->GetChild(AP4_ATOM_TYPE_AVCC))) {
+ if (AP4_AvcCAtom* avcC = dynamic_cast<AP4_AvcCAtom*>(avc1->GetChild(AP4_ATOM_TYPE_AVCC))) {
SetTrackName(&TrackName, _T("MPEG4 Video (H264)"));
const AP4_DataBuffer* di = avcC->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = ∅
}
int num = 1;
int den = 1;
- if(AP4_PaspAtom* pasp = dynamic_cast<AP4_PaspAtom*>(avc1->GetChild(AP4_ATOM_TYPE_PASP))) {
+ if (AP4_PaspAtom* pasp = dynamic_cast<AP4_PaspAtom*>(avc1->GetChild(AP4_ATOM_TYPE_PASP))) {
num = pasp->GetNum();
den = pasp->GetDen();
}
- if(num <= 0 || den <= 0) { // if bad AR
+ if (num <= 0 || den <= 0) { // if bad AR
num = den = 1; // then reset AR
}
@@ -543,7 +543,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CSize aspect(vih->hdr.bmiHeader.biWidth * num, vih->hdr.bmiHeader.biHeight * den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
vih->hdr.dwPictAspectRatioX = aspect.cx;
@@ -563,10 +563,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE* src_end = (BYTE*)data + size;
BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + size;
- for(int i = 0; i < 2; i++) {
- for(int n = *src++ & 0x1f; n > 0; n--) {
+ for (int i = 0; i < 2; i++) {
+ for (int n = *src++ & 0x1f; n > 0; n--) {
int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end) {
+ if (src + len > src_end || dst + len > dst_end) {
ASSERT(0);
break;
}
@@ -583,11 +583,11 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
b_HasVideo = true;
}
- } else if(AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
- track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd"))) {
+ } else if (AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd"))) {
const AP4_DataBuffer& db = stsd->GetDataBuffer();
- for(AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
+ for (AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
item;
item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
@@ -595,22 +595,22 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) AP4_Atom::Type type = atom->GetType();
DWORD fourcc;
- if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0)) {
+ if ((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0)) {
fourcc = type & 0xffff;
- } else if(type == AP4_ATOM_TYPE__MP3) {
+ } else if (type == AP4_ATOM_TYPE__MP3) {
SetTrackName(&TrackName, _T("MPEG Audio (MP3)"));
fourcc = 0x0055;
- } else if((type == AP4_ATOM_TYPE__AC3) || (type == AP4_ATOM_TYPE_SAC3) || (type == AP4_ATOM_TYPE_EAC3)) {
- if(type == AP4_ATOM_TYPE_EAC3) {
+ } else if ((type == AP4_ATOM_TYPE__AC3) || (type == AP4_ATOM_TYPE_SAC3) || (type == AP4_ATOM_TYPE_EAC3)) {
+ if (type == AP4_ATOM_TYPE_EAC3) {
SetTrackName(&TrackName, _T("AC-3 Audio"));
} else {
SetTrackName(&TrackName, _T("Enhanced AC-3 audio"));
}
fourcc = 0x2000;
- } else if(type == AP4_ATOM_TYPE_MP4A) {
+ } else if (type == AP4_ATOM_TYPE_MP4A) {
SetTrackName(&TrackName, _T("MPEG-2 Audio AAC"));
fourcc = WAVE_FORMAT_AAC;
- } else if(type == AP4_ATOM_TYPE_NMOS) {
+ } else if (type == AP4_ATOM_TYPE_NMOS) {
SetTrackName(&TrackName, _T("NellyMoser Audio"));
fourcc = MAKEFOURCC('N','E','L','L');
} else {
@@ -621,7 +621,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ((type << 24) & 0xff000000);
}
- if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom)) {
+ if (AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom)) {
mt.majortype = MEDIATYPE_Video;
mt.subtype = FOURCCMap(fourcc);
mt.formattype = FORMAT_VideoInfo;
@@ -642,7 +642,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) _strlwr((char*)&buff);
AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
- if(typelwr != fourcc) {
+ if (typelwr != fourcc) {
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
mts.Add(mt);
b_HasVideo = true;
@@ -651,48 +651,48 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) _strupr((char*)&buff);
AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
- if(typeupr != fourcc) {
+ if (typeupr != fourcc) {
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
mts.Add(mt);
b_HasVideo = true;
}
break;
- } else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom)) {
+ } else if (AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom)) {
if (ase->GetEndian()==1) {
if (type==AP4_ATOM_TYPE_IN24 || type==AP4_ATOM_TYPE_IN32 ||
type==AP4_ATOM_TYPE_FL32 || type==AP4_ATOM_TYPE_FL64) {
fourcc = type; //reverse fourcc
}
}
-
+
DWORD nSampleRate = ase->GetSampleRate();
WORD nChannels = ase->GetChannelCount();
DWORD nAvgBytesPerSec = 0;
- if(type == AP4_ATOM_TYPE_EAC3) {
+ if (type == AP4_ATOM_TYPE_EAC3) {
AP4_Sample sample;
AP4_DataBuffer sample_data;
AP4_Cardinal SampleCount = track->GetSampleCount();
- if(SampleCount) {
+ if (SampleCount) {
track->ReadSample(1, sample, sample_data);
const AP4_Byte* data = sample_data.GetData();
AP4_Size size = sample_data.GetDataSize();
CGolombBuffer gb((BYTE *)data, size);
- for(; size >= 7 && gb.BitRead(16, true) != 0x0b77; size--) {
+ for (; size >= 7 && gb.BitRead(16, true) != 0x0b77; size--) {
gb.BitRead(8);
}
WORD sync = (WORD)gb.BitRead(16);
- if((size >= 7) && (sync == 0x0b77)) {
+ if ((size >= 7) && (sync == 0x0b77)) {
static int freq[] = {48000, 44100, 32000, 0};
BYTE num_blocks;
gb.BitRead(2);
gb.BitRead(3);
WORD frame_size = (gb.BitRead(11) + 1) << 1;
BYTE sr_code = gb.BitRead(2);
- if(sr_code == 3) {
+ if (sr_code == 3) {
BYTE sr_code2 = gb.BitRead(2);
nSampleRate = freq[sr_code2] / 2;
} else {
@@ -713,7 +713,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mt.formattype = FORMAT_WaveFormatEx;
wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + (type == AP4_ATOM_TYPE_MP4A ? 0 : db.GetDataSize()));
memset(wfe, 0, mt.FormatLength());
- if(!(fourcc & 0xffff0000)) {
+ if (!(fourcc & 0xffff0000)) {
wfe->wFormatTag = (WORD)fourcc;
}
wfe->nSamplesPerSec = nSampleRate;
@@ -727,7 +727,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) } else {
mt.subtype = FOURCCMap(fourcc);
}
- if(type != AP4_ATOM_TYPE_MP4A) {
+ if (type != AP4_ATOM_TYPE_MP4A) {
wfe->cbSize = db.GetDataSize();
memcpy(wfe+1, db.GetData(), db.GetDataSize());
}
@@ -740,12 +740,12 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
continue;
}
REFERENCE_TIME rtDuration = 10000i64 * track->GetDurationMs();
- if(m_rtDuration < rtDuration) {
+ if (m_rtDuration < rtDuration) {
m_rtDuration = rtDuration;
}
@@ -754,19 +754,19 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CStringW name, lang;
name.Format(L"Output %d", id);
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
name = TrackName;
}
- if(!TrackLanguage.IsEmpty()) {
- if(TrackLanguage != L"und") {
+ if (!TrackLanguage.IsEmpty()) {
+ if (TrackLanguage != L"und") {
name += " (" + TrackLanguage + ")";
}
}
- for(int i = 0, j = mts.GetCount(); i < j; i++) {
+ for (int i = 0, j = mts.GetCount(); i < j; i++) {
BITMAPINFOHEADER bih;
- if(ExtractBIH(&mts[i], &bih)) {
+ if (ExtractBIH(&mts[i], &bih)) {
m_framesize.cx = bih.biWidth;
m_framesize.cy = abs(bih.biHeight);
}
@@ -774,10 +774,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
pPinOut->SetProperty(L"NAME", TrackName);
}
- if(!TrackLanguage.IsEmpty()) {
+ if (!TrackLanguage.IsEmpty()) {
pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
}
@@ -785,7 +785,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_trackpos[id] = trackpos();
- if(mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2) {
+ if (mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2) {
LPCWSTR postfix = L" (plain text)";
mts[0].subtype = MEDIASUBTYPE_UTF8;
@@ -797,10 +797,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
pPinOut->SetProperty(L"NAME", TrackName + postfix);
}
- if(!TrackLanguage.IsEmpty()) {
+ if (!TrackLanguage.IsEmpty()) {
pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
}
@@ -808,10 +808,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- if(AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl"))) {
+ if (AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl"))) {
AP4_Array<AP4_ChplAtom::AP4_Chapter>& chapters = chpl->GetChapters();
- for(AP4_Cardinal i = 0; i < chapters.ItemCount(); i++) {
+ for (AP4_Cardinal i = 0; i < chapters.ItemCount(); i++) {
AP4_ChplAtom::AP4_Chapter& chapter = chapters[i];
ChapAppend(chapter.Time, UTF8To16(ConvertMBCS(chapter.Name.c_str(), ANSI_CHARSET, CP_UTF8))); // this is b0rked, thx to nero :P
}
@@ -819,29 +819,29 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ChapSort();
}
- if(AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst"))) {
+ if (AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst"))) {
CStringW title, artist, writer, album, year, appl, desc, gen, track;
- for(AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
+ for (AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
item;
item = item->GetNext()) {
- if(AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData())) {
- if(AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA))) {
+ if (AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData())) {
+ if (AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA))) {
const AP4_DataBuffer* db = data->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRKN) {
- if(db->GetDataSize() >= 4) {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRKN) {
+ if (db->GetDataSize() >= 4) {
unsigned short n = (db->GetData()[2] << 8) | db->GetData()[3];
- if(n > 0 && n < 100) {
+ if (n > 0 && n < 100) {
track.Format(L"%02d", n);
- } else if(n >= 100) {
+ } else if (n >= 100) {
track.Format(L"%d", n);
}
}
} else {
CStringW str = UTF8To16(CStringA((LPCSTR)db->GetData(), db->GetDataSize()));
- switch(atom->GetType()) {
+ switch (atom->GetType()) {
case AP4_ATOM_TYPE_NAM:
title = str;
break;
@@ -872,33 +872,33 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- if(!title.IsEmpty()) {
- if(!track.IsEmpty()) {
+ if (!title.IsEmpty()) {
+ if (!track.IsEmpty()) {
title = track + L" - " + title;
}
- if(!album.IsEmpty()) {
+ if (!album.IsEmpty()) {
title = album + L" - " + title;
}
- if(!year.IsEmpty()) {
+ if (!year.IsEmpty()) {
title += L" - " + year;
}
- if(!gen.IsEmpty()) {
+ if (!gen.IsEmpty()) {
title += L" - " + gen;
}
SetProperty(L"TITL", title);
}
- if(!artist.IsEmpty()) {
+ if (!artist.IsEmpty()) {
SetProperty(L"AUTH", artist);
- } else if(!writer.IsEmpty()) {
+ } else if (!writer.IsEmpty()) {
SetProperty(L"AUTH", writer);
}
- if(!appl.IsEmpty()) {
+ if (!appl.IsEmpty()) {
SetProperty(L"APPL", appl);
}
- if(!desc.IsEmpty()) {
+ if (!desc.IsEmpty()) {
SetProperty(L"DESC", desc);
}
}
@@ -916,7 +916,7 @@ bool CMP4SplitterFilter::DemuxInit() AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
pPair->m_value.index = 0;
@@ -925,7 +925,7 @@ bool CMP4SplitterFilter::DemuxInit() AP4_Track* track = movie->GetTrack(pPair->m_key);
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(0, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(0, sample))) {
pPair->m_value.ts = sample.GetCts();
}
}
@@ -940,29 +940,29 @@ void CMP4SplitterFilter::DemuxSeek(REFERENCE_TIME rt) AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index))) {
+ if (AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index))) {
pPair->m_value.index = 0;
}
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample))) {
pPair->m_value.ts = sample.GetCts();
}
// FIXME: slow search & stss->m_Entries is private
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
- if(stss->m_Entries.ItemCount() > 0) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (stss->m_Entries.ItemCount() > 0) {
AP4_Cardinal i = -1;
- while(++i < stss->m_Entries.ItemCount() && stss->m_Entries[i]-1 <= pPair->m_value.index) {
+ while (++i < stss->m_Entries.ItemCount() && stss->m_Entries[i]-1 <= pPair->m_value.index) {
;
}
- if(i > 0) {
+ if (i > 0) {
i--;
}
pPair->m_value.index = stss->m_Entries[i]-1;
@@ -990,7 +990,7 @@ static CStringW ConvertTX3GToSSA( int str_len = str.GetLength();
SSACharacter* chars = DNew SSACharacter[str_len];
- for(int i = 0; i < str_len; i++) {
+ for (int i = 0; i < str_len; i++) {
chars[i].c = str[i];
}
str.Empty();
@@ -1002,32 +1002,32 @@ static CStringW ConvertTX3GToSSA( int align = 2;
signed char h = (signed char)desc.HorizontalJustification;
signed char v = (signed char)desc.VerticalJustification;
- if(h == 0 && v < 0) {
+ if (h == 0 && v < 0) {
align = 1;
- } else if(h > 0 && v < 0) {
+ } else if (h > 0 && v < 0) {
align = 2;
- } else if(h < 0 && v < 0) {
+ } else if (h < 0 && v < 0) {
align = 3;
- } else if(h == 0 && v > 0) {
+ } else if (h == 0 && v > 0) {
align = 4;
- } else if(h > 0 && v > 0) {
+ } else if (h > 0 && v > 0) {
align = 5;
- } else if(h < 0 && v > 0) {
+ } else if (h < 0 && v > 0) {
align = 6;
- } else if(h == 0 && v == 0) {
+ } else if (h == 0 && v == 0) {
align = 7;
- } else if(h > 0 && v == 0) {
+ } else if (h > 0 && v == 0) {
align = 8;
- } else if(h < 0 && v == 0) {
+ } else if (h < 0 && v == 0) {
align = 9;
}
str.Format(L"{\\an%d}%s", align, CStringW(str));
- if(!font.CompareNoCase(L"serif")) {
+ if (!font.CompareNoCase(L"serif")) {
font = L"Times New Roman";
- } else if(!font.CompareNoCase(L"sans-serif")) {
+ } else if (!font.CompareNoCase(L"sans-serif")) {
font = L"Arial";
- } else if(!font.CompareNoCase(L"monospace")) {
+ } else if (!font.CompareNoCase(L"monospace")) {
font = L"Courier New";
}
str.Format(L"{\\fn%s}%s", font, CStringW(str));
@@ -1055,7 +1055,7 @@ static CStringW ConvertTX3GToSSA( const AP4_Byte* hclr = (const AP4_Byte*)&desc.BackgroundColor;
- while(size > 8) {
+ while (size > 8) {
DWORD tag_size = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
DWORD tag = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
@@ -1065,11 +1065,11 @@ static CStringW ConvertTX3GToSSA( tag_size -= 8;
const AP4_Byte* next = mods + tag_size;
- if(tag == 'styl') {
+ if (tag == 'styl') {
WORD styl_count = (mods[0]<<8)|(mods[1]);
mods += 2;
- while(styl_count-- > 0) {
+ while (styl_count-- > 0) {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
@@ -1083,11 +1083,11 @@ static CStringW ConvertTX3GToSSA( const AP4_Byte* color = mods;
mods += 4;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", color[2], color[1], color[0], 255 - color[3]);
@@ -1103,19 +1103,19 @@ static CStringW ConvertTX3GToSSA( chars[end-1].post += font_flags;
}
}
- } else if(tag == 'hclr') {
+ } else if (tag == 'hclr') {
hclr = mods;
- } else if(tag == 'hlit') {
+ } else if (tag == 'hlit') {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\3c%02x%02x%02x\\3a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
@@ -1125,20 +1125,20 @@ static CStringW ConvertTX3GToSSA( chars[start].pre += L"{\\bord0.1}";
chars[end-1].post += L"{\\bord}";
}
- } else if(tag == 'blnk') {
+ } else if (tag == 'blnk') {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
// cheap...
- for(int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha) {
+ for (int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha) {
CStringW s;
s.Format(L"{\\t(%d, %d, \\alpha&H%02x&)}", i, i + 750, alpha);
chars[start].pre += s;
@@ -1146,7 +1146,7 @@ static CStringW ConvertTX3GToSSA( chars[end-1].post += L"{\\alpha}";
}
- } else if(tag == 'tbox') {
+ } else if (tag == 'tbox') {
rbox.top = (mods[0]<<8)|(mods[1]);
mods += 2;
rbox.left = (mods[0]<<8)|(mods[1]);
@@ -1155,13 +1155,13 @@ static CStringW ConvertTX3GToSSA( mods += 2;
rbox.right = (mods[0]<<8)|(mods[1]);
mods += 2;
- } else if(tag == 'krok' && !(desc.DisplayFlags & 0x800)) {
+ } else if (tag == 'krok' && !(desc.DisplayFlags & 0x800)) {
DWORD start_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
WORD krok_count = (mods[0]<<8)|(mods[1]);
mods += 2;
- while(krok_count-- > 0) {
+ while (krok_count-- > 0) {
DWORD end_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
WORD start = (mods[0]<<8)|(mods[1]);
@@ -1169,11 +1169,11 @@ static CStringW ConvertTX3GToSSA( WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\kt%d\\kf%d}", start_time/10, (end_time - start_time)/10);
@@ -1192,7 +1192,7 @@ static CStringW ConvertTX3GToSSA( // continous karaoke
- if(desc.DisplayFlags & 0x800) {
+ if (desc.DisplayFlags & 0x800) {
CStringW s;
s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
@@ -1200,17 +1200,17 @@ static CStringW ConvertTX3GToSSA( int breaks = 0;
- for(int i = 0, j = 0; i <= str_len; i++) {
- if(chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
+ for (int i = 0, j = 0; i <= str_len; i++) {
+ if (chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
breaks++;
}
}
- if(str_len > breaks) {
+ if (str_len > breaks) {
float dur = (float)max(durationms - 500, 0) / 10;
- for(int i = 0, j = 0; i <= str_len; i++) {
- if(i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
+ for (int i = 0, j = 0; i <= str_len; i++) {
+ if (i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
s.Format(L"{\\kf%d}", (int)(dur * (i - j) / (str_len - breaks)));
chars[j].pre += s;
j = i+1;
@@ -1221,10 +1221,10 @@ static CStringW ConvertTX3GToSSA( //
- for(int i = 0; i < str_len; i++) {
+ for (int i = 0; i < str_len; i++) {
str += chars[i].pre;
str += chars[i].c;
- if(desc.DisplayFlags & 0x20000) {
+ if (desc.DisplayFlags & 0x20000) {
str += L"\\N";
}
str += chars[i].post;
@@ -1234,7 +1234,7 @@ static CStringW ConvertTX3GToSSA( //
- if(rbox.IsRectEmpty()) {
+ if (rbox.IsRectEmpty()) {
rbox.SetRect(0, 0, framesize.cx, framesize.cy);
}
rbox.OffsetRect(translation);
@@ -1243,11 +1243,11 @@ static CStringW ConvertTX3GToSSA( rbox2.DeflateRect(2, 2);
CRect r(0,0,0,0);
- if(rbox2.Height() > 0) {
+ if (rbox2.Height() > 0) {
r.top = rbox2.top;
r.bottom = framesize.cy - rbox2.bottom;
}
- if(rbox2.Width() > 0) {
+ if (rbox2.Width() > 0) {
r.left = rbox2.left;
r.right = framesize.cx - rbox2.right;
}
@@ -1268,30 +1268,30 @@ bool CMP4SplitterFilter::DemuxLoop() AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
CAtlMap<DWORD, trackpos>::CPair* pPairNext = NULL;
REFERENCE_TIME rtNext = 0;
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
- if(!pPin->IsConnected()) {
+ if (!pPin->IsConnected()) {
continue;
}
REFERENCE_TIME rt = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * pPair->m_value.ts);
- if(pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext)) {
+ if (pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext)) {
pPairNext = pPair;
rtNext = rt;
}
}
- if(!pPairNext) {
+ if (!pPairNext) {
break;
}
@@ -1302,7 +1302,7 @@ bool CMP4SplitterFilter::DemuxLoop() AP4_Sample sample;
AP4_DataBuffer data;
- if(pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
+ if (pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
const CMediaType& mt = pPin->CurrentMediaType();
CAutoPtr<Packet> p(DNew Packet());
@@ -1312,25 +1312,25 @@ bool CMP4SplitterFilter::DemuxLoop() p->bSyncPoint = TRUE;
// FIXME: slow search & stss->m_Entries is private
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
- if(stss->m_Entries.ItemCount() > 0) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (stss->m_Entries.ItemCount() > 0) {
p->bSyncPoint = FALSE;
AP4_Cardinal i = -1;
- while(++i < stss->m_Entries.ItemCount())
- if(stss->m_Entries[i]-1 == pPairNext->m_value.index) {
+ while (++i < stss->m_Entries.ItemCount())
+ if (stss->m_Entries[i]-1 == pPairNext->m_value.index) {
p->bSyncPoint = TRUE;
}
}
}
//
- if(track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1) {
+ if (track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
int nBlockAlign = 1200;
- if(wfe->nBlockAlign > 1) {
+ if (wfe->nBlockAlign > 1) {
nBlockAlign = wfe->nBlockAlign;
pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
}
@@ -1339,40 +1339,40 @@ bool CMP4SplitterFilter::DemuxLoop() TRACE(_T("track->GetSampleCount() %d %d "), track->GetSampleCount(),pPairNext->m_value.index);
int fFirst = true;
- while(AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
+ while (AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
AP4_Size size = data.GetDataSize();
const AP4_Byte* ptr = data.GetData();
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
p->Add(ptr[i]);
}
- if(fFirst) {
+ if (fFirst) {
p->rtStart = p->rtStop = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
fFirst = false;
}
p->rtStop += (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
- if(pPairNext->m_value.index+1 >= track->GetSampleCount() || (int)p->GetCount() >= nBlockAlign) {
+ if (pPairNext->m_value.index+1 >= track->GetSampleCount() || (int)p->GetCount() >= nBlockAlign) {
break;
}
pPairNext->m_value.index++;
}
- } else if(track->GetType() == AP4_Track::TYPE_TEXT) {
+ } else if (track->GetType() == AP4_Track::TYPE_TEXT) {
CStringA dlgln_bkg, dlgln_plaintext;
const AP4_Byte* ptr = data.GetData();
AP4_Size avail = data.GetDataSize();
- if(avail > 2) {
+ if (avail > 2) {
AP4_UI16 size = (ptr[0] << 8) | ptr[1];
- if(size <= avail-2) {
+ if (size <= avail-2) {
CStringA str;
- if(size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff) {
+ if (size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff) {
CStringW wstr = CStringW((LPCWSTR)&ptr[2], size/2);
- for(int i = 0; i < wstr.GetLength(); i++) {
+ for (int i = 0; i < wstr.GetLength(); i++) {
wstr.SetAt(i, ((WORD)wstr[i] >> 8) | ((WORD)wstr[i] << 8));
}
str = UTF16To8(wstr);
@@ -1382,34 +1382,34 @@ bool CMP4SplitterFilter::DemuxLoop() CStringA dlgln = str;
- if(mt.subtype == MEDIASUBTYPE_ASS2) {
+ if (mt.subtype == MEDIASUBTYPE_ASS2) {
AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
dlgln_plaintext = str;
CPoint translation(0, 0);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
AP4_Float x, y;
tkhd->GetTranslation(x, y);
translation.SetPoint((int)x, (int)y);
}
- if(AP4_UnknownSampleDescription* unknown_desc = dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
+ if (AP4_UnknownSampleDescription* unknown_desc = dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
- if(AP4_TextSampleEntry* text = dynamic_cast<AP4_TextSampleEntry*>(sample_entry)) {
+ if (AP4_TextSampleEntry* text = dynamic_cast<AP4_TextSampleEntry*>(sample_entry)) {
const AP4_TextSampleEntry::AP4_TextDescription& d = text->GetDescription();
// TODO
- } else if(AP4_Tx3gSampleEntry* tx3g = dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
+ } else if (AP4_Tx3gSampleEntry* tx3g = dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc = tx3g->GetDescription();
CStringW font = L"Arial";
- if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(tx3g->GetChild(AP4_ATOM_TYPE_FTAB))) {
+ if (AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(tx3g->GetChild(AP4_ATOM_TYPE_FTAB))) {
AP4_String Name;
- if(AP4_SUCCEEDED(ftab->LookupFont(desc.Style.Font.Id, Name))) {
+ if (AP4_SUCCEEDED(ftab->LookupFont(desc.Style.Font.Id, Name))) {
font = Name.c_str();
}
}
@@ -1425,7 +1425,7 @@ bool CMP4SplitterFilter::DemuxLoop() const AP4_Byte* bclr = (const AP4_Byte*)&desc.BackgroundColor;
- if(bclr[3]) {
+ if (bclr[3]) {
CPoint tl = rbox.TopLeft();
rbox.OffsetRect(-tl.x, -tl.y);
@@ -1450,7 +1450,7 @@ bool CMP4SplitterFilter::DemuxLoop() }
}
- if(!dlgln_bkg.IsEmpty()) {
+ if (!dlgln_bkg.IsEmpty()) {
CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber;
p2->rtStart = p->rtStart;
@@ -1460,7 +1460,7 @@ bool CMP4SplitterFilter::DemuxLoop() hr = DeliverPacket(p2);
}
- if(!dlgln_plaintext.IsEmpty()) {
+ if (!dlgln_plaintext.IsEmpty()) {
CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber ^ 0x80402010;
p2->rtStart = p->rtStart;
@@ -1477,7 +1477,7 @@ bool CMP4SplitterFilter::DemuxLoop() {
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample))) {
pPairNext->m_value.ts = sample.GetCts();
}
}
@@ -1493,23 +1493,23 @@ STDMETHODIMP CMP4SplitterFilter::GetKeyFrameCount(UINT& nKFs) {
CheckPointer(m_pFile, E_UNEXPECTED);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO) {
+ if (track->GetType() != AP4_Track::TYPE_VIDEO) {
continue;
}
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
nKFs = stss->m_Entries.ItemCount();
return S_OK;
}
@@ -1524,32 +1524,32 @@ STDMETHODIMP CMP4SplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM CheckPointer(pKFs, E_POINTER);
CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO) {
+ if (track->GetType() != AP4_Track::TYPE_VIDEO) {
continue;
}
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
nKFs = 0;
- for(AP4_Cardinal i = 0; i < stss->m_Entries.ItemCount(); i++) {
+ for (AP4_Cardinal i = 0; i < stss->m_Entries.ItemCount(); i++) {
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(stss->m_Entries[i]-1, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(stss->m_Entries[i]-1, sample))) {
pKFs[nKFs++] = 10000000i64 * sample.GetCts() / track->GetMediaTimeScale();
}
}
@@ -1584,8 +1584,8 @@ CMPEG4VideoSplitterFilter::CMPEG4VideoSplitterFilter(LPUNKNOWN pUnk, HRESULT* ph void CMPEG4VideoSplitterFilter::SkipUserData()
{
m_pFile->BitByteAlign();
- while(m_pFile->BitRead(32, true) == 0x000001b2)
- while(m_pFile->BitRead(24, true) != 0x000001) {
+ while (m_pFile->BitRead(32, true) == 0x000001b2)
+ while (m_pFile->BitRead(24, true) != 0x000001) {
m_pFile->BitRead(8);
}
}
@@ -1598,10 +1598,10 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -1617,31 +1617,31 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE pary = 1;
REFERENCE_TIME atpf = 400000;
- if(m_pFile->BitRead(24, true) != 0x000001) {
+ if (m_pFile->BitRead(24, true) != 0x000001) {
return E_FAIL;
}
BYTE id;
- while(m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos())) {
- if(id == 0xb5) {
+ while (m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos())) {
+ if (id == 0xb5) {
BYTE is_visual_object_identifier = (BYTE)m_pFile->BitRead(1);
- if(is_visual_object_identifier) {
+ if (is_visual_object_identifier) {
BYTE visual_object_verid = (BYTE)m_pFile->BitRead(4);
BYTE visual_object_priority = (BYTE)m_pFile->BitRead(3);
}
BYTE visual_object_type = (BYTE)m_pFile->BitRead(4);
- if(visual_object_type == 1 || visual_object_type == 2) {
+ if (visual_object_type == 1 || visual_object_type == 2) {
BYTE video_signal_type = (BYTE)m_pFile->BitRead(1);
- if(video_signal_type) {
+ if (video_signal_type) {
BYTE video_format = (BYTE)m_pFile->BitRead(3);
BYTE video_range = (BYTE)m_pFile->BitRead(1);
BYTE colour_description = (BYTE)m_pFile->BitRead(1);
- if(colour_description) {
+ if (colour_description) {
BYTE colour_primaries = (BYTE)m_pFile->BitRead(8);
BYTE transfer_characteristics = (BYTE)m_pFile->BitRead(8);
BYTE matrix_coefficients = (BYTE)m_pFile->BitRead(8);
@@ -1651,29 +1651,29 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) SkipUserData();
- if(visual_object_type == 1) {
- if(m_pFile->BitRead(24) != 0x000001) {
+ if (visual_object_type == 1) {
+ if (m_pFile->BitRead(24) != 0x000001) {
break;
}
BYTE video_object_start_code = (BYTE)m_pFile->BitRead(8);
- if(video_object_start_code < 0x00 || video_object_start_code > 0x1f) {
+ if (video_object_start_code < 0x00 || video_object_start_code > 0x1f) {
break;
}
- if(m_pFile->BitRead(24) != 0x000001) {
+ if (m_pFile->BitRead(24) != 0x000001) {
break;
}
BYTE video_object_layer_start_code = (DWORD)m_pFile->BitRead(8);
- if(video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f) {
+ if (video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f) {
break;
}
BYTE random_accessible_vol = (BYTE)m_pFile->BitRead(1);
BYTE video_object_type_indication = (BYTE)m_pFile->BitRead(8);
- if(video_object_type_indication == 0x12) { // Fine Granularity Scalable
+ if (video_object_type_indication == 0x12) { // Fine Granularity Scalable
break; // huh
}
@@ -1681,14 +1681,14 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE video_object_layer_verid = 0;
- if(is_object_layer_identifier) {
+ if (is_object_layer_identifier) {
video_object_layer_verid = (BYTE)m_pFile->BitRead(4);
BYTE video_object_layer_priority = (BYTE)m_pFile->BitRead(3);
}
BYTE aspect_ratio_info = (BYTE)m_pFile->BitRead(4);
- switch(aspect_ratio_info) {
+ switch (aspect_ratio_info) {
default:
ASSERT(0);
break;
@@ -1720,32 +1720,32 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE vol_control_parameters = (BYTE)m_pFile->BitRead(1);
- if(vol_control_parameters) {
+ if (vol_control_parameters) {
BYTE chroma_format = (BYTE)m_pFile->BitRead(2);
BYTE low_delay = (BYTE)m_pFile->BitRead(1);
BYTE vbv_parameters = (BYTE)m_pFile->BitRead(1);
- if(vbv_parameters) {
+ if (vbv_parameters) {
WORD first_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD latter_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD first_half_vbv_buffer_size = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
BYTE latter_half_vbv_buffer_size = (BYTE)m_pFile->BitRead(3);
WORD first_half_vbv_occupancy = (WORD)m_pFile->BitRead(11);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD latter_half_vbv_occupancy = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
}
@@ -1753,43 +1753,43 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE video_object_layer_shape = (BYTE)m_pFile->BitRead(2);
- if(video_object_layer_shape == 3 && video_object_layer_verid != 1) {
+ if (video_object_layer_shape == 3 && video_object_layer_verid != 1) {
BYTE video_object_layer_shape_extension = (BYTE)m_pFile->BitRead(4);
}
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD vop_time_increment_resolution = (WORD)m_pFile->BitRead(16);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
BYTE fixed_vop_rate = (BYTE)m_pFile->BitRead(1);
- if(fixed_vop_rate) {
+ if (fixed_vop_rate) {
int bits = 0;
- for(WORD i = vop_time_increment_resolution; i; i /= 2) {
+ for (WORD i = vop_time_increment_resolution; i; i /= 2) {
bits++;
}
WORD fixed_vop_time_increment = m_pFile->BitRead(bits);
- if(fixed_vop_time_increment) {
+ if (fixed_vop_time_increment) {
atpf = 10000000i64 * fixed_vop_time_increment / vop_time_increment_resolution;
}
}
- if(video_object_layer_shape != 2) {
- if(video_object_layer_shape == 0) {
- if(!m_pFile->BitRead(1)) {
+ if (video_object_layer_shape != 2) {
+ if (video_object_layer_shape == 0) {
+ if (!m_pFile->BitRead(1)) {
break;
}
width = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
height = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
}
@@ -1800,12 +1800,12 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) // ...
}
}
- } else if(id == 0xb6) {
+ } else if (id == 0xb6) {
m_seqhdrsize = m_pFile->GetPos() - 4;
}
}
- if(!width || !height) {
+ if (!width || !height) {
return E_FAIL;
}
@@ -1866,19 +1866,19 @@ bool CMPEG4VideoSplitterFilter::DemuxLoop() DWORD sync = ~0;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
- for(int i = 0; i < 65536; i++) { // don't call CheckRequest so often
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ for (int i = 0; i < 65536; i++) { // don't call CheckRequest so often
bool eof = !m_pFile->GetRemaining();
- if(p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof)) {
+ if (p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof)) {
hr = DeliverPacket(p);
}
- if(eof) {
+ if (eof) {
break;
}
- if(!p) {
+ if (!p) {
p.Attach(DNew Packet());
p->SetCount(0, 1024);
p->TrackNumber = 0;
diff --git a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp index 88ce5ebfa..b7331bba4 100644 --- a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp +++ b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp @@ -6,7 +6,7 @@ CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr) : CBaseSplitterFileEx(pReader, hr, DEFAULT_CACHE_LENGTH, false)
, m_pAp4File(NULL)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp index 027b97b41..092e19334 100644 --- a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp +++ b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp @@ -32,7 +32,7 @@ static void LOG(LPCTSTR fmt, ...) {
va_list args;
va_start(args, fmt);
- if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at"))) {
+ if (FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at"))) {
fseek(f, 0, 2);
_vftprintf(f, fmt, args);
fclose(f);
@@ -62,7 +62,7 @@ using namespace MatroskaReader; static void bswap(BYTE* s, int len)
{
- for(BYTE* d = s + len-1; s < d; s++, d--) {
+ for (BYTE* d = s + len-1; s < d; s++, d--) {
*s ^= *d, *d ^= *s, *s ^= *d;
}
}
@@ -75,7 +75,7 @@ CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr) : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
, m_rtOffset(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -84,17 +84,17 @@ CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr) HRESULT CMatroskaFile::Init()
{
DWORD dw;
- if(FAILED(Read(dw)) || dw != 0x1A45DFA3) {
+ if (FAILED(Read(dw)) || dw != 0x1A45DFA3) {
return E_FAIL;
}
CMatroskaNode Root(this);
- if(FAILED(Parse(&Root))) {
+ if (FAILED(Parse(&Root))) {
return E_FAIL;
}
CAutoPtr<CMatroskaNode> pSegment, pCluster;
- if((pSegment = Root.Child(0x18538067))
+ if ((pSegment = Root.Child(0x18538067))
&& (pCluster = pSegment->Child(0x1F43B675))) {
Cluster c0;
c0.ParseTimeCode(pCluster);
@@ -108,7 +108,7 @@ template <class T> HRESULT CMatroskaFile::Read(T& var)
{
HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
- if(S_OK == hr) {
+ if (S_OK == hr) {
bswap((BYTE*)&var, sizeof(var));
}
return hr;
@@ -119,12 +119,12 @@ HRESULT CMatroskaFile::Parse(CMatroskaNode* pMN0) BeginChunk
case 0x1A45DFA3:
m_ebml.Parse(pMN);
- if((m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION) && m_ebml.DocType != DOCTYPE_WEBM) {
+ if ((m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION) && m_ebml.DocType != DOCTYPE_WEBM) {
return E_FAIL;
}
break;
case 0x18538067:
- if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) {
+ if (m_segment.SegmentInfo.SegmentUID.IsEmpty()) {
m_segment.ParseMinimal(pMN);
}
break;
@@ -198,14 +198,14 @@ HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0) len = pMN0->m_len;
CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
- if(!pMN) {
+ if (!pMN) {
return S_FALSE;
}
int n = 0;
do {
- switch(pMN->m_id) {
+ switch (pMN->m_id) {
case 0x1549A966:
SegmentInfo.Parse(pMN);
n++;
@@ -222,37 +222,37 @@ HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0) Cues.Parse(pMN);
break;
}
- } while(n < 3 && pMN->Next());
+ } while (n < 3 && pMN->Next());
- if(!pMN->IsRandomAccess()) {
+ if (!pMN->IsRandomAccess()) {
return S_OK;
}
- while(MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos())) {
+ while (MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos())) {
pMN->SeekTo(pos);
pMN->Parse();
- if(pMN->m_id != 0x114D9B74) {
+ if (pMN->m_id != 0x114D9B74) {
ASSERT(0);
break;
}
MetaSeekInfo.Parse(pMN);
}
- if(n == 3) {
- if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false))) {
+ if (n == 3) {
+ if (Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false))) {
do {
Cues.Parse(pMN);
- } while(pMN->Next(true));
+ } while (pMN->Next(true));
}
- if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false))) {
+ if (Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false))) {
do {
Chapters.Parse(pMN); /*BIG UGLY HACK:*/
break;
- } while(pMN->Next(true));
+ } while (pMN->Next(true));
}
- if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false))) {
+ if (Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false))) {
do {
Attachments.Parse(pMN); /*BIG UGLY HACK:*/
break;
@@ -268,26 +268,26 @@ UINT64 Segment::GetMasterTrack() UINT64 TrackNumber = 0, AltTrackNumber = 0;
POSITION pos1 = Tracks.GetHeadPosition();
- while(pos1 && TrackNumber == 0) {
+ while (pos1 && TrackNumber == 0) {
Track* pT = Tracks.GetNext(pos1);
POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2 && TrackNumber == 0) {
+ while (pos2 && TrackNumber == 0) {
TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
TrackNumber = pTE->TrackNumber;
break;
- } else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0) {
AltTrackNumber = pTE->TrackNumber;
}
}
}
- if(TrackNumber == 0) {
+ if (TrackNumber == 0) {
TrackNumber = AltTrackNumber;
}
- if(TrackNumber == 0) {
+ if (TrackNumber == 0) {
TrackNumber = 1;
}
@@ -296,14 +296,14 @@ UINT64 Segment::GetMasterTrack() ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
{
- if(ChapterUID == id) {
+ if (ChapterUID == id) {
return(this);
}
POSITION pos = ChapterAtoms.GetHeadPosition();
- while(pos) {
+ while (pos) {
ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
- if(ca) {
+ if (ca) {
return ca;
}
}
@@ -314,14 +314,14 @@ ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id) ChapterAtom* Segment::FindChapterAtom(UINT64 id, int nEditionEntry)
{
POSITION pos1 = Chapters.GetHeadPosition();
- while(pos1) {
+ while (pos1) {
Chapter* c = Chapters.GetNext(pos1);
POSITION pos2 = c->EditionEntries.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
EditionEntry* ee = c->EditionEntries.GetNext(pos2);
- if(nEditionEntry-- == 0) {
+ if (nEditionEntry-- == 0) {
return id == 0 ? ee : ee->FindChapterAtom(id);
}
}
@@ -470,12 +470,12 @@ case 0x23314F: TrackTimecodeScale.Parse(pMN);
break;
case 0xE0:
- if(S_OK == v.Parse(pMN)) {
+ if (S_OK == v.Parse(pMN)) {
DescType |= DescVideo;
}
break;
case 0xE1:
- if(S_OK == a.Parse(pMN)) {
+ if (S_OK == a.Parse(pMN)) {
DescType |= DescAudio;
}
break;
@@ -496,29 +496,29 @@ static int cesort(const void* a, const void* b) bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
{
- if(ces.ce.GetCount() == 0) {
+ if (ces.ce.GetCount() == 0) {
return true;
}
CAtlArray<ContentEncoding*> cearray;
POSITION pos = ces.ce.GetHeadPosition();
- while(pos) {
+ while (pos) {
cearray.Add(ces.ce.GetNext(pos));
}
qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
- for(int i = cearray.GetCount()-1; i >= 0; i--) {
+ for (int i = cearray.GetCount()-1; i >= 0; i--) {
ContentEncoding* ce = cearray[i];
- if(!(ce->ContentEncodingScope & Scope)) {
+ if (!(ce->ContentEncodingScope & Scope)) {
continue;
}
- if(ce->ContentEncodingType == ContentEncoding::Compression) {
- if(!data.Decompress(ce->cc)) {
+ if (ce->ContentEncodingType == ContentEncoding::Compression) {
+ if (!data.Decompress(ce->cc)) {
return false;
}
- } else if(ce->ContentEncodingType == ContentEncoding::Encryption) {
+ } else if (ce->ContentEncodingType == ContentEncoding::Encryption) {
// TODO
return false;
}
@@ -720,7 +720,7 @@ case 0xE8: TimeSlices.Parse(pMN);
break;
case 0x75A1:
- if(fFull) {
+ if (fFull) {
ba.Parse(pMN);
}
break;
@@ -737,7 +737,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) TimeCode.Set(s);
Lacing.Parse(pMN);
- if(!fFull) {
+ if (!fFull) {
return S_OK;
}
@@ -746,7 +746,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) MatroskaReader::QWORD FrameSize;
BYTE FramesInLaceLessOne;
- switch((Lacing & 0x06) >> 1) {
+ switch ((Lacing & 0x06) >> 1) {
case 0:
// No lacing
lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
@@ -755,13 +755,13 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) // Xiph lacing
BYTE n;
pMN->Read(n);
- while(n-- > 0) {
+ while (n-- > 0) {
BYTE b;
MatroskaReader::QWORD len = 0;
do {
pMN->Read(b);
len += b;
- } while(b == 0xff);
+ } while (b == 0xff);
lens.AddTail(len);
tlen += len;
}
@@ -772,7 +772,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) pMN->Read(FramesInLaceLessOne);
FramesInLaceLessOne++;
FrameSize = ((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen)) / FramesInLaceLessOne;
- while(FramesInLaceLessOne-- > 0) {
+ while (FramesInLaceLessOne-- > 0) {
lens.AddTail(FrameSize);
}
break;
@@ -788,7 +788,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) CSignedLength DiffSize;
FrameSize = FirstFrameSize;
- while(FramesInLaceLessOne--) {
+ while (FramesInLaceLessOne--) {
DiffSize.Parse(pMN);
FrameSize += DiffSize;
lens.AddTail(FrameSize);
@@ -799,7 +799,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) }
POSITION pos = lens.GetHeadPosition();
- while(pos) {
+ while (pos) {
MatroskaReader::QWORD len = lens.GetNext(pos);
CAutoPtr<CBinary> p(DNew CBinary());
p->SetCount((INT_PTR)len);
@@ -1012,7 +1012,7 @@ HRESULT CBinary::Parse(CMatroskaNode* pMN) bool CBinary::Compress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB) {
+ if (cc.ContentCompAlgo == ContentCompression::ZLIB) {
int res;
z_stream c_stream;
@@ -1020,7 +1020,7 @@ bool CBinary::Compress(ContentCompression& cc) c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
- if(Z_OK != (res = deflateInit(&c_stream, 9))) {
+ if (Z_OK != (res = deflateInit(&c_stream, 9))) {
return false;
}
@@ -1033,11 +1033,11 @@ bool CBinary::Compress(ContentCompression& cc) dst = (BYTE*)realloc(dst, ++n*10);
c_stream.next_out = &dst[(n-1)*10];
c_stream.avail_out = 10;
- if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res) {
+ if (Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res) {
free(dst);
return false;
}
- } while(0 == c_stream.avail_out && Z_STREAM_END != res);
+ } while (0 == c_stream.avail_out && Z_STREAM_END != res);
deflateEnd(&c_stream);
@@ -1054,7 +1054,7 @@ bool CBinary::Compress(ContentCompression& cc) bool CBinary::Decompress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB) {
+ if (cc.ContentCompAlgo == ContentCompression::ZLIB) {
int res;
z_stream d_stream;
@@ -1062,7 +1062,7 @@ bool CBinary::Decompress(ContentCompression& cc) d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
- if(Z_OK != (res = inflateInit(&d_stream))) {
+ if (Z_OK != (res = inflateInit(&d_stream))) {
return false;
}
@@ -1075,11 +1075,11 @@ bool CBinary::Decompress(ContentCompression& cc) dst = (unsigned char *)realloc(dst, ++n*1000);
d_stream.next_out = &dst[(n-1)*1000];
d_stream.avail_out = 1000;
- if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res) {
+ if (Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res) {
free(dst);
return false;
}
- } while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+ } while (0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
inflateEnd(&d_stream);
@@ -1089,7 +1089,7 @@ bool CBinary::Decompress(ContentCompression& cc) free(dst);
return true;
- } else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP) {
+ } else if (cc.ContentCompAlgo == ContentCompression::HDRSTRIP) {
InsertArrayAt(0, &cc.ContentCompSettings);
}
@@ -1102,7 +1102,7 @@ HRESULT CANSI::Parse(CMatroskaNode* pMN) MatroskaReader::QWORD len = pMN->m_len;
CHAR c;
- while(len-- > 0 && SUCCEEDED(pMN->Read(c))) {
+ while (len-- > 0 && SUCCEEDED(pMN->Read(c))) {
*this += c;
}
@@ -1113,7 +1113,7 @@ HRESULT CUTF8::Parse(CMatroskaNode* pMN) {
Empty();
CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len)) {
+ if (!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len)) {
return E_FAIL;
}
buff[pMN->m_len] = 0;
@@ -1124,10 +1124,10 @@ HRESULT CUTF8::Parse(CMatroskaNode* pMN) HRESULT CUInt::Parse(CMatroskaNode* pMN)
{
m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++) {
+ for (int i = 0; i < (int)pMN->m_len; i++) {
m_val <<= 8;
HRESULT hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1138,9 +1138,9 @@ HRESULT CUInt::Parse(CMatroskaNode* pMN) HRESULT CInt::Parse(CMatroskaNode* pMN)
{
m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++) {
+ for (int i = 0; i < (int)pMN->m_len; i++) {
HRESULT hr = pMN->Read(*((BYTE*)&m_val+7-i));
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1154,14 +1154,14 @@ HRESULT CFloat::Parse(CMatroskaNode* pMN) HRESULT hr = E_FAIL;
m_val = 0;
- if(pMN->m_len == 4) {
+ if (pMN->m_len == 4) {
float val = 0;
hr = pMN->Read(val);
m_val = val;
- } else if(pMN->m_len == 8) {
+ } else if (pMN->m_len == 8) {
hr = pMN->Read(m_val);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_fValid = true;
}
return hr;
@@ -1182,32 +1182,32 @@ HRESULT CID::Parse(CMatroskaNode* pMN) BYTE b = 0;
HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
int nMoreBytes = 0;
- if((b&0x80) == 0x80) {
+ if ((b&0x80) == 0x80) {
m_val = b&0xff;
nMoreBytes = 0;
- } else if((b&0xc0) == 0x40) {
+ } else if ((b&0xc0) == 0x40) {
m_val = b&0x7f;
nMoreBytes = 1;
- } else if((b&0xe0) == 0x20) {
+ } else if ((b&0xe0) == 0x20) {
m_val = b&0x3f;
nMoreBytes = 2;
- } else if((b&0xf0) == 0x10) {
+ } else if ((b&0xf0) == 0x10) {
m_val = b&0x1f;
nMoreBytes = 3;
} else {
return E_FAIL;
}
- while(nMoreBytes-- > 0) {
+ while (nMoreBytes-- > 0) {
m_val <<= 8;
hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1223,34 +1223,34 @@ HRESULT CLength::Parse(CMatroskaNode* pMN) BYTE b = 0;
HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
int nMoreBytes = 0;
- if((b&0x80) == 0x80) {
+ if ((b&0x80) == 0x80) {
m_val = b&0x7f;
nMoreBytes = 0;
- } else if((b&0xc0) == 0x40) {
+ } else if ((b&0xc0) == 0x40) {
m_val = b&0x3f;
nMoreBytes = 1;
- } else if((b&0xe0) == 0x20) {
+ } else if ((b&0xe0) == 0x20) {
m_val = b&0x1f;
nMoreBytes = 2;
- } else if((b&0xf0) == 0x10) {
+ } else if ((b&0xf0) == 0x10) {
m_val = b&0x0f;
nMoreBytes = 3;
- } else if((b&0xf8) == 0x08) {
+ } else if ((b&0xf8) == 0x08) {
m_val = b&0x07;
nMoreBytes = 4;
- } else if((b&0xfc) == 0x04) {
+ } else if ((b&0xfc) == 0x04) {
m_val = b&0x03;
nMoreBytes = 5;
- } else if((b&0xfe) == 0x02) {
+ } else if ((b&0xfe) == 0x02) {
m_val = b&0x01;
nMoreBytes = 6;
- } else if((b&0xff) == 0x01) {
+ } else if ((b&0xff) == 0x01) {
m_val = b&0x00;
nMoreBytes = 7;
} else {
@@ -1261,20 +1261,20 @@ HRESULT CLength::Parse(CMatroskaNode* pMN) MatroskaReader::QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
- while(nMoreBytes-- > 0) {
+ while (nMoreBytes-- > 0) {
m_val <<= 8;
hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(m_val == UnknownSize) {
+ if (m_val == UnknownSize) {
m_val = pMN->GetLength() - pMN->GetPos();
TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
}
- if(m_fSigned) {
+ if (m_fSigned) {
m_val -= (UnknownSize >> 1);
}
@@ -1335,7 +1335,7 @@ HRESULT CNode<T>::Parse(CMatroskaNode* pMN) {
CAutoPtr<T> p(DNew T());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN))) {
+ if (!p || FAILED(hr = p->Parse(pMN))) {
return hr;
}
AddTail(p);
@@ -1346,7 +1346,7 @@ HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull) {
CAutoPtr<BlockGroup> p(DNew BlockGroup());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) {
+ if (!p || FAILED(hr = p->Parse(pMN, fFull))) {
return hr;
}
AddTail(p);
@@ -1357,7 +1357,7 @@ HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull) {
CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) {
+ if (!p || FAILED(hr = p->Parse(pMN, fFull))) {
return hr;
}
AddTail(p);
@@ -1385,7 +1385,7 @@ CMatroskaNode::CMatroskaNode(CMatroskaNode* pParent) HRESULT CMatroskaNode::Parse()
{
m_filepos = GetPos();
- if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this))) {
+ if (FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this))) {
return E_FAIL;
}
m_start = GetPos();
@@ -1394,12 +1394,12 @@ HRESULT CMatroskaNode::Parse() CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
{
- if(m_len == 0) {
+ if (m_len == 0) {
return CAutoPtr<CMatroskaNode>();
}
SeekTo(m_start);
CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
- if(id && !pMN->Find(id, fSearch)) {
+ if (id && !pMN->Find(id, fSearch)) {
pMN.Free();
}
return pMN;
@@ -1407,22 +1407,22 @@ CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch) bool CMatroskaNode::Next(bool fSame)
{
- if(!m_pParent) {
+ if (!m_pParent) {
return false;
}
CID id = m_id;
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
+ while (m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
SeekTo(m_start+m_len);
- if(FAILED(Parse())) {
- if(!Resync()) {
+ if (FAILED(Parse())) {
+ if (!Resync()) {
return false;
}
}
- if(!fSame || m_id == id) {
+ if (!fSame || m_id == id) {
return true;
}
}
@@ -1436,11 +1436,11 @@ bool CMatroskaNode::Find(DWORD id, bool fSearch) ? FindPos(id)
: 0;
- if(pos) {
+ if (pos) {
SeekTo(pos);
Parse();
- } else if(fSearch) {
- while(m_id != id && Next()) {
+ } else if (fSearch) {
+ while (m_id != id && Next()) {
;
}
}
@@ -1479,13 +1479,13 @@ MatroskaReader::QWORD CMatroskaNode::FindPos(DWORD id, MatroskaReader::QWORD sta Segment& sm = m_pMF->m_segment;
POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
- while(pos) {
+ while (pos) {
Seek* s = sm.MetaSeekInfo.GetNext(pos);
POSITION pos2 = s->SeekHeads.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
SeekHead* sh = s->SeekHeads.GetNext(pos2);
- if(sh->SeekID == id && sh->SeekPosition+sm.pos >= start) {
+ if (sh->SeekID == id && sh->SeekPosition+sm.pos >= start) {
return sh->SeekPosition+sm.pos;
}
}
@@ -1509,31 +1509,31 @@ CAutoPtr<CMatroskaNode> CMatroskaNode::GetFirstBlock() {
CAutoPtr<CMatroskaNode> pNode = Child();
do {
- if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) {
+ if (pNode->m_id == 0xA0 || pNode->m_id == 0xA3) {
return pNode;
}
- } while(pNode->Next());
+ } while (pNode->Next());
return CAutoPtr<CMatroskaNode>();
}
bool CMatroskaNode::NextBlock()
{
- if(!m_pParent) {
+ if (!m_pParent) {
return false;
}
CID id = m_id;
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
+ while (m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
SeekTo(m_start+m_len);
- if(FAILED(Parse())) {
- if(!Resync()) {
+ if (FAILED(Parse())) {
+ if (!Resync()) {
return false;
}
}
- if(m_id == 0xA0 || m_id == 0xA3) {
+ if (m_id == 0xA0 || m_id == 0xA3) {
return true;
}
}
@@ -1543,11 +1543,11 @@ bool CMatroskaNode::NextBlock() bool CMatroskaNode::Resync()
{
- if(m_pParent->m_id == 0x18538067) { /*segment?*/
+ if (m_pParent->m_id == 0x18538067) { /*segment?*/
SeekTo(m_filepos);
- for(BYTE b = 0; S_OK == Read(b); b = 0) {
- if((b&0xf0) != 0x10) {
+ for (BYTE b = 0; S_OK == Read(b); b = 0) {
+ if ((b&0xf0) != 0x10) {
continue;
}
@@ -1555,7 +1555,7 @@ bool CMatroskaNode::Resync() Read((BYTE*)&dw+1, 3);
bswap((BYTE*)&dw, 4);
- switch(dw) {
+ switch (dw) {
case 0x1549A966: // SegmentInfo
case 0x114D9B74: // MetaSeekInfo
case 0x1654AE6B: // Tracks
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp index ca36e6d76..5b41014d2 100644 --- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp +++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp @@ -111,7 +111,7 @@ STDMETHODIMP CMatroskaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, MatroskaSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -132,10 +132,10 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAtlArray<TrackEntry*> pinOutTE;
m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -147,16 +147,16 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool bHasVideo = 0;
POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
- while(pos) {
+ while (pos) {
Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
bool isSub = false;
- if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData)) {
+ if (!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData)) {
continue;
}
@@ -170,18 +170,18 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mt.SetSampleSize(1);
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
Name.Format(L"Video %d", iVideo++);
mt.majortype = MEDIATYPE_Video;
- if(CodecID == "V_MS/VFW/FOURCC") {
+ if (CodecID == "V_MS/VFW/FOURCC") {
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
memset(mt.Format(), 0, mt.FormatLength());
memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
- switch(pvih->bmiHeader.biCompression) {
+ switch (pvih->bmiHeader.biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -197,19 +197,19 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) // case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
}
if (!bHasVideo) {
- mts.Add(mt);
+ mts.Add(mt);
if (mt.subtype == MEDIASUBTYPE_WVC1) {
mt.subtype = MEDIASUBTYPE_WVC1_CYBERLINK;
mts.Add(mt);
}
}
bHasVideo = true;
- } else if(CodecID == "V_UNCOMPRESSED") {
- } else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6) {
+ } else if (CodecID == "V_UNCOMPRESSED") {
+ } else if (CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6) {
BYTE sps = pTE->CodecPrivate[5] & 0x1f;
std::vector<BYTE> avcC;
- for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++) {
+ for (int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++) {
avcC.push_back(pTE->CodecPrivate[i]);
}
@@ -277,9 +277,9 @@ avcsuccess: memcpy(pSequenceHeader, data.GetData(), data.GetCount());
pm2vi->cbSequenceHeader = data.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_MPEG4/") == 0) {
+ } else if (CodecID.Find("V_MPEG4/") == 0) {
mt.subtype = FOURCCMap('V4PM');
mt.formattype = FORMAT_MPEG2Video;
MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
@@ -294,9 +294,9 @@ avcsuccess: memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_REAL/RV") == 0) {
+ } else if (CodecID.Find("V_REAL/RV") == 0) {
mt.subtype = FOURCCMap('00VR' + ((CodecID[9]-0x30)<<16));
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
@@ -307,9 +307,9 @@ avcsuccess: pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID == "V_DIRAC") {
+ } else if (CodecID == "V_DIRAC") {
mt.subtype = MEDIASUBTYPE_DiracVideo;
mt.formattype = FORMAT_DiracVideoInfo;
DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
@@ -325,20 +325,20 @@ avcsuccess: dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID == "V_MPEG2") {
+ } else if (CodecID == "V_MPEG2") {
BYTE* seqhdr = pTE->CodecPrivate.GetData();
DWORD len = pTE->CodecPrivate.GetCount();
int w = pTE->v.PixelWidth;
int h = pTE->v.PixelHeight;
- if(MakeMPEG2MediaType(mt, seqhdr, len, w, h)) {
+ if (MakeMPEG2MediaType(mt, seqhdr, len, w, h)) {
if (!bHasVideo)
mts.Add(mt);
bHasVideo = true;
}
- } else if(CodecID == "V_THEORA") {
+ } else if (CodecID == "V_THEORA") {
BYTE* thdr = pTE->CodecPrivate.GetData() + 3;
mt.majortype = MEDIATYPE_Video;
@@ -354,7 +354,7 @@ avcsuccess: vih->hdr.bmiHeader.biBitCount = 24;
int nFpsNum = (thdr[22]<<24)|(thdr[23]<<16)|(thdr[24]<<8)|thdr[25];
int nFpsDenum = (thdr[26]<<24)|(thdr[27]<<16)|(thdr[28]<<8)|thdr[29];
- if(nFpsNum) {
+ if (nFpsNum) {
vih->hdr.AvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * nFpsDenum / nFpsNum);
}
vih->hdr.dwPictAspectRatioX = (thdr[14]<<16)|(thdr[15]<<8)|thdr[16];
@@ -365,9 +365,9 @@ avcsuccess: memcpy (&vih->dwSequenceHeader, pTE->CodecPrivate.GetData(), vih->cbSequenceHeader);
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_VP8") == 0) {
+ } else if (CodecID.Find("V_VP8") == 0) {
mt.subtype = FOURCCMap('08PV');
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
@@ -378,7 +378,7 @@ avcsuccess: pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
}
/*
@@ -395,15 +395,15 @@ avcsuccess: */
REFERENCE_TIME AvgTimePerFrame = 0;
- if(pTE->v.FramePerSec > 0) {
+ if (pTE->v.FramePerSec > 0) {
AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
- } else if(pTE->DefaultDuration > 0) {
+ } else if (pTE->DefaultDuration > 0) {
AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
}
- if(AvgTimePerFrame) {
- for(size_t i = 0; i < mts.GetCount(); i++) {
- if(mts[i].formattype == FORMAT_VideoInfo
+ if (AvgTimePerFrame) {
+ for (size_t i = 0; i < mts.GetCount(); i++) {
+ if (mts[i].formattype == FORMAT_VideoInfo
|| mts[i].formattype == FORMAT_VideoInfo2
|| mts[i].formattype == FORMAT_MPEG2Video) {
((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
@@ -411,9 +411,9 @@ avcsuccess: }
}
- if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0) {
- for(size_t i = 0; i < mts.GetCount(); i++) {
- if(mts[i].formattype == FORMAT_VideoInfo) {
+ if (pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0) {
+ for (size_t i = 0; i < mts.GetCount(); i++) {
+ if (mts[i].formattype == FORMAT_VideoInfo) {
mt = mts[i];
DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
@@ -426,16 +426,16 @@ avcsuccess: CSize aspect(pTE->v.DisplayWidth, pTE->v.DisplayHeight);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = aspect.cx;
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = aspect.cy;
mts.InsertAt(i++, mt);
- } else if(mts[i].formattype == FORMAT_MPEG2Video) {
+ } else if (mts[i].formattype == FORMAT_MPEG2Video) {
CSize aspect(pTE->v.DisplayWidth, pTE->v.DisplayHeight);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = aspect.cx;
@@ -443,7 +443,7 @@ avcsuccess: }
}
}
- } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio) {
Name.Format(L"Audio %d", iAudio++);
mt.majortype = MEDIATYPE_Audio;
@@ -459,7 +459,7 @@ avcsuccess: static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
- if(id2ft.IsEmpty()) {
+ if (id2ft.IsEmpty()) {
id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
id2ft["A_MPEG/L1"] = WAVE_FORMAT_MPEG;
@@ -476,8 +476,8 @@ avcsuccess: }
int wFormatTag;
- if(id2ft.Lookup(CodecID, wFormatTag)) {
- if(wFormatTag < 0) {
+ if (id2ft.Lookup(CodecID, wFormatTag)) {
+ if (wFormatTag < 0) {
wFormatTag = -wFormatTag;
wfe->cbSize = pTE->CodecPrivate.GetCount();
wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
@@ -491,11 +491,11 @@ avcsuccess: }
mts.Add(mt);
- if(wFormatTag == WAVE_FORMAT_FLAC) {
+ if (wFormatTag == WAVE_FORMAT_FLAC) {
mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
mts.InsertAt(0, mt);
}
- } else if(CodecID == "A_PCM/INT/LIT") {
+ } else if (CodecID == "A_PCM/INT/LIT") {
mt.subtype = MEDIASUBTYPE_PCM;
if (pTE->a.Channels <= 2 && pTE->a.BitDepth <= 16) {
wfe->wFormatTag = WAVE_FORMAT_PCM;
@@ -516,7 +516,7 @@ avcsuccess: mt.SetSampleSize(wfex->Format.nBlockAlign);
}
mts.Add(mt);
- } else if(CodecID == "A_MS/ACM") {
+ } else if (CodecID == "A_MS/ACM") {
wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
if (wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE && wfe->cbSize == 22) {
@@ -524,26 +524,26 @@ avcsuccess: }
else mt.subtype = FOURCCMap(wfe->wFormatTag);
mts.Add(mt);
- } else if(CodecID == "A_VORBIS") {
+ } else if (CodecID == "A_VORBIS") {
BYTE* p = pTE->CodecPrivate.GetData();
CAtlArray<int> sizes;
- for(BYTE n = *p++; n > 0; n--) {
+ for (BYTE n = *p++; n > 0; n--) {
int size = 0;
do {
size += *p;
- } while(*p++ == 0xff);
+ } while (*p++ == 0xff);
sizes.Add(size);
}
int totalsize = 0;
- for(size_t i = 0; i < sizes.GetCount(); i++) {
+ for (size_t i = 0; i < sizes.GetCount(); i++) {
totalsize += sizes[i];
}
sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
totalsize += sizes[sizes.GetCount()-1];
- if(sizes.GetCount() == 3) {
+ if (sizes.GetCount() == 3) {
mt.subtype = MEDIASUBTYPE_Vorbis2;
mt.formattype = FORMAT_VorbisFormat2;
VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
@@ -552,7 +552,7 @@ avcsuccess: pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
- for(size_t i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++) {
+ for (size_t i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++) {
memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
}
@@ -567,22 +567,22 @@ avcsuccess: vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = (DWORD)-1;
mts.Add(mt);
- } else if(CodecID.Find("A_AAC/") == 0) {
+ } else if (CodecID.Find("A_AAC/") == 0) {
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
wfe->cbSize = 2;
int profile;
- if(CodecID.Find("/MAIN") > 0) {
+ if (CodecID.Find("/MAIN") > 0) {
profile = 0;
- } else if(CodecID.Find("/SBR") > 0) {
+ } else if (CodecID.Find("/SBR") > 0) {
profile = -1;
- } else if(CodecID.Find("/LC") > 0) {
+ } else if (CodecID.Find("/LC") > 0) {
profile = 1;
- } else if(CodecID.Find("/SSR") > 0) {
+ } else if (CodecID.Find("/SSR") > 0) {
profile = 2;
- } else if(CodecID.Find("/LTP") > 0) {
+ } else if (CodecID.Find("/LTP") > 0) {
profile = 3;
} else {
continue;
@@ -592,14 +592,14 @@ avcsuccess: mts.Add(mt);
- if(profile < 0) {
+ if (profile < 0) {
wfe->cbSize = cbSize;
wfe->nSamplesPerSec *= 2;
wfe->nAvgBytesPerSec *= 2;
mts.InsertAt(0, mt);
}
- } else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11) {
+ } else if (CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11) {
mt.subtype = FOURCCMap((DWORD)CodecID[7]|((DWORD)CodecID[8]<<8)|((DWORD)CodecID[9]<<16)|((DWORD)CodecID[10]<<24));
mt.bTemporalCompression = TRUE;
wfe->cbSize = pTE->CodecPrivate.GetCount();
@@ -608,8 +608,8 @@ avcsuccess: wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
mts.Add(mt);
}
- } else if(pTE->TrackType == TrackEntry::TypeSubtitle) {
- if(iSubtitle == 1) {
+ } else if (pTE->TrackType == TrackEntry::TypeSubtitle) {
+ if (iSubtitle == 1) {
InstallFonts();
}
@@ -617,7 +617,7 @@ avcsuccess: mt.SetSampleSize(1);
- if(CodecID == "S_TEXT/ASCII") {
+ if (CodecID == "S_TEXT/ASCII") {
mt.majortype = MEDIATYPE_Text;
mt.subtype = MEDIASUBTYPE_NULL;
mt.formattype = FORMAT_None;
@@ -650,14 +650,14 @@ avcsuccess: CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
MEDIASUBTYPE_NULL;
- if(mt.subtype != MEDIASUBTYPE_NULL) {
+ if (mt.subtype != MEDIASUBTYPE_NULL) {
mts.Add(mt);
isSub = true;
}
}
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
continue;
}
@@ -675,10 +675,10 @@ avcsuccess: HRESULT hr;
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin(pTE->MinCache, pTE->DefaultDuration / 100, mts, Name, this, this, &hr));
- if(!pTE->Name.IsEmpty()) {
+ if (!pTE->Name.IsEmpty()) {
pPinOut->SetProperty(L"NAME", pTE->Name);
}
- if(pTE->Language.GetLength() == 3) {
+ if (pTE->Language.GetLength() == 3) {
pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
}
@@ -693,7 +693,7 @@ avcsuccess: }
}
- for(size_t i = 0; i < pinOut.GetCount(); i++) {
+ for (size_t i = 0; i < pinOut.GetCount(); i++) {
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
pPinOut.Attach(pinOut[i]);
@@ -709,7 +709,7 @@ avcsuccess: Info& info = m_pFile->m_segment.SegmentInfo;
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
m_rtDuration = (REFERENCE_TIME)(info.Duration * info.TimeCodeScale / 100);
}
@@ -735,17 +735,17 @@ avcsuccess: {
POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos) {
+ while (pos) {
Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
POSITION pos = pA->AttachedFiles.GetHeadPosition();
- while(pos) {
+ while (pos) {
AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
CAtlArray<BYTE> pData;
pData.SetCount(pF->FileDataLen);
m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount()))) {
+ if (SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount()))) {
ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
}
}
@@ -754,11 +754,11 @@ avcsuccess: // chapters
- if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0)) {
+ if (ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0)) {
CStringA str;
str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
CStringA ChapLanguage = CStringA(ISO6391To6392(str));
- if(ChapLanguage.GetLength() < 3) {
+ if (ChapLanguage.GetLength() < 3) {
ChapLanguage = "eng";
}
@@ -772,26 +772,26 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int {
CStringW tabs('+', level);
- if(!tabs.IsEmpty()) {
+ if (!tabs.IsEmpty()) {
tabs += ' ';
}
POSITION pos = parent->ChapterAtoms.GetHeadPosition();
- while(pos) {
+ while (pos) {
// ChapUID zero not allow by Matroska specs
UINT64 ChapUID = parent->ChapterAtoms.GetNext(pos)->ChapterUID;
ChapterAtom* ca = (ChapUID == 0) ? NULL : m_pFile->m_segment.FindChapterAtom(ChapUID);
- if(ca) {
+ if (ca) {
CStringW name, first;
POSITION pos = ca->ChapterDisplays.GetHeadPosition();
- while(pos) {
+ while (pos) {
ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
- if(first.IsEmpty()) {
+ if (first.IsEmpty()) {
first = cd->ChapString;
}
- if(cd->ChapLanguage == lng) {
+ if (cd->ChapLanguage == lng) {
name = cd->ChapString;
}
}
@@ -800,7 +800,7 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, name);
- if(!ca->ChapterAtoms.IsEmpty()) {
+ if (!ca->ChapterAtoms.IsEmpty()) {
SetupChapters(lng, ca, level+1);
}
}
@@ -811,22 +811,22 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int void CMatroskaSplitterFilter::InstallFonts()
{
POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos) {
+ while (pos) {
Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
POSITION p2 = pA->AttachedFiles.GetHeadPosition();
- while(p2) {
+ while (p2) {
AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
- if(pF->FileMimeType == "application/x-truetype-font" ||
- pF->FileMimeType == "application/x-font-ttf" ||
- pF->FileMimeType == "application/vnd.ms-opentype") {
+ if (pF->FileMimeType == "application/x-truetype-font" ||
+ pF->FileMimeType == "application/x-font-ttf" ||
+ pF->FileMimeType == "application/vnd.ms-opentype") {
// assume this is a font resource
- if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen]) {
+ if (BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen]) {
m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen))) {
+ if (SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen))) {
//m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
m_fontinst.InstallFontMemory(pData, (UINT)pF->FileDataLen);
}
@@ -843,28 +843,28 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample() HRESULT hr;
POSITION pos = m_pTrackEntryMap.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNumber = 0;
TrackEntry* pTE = NULL;
m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
- if(!(pTE && pPin && pPin->IsConnected())) {
+ if (!(pTE && pPin && pPin->IsConnected())) {
continue;
}
- if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
+ if (pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
&& pTE->CodecPrivate.GetCount() > 0) {
BYTE* ptr = pTE->CodecPrivate.GetData();
CAtlList<int> sizes;
long last = 0;
- for(BYTE n = *ptr++; n > 0; n--) {
+ for (BYTE n = *ptr++; n > 0; n--) {
int size = 0;
do {
size += *ptr;
- } while(*ptr++ == 0xff);
+ } while (*ptr++ == 0xff);
sizes.AddTail(size);
last += size;
}
@@ -873,7 +873,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample() hr = S_OK;
POSITION pos = sizes.GetHeadPosition();
- while(pos && SUCCEEDED(hr)) {
+ while (pos && SUCCEEDED(hr)) {
long len = sizes.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet());
@@ -888,7 +888,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample() hr = DeliverPacket(p);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
}
}
@@ -900,7 +900,7 @@ bool CMatroskaSplitterFilter::DemuxInit() SetThreadName((DWORD)-1, "CMatroskaSplitterFilter");
CMatroskaNode Root(m_pFile);
- if(!m_pFile
+ if (!m_pFile
|| !(m_pSegment = Root.Child(0x18538067))
|| !(m_pCluster = m_pSegment->Child(0x1F43B675))) {
return false;
@@ -908,7 +908,7 @@ bool CMatroskaSplitterFilter::DemuxInit() // reindex if needed
- if(m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0) {
+ if (m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0) {
m_nOpenProgress = 0;
m_pFile->m_segment.SegmentInfo.Duration.Set(0);
@@ -933,18 +933,18 @@ bool CMatroskaSplitterFilter::DemuxInit() m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
}
}
- } while(!m_fAbort && m_pCluster->Next(true));
+ } while (!m_fAbort && m_pCluster->Next(true));
m_nOpenProgress = 100;
- if(!m_fAbort) {
+ if (!m_fAbort) {
m_pFile->m_segment.Cues.AddTail(pCue);
}
@@ -962,7 +962,7 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) m_pCluster = m_pSegment->Child(0x1F43B675);
m_pBlock.Free();
- if(rt > 0) {
+ if (rt > 0) {
rt += m_pFile->m_rtOffset;
MatroskaReader::QWORD lastCueClusterPosition = (MatroskaReader::QWORD)-1;
@@ -972,26 +972,26 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) UINT64 TrackNumber = s.GetMasterTrack();
POSITION pos1 = s.Cues.GetHeadPosition();
- while(pos1) {
+ while (pos1) {
Cue* pCue = s.Cues.GetNext(pos1);
POSITION pos2 = pCue->CuePoints.GetTailPosition();
- while(pos2) {
+ while (pos2) {
CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
- if(rt < s.GetRefTime(pCuePoint->CueTime)) {
+ if (rt < s.GetRefTime(pCuePoint->CueTime)) {
continue;
}
POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
- while(pos3) {
+ while (pos3) {
CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
- if(TrackNumber != pCueTrackPositions->CueTrack) {
+ if (TrackNumber != pCueTrackPositions->CueTrack) {
continue;
}
- if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition) {
+ if (lastCueClusterPosition == pCueTrackPositions->CueClusterPosition) {
continue;
}
@@ -1014,47 +1014,47 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) Cluster c;
c.ParseTimeCode(m_pCluster);
- if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock()) {
+ if (CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock()) {
bool fPassedCueTime = false;
do {
CBlockGroupNode bgn;
- if(pBlock->m_id == 0xA0) {
+ if (pBlock->m_id == 0xA0) {
bgn.Parse(pBlock, true);
- } else if(pBlock->m_id == 0xA3) {
+ } else if (pBlock->m_id == 0xA3) {
CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) {
+ if (!(bg->Block.Lacing & 0x80)) {
bg->ReferenceBlock.Set(0); // not a kf
}
bgn.AddTail(bg);
}
POSITION pos4 = bgn.GetHeadPosition();
- while(!fPassedCueTime && pos4) {
+ while (!fPassedCueTime && pos4) {
BlockGroup* bg = bgn.GetNext(pos4);
- if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
+ if (bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
|| rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) { // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
fPassedCueTime = true;
- } else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid()) {
+ } else if (bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid()) {
fFoundKeyFrame = true;
m_pBlock = pBlock->Copy();
}
}
- } while(!fPassedCueTime && pBlock->NextBlock());
+ } while (!fPassedCueTime && pBlock->NextBlock());
}
}
- if(fFoundKeyFrame) {
+ if (fFoundKeyFrame) {
pos1 = pos2 = pos3 = NULL;
}
}
}
}
- if(!m_pBlock) {
+ if (!m_pBlock) {
m_pCluster = m_pSegment->Child(0x1F43B675);
}
}
@@ -1070,28 +1070,28 @@ bool CMatroskaSplitterFilter::DemuxLoop() Cluster c;
c.ParseTimeCode(m_pCluster);
- if(!m_pBlock) {
+ if (!m_pBlock) {
m_pBlock = m_pCluster->GetFirstBlock();
}
- if(!m_pBlock) {
+ if (!m_pBlock) {
continue;
}
do {
CBlockGroupNode bgn;
- if(m_pBlock->m_id == 0xA0) {
+ if (m_pBlock->m_id == 0xA0) {
bgn.Parse(m_pBlock, true);
- } else if(m_pBlock->m_id == 0xA3) {
+ } else if (m_pBlock->m_id == 0xA3) {
CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(m_pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) {
+ if (!(bg->Block.Lacing & 0x80)) {
bg->ReferenceBlock.Set(0); // not a kf
}
bgn.AddTail(bg);
}
- while(bgn.GetCount() && SUCCEEDED(hr)) {
+ while (bgn.GetCount() && SUCCEEDED(hr)) {
CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
p->bg = bgn.RemoveHead();
@@ -1108,13 +1108,13 @@ bool CMatroskaSplitterFilter::DemuxLoop() p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
// Fix subtitle with duration = 0
- if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid()) {
+ if (pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid()) {
p->bg->BlockDuration.Set(1); // just setting it to be valid
p->rtStop = p->rtStart;
}
POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
pTE->Expand(*pb, ContentEncoding::AllFrameContents);
}
@@ -1125,11 +1125,11 @@ bool CMatroskaSplitterFilter::DemuxLoop() hr = DeliverPacket(p);
}
- } while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
+ } while (m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
m_pBlock.Free();
- } while(m_pFile->GetPos() < (__int64)(m_pFile->m_segment.pos + m_pFile->m_segment.len)
- && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
+ } while (m_pFile->GetPos() < (__int64)(m_pFile->m_segment.pos + m_pFile->m_segment.len)
+ && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
m_pCluster.Free();
@@ -1140,7 +1140,7 @@ bool CMatroskaSplitterFilter::DemuxLoop() STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
@@ -1149,7 +1149,7 @@ STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs) nKFs = 0;
POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos) {
+ while (pos) {
nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
}
@@ -1161,21 +1161,21 @@ STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENC CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos1 && nKFsTmp < nKFs) {
+ while (pos1 && nKFsTmp < nKFs) {
Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
POSITION pos2 = pCue->CuePoints.GetHeadPosition();
- while(pos2 && nKFsTmp < nKFs) {
+ while (pos2 && nKFsTmp < nKFs) {
pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
}
}
@@ -1231,11 +1231,11 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream() // send out the last remaining packets from the queue
- while(m_rob.GetCount()) {
+ while (m_rob.GetCount()) {
MatroskaPacket* mp = m_rob.RemoveHead();
- if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid()) {
+ if (m_rob.GetCount() && !mp->bg->BlockDuration.IsValid()) {
mp->rtStop = m_rob.GetHead()->rtStart;
- } else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0) {
+ } else if (m_rob.GetCount() == 0 && m_rtDefaultDuration > 0) {
mp->rtStop = mp->rtStart + m_rtDefaultDuration;
}
@@ -1243,9 +1243,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream() m_tos.AddTail(to);
}
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1256,7 +1256,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream() HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
- if(!mp) {
+ if (!mp) {
return __super::DeliverPacket(p);
}
@@ -1271,11 +1271,11 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) POSITION pos = m_rob.GetTailPosition();
_ASSERTE(m_nMinCache > 0);
- for(int i = m_nMinCache - 1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; --i) {
+ for (int i = m_nMinCache - 1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; --i) {
m_rob.GetPrev(pos);
}
- if(!pos) {
+ if (!pos) {
m_rob.AddHead(mp);
} else {
m_rob.InsertAfter(pos, mp);
@@ -1283,15 +1283,15 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) mp = NULL;
- if(m_rob.GetCount() == m_nMinCache + 1) {
+ if (m_rob.GetCount() == m_nMinCache + 1) {
ASSERT(m_nMinCache > 0);
pos = m_rob.GetHeadPosition();
MatroskaPacket* mp1 = m_rob.GetNext(pos);
MatroskaPacket* mp2 = m_rob.GetNext(pos);
- if(!mp1->bg->BlockDuration.IsValid()) {
+ if (!mp1->bg->BlockDuration.IsValid()) {
mp1->bg->BlockDuration.Set(1); // just to set it valid
- if(mp1->rtStart >= mp2->rtStart) {
+ if (mp1->rtStart >= mp2->rtStart) {
/* CString str;
str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
AfxMessageBox(str);
@@ -1303,9 +1303,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
}
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
mp = m_packets.GetHead();
- if(!mp->bg->BlockDuration.IsValid()) {
+ if (!mp->bg->BlockDuration.IsValid()) {
break;
}
@@ -1314,7 +1314,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) m_tos.AddTail(to);
HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1326,7 +1326,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) {
HRESULT hr = S_FALSE;
- if(m_tos.GetCount()) {
+ if (m_tos.GetCount()) {
timeoverride to = m_tos.RemoveHead();
// if(p->TrackNumber == 2)
TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
@@ -1343,7 +1343,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) rtStop = p->rtStart + rtDelta;
POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
tmp->bDiscontinuity = p->bDiscontinuity;
@@ -1351,7 +1351,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) tmp->rtStart = rtStart;
tmp->rtStop = rtStop;
tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
- if(S_OK != (hr = DeliverPacket(tmp))) {
+ if (S_OK != (hr = DeliverPacket(tmp))) {
break;
}
@@ -1362,9 +1362,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) p->bDiscontinuity = false;
}
- if(m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4)) {
+ if (m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4)) {
POSITION pos = p->bg->ba.bm.GetHeadPosition();
- while(pos) {
+ while (pos) {
const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
@@ -1373,7 +1373,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) tmp->rtStart = p->rtStart;
tmp->rtStop = p->rtStop;
tmp->Copy(bm->BlockAdditional);
- if(S_OK != (hr = DeliverPacket(tmp))) {
+ if (S_OK != (hr = DeliverPacket(tmp))) {
break;
}
}
@@ -1386,7 +1386,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) TrackEntry* CMatroskaSplitterFilter::GetTrackEntryAt(UINT aTrackIdx)
{
- if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount()) {
+ if (aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount()) {
return NULL;
}
return m_pOrderedTrackArray[aTrackIdx];
@@ -1400,7 +1400,7 @@ STDMETHODIMP_(UINT) CMatroskaSplitterFilter::GetTrackCount() STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return FALSE;
}
@@ -1408,7 +1408,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct pStructureToFill->FlagForced = !!pTE->FlagForced;
pStructureToFill->FlagLacing = !!pTE->FlagLacing;
strncpy(pStructureToFill->Language, pTE->Language, 3);
- if(pStructureToFill->Language[0] == '\0') {
+ if (pStructureToFill->Language[0] == '\0') {
strncpy(pStructureToFill->Language, "eng", 3);
}
pStructureToFill->Language[3] = '\0';
@@ -1421,11 +1421,11 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return FALSE;
}
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
@@ -1434,7 +1434,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
- } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio) {
TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
pTEIA->Channels = (UINT)pTE->a.Channels;
@@ -1450,7 +1450,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->Name.AllocSysString();
@@ -1459,7 +1459,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx) STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecID.ToString().AllocSysString();
@@ -1468,7 +1468,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx) STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecName.AllocSysString();
@@ -1477,7 +1477,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx) STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecInfoURL.AllocSysString();
@@ -1486,7 +1486,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecDownloadURL(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecDownloadURL.AllocSysString();
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h index 9913040cd..9fb03dd10 100644 --- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h +++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h @@ -36,7 +36,7 @@ protected: int GetDataSize() {
int size = 0;
POSITION pos = bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
size += bg->Block.BlockData.GetNext(pos)->GetCount();
}
return size;
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.cpp b/src/filters/parser/MpaSplitter/MpaSplitter.cpp index d30ad5a5f..37aca92f8 100644 --- a/src/filters/parser/MpaSplitter/MpaSplitter.cpp +++ b/src/filters/parser/MpaSplitter/MpaSplitter.cpp @@ -98,7 +98,7 @@ STDMETHODIMP CMpaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, MpaSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -114,10 +114,10 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CMpaSplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -132,22 +132,22 @@ 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)) {
+ if (m_pFile->m_tags.Lookup('TIT2', str)) {
title = str;
}
- if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) {
+ if (m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) {
title += L" (" + str + L")";
}
- if(!title.IsEmpty()) {
+ if (!title.IsEmpty()) {
SetProperty(L"TITL", title);
}
- if(m_pFile->m_tags.Lookup('TPE1', str)) {
+ if (m_pFile->m_tags.Lookup('TPE1', str)) {
SetProperty(L"AUTH", str);
}
- if(m_pFile->m_tags.Lookup('TCOP', str)) {
+ if (m_pFile->m_tags.Lookup('TCOP', str)) {
SetProperty(L"CPYR", str);
}
- if(m_pFile->m_tags.Lookup('COMM', str)) {
+ if (m_pFile->m_tags.Lookup('COMM', str)) {
SetProperty(L"DESC", str);
}
@@ -167,7 +167,7 @@ STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration) bool CMpaSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CMpaSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -181,7 +181,7 @@ 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 {
@@ -198,8 +198,8 @@ 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)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9) {
+ if (!m_pFile->Sync(FrameSize, rtDuration)) {
Sleep(1);
continue;
}
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp index fddbc1737..f14a79221 100644 --- a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp +++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp @@ -82,7 +82,7 @@ CMpaSplitterFile::CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr) , m_totalbps(0)
, m_bIsVBR(false)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = Init();
}
}
@@ -94,14 +94,14 @@ 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;
@@ -128,13 +128,13 @@ HRESULT CMpaSplitterFile::Init() // track
LPCSTR s = str;
- if(s[28] == 0 && s[29] != 0) {
+ 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]);
}
}
@@ -144,7 +144,7 @@ HRESULT CMpaSplitterFile::Init() bool MP3_find = false;
- while(BitRead(24, true) == 'ID3') {
+ while (BitRead(24, true) == 'ID3') {
MP3_find = true;
BitRead(24);
@@ -156,19 +156,19 @@ HRESULT CMpaSplitterFile::Init() BYTE flags = (BYTE)BitRead(8);
UNUSED_ALWAYS(flags);
DWORD size = 0;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 21;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 14;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 7;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7);
@@ -177,10 +177,10 @@ HRESULT CMpaSplitterFile::Init() // 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);
@@ -194,11 +194,11 @@ HRESULT CMpaSplitterFile::Init() pos += 4+4+2+size;
- if(!size || pos >= m_startpos) {
+ if (!size || pos >= m_startpos) {
break;
}
- if(tag == 'TIT2'
+ if (tag == 'TIT2'
|| tag == 'TPE1'
|| tag == 'TALB'
|| tag == 'TYER'
@@ -212,16 +212,16 @@ HRESULT CMpaSplitterFile::Init() CStringA str;
CStringW wstr;
- if(encoding > 0 && size >= 2 && bom == 0xfffe) {
+ 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++) {
+ for (int i = 0, j = wstr.GetLength(); i < j; i++) {
wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
}
m_tags[tag] = wstr.Trim();
@@ -235,7 +235,7 @@ HRESULT CMpaSplitterFile::Init() 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++;
}
}
@@ -244,16 +244,16 @@ HRESULT CMpaSplitterFile::Init() __int64 startpos;
__int64 syncpos;
-
- if(!MP3_find) { // if no 'ID3' tag at begin of file
+
+ if (!MP3_find) { // if no 'ID3' tag at begin of file
Seek(m_startpos);
searchlen = min(m_endpos - m_startpos, 4);
- if(Read(m_mpahdr, searchlen, true, &m_mt)) {
+ if (Read(m_mpahdr, searchlen, true, &m_mt)) {
MP3_find = true;
}
}
- if(MP3_find) {
+ if (MP3_find) {
__int64 startpos_mp3 = m_startpos;
while (m_mode == none) {
searchlen = min(m_endpos - startpos_mp3, 0x200);
@@ -263,7 +263,7 @@ 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();
@@ -271,7 +271,7 @@ HRESULT CMpaSplitterFile::Init() // 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 {
break;
@@ -290,37 +290,37 @@ HRESULT CMpaSplitterFile::Init() 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)) {
+ if (!Sync(9)) {
m_mode = none;
}
}
- if(m_mode == none) {
+ if (m_mode == none) {
return E_FAIL;
}
m_startpos = startpos;
- if(m_mode == mpa) {
+ if (m_mode == mpa) {
DWORD m_dwFrames = 0; // total number of frames
Seek(m_startpos + MPA_HEADER_SIZE + 32);
- if(BitRead(32, true) == 'Xing' || BitRead(32, true) == 'Info') {
+ if (BitRead(32, true) == 'Xing' || BitRead(32, true) == 'Info') {
TRACE(_T("CMpaSplitterFile - Xing VBR header found\n"));
BitRead(32); // Skip ID tag
DWORD dwFlags = BitRead(32);
// extract total number of frames in file
- if(dwFlags & FRAMES_FLAG)
+ if (dwFlags & FRAMES_FLAG)
m_dwFrames = BitRead(32);
- } else if(BitRead(32, true) == 'VBRI') {
+ } else if (BitRead(32, true) == 'VBRI') {
TRACE(_T("CMpaSplitterFile - VBRI header found\n"));
BitRead(32); // Skip ID tag
@@ -332,8 +332,8 @@ HRESULT CMpaSplitterFile::Init() m_dwFrames = BitRead(32); // extract total number of frames in file
}
- if(m_dwFrames) {
-
+ if (m_dwFrames) {
+
bool l3ext = m_mpahdr.layer == 3 && !(m_mpahdr.version&1);
DWORD m_dwSamplesPerFrame = m_mpahdr.layer == 1 ? 384 : l3ext ? 576 : 1152;
@@ -348,11 +348,11 @@ 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) {
+ if (i == 10) {
break;
}
rtPrevDur = m_rtDuration;
@@ -372,11 +372,11 @@ 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) {
@@ -392,11 +392,11 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi 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) {
@@ -422,11 +422,11 @@ void CMpaSplitterFile::AdjustDuration(int nBytesPerSec) {
ASSERT(nBytesPerSec);
- if(!m_bIsVBR) {
+ if (!m_bIsVBR) {
int rValue;
- if(!m_pos2bps.Lookup(GetPos(), rValue)) {
+ if (!m_pos2bps.Lookup(GetPos(), rValue)) {
m_totalbps += nBytesPerSec;
- if(!m_totalbps) {
+ if (!m_totalbps) {
return;
}
m_pos2bps.SetAt(GetPos(), nBytesPerSec);
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp index a7d6562cd..a3687b505 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp @@ -31,34 +31,34 @@ TCHAR* MPEG2_Profile[]=
{
- L"0",
- L"High Profile",
- L"Spatially Scalable Profile",
- L"SNR Scalable Profile",
- L"Main Profile",
- L"Simple Profile",
- L"6",
- L"7",
+ L"0",
+ L"High Profile",
+ L"Spatially Scalable Profile",
+ L"SNR Scalable Profile",
+ L"Main Profile",
+ L"Simple Profile",
+ L"6",
+ L"7",
};
TCHAR* MPEG2_Level[]=
{
- L"0",
- L"1",
- L"2",
- L"3",
- L"High Level",
- L"4",
- L"High1440 Level",
- L"5",
- L"Main Level",
- L"6",
- L"Low Level",
- L"7",
- L"8",
- L"9",
- L"10",
- L"11",
+ L"0",
+ L"1",
+ L"2",
+ L"3",
+ L"High Level",
+ L"4",
+ L"High1440 Level",
+ L"5",
+ L"Main Level",
+ L"6",
+ L"Low Level",
+ L"7",
+ L"8",
+ L"9",
+ L"10",
+ L"11",
};
#ifdef REGISTER_FILTER
@@ -229,10 +229,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str Infos.AddTail(Temp);
}
- if(bIsMPEG2) {
+ if (bIsMPEG2) {
Infos.AddTail(MPEG2_Profile[pInfo->dwProfile]);
- } else
- if (pInfo->dwProfile) {
+ } else if (pInfo->dwProfile) {
if (bIsAVC) {
switch (pInfo->dwProfile) {
case 44:
@@ -274,10 +273,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str }
}
- if(bIsMPEG2) {
+ if (bIsMPEG2) {
Infos.AddTail(MPEG2_Level[pInfo->dwLevel]);
- } else
- if (pInfo->dwLevel) {
+ } else if (pInfo->dwLevel) {
if (bIsAVC) {
Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel)/10.0));
} else {
@@ -465,7 +463,7 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str bool bFirst = true;
- for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos)) {
+ for (POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos)) {
CString& String = Infos.GetAt(pos);
if (bFirst) {
@@ -503,38 +501,38 @@ CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLS TCHAR buff[256];
ULONG len;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"), KEY_READ)) {
DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("UseFastStreamChange"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("UseFastStreamChange"), dw)) {
m_useFastStreamChange = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSub"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSub"), dw)) {
m_ForcedSub = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("TrackPriority"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("TrackPriority"), dw)) {
m_TrackPriority = !!dw;
}
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(_T("AudioLanguageOrder"), buff, &len)) {
- m_csAudioLanguageOrder = CString(buff);
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("AudioLanguageOrder"), buff, &len)) {
+ m_csAudioLanguageOrder = CString(buff);
}
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(_T("SubtitlesLanguageOrder"), buff, &len)) {
- m_csSubtitlesLanguageOrder = CString(buff);
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("SubtitlesLanguageOrder"), buff, &len)) {
+ m_csSubtitlesLanguageOrder = CString(buff);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("VC1_Decoder_Output"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("VC1_Decoder_Output"), dw)) {
m_nVC1_GuidFlag = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AC3CoreOnly"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("AC3CoreOnly"), dw)) {
m_AC3CoreOnly = dw;
}
}
@@ -545,7 +543,7 @@ CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLS m_csSubtitlesLanguageOrder = AfxGetApp()->GetProfileString(IDS_R_SETTINGS, IDS_RS_SUBTITLESLANGORDER, _T(""));
m_csAudioLanguageOrder = AfxGetApp()->GetProfileString(IDS_R_SETTINGS, IDS_RS_AUDIOSLANGORDER, _T(""));
m_nVC1_GuidFlag = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Splitter"), _T("VC1_Decoder_Output"), m_nVC1_GuidFlag);
- if(m_nVC1_GuidFlag<1 || m_nVC1_GuidFlag>3) m_nVC1_GuidFlag = 1;
+ if (m_nVC1_GuidFlag<1 || m_nVC1_GuidFlag>3) m_nVC1_GuidFlag = 1;
m_AC3CoreOnly = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Splitter"), _T("AC3CoreOnly"), m_AC3CoreOnly);
#endif
}
@@ -594,7 +592,7 @@ STDMETHODIMP CMpegSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, MpegSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -643,35 +641,35 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) HRESULT hr;
BYTE b;
- if(m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es) {
- if(!m_pFile->NextMpegStartCode(b)) {
+ if (m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es) {
+ if (!m_pFile->NextMpegStartCode(b)) {
return S_FALSE;
}
- if(b == 0xba) { // program stream header
+ if (b == 0xba) { // program stream header
CMpegSplitterFile::pshdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
- } else if(b == 0xbb) { // program stream system header
+ } else if (b == 0xbb) { // program stream system header
CMpegSplitterFile::pssyshdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
}
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if (b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if ((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
{
CMpegSplitterFile::peshdr h;
- if(!m_pFile->Read(h, b) || !h.len) {
+ if (!m_pFile->Read(h, b) || !h.len) {
return S_FALSE;
}
- if(h.type == CMpegSplitterFile::mpeg2 && h.scrambling) {
+ if (h.type == CMpegSplitterFile::mpeg2 && h.scrambling) {
ASSERT(0);
return E_FAIL;
}
@@ -680,7 +678,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) DWORD TrackNumber = m_pFile->AddStream(0, b, h.len);
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -696,10 +694,10 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) }
m_pFile->Seek(pos + h.len);
}
- } else if(m_pFile->m_type == CMpegSplitterFile::ts) {
+ } else if (m_pFile->m_type == CMpegSplitterFile::ts) {
CMpegSplitterFile::trhdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
@@ -708,20 +706,20 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) m_pFile->UpdatePrograms(h, false);
- if(h.payload && ISVALIDPID(h.pid)) {
+ if (h.payload && ISVALIDPID(h.pid)) {
DWORD TrackNumber = h.pid;
CMpegSplitterFile::peshdr h2;
- if(h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) { // pes packet
- if(h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling) {
+ if (h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) { // pes packet
+ if (h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling) {
ASSERT(0);
return E_FAIL;
}
TrackNumber = m_pFile->AddStream(h.pid, b, h.bytes - (DWORD)(m_pFile->GetPos() - pos));
}
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -746,9 +744,9 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) }
m_pFile->Seek(h.next);
- } else if(m_pFile->m_type == CMpegSplitterFile::pva) {
+ } else if (m_pFile->m_type == CMpegSplitterFile::pva) {
CMpegSplitterFile::pvahdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
@@ -756,7 +754,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) __int64 pos = m_pFile->GetPos();
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -789,17 +787,17 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ReadClipInfo (GetPartFilename(pAsyncReader));
m_pFile.Attach(DNew CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo, m_nVC1_GuidFlag, m_ForcedSub, m_TrackPriority, m_AC3CoreOnly));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
- if(m_pFile->m_type == CMpegSplitterFile::ps) {
- if(m_pInput && m_pInput->IsConnected() && (GetCLSID(m_pInput->GetConnected()) == GUIDFromCString(_T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")))){ // MPC VTS Reader
+ if (m_pFile->m_type == CMpegSplitterFile::ps) {
+ if (m_pInput && m_pInput->IsConnected() && (GetCLSID(m_pInput->GetConnected()) == GUIDFromCString(_T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")))) { // MPC VTS Reader
pTI = GetFilterFromPin(m_pInput->GetConnected());
}
}
@@ -823,29 +821,29 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) int Idx_audio = 99;
int Idx_subpic = 99;
- if(!m_csAudioLanguageOrder.IsEmpty()) {
+ if (!m_csAudioLanguageOrder.IsEmpty()) {
int tPos = 0;
lang = m_csAudioLanguageOrder.Tokenize(_T(",; "), tPos);
- while(tPos != -1) {
- if(!lang.IsEmpty()) lang_list_audio.AddTail(lang);
+ while (tPos != -1) {
+ if (!lang.IsEmpty()) lang_list_audio.AddTail(lang);
lang = m_csAudioLanguageOrder.Tokenize(_T(",; "), tPos);
}
- if(!lang.IsEmpty()) lang_list_audio.AddTail(lang);
+ if (!lang.IsEmpty()) lang_list_audio.AddTail(lang);
}
- if(!m_csSubtitlesLanguageOrder.IsEmpty()) {
+ if (!m_csSubtitlesLanguageOrder.IsEmpty()) {
int tPos = 0;
lang = m_csSubtitlesLanguageOrder.Tokenize(_T(",; "), tPos);
- while(tPos != -1) {
- if(!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
+ while (tPos != -1) {
+ if (!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
lang = m_csSubtitlesLanguageOrder.Tokenize(_T(",; "), tPos);
}
- if(!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
+ if (!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
}
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
CAtlArray<CMediaType> mts;
mts.Add(s.mt);
@@ -866,7 +864,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CString lang_name = _T("");
m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_name);
-
+
lang_name = pTI ? pTI->GetTrackName(s.ps1id) : lang_name;
CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
@@ -881,15 +879,15 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
CString str_tmp = str;
str_tmp.MakeLower();
- if(i == CMpegSplitterFile::audio) {
- if(lang_list_audio.GetCount()>0) {
+ if (i == CMpegSplitterFile::audio) {
+ if (lang_list_audio.GetCount()>0) {
int idx = 0;
POSITION pos = lang_list_audio.GetHeadPosition();
- while(pos) {
+ while (pos) {
lang = lang_list_audio.GetNext(pos).MakeLower();
- if(-1 != str_tmp.Find(lang)) {
- if(idx<Idx_audio) {
- cs_audioProgram = str;
+ if (-1 != str_tmp.Find(lang)) {
+ if (idx<Idx_audio) {
+ cs_audioProgram = str;
Idx_audio = idx;
break;
}
@@ -897,16 +895,16 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) idx++;
}
}
- if(!Idx_audio && !cs_audioProgram.IsEmpty()) break;
+ if (!Idx_audio && !cs_audioProgram.IsEmpty()) break;
}
- if(i == CMpegSplitterFile::subpic) {
- if(lang_list_subpic.GetCount()>0) {
+ if (i == CMpegSplitterFile::subpic) {
+ if (lang_list_subpic.GetCount()>0) {
int idx = 0;
POSITION pos = lang_list_subpic.GetHeadPosition();
- while(pos) {
+ while (pos) {
lang = lang_list_subpic.GetNext(pos).MakeLower();
- if(-1 != str_tmp.Find(lang)) {
- if(idx<Idx_subpic) {
+ if (-1 != str_tmp.Find(lang)) {
+ if (idx<Idx_subpic) {
cs_subpicProgram = str;
Idx_subpic = idx;
break;
@@ -915,7 +913,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) idx++;
}
}
- if(!Idx_subpic && !cs_subpicProgram.IsEmpty()) break;
+ if (!Idx_subpic && !cs_subpicProgram.IsEmpty()) break;
}
}
}
@@ -923,9 +921,9 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
CAtlArray<CMediaType> mts;
mts.Add(s.mt);
@@ -949,7 +947,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) lang_name = pTI ? pTI->GetTrackName(s.ps1id) : lang_name;
CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
-
+
if (!FormatDesc.IsEmpty()) {
str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
} else if (pStreamName) {
@@ -964,41 +962,40 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) (static_cast<CMpegSplitterOutputPin*>(pPinOut.m_p))->SetMaxShift (_I64_MAX);
}
- if(i == CMpegSplitterFile::audio) {
- if(!cs_audioProgram.IsEmpty()) {
- if((!cs_audioProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
+ if (i == CMpegSplitterFile::audio) {
+ if (!cs_audioProgram.IsEmpty()) {
+ if ((!cs_audioProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
} else {
- if(S_OK == AddOutputPin(s, pPinOut)) {
+ if (S_OK == AddOutputPin(s, pPinOut)) {
break;
}
}
}
- else
- if(i == CMpegSplitterFile::subpic) {
- if(!cs_subpicProgram.IsEmpty()) {
- if((!cs_subpicProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
+ else if (i == CMpegSplitterFile::subpic) {
+ if (!cs_subpicProgram.IsEmpty()) {
+ if ((!cs_subpicProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
} else {
- if((m_pFile->m_streams[CMpegSplitterFile::subpic].GetCount() == 1) && (S_OK == AddOutputPin(s, pPinOut))) {
+ if ((m_pFile->m_streams[CMpegSplitterFile::subpic].GetCount() == 1) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
- } else if((s.pid != NO_SUBTITLE_PID) && (S_OK == AddOutputPin(s, pPinOut))) {
+ } else if ((s.pid != NO_SUBTITLE_PID) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
}
} else {
- if(S_OK == AddOutputPin(s, pPinOut)) {
+ if (S_OK == AddOutputPin(s, pPinOut)) {
break;
}
}
}
}
- if(m_rtPlaylistDuration) {
+ if (m_rtPlaylistDuration) {
m_rtNewStop = m_rtStop = m_rtDuration = m_rtPlaylistDuration;
- } else if(m_pFile->IsRandomAccess() && m_pFile->m_rate) {
+ } else if (m_pFile->IsRandomAccess() && m_pFile->m_rate) {
m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * m_pFile->GetLength() / m_pFile->m_rate;
}
@@ -1008,7 +1005,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool CMpegSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CMpegSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -1021,12 +1018,12 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt) {
CAtlList<CMpegSplitterFile::stream>* pMasterStream = m_pFile->GetMasterStream();
- if(!pMasterStream) {
+ if (!pMasterStream) {
ASSERT(0);
return;
}
- if(m_pFile->IsStreaming()) {
+ if (m_pFile->IsStreaming()) {
m_pFile->Seek(max(0, m_pFile->GetLength() - 100*1024));
m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead());
return;
@@ -1034,7 +1031,7 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt) REFERENCE_TIME rtPreroll = 10000000;
- if(rt <= rtPreroll || m_rtDuration <= 0) {
+ if (rt <= rtPreroll || m_rtDuration <= 0) {
m_pFile->Seek(0);
} else {
__int64 len = m_pFile->GetLength();
@@ -1044,33 +1041,33 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt) REFERENCE_TIME rtmax = rt - rtPreroll;
REFERENCE_TIME rtmin = rtmax - 5000000;
- if(m_rtStartOffset == 0)
- for(int i = 0; i < countof(m_pFile->m_streams)-1; i++) {
+ if (m_rtStartOffset == 0)
+ for (int i = 0; i < countof(m_pFile->m_streams)-1; i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNum = m_pFile->m_streams[i].GetNext(pos);
CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNum);
- if(pPin && pPin->IsConnected()) {
+ if (pPin && pPin->IsConnected()) {
m_pFile->Seek(seekpos);
__int64 curpos = seekpos;
REFERENCE_TIME pdt = _I64_MIN;
- for(int j = 0; j < 10; j++) {
+ for (int j = 0; j < 10; j++) {
REFERENCE_TIME rt = m_pFile->NextPTS(TrackNum);
- if(rt < 0) {
+ if (rt < 0) {
break;
}
REFERENCE_TIME dt = rt - rtmax;
- if(dt > 0 && dt == pdt) {
+ if (dt > 0 && dt == pdt) {
dt = 10000000i64;
}
- if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0) {
+ if (rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0) {
minseekpos = min(minseekpos, curpos);
break;
}
@@ -1084,7 +1081,7 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt) }
}
- if(minseekpos != _I64_MAX) {
+ if (minseekpos != _I64_MAX) {
seekpos = minseekpos;
} else {
// this file is probably screwed up, try plan B, seek simply by bitrate
@@ -1104,9 +1101,9 @@ bool CMpegSplitterFilter::DemuxLoop() REFERENCE_TIME rtStartOffset = m_rtStartOffset ? m_rtStartOffset : m_pFile->m_rtMin;
HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
- if((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
- if((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ if ((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
+ if ((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE) {
Sleep(1);
}
}
@@ -1133,7 +1130,7 @@ STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams) *pcStreams = 0;
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
(*pcStreams) += m_pFile->m_streams[i].GetCount();
}
@@ -1142,37 +1139,37 @@ STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams) STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
+ if (!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
return E_NOTIMPL;
}
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
int cnt = m_pFile->m_streams[i].GetCount();
- if(lIndex >= j && lIndex < j+cnt) {
+ if (lIndex >= j && lIndex < j+cnt) {
lIndex -= j;
POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) {
+ if (!pos) {
return E_UNEXPECTED;
}
CMpegSplitterFile::stream& to = m_pFile->m_streams[i].GetAt(pos);
pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& from = m_pFile->m_streams[i].GetNext(pos);
- if(!GetOutputPin(from)) {
+ if (!GetOutputPin(from)) {
continue;
}
- if(m_useFastStreamChange) {
+ if (m_useFastStreamChange) {
PauseGraph;
ResumeGraph;
}
HRESULT hr;
- if(FAILED(hr = RenameOutputPin(from, to, &to.mt))) {
+ if (FAILED(hr = RenameOutputPin(from, to, &to.mt))) {
return hr;
}
@@ -1182,22 +1179,22 @@ STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags) const CHdmvClipInfo::Stream *pClipInfo;
const CMpegSplitterFile::program* p = m_pFile->FindProgram(to.pid, iProgram, pClipInfo);
- if(p!=NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv()) {
- for(int k = 0; k < countof(m_pFile->m_streams); k++) {
- if(k == i) {
+ if (p!=NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv()) {
+ for (int k = 0; k < countof(m_pFile->m_streams); k++) {
+ if (k == i) {
continue;
}
pos = m_pFile->m_streams[k].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& from = m_pFile->m_streams[k].GetNext(pos);
- if(!GetOutputPin(from)) {
+ if (!GetOutputPin(from)) {
continue;
}
- for(int l = 0; l < countof(p->streams); l++) {
- if(const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid)) {
- if(from != *s) {
+ for (int l = 0; l < countof(p->streams); l++) {
+ if (const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid)) {
+ if (from != *s) {
hr = RenameOutputPin(from, *s, &s->mt);
}
break;
@@ -1322,47 +1319,47 @@ bool CMpegSplitterFile::stream::operator < (const stream &_Other) const STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
int cnt = m_pFile->m_streams[i].GetCount();
- if(lIndex >= j && lIndex < j+cnt) {
+ if (lIndex >= j && lIndex < j+cnt) {
lIndex -= j;
POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) {
+ if (!pos) {
return E_UNEXPECTED;
}
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetAt(pos);
CHdmvClipInfo::Stream* pStream = m_ClipInfo.FindStream (s.pid);
- if(ppmt) {
+ if (ppmt) {
*ppmt = CreateMediaType(&s.mt);
}
- if(pdwFlags) {
+ if (pdwFlags) {
*pdwFlags = GetOutputPin(s) ? (AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE) : 0;
}
- if(plcid) {
+ if (plcid) {
*plcid = pStream ? pStream->m_LCID : 0;
}
- if(pdwGroup) {
+ if (pdwGroup) {
*pdwGroup = i;
}
- if(ppObject) {
+ if (ppObject) {
*ppObject = NULL;
}
- if(ppUnk) {
+ if (ppUnk) {
*ppUnk = NULL;
}
- if(ppszName) {
+ if (ppszName) {
CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
CStringW str;
if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID) {
str = NO_SUBTITLE_NAME;
- if(plcid) {
+ if (plcid) {
*plcid = (LCID)LCID_NOSUBTITLES;
}
} else {
@@ -1390,7 +1387,7 @@ STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* }
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
- if(*ppszName == NULL) {
+ if (*ppszName == NULL) {
return E_OUTOFMEMORY;
}
@@ -1421,13 +1418,13 @@ STDMETHODIMP CMpegSplitterFilter::CreatePage(const GUID& guid, IPropertyPage** p {
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMpegSplitterSettingsWnd)) {
+ if (guid == __uuidof(CMpegSplitterSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMpegSplitterSettingsWnd>(NULL, &hr))->AddRef();
}
@@ -1439,7 +1436,7 @@ STDMETHODIMP CMpegSplitterFilter::Apply() {
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"))) {
key.SetDWORDValue(_T("UseFastStreamChange"), m_useFastStreamChange);
key.SetDWORDValue(_T("ForcedSub"), m_ForcedSub);
key.SetDWORDValue(_T("TrackPriority"), m_TrackPriority);
@@ -1607,12 +1604,12 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) {
CAutoLock cAutoLock(this);
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME rt = p->rtStart + m_rtOffset;
// Filter invalid PTS (if too different from previous packet)
- if(m_rtPrev != Packet::INVALID_TIME)
- if(_abs64(rt - m_rtPrev) > m_rtMaxShift) {
+ if (m_rtPrev != Packet::INVALID_TIME)
+ if (_abs64(rt - m_rtPrev) > m_rtMaxShift) {
m_rtOffset += m_rtPrev - rt;
}
@@ -1630,22 +1627,22 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
- if(m_mt.subtype == MEDIASUBTYPE_AAC) { // special code for aac, the currently available decoders only like whole frame samples
- if(m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0)) {
+ if (m_mt.subtype == MEDIASUBTYPE_AAC) { // special code for aac, the currently available decoders only like whole frame samples
+ if (m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0)) {
m_p.Free();
}
- if(!m_p) {
+ if (!m_p) {
BYTE* base = p->GetData();
BYTE* s = base;
BYTE* e = s + p->GetCount();
- for(; s < e; s++) {
- if(*s != 0xff) {
+ for (; s < e; s++) {
+ if (*s != 0xff) {
continue;
}
- if(s == e-1 || (s[1]&0xf6) == 0xf0) {
+ if (s == e-1 || (s[1]&0xf6) == 0xf0) {
memmove(base, s, e - s);
p->SetCount(e - s);
m_p = p;
@@ -1656,7 +1653,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) m_p->Append(*p);
}
- while(m_p && m_p->GetCount() > 9) {
+ while (m_p && m_p->GetCount() > 9) {
BYTE* base = m_p->GetData();
BYTE* s = base;
BYTE* e = s + m_p->GetCount();
@@ -1664,15 +1661,15 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) bool crc = !(s[1]&1);
s += 7;
len -= 7;
- if(crc) {
+ if (crc) {
s += 2, len -= 2;
}
- if(e - s < len) {
+ if (e - s < len) {
break;
}
- if(len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0)) {
+ if (len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0)) {
m_p.Free();
break;
}
@@ -1698,22 +1695,22 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) m_p->SetCount(e - s);
HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
- if(m_p && p) {
- if(!m_p->bDiscontinuity) {
+ if (m_p && p) {
+ if (!m_p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
}
- if(!m_p->bSyncPoint) {
+ if (!m_p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
}
- if(m_p->rtStart == Packet::INVALID_TIME) {
+ if (m_p->rtStart == Packet::INVALID_TIME) {
m_p->rtStart = p->rtStart, m_p->rtStop = p->rtStop;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1722,8 +1719,8 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
return S_OK;
- } else if(m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva') || m_mt.subtype == FOURCCMap('CVMA') || m_mt.subtype == FOURCCMap('CVME')) {
- if(!m_p) {
+ } else if (m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva') || m_mt.subtype == FOURCCMap('CVMA') || m_mt.subtype == FOURCCMap('CVME')) {
+ if (!m_p) {
m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity;
@@ -1746,12 +1743,12 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) MOVE_TO_H264_START_CODE(start, end);
- while(start <= end-4) {
+ while (start <= end-4) {
BYTE* next = start+1;
MOVE_TO_H264_START_CODE(next, end);
- if(next >= end-4) {
+ if (next >= end-4) {
break;
}
@@ -1799,20 +1796,20 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) m_pl.AddTail(p2);
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_p->rtStart = p->rtStart;
m_p->rtStop = p->rtStop;
p->rtStart = Packet::INVALID_TIME;
}
- if(p->bDiscontinuity) {
+ if (p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
p->bDiscontinuity = FALSE;
}
- if(p->bSyncPoint) {
+ if (p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
p->bSyncPoint = FALSE;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1821,44 +1818,44 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) start = next;
}
- if(start > m_p->GetData()) {
+ if (start > m_p->GetData()) {
m_p->RemoveAt(0, start - m_p->GetData());
}
REFERENCE_TIME rtStart = Packet::INVALID_TIME, rtStop = Packet::INVALID_TIME;
- for(POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos)) {
- if(pos == m_pl.GetHeadPosition()) {
+ for (POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos)) {
+ if (pos == m_pl.GetHeadPosition()) {
continue;
}
Packet* pPacket = m_pl.GetAt(pos);
BYTE* pData = pPacket->GetData();
- if((pData[4]&0x1f) == 0x09) {
+ if ((pData[4]&0x1f) == 0x09) {
m_fHasAccessUnitDelimiters = true;
}
- if((pData[4]&0x1f) == 0x09 || (!m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)) {
+ if ((pData[4]&0x1f) == 0x09 || (!m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)) {
if (pPacket->rtStart == Packet::INVALID_TIME && rtStart != Packet::INVALID_TIME) {
pPacket->rtStart = rtStart;
pPacket->rtStop = rtStop;
}
-/*
- if(pPacket->rtStart == Packet::INVALID_TIME) {
- continue;
- }
-*/
+ /*
+ if(pPacket->rtStart == Packet::INVALID_TIME) {
+ continue;
+ }
+ */
p = m_pl.RemoveHead();
- while(pos != m_pl.GetHeadPosition()) {
+ while (pos != m_pl.GetHeadPosition()) {
CAutoPtr<Packet> p2 = m_pl.RemoveHead();
p->Append(*p2);
}
HRESULT hr = __super::DeliverPacket(p);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1869,8 +1866,8 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
return S_OK;
- } else if(m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw') || m_mt.subtype == MEDIASUBTYPE_WVC1_CYBERLINK || m_mt.subtype == MEDIASUBTYPE_WVC1_ARCSOFT) { // just like aac, this has to be starting nalus, more can be packed together
- if(!m_p) {
+ } else if (m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw') || m_mt.subtype == MEDIASUBTYPE_WVC1_CYBERLINK || m_mt.subtype == MEDIASUBTYPE_WVC1_ARCSOFT) { // just like aac, this has to be starting nalus, more can be packed together
+ if (!m_p) {
m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity;
@@ -1892,7 +1889,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) BYTE* end = start + m_p->GetCount();
bool bSeqFound = false;
- while(start <= end-4) {
+ while (start <= end-4) {
if (*(DWORD*)start == 0x0D010000) {
bSeqFound = true;
break;
@@ -1902,10 +1899,10 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) start++;
}
- while(start <= end-4) {
+ while (start <= end-4) {
BYTE* next = start+1;
- while(next <= end-4) {
+ while (next <= end-4) {
if (*(DWORD*)next == 0x0D010000) {
if (bSeqFound) {
break;
@@ -1917,7 +1914,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) next++;
}
- if(next >= end-4) {
+ if (next >= end-4) {
break;
}
@@ -1944,24 +1941,24 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) p2->SetData(start, next - start);
HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_p->rtStart = p->rtStop; //p->rtStart; //Sebastiii for enable VC1 decoding in FFDshow (no more shutter)
m_p->rtStop = p->rtStop;
p->rtStart = Packet::INVALID_TIME;
}
- if(p->bDiscontinuity) {
+ if (p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
p->bDiscontinuity = FALSE;
}
- if(p->bSyncPoint) {
+ if (p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
p->bSyncPoint = FALSE;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1972,7 +1969,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) bSeqFound = (*(DWORD*)start == 0x0D010000);
}
- if(start > m_p->GetData()) {
+ if (start > m_p->GetData()) {
m_p->RemoveAt(0, start - m_p->GetData());
}
@@ -2016,15 +2013,15 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) else if (!p->pmt) {
return S_OK;
}
- // HDMV LPCM
+ // HDMV LPCM
} else if (m_mt.subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
BYTE* start = p->GetData();
p->SetData(start + 4, p->GetCount() - 4);
- // Dolby_AC3
- } else if ((m_type == CMpegSplitterFile::ts) &&
- (m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3) &&
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->StreamIsTrueHD(p->TrackNumber) &&
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
+ // Dolby_AC3
+ } else if ((m_type == CMpegSplitterFile::ts) &&
+ (m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3) &&
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->StreamIsTrueHD(p->TrackNumber) &&
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
if (p->GetCount() < 8) {
return S_OK; // Should be invalid packet
}
@@ -2032,7 +2029,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) if (*(WORD*)start != 0x770b) { // skip none AC3
return S_OK;
}
- // TrueHD
+ // TrueHD
} else if (m_mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD && (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
if (p->GetCount() < 8) {
return S_OK; // Should be invalid packet
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.h b/src/filters/parser/MpegSplitter/MpegSplitter.h index 9a5872238..e58d84158 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitter.h +++ b/src/filters/parser/MpegSplitter/MpegSplitter.h @@ -47,7 +47,7 @@ \
if(_fs == State_Running && _pMS) \
_pMC->Run(); \
-
+
class __declspec(uuid("DC257063-045F-4BE2-BD5B-E12279C464F0"))
CMpegSplitterFilter
: public CBaseSplitterFilter
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp index 93cecf54d..76df3392a 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp @@ -43,7 +43,7 @@ CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bo , m_AC3CoreOnly(AC3CoreOnly)
, m_init(false)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = Init(pAsyncReader);
}
}
@@ -58,64 +58,64 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) Seek(0);
- if(m_type == us) {
- if(BitRead(32, true) == 'TFrc') {
+ if (m_type == us) {
+ if (BitRead(32, true) == 'TFrc') {
Seek(0x67c);
}
int cnt = 0, limit = 4;
- for(trhdr h; cnt < limit && Read(h); cnt++) {
+ for (trhdr h; cnt < limit && Read(h); cnt++) {
Seek(h.next);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = ts;
}
}
Seek(0);
- if(m_type == us) {
- if(BitRead(32, true) == 'TFrc') {
+ if (m_type == us) {
+ if (BitRead(32, true) == 'TFrc') {
Seek(0xE80);
}
int cnt = 0, limit = 4;
- for(trhdr h; cnt < limit && Read(h); cnt++) {
+ for (trhdr h; cnt < limit && Read(h); cnt++) {
Seek(h.next);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = ts;
}
}
Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
int cnt = 0, limit = 4;
- for(pvahdr h; cnt < limit && Read(h); cnt++) {
+ for (pvahdr h; cnt < limit && Read(h); cnt++) {
Seek(GetPos() + h.length);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = pva;
}
}
Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
BYTE b;
- for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++) {
- if(b == 0xba) {
+ for (int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++) {
+ if (b == 0xba) {
pshdr h;
- if(Read(h)) {
+ if (Read(h)) {
m_type = ps;
m_rate = int(h.bitrate/8);
break;
}
- } else if((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
- || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
- // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
- || b == 0xbd) { // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ } else if ((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
+ || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
+ // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ || b == 0xbd) { // private stream 1, 0xbd, ac3/dts/lpcm/subpic
peshdr h;
- if(Read(h, b) && BitRead(24, true) == 0x000001) {
+ if (Read(h, b) && BitRead(24, true) == 0x000001) {
m_type = es;
}
}
@@ -124,75 +124,75 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
return E_FAIL;
}
// min/max pts & bitrate
m_rtMin = m_posMin = _I64_MAX;
m_rtMax = m_posMax = 0;
-
+
m_init = true;
- if(IsRandomAccess() || IsStreaming()) {
- if(IsStreaming()) {
- for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
+ if (IsRandomAccess() || IsStreaming()) {
+ if (IsStreaming()) {
+ for (int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
;
}
}
CAtlList<__int64> fps;
- for(int i = 0, j = 5; i <= j; i++) {
+ for (int i = 0, j = 5; i <= j; i++) {
fps.AddTail(i*GetLength()/j);
}
- for(__int64 pfp = 0; fps.GetCount(); ) {
+ for (__int64 pfp = 0; fps.GetCount(); ) {
__int64 fp = fps.RemoveHead();
fp = min(GetLength() - MEGABYTE/8, fp);
fp = max(pfp, fp);
__int64 nfp = fp + (pfp == 0 ? 10*MEGABYTE : MEGABYTE/8);
- if(FAILED(hr = SearchStreams(fp, nfp, pAsyncReader))) {
+ if (FAILED(hr = SearchStreams(fp, nfp, pAsyncReader))) {
return hr;
}
pfp = nfp;
}
} else {
- if(FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader))) {
+ if (FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader))) {
return hr;
}
}
- if(m_type == ts) {
- if(IsRandomAccess() || IsStreaming()) {
- if(IsStreaming()) {
- for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
+ if (m_type == ts) {
+ if (IsRandomAccess() || IsStreaming()) {
+ if (IsStreaming()) {
+ for (int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
;
}
}
CAtlList<__int64> fps;
- for(int i = 0, j = 5; i <= j; i++) {
+ for (int i = 0, j = 5; i <= j; i++) {
fps.AddTail(i*GetLength()/j);
}
- for(__int64 pfp = 0; fps.GetCount(); ) {
+ for (__int64 pfp = 0; fps.GetCount(); ) {
__int64 fp = fps.RemoveHead();
fp = min(GetLength() - MEGABYTE/8, fp);
fp = max(pfp, fp);
__int64 nfp = fp + (pfp == 0 ? 10*MEGABYTE : MEGABYTE/8);
- if(FAILED(hr = SearchStreams(fp, nfp, pAsyncReader, TRUE))) {
+ if (FAILED(hr = SearchStreams(fp, nfp, pAsyncReader, TRUE))) {
return hr;
}
pfp = nfp;
}
} else {
- if(FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader, TRUE))) {
+ if (FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader, TRUE))) {
return hr;
}
}
}
- if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0) {
+ if (m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0) {
return E_FAIL;
}
@@ -205,7 +205,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) #if (0)
// normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
// (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
+ if (indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
m_rate = detected_rate;
} else {
; // TODO: in this case disable seeking, or try doing something less drastical...
@@ -213,8 +213,8 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) #endif
// Add fake Subtitle stream ...
- if(m_type == ts) {
- if(m_streams[video].GetCount()) {
+ if (m_type == ts) {
+ if (m_streams[video].GetCount()) {
if (!m_bIsHdmv && m_streams[subpic].GetCount()) {
stream s;
s.pid = NO_SUBTITLE_PID;
@@ -227,7 +227,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader) }
}
} else {
- if(m_streams[video].GetCount() && m_streams[subpic].GetCount()) {
+ if (m_streams[video].GetCount() && m_streams[subpic].GetCount()) {
stream s;
s.pid = NO_SUBTITLE_PID;
s.mt.majortype = m_streams[subpic].GetHead().mt.majortype;
@@ -246,7 +246,7 @@ void CMpegSplitterFile::OnComplete(IAsyncReader* pAsyncReader) {
__int64 pos = GetPos();
- if(SUCCEEDED(SearchStreams(GetLength() - 500*1024, GetLength(), pAsyncReader, TRUE))) {
+ if (SUCCEEDED(SearchStreams(GetLength() - 500*1024, GetLength(), pAsyncReader, TRUE))) {
int indicated_rate = m_rate;
int detected_rate = int(m_rtMax > m_rtMin ? 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin) : 0);
@@ -254,7 +254,7 @@ void CMpegSplitterFile::OnComplete(IAsyncReader* pAsyncReader) #if (0)
// normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
// (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
+ if (indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
m_rate = detected_rate;
} else {
; // TODO: in this case disable seeking, or try doing something less drastical...
@@ -272,9 +272,9 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) BYTE b;
- while(GetRemaining()) {
- if(m_type == ps || m_type == es) {
- if(!NextMpegStartCode(b)) { // continue;
+ while (GetRemaining()) {
+ if (m_type == ps || m_type == es) {
+ if (!NextMpegStartCode(b)) { // continue;
ASSERT(0);
break;
}
@@ -282,19 +282,19 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) rtpos = GetPos()-4;
#if (EVO_SUPPORT == 0)
- if(b >= 0xbd && b < 0xf0)
+ if (b >= 0xbd && b < 0xf0)
#else
- if((b >= 0xbd && b < 0xf0) || (b == 0xfd))
+ if ((b >= 0xbd && b < 0xf0) || (b == 0xfd))
#endif
{
peshdr h;
- if(!Read(h, b) || !h.len) {
+ if (!Read(h, b) || !h.len) {
continue;
}
__int64 pos = GetPos();
- if(h.fpts && AddStream(0, b, h.len) == TrackNum) {
+ if (h.fpts && AddStream(0, b, h.len) == TrackNum) {
//ASSERT(h.pts >= m_rtMin && h.pts <= m_rtMax);
rt = h.pts;
break;
@@ -302,18 +302,18 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) Seek(pos + h.len);
}
- } else if(m_type == ts) {
+ } else if (m_type == ts) {
trhdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
rtpos = GetPos()-4;
- if(h.payload && h.payloadstart && ISVALIDPID(h.pid)) {
+ if (h.payload && h.payloadstart && ISVALIDPID(h.pid)) {
peshdr h2;
- if(NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
- if(h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum)) {
+ if (NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
+ if (h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum)) {
//ASSERT(h2.pts >= m_rtMin && h2.pts <= m_rtMax);
rt = h2.pts;
break;
@@ -322,23 +322,23 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum) }
Seek(h.next);
- } else if(m_type == pva) {
+ } else if (m_type == pva) {
pvahdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
- if(h.fpts) {
+ if (h.fpts) {
rt = h.pts;
break;
}
}
}
- if(rtpos >= 0) {
+ if (rtpos >= 0) {
Seek(rtpos);
}
- if(rt >= 0) {
+ if (rt >= 0) {
rt -= m_rtMin;
}
@@ -350,49 +350,49 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead Seek(start);
stop = min(stop, GetLength());
- while(GetPos() < stop) {
+ while (GetPos() < stop) {
BYTE b;
- if(m_type == ps || m_type == es) {
- if(!NextMpegStartCode(b)) {
+ if (m_type == ps || m_type == es) {
+ if (!NextMpegStartCode(b)) {
continue;
}
- if(b == 0xba) { // program stream header
+ if (b == 0xba) { // program stream header
pshdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
m_rate = int(h.bitrate/8);
- } else if(b == 0xbb) { // program stream system header
+ } else if (b == 0xbb) { // program stream system header
pssyshdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
}
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if (b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if ((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
{
peshdr h;
- if(!Read(h, b)) {
+ if (!Read(h, b)) {
continue;
}
- if(h.type == mpeg2 && h.scrambling) {
+ if (h.type == mpeg2 && h.scrambling) {
ASSERT(0);
return E_FAIL;
}
- if(h.fpts) {
- if(m_rtMin == _I64_MAX) {
+ if (h.fpts) {
+ if (m_rtMin == _I64_MAX) {
m_rtMin = h.pts;
m_posMin = GetPos();
TRACE ("m_rtMin(SearchStreams)=%S\n", ReftimeToString(m_rtMin));
}
- if(m_rtMin < h.pts && m_rtMax < h.pts) {
+ if (m_rtMin < h.pts && m_rtMax < h.pts) {
m_rtMax = h.pts;
m_posMax = GetPos();
TRACE ("m_rtMax(SearchStreams)=%S\n", ReftimeToString(m_rtMax));
@@ -401,13 +401,13 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead __int64 pos = GetPos();
AddStream(0, b, h.len);
- if(h.len) {
+ if (h.len) {
Seek(pos + h.len);
}
}
- } else if(m_type == ts) {
+ } else if (m_type == ts) {
trhdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
@@ -415,22 +415,22 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead UpdatePrograms(h);
- if(h.payload && ISVALIDPID(h.pid)) {
+ if (h.payload && ISVALIDPID(h.pid)) {
peshdr h2;
- if(h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
- if(h2.type == mpeg2 && h2.scrambling) {
+ if (h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
+ if (h2.type == mpeg2 && h2.scrambling) {
ASSERT(0);
return E_FAIL;
}
- if(h2.fpts && CalcDuration && GetMasterStream() && GetMasterStream()->GetHead() == h.pid) {
- if((m_rtMin == _I64_MAX) || (m_rtMin > h2.pts)) {
+ if (h2.fpts && CalcDuration && GetMasterStream() && GetMasterStream()->GetHead() == h.pid) {
+ if ((m_rtMin == _I64_MAX) || (m_rtMin > h2.pts)) {
m_rtMin = h2.pts;
m_posMin = GetPos();
TRACE ("m_rtMin(SearchStreams)=%S, PID=%d\n", ReftimeToString(m_rtMin), h.pid);
}
- if(m_rtMin < h2.pts && m_rtMax < h2.pts) {
+ if (m_rtMin < h2.pts && m_rtMax < h2.pts) {
m_rtMax = h2.pts;
m_posMax = GetPos();
TRACE ("m_rtMax(SearchStreams)=%S, PID=%d\n", ReftimeToString(m_rtMax), h.pid);
@@ -457,25 +457,25 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead b = 0;
}
- if(!CalcDuration) {
+ if (!CalcDuration) {
AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - pos)));
}
}
Seek(h.next);
- } else if(m_type == pva) {
+ } else if (m_type == pva) {
pvahdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
- if(h.fpts) {
- if(m_rtMin == _I64_MAX) {
+ if (h.fpts) {
+ if (m_rtMin == _I64_MAX) {
m_rtMin = h.pts;
m_posMin = GetPos();
}
- if(m_rtMin < h.pts && m_rtMax < h.pts) {
+ if (m_rtMin < h.pts && m_rtMax < h.pts) {
m_rtMax = h.pts;
m_posMax = GetPos();
}
@@ -483,13 +483,13 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead __int64 pos = GetPos();
- if(h.streamid == 1) {
+ if (h.streamid == 1) {
AddStream(h.streamid, 0xe0, h.length);
- } else if(h.streamid == 2) {
+ } else if (h.streamid == 2) {
AddStream(h.streamid, 0xc0, h.length);
}
- if(h.length) {
+ if (h.length) {
Seek(pos + h.length);
}
}
@@ -500,8 +500,8 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
{
- if(pid) {
- if(pesid) {
+ if (pid) {
+ if (pesid) {
m_pid2pes[pid] = pesid;
} else {
m_pid2pes.Lookup(pid, pesid);
@@ -514,24 +514,24 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) int type = unknown;
- if(pesid >= 0xe0 && pesid < 0xf0) { // mpeg video
+ if (pesid >= 0xe0 && pesid < 0xf0) { // mpeg video
__int64 pos = GetPos();
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::seqhdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
type = video;
}
}
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
// PPS and SPS can be present on differents packets
// and can also be split into multiple packets
if (!avch.Lookup(pid))
memset(&avch[pid], 0, sizeof(CMpegSplitterFile::avchdr));
#if defined(MVC_SUPPORT)
- if(!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt))
+ if (!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt))
{
if (avch[pid].spspps[index_subsetsps].complete)
type = stereo;
@@ -539,64 +539,64 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) type = video;
}
#else
- if(!m_streams[video].Find(s) && Read(avch[pid], len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(avch[pid], len, &s.mt)) {
type = video;
}
#endif
}
- } else if(pesid >= 0xc0 && pesid < 0xe0) { // mpeg audio
+ } else if (pesid >= 0xc0 && pesid < 0xe0) { // mpeg audio
__int64 pos = GetPos();
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::aachdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
}
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::mpahdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
type = audio;
}
}
- } else if(pesid == 0xbd || pesid == 0xfd) { // private stream 1
- if(s.pid) {
- if(!m_streams[audio].Find(s) && !m_streams[video].Find(s)) {
+ } else if (pesid == 0xbd || pesid == 0xfd) { // private stream 1
+ if (s.pid) {
+ if (!m_streams[audio].Find(s) && !m_streams[video].Find(s)) {
__int64 pos = GetPos();
// AC3
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::ac3hdr h;
- if(Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1))) {
+ if (Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1))) {
type = audio;
}
}
// DTS
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::dtshdr h;
- if(Read(h, len, &s.mt, false)) {
+ if (Read(h, len, &s.mt, false)) {
type = audio;
}
}
// VC1
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
type = video;
}
}
// DVB subtitles
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::dvbsub h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
type = subpic;
}
}
@@ -604,7 +604,7 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) int iProgram;
const CHdmvClipInfo::Stream *pClipInfo;
const program* pProgram = FindProgram (s.pid, iProgram, pClipInfo);
- if((type == unknown) && (pProgram != NULL)) {
+ if ((type == unknown) && (pProgram != NULL)) {
PES_STREAM_TYPE StreamType = INVALID;
Seek(pos);
@@ -613,14 +613,14 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) switch (StreamType) {
case AUDIO_STREAM_LPCM : {
CMpegSplitterFile::hdmvlpcmhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, &s.mt)) {
type = audio;
}
}
break;
case PRESENTATION_GRAPHICS_STREAM : {
CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL)) {
m_bIsHdmv = true;
type = subpic;
}
@@ -628,15 +628,15 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) break;
}
}
- } else if((m_AC3CoreOnly != 1) && m_init){
+ } else if ((m_AC3CoreOnly != 1) && m_init) {
int iProgram;
const CHdmvClipInfo::Stream *pClipInfo;
const program* pProgram = FindProgram (s.pid, iProgram, pClipInfo);
- if((type == unknown) && (pProgram != NULL) && AUDIO_STREAM_AC3_TRUE_HD == pProgram->streams[iProgram].type) {
+ if ((type == unknown) && (pProgram != NULL) && AUDIO_STREAM_AC3_TRUE_HD == pProgram->streams[iProgram].type) {
const stream* source = m_streams[audio].FindStream(s.pid);
- if(source && source->mt.subtype == MEDIASUBTYPE_DOLBY_AC3) {
+ if (source && source->mt.subtype == MEDIASUBTYPE_DOLBY_AC3) {
CMpegSplitterFile::ac3hdr h;
- if(Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1)) && s.mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
+ if (Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1)) && s.mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
m_streams[audio].Replace((stream&)*source, s, this);
}
}
@@ -646,7 +646,7 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) #if (EVO_SUPPORT != 0)
else if (pesid == 0xfd) { // TODO EVO SUPPORT
CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
type = video;
}
}
@@ -656,98 +656,98 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len) WORD w = (WORD)BitRead(16, true);
DWORD dw = (DWORD)BitRead(32, true);
- if(b >= 0x80 && b < 0x88 || w == 0x0b77) { // ac3
+ if (b >= 0x80 && b < 0x88 || w == 0x0b77) { // ac3
s.ps1id = (b >= 0x80 && b < 0x88) ? (BYTE)(BitRead(32) >> 24) : 0x80;
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) { // dts
+ } else if (b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) { // dts
s.ps1id = (b >= 0x88 && b < 0x90) ? (BYTE)(BitRead(32) >> 24) : 0x88;
CMpegSplitterFile::dtshdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(b >= 0xa0 && b < 0xa8) { // lpcm
+ } else if (b >= 0xa0 && b < 0xa8) { // lpcm
s.ps1id = (b >= 0xa0 && b < 0xa8) ? (BYTE)(BitRead(32) >> 24) : 0xa0;
CMpegSplitterFile::lpcmhdr h;
- if(Read(h, &s.mt) && !m_streams[audio].Find(s)) { // note the reversed order, the header should be stripped always even if it's not a new stream
+ if (Read(h, &s.mt) && !m_streams[audio].Find(s)) { // note the reversed order, the header should be stripped always even if it's not a new stream
type = audio;
}
- } else if(b >= 0x20 && b < 0x40) { // DVD subpic
+ } else if (b >= 0x20 && b < 0x40) { // DVD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::dvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(b >= 0x70 && b < 0x80) { // SVCD subpic
+ } else if (b >= 0x70 && b < 0x80) { // SVCD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::svcdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(b >= 0x00 && b < 0x10) { // CVD subpic
+ } else if (b >= 0x00 && b < 0x10) { // CVD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::cvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(w == 0xffa0 || w == 0xffa1) { // ps2-mpg audio
+ } else if (w == 0xffa0 || w == 0xffa1) { // ps2-mpg audio
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0xa000 | track id
CMpegSplitterFile::ps2audhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, &s.mt)) {
type = audio;
}
- } else if(w == 0xff90) { // ps2-mpg ac3 or subtitles
+ } else if (w == 0xff90) { // ps2-mpg ac3 or subtitles
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
w = (WORD)BitRead(16, true);
- if(w == 0x0b77) {
+ if (w == 0x0b77) {
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(w == 0x0000) { // usually zero...
+ } else if (w == 0x0000) { // usually zero...
CMpegSplitterFile::ps2subhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
}
}
#if (EVO_SUPPORT != 0)
- else if(b >= 0xc0 && b < 0xc8) { // dolby digital +
+ else if (b >= 0xc0 && b < 0xc8) { // dolby digital +
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
w = (WORD)BitRead(16, true);
- if(w == 0x0b77) {
+ if (w == 0x0b77) {
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
}
}
#endif
}
- } else if(pesid == 0xbe) { // padding
- } else if(pesid == 0xbf) { // private stream 2
+ } else if (pesid == 0xbe) { // padding
+ } else if (pesid == 0xbf) { // private stream 2
}
- if(type != unknown && !m_streams[type].Find(s)) {
- if(s.pid) {
- for(int i = 0; i < unknown; i++) {
- if(m_streams[i].Find(s)) {
+ if (type != unknown && !m_streams[type].Find(s)) {
+ if (s.pid) {
+ for (int i = 0; i < unknown; i++) {
+ if (m_streams[i].Find(s)) {
/*ASSERT(0);*/
return s;
}
@@ -768,7 +768,7 @@ void CMpegSplitterFile::AddHdmvPGStream(WORD pid, const char* language_code) s.pesid = 0xbd;
CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code)) {
m_streams[subpic].Insert(s, this);
}
}
@@ -789,38 +789,38 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang) {
CAutoLock cAutoLock(&m_csProps);
- if(h.payload && h.payloadstart && h.pid == 0) {
+ if (h.payload && h.payloadstart && h.pid == 0) {
trsechdr h2;
- if(Read(h2) && h2.table_id == 0) {
+ if (Read(h2) && h2.table_id == 0) {
CAtlMap<WORD, bool> newprograms;
int len = h2.section_length;
len -= 5+4;
- for(int i = len/4; i > 0; i--) {
+ for (int i = len/4; i > 0; i--) {
WORD program_number = (WORD)BitRead(16);
BYTE reserved = (BYTE)BitRead(3);
WORD pid = (WORD)BitRead(13);
UNUSED_ALWAYS(reserved);
- if(program_number != 0) {
+ if (program_number != 0) {
m_programs[pid].program_number = program_number;
newprograms[program_number] = true;
}
}
POSITION pos = m_programs.GetStartPosition();
- while(pos) {
+ while (pos) {
const CAtlMap<WORD, program>::CPair* pPair = m_programs.GetNext(pos);
- if(!newprograms.Lookup(pPair->m_value.program_number)) {
+ if (!newprograms.Lookup(pPair->m_value.program_number)) {
m_programs.RemoveKey(pPair->m_key);
}
}
}
- } else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid)) {
- if(h.payload && h.payloadstart) {
+ } else if (CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid)) {
+ if (h.payload && h.payloadstart) {
trsechdr h2;
- if(Read(h2) && h2.table_id == 2) {
+ if (Read(h2) && h2.table_id == 2) {
int len = h2.section_length;
len -= 5+4;
@@ -829,8 +829,8 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang) CGolombBuffer gb(buffer, len);
int max_len = h.bytes - 9;
-
- if(len > max_len) {
+
+ if (len > max_len) {
memset(pPair->m_value.ts_buffer, 0, sizeof(pPair->m_value.ts_buffer));
pPair->m_value.ts_len_cur = max_len;
pPair->m_value.ts_len_packet = len;
@@ -841,9 +841,9 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang) }
}
} else {
- if(pPair->m_value.ts_len_cur > 0) {
+ if (pPair->m_value.ts_len_cur > 0) {
int len = pPair->m_value.ts_len_packet - pPair->m_value.ts_len_cur;
- if(len > h.bytes) {
+ if (len > h.bytes) {
ByteRead(pPair->m_value.ts_buffer + pPair->m_value.ts_len_cur, h.bytes);
pPair->m_value.ts_len_cur += h.bytes;
} else {
@@ -858,7 +858,7 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang) void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLang)
{
- if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(pid))
+ if (CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(pid))
{
memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
@@ -873,14 +873,14 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa UNUSED_ALWAYS(reserved2);
len -= (4 + program_info_length);
- if(len <= 0)
+ if (len <= 0)
return;
- while(program_info_length-- > 0) {
+ while (program_info_length-- > 0) {
gb.BitRead(8);
}
- for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
+ for (int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
BYTE stream_type = (BYTE)gb.BitRead(8);
BYTE nreserved1 = (BYTE)gb.BitRead(3);
WORD pid = (WORD)gb.BitRead(13);
@@ -891,14 +891,14 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa pPair->m_value.streams[i].pid = pid;
pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
-
- if(m_ForcedSub) {
- if(stream_type == PRESENTATION_GRAPHICS_STREAM) {
+
+ if (m_ForcedSub) {
+ if (stream_type == PRESENTATION_GRAPHICS_STREAM) {
stream s;
s.pid = pid;
CMpegSplitterFile::hdmvsubhdr hdr;
- if(Read(hdr, &s.mt, NULL)) {
- if(!m_streams[subpic].Find(s)) {
+ if (Read(hdr, &s.mt, NULL)) {
+ if (!m_streams[subpic].Find(s)) {
m_streams[subpic].Insert(s, this);
}
}
@@ -906,43 +906,43 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa }
len -= (5 + ES_info_length);
- if(len < 0)
+ if (len < 0)
break;
- if(ES_info_length<=2)
+ if (ES_info_length<=2)
continue;
- if(UpdateLang) {
+ if (UpdateLang) {
int info_length = ES_info_length;
- for(;;) {
+ for (;;) {
BYTE descriptor_tag = gb.BitRead(8);
BYTE descriptor_length = gb.BitRead(8);
info_length -= (2 + descriptor_length);
- if(info_length < 0)
+ if (info_length < 0)
break;
char ch[4];
- switch(descriptor_tag) {
+ switch (descriptor_tag) {
case 0x0a: // ISO 639 language descriptor
case 0x56: // Teletext descriptor
case 0x59: // Subtitling descriptor
gb.ReadBuffer((BYTE *)ch, 3);
ch[3] = 0;
- for(int i = 3; i < descriptor_length; i++) {
+ for (int i = 3; i < descriptor_length; i++) {
gb.BitRead(8);
}
- if(!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
+ if (!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
m_pPMT_Lang[pid] = ISO6392ToLanguage(ch);
}
break;
default:
- for(int i = 0; i < descriptor_length; i++) {
+ for (int i = 0; i < descriptor_length; i++) {
gb.BitRead(8);
}
break;
}
- if(info_length<=2) break;
+ if (info_length<=2) break;
}
} else {
- while(ES_info_length-- > 0) {
+ while (ES_info_length-- > 0) {
gb.BitRead(8);
}
}
@@ -970,11 +970,11 @@ const CMpegSplitterFile::program* CMpegSplitterFile::FindProgram(WORD pid, int & POSITION pos = m_programs.GetStartPosition();
- while(pos) {
+ while (pos) {
program* p = &m_programs.GetNextValue(pos);
- for(int i = 0; i < countof(p->streams); i++) {
- if(p->streams[i].pid == pid) {
+ for (int i = 0; i < countof(p->streams); i++) {
+ if (p->streams[i].pid == pid) {
iStream = i;
return p;
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.h b/src/filters/parser/MpegSplitter/MpegSplitterFile.h index 300dd30c1..46c4f23ec 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterFile.h +++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.h @@ -78,21 +78,22 @@ public: }
};
- enum {video, audio, subpic,
+ enum {video, audio, subpic,
#if defined(MVC_SUPPORT)
- stereo,
+ stereo,
#endif
- unknown};
+ unknown
+ };
class CStreamList : public CAtlList<stream>
{
public:
void Insert(stream& s, CMpegSplitterFile *_pFile) {
s.m_pFile = _pFile;
- if(_pFile->m_TrackPriority) {
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ if (_pFile->m_TrackPriority) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
stream& s2 = GetAt(pos);
- if(s < s2) {
+ if (s < s2) {
InsertBefore(pos, s);
return;
}
@@ -100,9 +101,9 @@ public: AddTail(s);
} else {
AddTail(s);
- if(GetCount() > 1) {
+ if (GetCount() > 1) {
for (size_t j=0; j<GetCount(); j++) {
- for(size_t i=0; i<GetCount()-1; i++) {
+ for (size_t i=0; i<GetCount()-1; i++) {
if (GetAt(FindIndex(i)) > GetAt(FindIndex(i+1))) {
SwapElements(FindIndex(i), FindIndex(i+1));
}
@@ -115,9 +116,9 @@ public: void Replace(stream& source, stream& dest, CMpegSplitterFile *_pFile) {
source.m_pFile = _pFile;
dest.m_pFile = _pFile;
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
stream& s = GetAt(pos);
- if(source == s) {
+ if (source == s) {
SetAt(pos, dest);
return;
}
@@ -130,15 +131,15 @@ public: type == audio ? L"Audio" :
type == subpic ? L"Subtitle" :
#if defined(MVC_SUPPORT)
- type == stereo ? L"Stereo" :
+ type == stereo ? L"Stereo" :
#endif
L"Unknown";
}
const stream* FindStream(int pid) {
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
const stream& s = GetAt(pos);
- if(s.pid == pid) {
+ if (s.pid == pid) {
return &s;
}
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp b/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp index ff194e856..b813d4d37 100644 --- a/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp +++ b/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp @@ -42,11 +42,11 @@ bool CMpegSplitterSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUn m_pMSF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMSF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMSF = pUnks.GetNext(pos))) {
;
}
- if(!m_pMSF) {
+ if (!m_pMSF) {
return false;
}
@@ -63,7 +63,7 @@ bool CMpegSplitterSettingsWnd::OnActivate() int nPosY = 10;
m_grpDefault.Create (ResStr(IDS_OPTIONS_CAPTION), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 320, nPosY+285), this, (UINT)IDC_STATIC);
-
+
nPosY += VERTICAL_SPACING;
m_cbFastStreamChange.Create (ResStr(IDS_MPEGSPLITTER_FSTREAM_CHANGE), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING, nPosY, 305, nPosY+15), this, IDC_PP_FAST_STREAM_SELECT);
@@ -72,7 +72,7 @@ bool CMpegSplitterSettingsWnd::OnActivate() nPosY += VERTICAL_SPACING;
m_cbTrackPriority.Create (_T("Change Audio-track Priority"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING, nPosY, 305, nPosY+15), this, IDC_PP_TRACK_PRIORITY);
-
+
nPosY += VERTICAL_SPACING;
m_txtAudioLanguageOrder.Create (ResStr(IDS_MPEGSPLITTER_LANG_ORDER), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 200, nPosY+15), this, (UINT)IDC_STATIC);
nPosY += 15;
@@ -101,7 +101,7 @@ bool CMpegSplitterSettingsWnd::OnActivate() m_cbAC3Core.Create (_T("AC-3 Core"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE, CRect (LEFT_SPACING + 15 + 95, nPosY, LEFT_SPACING + 15 + 185, nPosY+20), this, IDC_PP_AC3CORE);
m_cbAsIs.Create (_T("As Source"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE, CRect (LEFT_SPACING + 15 + 190, nPosY, LEFT_SPACING + 15 + 260, nPosY+20), this, IDC_PP_ASIS);
- if(m_pMSF) {
+ if (m_pMSF) {
m_cbFastStreamChange.SetCheck(m_pMSF->GetFastStreamChange());
m_cbForcedSub.SetCheck(m_pMSF->GetForcedSub());
m_cbTrackPriority.SetCheck(m_pMSF->GetTrackPriority());
@@ -119,7 +119,7 @@ bool CMpegSplitterSettingsWnd::OnActivate() #endif
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -134,14 +134,14 @@ bool CMpegSplitterSettingsWnd::OnApply() {
OnDeactivate();
- if(m_pMSF) {
+ if (m_pMSF) {
m_pMSF->SetFastStreamChange(m_cbFastStreamChange.GetCheck());
m_pMSF->SetForcedSub(m_cbForcedSub.GetCheck());
m_pMSF->SetTrackPriority(m_cbTrackPriority.GetCheck());
m_pMSF->SetVC1_GuidFlag(m_cbVC1_GuidFlag.GetCurSel() + 1);
m_pMSF->SetTrueHD(m_cbTrueHD.GetCheck() ? 0 : m_cbAC3Core.GetCheck() ? 1 : 2);
-#ifdef REGISTER_FILTER
+#ifdef REGISTER_FILTER
CString str = _T("");
m_edtAudioLanguageOrder.GetWindowText(str);
m_pMSF->SetAudioLanguageOrder(str.GetBuffer());
diff --git a/src/filters/parser/OggSplitter/OggFile.cpp b/src/filters/parser/OggSplitter/OggFile.cpp index 6df7d81cf..ac7ce7227 100644 --- a/src/filters/parser/OggSplitter/OggFile.cpp +++ b/src/filters/parser/OggSplitter/OggFile.cpp @@ -4,7 +4,7 @@ COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -13,7 +13,7 @@ COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr) HRESULT COggFile::Init()
{
Seek(0);
- if(!Sync()) {
+ if (!Sync()) {
return E_FAIL;
}
@@ -25,11 +25,11 @@ bool COggFile::Sync(HANDLE hBreak) __int64 start = GetPos();
DWORD dw;
- for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
+ for (__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
&& ((i&0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
i++, Seek(start + i)) {
- if(dw == 'SggO') {
+ if (dw == 'SggO') {
Seek(start + i);
return true;
}
@@ -51,27 +51,27 @@ bool COggFile::Read(OggPage& page, bool fFull, HANDLE hBreak) page.m_lens.RemoveAll();
page.SetCount(0);
- if(!Read(page.m_hdr, hBreak)) {
+ if (!Read(page.m_hdr, hBreak)) {
return false;
}
int pagelen = 0, packetlen = 0;
- for(BYTE i = 0; i < page.m_hdr.number_page_segments; i++) {
+ for (BYTE i = 0; i < page.m_hdr.number_page_segments; i++) {
BYTE b;
- if(S_OK != ByteRead(&b, 1)) {
+ if (S_OK != ByteRead(&b, 1)) {
return false;
}
packetlen += b;
- if(1/*b < 0xff*/) {
+ if (1/*b < 0xff*/) {
page.m_lens.AddTail(packetlen);
pagelen += packetlen;
packetlen = 0;
}
}
- if(fFull) {
+ if (fFull) {
page.SetCount(pagelen);
- if(S_OK != ByteRead(page.GetData(), page.GetCount())) {
+ if (S_OK != ByteRead(page.GetData(), page.GetCount())) {
return false;
}
} else {
diff --git a/src/filters/parser/OggSplitter/OggSplitter.cpp b/src/filters/parser/OggSplitter/OggSplitter.cpp index 8851b8053..c770f2007 100644 --- a/src/filters/parser/OggSplitter/OggSplitter.cpp +++ b/src/filters/parser/OggSplitter/OggSplitter.cpp @@ -100,13 +100,13 @@ public: return(pos >= 0 && pos < m_len);
}
unsigned int showbits(int cnt) { // a bit unclean, but works and can read backwards too! :P
- if(!hasbits(cnt)) {
+ if (!hasbits(cnt)) {
ASSERT(0);
return 0;
}
unsigned int ret = 0, off = 0;
BYTE* p = m_p;
- if(cnt < 0) {
+ if (cnt < 0) {
p += (m_pos+cnt)>>3;
off = (m_pos+cnt)&7;
cnt = abs(cnt);
@@ -120,7 +120,7 @@ public: off = 0;
cnt -= 8 - off;
}
- while(cnt > 0) {
+ while (cnt > 0) {
ret |= (*p++&((1<<min(cnt,8))-1)) << off;
off += 8;
cnt -= 8;
@@ -158,7 +158,7 @@ STDMETHODIMP COggSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, OggSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -174,10 +174,10 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew COggFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -189,14 +189,14 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile->Seek(0);
OggPage page;
- for(int i = 0, nWaitForMore = 0; m_pFile->Read(page), i<100; i++) {
+ for (int i = 0, nWaitForMore = 0; m_pFile->Read(page), i<100; i++) {
BYTE* p = page.GetData();
- if(!p) {
+ if (!p) {
break;
}
- if(!(page.m_hdr.header_type_flag & OggPageHeader::continued)) {
- if(!memcmp(p, "fishead", 7) || !memcmp(p, "fisbone", 7)) {
+ if (!(page.m_hdr.header_type_flag & OggPageHeader::continued)) {
+ if (!memcmp(p, "fishead", 7) || !memcmp(p, "fisbone", 7)) {
continue;
}
@@ -207,42 +207,42 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr;
- if(type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6)) {
- if(type == 0x80) {
+ if (type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6)) {
+ if (type == 0x80) {
name.Format(L"Theora %d", i);
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
pPinOut.Attach(DNew COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
nWaitForMore++;
}
- } else if(type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first)) {
+ } else if (type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first)) {
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- if(!memcmp(p, "vorbis", 6)) {
+ if (!memcmp(p, "vorbis", 6)) {
name.Format(L"Vorbis %d", i);
pPinOut.Attach(DNew COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
nWaitForMore++;
- } else if(!memcmp(p, "video", 5)) {
+ } else if (!memcmp(p, "video", 5)) {
name.Format(L"Video %d", i);
pPinOut.Attach(DNew COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "audio", 5)) {
+ } else if (!memcmp(p, "audio", 5)) {
name.Format(L"Audio %d", i);
pPinOut.Attach(DNew COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "text", 4)) {
+ } else if (!memcmp(p, "text", 4)) {
name.Format(L"Text %d", i);
pPinOut.Attach(DNew COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35)) {
+ } else if (!memcmp(p, "Direct Show Samples embedded in Ogg", 35)) {
name.Format(L"DirectShow %d", i);
pPinOut.Attach(DNew COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
}
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- } else if(type == 3 && !memcmp(p, "vorbis", 6)) {
- if(COggSplitterOutputPin* pOggPin =
+ } else if (type == 3 && !memcmp(p, "vorbis", 6)) {
+ if (COggSplitterOutputPin* pOggPin =
dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
pOggPin->AddComment(p+6, page.GetCount()-6-1);
}
- } else if(type == 0x7F && page.GetCount()>12 && *(long*)(p+8) == 0x43614C66) { // Flac
+ } else if (type == 0x7F && page.GetCount()>12 && *(long*)(p+8) == 0x43614C66) { // Flac
// Ogg Flac : method 1
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
name.Format(L"Flac %d", i);
@@ -258,37 +258,37 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) pPinOut.Attach(DNew COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
}
- } else if(!(type&1) && nWaitForMore == 0) {
+ } else if (!(type&1) && nWaitForMore == 0) {
break;
}
}
- if(COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
p->UnpackInitPage(page);
- if(p->IsInitialized()) {
+ if (p->IsInitialized()) {
nWaitForMore--;
}
}
- if(COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
p->UnpackInitPage(page);
- if(p->IsInitialized()) {
+ if (p->IsInitialized()) {
nWaitForMore--;
}
}
}
- if(m_pOutputs.IsEmpty()) {
+ if (m_pOutputs.IsEmpty()) {
return E_FAIL;
}
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
m_pFile->Seek(max(m_pFile->GetLength()-65536, 0));
OggPage page;
- while(m_pFile->Read(page)) {
+ while (m_pFile->Read(page)) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin || page.m_hdr.granule_position == -1) {
+ if (!pOggPin || page.m_hdr.granule_position == -1) {
continue;
}
REFERENCE_TIME rt = pOggPin->GetRefTime(page.m_hdr.granule_position);
@@ -309,19 +309,19 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) tagmap[L"DESCRIPTION"] = L"DESC";
POSITION pos2 = tagmap.GetStartPosition();
- while(pos2) {
+ while (pos2) {
CStringW oggtag, dsmtag;
tagmap.GetNextAssoc(pos2, oggtag, dsmtag);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) {
+ if (!pOggPin) {
continue;
}
CStringW value = pOggPin->GetComment(oggtag);
- if(!value.IsEmpty()) {
+ if (!value.IsEmpty()) {
SetProperty(dsmtag, value);
break;
}
@@ -329,27 +329,27 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !ChapGetCount()) {
+ while (pos && !ChapGetCount()) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) {
+ if (!pOggPin) {
continue;
}
- for(int i = 1; pOggPin; i++) {
+ for (int i = 1; pOggPin; i++) {
CStringW key;
key.Format(L"CHAPTER%02d", i);
CStringW time = pOggPin->GetComment(key);
- if(time.IsEmpty()) {
+ if (time.IsEmpty()) {
break;
}
key.Format(L"CHAPTER%02dNAME", i);
CStringW name = pOggPin->GetComment(key);
- if(name.IsEmpty()) {
+ if (name.IsEmpty()) {
name.Format(L"Chapter %d", i);
}
int h, m, s, ms;
WCHAR c;
- if(7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
+ if (7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
break;
}
REFERENCE_TIME rt = ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000;
@@ -364,7 +364,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bool COggSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "COggSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -373,9 +373,9 @@ bool COggSplitterFilter::DemuxInit() void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0 ) {
+ if (rt <= 0 ) {
m_pFile->Seek(0);
- } else if(m_rtDuration > 0) {
+ } else if (m_rtDuration > 0) {
// oh, the horror...
__int64 len = m_pFile->GetLength();
@@ -384,19 +384,19 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) REFERENCE_TIME rtMinDiff = _I64_MAX;
- while(1) {
+ while (1) {
__int64 endpos = startpos;
REFERENCE_TIME rtPos = -1;
OggPage page;
m_pFile->Seek(startpos);
- while(m_pFile->Read(page, false)) {
- if(page.m_hdr.granule_position == -1) {
+ while (m_pFile->Read(page, false)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin) {
+ if (!pOggPin) {
ASSERT(0);
continue;
}
@@ -409,10 +409,10 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) __int64 rtDiff = rtPos - rt;
- if(rtDiff < 0) {
+ if (rtDiff < 0) {
rtDiff = -rtDiff;
- if(rtDiff < 1000000 || rtDiff >= rtMinDiff) {
+ if (rtDiff < 1000000 || rtDiff >= rtMinDiff) {
m_pFile->Seek(startpos);
break;
}
@@ -422,17 +422,17 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) __int64 newpos = startpos;
- if(rtPos < rt && rtPos < m_rtDuration) {
+ if (rtPos < rt && rtPos < m_rtDuration) {
newpos = startpos + (__int64)((1.0*(rt - rtPos)/(m_rtDuration - rtPos)) * (len - startpos)) + 1024;
- if(newpos < endpos) {
+ if (newpos < endpos) {
newpos = endpos + 1024;
}
- } else if(rtPos > rt && rtPos > 0) {
+ } else if (rtPos > rt && rtPos > 0) {
newpos = startpos - (__int64)((1.0*(rtPos - rt)/(rtPos - 0)) * (startpos - 0)) - 1024;
- if(newpos >= startpos) {
+ if (newpos >= startpos) {
newpos = startpos - 1024;
}
- } else if(rtPos == rt) {
+ } else if (rtPos == rt) {
m_pFile->Seek(startpos);
break;
} else {
@@ -449,51 +449,51 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) m_pFile->Seek(startpos);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
COggSplitterOutputPin* pPin = dynamic_cast<COggSplitterOutputPin*>(static_cast<CBaseSplitterOutputPin*>(m_pOutputs.GetNext(pos)));
- if(!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin)) {
+ if (!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin)) {
continue;
}
bool fKeyFrameFound = false, fSkipKeyFrame = true;
__int64 endpos = _I64_MAX;
- while(!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0) {
+ while (!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0) {
OggPage page;
- while(!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page)) {
- if(page.m_hdr.granule_position == -1) {
+ while (!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
continue;
}
- if(pPin->GetRefTime(page.m_hdr.granule_position) > rt) {
+ if (pPin->GetRefTime(page.m_hdr.granule_position) > rt) {
break;
}
- if(!fKeyFrameFound) {
+ if (!fKeyFrameFound) {
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(p->bSyncPoint) {
+ while (p = pPin->GetPacket()) {
+ if (p->bSyncPoint) {
fKeyFrameFound = true;
fSkipKeyFrame = p->fSkip;
}
}
- if(fKeyFrameFound) {
+ if (fKeyFrameFound) {
break;
}
} else {
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(!p->fSkip) {
+ while (p = pPin->GetPacket()) {
+ if (!p->fSkip) {
fSkipKeyFrame = false;
break;
}
@@ -501,7 +501,7 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) }
}
- if(!(fKeyFrameFound && !fSkipKeyFrame)) {
+ if (!(fKeyFrameFound && !fSkipKeyFrame)) {
endpos = startpos;
startpos = max(startpos - 10*65536, 0);
}
@@ -516,25 +516,25 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt) fKeyFrameFound = false;
OggPage page;
- while(!fKeyFrameFound && m_pFile->Read(page)) {
- if(page.m_hdr.granule_position == -1) {
+ while (!fKeyFrameFound && m_pFile->Read(page)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
continue;
}
REFERENCE_TIME rtPos = pPin->GetRefTime(page.m_hdr.granule_position);
- if(rtPos > rt) {
+ if (rtPos > rt) {
break;
}
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(p->bSyncPoint) {
+ while (p = pPin->GetPacket()) {
+ if (p->bSyncPoint) {
fKeyFrameFound = true;
break;
}
@@ -556,22 +556,22 @@ bool COggSplitterFilter::DemuxLoop() HRESULT hr = S_OK;
OggPage page;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle())) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle())) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin) {
+ if (!pOggPin) {
ASSERT(0);
continue;
}
- if(!pOggPin->IsConnected()) {
+ if (!pOggPin->IsConnected()) {
continue;
}
- if(FAILED(hr = pOggPin->UnpackPage(page))) {
+ if (FAILED(hr = pOggPin->UnpackPage(page))) {
ASSERT(0);
break;
}
CAutoPtr<OggPacket> p;
- while(!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket())) {
- if(!p->fSkip) {
+ while (!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket())) {
+ if (!p->fSkip) {
hr = DeliverPacket(p);
}
}
@@ -605,24 +605,24 @@ void COggSplitterOutputPin::AddComment(BYTE* p, int len) {
bitstream bs(p, len);
bs.getbits(bs.getbits(32)*8);
- for(int n = bs.getbits(32); n-- > 0; ) {
+ for (int n = bs.getbits(32); n-- > 0; ) {
CStringA str;
- for(int len = bs.getbits(32); len-- > 0; ) {
+ for (int len = bs.getbits(32); len-- > 0; ) {
str += (CHAR)bs.getbits(8);
}
CAtlList<CStringA> sl;
Explode(str, sl, '=', 2);
- if(sl.GetCount() == 2) {
+ if (sl.GetCount() == 2) {
CAutoPtr<CComment> p(DNew CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
- if(p->m_key == L"LANGUAGE") {
+ if (p->m_key == L"LANGUAGE") {
CString lang = ISO6392ToLanguage(sl.GetTail()), iso6392 = LanguageToISO6392(CString(p->m_value));
- if(p->m_value.GetLength() == 3 && !lang.IsEmpty()) {
+ if (p->m_value.GetLength() == 3 && !lang.IsEmpty()) {
SetName(CStringW(lang));
SetProperty(L"LANG", p->m_value);
- } else if(!iso6392.IsEmpty()) {
+ } else if (!iso6392.IsEmpty()) {
SetName(p->m_value);
SetProperty(L"LANG", CStringW(iso6392));
} else {
@@ -642,9 +642,9 @@ CStringW COggSplitterOutputPin::GetComment(CStringW key) key.MakeUpper();
CAtlList<CStringW> sl;
POSITION pos = m_pComments.GetHeadPosition();
- while(pos) {
+ while (pos) {
CComment* p = m_pComments.GetNext(pos);
- if(key == p->m_key) {
+ if (key == p->m_key) {
sl.AddTail(p->m_value);
}
}
@@ -663,7 +663,7 @@ void COggSplitterOutputPin::ResetState(DWORD seqnum) HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
{
- if(m_lastseqnum != page.m_hdr.page_sequence_number - 1) {
+ if (m_lastseqnum != page.m_hdr.page_sequence_number - 1) {
ResetState(page.m_hdr.page_sequence_number);
return S_FALSE; // FIXME
} else {
@@ -671,18 +671,18 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page) }
POSITION first = page.m_lens.GetHeadPosition();
- while(first && page.m_lens.GetAt(first) == 255) {
+ while (first && page.m_lens.GetAt(first) == 255) {
page.m_lens.GetNext(first);
}
- if(!first) {
+ if (!first) {
first = page.m_lens.GetTailPosition();
}
POSITION last = page.m_lens.GetTailPosition();
- while(last && page.m_lens.GetAt(last) == 255) {
+ while (last && page.m_lens.GetAt(last) == 255) {
page.m_lens.GetPrev(last);
}
- if(!last) {
+ if (!last) {
last = page.m_lens.GetTailPosition();
}
@@ -690,36 +690,36 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page) int i = 0, j = 0, len = 0;
- for(POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos)) {
+ for (POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos)) {
len = page.m_lens.GetAt(pos);
j += len;
- if(len < 255 || pos == page.m_lens.GetTailPosition()) {
- if(first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued)) {
+ if (len < 255 || pos == page.m_lens.GetTailPosition()) {
+ if (first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued)) {
// ASSERT(m_lastpacket);
- if(m_lastpacket) {
+ if (m_lastpacket) {
int size = m_lastpacket->GetCount();
m_lastpacket->SetCount(size + j-i);
memcpy(m_lastpacket->GetData() + size, pData + i, j-i);
CAutoLock csAutoLock(&m_csPackets);
- if(len < 255) {
+ if (len < 255) {
m_packets.AddTail(m_lastpacket);
}
}
} else {
CAutoPtr<OggPacket> p(DNew OggPacket());
- if(last == pos && page.m_hdr.granule_position != -1) {
+ if (last == pos && page.m_hdr.granule_position != -1) {
p->bDiscontinuity = m_fSkip;
REFERENCE_TIME rtLast = m_rtLast;
m_rtLast = GetRefTime(page.m_hdr.granule_position);
// some bad encodings have a +/-1 frame difference from the normal timeline,
// but these seem to cancel eachother out nicely so we can just ignore them
// to make it play a bit more smooth.
- if(abs(rtLast - m_rtLast) == GetRefTime(1)) {
+ if (abs(rtLast - m_rtLast) == GetRefTime(1)) {
m_rtLast = rtLast; // FIXME
}
m_fSkip = false;
@@ -727,19 +727,19 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page) p->TrackNumber = page.m_hdr.bitstream_serial_number;
- if(S_OK == UnpackPacket(p, pData + i, j-i)) {
+ if (S_OK == UnpackPacket(p, pData + i, j-i)) {
//if(p->TrackNumber == 1)
//TRACE(_T("[%d]: %d, %I64d -> %I64d (skip=%d, disc=%d, sync=%d)\n"),
// (int)p->TrackNumber, p->GetCount(), p->rtStart, p->rtStop,
// (int)m_fSkip, (int)p->bDiscontinuity, (int)p->bSyncPoint);
- if(p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60) {
+ if (p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60) {
CAutoLock csAutoLock(&m_csPackets);
m_rtLast = p->rtStop;
p->fSkip = m_fSkip;
- if(len < 255) {
+ if (len < 255) {
m_packets.AddTail(p);
} else {
m_lastpacket = p;
@@ -761,7 +761,7 @@ CAutoPtr<OggPacket> COggSplitterOutputPin::GetPacket() {
CAutoPtr<OggPacket> p;
CAutoLock csAutoLock(&m_csPackets);
- if(m_packets.GetCount()) {
+ if (m_packets.GetCount()) {
p = m_packets.RemoveHead();
}
return p;
@@ -824,16 +824,16 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page) {
HRESULT hr = __super::UnpackPage(page);
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
Packet* p = m_packets.GetHead();
- if(p->GetCount() >= 6 && p->GetAt(0) == 0x05) {
+ if (p->GetCount() >= 6 && p->GetAt(0) == 0x05) {
// yeah, right, we are going to be parsing this backwards! :P
bitstream bs(p->GetData(), p->GetCount(), true);
- while(bs.hasbits(-1) && bs.getbits(-1) != 1) {
+ while (bs.hasbits(-1) && bs.getbits(-1) != 1) {
;
}
- for(int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++) {
+ for (int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++) {
unsigned int modes = bs.showbits(-6) + 1;
unsigned int mapping = bs.getbits(-8);
@@ -842,7 +842,7 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page) unsigned int blockflag = bs.getbits(-1);
UNUSED_ALWAYS(mapping);
- if(transformtype != 0 || windowtype != 0) {
+ if (transformtype != 0 || windowtype != 0) {
ASSERT(modes == cnt);
UNREFERENCED_PARAMETER(modes);
break;
@@ -853,7 +853,7 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page) }
int cnt = m_initpackets.GetCount();
- if(cnt <= 3 && (p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2)) {
+ if (cnt <= 3 && (p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2)) {
VORBISFORMAT2* vf2 = (VORBISFORMAT2*)m_mts[0].Format();
vf2->HeaderSize[cnt] = p->GetCount();
int len = m_mts[0].FormatLength();
@@ -874,16 +874,16 @@ REFERENCE_TIME COggVorbisOutputPin::GetRefTime(__int64 granule_position) HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(len > 0 && m_blockflags.GetCount()) {
+ if (len > 0 && m_blockflags.GetCount()) {
bitstream bs(pData, len);
- if(bs.getbits(1) == 0) {
+ if (bs.getbits(1) == 0) {
int x = m_blockflags.GetCount()-1, n = 0;
- while(x) {
+ while (x) {
n++;
x >>= 1;
}
DWORD blocksize = m_blocksize[m_blockflags[bs.getbits(n)]?1:0];
- if(m_lastblocksize) {
+ if (m_lastblocksize) {
m_rtLast += GetRefTime((m_lastblocksize + blocksize) >> 2);
}
m_lastblocksize = blocksize;
@@ -900,7 +900,7 @@ HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i HRESULT COggVorbisOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0)&1)) {
+ if (p->GetCount() > 0 && (p->GetAt(0)&1)) {
return S_OK;
}
@@ -913,9 +913,9 @@ HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_ m_lastblocksize = 0;
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis) {
+ if (m_mt.subtype == MEDIASUBTYPE_Vorbis) {
POSITION pos = m_initpackets.GetHeadPosition();
- while(pos) {
+ while (pos) {
Packet* pi = m_initpackets.GetNext(pos);
CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
@@ -941,7 +941,7 @@ COggFlacOutputPin::COggFlacOutputPin(BYTE* h, int nCount, LPCWSTR pName, CBaseFi Buffer.BitRead(1); // Last-metadata-block flag
if (Buffer.BitRead(7) != 0) { // Should be a STREAMINFO block
- if(phr) {
+ if (phr) {
*phr = VFW_E_INVALID_FILE_FORMAT;
}
return;
@@ -999,7 +999,7 @@ HRESULT COggFlacOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int HRESULT COggFlacOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0)&1)) {
+ if (p->GetCount() > 0 && (p->GetAt(0)&1)) {
return S_OK;
}
@@ -1012,9 +1012,9 @@ HRESULT COggFlacOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TI m_lastblocksize = 0;
- if(m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED) {
+ if (m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED) {
POSITION pos = m_initpackets.GetHeadPosition();
- while(pos) {
+ while (pos) {
Packet* pi = m_initpackets.GetNext(pos);
CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
@@ -1038,7 +1038,7 @@ COggDirectShowOutputPin::COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pNa memcpy((AM_MEDIA_TYPE*)&mt, pmt, FIELD_OFFSET(AM_MEDIA_TYPE, pUnk));
mt.SetFormat((BYTE*)(pmt+1), pmt->cbFormat);
mt.SetSampleSize(1);
- if(mt.majortype == MEDIATYPE_Video) { // TODO: find samples for audio and find out what to return in GetRefTime...
+ if (mt.majortype == MEDIATYPE_Video) { // TODO: find samples for audio and find out what to return in GetRefTime...
m_mts.Add(mt);
}
}
@@ -1047,9 +1047,9 @@ REFERENCE_TIME COggDirectShowOutputPin::GetRefTime(__int64 granule_position) {
REFERENCE_TIME rt = 0;
- if(m_mt.majortype == MEDIATYPE_Video) {
+ if (m_mt.majortype == MEDIATYPE_Video) {
rt = granule_position * ((VIDEOINFOHEADER*)m_mt.Format())->AvgTimePerFrame;
- } else if(m_mt.majortype == MEDIATYPE_Audio) {
+ } else if (m_mt.majortype == MEDIATYPE_Audio) {
rt = granule_position; // ((WAVEFORMATEX*)m_mt.Format())-> // TODO
}
@@ -1062,15 +1062,15 @@ HRESULT COggDirectShowOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pDat BYTE hdr = pData[i++];
- if(!(hdr&1)) {
+ if (!(hdr&1)) {
// TODO: verify if this was still present in the old format (haven't found one sample yet)
BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
__int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++) {
+ for (int j = 0; j < nLenBytes; j++) {
Length |= (__int64)pData[i++] << (j << 3);
}
- if(len < i) {
+ if (len < i) {
ASSERT(0);
return E_FAIL;
}
@@ -1109,14 +1109,14 @@ HRESULT COggStreamOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i BYTE hdr = pData[i++];
- if(!(hdr&1)) {
+ if (!(hdr&1)) {
BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
__int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++) {
+ for (int j = 0; j < nLenBytes; j++) {
Length |= (__int64)pData[i++] << (j << 3);
}
- if(len < i) {
+ if (len < i) {
ASSERT(0);
return E_FAIL;
}
@@ -1154,7 +1154,7 @@ COggVideoOutputPin::COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseF pvih->bmiHeader.biHeight = h->v.h;
pvih->bmiHeader.biBitCount = (WORD)h->bps;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
- switch(pvih->bmiHeader.biCompression) {
+ switch (pvih->bmiHeader.biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -1239,7 +1239,7 @@ COggTheoraOutputPin::COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pF vih->hdr.bmiHeader.biBitCount = 24;
m_nFpsNum = (p[22]<<24)|(p[23]<<16)|(p[24]<<8)|p[25];
m_nFpsDenum = (p[26]<<24)|(p[27]<<16)|(p[28]<<8)|p[29];
- if(m_nFpsNum) {
+ if (m_nFpsNum) {
m_rtAvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * m_nFpsDenum / m_nFpsNum);
vih->hdr.AvgTimePerFrame = m_rtAvgTimePerFrame;
}
@@ -1261,7 +1261,7 @@ HRESULT COggTheoraOutputPin::UnpackInitPage(OggPage& page) {
HRESULT hr = __super::UnpackPage(page);
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
Packet* p = m_packets.GetHead();
CMediaType& mt = m_mts[0];
@@ -1300,7 +1300,7 @@ REFERENCE_TIME COggTheoraOutputPin::GetRefTime(__int64 granule_position) HRESULT COggTheoraOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(!pData) {
+ if (!pData) {
return E_FAIL;
}
@@ -1309,7 +1309,7 @@ HRESULT COggTheoraOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i p->rtStop = m_rtLast+1;
p->SetData(pData, len);
- if(!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video) {
+ if (!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video) {
p->rtStop = p->rtStart + ((MPEG2VIDEOINFO*)m_mt.Format())->hdr.AvgTimePerFrame;
}
diff --git a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp index aeb975c10..0329135d6 100644 --- a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp +++ b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp @@ -38,7 +38,7 @@ template<typename T> static void bswap(T& var)
{
BYTE* s = (BYTE*)&var;
- for(BYTE* d = s + sizeof(var)-1; s < d; s++, d--) {
+ for (BYTE* d = s + sizeof(var)-1; s < d; s++, d--) {
*s ^= *d, *d ^= *s, *s ^= *d;
}
}
@@ -193,7 +193,7 @@ STDMETHODIMP CRealMediaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo) wcscpy(pInfo->achName, RMSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -206,7 +206,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) {
DWORD dw;
- if(FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.') {
+ if (FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.') {
return E_FAIL;
}
}
@@ -216,10 +216,10 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CRMFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -230,12 +230,12 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_rtStop = 10000i64*m_pFile->m_p.tDuration;
POSITION pos = m_pFile->m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
MediaProperies* pmp = m_pFile->m_mps.GetNext(pos);
CStringW name;
name.Format(L"Output %02d", pmp->stream);
- if(!pmp->name.IsEmpty()) {
+ if (!pmp->name.IsEmpty()) {
name += L" (" + CStringW(pmp->name) + L")";
}
@@ -244,7 +244,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CMediaType mt;
mt.SetSampleSize(max(pmp->maxPacketSize*16/**/, 1));
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
mt.majortype = MEDIATYPE_Video;
mt.formattype = FORMAT_VideoInfo;
@@ -259,7 +259,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) ASSERT(rvi.fcc1 == 'ODIV');
mt.subtype = FOURCCMap(rvi.fcc2);
- if(rvi.fps > 0x10000) {
+ if (rvi.fps > 0x10000) {
pvih->AvgTimePerFrame = REFERENCE_TIME(10000000i64 / ((float)rvi.fps/0x10000));
}
pvih->dwBitRate = pmp->avgBitRate;
@@ -273,7 +273,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
- if(pmp->width > 0 && pmp->height > 0) {
+ if (pmp->width > 0 && pmp->height > 0) {
BITMAPINFOHEADER bmi = pvih->bmiHeader;
mt.formattype = FORMAT_VideoInfo2;
VIDEOINFOHEADER2* pvih2 = (VIDEOINFOHEADER2*)mt.ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2) + pmp->typeSpecData.GetCount());
@@ -287,7 +287,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.InsertAt(0, mt);
}
- } else if(pmp->mime == "audio/x-pn-realaudio") {
+ } else if (pmp->mime == "audio/x-pn-realaudio") {
mt.majortype = MEDIATYPE_Audio;
mt.formattype = FORMAT_WaveFormatEx;
mt.bTemporalCompression = 1;
@@ -305,8 +305,8 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) fccstr[4] = 0;
BYTE* fmt = pmp->typeSpecData.GetData();
- for(size_t i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++) {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
+ for (size_t i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++) {
+ if (fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
break;
}
}
@@ -316,7 +316,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) BYTE* extra = NULL;
- if(rai.version2 == 4) {
+ if (rai.version2 == 4) {
rainfo4 rai4 = *(rainfo4*)fmt;
rai4.bswap();
pwfe->nChannels = rai4.channels;
@@ -328,11 +328,11 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) p += len;
len = *p++;
ASSERT(len == 4);
- if(len == 4) {
+ if (len == 4) {
fcc = MAKEFOURCC(p[0],p[1],p[2],p[3]);
}
extra = p + len + 3;
- } else if(rai.version2 == 5) {
+ } else if (rai.version2 == 5) {
rainfo5 rai5 = *(rainfo5*)fmt;
rai5.bswap();
pwfe->nChannels = rai5.channels;
@@ -351,7 +351,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bswap(fcc);
- switch(fcc) {
+ switch (fcc) {
case '14_4':
pwfe->wFormatTag = WAVE_FORMAT_14_4;
break;
@@ -378,19 +378,19 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) break;
}
- if(pwfe->wFormatTag) {
+ if (pwfe->wFormatTag) {
mts.Add(mt);
- if(fcc == 'DNET') {
+ if (fcc == 'DNET') {
mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3);
mts.InsertAt(0, mt);
- } else if(fcc == 'RAAC' || fcc == 'RACP') {
+ } else if (fcc == 'RAAC' || fcc == 'RACP') {
mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_AAC);
int extralen = *(DWORD*)extra;
extra += 4;
::bswap(extralen);
ASSERT(*extra == 2); // always 2? why? what does it mean?
- if(*extra == 2) {
+ if (*extra == 2) {
extra++;
extralen--;
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + extralen);
@@ -403,7 +403,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.InsertAt(0, mt);
}
}
- } else if(pmp->mime == "logical-fileinfo") {
+ } else if (pmp->mime == "logical-fileinfo") {
CAtlMap<CStringA, CStringA, CStringElementTraits<CStringA> > lfi;
CStringA key, value;
@@ -415,19 +415,19 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) bswap(cnt);
p += 4;
- if(cnt > 0xffff) { // different format?
+ if (cnt > 0xffff) { // different format?
p += 2;
cnt = p <= end-4 ? *(DWORD*)p : 0;
bswap(cnt);
p += 4;
}
- while(p < end-4 && cnt-- > 0) {
+ while (p < end-4 && cnt-- > 0) {
BYTE* base = p;
DWORD len = *(DWORD*)p;
bswap(len);
p += 4;
- if(base + len > end) {
+ if (base + len > end) {
break;
}
@@ -452,20 +452,20 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
POSITION pos = lfi.GetStartPosition();
- while(pos) {
+ while (pos) {
lfi.GetNextAssoc(pos, key, value);
int n = 0;
- if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
+ if (key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
&& (n = strtol(key.Mid(7), NULL, 10)) > 0) {
int h, m, s, ms;
char c;
- if(7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
+ if (7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
continue;
}
key.Format("CHAPTER%02dNAME", n);
- if(!lfi.Lookup(key, value) || value.IsEmpty()) {
+ if (!lfi.Lookup(key, value) || value.IsEmpty()) {
value.Format("Chapter %d", n);
}
@@ -476,7 +476,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("Unsupported RealMedia stream (%d): %s\n"), pmp->stream, CString(pmp->mime));
continue;
}
@@ -484,20 +484,20 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr;
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
- if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut))) {
- if(!m_rtStop) {
+ if (SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut))) {
+ if (!m_rtStop) {
m_pFile->m_p.tDuration = max(m_pFile->m_p.tDuration, pmp->tDuration);
}
}
}
pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos; stream++) {
+ for (DWORD stream = 0; pos; stream++) {
CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
CStringW name;
name.Format(L"Subtitle %02d", stream);
- if(!s.name.IsEmpty()) {
+ if (!s.name.IsEmpty()) {
name += L" (" + CStringW(CString(s.name)) + L")";
}
@@ -528,13 +528,13 @@ bool CRealMediaSplitterFilter::DemuxInit() {
SetThreadName((DWORD)-1, "CRealMediaSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
// reindex if needed
- if(m_pFile->m_irs.GetCount() == 0) {
+ if (m_pFile->m_irs.GetCount() == 0) {
m_nOpenProgress = 0;
m_rtDuration = 0;
@@ -544,24 +544,24 @@ bool CRealMediaSplitterFilter::DemuxInit() UINT32 nPacket = 0;
POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos && !m_fAbort) {
+ while (pos && !m_fAbort) {
DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
m_pFile->Seek(pdc->pos);
- for(UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++) {
+ for (UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++) {
UINT64 filepos = m_pFile->GetPos();
HRESULT hr;
MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph, false))) {
+ if (S_OK != (hr = m_pFile->Read(mph, false))) {
break;
}
m_rtDuration = max((__int64)(10000i64*mph.tStart), m_rtDuration);
- if(mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart) {
+ if (mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart) {
CAutoPtr<IndexRecord> pir(DNew IndexRecord);
pir->tStart = mph.tStart;
pir->ptrFilePos = (UINT32)filepos;
@@ -574,8 +574,8 @@ bool CRealMediaSplitterFilter::DemuxInit() m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
@@ -586,7 +586,7 @@ bool CRealMediaSplitterFilter::DemuxInit() m_nOpenProgress = 100;
- if(m_fAbort) {
+ if (m_fAbort) {
m_pFile->m_irs.RemoveAll();
}
@@ -602,7 +602,7 @@ bool CRealMediaSplitterFilter::DemuxInit() void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0) {
+ if (rt <= 0) {
m_seekpos = m_pFile->m_dcs.GetHeadPosition();
m_seekpacket = 0;
m_seekfilepos = m_pFile->m_dcs.GetHead()->pos;
@@ -610,23 +610,23 @@ void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) m_seekpos = NULL;
POSITION pos = m_pFile->m_irs.GetTailPosition();
- while(pos && !m_seekpos) {
+ while (pos && !m_seekpos) {
IndexRecord* pir = m_pFile->m_irs.GetPrev(pos);
- if(pir->tStart <= rt/10000) {
+ if (pir->tStart <= rt/10000) {
m_seekpacket = pir->packet;
pos = m_pFile->m_dcs.GetTailPosition();
- while(pos && !m_seekpos) {
+ while (pos && !m_seekpos) {
POSITION tmp = pos;
DataChunk* pdc = m_pFile->m_dcs.GetPrev(pos);
- if(pdc->pos <= pir->ptrFilePos) {
+ if (pdc->pos <= pir->ptrFilePos) {
m_seekpos = tmp;
m_seekfilepos = pir->ptrFilePos;
POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos != m_seekpos) {
+ while (pos != m_seekpos) {
m_seekpacket -= m_pFile->m_dcs.GetNext(pos)->nPackets;
}
}
@@ -669,7 +669,7 @@ void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) }
}
- if(!m_seekpos) {
+ if (!m_seekpos) {
m_seekpos = m_pFile->m_dcs.GetHeadPosition();
m_seekpacket = 0;
m_seekfilepos = m_pFile->m_dcs.GetAt(m_seekpos)->pos;
@@ -683,7 +683,7 @@ bool CRealMediaSplitterFilter::DemuxLoop() POSITION pos;
pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++) {
+ for (DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++) {
CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet);
@@ -717,14 +717,14 @@ bool CRealMediaSplitterFilter::DemuxLoop() }
pos = m_seekpos;
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
m_pFile->Seek(m_seekfilepos > 0 ? m_seekfilepos : pdc->pos);
- for(UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++) {
+ for (UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++) {
MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph))) {
+ if (S_OK != (hr = m_pFile->Read(mph))) {
break;
}
@@ -748,7 +748,7 @@ bool CRealMediaSplitterFilter::DemuxLoop() STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
nKFs = m_pFile->m_irs.GetCount();
@@ -760,16 +760,16 @@ STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFEREN CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
POSITION pos = m_pFile->m_irs.GetHeadPosition();
- for(int i = 0; pos && nKFsTmp < nKFs; i++) {
+ for (int i = 0; pos && nKFsTmp < nKFs; i++) {
pKFs[nKFsTmp++] = 10000i64*m_pFile->m_irs.GetNext(pos)->tStart;
}
nKFs = nKFsTmp;
@@ -804,7 +804,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() {
HRESULT hr;
- if(m_segments.GetCount() == 0) {
+ if (m_segments.GetCount() == 0) {
m_segments.Clear();
return S_OK;
}
@@ -819,7 +819,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() DWORD len = 0, total = 0;
POSITION pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
segment* s = m_segments.GetNext(pos);
len = max(len, s->offset + s->data.GetCount());
total += s->data.GetCount();
@@ -833,14 +833,14 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() *pData++ = m_segments.fMerged ? 0 : m_segments.GetCount()-1;
- if(m_segments.fMerged) {
+ if (m_segments.fMerged) {
*((DWORD*)pData) = 1;
pData += 4;
*((DWORD*)pData) = 0;
pData += 4;
} else {
pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
*((DWORD*)pData) = 1;
pData += 4;
*((DWORD*)pData) = m_segments.GetNext(pos)->offset;
@@ -849,7 +849,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() }
pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
segment* s = m_segments.GetNext(pos);
memcpy(pData + s->offset, s->data.GetData(), s->data.GetCount());
}
@@ -867,15 +867,15 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) ASSERT(p->rtStart < p->rtStop);
- if(m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
+ if (m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
WORD* s = (WORD*)p->GetData();
WORD* e = s + p->GetCount()/2;
- while(s < e) {
+ while (s < e) {
bswap(*s++);
}
}
- if(m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ if (m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
|| m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40
|| m_mt.subtype == MEDIASUBTYPE_RV41) {
CAutoLock cAutoLock(&m_csQueue);
@@ -884,27 +884,27 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) BYTE* pIn = p->GetData();
BYTE* pInOrg = pIn;
- if(m_segments.rtStart != p->rtStart) {
- if(S_OK != (hr = DeliverSegments())) {
+ if (m_segments.rtStart != p->rtStart) {
+ if (S_OK != (hr = DeliverSegments())) {
return hr;
}
}
- if(!m_segments.fDiscontinuity && p->bDiscontinuity) {
+ if (!m_segments.fDiscontinuity && p->bDiscontinuity) {
m_segments.fDiscontinuity = true;
}
m_segments.fSyncPoint = !!p->bSyncPoint;
m_segments.rtStart = p->rtStart;
- while(pIn - pInOrg < len) {
+ while (pIn - pInOrg < len) {
BYTE hdr = *pIn++;
DWORD packetlen = 0, packetoffset = 0;
- if((hdr&0xc0) == 0x40) {
+ if ((hdr&0xc0) == 0x40) {
pIn++;
packetlen = len - (pIn - pInOrg);
} else {
- if((hdr&0x40) == 0) {
+ if ((hdr&0x40) == 0) {
pIn++; //BYTE subseq = (*pIn++)&0x7f;
}
@@ -913,10 +913,10 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) var = (var<<8)|(*pIn++); \
GetWORD(packetlen);
- if(packetlen&0x8000) {
+ if (packetlen&0x8000) {
m_segments.fMerged = true;
}
- if((packetlen&0x4000) == 0) {
+ if ((packetlen&0x4000) == 0) {
GetWORD(packetlen);
packetlen &= 0x3fffffff;
} else {
@@ -924,7 +924,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) }
GetWORD(packetoffset);
- if((packetoffset&0x4000) == 0) {
+ if ((packetoffset&0x4000) == 0) {
GetWORD(packetoffset);
packetoffset &= 0x3fffffff;
} else {
@@ -933,9 +933,9 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) #undef GetWORD
- if((hdr&0xc0) == 0xc0) {
+ if ((hdr&0xc0) == 0xc0) {
m_segments.rtStart = 10000i64*packetoffset - m_rtStart, packetoffset = 0;
- } else if((hdr&0xc0) == 0x80) {
+ } else if ((hdr&0xc0) == 0x80) {
packetoffset = packetlen - packetoffset;
}
@@ -952,14 +952,14 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) pIn += len2;
- if((hdr&0x80) || packetoffset+len2 >= packetlen) {
- if(S_OK != (hr = DeliverSegments())) {
+ if ((hdr&0x80) || packetoffset+len2 >= packetlen) {
+ if (S_OK != (hr = DeliverSegments())) {
return hr;
}
}
}
- } else if(m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
- || m_mt.subtype == MEDIASUBTYPE_AAC) {
+ } else if (m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
+ || m_mt.subtype == MEDIASUBTYPE_AAC) {
BYTE* ptr = p->GetData()+2;
CAtlList<WORD> sizes;
@@ -967,7 +967,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) int remaining = p->GetCount()-2;
int expected = *(ptr-1)>>4;
- while(total < remaining) {
+ while (total < remaining) {
int size = (ptr[0]<<8)|(ptr[1]);
sizes.AddTail(size);
total += size;
@@ -985,7 +985,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) BOOL bDiscontinuity = p->bDiscontinuity;
POSITION pos = sizes.GetHeadPosition();
- while(pos) {
+ while (pos) {
WORD size = sizes.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet);
@@ -996,7 +996,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) p->SetData(ptr, size);
ptr += size;
bDiscontinuity = false;
- if(S_OK != (hr = __super::DeliverPacket(p))) {
+ if (S_OK != (hr = __super::DeliverPacket(p))) {
break;
}
}
@@ -1025,7 +1025,7 @@ CRealMediaSourceFilter::CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr) CRMFile::CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -1043,7 +1043,7 @@ HRESULT CRMFile::Read(ChunkHdr& hdr) {
memset(&hdr, 0, sizeof(hdr));
HRESULT hr;
- if(S_OK != (hr = Read(hdr.object_id))
+ if (S_OK != (hr = Read(hdr.object_id))
|| S_OK != (hr = Read(hdr.size))
|| S_OK != (hr = Read(hdr.object_version))) {
return hr;
@@ -1059,15 +1059,15 @@ HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull) HRESULT hr;
UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) {
+ if (S_OK != (hr = Read(object_version))) {
return hr;
}
- if(object_version != 0 && object_version != 1) {
+ if (object_version != 0 && object_version != 1) {
return S_OK;
}
UINT8 flags;
- if(S_OK != (hr = Read(mph.len))
+ if (S_OK != (hr = Read(mph.len))
|| S_OK != (hr = Read(mph.stream))
|| S_OK != (hr = Read(mph.tStart))
|| S_OK != (hr = Read(mph.reserved))
@@ -1083,9 +1083,9 @@ HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull) ASSERT(len >= 0);
len = max(len, 0);
- if(fFull) {
+ if (fFull) {
mph.pData.SetCount(len);
- if(mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len))) {
+ if (mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len))) {
return hr;
}
} else {
@@ -1104,148 +1104,148 @@ HRESULT CRMFile::Init() HRESULT hr;
ChunkHdr hdr;
- while(GetRemaining() && S_OK == (hr = Read(hdr))) {
+ while (GetRemaining() && S_OK == (hr = Read(hdr))) {
__int64 pos = GetPos() - sizeof(hdr);
- if(fFirstChunk && hdr.object_id != '.RMF') {
+ if (fFirstChunk && hdr.object_id != '.RMF') {
return E_FAIL;
}
fFirstChunk = false;
- if(pos + hdr.size > GetLength() && hdr.object_id != 'DATA') { // truncated?
+ if (pos + hdr.size > GetLength() && hdr.object_id != 'DATA') { // truncated?
break;
}
- if(hdr.object_id == 0x2E7261FD) { // '.ra+0xFD'
+ if (hdr.object_id == 0x2E7261FD) { // '.ra+0xFD'
return E_FAIL;
}
- if(hdr.object_version == 0) {
- switch(hdr.object_id) {
+ if (hdr.object_version == 0) {
+ switch (hdr.object_id) {
case '.RMF':
- if(S_OK != (hr = Read(m_fh.version))) {
+ if (S_OK != (hr = Read(m_fh.version))) {
return hr;
}
- if(hdr.size == 0x10) {
+ if (hdr.size == 0x10) {
WORD w = 0;
- if(S_OK != (hr = Read(w))) {
+ if (S_OK != (hr = Read(w))) {
return hr;
}
m_fh.nHeaders = w;
- } else if(S_OK != (hr = Read(m_fh.nHeaders))) {
+ } else if (S_OK != (hr = Read(m_fh.nHeaders))) {
return hr;
}
break;
case 'CONT':
UINT16 slen;
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) {
return hr;
}
break;
case 'PROP':
- if(S_OK != (hr = Read(m_p.maxBitRate))) {
+ if (S_OK != (hr = Read(m_p.maxBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.avgBitRate))) {
+ if (S_OK != (hr = Read(m_p.avgBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.maxPacketSize))) {
+ if (S_OK != (hr = Read(m_p.maxPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.avgPacketSize))) {
+ if (S_OK != (hr = Read(m_p.avgPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.nPackets))) {
+ if (S_OK != (hr = Read(m_p.nPackets))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.tDuration))) {
+ if (S_OK != (hr = Read(m_p.tDuration))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.tPreroll))) {
+ if (S_OK != (hr = Read(m_p.tPreroll))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.ptrIndex))) {
+ if (S_OK != (hr = Read(m_p.ptrIndex))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.ptrData))) {
+ if (S_OK != (hr = Read(m_p.ptrData))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.nStreams))) {
+ if (S_OK != (hr = Read(m_p.nStreams))) {
return hr;
}
UINT16 flags;
- if(S_OK != (hr = Read(flags))) {
+ if (S_OK != (hr = Read(flags))) {
return hr;
}
m_p.flags = (Properies::flags_t)flags;
break;
case 'MDPR': {
CAutoPtr<MediaProperies> mp(DNew MediaProperies);
- if(S_OK != (hr = Read(mp->stream))) {
+ if (S_OK != (hr = Read(mp->stream))) {
return hr;
}
- if(S_OK != (hr = Read(mp->maxBitRate))) {
+ if (S_OK != (hr = Read(mp->maxBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(mp->avgBitRate))) {
+ if (S_OK != (hr = Read(mp->avgBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(mp->maxPacketSize))) {
+ if (S_OK != (hr = Read(mp->maxPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(mp->avgPacketSize))) {
+ if (S_OK != (hr = Read(mp->avgPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tStart))) {
+ if (S_OK != (hr = Read(mp->tStart))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tPreroll))) {
+ if (S_OK != (hr = Read(mp->tPreroll))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tDuration))) {
+ if (S_OK != (hr = Read(mp->tDuration))) {
return hr;
}
UINT8 slen;
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) {
return hr;
}
UINT32 tsdlen;
- if(S_OK != (hr = Read(tsdlen))) {
+ if (S_OK != (hr = Read(tsdlen))) {
return hr;
}
mp->typeSpecData.SetCount(tsdlen);
- if(tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) {
+ if (tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) {
return hr;
}
mp->width = mp->height = 0;
@@ -1255,10 +1255,10 @@ HRESULT CRMFile::Init() }
case 'DATA': {
CAutoPtr<DataChunk> dc(DNew DataChunk);
- if(S_OK != (hr = Read(dc->nPackets))) {
+ if (S_OK != (hr = Read(dc->nPackets))) {
return hr;
}
- if(S_OK != (hr = Read(dc->ptrNext))) {
+ if (S_OK != (hr = Read(dc->ptrNext))) {
return hr;
}
dc->pos = GetPos();
@@ -1268,33 +1268,33 @@ HRESULT CRMFile::Init() }
case 'INDX': {
IndexChunkHeader ich;
- if(S_OK != (hr = Read(ich.nIndices))) {
+ if (S_OK != (hr = Read(ich.nIndices))) {
return hr;
}
- if(S_OK != (hr = Read(ich.stream))) {
+ if (S_OK != (hr = Read(ich.stream))) {
return hr;
}
- if(S_OK != (hr = Read(ich.ptrNext))) {
+ if (S_OK != (hr = Read(ich.ptrNext))) {
return hr;
}
int stream = GetMasterStream();
- while(ich.nIndices-- > 0) {
+ while (ich.nIndices-- > 0) {
UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) {
+ if (S_OK != (hr = Read(object_version))) {
return hr;
}
- if(object_version == 0) {
+ if (object_version == 0) {
CAutoPtr<IndexRecord> ir(DNew IndexRecord);
- if(S_OK != (hr = Read(ir->tStart))) {
+ if (S_OK != (hr = Read(ir->tStart))) {
return hr;
}
- if(S_OK != (hr = Read(ir->ptrFilePos))) {
+ if (S_OK != (hr = Read(ir->ptrFilePos))) {
return hr;
}
- if(S_OK != (hr = Read(ir->packet))) {
+ if (S_OK != (hr = Read(ir->packet))) {
return hr;
}
- if(ich.stream == stream) {
+ if (ich.stream == stream) {
m_irs.AddTail(ir);
}
}
@@ -1302,17 +1302,17 @@ HRESULT CRMFile::Init() break;
}
case '.SUB':
- if(hdr.size > sizeof(hdr)) {
+ if (hdr.size > sizeof(hdr)) {
int size = hdr.size - sizeof(hdr);
CAutoVectorPtr<char> buff;
- if(!buff.Allocate(size)) {
+ if (!buff.Allocate(size)) {
return E_OUTOFMEMORY;
}
char* p = buff;
- if(S_OK != (hr = ByteRead((BYTE*)p, size))) {
+ if (S_OK != (hr = ByteRead((BYTE*)p, size))) {
return hr;
}
- for(char* end = p + size; p < end; ) {
+ for (char* end = p + size; p < end; ) {
subtitle s;
s.name = p;
p += s.name.GetLength()+1;
@@ -1327,7 +1327,7 @@ HRESULT CRMFile::Init() }
}
- if(hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA') {
+ if (hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA') {
hdr.size = GetPos() - pos;
}
@@ -1336,7 +1336,7 @@ HRESULT CRMFile::Init() || GetPos() == pos + sizeof(hdr));
pos += hdr.size;
- if(pos > GetPos()) {
+ if (pos > GetPos()) {
Seek(pos);
}
}
@@ -1352,7 +1352,7 @@ unsigned int GetBits2(int n, unsigned char*& p, unsigned int& bit_offset, unsign bit_offset += n;
bit_buffer <<= n;
- if(bit_offset > (32-16)) {
+ if (bit_offset > (32-16)) {
p += bit_offset >> 3;
bit_offset &= 7;
bit_buffer = (unsigned int)p[0] << 24;
@@ -1382,25 +1382,25 @@ void GetDimensions(unsigned char* p, unsigned int* wi, unsigned int* hi) GetBits(13);
w = cw[GetBits(3)];
- if(w == 0) {
+ if (w == 0) {
do {
c = GetBits(8);
w += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
c = GetBits(3);
h = ch1[c];
- if(h == 0) {
+ if (h == 0) {
c = ((c << 1) | GetBits(1)) & 3;
h = ch2[c];
- if(h == 0) {
+ if (h == 0) {
do {
c = GetBits(8);
h += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
}
@@ -1451,25 +1451,25 @@ void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi, GetBits(16);
w = cw[GetBits(3)];
- if(w == 0) {
+ if (w == 0) {
do {
c = GetBits(8);
w += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
c = GetBits(3);
h = ch1[c];
- if(h == 0) {
+ if (h == 0) {
c = ((c << 1) | GetBits(1)) & 3;
h = ch2[c];
- if(h == 0) {
+ if (h == 0) {
do {
c = GetBits(8);
h += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
}
@@ -1480,23 +1480,23 @@ void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi, void CRMFile::GetDimensions()
{
POSITION pos = m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
UINT64 filepos = GetPos();
MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
pmp->width = pmp->height = 0;
rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
rvi.bswap();
- if(rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR') {
+ if (rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR') {
continue;
}
MediaPacketHeader mph;
- while(S_OK == Read(mph)) {
- if(mph.stream != pmp->stream || mph.len == 0
+ while (S_OK == Read(mph)) {
+ if (mph.stream != pmp->stream || mph.len == 0
|| !(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG)) {
continue;
}
@@ -1508,10 +1508,10 @@ void CRMFile::GetDimensions() BYTE hdr = *p++;
DWORD packetlen = 0, packetoffset = 0;
- if((hdr&0xc0) == 0x40) {
+ if ((hdr&0xc0) == 0x40) {
packetlen = len - (++p - p0);
} else {
- if((hdr&0x40) == 0) {
+ if ((hdr&0x40) == 0) {
p++;
}
@@ -1520,7 +1520,7 @@ void CRMFile::GetDimensions() var = (var<<8)|(*p++); \
GetWORD(packetlen);
- if((packetlen&0x4000) == 0) {
+ if ((packetlen&0x4000) == 0) {
GetWORD(packetlen);
packetlen &= 0x3fffffff;
} else {
@@ -1528,7 +1528,7 @@ void CRMFile::GetDimensions() }
GetWORD(packetoffset);
- if((packetoffset&0x4000) == 0) {
+ if ((packetoffset&0x4000) == 0) {
GetWORD(packetoffset);
packetoffset &= 0x3fffffff;
} else {
@@ -1537,9 +1537,9 @@ void CRMFile::GetDimensions() #undef GetWORD
- if((hdr&0xc0) == 0xc0) {
+ if ((hdr&0xc0) == 0xc0) {
packetoffset = 0;
- } else if((hdr&0xc0) == 0x80) {
+ } else if ((hdr&0xc0) == 0x80) {
packetoffset = packetlen - packetoffset;
}
@@ -1548,15 +1548,15 @@ void CRMFile::GetDimensions() len = min(len - (p - p0), packetlen - packetoffset);
- if(len > 0) {
+ if (len > 0) {
bool repeat_field;
- if(rvi.fcc2 == '14VR') {
+ if (rvi.fcc2 == '14VR') {
::GetDimensions_X10(p, &pmp->width, &pmp->height, &pmp->interlaced, &pmp->top_field_first, &repeat_field);
} else {
::GetDimensions(p, &pmp->width, &pmp->height);
}
- if(rvi.w == pmp->width && rvi.h == pmp->height) {
+ if (rvi.w == pmp->width && rvi.h == pmp->height) {
pmp->width = pmp->height = 0;
}
@@ -1574,17 +1574,17 @@ int CRMFile::GetMasterStream() int s1 = -1, s2 = -1;
POSITION pos = m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
s1 = pmp->stream;
break;
- } else if(pmp->mime == "audio/x-pn-realaudio" && s2 == -1) {
+ } else if (pmp->mime == "audio/x-pn-realaudio" && s2 == -1) {
s2 = pmp->stream;
}
}
- if(s1 == -1) {
+ if (s1 == -1) {
s1 = s2;
}
@@ -1608,7 +1608,7 @@ CRealVideoDecoder::CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr) CRealVideoDecoder::~CRealVideoDecoder()
{
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
}
}
@@ -1630,16 +1630,16 @@ HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt) {11, rvi.w, rvi.h, 0, 0, rvi.type1, 1, rvi.type2};
#pragma pack(pop)
- if(FAILED(hr = RVInit(&i, &m_dwCookie))) {
+ if (FAILED(hr = RVInit(&i, &m_dwCookie))) {
return hr;
}
- if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002) {
+ if (rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002) {
int nWidthHeight = (1+((rvi.type1>>16)&7));
UINT32* pWH = DNew UINT32[nWidthHeight*2];
pWH[0] = rvi.w;
pWH[1] = rvi.h;
- for(int i = 2; i < nWidthHeight*2; i++) {
+ for (int i = 2; i < nWidthHeight*2; i++) {
pWH[i] = rvi.morewh[i-2]*4;
}
#pragma pack(push, 1)
@@ -1659,7 +1659,7 @@ HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt) void CRealVideoDecoder::FreeRV()
{
- if(m_dwCookie) {
+ if (m_dwCookie) {
RVFree(m_dwCookie);
m_dwCookie = 0;
}
@@ -1672,12 +1672,12 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) HRESULT hr;
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
long len = pIn->GetActualDataLength();
- if(len <= 0) {
+ if (len <= 0) {
return S_OK; // nothing to do
}
@@ -1703,7 +1703,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) pDataIn += offset;
- if(m_fDropFrames && m_timestamp+1 == transform_in.timestamp) {
+ if (m_fDropFrames && m_timestamp+1 == transform_in.timestamp) {
m_timestamp = transform_in.timestamp;
return S_OK;
}
@@ -1714,7 +1714,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) ::GetDimensions_X10(pDataIn, &tmp1, &tmp2, &interlaced, &tmp3, &tmp4);
int size = tmp1*tmp2;
- if( m_lastBuffSizeDim < size ) {
+ if ( m_lastBuffSizeDim < size ) {
_aligned_free(m_pI420);
_aligned_free(m_pI420Tmp);
@@ -1748,19 +1748,19 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) m_timestamp = transform_in.timestamp;
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("RV returned an error code!!!\n"));
ASSERT(!(transform_out.unk1&1)); // error allowed when the "render" flag is not set
// return hr;
}
- if(pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1)) {
+ if (pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1)) {
return S_OK;
}
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
+ if (/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
&& */ FAILED(hr = GetDeliveryBuffer(m_w, m_h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
@@ -1768,7 +1768,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) BYTE* pI420[3] = {m_pI420, m_pI420Tmp, NULL};
- if(interlaced) {
+ if (interlaced) {
int size = m_w*m_h;
DeinterlaceBlend(pI420[1], pI420[0], m_w, m_h, m_w, m_w);
DeinterlaceBlend(pI420[1]+size, pI420[0]+size, m_w/2, m_h/2, m_w/2, m_w/2);
@@ -1776,10 +1776,10 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn) pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
}
- if(transform_out.w != m_w || transform_out.h != m_h) {
+ if (transform_out.w != m_w || transform_out.h != m_h) {
Resize(pI420[0], transform_out.w, transform_out.h, pI420[1], m_w, m_h);
// only one of these can be true, and when it happens the result image must be in the tmp buffer
- if(transform_out.w == m_w || transform_out.h == m_h) {
+ if (transform_out.w == m_w || transform_out.h == m_h) {
pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
}
}
@@ -1803,21 +1803,21 @@ void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD int si = wi*hi, so = wo*ho;
ASSERT(((si*so)&3) == 0);
- if(wi < wo) {
+ if (wi < wo) {
ResizeWidth(pIn, wi, hi, pOut, wo, ho);
ResizeWidth(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
ResizeWidth(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
- if(hi == ho) {
+ if (hi == ho) {
return;
}
ResizeHeight(pOut, wo, hi, pIn, wo, ho);
ResizeHeight(pOut + so, wo/2, hi/2, pIn + so, wo/2, ho/2);
ResizeHeight(pOut + so + so/4, wo/2, hi/2, pIn + so + so/4, wo/2, ho/2);
- } else if(hi < ho) {
+ } else if (hi < ho) {
ResizeHeight(pIn, wi, hi, pOut, wo, ho);
ResizeHeight(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
ResizeHeight(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
- if(wi == wo) {
+ if (wi == wo) {
return;
}
ASSERT(0); // this is uncreachable code, but anyway... looks nice being so symmetric
@@ -1829,8 +1829,8 @@ void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- for(DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo) {
- if(wi == wo) {
+ for (DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo) {
+ if (wi == wo) {
memcpy(pOut, pIn, wo);
} else {
ResizeRow(pIn, wi, 1, pOut, wo, 1);
@@ -1840,10 +1840,10 @@ void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, D void CRealVideoDecoder::ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- if(hi == ho) {
+ if (hi == ho) {
memcpy(pOut, pIn, wo*ho);
} else {
- for(DWORD x = 0; x < wo; x++, pIn++, pOut++) {
+ for (DWORD x = 0; x < wo; x++, pIn++, pOut++) {
ResizeRow(pIn, hi, wo, pOut, ho, wo);
}
}
@@ -1853,8 +1853,8 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW {
ASSERT(wi < wo);
- if(dpo == 1) {
- for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
+ if (dpo == 1) {
+ for (DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
// pOut[i] = pIn[j>>16];
{
BYTE* p = &pIn[j>>16];
@@ -1864,7 +1864,7 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW *pOut = pIn[wi-1];
} else {
- for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
+ for (DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
// *pOut = pIn[dpi*(j>>16)];
{
BYTE* p = &pIn[dpi*(j>>16)];
@@ -1878,7 +1878,7 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Video
+ if (mtIn->majortype != MEDIATYPE_Video
|| mtIn->subtype != MEDIASUBTYPE_RV20
&& mtIn->subtype != MEDIASUBTYPE_RV30
&& mtIn->subtype != MEDIASUBTYPE_RV40
@@ -1886,16 +1886,16 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn) return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(mtIn->formattype == FORMAT_VideoInfo2) {
+ if (mtIn->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mtIn->Format();
- if(vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
+ if (vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
|| vih2->dwPictAspectRatioY < vih2->bmiHeader.biHeight) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
- if(!m_pInput->IsConnected()) {
- if(m_hDrvDll) {
+ if (!m_pInput->IsConnected()) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
m_hDrvDll = NULL;
}
@@ -1912,37 +1912,37 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn) CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
oldpath = buff;
TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
oldpath += '\\';
}
key.Close();
}
len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
newpath = buff;
TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
newpath += '\\';
}
key.Close();
}
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + newdll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + newdll);
}
paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + olddll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + olddll);
}
paths.AddTail(olddll); // default dll paths
@@ -1952,39 +1952,39 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn) if (pos) {
m_hDrvDll = LoadLibrary(paths.GetNext(pos));
}
- } while(pos && !m_hDrvDll);
+ } while (pos && !m_hDrvDll);
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420CustomMessage");
RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV20toYUV420Free");
RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420HiveMessage");
RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV20toYUV420Init");
RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV20toYUV420Transform");
- if(!RVCustomMessage) {
+ if (!RVCustomMessage) {
RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420CustomMessage");
}
- if(!RVFree) {
+ if (!RVFree) {
RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV40toYUV420Free");
}
- if(!RVHiveMessage) {
+ if (!RVHiveMessage) {
RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420HiveMessage");
}
- if(!RVInit) {
+ if (!RVInit) {
RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV40toYUV420Init");
}
- if(!RVTransform) {
+ if (!RVTransform) {
RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV40toYUV420Transform");
}
}
- if(!m_hDrvDll || !RVCustomMessage
+ if (!m_hDrvDll || !RVCustomMessage
|| !RVFree || !RVHiveMessage
|| !RVInit || !RVTransform) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(FAILED(InitRV(mtIn))) {
+ if (FAILED(InitRV(mtIn))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -1994,9 +1994,9 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn) HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(m_pOutput && m_pOutput->IsConnected()) {
+ if (m_pOutput && m_pOutput->IsConnected()) {
BITMAPINFOHEADER bih1, bih2;
- if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ if (ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
&& abs(bih1.biHeight) != abs(bih2.biHeight)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2008,7 +2008,7 @@ HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaTy HRESULT CRealVideoDecoder::StartStreaming()
{
const CMediaType& mt = m_pInput->CurrentMediaType();
- if(FAILED(InitRV(&mt))) {
+ if (FAILED(InitRV(&mt))) {
return E_FAIL;
}
@@ -2050,10 +2050,10 @@ HRESULT CRealVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tSto HRESULT CRealVideoDecoder::AlterQuality(Quality q)
{
- if(q.Late > 500*10000i64) {
+ if (q.Late > 500*10000i64) {
m_fDropFrames = true;
}
- if(q.Late <= 0) {
+ if (q.Late <= 0) {
m_fDropFrames = false;
}
// TRACE(_T("CRealVideoDecoder::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
@@ -2071,7 +2071,7 @@ CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr) , m_hDrvDll(NULL)
, m_dwCookie(0)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -2079,7 +2079,7 @@ CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr) CRealAudioDecoder::~CRealAudioDecoder()
{
// FreeRA();
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
}
}
@@ -2090,7 +2090,7 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) HRESULT hr;
- if(RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
+ if (RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
|| RAOpenCodec && FAILED(hr = RAOpenCodec(&m_dwCookie))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2101,13 +2101,13 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) // cbSize being really sizeof(WAVEFORMATEX) is less than this,
// especially with our rm splitter ;)
DWORD cbSize = pwfe->cbSize;
- if(cbSize == sizeof(WAVEFORMATEX)) {
+ if (cbSize == sizeof(WAVEFORMATEX)) {
ASSERT(0);
cbSize = 0;
}
WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) {
+ if (!wBitsPerSample) {
wBitsPerSample = 16;
}
@@ -2125,21 +2125,21 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) CAutoVectorPtr<BYTE> pBuff;
- if(pmt->subtype == MEDIASUBTYPE_AAC) {
+ if (pmt->subtype == MEDIASUBTYPE_AAC) {
pBuff.Allocate(cbSize+1);
pBuff[0] = 0x02;
memcpy(pBuff+1, pwfe+1, cbSize);
initdata.extralen = cbSize+1;
initdata.extra = pBuff;
} else {
- if(pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) { // must have type_specific_data appended
+ if (pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) { // must have type_specific_data appended
return VFW_E_TYPE_NOT_ACCEPTED;
}
BYTE* fmt = pmt->Format() + sizeof(WAVEFORMATEX) + cbSize;
- for(int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++) {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
+ for (int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++) {
+ if (fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
break;
}
}
@@ -2149,21 +2149,21 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) BYTE* p;
- if(m_rai.version2 == 4) {
+ if (m_rai.version2 == 4) {
p = (BYTE*)((rainfo4*)fmt+1);
int len = *p++;
p += len;
len = *p++;
p += len;
ASSERT(len == 4);
- } else if(m_rai.version2 == 5) {
+ } else if (m_rai.version2 == 5) {
p = (BYTE*)((rainfo5*)fmt+1);
} else {
return VFW_E_TYPE_NOT_ACCEPTED;
}
p += 3;
- if(m_rai.version2 == 5) {
+ if (m_rai.version2 == 5) {
p++;
}
@@ -2173,15 +2173,15 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) initdata.extra = p + 4;
}
- if(FAILED(hr = RAInitDecoder(m_dwCookie, &initdata))) {
+ if (FAILED(hr = RAInitDecoder(m_dwCookie, &initdata))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(RASetPwd) {
+ if (RASetPwd) {
RASetPwd(m_dwCookie, "Ardubancel Quazanga");
}
- if(RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor))) {
+ if (RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2190,7 +2190,7 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt) void CRealAudioDecoder::FreeRA()
{
- if(m_dwCookie) {
+ if (m_dwCookie) {
RAFreeDecoder(m_dwCookie);
RACloseCodec(m_dwCookie);
m_dwCookie = 0;
@@ -2204,19 +2204,19 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA) {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pIn);
}
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
BYTE* pDataInOrg = pDataIn;
UNUSED_ALWAYS(pDataInOrg);
long len = pIn->GetActualDataLength();
- if(len <= 0) {
+ if (len <= 0) {
return S_OK;
}
@@ -2227,7 +2227,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) return S_OK;
*/
- if(S_OK == pIn->IsSyncPoint()) {
+ if (S_OK == pIn->IsSyncPoint()) {
m_bufflen = 0;
m_rtBuffStart = rtStart;
m_fBuffDiscontinuity = pIn->IsDiscontinuity() == S_OK;
@@ -2240,7 +2240,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) int h = m_rai.sub_packet_h;
int sps = m_rai.sub_packet_size;
- if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
+ if (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RACP
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_AAC) {
src = pDataIn;
@@ -2252,17 +2252,17 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) len = w*h;
- if(m_bufflen >= len) {
+ if (m_bufflen >= len) {
ASSERT(m_bufflen == len);
src = m_buff;
dst = m_buff + len;
- if(sps > 0
+ if (sps > 0
&& (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_COOK
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_ATRC)) {
- for(int y = 0; y < h; y++) {
- for(int x = 0, w2 = w / sps; x < w2; x++) {
+ for (int y = 0; y < h; y++) {
+ for (int x = 0, w2 = w / sps; x < w2; x++) {
// TRACE(_T("--- %d, %d\n"), (h*x+((h+1)/2)*(y&1)+(y>>1)), sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
memcpy(dst + sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), src, sps);
src += sps;
@@ -2271,7 +2271,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) src = m_buff + len;
dst = m_buff + len*2;
- } else if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR) {
+ } else if (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR) {
// http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-August/010569.html
static BYTE sipr_swaps[38][2]= {
@@ -2283,19 +2283,19 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) };
int bs=h*w*2/96; // nibbles per subpacket
- for(int n=0; n<38; n++) {
+ for (int n=0; n<38; n++) {
int i=bs*sipr_swaps[n][0];
int o=bs*sipr_swaps[n][1];
// swap nibbles of block 'i' with 'o' TODO: optimize
- for(int j=0; j<bs; j++) {
+ for (int j=0; j<bs; j++) {
int x=(i&1) ? (src[(i>>1)]>>4) : (src[(i>>1)]&15);
int y=(o&1) ? (src[(o>>1)]>>4) : (src[(o>>1)]&15);
- if(o&1) {
+ if (o&1) {
src[(o>>1)]=(src[(o>>1)]&0x0F)|(x<<4);
} else {
src[(o>>1)]=(src[(o>>1)]&0xF0)|x;
}
- if(i&1) {
+ if (i&1) {
src[(i>>1)]=(src[(i>>1)]&0x0F)|(y<<4);
} else {
src[(i>>1)]=(src[(i>>1)]&0xF0)|y;
@@ -2312,16 +2312,16 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) rtStart = m_rtBuffStart;
- for(; src < dst; src += w) {
+ for (; src < dst; src += w) {
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
+ if (FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -2329,7 +2329,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) hr = RADecode(m_dwCookie, src, w, pDataOut, &len, -1);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("RA returned an error code!!!\n"));
continue;
// return hr;
@@ -2350,7 +2350,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
- if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut))) {
+ if (rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut))) {
return hr;
}
@@ -2364,7 +2364,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn) HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Audio
+ if (mtIn->majortype != MEDIATYPE_Audio
|| mtIn->subtype != MEDIASUBTYPE_14_4
&& mtIn->subtype != MEDIASUBTYPE_28_8
&& mtIn->subtype != MEDIASUBTYPE_ATRC
@@ -2377,8 +2377,8 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(!m_pInput->IsConnected()) {
- if(m_hDrvDll) {
+ if (!m_pInput->IsConnected()) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
m_hDrvDll = NULL;
}
@@ -2394,7 +2394,7 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) 0
};
- if(!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc)) {
+ if (!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc)) {
_tcscpy(fourcc, _T("RAAC"));
}
@@ -2404,37 +2404,37 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
oldpath = buff;
TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
oldpath += '\\';
}
key.Close();
}
len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
newpath = buff;
TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
newpath += '\\';
}
key.Close();
}
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + newdll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + newdll);
}
paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + olddll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + olddll);
}
paths.AddTail(olddll); // default dll paths
@@ -2444,9 +2444,9 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) if (pos) {
m_hDrvDll = LoadLibrary(paths.GetNext(pos));
}
- } while(pos && !m_hDrvDll);
+ } while (pos && !m_hDrvDll);
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
RACloseCodec = (PCloseCodec)GetProcAddress(m_hDrvDll, "RACloseCodec");
RADecode = (PDecode)GetProcAddress(m_hDrvDll, "RADecode");
RAFlush = (PFlush)GetProcAddress(m_hDrvDll, "RAFlush");
@@ -2460,25 +2460,25 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn) RASetPwd = (PSetPwd)GetProcAddress(m_hDrvDll, "RASetPwd");
}
- if(!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
+ if (!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
|| !RAFreeDecoder || !RAGetFlavorProperty || !RAInitDecoder
|| !(RAOpenCodec || RAOpenCodec2) /*|| !RASetFlavor*/) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
char buff[_MAX_PATH];
GetModuleFileNameA(m_hDrvDll, buff, MAX_PATH);
CPathA p(buff);
p.RemoveFileSpec();
p.AddBackslash();
m_dllpath = p.m_strPath;
- if(RASetDLLAccessPath) {
+ if (RASetDLLAccessPath) {
RASetDLLAccessPath("DT_Codecs=" + m_dllpath);
}
}
- if(FAILED(InitRA(mtIn))) {
+ if (FAILED(InitRA(mtIn))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -2504,20 +2504,20 @@ HRESULT CRealAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaTy HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
CComPtr<IMemAllocator> pAllocatorIn;
m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) {
+ if (!wBitsPerSample) {
wBitsPerSample = 16;
}
@@ -2529,7 +2529,7 @@ HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -2540,7 +2540,7 @@ HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -2548,14 +2548,14 @@ HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt) pmt->subtype = MEDIASUBTYPE_PCM;
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) {
+ if (iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) {
return VFW_S_NO_MORE_ITEMS;
}
- if(!pwfe->wBitsPerSample) {
+ if (!pwfe->wBitsPerSample) {
pwfe->wBitsPerSample = 16;
}
@@ -2564,7 +2564,7 @@ HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt) pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
pwfe->nAvgBytesPerSec = pwfe->nSamplesPerSec*pwfe->nBlockAlign;
- if(iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6) {
+ if (iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6) {
static DWORD chmask[] = {
KSAUDIO_SPEAKER_DIRECTOUT,
KSAUDIO_SPEAKER_MONO,
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.cpp b/src/filters/parser/SSFSplitter/SSFSplitter.cpp index 6c8532e57..bf1cf34d4 100644 --- a/src/filters/parser/SSFSplitter/SSFSplitter.cpp +++ b/src/filters/parser/SSFSplitter/SSFSplitter.cpp @@ -81,10 +81,10 @@ namespace ssf }
int NextByte() {
- if(!m_pFile) {
+ if (!m_pFile) {
ThrowError(_T("m_pFile is NULL"));
}
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return EOS;
}
return (int)m_pFile->BitRead(8);
@@ -96,10 +96,10 @@ 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) {
+ if (si1->start < si2->start) {
return -1;
}
- if(si2->start < si1->start) {
+ if (si2->start < si1->start) {
return +1;
}
return 0;
@@ -122,17 +122,17 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
try {
m_ssf.Parse(ssf::InputStreamBSF(m_pFile));
- } catch(ssf::Exception&) {
+ } catch (ssf::Exception&) {
return E_FAIL;
}
@@ -141,17 +141,17 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) 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))) {
+ 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;
@@ -162,7 +162,7 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) continue;
}
- } catch(ssf::Exception&) {
+ } catch (ssf::Exception&) {
}
pDef->Dump(s);
@@ -193,16 +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++) {
+ 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++) {
+ 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;
}
}
@@ -218,7 +218,7 @@ bool CSSFSplitterFilter::DemuxInit() void CSSFSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0) {
+ if (rt <= 0) {
} else {
// TODO
}
@@ -230,7 +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/StreamDriveThru/StreamDriveThru.cpp b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp index 8e5e09192..b6cac313a 100644 --- a/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp +++ b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp @@ -72,7 +72,7 @@ CStreamDriveThruFilter::CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr) : CBaseFilter(NAME("CStreamDriveThruFilter"), pUnk, &m_csLock, __uuidof(this))
, m_position(0)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -106,10 +106,10 @@ STDMETHODIMP CStreamDriveThruFilter::NonDelegatingQueryInterface(REFIID riid, vo DWORD CStreamDriveThruFilter::ThreadProc()
{
- while(1) {
+ while (1) {
DWORD cmd = GetRequest();
- switch(cmd) {
+ switch (cmd) {
default:
case CMD_EXIT:
Reply(S_OK);
@@ -127,7 +127,7 @@ DWORD CStreamDriveThruFilter::ThreadProc() CComPtr<IAsyncReader> pAsyncReader;
CComPtr<IStream> pStream;
- if(!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
+ if (!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
|| !m_pOutput || !m_pOutput->IsConnected() || FAILED(m_pOutput->GetStream(&pStream))) {
break;
}
@@ -135,16 +135,16 @@ DWORD CStreamDriveThruFilter::ThreadProc() LARGE_INTEGER li = {0};
ULARGE_INTEGER uli = {0};
- if(FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
+ if (FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
|| FAILED(pStream->SetSize(uli))) {
break;
}
- if(CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected())) {
+ if (CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected())) {
pFSF->SetMode(AM_FILE_OVERWRITE);
LPOLESTR pfn;
- if(SUCCEEDED(pFSF->GetCurFile(&pfn, NULL))) {
+ if (SUCCEEDED(pFSF->GetCurFile(&pfn, NULL))) {
pFSF->SetFileName(pfn, NULL);
CoTaskMemFree(pfn);
}
@@ -154,23 +154,23 @@ DWORD CStreamDriveThruFilter::ThreadProc() BYTE buff[PACKETSIZE];
do {
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
CAutoLock csAutoLock(&m_csLock);
LONGLONG total = 0, available = 0;
- if(FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total) {
+ if (FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total) {
cmd = CMD_STOP;
break;
}
LONG size = (LONG)min(PACKETSIZE, total - m_position);
- if(FAILED(pAsyncReader->SyncRead(m_position, size, buff))) {
+ if (FAILED(pAsyncReader->SyncRead(m_position, size, buff))) {
cmd = CMD_STOP;
break;
}
ULONG written = 0;
- if(FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written) {
+ if (FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written) {
cmd = CMD_STOP;
break;
}
@@ -178,24 +178,24 @@ DWORD CStreamDriveThruFilter::ThreadProc() m_position += size;
}
- if(cmd == CMD_PAUSE) {
+ if (cmd == CMD_PAUSE) {
Reply(S_OK); // reply to CMD_PAUSE
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
Sleep(50);
}
Reply(S_OK); // reply to something
}
- } while(cmd == CMD_RUN);
+ } while (cmd == CMD_RUN);
uli.QuadPart = m_position;
pStream->SetSize(uli);
- if(CComPtr<IPin> pPin = m_pOutput->GetConnected()) {
+ if (CComPtr<IPin> pPin = m_pOutput->GetConnected()) {
pPin->EndOfStream();
}
- } while(false);
+ } while (false);
break;
}
@@ -213,9 +213,9 @@ CBasePin* CStreamDriveThruFilter::GetPin(int n) {
CAutoLock csAutoLock(&m_csLock);
- if(n == 0) {
+ if (n == 0) {
return m_pInput;
- } else if(n == 1) {
+ } else if (n == 1) {
return m_pOutput;
}
@@ -226,7 +226,7 @@ STDMETHODIMP CStreamDriveThruFilter::Stop() {
HRESULT hr;
- if(FAILED(hr = __super::Stop())) {
+ if (FAILED(hr = __super::Stop())) {
return hr;
}
@@ -239,7 +239,7 @@ STDMETHODIMP CStreamDriveThruFilter::Pause() {
HRESULT hr;
- if(FAILED(hr = __super::Pause())) {
+ if (FAILED(hr = __super::Pause())) {
return hr;
}
@@ -252,7 +252,7 @@ STDMETHODIMP CStreamDriveThruFilter::Run(REFERENCE_TIME tStart) {
HRESULT hr;
- if(FAILED(hr = __super::Run(tStart))) {
+ if (FAILED(hr = __super::Run(tStart))) {
return hr;
}
@@ -272,7 +272,7 @@ STDMETHODIMP CStreamDriveThruFilter::CheckCapabilities(DWORD* pCapabilities) {
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
@@ -314,9 +314,9 @@ STDMETHODIMP CStreamDriveThruFilter::GetDuration(LONGLONG* pDuration) CheckPointer(pDuration, E_POINTER);
CheckPointer(m_pInput, VFW_E_NOT_CONNECTED);
- if(CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected()) {
+ if (CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected()) {
LONGLONG total, available;
- if(SUCCEEDED(pAsyncReader->Length(&total, &available))) {
+ if (SUCCEEDED(pAsyncReader->Length(&total, &available))) {
*pDuration = total;
return S_OK;
}
@@ -415,11 +415,11 @@ HRESULT CStreamDriveThruInputPin::CheckConnect(IPin* pPin) {
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
- if(!CComQIPtr<IAsyncReader>(pPin)) {
+ if (!CComQIPtr<IAsyncReader>(pPin)) {
return E_NOINTERFACE;
}
@@ -430,7 +430,7 @@ HRESULT CStreamDriveThruInputPin::BreakConnect() {
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
@@ -443,7 +443,7 @@ HRESULT CStreamDriveThruInputPin::CompleteConnect(IPin* pPin) {
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
@@ -509,11 +509,11 @@ HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOC pProperties->cbBuffer = PACKETSIZE;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -532,10 +532,10 @@ HRESULT CStreamDriveThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt) {
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -551,11 +551,11 @@ HRESULT CStreamDriveThruOutputPin::CheckConnect(IPin* pPin) {
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
- if(!CComQIPtr<IStream>(pPin)) {
+ if (!CComQIPtr<IStream>(pPin)) {
return E_NOINTERFACE;
}
@@ -566,7 +566,7 @@ HRESULT CStreamDriveThruOutputPin::BreakConnect() {
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
@@ -579,7 +579,7 @@ HRESULT CStreamDriveThruOutputPin::CompleteConnect(IPin* pPin) {
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
|