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

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-08-16 16:52:56 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-08-16 16:52:56 +0400
commit60af42a80edbf24004c1662591721b9db454c248 (patch)
tree05dc675a3f427e5c05cdac9165745c149df7980f
parent34c461761913564627c15458506eb1d33f23f0a3 (diff)
muxers: applied astyle formatting
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2252 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxer.cpp123
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxer.h18
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp26
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h63
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp106
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h4
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp12
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h15
-rw-r--r--src/filters/muxer/BaseMuxer/BitStream.cpp21
-rw-r--r--src/filters/muxer/BaseMuxer/BitStream.h19
-rw-r--r--src/filters/muxer/BaseMuxer/stdafx.cpp18
-rw-r--r--src/filters/muxer/BaseMuxer/stdafx.h20
-rw-r--r--src/filters/muxer/DSMMuxer/DSMMuxer.cpp54
-rw-r--r--src/filters/muxer/DSMMuxer/DSMMuxer.h28
-rw-r--r--src/filters/muxer/DSMMuxer/resource.h2
-rw-r--r--src/filters/muxer/DSMMuxer/stdafx.cpp14
-rw-r--r--src/filters/muxer/DSMMuxer/stdafx.h20
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp22
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.h699
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp356
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h43
-rw-r--r--src/filters/muxer/MatroskaMuxer/resource.h2
-rw-r--r--src/filters/muxer/MatroskaMuxer/stdafx.cpp17
-rw-r--r--src/filters/muxer/MatroskaMuxer/stdafx.h20
-rw-r--r--src/filters/muxer/WavDest/WavDest.cpp300
-rw-r--r--src/filters/muxer/WavDest/WavDest.h50
-rw-r--r--src/filters/muxer/WavDest/stdafx.cpp18
-rw-r--r--src/filters/muxer/WavDest/stdafx.h19
28 files changed, 1117 insertions, 992 deletions
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
index 4ff8199f9..fb596eaaa 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -45,7 +45,7 @@ STDMETHODIMP CBaseMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** p
*ppv = NULL;
- return
+ return
QI(IMediaSeeking)
QI(IPropertyBag)
QI(IPropertyBag2)
@@ -71,13 +71,19 @@ void CBaseMuxerFilter::AddInput()
name.Format(L"Input %d", m_pInputs.GetCount()+1);
CBaseMuxerInputPin* pInputPin = NULL;
- if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {ASSERT(0); return;}
+ if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {
+ ASSERT(0);
+ return;
+ }
CAutoPtr<CBaseMuxerInputPin> pAutoPtrInputPin(pInputPin);
name.Format(L"~Output %d", m_pRawOutputs.GetCount()+1);
CBaseMuxerRawOutputPin* pRawOutputPin = NULL;
- if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {ASSERT(0); return;}
+ if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {
+ ASSERT(0);
+ return;
+ }
CAutoPtr<CBaseMuxerRawOutputPin> pAutoPtrRawOutputPin(pRawOutputPin);
pInputPin->SetRelatedPin(pRawOutputPin);
@@ -150,17 +156,23 @@ DWORD CBaseMuxerFilter::ThreadProc()
while(!CheckRequest(NULL) && m_pActivePins.GetCount())
{
- if(m_State == State_Paused) {Sleep(10); continue;}
+ if(m_State == State_Paused) {
+ Sleep(10);
+ continue;
+ }
CAutoPtr<MuxerPacket> pPacket = GetPacket();
- if(!pPacket) {Sleep(1); continue;}
+ if(!pPacket) {
+ Sleep(1);
+ continue;
+ }
if(pPacket->IsTimeValid())
m_rtCurrent = pPacket->rtStart;
if(pPacket->IsEOS())
m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
-
+
MuxPacketInternal(pPacket);
}
@@ -203,21 +215,21 @@ void CBaseMuxerFilter::MuxHeaderInternal()
POSITION pos = m_pPins.GetHeadPosition();
while(pos)
{
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxHeader(pInput->CurrentMediaType());
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxHeader(pInput->CurrentMediaType());
}
}
void CBaseMuxerFilter::MuxPacketInternal(const MuxerPacket* pPacket)
{
- TRACE(_T("MuxPacket pPin=%x, size=%d, s%d e%d b%d, rt=(%I64d-%I64d)\n"),
- pPacket->pPin->GetID(),
- pPacket->pData.GetCount(),
- !!(pPacket->flags & MuxerPacket::syncpoint),
- !!(pPacket->flags & MuxerPacket::eos),
- !!(pPacket->flags & MuxerPacket::bogus),
- pPacket->rtStart/10000, pPacket->rtStop/10000);
+ TRACE(_T("MuxPacket pPin=%x, size=%d, s%d e%d b%d, rt=(%I64d-%I64d)\n"),
+ pPacket->pPin->GetID(),
+ pPacket->pData.GetCount(),
+ !!(pPacket->flags & MuxerPacket::syncpoint),
+ !!(pPacket->flags & MuxerPacket::eos),
+ !!(pPacket->flags & MuxerPacket::bogus),
+ pPacket->rtStart/10000, pPacket->rtStop/10000);
if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
MuxPacket(pBitStream, pPacket);
@@ -225,14 +237,14 @@ void CBaseMuxerFilter::MuxPacketInternal(const MuxerPacket* pPacket)
MuxPacket(pPacket);
if(CBaseMuxerInputPin* pInput = pPacket->pPin)
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
}
void CBaseMuxerFilter::MuxFooterInternal()
{
TRACE(_T("MuxFooter\n"));
-
+
if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
MuxFooter(pBitStream);
@@ -243,9 +255,9 @@ void CBaseMuxerFilter::MuxFooterInternal()
POSITION pos = m_pPins.GetHeadPosition();
while(pos)
{
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxFooter(pInput->CurrentMediaType());
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxFooter(pInput->CurrentMediaType());
}
}
@@ -305,7 +317,7 @@ int CBaseMuxerFilter::GetPinCount()
CBasePin* CBaseMuxerFilter::GetPin(int n)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
if(n >= 0 && n < (int)m_pInputs.GetCount())
{
@@ -388,27 +400,44 @@ STDMETHODIMP CBaseMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
caps &= *pCapabilities;
return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
}
-STDMETHODIMP CBaseMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
-STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
-STDMETHODIMP CBaseMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
-STDMETHODIMP CBaseMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
-STDMETHODIMP CBaseMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseMuxerFilter::IsFormatSupported(const GUID* pFormat) {
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
+}
+STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat) {
+ return GetTimeFormat(pFormat);
+}
+STDMETHODIMP CBaseMuxerFilter::GetTimeFormat(GUID* pFormat) {
+ return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
+}
+STDMETHODIMP CBaseMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {
+ return IsFormatSupported(pFormat);
+}
+STDMETHODIMP CBaseMuxerFilter::SetTimeFormat(const GUID* pFormat) {
+ return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+}
STDMETHODIMP CBaseMuxerFilter::GetDuration(LONGLONG* pDuration)
{
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration(); if(rt > *pDuration) *pDuration = rt;}
+ while(pos) {
+ REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration();
+ if(rt > *pDuration) *pDuration = rt;
+ }
return S_OK;
}
-STDMETHODIMP CBaseMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetStopPosition(LONGLONG* pStop) {
+ return E_NOTIMPL;
+}
STDMETHODIMP CBaseMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
{
CheckPointer(pCurrent, E_POINTER);
*pCurrent = m_rtCurrent;
return S_OK;
}
-STDMETHODIMP CBaseMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {
+ return E_NOTIMPL;
+}
STDMETHODIMP CBaseMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
FILTER_STATE fs;
@@ -429,8 +458,18 @@ STDMETHODIMP CBaseMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentF
return VFW_E_WRONG_STATE;
}
-STDMETHODIMP CBaseMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
-STDMETHODIMP CBaseMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
-STDMETHODIMP CBaseMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
-STDMETHODIMP CBaseMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
-STDMETHODIMP CBaseMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CBaseMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CBaseMuxerFilter::SetRate(double dRate) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CBaseMuxerFilter::GetRate(double* pdRate) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CBaseMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {
+ return E_NOTIMPL;
+}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxer.h b/src/filters/muxer/BaseMuxer/BaseMuxer.h
index 71aed60fa..6cd8221e1 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxer.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxer.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -52,7 +52,9 @@ private:
protected:
CAtlList<CBaseMuxerInputPin*> m_pPins;
- CBaseMuxerOutputPin* GetOutputPin() {return m_pOutput;}
+ CBaseMuxerOutputPin* GetOutputPin() {
+ return m_pOutput;
+ }
virtual void MuxInit() = 0;
@@ -75,7 +77,7 @@ public:
virtual ~CBaseMuxerFilter();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
void AddInput();
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
index 4aa1bedb9..abfb8923e 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -50,7 +50,7 @@ STDMETHODIMP CBaseMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, void**
{
CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IBaseMuxerRelatedPin)
QI(IPropertyBag)
QI(IPropertyBag2)
@@ -66,9 +66,9 @@ bool CBaseMuxerInputPin::IsSubtitleStream()
void CBaseMuxerInputPin::PushPacket(CAutoPtr<MuxerPacket> pPacket)
{
for(int i = 0; m_pFilter->IsActive() && !m_bFlushing
- && !m_evAcceptPacket.Wait(1)
- && i < 1000;
- i++);
+ && !m_evAcceptPacket.Wait(1)
+ && i < 1000;
+ i++);
if(!m_pFilter->IsActive() || m_bFlushing)
return;
@@ -87,7 +87,7 @@ CAutoPtr<MuxerPacket> CBaseMuxerInputPin::PopPacket()
CAutoLock cAutoLock(&m_csQueue);
- if(m_queue.GetCount())
+ if(m_queue.GetCount())
pPacket = m_queue.RemoveHead();
if(m_queue.GetCount() < MAXQUEUESIZE)
@@ -101,7 +101,7 @@ HRESULT CBaseMuxerInputPin::CheckMediaType(const CMediaType* pmt)
if(pmt->formattype == FORMAT_WaveFormatEx)
{
WORD wFormatTag = ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag;
- if((wFormatTag == WAVE_FORMAT_PCM
+ if((wFormatTag == WAVE_FORMAT_PCM
|| wFormatTag == WAVE_FORMAT_EXTENSIBLE
|| wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
&& pmt->subtype != FOURCCMap(wFormatTag)
@@ -230,7 +230,7 @@ STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample)
{
pPacket->flags |= MuxerPacket::timevalid;
- pPacket->rtStart += m_tStart;
+ pPacket->rtStart += m_tStart;
pPacket->rtStop += m_tStart;
if((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart)
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
index 7b10c3474..1ae51ae1d 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -34,12 +34,27 @@ struct MuxerPacket
enum flag_t {empty = 0, timevalid = 1, syncpoint = 2, discontinuity = 4, eos = 8, bogus = 16};
DWORD flags;
int index;
- struct MuxerPacket(CBaseMuxerInputPin* pPin) {this->pPin = pPin; rtStart = rtStop = _I64_MIN; flags = empty; index = -1;}
- bool IsTimeValid() const {return !!(flags & timevalid);}
- bool IsSyncPoint() const {return !!(flags & syncpoint);}
- bool IsDiscontinuity() const {return !!(flags & discontinuity);}
- bool IsEOS() const {return !!(flags & eos);}
- bool IsBogus() const {return !!(flags & bogus);}
+ struct MuxerPacket(CBaseMuxerInputPin* pPin) {
+ this->pPin = pPin;
+ rtStart = rtStop = _I64_MIN;
+ flags = empty;
+ index = -1;
+ }
+ bool IsTimeValid() const {
+ return !!(flags & timevalid);
+ }
+ bool IsSyncPoint() const {
+ return !!(flags & syncpoint);
+ }
+ bool IsDiscontinuity() const {
+ return !!(flags & discontinuity);
+ }
+ bool IsEOS() const {
+ return !!(flags & eos);
+ }
+ bool IsBogus() const {
+ return !!(flags & bogus);
+ }
};
class CBaseMuxerInputPin : public CBaseInputPin, public CBaseMuxerRelatedPin, public IDSMPropertyBagImpl
@@ -65,21 +80,27 @@ public:
virtual ~CBaseMuxerInputPin();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- REFERENCE_TIME GetDuration() {return m_rtDuration;}
- int GetID() {return m_iID;}
- CMediaType& CurrentMediaType() {return m_mt;}
+ REFERENCE_TIME GetDuration() {
+ return m_rtDuration;
+ }
+ int GetID() {
+ return m_iID;
+ }
+ CMediaType& CurrentMediaType() {
+ return m_mt;
+ }
bool IsSubtitleStream();
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pReceivePin);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pReceivePin);
HRESULT Active();
HRESULT Inactive();
- STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
STDMETHODIMP Receive(IMediaSample* pSample);
- STDMETHODIMP EndOfStream();
+ STDMETHODIMP EndOfStream();
};
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
index d827ba1f6..108549d91 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -60,33 +60,33 @@ HRESULT CBaseMuxerOutputPin::BreakConnect()
HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
pProperties->cBuffers = 1;
pProperties->cbBuffer = 1;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
- if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
- ASSERT(Actual.cBuffers == pProperties->cBuffers);
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
- return NOERROR;
+ return NOERROR;
}
HRESULT CBaseMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
{
return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL
- ? S_OK
- : E_INVALIDARG;
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CBaseMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pLock);
+ CAutoLock cAutoLock(m_pLock);
if(iPosition < 0) return E_INVALIDARG;
if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
@@ -125,7 +125,7 @@ STDMETHODIMP CBaseMuxerRawOutputPin::NonDelegatingQueryInterface(REFIID riid, vo
{
CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IBaseMuxerRelatedPin)
__super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -158,31 +158,33 @@ void CBaseMuxerRawOutputPin::MuxHeader(const CMediaType& mt)
SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
BYTE* p = (BYTE*)si + si->dwOffset;
- if(memcmp(utf8bom, p, 3) != 0)
+ if(memcmp(utf8bom, p, 3) != 0)
pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
CStringA str((char*)p, mt.FormatLength() - (p - mt.Format()));
pBitStream->StrWrite(str + '\n', true);
- if(str.Find("[Events]") < 0)
+ if(str.Find("[Events]") < 0)
pBitStream->StrWrite("\n\n[Events]\n", true);
}
else if(mt.subtype == MEDIASUBTYPE_SSF)
{
DWORD dwOffset = ((SUBTITLEINFO*)mt.pbFormat)->dwOffset;
- try {m_ssf.Parse(ssf::MemoryInputStream(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, false, false));}
+ try {
+ m_ssf.Parse(ssf::MemoryInputStream(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, false, false));
+ }
catch(ssf::Exception&) {}
}
else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
{
m_idx.RemoveAll();
}
- else if(mt.majortype == MEDIATYPE_Audio
- && (mt.subtype == MEDIASUBTYPE_PCM
- || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
- || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
- || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
- && mt.formattype == FORMAT_WaveFormatEx)
+ else if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
{
pBitStream->BitWrite('RIFF', 32);
pBitStream->BitWrite(0, 32); // file length - 8, set later
@@ -269,10 +271,13 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
pBitStream->BitWrite(0x00000001, 32);
- p += 4;
+ p += 4;
i -= 4;
- if(len > i || len == 1) {len = i; ASSERT(0);}
+ if(len > i || len == 1) {
+ len = i;
+ ASSERT(0);
+ }
pBitStream->ByteWrite(p, len);
@@ -292,11 +297,11 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
- str.Format("%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
- pPacket->index+1,
- start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/10000)%1000),
- stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/10000)%1000),
- CStringA(str));
+ str.Format("%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
+ pPacket->index+1,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/10000)%1000),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/10000)%1000),
+ CStringA(str));
pBitStream->StrWrite(str, true);
@@ -331,11 +336,11 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
if(mt.subtype == MEDIASUBTYPE_SSA) layer = "Marked=0";
str.Format("Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%s,%s,%s,%s,%s\n",
- layer,
- start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/100000)%100),
- stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/100000)%100),
- style, actor, left, right, top, effect,
- CStringA(str));
+ layer,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/100000)%100),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/100000)%100),
+ style, actor, left, right, top, effect,
+ CStringA(str));
pBitStream->StrWrite(str, true);
@@ -426,12 +431,12 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
CComQIPtr<IBitStream> pBitStream = GetBitStream();
if(!pBitStream) return;
- if(mt.majortype == MEDIATYPE_Audio
- && (mt.subtype == MEDIASUBTYPE_PCM
- || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
- || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
- || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
- && mt.formattype == FORMAT_WaveFormatEx)
+ if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
{
pBitStream->BitFlush();
@@ -449,7 +454,10 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
else if(mt.subtype == MEDIASUBTYPE_SSF)
{
ssf::WCharOutputStream s;
- try {m_ssf.Dump(s);} catch(ssf::Exception&) {}
+ try {
+ m_ssf.Dump(s);
+ }
+ catch(ssf::Exception&) {}
CStringA str = UTF16To8(s.GetString());
pBitStream->StrWrite(str, true);
}
@@ -484,9 +492,9 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
{
const idx_t& i = m_idx.GetNext(pos);
DVD_HMSF_TIMECODE start = RT2HMSF(i.rt, 25);
- _ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
- start.bHours, start.bMinutes, start.bSeconds, (int)((i.rt/10000)%1000),
- i.fp);
+ _ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
+ start.bHours, start.bMinutes, start.bSeconds, (int)((i.rt/10000)%1000),
+ i.fp);
}
fclose(f);
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
index c6b26ede4..63a80e6e9 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
index c4ba9b3bd..52b323c4c 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
index 21765fded..3d911ccdd 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -22,7 +22,8 @@
#pragma once
interface __declspec(uuid("EE6F2741-7DB4-4AAD-A3CB-545208EE4C0A"))
-IBaseMuxerRelatedPin : public IUnknown
+IBaseMuxerRelatedPin :
+public IUnknown
{
STDMETHOD(SetRelatedPin) (CBasePin* pPin) = 0;
STDMETHOD_(CBasePin*, GetRelatedPin) () = 0;
diff --git a/src/filters/muxer/BaseMuxer/BitStream.cpp b/src/filters/muxer/BaseMuxer/BitStream.cpp
index abb18055f..d18fc53fa 100644
--- a/src/filters/muxer/BaseMuxer/BitStream.cpp
+++ b/src/filters/muxer/BaseMuxer/BitStream.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -54,7 +54,7 @@ STDMETHODIMP CBitStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
*ppv = NULL;
- return
+ return
QI(IBitStream)
__super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -105,12 +105,15 @@ STDMETHODIMP CBitStream::BitWrite(UINT64 data, int len)
ASSERT(len >= 0 && len <= 64);
- if(len > 56) {BitWrite(data >> 56, len - 56); len = 56;}
+ if(len > 56) {
+ BitWrite(data >> 56, len - 56);
+ len = 56;
+ }
m_bitbuff <<= len;
m_bitbuff |= data & ((1ui64 << len) - 1);
m_bitlen += len;
-
+
while(m_bitlen >= 8)
{
BYTE b = (BYTE)(m_bitbuff >> (m_bitlen - 8));
diff --git a/src/filters/muxer/BaseMuxer/BitStream.h b/src/filters/muxer/BaseMuxer/BitStream.h
index d3238b94a..02ffbe2ce 100644
--- a/src/filters/muxer/BaseMuxer/BitStream.h
+++ b/src/filters/muxer/BaseMuxer/BitStream.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -22,10 +22,11 @@
#pragma once
interface __declspec(uuid("30AB78C7-5259-4594-AEFE-9C0FC2F08A5E"))
-IBitStream : public IUnknown
+IBitStream :
+public IUnknown
{
STDMETHOD_(UINT64, GetPos) () = 0;
- STDMETHOD_(UINT64, Seek) (UINT64 pos) = 0; // it's a _stream_, please don't seek if you don't have to
+ STDMETHOD_(UINT64, Seek) (UINT64 pos) = 0; // it's a _stream_, please don't seek if you don't have to
STDMETHOD(ByteWrite) (const void* pData, int len) = 0;
STDMETHOD(BitWrite) (UINT64 data, int len) = 0;
STDMETHOD(BitFlush) () = 0;
@@ -44,7 +45,7 @@ public:
virtual ~CBitStream();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IBitStream
diff --git a/src/filters/muxer/BaseMuxer/stdafx.cpp b/src/filters/muxer/BaseMuxer/stdafx.cpp
index 6f5d2a928..d58a51550 100644
--- a/src/filters/muxer/BaseMuxer/stdafx.cpp
+++ b/src/filters/muxer/BaseMuxer/stdafx.cpp
@@ -1,29 +1,23 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.cpp : source file that includes just the standard includes
-// BaseMuxer.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
#include "stdafx.h"
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/src/filters/muxer/BaseMuxer/stdafx.h b/src/filters/muxer/BaseMuxer/stdafx.h
index a2674a8f9..0c3d9bf8d 100644
--- a/src/filters/muxer/BaseMuxer/stdafx.h
+++ b/src/filters/muxer/BaseMuxer/stdafx.h
@@ -1,28 +1,24 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
#pragma once
#include "../../../DSUtil/SharedInclude.h"
@@ -35,9 +31,7 @@
#endif
#include <afx.h>
-#include <afxwin.h> // MFC core and standard components
-
-// TODO: reference additional headers your program requires here
+#include <afxwin.h> // MFC core and standard components
#include <atlbase.h>
#include <atlcoll.h>
diff --git a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
index ca349a306..17fce671d 100644
--- a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
+++ b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -37,8 +37,8 @@ const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
@@ -69,7 +69,9 @@ CFilterApp theApp;
#endif
-template<typename T> static T myabs(T n) {return n >= 0 ? n : -n;}
+template<typename T> static T myabs(T n) {
+ return n >= 0 ? n : -n;
+}
static int GetByteLength(UINT64 data, int min = 0)
{
@@ -100,7 +102,7 @@ STDMETHODIMP CDSMMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** pp
*ppv = NULL;
- return
+ return
__super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -200,7 +202,7 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
pBS->BitWrite(mt.lSampleSize, 30);
pBS->ByteWrite(&mt.formattype, sizeof(mt.formattype));
pBS->ByteWrite(mt.Format(), mt.FormatLength());
-
+
MuxStreamInfo(pBS, pPin);
}
@@ -224,7 +226,7 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
if(m_fAutoChap)
{
- if(!pCB || pCB->ChapGetCount() == 0) pCB = GetFilterFromPin(pPin);
+ if(!pCB || pCB->ChapGetCount() == 0) pCB = GetFilterFromPin(pPin);
}
}
}
@@ -247,12 +249,12 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
CStringA utf8_desc = UTF16To8(desc);
CStringA utf8_mime = UTF16To8(mime);
- MuxPacketHeader(pBS, DSMP_RESOURCE,
- 1 +
- utf8_name.GetLength()+1 +
- utf8_desc.GetLength()+1 +
- utf8_mime.GetLength()+1 +
- len);
+ MuxPacketHeader(pBS, DSMP_RESOURCE,
+ 1 +
+ utf8_name.GetLength()+1 +
+ utf8_desc.GetLength()+1 +
+ utf8_mime.GetLength()+1 +
+ len);
pBS->BitWrite(0, 2);
pBS->BitWrite(0, 6); // reserved
@@ -282,7 +284,9 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
CComBSTR name;
if(SUCCEEDED(pCB->ChapGet(i, &c.rt, &name)))
{
- REFERENCE_TIME rtDiff = c.rt - rtPrev; rtPrev = c.rt; c.rt = rtDiff;
+ REFERENCE_TIME rtDiff = c.rt - rtPrev;
+ rtPrev = c.rt;
+ c.rt = rtDiff;
c.name = name;
len += 1 + GetByteLength(myabs(c.rt)) + UTF16To8(c.name).GetLength()+1;
chapters.AddTail(c);
@@ -344,7 +348,7 @@ void CDSMMuxerFilter::MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket)
IndexSyncPoint(pPacket, pBS->GetPos());
}
- int len = 2 + iTimeStamp + iDuration + pPacket->pData.GetCount(); // id + flags + data
+ int len = 2 + iTimeStamp + iDuration + pPacket->pData.GetCount(); // id + flags + data
MuxPacketHeader(pBS, DSMP_SAMPLE, len);
pBS->BitWrite(pPacket->pPin->GetID(), 8);
@@ -372,8 +376,10 @@ void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
IndexedSyncPoint& isp = m_isps.GetNext(pos);
TRACE(_T("sp[%d]: %I64d %I64x\n"), isp.id, isp.rt, isp.fp);
- rt = isp.rt - rtPrev; rtPrev = isp.rt;
- fp = isp.fp - fpPrev; fpPrev = isp.fp;
+ rt = isp.rt - rtPrev;
+ rtPrev = isp.rt;
+ fp = isp.fp - fpPrev;
+ fpPrev = isp.fp;
IndexedSyncPoint isp2;
isp2.fp = fp;
@@ -405,12 +411,12 @@ void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
{
// Yes, this is as complicated as it looks.
- // Rule #1: don't write this packet if you can't do it reliably.
+ // Rule #1: don't write this packet if you can't do it reliably.
// (think about overlapped subtitles, line1: 0->10, line2: 1->9)
// FIXME: the very last syncpoints won't get moved to m_isps because there are no more syncpoints to trigger it!
- if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint())
+ if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint())
return;
ASSERT(p->rtStart >= m_rtPrevSyncPoint);
diff --git a/src/filters/muxer/DSMMuxer/DSMMuxer.h b/src/filters/muxer/DSMMuxer/DSMMuxer.h
index 71fccc081..dded4c4ac 100644
--- a/src/filters/muxer/DSMMuxer/DSMMuxer.h
+++ b/src/filters/muxer/DSMMuxer/DSMMuxer.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,12 +25,20 @@
#include <dsm/dsm.h>
class __declspec(uuid("C6590B76-587E-4082-9125-680D0693A97B"))
-CDSMMuxerFilter : public CBaseMuxerFilter
+ CDSMMuxerFilter : public CBaseMuxerFilter
{
bool m_fAutoChap, m_fAutoRes;
- struct SyncPoint {BYTE id; REFERENCE_TIME rtStart, rtStop; __int64 fp;};
- struct IndexedSyncPoint {BYTE id; REFERENCE_TIME rt, rtfp; __int64 fp;};
+ struct SyncPoint {
+ BYTE id;
+ REFERENCE_TIME rtStart, rtStop;
+ __int64 fp;
+ };
+ struct IndexedSyncPoint {
+ BYTE id;
+ REFERENCE_TIME rt, rtfp;
+ __int64 fp;
+ };
CAtlList<SyncPoint> m_sps;
CAtlList<IndexedSyncPoint> m_isps;
REFERENCE_TIME m_rtPrevSyncPoint;
@@ -52,5 +60,5 @@ public:
virtual ~CDSMMuxerFilter();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
diff --git a/src/filters/muxer/DSMMuxer/resource.h b/src/filters/muxer/DSMMuxer/resource.h
index be7a94010..07b0c9339 100644
--- a/src/filters/muxer/DSMMuxer/resource.h
+++ b/src/filters/muxer/DSMMuxer/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/muxer/DSMMuxer/stdafx.cpp b/src/filters/muxer/DSMMuxer/stdafx.cpp
index 5e2cdab92..aab1450a7 100644
--- a/src/filters/muxer/DSMMuxer/stdafx.cpp
+++ b/src/filters/muxer/DSMMuxer/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,24 +6,18 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.cpp : source file that includes just the standard includes
-// DSMMuxer.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
#include "stdafx.h"
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/src/filters/muxer/DSMMuxer/stdafx.h b/src/filters/muxer/DSMMuxer/stdafx.h
index 7be94a40c..bc925c87a 100644
--- a/src/filters/muxer/DSMMuxer/stdafx.h
+++ b/src/filters/muxer/DSMMuxer/stdafx.h
@@ -1,28 +1,24 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
#pragma once
#include "../../../DSUtil/SharedInclude.h"
@@ -35,9 +31,7 @@
#endif
#include <afx.h>
-#include <afxwin.h> // MFC core and standard components
-
-// TODO: reference additional headers your program requires here
+#include <afxwin.h> // MFC core and standard components
#include <atlbase.h>
#include <atlcoll.h>
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
index 1de7b2956..d1af9a3e4 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -156,7 +156,7 @@ MatroskaWriter::QWORD CUInt::Size(bool fWithHeader)
{
if(((0xffi64<<((i-1)*8))&m_val))
{
- len += i;
+ len += i;
break;
}
}
@@ -194,7 +194,7 @@ MatroskaWriter::QWORD CInt::Size(bool fWithHeader)
{
if(((0xffi64<<((i-1)*8))&val))
{
- len += i;
+ len += i;
if(m_val < 0 && !(m_val&(0x80<<(i-1))))
len++;
break;
@@ -227,7 +227,7 @@ MatroskaWriter::QWORD CLength::Size(bool fWithHeader)
{
if(!(m_len&(~((1i64<<(7*i))-1))) && (m_len&((1i64<<(7*i))-1)) != ((1i64<<(7*i))-1))
{
- len += i;
+ len += i;
break;
}
}
@@ -245,7 +245,7 @@ HRESULT CLength::Write(IStream* pStream)
//
-EBML::EBML(DWORD id)
+EBML::EBML(DWORD id)
: CID(id)
, EBMLVersion(0x4286)
, EBMLReadVersion(0x42F7)
@@ -379,7 +379,7 @@ HRESULT Track::Write(IStream* pStream)
return S_OK;
}
-TrackEntry::TrackEntry(DWORD id)
+TrackEntry::TrackEntry(DWORD id)
: CID(id)
, TrackNumber(0xD7)
, TrackUID(0x73C5)
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
index 80273dd76..feb94cd6c 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,264 +26,293 @@
namespace MatroskaWriter
{
- typedef unsigned __int64 QWORD;
+typedef unsigned __int64 QWORD;
- class CID
- {
- protected:
- DWORD m_id;
- QWORD HeaderSize(QWORD len);
- HRESULT HeaderWrite(IStream* pStream);
-
- public:
- CID(DWORD id);
- DWORD GetID() const {return m_id;}
- virtual QWORD Size(bool fWithHeader = true);
- virtual HRESULT Write(IStream* pStream);
- };
-
- class CLength : public CID
- {
- UINT64 m_len;
- public:
- CLength(UINT64 len = 0) : CID(0), m_len(len) {}
- operator UINT64() {return m_len;}
- QWORD Size(bool fWithHeader = false);
- HRESULT Write(IStream* pStream);
- };
-
- class CBinary : public CAtlArray<BYTE>, public CID
- {
- public:
- CBinary(DWORD id) : CID(id) {}
- CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
- operator BYTE*() {return (BYTE*)GetData();}
- CBinary& Set(CStringA str) {SetCount(str.GetLength()+1); strcpy((char*)GetData(), str); return(*this);}
+class CID
+{
+protected:
+ DWORD m_id;
+ QWORD HeaderSize(QWORD len);
+ HRESULT HeaderWrite(IStream* pStream);
+
+public:
+ CID(DWORD id);
+ DWORD GetID() const {
+ return m_id;
+ }
+ virtual QWORD Size(bool fWithHeader = true);
+ virtual HRESULT Write(IStream* pStream);
+};
+
+class CLength : public CID
+{
+ UINT64 m_len;
+public:
+ CLength(UINT64 len = 0) : CID(0), m_len(len) {}
+ operator UINT64() {
+ return m_len;
+ }
+ QWORD Size(bool fWithHeader = false);
+ HRESULT Write(IStream* pStream);
+};
+
+class CBinary : public CAtlArray<BYTE>, public CID
+{
+public:
+ CBinary(DWORD id) : CID(id) {}
+ CBinary& operator = (const CBinary& b) {
+ Copy(b);
+ return(*this);
+ }
+ operator BYTE*() {
+ return (BYTE*)GetData();
+ }
+ CBinary& Set(CStringA str) {
+ SetCount(str.GetLength()+1);
+ strcpy((char*)GetData(), str);
+ return(*this);
+ }
// CBinary& Set(CStringA str) {SetCount(str.GetLength()); memcpy((char*)GetData(), str, str.GetLength()); return(*this);}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class CANSI : public CStringA, public CID
- {
- public:
- CANSI(DWORD id) : CID(id) {}
- CANSI& Set(CStringA str) {CStringA::operator = (str); return(*this);}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class CUTF8 : public CStringW, public CID
- {
- public:
- CUTF8(DWORD id) : CID(id) {}
- CUTF8& Set(CStringW str) {CStringW::operator = (str); return(*this);}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- template<class T, class BASE>
- class CSimpleVar : public CID
- {
- protected:
- T m_val;
- bool m_fSet;
- public:
- explicit CSimpleVar(DWORD id, T val = 0) : CID(id), m_val(val) {m_fSet = !!val;}
- operator T() {return m_val;}
- BASE& Set(T val) {m_val = val; m_fSet = true; return(*(BASE*)this);}
- void UnSet() {m_fSet = false;}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class CUInt : public CSimpleVar<UINT64, CUInt>
- {
- public:
- explicit CUInt(DWORD id, UINT64 val = 0) : CSimpleVar<UINT64, CUInt>(id, val) {}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+class CANSI : public CStringA, public CID
+{
+public:
+ CANSI(DWORD id) : CID(id) {}
+ CANSI& Set(CStringA str) {
+ CStringA::operator = (str);
+ return(*this);
+ }
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class CUTF8 : public CStringW, public CID
+{
+public:
+ CUTF8(DWORD id) : CID(id) {}
+ CUTF8& Set(CStringW str) {
+ CStringW::operator = (str);
+ return(*this);
+ }
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+template<class T, class BASE>
+class CSimpleVar : public CID
+{
+protected:
+ T m_val;
+ bool m_fSet;
+public:
+ explicit CSimpleVar(DWORD id, T val = 0) : CID(id), m_val(val) {
+ m_fSet = !!val;
+ }
+ operator T() {
+ return m_val;
+ }
+ BASE& Set(T val) {
+ m_val = val;
+ m_fSet = true;
+ return(*(BASE*)this);
+ }
+ void UnSet() {
+ m_fSet = false;
+ }
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class CUInt : public CSimpleVar<UINT64, CUInt>
+{
+public:
+ explicit CUInt(DWORD id, UINT64 val = 0) : CSimpleVar<UINT64, CUInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class CInt : public CSimpleVar<INT64, CInt>
- {
- public:
- explicit CInt(DWORD id, INT64 val = 0) : CSimpleVar<INT64, CInt>(id, val) {}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+class CInt : public CSimpleVar<INT64, CInt>
+{
+public:
+ explicit CInt(DWORD id, INT64 val = 0) : CSimpleVar<INT64, CInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class CByte : public CSimpleVar<BYTE, CByte>
- {
- public:
- explicit CByte(DWORD id, BYTE val = 0) : CSimpleVar<BYTE, CByte>(id, val) {}
- };
+class CByte : public CSimpleVar<BYTE, CByte>
+{
+public:
+ explicit CByte(DWORD id, BYTE val = 0) : CSimpleVar<BYTE, CByte>(id, val) {}
+};
- class CShort : public CSimpleVar<short, CShort>
- {
- public:
- explicit CShort(DWORD id, short val = 0) : CSimpleVar<short, CShort>(id, val) {}
- };
+class CShort : public CSimpleVar<short, CShort>
+{
+public:
+ explicit CShort(DWORD id, short val = 0) : CSimpleVar<short, CShort>(id, val) {}
+};
- class CFloat : public CSimpleVar<float, CFloat>
- {
- public:
- explicit CFloat(DWORD id, float val = 0) : CSimpleVar<float, CFloat>(id, val) {}
- };
+class CFloat : public CSimpleVar<float, CFloat>
+{
+public:
+ explicit CFloat(DWORD id, float val = 0) : CSimpleVar<float, CFloat>(id, val) {}
+};
- template<class T>
- class CNode : public CAutoPtrList<T>
+template<class T>
+class CNode : public CAutoPtrList<T>
+{
+public:
+ QWORD Size(bool fWithHeader = true)
{
- public:
- QWORD Size(bool fWithHeader = true)
- {
- QWORD len = 0;
- POSITION pos = GetHeadPosition();
- while(pos) len += GetNext(pos)->Size(fWithHeader);
- return len;
- }
- HRESULT Write(IStream* pStream)
- {
- HRESULT hr;
- POSITION pos = GetHeadPosition();
- while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) return hr;
- return S_OK;
- }
- };
-
- class EBML : public CID
+ QWORD len = 0;
+ POSITION pos = GetHeadPosition();
+ while(pos) len += GetNext(pos)->Size(fWithHeader);
+ return len;
+ }
+ HRESULT Write(IStream* pStream)
{
- public:
- CUInt EBMLVersion, EBMLReadVersion;
- CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
- CANSI DocType;
- CUInt DocTypeVersion, DocTypeReadVersion;
-
- EBML(DWORD id = 0x1A45DFA3);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Info : public CID
- {
- public:
- CBinary SegmentUID, PrevUID, NextUID;
- CUTF8 SegmentFilename, PrevFilename, NextFilename;
- CUInt TimeCodeScale; // [ns], default: 1.000.000
- CFloat Duration;
- CInt DateUTC;
- CUTF8 Title, MuxingApp, WritingApp;
-
- Info(DWORD id = 0x1549A966);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Video : public CID
- {
- public:
- CUInt FlagInterlaced, StereoMode;
- CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
- CUInt AspectRatioType;
- CUInt ColourSpace;
- CFloat GammaValue;
- CFloat FramePerSec;
-
- Video(DWORD id = 0xE0);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Audio : public CID
- {
- public:
- CFloat SamplingFrequency;
- CFloat OutputSamplingFrequency;
- CUInt Channels;
- CBinary ChannelPositions;
- CUInt BitDepth;
-
- Audio(DWORD id = 0xE1);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class TrackEntry : public CID
- {
- public:
- enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
- CUInt TrackNumber, TrackUID, TrackType;
- CUInt FlagEnabled, FlagDefault, FlagLacing;
- CUInt MinCache, MaxCache;
- CUTF8 Name;
- CANSI Language;
- CBinary CodecID;
- CBinary CodecPrivate;
- CUTF8 CodecName;
- CUTF8 CodecSettings;
- CANSI CodecInfoURL;
- CANSI CodecDownloadURL;
- CUInt CodecDecodeAll;
- CUInt TrackOverlay;
- CUInt DefaultDuration;
- enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
- int DescType;
- Video v;
- Audio a;
-
- TrackEntry(DWORD id = 0xAE);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Track : public CID
- {
- public:
- CNode<TrackEntry> TrackEntries;
-
- Track(DWORD id = 0x1654AE6B);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class CBlock : public CID
- {
- public:
- CLength TrackNumber;
- REFERENCE_TIME TimeCode, TimeCodeStop;
- CNode<CBinary> BlockData;
-
- CBlock(DWORD id = 0xA1);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class BlockGroup : public CID
- {
- public:
- CUInt BlockDuration;
- CUInt ReferencePriority;
- CInt ReferenceBlock;
- CInt ReferenceVirtual;
- CBinary CodecState;
- CBlock Block;
+ HRESULT hr;
+ POSITION pos = GetHeadPosition();
+ while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) return hr;
+ return S_OK;
+ }
+};
+
+class EBML : public CID
+{
+public:
+ CUInt EBMLVersion, EBMLReadVersion;
+ CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
+ CANSI DocType;
+ CUInt DocTypeVersion, DocTypeReadVersion;
+
+ EBML(DWORD id = 0x1A45DFA3);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Info : public CID
+{
+public:
+ CBinary SegmentUID, PrevUID, NextUID;
+ CUTF8 SegmentFilename, PrevFilename, NextFilename;
+ CUInt TimeCodeScale; // [ns], default: 1.000.000
+ CFloat Duration;
+ CInt DateUTC;
+ CUTF8 Title, MuxingApp, WritingApp;
+
+ Info(DWORD id = 0x1549A966);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Video : public CID
+{
+public:
+ CUInt FlagInterlaced, StereoMode;
+ CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
+ CUInt AspectRatioType;
+ CUInt ColourSpace;
+ CFloat GammaValue;
+ CFloat FramePerSec;
+
+ Video(DWORD id = 0xE0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Audio : public CID
+{
+public:
+ CFloat SamplingFrequency;
+ CFloat OutputSamplingFrequency;
+ CUInt Channels;
+ CBinary ChannelPositions;
+ CUInt BitDepth;
+
+ Audio(DWORD id = 0xE1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class TrackEntry : public CID
+{
+public:
+ enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
+ CUInt TrackNumber, TrackUID, TrackType;
+ CUInt FlagEnabled, FlagDefault, FlagLacing;
+ CUInt MinCache, MaxCache;
+ CUTF8 Name;
+ CANSI Language;
+ CBinary CodecID;
+ CBinary CodecPrivate;
+ CUTF8 CodecName;
+ CUTF8 CodecSettings;
+ CANSI CodecInfoURL;
+ CANSI CodecDownloadURL;
+ CUInt CodecDecodeAll;
+ CUInt TrackOverlay;
+ CUInt DefaultDuration;
+ enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
+ int DescType;
+ Video v;
+ Audio a;
+
+ TrackEntry(DWORD id = 0xAE);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Track : public CID
+{
+public:
+ CNode<TrackEntry> TrackEntries;
+
+ Track(DWORD id = 0x1654AE6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class CBlock : public CID
+{
+public:
+ CLength TrackNumber;
+ REFERENCE_TIME TimeCode, TimeCodeStop;
+ CNode<CBinary> BlockData;
+
+ CBlock(DWORD id = 0xA1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class BlockGroup : public CID
+{
+public:
+ CUInt BlockDuration;
+ CUInt ReferencePriority;
+ CInt ReferenceBlock;
+ CInt ReferenceVirtual;
+ CBinary CodecState;
+ CBlock Block;
// CNode<TimeSlice> TimeSlices;
- BlockGroup(DWORD id = 0xA0);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+ BlockGroup(DWORD id = 0xA0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class Cluster : public CID
- {
- public:
- CUInt TimeCode, Position, PrevSize;
- CNode<BlockGroup> BlockGroups;
+class Cluster : public CID
+{
+public:
+ CUInt TimeCode, Position, PrevSize;
+ CNode<BlockGroup> BlockGroups;
- Cluster(DWORD id = 0x1F43B675);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+ Cluster(DWORD id = 0x1F43B675);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
/* class CueReference : public CID
{
@@ -295,93 +324,95 @@ namespace MatroskaWriter
HRESULT Write(IStream* pStream);
};
*/
- class CueTrackPosition : public CID
- {
- public:
- CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
+class CueTrackPosition : public CID
+{
+public:
+ CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
// CNode<CueReference> CueReferences;
- CueTrackPosition(DWORD id = 0xB7);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class CuePoint : public CID
- {
- public:
- CUInt CueTime;
- CNode<CueTrackPosition> CueTrackPositions;
-
- CuePoint(DWORD id = 0xBB);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Cue : public CID
- {
- public:
- CNode<CuePoint> CuePoints;
-
- Cue(DWORD id = 0x1C53BB6B);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class SeekID : public CID
- {
- CID m_id;
- public:
- SeekID(DWORD id = 0x53AB);
- void Set(DWORD id) {m_id = id;}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class SeekHead : public CID
- {
- public:
- SeekID ID;
- CUInt Position;
-
- SeekHead(DWORD id = 0x4DBB);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Seek : public CID
- {
- public:
- CNode<SeekHead> SeekHeads;
-
- Seek(DWORD id = 0x114D9B74);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
-
- class Segment : public CID
- {
- public:
- Segment(DWORD id = 0x18538067);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+ CueTrackPosition(DWORD id = 0xB7);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class Tags : public CID
- {
- public:
- // TODO
+class CuePoint : public CID
+{
+public:
+ CUInt CueTime;
+ CNode<CueTrackPosition> CueTrackPositions;
- Tags(DWORD id = 0x1254C367);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+ CuePoint(DWORD id = 0xBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
- class Void : public CID
- {
- QWORD m_len;
- public:
- Void(QWORD len, DWORD id = 0xEC);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
- };
+class Cue : public CID
+{
+public:
+ CNode<CuePoint> CuePoints;
+
+ Cue(DWORD id = 0x1C53BB6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class SeekID : public CID
+{
+ CID m_id;
+public:
+ SeekID(DWORD id = 0x53AB);
+ void Set(DWORD id) {
+ m_id = id;
+ }
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class SeekHead : public CID
+{
+public:
+ SeekID ID;
+ CUInt Position;
+
+ SeekHead(DWORD id = 0x4DBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Seek : public CID
+{
+public:
+ CNode<SeekHead> SeekHeads;
+
+ Seek(DWORD id = 0x114D9B74);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Segment : public CID
+{
+public:
+ Segment(DWORD id = 0x18538067);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Tags : public CID
+{
+public:
+ // TODO
+
+ Tags(DWORD id = 0x1254C367);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
+
+class Void : public CID
+{
+ QWORD m_len;
+public:
+ Void(QWORD len, DWORD id = 0xEC);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+};
}
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
index 4ed4217d6..68d3b89d2 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -38,8 +38,8 @@ const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
@@ -99,7 +99,7 @@ STDMETHODIMP CMatroskaMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void
*ppv = NULL;
- return
+ return
// QI(IAMFilterMiscFlags)
QI(IMediaSeeking)
QI(IMatroskaMuxer)
@@ -132,7 +132,7 @@ void CMatroskaMuxerFilter::AddInput()
CStringW name;
name.Format(L"Track %d", m_pInputs.GetCount()+1);
-
+
HRESULT hr;
CAutoPtr<CMatroskaMuxerInputPin> pPin(DNew CMatroskaMuxerInputPin(name, this, this, &hr));
m_pInputs.AddTail(pPin);
@@ -145,7 +145,7 @@ int CMatroskaMuxerFilter::GetPinCount()
CBasePin* CMatroskaMuxerFilter::GetPin(int n)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
if(n >= 0 && n < (int)m_pInputs.GetCount())
{
@@ -166,7 +166,7 @@ STDMETHODIMP CMatroskaMuxerFilter::Stop()
CAutoLock cAutoLock(this);
HRESULT hr;
-
+
if(FAILED(hr = __super::Stop()))
return hr;
@@ -218,9 +218,9 @@ STDMETHODIMP_(ULONG) CMatroskaMuxerFilter::GetMiscFlags()
STDMETHODIMP CMatroskaMuxerFilter::GetCapabilities(DWORD* pCapabilities)
{
- return pCapabilities ? *pCapabilities =
- AM_SEEKING_CanGetDuration|
- AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
+ return pCapabilities ? *pCapabilities =
+ AM_SEEKING_CanGetDuration|
+ AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
}
STDMETHODIMP CMatroskaMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
{
@@ -231,35 +231,64 @@ STDMETHODIMP CMatroskaMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
caps &= *pCapabilities;
return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
}
-STDMETHODIMP CMatroskaMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
-STDMETHODIMP CMatroskaMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
-STDMETHODIMP CMatroskaMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
-STDMETHODIMP CMatroskaMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
-STDMETHODIMP CMatroskaMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CMatroskaMuxerFilter::IsFormatSupported(const GUID* pFormat) {
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
+}
+STDMETHODIMP CMatroskaMuxerFilter::QueryPreferredFormat(GUID* pFormat) {
+ return GetTimeFormat(pFormat);
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetTimeFormat(GUID* pFormat) {
+ return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
+}
+STDMETHODIMP CMatroskaMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {
+ return IsFormatSupported(pFormat);
+}
+STDMETHODIMP CMatroskaMuxerFilter::SetTimeFormat(const GUID* pFormat) {
+ return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+}
STDMETHODIMP CMatroskaMuxerFilter::GetDuration(LONGLONG* pDuration)
{
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur; if(rt > *pDuration) *pDuration = rt;}
+ while(pos) {
+ REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur;
+ if(rt > *pDuration) *pDuration = rt;
+ }
return S_OK;
}
-STDMETHODIMP CMatroskaMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetStopPosition(LONGLONG* pStop) {
+ return E_NOTIMPL;
+}
STDMETHODIMP CMatroskaMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
{
CheckPointer(pCurrent, E_POINTER);
*pCurrent = m_rtCurrent;
return S_OK;
}
-STDMETHODIMP CMatroskaMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
-STDMETHODIMP CMatroskaMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::SetRate(double dRate) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetRate(double* pdRate) {
+ return E_NOTIMPL;
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {
+ return E_NOTIMPL;
+}
-// IMatroskaMuxer
+// IMatroskaMuxer
STDMETHODIMP CMatroskaMuxerFilter::CorrectTimeOffset(bool fNegative, bool fPositive)
{
@@ -290,7 +319,7 @@ ULONGLONG SetStreamPosition(IStream* pStream, ULONGLONG seekpos)
DWORD CMatroskaMuxerFilter::ThreadProc()
{
CComQIPtr<IStream> pStream;
-
+
if(!m_pOutput || !(pStream = m_pOutput->GetConnected()))
{
while(1)
@@ -359,26 +388,26 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
seek.SeekHeads.AddTail(sh);
UINT64 TrackNumber = 0;
-/*
- CNode<Track> Tracks;
- CAutoPtr<Track> pT(DNew Track());
- POSITION pos = m_pInputs.GetHeadPosition();
- for(int i = 1; pos; i++)
- {
- CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) continue;
-
- CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
- *pTE = *pPin->GetTrackEntry();
- if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
- TrackNumber = pTE->TrackNumber;
- pT->TrackEntries.AddTail(pTE);
- }
- Tracks.AddTail(pT);
- Tracks.Write(pStream);
+ /*
+ CNode<Track> Tracks;
+ CAutoPtr<Track> pT(DNew Track());
+ POSITION pos = m_pInputs.GetHeadPosition();
+ for(int i = 1; pos; i++)
+ {
+ CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) continue;
+
+ CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
+ *pTE = *pPin->GetTrackEntry();
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ TrackNumber = pTE->TrackNumber;
+ pT->TrackEntries.AddTail(pTE);
+ }
+ Tracks.AddTail(pT);
+ Tracks.Write(pStream);
- if(TrackNumber == 0) TrackNumber = 1;
-*/
+ if(TrackNumber == 0) TrackNumber = 1;
+ */
bool fTracksWritten = false;
//
@@ -454,7 +483,10 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
if(pTmp->m_blocks.GetCount() > 0)
{
REFERENCE_TIME rt = pTmp->m_blocks.GetHead()->Block.TimeCode;
- if(rt < rtMin) {rtMin = rt; pPin = pTmp;}
+ if(rt < rtMin) {
+ rtMin = rt;
+ pPin = pTmp;
+ }
}
}
}
@@ -481,7 +513,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
*pTE = *pPin->GetTrackEntry();
- if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
TrackNumber = pTE->TrackNumber;
pT->TrackEntries.AddTail(pTE);
}
@@ -514,14 +546,17 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
b->Block.TimeCode -= firstTimeCode;
b->Block.TimeCodeStop -= firstTimeCode;
-/*
-TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n"),
- GetTrackNumber(pPin),
- (INT64)b->Block.TimeCode, (INT64)b->Block.TimeCodeStop, (UINT64)b->BlockDuration,
- (int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
- b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
-*/
- if(b->Block.TimeCode < SHRT_MIN /*0*/) {ASSERT(0); continue;}
+ /*
+ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n"),
+ GetTrackNumber(pPin),
+ (INT64)b->Block.TimeCode, (INT64)b->Block.TimeCodeStop, (UINT64)b->BlockDuration,
+ (int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
+ b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
+ */
+ if(b->Block.TimeCode < SHRT_MIN /*0*/) {
+ ASSERT(0);
+ continue;
+ }
while((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode)
{
@@ -600,7 +635,7 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n")
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
- tags.Write(pStream);
+ tags.Write(pStream);
}
SetStreamPosition(pStream, voidpos);
@@ -666,13 +701,13 @@ STDMETHODIMP CMatroskaMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, vo
{
CheckPointer(ppv, E_POINTER);
- return
+ return
__super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMatroskaMuxerInputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Video && (pmt->formattype == FORMAT_VideoInfo
+ return pmt->majortype == MEDIATYPE_Video && (pmt->formattype == FORMAT_VideoInfo
|| pmt->formattype == FORMAT_VideoInfo2)
// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG1Payload && pmt->formattype == FORMAT_MPEGVideo
// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG2_VIDEO && pmt->formattype == FORMAT_MPEG2_VIDEO
@@ -730,7 +765,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
{
m_pTE->TrackType.Set(TrackEntry::TypeVideo);
- if(m_mt.formattype == FORMAT_VideoInfo
+ if(m_mt.formattype == FORMAT_VideoInfo
&& m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
|| m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40)
{
@@ -745,12 +780,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER));
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER), m_pTE->CodecPrivate.GetCount());
}
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
}
else if(m_mt.formattype == FORMAT_VideoInfo2)
{
@@ -760,12 +795,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER2));
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER2), m_pTE->CodecPrivate.GetCount());
}
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
}
@@ -784,12 +819,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader));
memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
hr = S_OK;
}
@@ -807,7 +842,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
hr = S_OK;
}
@@ -825,50 +860,50 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
// m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
// m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
if(vih->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
-
- hr = S_OK;
- }
-/*
- else if(m_mt.formattype == FORMAT_MPEGVideo)
- {
- m_pTE->CodecID.Set("V_DSHOW/MPEG1VIDEO"); // V_MPEG1
-
- MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(pm1vi->hdr.AvgTimePerFrame*100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(pm1vi->hdr.bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(pm1vi->hdr.bmiHeader.biHeight));
- if(pm1vi->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm1vi->hdr.AvgTimePerFrame));
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
hr = S_OK;
}
- else if(m_mt.formattype == FORMAT_MPEG2_VIDEO)
- {
- m_pTE->CodecID.Set("V_DSHOW/MPEG2VIDEO"); // V_MPEG2
-
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(pm2vi->hdr.AvgTimePerFrame*100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(pm2vi->hdr.bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(pm2vi->hdr.bmiHeader.biHeight));
- if(pm2vi->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm2vi->hdr.AvgTimePerFrame));
-
- hr = S_OK;
- }
-*/
+ /*
+ else if(m_mt.formattype == FORMAT_MPEGVideo)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG1VIDEO"); // V_MPEG1
+
+ MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm1vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm1vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm1vi->hdr.bmiHeader.biHeight));
+ if(pm1vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm1vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG2VIDEO"); // V_MPEG2
+
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm2vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm2vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm2vi->hdr.bmiHeader.biHeight));
+ if(pm2vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm2vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ */
}
else if(m_mt.majortype == MEDIATYPE_Audio)
{
m_pTE->TrackType.Set(TrackEntry::TypeAudio);
- if(m_mt.formattype == FORMAT_WaveFormatEx
+ if(m_mt.formattype == FORMAT_WaveFormatEx
&& ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_AAC
&& m_mt.cbFormat >= sizeof(WAVEFORMATEX)+2)
{
@@ -903,11 +938,21 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
switch(profile)
{
default:
- case 0: m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN"); break;
- case 1: m_pTE->CodecID.Set("A_AAC/MPEG2/LC"); break;
- case 2: m_pTE->CodecID.Set("A_AAC/MPEG2/SSR"); break;
- case 3: m_pTE->CodecID.Set("A_AAC/MPEG4/LTP"); break;
- case 4: m_pTE->CodecID.Set("A_AAC/MPEG4/LC/SBR"); break;
+ case 0:
+ m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN");
+ break;
+ case 1:
+ m_pTE->CodecID.Set("A_AAC/MPEG2/LC");
+ break;
+ case 2:
+ m_pTE->CodecID.Set("A_AAC/MPEG2/SSR");
+ break;
+ case 3:
+ m_pTE->CodecID.Set("A_AAC/MPEG4/LTP");
+ break;
+ case 4:
+ m_pTE->CodecID.Set("A_AAC/MPEG4/LC/SBR");
+ break;
}
ASSERT(channels == wfe->nChannels);
@@ -918,8 +963,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
&& ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3)
{
m_pTE->CodecID.Set("A_AC3");
@@ -931,8 +976,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
&& ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS)
{
m_pTE->CodecID.Set("A_DTS");
@@ -964,7 +1009,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
hr = S_OK;
}
- else if(m_mt.formattype == FORMAT_WaveFormatEx
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
&& (m_mt.subtype == MEDIASUBTYPE_14_4
|| m_mt.subtype == MEDIASUBTYPE_28_8
|| m_mt.subtype == MEDIASUBTYPE_ATRC
@@ -973,7 +1018,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
|| m_mt.subtype == MEDIASUBTYPE_SIPR))
{
CStringA id;
- id.Format("A_REAL/%c%c%c%c",
+ id.Format("A_REAL/%c%c%c%c",
(char)((m_mt.subtype.Data1>>0)&0xff),
(char)((m_mt.subtype.Data1>>8)&0xff),
(char)((m_mt.subtype.Data1>>16)&0xff),
@@ -1007,7 +1052,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- }
+ }
else if(m_mt.formattype == FORMAT_WaveFormatEx)
{
m_pTE->CodecID.Set("A_MS/ACM");
@@ -1058,14 +1103,14 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
for(int len = pvf2->HeaderSize[i]; len >= 0; len -= 255)
*dst++ = min(len, 255);
- memcpy(dst, src, pvf2->HeaderSize[0]);
- dst += pvf2->HeaderSize[0];
+ memcpy(dst, src, pvf2->HeaderSize[0]);
+ dst += pvf2->HeaderSize[0];
src += pvf2->HeaderSize[0];
- memcpy(dst, src, pvf2->HeaderSize[1]);
- dst += pvf2->HeaderSize[1];
+ memcpy(dst, src, pvf2->HeaderSize[1]);
+ dst += pvf2->HeaderSize[1];
src += pvf2->HeaderSize[1];
- memcpy(dst, src, pvf2->HeaderSize[2]);
- dst += pvf2->HeaderSize[2];
+ memcpy(dst, src, pvf2->HeaderSize[2]);
+ dst += pvf2->HeaderSize[2];
src += pvf2->HeaderSize[2];
ASSERT(src <= m_mt.pbFormat + m_mt.cbFormat);
@@ -1152,7 +1197,10 @@ STDMETHODIMP CMatroskaMuxerInputPin::EndFlush()
STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
{
- if(m_fEndOfStreamReceived) {/*ASSERT(0);*/ return S_FALSE;}
+ if(m_fEndOfStreamReceived) {
+ /*ASSERT(0);*/
+ return S_FALSE;
+ }
CAutoLock cAutoLock(&m_csReceive);
@@ -1192,14 +1240,14 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
// rtStart += m_tStart;
// rtStop += m_tStart;
-/**/
- TRACE(_T("Received (%d): %I64d-%I64d (c=%d, co=%dms), len=%d, d%d p%d s%d\n"),
- (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this),
- rtStart, rtStop, (int)((rtStart/10000)/MAXCLUSTERTIME), (int)((rtStart/10000)%MAXCLUSTERTIME),
- len,
- pSample->IsDiscontinuity() == S_OK ? 1 : 0,
- pSample->IsPreroll() == S_OK ? 1 : 0,
- pSample->IsSyncPoint() == S_OK ? 1 : 0);
+ /**/
+ TRACE(_T("Received (%d): %I64d-%I64d (c=%d, co=%dms), len=%d, d%d p%d s%d\n"),
+ (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this),
+ rtStart, rtStop, (int)((rtStart/10000)/MAXCLUSTERTIME), (int)((rtStart/10000)%MAXCLUSTERTIME),
+ len,
+ pSample->IsDiscontinuity() == S_OK ? 1 : 0,
+ pSample->IsPreroll() == S_OK ? 1 : 0,
+ pSample->IsSyncPoint() == S_OK ? 1 : 0);
if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3)
{
@@ -1225,26 +1273,26 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
for(int i = 0; i < 3; i++)
{
memcpy(dst, m_pVorbisHdrs[i]->GetData(), m_pVorbisHdrs[i]->GetCount());
- dst += m_pVorbisHdrs[i]->GetCount();
+ dst += m_pVorbisHdrs[i]->GetCount();
}
}
return S_OK;
}
- if(m_mt.formattype == FORMAT_WaveFormatEx
+ if(m_mt.formattype == FORMAT_WaveFormatEx
&& (((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM
|| ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3))
pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
CAutoPtr<BlockGroup> b(DNew BlockGroup());
/*
- // TODO: test this with a longer capture (pcm, mp3)
- if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
- {
- TRACE(_T("!!! timestamp went backwards, dropping this frame !!! rtStart (%I64) < m_rtLastStart (%I64)"), rtStart, m_rtLastStart);
- return S_OK;
- }
+ // TODO: test this with a longer capture (pcm, mp3)
+ if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
+ {
+ TRACE(_T("!!! timestamp went backwards, dropping this frame !!! rtStart (%I64) < m_rtLastStart (%I64)"), rtStart, m_rtLastStart);
+ return S_OK;
+ }
*/
if((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/)
{
@@ -1308,39 +1356,39 @@ STDMETHODIMP CMatroskaMuxerOutputPin::NonDelegatingQueryInterface(REFIID riid, v
{
CheckPointer(ppv, E_POINTER);
- return
+ return
__super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
pProperties->cBuffers = 1;
pProperties->cbBuffer = 1;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
- if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
- ASSERT(Actual.cBuffers == pProperties->cBuffers);
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
- return NOERROR;
+ return NOERROR;
}
HRESULT CMatroskaMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
{
return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_Matroska
- ? S_OK
- : E_INVALIDARG;
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CMatroskaMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pLock);
+ CAutoLock cAutoLock(m_pLock);
if(iPosition < 0) return E_INVALIDARG;
if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
index 21f259901..4a29b8bb5 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -43,9 +43,11 @@ public:
virtual ~CMatroskaMuxerInputPin();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- MatroskaWriter::TrackEntry* GetTrackEntry() {return m_pTE;}
+ MatroskaWriter::TrackEntry* GetTrackEntry() {
+ return m_pTE;
+ }
REFERENCE_TIME m_rtDur;
@@ -53,17 +55,17 @@ public:
CAutoPtrList<MatroskaWriter::BlockGroup> m_blocks;
bool m_fEndOfStreamReceived;
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pPin);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pPin);
HRESULT Active(), Inactive();
- STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
STDMETHODIMP BeginFlush();
STDMETHODIMP EndFlush();
STDMETHODIMP Receive(IMediaSample* pSample);
- STDMETHODIMP EndOfStream();
+ STDMETHODIMP EndOfStream();
};
class CMatroskaMuxerOutputPin : public CBaseOutputPin
@@ -73,25 +75,26 @@ public:
virtual ~CMatroskaMuxerOutputPin();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
interface __declspec(uuid("38E2D43D-915D-493C-B373-888DB16EE3DC"))
-IMatroskaMuxer : public IUnknown
+IMatroskaMuxer :
+public IUnknown
{
STDMETHOD (CorrectTimeOffset) (bool fNegative, bool fPositive) = 0;
// TODO: chapters
};
class __declspec(uuid("1E1299A2-9D42-4F12-8791-D79E376F4143"))
-CMatroskaMuxerFilter
+ CMatroskaMuxerFilter
: public CBaseFilter
, public CCritSec
, public CAMThread
@@ -115,7 +118,7 @@ public:
virtual ~CMatroskaMuxerFilter();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
void AddInput();
UINT GetTrackNumber(CBasePin* pPin);
diff --git a/src/filters/muxer/MatroskaMuxer/resource.h b/src/filters/muxer/MatroskaMuxer/resource.h
index cfa5a212d..22bd5aaf8 100644
--- a/src/filters/muxer/MatroskaMuxer/resource.h
+++ b/src/filters/muxer/MatroskaMuxer/resource.h
@@ -3,7 +3,7 @@
// Used by MatroskaMuxer.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/muxer/MatroskaMuxer/stdafx.cpp b/src/filters/muxer/MatroskaMuxer/stdafx.cpp
index 6927dbf9c..4bbe643da 100644
--- a/src/filters/muxer/MatroskaMuxer/stdafx.cpp
+++ b/src/filters/muxer/MatroskaMuxer/stdafx.cpp
@@ -1,29 +1,24 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.cpp : source file that includes just the standard includes
-// MatroskaMuxer.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/src/filters/muxer/MatroskaMuxer/stdafx.h b/src/filters/muxer/MatroskaMuxer/stdafx.h
index 22cb54295..a24b77625 100644
--- a/src/filters/muxer/MatroskaMuxer/stdafx.h
+++ b/src/filters/muxer/MatroskaMuxer/stdafx.h
@@ -1,28 +1,24 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
#pragma once
#include "../../../DSUtil/SharedInclude.h"
@@ -35,9 +31,7 @@
#endif
#include <afx.h>
-#include <afxwin.h> // MFC core and standard components
-
-// TODO: reference additional headers your program requires here
+#include <afxwin.h> // MFC core and standard components
#include <dshow.h>
#include <streams.h>
diff --git a/src/filters/muxer/WavDest/WavDest.cpp b/src/filters/muxer/WavDest/WavDest.cpp
index ff3085f24..9cd6e2833 100644
--- a/src/filters/muxer/WavDest/WavDest.cpp
+++ b/src/filters/muxer/WavDest/WavDest.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -39,8 +39,8 @@ const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
@@ -50,7 +50,7 @@ const AMOVIESETUP_FILTER sudFilter[] =
CFactoryTemplate g_Templates[] =
{
- {L"WavDest", &__uuidof(CWavDestFilter), CreateInstance<CWavDestFilter>, NULL, &sudFilter[0]}
+ {L"WavDest", &__uuidof(CWavDestFilter), CreateInstance<CWavDestFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
@@ -78,30 +78,30 @@ CFilterApp theApp;
CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
: CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
{
- if(SUCCEEDED(*phr))
- {
- if(CWavDestOutputPin* pOut = DNew CWavDestOutputPin(this, phr))
- {
- if(SUCCEEDED(*phr)) m_pOutput = pOut;
- else delete pOut;
- }
- else
- {
- *phr = E_OUTOFMEMORY;
+ if(SUCCEEDED(*phr))
+ {
+ if(CWavDestOutputPin* pOut = DNew CWavDestOutputPin(this, phr))
+ {
+ if(SUCCEEDED(*phr)) m_pOutput = pOut;
+ else delete pOut;
+ }
+ else
+ {
+ *phr = E_OUTOFMEMORY;
return;
- }
+ }
if(CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
- {
- if(SUCCEEDED(*phr)) m_pInput = pIn;
- else delete pIn;
- }
- else
- {
- *phr = E_OUTOFMEMORY;
+ {
+ if(SUCCEEDED(*phr)) m_pInput = pIn;
+ else delete pIn;
+ }
+ else
+ {
+ *phr = E_OUTOFMEMORY;
return;
- }
- }
+ }
+ }
}
CWavDestFilter::~CWavDestFilter()
@@ -110,78 +110,78 @@ CWavDestFilter::~CWavDestFilter()
HRESULT CWavDestFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return CheckInputType(mtIn);
+ return CheckInputType(mtIn);
}
HRESULT CWavDestFilter::Receive(IMediaSample* pSample)
{
- ULONG cbOld = m_cbWavData;
- HRESULT hr = CTransformFilter::Receive(pSample);
+ ULONG cbOld = m_cbWavData;
+ HRESULT hr = CTransformFilter::Receive(pSample);
- // don't update the count if Deliver() downstream fails.
- if(hr != S_OK)
+ // don't update the count if Deliver() downstream fails.
+ if(hr != S_OK)
m_cbWavData = cbOld;
- return hr;
+ return hr;
}
HRESULT CWavDestFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- REFERENCE_TIME rtStart, rtEnd;
-
- HRESULT hr = Copy(pIn, pOut);
- if(FAILED(hr))
+ REFERENCE_TIME rtStart, rtEnd;
+
+ HRESULT hr = Copy(pIn, pOut);
+ if(FAILED(hr))
return hr;
- // Prepare it for writing
- LONG lActual = pOut->GetActualDataLength();
+ // Prepare it for writing
+ LONG lActual = pOut->GetActualDataLength();
+
+ if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) // overflow
+ return E_FAIL;
- if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) // overflow
- return E_FAIL;
+ rtStart = m_cbWavData + m_cbHeader;
+ rtEnd = rtStart + lActual;
+ m_cbWavData += lActual;
- rtStart = m_cbWavData + m_cbHeader;
- rtEnd = rtStart + lActual;
- m_cbWavData += lActual;
+ EXECUTE_ASSERT(pOut->SetTime(&rtStart, &rtEnd) == S_OK);
- EXECUTE_ASSERT(pOut->SetTime(&rtStart, &rtEnd) == S_OK);
-
- return S_OK;
+ return S_OK;
}
HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
{
- BYTE* pSourceBuffer, * pDestBuffer;
- long lSourceSize = pSource->GetActualDataLength();
+ BYTE* pSourceBuffer, * pDestBuffer;
+ long lSourceSize = pSource->GetActualDataLength();
#ifdef DEBUG
- long lDestSize = pDest->GetSize();
- ASSERT(lDestSize >= lSourceSize);
+ long lDestSize = pDest->GetSize();
+ ASSERT(lDestSize >= lSourceSize);
#endif
-
- pSource->GetPointer(&pSourceBuffer);
- pDest->GetPointer(&pDestBuffer);
- CopyMemory((PVOID)pDestBuffer, (PVOID)pSourceBuffer, lSourceSize);
+ pSource->GetPointer(&pSourceBuffer);
+ pDest->GetPointer(&pDestBuffer);
+
+ CopyMemory((PVOID)pDestBuffer, (PVOID)pSourceBuffer, lSourceSize);
- // Copy the sample times
+ // Copy the sample times
- REFERENCE_TIME TimeStart, TimeEnd;
- if(NOERROR == pSource->GetTime(&TimeStart, &TimeEnd))
+ REFERENCE_TIME TimeStart, TimeEnd;
+ if(NOERROR == pSource->GetTime(&TimeStart, &TimeEnd))
pDest->SetTime(&TimeStart, &TimeEnd);
- LONGLONG MediaStart, MediaEnd;
- if(pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
+ LONGLONG MediaStart, MediaEnd;
+ if(pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
pDest->SetMediaTime(&MediaStart, &MediaEnd);
- // Copy the media type
- AM_MEDIA_TYPE* pMediaType;
- pSource->GetMediaType(&pMediaType);
- pDest->SetMediaType(pMediaType);
- DeleteMediaType(pMediaType);
+ // Copy the media type
+ AM_MEDIA_TYPE* pMediaType;
+ pSource->GetMediaType(&pMediaType);
+ pDest->SetMediaType(pMediaType);
+ DeleteMediaType(pMediaType);
- // Copy the actual data length
- long lDataLength = pSource->GetActualDataLength();
- pDest->SetActualDataLength(lDataLength);
+ // Copy the actual data length
+ long lDataLength = pSource->GetActualDataLength();
+ pDest->SetActualDataLength(lDataLength);
return NOERROR;
}
@@ -193,58 +193,58 @@ HRESULT CWavDestFilter::CheckInputType(const CMediaType* mtIn)
HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
- ASSERT(iPosition == 0 || iPosition == 1);
+ ASSERT(iPosition == 0 || iPosition == 1);
if(iPosition == 0)
{
- pMediaType->SetType(&MEDIATYPE_Stream);
- pMediaType->SetSubtype(&MEDIASUBTYPE_WAVE);
- return S_OK;
- }
+ pMediaType->SetType(&MEDIATYPE_Stream);
+ pMediaType->SetSubtype(&MEDIASUBTYPE_WAVE);
+ return S_OK;
+ }
- return VFW_S_NO_MORE_ITEMS;
+ return VFW_S_NO_MORE_ITEMS;
}
HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE)
+ if(m_pInput->IsConnected() == FALSE)
return E_UNEXPECTED;
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbAlign = 1;
-
- CComPtr<IMemAllocator> pInAlloc;
- ALLOCATOR_PROPERTIES InProps;
- if(SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
- && SUCCEEDED(hr = pInAlloc->GetProperties(&InProps)))
- {
+ pProperties->cBuffers = 1;
+ pProperties->cbAlign = 1;
+
+ CComPtr<IMemAllocator> pInAlloc;
+ ALLOCATOR_PROPERTIES InProps;
+ if(SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
+ && SUCCEEDED(hr = pInAlloc->GetProperties(&InProps)))
+ {
pProperties->cbBuffer = InProps.cbBuffer;
- }
+ }
else
{
return hr;
}
- ASSERT(pProperties->cbBuffer);
+ ASSERT(pProperties->cbBuffer);
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties,&Actual)))
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties,&Actual)))
return hr;
- ASSERT(Actual.cBuffers == 1);
+ ASSERT(Actual.cBuffers == 1);
- if(pProperties->cBuffers > Actual.cBuffers
- || pProperties->cbBuffer > Actual.cbBuffer)
+ if(pProperties->cBuffers > Actual.cBuffers
+ || pProperties->cbBuffer > Actual.cbBuffer)
{
return E_FAIL;
- }
+ }
- return NOERROR;
+ return NOERROR;
}
// Compute the header size to allow space for us to write it at the end.
@@ -257,59 +257,59 @@ HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPER
HRESULT CWavDestFilter::StartStreaming()
{
- // leave space for the header
- m_cbHeader = sizeof(RIFFLIST) +
- sizeof(RIFFCHUNK) +
- m_pInput->CurrentMediaType().FormatLength() +
- sizeof(RIFFCHUNK);
-
- m_cbWavData = 0;
-
- return S_OK;
+ // leave space for the header
+ m_cbHeader = sizeof(RIFFLIST) +
+ sizeof(RIFFCHUNK) +
+ m_pInput->CurrentMediaType().FormatLength() +
+ sizeof(RIFFCHUNK);
+
+ m_cbWavData = 0;
+
+ return S_OK;
}
HRESULT CWavDestFilter::StopStreaming()
{
- IStream* pStream;
- if (m_pOutput->IsConnected() == FALSE)
- return E_FAIL;
-
- IPin* pDwnstrmInputPin = m_pOutput->GetConnected();
-
- if (!pDwnstrmInputPin)
- return E_FAIL;
-
- HRESULT hr = ((IMemInputPin *) pDwnstrmInputPin)->QueryInterface(IID_IStream, (void **)&pStream);
- if(SUCCEEDED(hr))
- {
- BYTE *pb = (BYTE *)_alloca(m_cbHeader);
-
- RIFFLIST *pRiffWave = (RIFFLIST *)pb;
- RIFFCHUNK *pRiffFmt = (RIFFCHUNK *)(pRiffWave + 1);
- RIFFCHUNK *pRiffData = (RIFFCHUNK *)(((BYTE *)(pRiffFmt + 1)) + m_pInput->CurrentMediaType().FormatLength());
-
- pRiffData->fcc = FCC('data');
- pRiffData->cb = m_cbWavData;
-
- pRiffFmt->fcc = FCC('fmt ');
- pRiffFmt->cb = m_pInput->CurrentMediaType().FormatLength();
- CopyMemory(pRiffFmt + 1, m_pInput->CurrentMediaType().Format(), pRiffFmt->cb);
-
- pRiffWave->fcc = FCC('RIFF');
- pRiffWave->cb = m_cbWavData + m_cbHeader - sizeof(RIFFCHUNK);
- pRiffWave->fccListType = FCC('WAVE');
-
- LARGE_INTEGER li;
- ZeroMemory(&li, sizeof(li));
-
- hr = pStream->Seek(li, STREAM_SEEK_SET, 0);
- if(SUCCEEDED(hr)) {
- hr = pStream->Write(pb, m_cbHeader, 0);
- }
- pStream->Release();
- }
-
- return hr;
+ IStream* pStream;
+ if (m_pOutput->IsConnected() == FALSE)
+ return E_FAIL;
+
+ IPin* pDwnstrmInputPin = m_pOutput->GetConnected();
+
+ if (!pDwnstrmInputPin)
+ return E_FAIL;
+
+ HRESULT hr = ((IMemInputPin *) pDwnstrmInputPin)->QueryInterface(IID_IStream, (void **)&pStream);
+ if(SUCCEEDED(hr))
+ {
+ BYTE *pb = (BYTE *)_alloca(m_cbHeader);
+
+ RIFFLIST *pRiffWave = (RIFFLIST *)pb;
+ RIFFCHUNK *pRiffFmt = (RIFFCHUNK *)(pRiffWave + 1);
+ RIFFCHUNK *pRiffData = (RIFFCHUNK *)(((BYTE *)(pRiffFmt + 1)) + m_pInput->CurrentMediaType().FormatLength());
+
+ pRiffData->fcc = FCC('data');
+ pRiffData->cb = m_cbWavData;
+
+ pRiffFmt->fcc = FCC('fmt ');
+ pRiffFmt->cb = m_pInput->CurrentMediaType().FormatLength();
+ CopyMemory(pRiffFmt + 1, m_pInput->CurrentMediaType().Format(), pRiffFmt->cb);
+
+ pRiffWave->fcc = FCC('RIFF');
+ pRiffWave->cb = m_cbWavData + m_cbHeader - sizeof(RIFFCHUNK);
+ pRiffWave->fccListType = FCC('WAVE');
+
+ LARGE_INTEGER li;
+ ZeroMemory(&li, sizeof(li));
+
+ hr = pStream->Seek(li, STREAM_SEEK_SET, 0);
+ if(SUCCEEDED(hr)) {
+ hr = pStream->Write(pb, m_cbHeader, 0);
+ }
+ pStream->Release();
+ }
+
+ return hr;
}
CWavDestOutputPin::CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr)
@@ -319,13 +319,13 @@ CWavDestOutputPin::CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr)
STDMETHODIMP CWavDestOutputPin::EnumMediaTypes(IEnumMediaTypes** ppEnum)
{
- return CBaseOutputPin::EnumMediaTypes(ppEnum);
+ return CBaseOutputPin::EnumMediaTypes(ppEnum);
}
HRESULT CWavDestOutputPin::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_WAVE)
- return S_OK;
- else
- return S_FALSE;
+ if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_WAVE)
+ return S_OK;
+ else
+ return S_FALSE;
}
diff --git a/src/filters/muxer/WavDest/WavDest.h b/src/filters/muxer/WavDest/WavDest.h
index cd1054ca9..08f723382 100644
--- a/src/filters/muxer/WavDest/WavDest.h
+++ b/src/filters/muxer/WavDest/WavDest.h
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,39 +26,39 @@
class CWavDestOutputPin : public CTransformOutputPin
{
public:
- CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr);
+ CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr);
- STDMETHODIMP EnumMediaTypes(IEnumMediaTypes** ppEnum);
- HRESULT CheckMediaType(const CMediaType* pmt);
+ STDMETHODIMP EnumMediaTypes(IEnumMediaTypes** ppEnum);
+ HRESULT CheckMediaType(const CMediaType* pmt);
};
class __declspec(uuid("8685214E-4D32-4058-BE04-D01104F00B0C"))
-CWavDestFilter : public CTransformFilter
+ CWavDestFilter : public CTransformFilter
{
public:
- CWavDestFilter(LPUNKNOWN pUnk, HRESULT* pHr);
- ~CWavDestFilter();
+ CWavDestFilter(LPUNKNOWN pUnk, HRESULT* pHr);
+ ~CWavDestFilter();
DECLARE_IUNKNOWN;
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- HRESULT Receive(IMediaSample* pSample);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT Receive(IMediaSample* pSample);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType*mtIn, const CMediaType* mtOut);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType*mtIn, const CMediaType* mtOut);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
private:
- HRESULT Copy(IMediaSample* pSource, IMediaSample* pDest) const;
- HRESULT Transform(IMediaSample* pMediaSample);
- HRESULT Transform(AM_MEDIA_TYPE* pType, const signed char ContrastLevel) const;
+ HRESULT Copy(IMediaSample* pSource, IMediaSample* pDest) const;
+ HRESULT Transform(IMediaSample* pMediaSample);
+ HRESULT Transform(AM_MEDIA_TYPE* pType, const signed char ContrastLevel) const;
- ULONG m_cbWavData;
- ULONG m_cbHeader;
+ ULONG m_cbWavData;
+ ULONG m_cbHeader;
};
diff --git a/src/filters/muxer/WavDest/stdafx.cpp b/src/filters/muxer/WavDest/stdafx.cpp
index e9267f937..d58a51550 100644
--- a/src/filters/muxer/WavDest/stdafx.cpp
+++ b/src/filters/muxer/WavDest/stdafx.cpp
@@ -1,29 +1,23 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.cpp : source file that includes just the standard includes
-// wavdest.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
#include "stdafx.h"
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/src/filters/muxer/WavDest/stdafx.h b/src/filters/muxer/WavDest/stdafx.h
index 2b6b600ac..811869bff 100644
--- a/src/filters/muxer/WavDest/stdafx.h
+++ b/src/filters/muxer/WavDest/stdafx.h
@@ -1,28 +1,24 @@
-/*
- * Copyright (C) 2003-2006 Gabest
- * http://www.gabest.org
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
#pragma once
#include "../../../DSUtil/SharedInclude.h"
@@ -35,6 +31,5 @@
#endif
#include <afx.h>
-#include <afxwin.h> // MFC core and standard components
+#include <afxwin.h> // MFC core and standard components
-// TODO: reference additional headers your program requires here