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/BaseSplitter | |
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/BaseSplitter')
-rw-r--r-- | src/filters/parser/BaseSplitter/AsyncReader.cpp | 46 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.cpp | 278 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.h | 124 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitterFile.cpp | 44 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp | 468 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitterFileEx.h | 10 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/MultiFiles.cpp | 2 |
7 files changed, 486 insertions, 486 deletions
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)) {
|