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>2011-01-10 03:05:13 +0300
committerXhmikosR <xhmikosr@users.sourceforge.net>2011-01-10 03:05:13 +0300
commit0eb98dcebf3ff5c8fbdc1235474c0d5640f9a04c (patch)
tree65e403462fdb55541e4a98358c824aa8a15b8027 /src/filters/source
parent93411f0c1eef8de213410b0544b246dd7086be74 (diff)
legacy branch: merge r2785-r2825,r2827 from trunk
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/legacy@2830 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/source')
-rw-r--r--src/filters/source/BaseSource/BaseSource.cpp82
-rw-r--r--src/filters/source/BaseSource/BaseSource.h61
-rw-r--r--src/filters/source/BaseSource/stdafx.cpp6
-rw-r--r--src/filters/source/BaseSource/stdafx.h6
-rw-r--r--src/filters/source/D2VSource/D2VSource.cpp150
-rw-r--r--src/filters/source/D2VSource/D2VSource.h20
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.cpp239
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.h18
-rw-r--r--src/filters/source/DTSAC3Source/stdafx.cpp6
-rw-r--r--src/filters/source/DTSAC3Source/stdafx.h6
-rw-r--r--src/filters/source/FLICSource/FLICSource.cpp437
-rw-r--r--src/filters/source/FLICSource/FLICSource.h52
-rw-r--r--src/filters/source/FLICSource/stdafx.cpp6
-rw-r--r--src/filters/source/FLICSource/stdafx.h6
-rw-r--r--src/filters/source/FlacSource/FlacSource.cpp136
-rw-r--r--src/filters/source/FlacSource/FlacSource.h24
-rw-r--r--src/filters/source/FlacSource/stdafx.cpp6
-rw-r--r--src/filters/source/FlacSource/stdafx.h6
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.cpp365
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.h122
-rw-r--r--src/filters/source/ShoutcastSource/stdafx.cpp6
-rw-r--r--src/filters/source/ShoutcastSource/stdafx.h6
-rw-r--r--src/filters/source/SubtitleSource/SubtitleSource.cpp388
-rw-r--r--src/filters/source/SubtitleSource/SubtitleSource.h42
-rw-r--r--src/filters/source/SubtitleSource/stdafx.cpp6
-rw-r--r--src/filters/source/SubtitleSource/stdafx.h6
26 files changed, 1151 insertions, 1057 deletions
diff --git a/src/filters/source/BaseSource/BaseSource.cpp b/src/filters/source/BaseSource/BaseSource.cpp
index 3c42d2732..1c26cb6ba 100644
--- a/src/filters/source/BaseSource/BaseSource.cpp
+++ b/src/filters/source/BaseSource/BaseSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -31,7 +31,7 @@
// CBaseStream
//
-CBaseStream::CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr)
+CBaseStream::CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr)
: CSourceStream(name, phr, pParent, L"Output")
, CSourceSeeking(name, (IPin*)this, phr, &m_cSharedState)
, m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
@@ -50,21 +50,20 @@ CBaseStream::~CBaseStream()
STDMETHODIMP CBaseStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CBaseStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
+ if(ThreadExists()) {
// next time around the loop, the worker thread will
// pick up the position change.
// We need to flush all the existing data - we must do that here
// as our thread will probably be blocked in GetBuffer otherwise
-
+
m_bFlushing = TRUE;
DeliverBeginFlush();
@@ -73,7 +72,7 @@ void CBaseStream::UpdateFromSeek()
// complete the flush
DeliverEndFlush();
- m_bFlushing = FALSE;
+ m_bFlushing = FALSE;
// restart
Run();
@@ -82,8 +81,9 @@ void CBaseStream::UpdateFromSeek()
HRESULT CBaseStream::SetRate(double dRate)
{
- if(dRate <= 0)
+ if(dRate <= 0) {
return E_INVALIDARG;
+ }
{
CAutoLock lock(CSourceSeeking::m_pLock);
@@ -97,45 +97,46 @@ HRESULT CBaseStream::SetRate(double dRate)
HRESULT CBaseStream::OnThreadStartPlay()
{
- m_bDiscontinuity = TRUE;
- return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
}
HRESULT CBaseStream::ChangeStart()
{
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
m_rtSampleTime = 0;
m_rtPosition = m_rtStart;
- }
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CBaseStream::ChangeStop()
{
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop)
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop) {
return S_OK;
- }
+ }
+ }
- // We're already past the new stop time -- better flush the graph.
- UpdateFromSeek();
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CBaseStream::OnThreadCreate()
{
- CAutoLock cAutoLockShared(&m_cSharedState);
+ CAutoLock cAutoLockShared(&m_cSharedState);
- m_rtSampleTime = 0;
- m_rtPosition = m_rtStart;
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
- return CSourceStream::OnThreadCreate();
+ return CSourceStream::OnThreadCreate();
}
HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
@@ -145,36 +146,39 @@ HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
{
CAutoLock cAutoLockShared(&m_cSharedState);
- if(m_rtPosition >= m_rtStop)
+ if(m_rtPosition >= m_rtStop) {
return S_FALSE;
+ }
BYTE* pOut = NULL;
- if(FAILED(hr = pSample->GetPointer(&pOut)) || !pOut)
+ if(FAILED(hr = pSample->GetPointer(&pOut)) || !pOut) {
return S_FALSE;
+ }
int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
long len = pSample->GetSize();
hr = FillBuffer(pSample, nFrame, pOut, len);
- if(hr != S_OK) return hr;
+ if(hr != S_OK) {
+ return hr;
+ }
pSample->SetActualDataLength(len);
REFERENCE_TIME rtStart, rtStop;
- // The sample times are modified by the current rate.
- rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
- rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
+ // The sample times are modified by the current rate.
+ rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
+ rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
pSample->SetTime(&rtStart, &rtStop);
- m_rtSampleTime += m_AvgTimePerFrame;
- m_rtPosition += m_AvgTimePerFrame;
+ m_rtSampleTime += m_AvgTimePerFrame;
+ m_rtPosition += m_AvgTimePerFrame;
}
pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity)
- {
+ if(m_bDiscontinuity) {
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity = FALSE;
}
diff --git a/src/filters/source/BaseSource/BaseSource.h b/src/filters/source/BaseSource/BaseSource.h
index b305defdc..fea572b3c 100644
--- a/src/filters/source/BaseSource/BaseSource.h
+++ b/src/filters/source/BaseSource/BaseSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -34,17 +34,17 @@ protected:
public:
CBaseSource(TCHAR* name, LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
- : CSource(name, lpunk, clsid)
- {
- if(phr) *phr = S_OK;
+ : CSource(name, lpunk, clsid) {
+ if(phr) {
+ *phr = S_OK;
+ }
}
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IFileSourceFilter)
QI(IAMFilterMiscFlags)
__super::NonDelegatingQueryInterface(riid, ppv);
@@ -52,33 +52,37 @@ public:
// IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
- {
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt) {
// TODO: destroy any already existing pins and create new, now we are just going die nicely instead of doing it :)
- if(GetPinCount() > 0)
+ if(GetPinCount() > 0) {
return VFW_E_ALREADY_CONNECTED;
+ }
HRESULT hr = S_OK;
- if(!(DNew TStream(pszFileName, this, &hr)))
+ if(!(DNew TStream(pszFileName, this, &hr))) {
return E_OUTOFMEMORY;
+ }
- if(FAILED(hr))
+ if(FAILED(hr)) {
return hr;
+ }
m_fn = pszFileName;
return S_OK;
}
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
- {
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) {
size_t nCount;
- if(!ppszFileName) return E_POINTER;
-
+ if(!ppszFileName) {
+ return E_POINTER;
+ }
+
nCount = m_fn.GetLength()+1;
*ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount*sizeof(WCHAR));
- if(!(*ppszFileName))
+ if(!(*ppszFileName)) {
return E_OUTOFMEMORY;
+ }
wcscpy_s(*ppszFileName, nCount, m_fn);
@@ -87,13 +91,12 @@ public:
// IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags()
- {
+ STDMETHODIMP_(ULONG) GetMiscFlags() {
return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
};
-class CBaseStream
+class CBaseStream
: public CSourceStream
, public CSourceSeeking
{
@@ -113,18 +116,20 @@ private:
STDMETHODIMP SetRate(double dRate);
HRESULT ChangeStart();
- HRESULT ChangeStop();
- HRESULT ChangeRate() {return S_OK;}
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {
+ return S_OK;
+ }
public:
- CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr);
+ CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr);
virtual ~CBaseStream();
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT FillBuffer(IMediaSample* pSample);
- virtual HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/) = 0;
+ virtual HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/) = 0;
STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/BaseSource/stdafx.cpp b/src/filters/source/BaseSource/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/BaseSource/stdafx.cpp
+++ b/src/filters/source/BaseSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/BaseSource/stdafx.h b/src/filters/source/BaseSource/stdafx.h
index 4811c9499..eb1a0a29e 100644
--- a/src/filters/source/BaseSource/stdafx.h
+++ b/src/filters/source/BaseSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/D2VSource/D2VSource.cpp b/src/filters/source/D2VSource/D2VSource.cpp
index 1745e381d..ec59fad28 100644
--- a/src/filters/source/D2VSource/D2VSource.cpp
+++ b/src/filters/source/D2VSource/D2VSource.cpp
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* 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.
@@ -24,23 +24,19 @@
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CD2VSource), L"MPC - D2VSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
};
@@ -49,15 +45,15 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
_T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
_T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".d2v"),
+ _T("Media Type\\Extensions"), _T(".d2v"),
_T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
return AMovieDllRegisterServer2(TRUE);
@@ -84,7 +80,9 @@ CFilterApp theApp;
CD2VSource::CD2VSource(LPUNKNOWN lpunk, HRESULT* phr)
: CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) {
+ *phr = S_OK;
+ }
}
CD2VSource::~CD2VSource()
@@ -95,35 +93,40 @@ CD2VSource::~CD2VSource()
// CD2VStream
//
-CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
+CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
: CBaseStream(NAME("D2VSourceStream"), pParent, phr)
, m_pFrameBuffer(NULL)
{
CAutoLock cAutoLock(&m_cSharedState);
m_pDecoder.Attach(DNew CMPEG2Dec());
- if(!m_pDecoder)
- {
- if(phr) *phr = E_OUTOFMEMORY;
+ if(!m_pDecoder) {
+ if(phr) {
+ *phr = E_OUTOFMEMORY;
+ }
return;
}
- if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
- {
- if(phr) *phr = E_FAIL;
+ if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2)) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
- if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4))
- {
- if(phr) *phr = E_OUTOFMEMORY;
+ if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4)) {
+ if(phr) {
+ *phr = E_OUTOFMEMORY;
+ }
return;
}
m_AvgTimePerFrame = 10000000000i64/m_pDecoder->VF_FrameRate;
m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_pDecoder->VF_FrameLimit;
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ if(phr) {
+ *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ }
}
CD2VStream::~CD2VStream()
@@ -133,37 +136,42 @@ CD2VStream::~CD2VStream()
HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
-// CAutoLock cAutoLock(m_pFilter->pStateLock());
+ // CAutoLock cAutoLock(m_pFilter->pStateLock());
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
int w, h, bpp;
- if(!GetDim(w, h, bpp))
+ if(!GetDim(w, h, bpp)) {
return E_FAIL;
+ }
pProperties->cBuffers = 1;
pProperties->cbBuffer = w*h*bpp>>3;
- 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 CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
{
- if(!m_pDecoder)
+ if(!m_pDecoder) {
return S_FALSE;
+ }
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
SetMediaType(&mt);
@@ -171,8 +179,9 @@ HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, lo
}
int w, h, bpp;
- if(!GetDim(w, h, bpp))
+ if(!GetDim(w, h, bpp)) {
return S_FALSE;
+ }
BYTE* pIn = m_pFrameBuffer;
@@ -183,10 +192,9 @@ HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, lo
m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
- for(int y = 0, p = min(pitchIn, pitchOut);
- y < h;
- y++, pIn += pitchIn, pOut += pitchOut)
- {
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pIn += pitchIn, pOut += pitchOut) {
memcpy(pOut, pIn, p);
}
@@ -197,15 +205,19 @@ HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, lo
HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pFilter->pStateLock());
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if(iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
- pmt->SetType(&MEDIATYPE_Video);
- pmt->SetSubtype(&MEDIASUBTYPE_YUY2);
- pmt->SetFormatType(&FORMAT_VideoInfo);
- pmt->SetTemporalCompression(FALSE);
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_YUY2);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ pmt->SetTemporalCompression(FALSE);
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
memset(vih, 0, sizeof(VIDEOINFOHEADER));
@@ -220,17 +232,17 @@ HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
- return NOERROR;
+ return NOERROR;
}
HRESULT CD2VStream::SetMediaType(const CMediaType* pmt)
{
- if(m_pDecoder)
- {
- if(pmt->subtype == MEDIASUBTYPE_YUY2)
+ if(m_pDecoder) {
+ if(pmt->subtype == MEDIASUBTYPE_YUY2) {
m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
- else
+ } else {
return E_FAIL;
+ }
}
return CSourceStream::SetMediaType(pmt);
@@ -239,20 +251,19 @@ HRESULT CD2VStream::SetMediaType(const CMediaType* pmt)
HRESULT CD2VStream::CheckMediaType(const CMediaType* pmt)
{
return pmt->majortype == MEDIATYPE_Video
- && pmt->subtype == MEDIASUBTYPE_YUY2
- && pmt->formattype == FORMAT_VideoInfo
- ? S_OK
- : E_INVALIDARG;
+ && pmt->subtype == MEDIASUBTYPE_YUY2
+ && pmt->formattype == FORMAT_VideoInfo
+ ? S_OK
+ : E_INVALIDARG;
}
STDMETHODIMP CD2VStream::Notify(IBaseFilter* pSender, Quality q)
{
- if(q.Late > 0 && q.Late < 100000000)
- {
+ if(q.Late > 0 && q.Late < 100000000) {
CAutoLock cAutoLockShared(&m_cSharedState);
- m_rtSampleTime += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
- m_rtPosition += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ m_rtSampleTime += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ m_rtPosition += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
}
return S_OK;
@@ -262,20 +273,15 @@ STDMETHODIMP CD2VStream::Notify(IBaseFilter* pSender, Quality q)
bool CD2VStream::GetDim(int& w, int& h, int& bpp)
{
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
+ if(m_mt.formattype == FORMAT_VideoInfo) {
w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
+ } else if(m_mt.formattype == FORMAT_VideoInfo2) {
w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else
- {
+ } else {
return(false);
}
diff --git a/src/filters/source/D2VSource/D2VSource.h b/src/filters/source/D2VSource/D2VSource.h
index d36f05956..6d38f3936 100644
--- a/src/filters/source/D2VSource/D2VSource.h
+++ b/src/filters/source/D2VSource/D2VSource.h
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* 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.
@@ -24,7 +24,7 @@
class CD2VStream;
class __declspec(uuid("47CE0591-C4D5-4b41-BED7-28F59AD76228"))
-CD2VSource : public CBaseSource<CD2VStream>
+ CD2VSource : public CBaseSource<CD2VStream>
{
public:
CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
@@ -42,15 +42,15 @@ private:
bool GetDim(int& w, int& h, int& bpp);
public:
- CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr);
+ CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr);
virtual ~CD2VStream();
- HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/);
+ HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/);
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT CheckMediaType(const CMediaType* pMediaType);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- HRESULT SetMediaType(const CMediaType* pmt);
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT SetMediaType(const CMediaType* pmt);
STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
index ea2c58ba2..98e61db08 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -30,21 +30,18 @@
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
{&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
{&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
{&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
#ifdef DDPLUS_ONLY
{&__uuidof(CDTSAC3Source), L"MPC - DD+ Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin}
#else
@@ -52,8 +49,7 @@ const AMOVIESETUP_FILTER sudFilter[] =
#endif
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDTSAC3Source>, NULL, &sudFilter[0]}
};
@@ -62,36 +58,36 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
_T("0"), _T("0,4,,7FFE8001"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
_T("1"), _T("0,2,,0B77"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
_T("2"), _T("0,2,,770B"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
_T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
#ifndef DDPLUS_ONLY
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".dts"),
+ _T("Media Type\\Extensions"), _T(".dts"),
_T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ac3"),
+ _T("Media Type\\Extensions"), _T(".ac3"),
_T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
#endif
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ddp"),
+ _T("Media Type\\Extensions"), _T(".ddp"),
_T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ec3"),
+ _T("Media Type\\Extensions"), _T(".ec3"),
_T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
return AMovieDllRegisterServer2(TRUE);
@@ -131,7 +127,7 @@ CDTSAC3Source::~CDTSAC3Source()
// CDTSAC3Stream
-CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
+CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
: CBaseStream(NAME("CDTSAC3Stream"), pParent, phr)
, m_nFileOffset(0)
{
@@ -143,25 +139,28 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
CString fn(wfn);
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone))
- {
- if(phr) *phr = E_FAIL;
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone)) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
DWORD id = 0;
if(m_file.Read(&id, sizeof(id)) != sizeof(id)
- || id != 0x0180FE7F && (WORD)id != 0x0b77 && (WORD)id != 0x770b)
- {
- if(phr) *phr = E_FAIL;
+ || id != 0x0180FE7F && (WORD)id != 0x0b77 && (WORD)id != 0x770b) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
- if(id == 0x0180FE7F)
- {
+ if(id == 0x0180FE7F) {
#ifdef DDPLUS_ONLY
-//Temporary patch to disable DTS source
- if(phr) *phr = E_FAIL;
+ //Temporary patch to disable DTS source
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
#endif
BYTE buff[8];
@@ -181,8 +180,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
UNUSED_ALWAYS(npcmsampleblocks);
UNUSED_ALWAYS(audiochannelarrangement);
- int freqtbl[] =
- {
+ int freqtbl[] = {
0,8000,16000,32000,
0,0,
11025,22050,44100,
@@ -191,8 +189,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
0,0
};
- int bitratetbl[] =
- {
+ int bitratetbl[] = {
32000,56000,64000,96000,112000,128000,192000,224000,
256000,320000,384000,448000,512000,576000,640000,754500,
960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
@@ -203,50 +200,50 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_nSamplesPerSec = freqtbl[freq];
m_nAvgBytesPerSec = (bitratetbl[transbitrate] + 4) / 8;
-// m_nBytesPerFrame = m_nAvgBytesPerSec*10.656063618290258449304174950298/1000 + 0.5;
+ // m_nBytesPerFrame = m_nAvgBytesPerSec*10.656063618290258449304174950298/1000 + 0.5;
m_nBytesPerFrame = framebytes*DTS_MAGIC_NUMBER;
- if (framebytes == 2012)
- {
+ if (framebytes == 2012) {
// DTS and DTS-HD tracks from HD DVD and Blu-Ray sources have framesizes of 2012 bytes
// but if we handle them mathematically "correctly", audio sync will slowly drift away
// we have to handle them as if they had 2013 bytes
m_AvgTimePerFrame = 10000000i64 * (2013*DTS_MAGIC_NUMBER) * 8 / bitratetbl[transbitrate];
- }
- else
+ } else {
m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[transbitrate];
+ }
m_subtype = MEDIASUBTYPE_DTS;
m_wFormatTag = WAVE_FORMAT_DVD_DTS;
m_streamid = 0x88;
- }
- else
- {
+ } else {
BYTE info, info1, bsid;
- if((BYTE)id == 0x77) m_file.Seek(1, CFile::current); // LE
+ if((BYTE)id == 0x77) {
+ m_file.Seek(1, CFile::current); // LE
+ }
m_file.Read(&info, 1);
m_file.Read(&info1, 1);
bsid = (info1>>3);
- if(bsid>=0 && bsid<=8) //AC3
- {
+ if(bsid>=0 && bsid<=8) { //AC3
#ifdef DDPLUS_ONLY
-//Temporary patch to disable AC3 source
- if(phr) *phr = E_FAIL;
+ //Temporary patch to disable AC3 source
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
#endif
BYTE freq = info>>6;
BYTE bitrate = info&0x3f;
- if(bitrate >= 38)
- {
- if(phr) *phr = E_FAIL;
+ if(bitrate >= 38) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
int freqtbl[] = {48000,44100,32000,48000};
- int bitratetbl[] =
- {
+ int bitratetbl[] = {
32000,32000,40000,40000,48000,48000,56000,56000,64000,64000,
80000,80000,96000,96000,112000,112000,128000,128000,160000,160000,
192000,192000,224000,224000,256000,256000,320000,320000,384000,384000,
@@ -259,18 +256,15 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_nAvgBytesPerSec = (bitratetbl[bitrate] + 4) / 8;
m_nBytesPerFrame = m_nAvgBytesPerSec*32/1000*AC3_MAGIC_NUMBER;
m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[bitrate];
-
+
m_subtype = MEDIASUBTYPE_DOLBY_AC3;
m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
m_streamid = 0x80;
- }
- else if(bsid>=11 && bsid <=16) //DD+
- {
+ } else if(bsid>=11 && bsid <=16) { //DD+
BYTE fscod = info>>6;
BYTE numblkscod = (info&0x30)>>4;
- if(fscod == 3)
- {
+ if(fscod == 3) {
fscod = numblkscod+3;
numblkscod = 3;
}
@@ -284,10 +278,10 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_subtype = MEDIASUBTYPE_DOLBY_AC3;
m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
m_streamid = 0xC0;
- }
- else
- {
- if(phr) *phr = E_FAIL;
+ } else {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
@@ -303,21 +297,25 @@ CDTSAC3Stream::~CDTSAC3Stream()
HRESULT CDTSAC3Stream::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 = m_nBytesPerFrame+35;
- 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 CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
@@ -328,10 +326,8 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut,
const GUID* subtype = &m_mt.subtype;
UNUSED_ALWAYS(subtype);
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- BYTE PESHeader[] =
- {
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK) {
+ BYTE PESHeader[] = {
0x00,0x00,0x01,0xBA, // PES id
0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
@@ -343,10 +339,8 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut,
majortype = &MEDIATYPE_MPEG2_PES;
}
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- BYTE Private1Header[] =
- {
+ if(*majortype == MEDIATYPE_MPEG2_PES) {
+ BYTE Private1Header[] = {
0x00,0x00,0x01,0xBD, // private stream 1 id
(m_nBytesPerFrame+15)>>8,(m_nBytesPerFrame+15)&255, // packet length
0x81,0x80, // marker, original, PTS - flags
@@ -363,10 +357,11 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut,
majortype = &MEDIATYPE_Audio;
}
- if(*majortype == MEDIATYPE_Audio)
- {
+ if(*majortype == MEDIATYPE_Audio) {
m_file.Seek(m_nFileOffset + nFrame*m_nBytesPerFrame, CFile::begin);
- if(m_file.Read(pOut, m_nBytesPerFrame) < m_nBytesPerFrame) return S_FALSE;
+ if(m_file.Read(pOut, m_nBytesPerFrame) < m_nBytesPerFrame) {
+ return S_FALSE;
+ }
pOut += m_nBytesPerFrame;
}
@@ -378,43 +373,42 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut,
bool CDTSAC3Stream::CheckDTS(const CMediaType* pmt)
{
return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
|| pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DTS;
-// return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DTS;
+ && pmt->subtype == MEDIASUBTYPE_DTS;
+ // return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DTS;
}
bool CDTSAC3Stream::CheckWAVEDTS(const CMediaType* pmt)
{
return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
}
bool CDTSAC3Stream::CheckAC3(const CMediaType* pmt)
{
return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
|| pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
-// return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+ // return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
}
bool CDTSAC3Stream::CheckWAVEAC3(const CMediaType* pmt)
{
return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
}
HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pFilter->pStateLock());
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition >= 0 && iPosition < 5)
- {
+ if(iPosition >= 0 && iPosition < 5) {
pmt->subtype = m_subtype;
pmt->formattype = FORMAT_WaveFormatEx;
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
@@ -425,29 +419,26 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
wfe->nChannels = 6;
- switch(iPosition)
- {
- case 0:
- pmt->majortype = MEDIATYPE_Audio;
- break;
- case 1:
- pmt->ResetFormatBuffer();
- pmt->formattype = FORMAT_None;
- case 2:
- pmt->majortype = MEDIATYPE_MPEG2_PES;
- break;
- case 3:
- pmt->ResetFormatBuffer();
- pmt->formattype = FORMAT_None;
- case 4:
- pmt->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
- break;
- default:
- return E_INVALIDARG;
+ switch(iPosition) {
+ case 0:
+ pmt->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 2:
+ pmt->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 4:
+ pmt->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
}
- }
- else if(iPosition == 5)
- {
+ } else if(iPosition == 5) {
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = FOURCCMap(m_wFormatTag);
pmt->formattype = FORMAT_WaveFormatEx;
@@ -459,13 +450,11 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
wfe->nChannels = 2;
wfe->nBlockAlign = 1;
- }
- else
- {
+ } else {
return VFW_S_NO_MORE_ITEMS;
}
- pmt->SetTemporalCompression(FALSE);
+ pmt->SetTemporalCompression(FALSE);
return S_OK;
}
@@ -473,7 +462,7 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CDTSAC3Stream::CheckMediaType(const CMediaType* pmt)
{
return CheckDTS(pmt) || CheckWAVEDTS(pmt)
- || CheckAC3(pmt) || CheckWAVEAC3(pmt)
- ? S_OK
- : E_INVALIDARG;
+ || CheckAC3(pmt) || CheckWAVEAC3(pmt)
+ ? S_OK
+ : E_INVALIDARG;
}
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.h b/src/filters/source/DTSAC3Source/DTSAC3Source.h
index 5f0b1a976..75593e8f4 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.h
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -27,7 +27,7 @@
class CDTSAC3Stream;
class __declspec(uuid("B4A7BE85-551D-4594-BDC7-832B09185041"))
-CDTSAC3Source : public CBaseSource<CDTSAC3Stream>
+ CDTSAC3Source : public CBaseSource<CDTSAC3Stream>
{
public:
CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr);
@@ -48,12 +48,12 @@ class CDTSAC3Stream : public CBaseStream
bool CheckWAVEAC3(const CMediaType* pmt);
public:
- CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
+ CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
virtual ~CDTSAC3Stream();
- HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
-
+ HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
+
HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT CheckMediaType(const CMediaType* pMediaType);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
};
diff --git a/src/filters/source/DTSAC3Source/stdafx.cpp b/src/filters/source/DTSAC3Source/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/DTSAC3Source/stdafx.cpp
+++ b/src/filters/source/DTSAC3Source/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/DTSAC3Source/stdafx.h b/src/filters/source/DTSAC3Source/stdafx.h
index 62d50a36b..d1c3768d8 100644
--- a/src/filters/source/DTSAC3Source/stdafx.h
+++ b/src/filters/source/DTSAC3Source/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/FLICSource/FLICSource.cpp b/src/filters/source/FLICSource/FLICSource.cpp
index 696103f59..16e92a992 100644
--- a/src/filters/source/FLICSource/FLICSource.cpp
+++ b/src/filters/source/FLICSource/FLICSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -25,23 +25,19 @@
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CFLICSource), L"MPC - FLICSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLICSource>, NULL, &sudFilter[0]}
};
@@ -50,23 +46,23 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
- _T("0"), _T("4,2,,11AF"));
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("0"), _T("4,2,,11AF"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
_T("1"), _T("4,2,,12AF"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
_T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".fli"),
+ _T("Media Type\\Extensions"), _T(".fli"),
_T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".flc"),
+ _T("Media Type\\Extensions"), _T(".flc"),
_T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
return AMovieDllRegisterServer2(TRUE);
@@ -102,9 +98,9 @@ CFLICSource::~CFLICSource()
STDMETHODIMP CFLICSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IFileSourceFilter)
QI(IAMFilterMiscFlags)
__super::NonDelegatingQueryInterface(riid, ppv);
@@ -112,17 +108,20 @@ STDMETHODIMP CFLICSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
// IFileSourceFilter
-STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
+ if(GetPinCount() > 0) {
return VFW_E_ALREADY_CONNECTED;
+ }
HRESULT hr = S_OK;
- if(!(DNew CFLICStream(pszFileName, this, &hr)))
+ if(!(DNew CFLICStream(pszFileName, this, &hr))) {
return E_OUTOFMEMORY;
+ }
- if(FAILED(hr))
+ if(FAILED(hr)) {
return hr;
+ }
m_fn = pszFileName;
@@ -131,11 +130,14 @@ STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
STDMETHODIMP CFLICSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
+ if(!ppszFileName) {
+ return E_POINTER;
+ }
+
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName))
+ if(!(*ppszFileName)) {
return E_OUTOFMEMORY;
+ }
wcscpy(*ppszFileName, m_fn);
@@ -151,7 +153,7 @@ ULONG CFLICSource::GetMiscFlags()
// CFLICStream
-CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
+CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
: CSourceStream(NAME("FLICStream"), phr, pParent, L"Output")
, CSourceSeeking(NAME("FLICStream"), (IPin*)this, phr, &m_cSharedState)
, m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
@@ -160,98 +162,106 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
CString fn(wfn);
- if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyNone))
- {
- if(phr) *phr = E_FAIL;
+ if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyNone)) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
if(m_flic.Read(&m_hdr, sizeof(m_hdr)) != sizeof(m_hdr)
- || (m_hdr.id != 0xaf11 && m_hdr.id != 0xaf12)
- || m_hdr.bpp != 8)
- {
- if(phr) *phr = E_FAIL;
+ || (m_hdr.id != 0xaf11 && m_hdr.id != 0xaf12)
+ || m_hdr.bpp != 8) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
m_AvgTimePerFrame = (m_hdr.id == 0xaf11)
- ? 10000000i64 * max(m_hdr.ticks, 1) / 70
- : 10000000i64 * max(m_hdr.ticks, 1) / 1000;
+ ? 10000000i64 * max(m_hdr.ticks, 1) / 70
+ : 10000000i64 * max(m_hdr.ticks, 1) / 1000;
// not tested (lack of test files)
{
__int64 pos = m_flic.GetPosition();
FLIC_PREFIX fp;
- if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.id != 0xf100)
+ if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.id != 0xf100) {
m_flic.Seek(pos, CFile::begin);
- else
+ } else {
m_flic.Seek(pos + fp.size, CFile::begin);
+ }
}
- do
- {
+ do {
FLIC_FRAME_ENTRY ffe;
- if(m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) != sizeof(ffe.hdr) || ffe.hdr.id != 0xf1fa)
+ if(m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) != sizeof(ffe.hdr) || ffe.hdr.id != 0xf1fa) {
break;
+ }
ffe.pos = m_flic.GetPosition();
ffe.fKeyframe = (m_frames.GetCount() == 0);
int chunk = 0;
- while(chunk < ffe.hdr.chunks)
- {
+ while(chunk < ffe.hdr.chunks) {
FLIC_CHUNK fc;
- if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc)) {
break;
-/*
- switch(fc.type)
- {
- case FLIC_COLOR: _colorchunk(); break;
- case FLIC_256_COLOR: _color256chunk(); break;
- case FLIC_BRUN: _brunchunk(); break;
- case FLIC_LC: _lcchunk(); break;
- case FLIC_DELTA: _deltachunk(); break;
- case FLIC_BLACK: _blackchunk(); break;
- case FLIC_COPY: _copychunk(); break;
- case FLIC_MINI: break;
- default: break;
}
-*/
- ffe.fKeyframe =
+ /*
+ switch(fc.type)
+ {
+ case FLIC_COLOR: _colorchunk(); break;
+ case FLIC_256_COLOR: _color256chunk(); break;
+ case FLIC_BRUN: _brunchunk(); break;
+ case FLIC_LC: _lcchunk(); break;
+ case FLIC_DELTA: _deltachunk(); break;
+ case FLIC_BLACK: _blackchunk(); break;
+ case FLIC_COPY: _copychunk(); break;
+ case FLIC_MINI: break;
+ default: break;
+ }
+ */
+ ffe.fKeyframe =
(/*fc.type == FLIC_256_COLOR
|| fc.type == FLIC_64_COLOR
- ||*/ fc.type == FLIC_BRUN
- || fc.type == FLIC_BLACK
- || fc.type == FLIC_COPY);
+ ||*/ fc.type == FLIC_BRUN
+ || fc.type == FLIC_BLACK
+ || fc.type == FLIC_COPY);
ULONGLONG pos = m_flic.GetPosition() + fc.size - sizeof(fc);
- if(m_flic.Seek(pos, CFile::begin) != pos)
+ if(m_flic.Seek(pos, CFile::begin) != pos) {
break;
+ }
chunk++;
}
- if(chunk < ffe.hdr.chunks)
+ if(chunk < ffe.hdr.chunks) {
break;
+ }
ULONGLONG pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
- if(m_flic.Seek(pos, CFile::begin) != pos)
+ if(m_flic.Seek(pos, CFile::begin) != pos) {
break;
+ }
m_frames.Add(ffe);
- }
- while(1);
+ } while(1);
m_nLastFrameNum = -1;
memset(m_pPalette, 0, sizeof(m_pPalette));
m_nBufferSize = m_hdr.x*m_hdr.y*32>>3;
- if(!m_pFrameBuffer.Allocate(m_nBufferSize))
- {
- if(phr) *phr = E_OUTOFMEMORY;
+ if(!m_pFrameBuffer.Allocate(m_nBufferSize)) {
+ if(phr) {
+ *phr = E_OUTOFMEMORY;
+ }
return;
}
m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_frames.GetCount();
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ if(phr) {
+ *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ }
}
CFLICStream::~CFLICStream()
@@ -261,21 +271,20 @@ CFLICStream::~CFLICStream()
STDMETHODIMP CFLICStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CFLICStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
+ if(ThreadExists()) {
// next time around the loop, the worker thread will
// pick up the position change.
// We need to flush all the existing data - we must do that here
// as our thread will probably be blocked in GetBuffer otherwise
-
+
m_bFlushing = TRUE;
DeliverBeginFlush();
@@ -284,7 +293,7 @@ void CFLICStream::UpdateFromSeek()
// complete the flush
DeliverEndFlush();
- m_bFlushing = FALSE;
+ m_bFlushing = FALSE;
// restart
Run();
@@ -293,8 +302,9 @@ void CFLICStream::UpdateFromSeek()
HRESULT CFLICStream::SetRate(double dRate)
{
- if(dRate <= 0)
+ if(dRate <= 0) {
return E_INVALIDARG;
+ }
{
CAutoLock lock(CSourceSeeking::m_pLock);
@@ -308,65 +318,70 @@ HRESULT CFLICStream::SetRate(double dRate)
HRESULT CFLICStream::OnThreadStartPlay()
{
- m_bDiscontinuity = TRUE;
- return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
}
HRESULT CFLICStream::ChangeStart()
{
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
m_rtSampleTime = 0;
m_rtPosition = m_rtStart;
- }
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CFLICStream::ChangeStop()
{
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop)
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop) {
return S_OK;
- }
+ }
+ }
- // We're already past the new stop time -- better flush the graph.
- UpdateFromSeek();
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CFLICStream::OnThreadCreate()
{
- CAutoLock cAutoLockShared(&m_cSharedState);
- m_rtSampleTime = 0;
- m_rtPosition = m_rtStart;
+ CAutoLock cAutoLockShared(&m_cSharedState);
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
- return CSourceStream::OnThreadCreate();
+ return CSourceStream::OnThreadCreate();
}
HRESULT CFLICStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
-// CAutoLock cAutoLock(m_pFilter->pStateLock());
+ // CAutoLock cAutoLock(m_pFilter->pStateLock());
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
pProperties->cBuffers = 1;
pProperties->cbBuffer = m_nBufferSize;
- 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 CFLICStream::FillBuffer(IMediaSample* pSample)
@@ -376,17 +391,18 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
{
CAutoLock cAutoLockShared(&m_cSharedState);
- if(m_rtPosition >= m_rtStop)
+ if(m_rtPosition >= m_rtStop) {
return S_FALSE;
+ }
BYTE* pDataIn = m_pFrameBuffer;
BYTE* pDataOut = NULL;
- if(!pDataIn || FAILED(hr = pSample->GetPointer(&pDataOut)) || !pDataOut)
+ if(!pDataIn || FAILED(hr = pSample->GetPointer(&pDataOut)) || !pDataOut) {
return S_FALSE;
+ }
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
SetMediaType(&mt);
@@ -394,20 +410,15 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
}
int w, h, bpp;
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
+ if(m_mt.formattype == FORMAT_VideoInfo) {
w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
+ } else if(m_mt.formattype == FORMAT_VideoInfo2) {
w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else
- {
+ } else {
return S_FALSE;
}
@@ -419,36 +430,37 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
{
SeekToNearestKeyFrame(nFrame);
- while(m_nLastFrameNum < nFrame && !m_bFlushing)
+ while(m_nLastFrameNum < nFrame && !m_bFlushing) {
ExtractFrame(++m_nLastFrameNum);
+ }
- for(int y = 0, p = min(pitchIn, pitchOut);
- y < h;
- y++, pDataIn += pitchIn, pDataOut += pitchOut)
- {
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pDataIn += pitchIn, pDataOut += pitchOut) {
BYTE* src = pDataIn;
BYTE* end = src + p;
DWORD* dst = (DWORD*)pDataOut;
- while(src < end) *dst++ = m_pPalette[*src++];
+ while(src < end) {
+ *dst++ = m_pPalette[*src++];
+ }
}
}
pSample->SetActualDataLength(pitchOut*h);
REFERENCE_TIME rtStart, rtStop;
- // The sample times are modified by the current rate.
- rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
- rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
- pSample->SetTime(&rtStart, &rtStop);
+ // The sample times are modified by the current rate.
+ rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
+ rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
+ pSample->SetTime(&rtStart, &rtStop);
- m_rtSampleTime += m_AvgTimePerFrame;
- m_rtPosition += m_AvgTimePerFrame;
+ m_rtSampleTime += m_AvgTimePerFrame;
+ m_rtPosition += m_AvgTimePerFrame;
}
pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity)
- {
+ if(m_bDiscontinuity) {
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity = FALSE;
}
@@ -458,15 +470,19 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pFilter->pStateLock());
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if(iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
- pmt->SetType(&MEDIATYPE_Video);
- pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
- pmt->SetFormatType(&FORMAT_VideoInfo);
- pmt->SetTemporalCompression(TRUE);
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ pmt->SetTemporalCompression(TRUE);
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
memset(vih, 0, sizeof(VIDEOINFOHEADER));
@@ -481,7 +497,7 @@ HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
- return NOERROR;
+ return NOERROR;
}
HRESULT CFLICStream::CheckConnect(IPin* pPin)
@@ -492,8 +508,10 @@ HRESULT CFLICStream::CheckConnect(IPin* pPin)
HRESULT CFLICStream::CheckMediaType(const CMediaType* pmt)
{
if(pmt->majortype == MEDIATYPE_Video
- && pmt->subtype == MEDIASUBTYPE_RGB32
- && pmt->formattype == FORMAT_VideoInfo) return S_OK;
+ && pmt->subtype == MEDIASUBTYPE_RGB32
+ && pmt->formattype == FORMAT_VideoInfo) {
+ return S_OK;
+ }
return E_INVALIDARG;
}
@@ -507,17 +525,19 @@ STDMETHODIMP CFLICStream::Notify(IBaseFilter* pSender, Quality q)
void CFLICStream::SeekToNearestKeyFrame(int nFrame)
{
- if(m_nLastFrameNum == nFrame)
+ if(m_nLastFrameNum == nFrame) {
return;
+ }
- if(m_nLastFrameNum > nFrame)
+ if(m_nLastFrameNum > nFrame) {
m_nLastFrameNum = -1;
+ }
- for(int i = m_nLastFrameNum+1, j = min(m_frames.GetCount(), nFrame); i < j; i++)
- {
+ for(int i = m_nLastFrameNum+1, j = min(m_frames.GetCount(), nFrame); i < j; i++) {
FLIC_FRAME_ENTRY& ffe = m_frames[i];
- if(ffe.fKeyframe)
+ if(ffe.fKeyframe) {
m_nLastFrameNum = i-1;
+ }
}
}
@@ -531,35 +551,55 @@ void CFLICStream::ExtractFrame(int nFrame)
m_flic.Seek(ffe.pos, CFile::begin);
int chunk = 0;
- while(chunk < ffe.hdr.chunks)
- {
+ while(chunk < ffe.hdr.chunks) {
FLIC_CHUNK fc;
- if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc)) {
break;
+ }
ULONGLONG next = m_flic.GetPosition() + fc.size - sizeof(fc);
- switch(fc.type)
- {
- case FLIC_64_COLOR: fNewPalette = _colorchunk(true); break;
- case FLIC_256_COLOR: fNewPalette = _colorchunk(false); break;
- case FLIC_BRUN: _brunchunk(); fNewFrame = true; break;
- case FLIC_LC: _lcchunk(); break;
- case FLIC_DELTA: _deltachunk(); break;
- case FLIC_BLACK: _blackchunk(); fNewFrame = true; break;
- case FLIC_COPY: _copychunk(); fNewFrame = true; break;
- case FLIC_MINI: break;
- default: break;
+ switch(fc.type) {
+ case FLIC_64_COLOR:
+ fNewPalette = _colorchunk(true);
+ break;
+ case FLIC_256_COLOR:
+ fNewPalette = _colorchunk(false);
+ break;
+ case FLIC_BRUN:
+ _brunchunk();
+ fNewFrame = true;
+ break;
+ case FLIC_LC:
+ _lcchunk();
+ break;
+ case FLIC_DELTA:
+ _deltachunk();
+ break;
+ case FLIC_BLACK:
+ _blackchunk();
+ fNewFrame = true;
+ break;
+ case FLIC_COPY:
+ _copychunk();
+ fNewFrame = true;
+ break;
+ case FLIC_MINI:
+ break;
+ default:
+ break;
}
- if(m_flic.Seek(next, CFile::begin) != next)
+ if(m_flic.Seek(next, CFile::begin) != next) {
break;
+ }
chunk++;
}
- if(chunk < ffe.hdr.chunks)
+ if(chunk < ffe.hdr.chunks) {
ASSERT(0);
+ }
ffe.fKeyframe = (fNewPalette && fNewFrame);
}
@@ -583,8 +623,7 @@ bool CFLICStream::_colorchunk(bool f64)
WORD packets;
m_flic.Read(&packets, sizeof(packets));
- while(packets--)
- {
+ while(packets--) {
BYTE skip2;
m_flic.Read(&skip2, sizeof(skip2));
skip += skip2;
@@ -593,15 +632,14 @@ bool CFLICStream::_colorchunk(bool f64)
m_flic.Read(&count, sizeof(count));
int len = (count == 0 ? (256-skip) : count);
- while(len-- > 0)
- {
+ while(len-- > 0) {
BYTE r, g, b;
m_flic.Read(&r, sizeof(r));
m_flic.Read(&g, sizeof(g));
m_flic.Read(&b, sizeof(b));
- m_pPalette[skip++] = f64
- ? ((r << 18)&0xff0000) | ((g << 10)&0xff00) | ((b << 2)&0xff)
- : ((r << 16)&0xff0000) | ((g << 8)&0xff00) | ((b << 0)&0xff);
+ m_pPalette[skip++] = f64
+ ? ((r << 18)&0xff0000) | ((g << 10)&0xff00) | ((b << 2)&0xff)
+ : ((r << 16)&0xff0000) | ((g << 8)&0xff00) | ((b << 0)&0xff);
nColorsUpdated++;
}
}
@@ -614,27 +652,22 @@ void CFLICStream::_brunchunk()
BYTE* tmp = m_pFrameBuffer;
int lines = m_hdr.y;
- while(lines--)
- {
+ while(lines--) {
BYTE packets;
m_flic.Read(&packets, sizeof(packets));
-
+
BYTE* ptr = tmp;
- while(ptr < tmp + m_hdr.x)
- {
+ while(ptr < tmp + m_hdr.x) {
signed char count;
m_flic.Read(&count, sizeof(count));
- if(count >= 0)
- {
+ if(count >= 0) {
BYTE c;
m_flic.Read(&c, sizeof(c));
memset(ptr, c, count);
ptr += count;
- }
- else
- {
+ } else {
m_flic.Read(ptr, -count);
ptr += -count;
}
@@ -654,15 +687,13 @@ void CFLICStream::_lcchunk()
WORD lines;
m_flic.Read(&lines, sizeof(lines));
- while(lines--)
- {
+ while(lines--) {
BYTE* ptr = tmp;
BYTE packets;
m_flic.Read(&packets, sizeof(packets));
- while(packets--)
- {
+ while(packets--) {
BYTE skip;
m_flic.Read(&skip, sizeof(skip));
@@ -671,13 +702,10 @@ void CFLICStream::_lcchunk()
signed char count;
m_flic.Read(&count, sizeof(count));
- if(count >= 0)
- {
+ if(count >= 0) {
m_flic.Read(ptr, count);
ptr += count;
- }
- else
- {
+ } else {
BYTE c;
m_flic.Read(&c, sizeof(c));
memset(ptr, c, -count);
@@ -696,31 +724,23 @@ void CFLICStream::_deltachunk()
WORD lines;
m_flic.Read(&lines, sizeof(lines));
- while(lines--)
- {
+ while(lines--) {
signed short packets;
m_flic.Read(&packets, sizeof(packets));
- if(packets < 0)
- {
- if(packets&0x4000)
- {
+ if(packets < 0) {
+ if(packets&0x4000) {
tmp += -packets * m_hdr.x;
lines++;
- }
- else
- {
+ } else {
signed char count;
m_flic.Read(&count, sizeof(count));
tmp[m_hdr.x-1] = (BYTE)packets;
}
- }
- else
- {
+ } else {
BYTE* ptr = tmp;
- while(packets--)
- {
+ while(packets--) {
BYTE skip;
m_flic.Read(&skip, sizeof(skip));
@@ -729,22 +749,19 @@ void CFLICStream::_deltachunk()
signed char count;
m_flic.Read(&count, sizeof(count));
- if(count >= 0)
- {
+ if(count >= 0) {
// Fix vulnerability : http://www.team509.com/modules.php?name=News&file=article&sid=38
- if ((count << 1) + (long)(ptr - m_pFrameBuffer) < m_nBufferSize)
+ if ((count << 1) + (long)(ptr - m_pFrameBuffer) < m_nBufferSize) {
m_flic.Read(ptr, count << 1);
- else
+ } else {
ASSERT(FALSE);
+ }
ptr += count << 1;
- }
- else
- {
+ } else {
WORD c;
m_flic.Read(&c, sizeof(c));
count = -count;
- while(count-- > 0)
- {
+ while(count-- > 0) {
*ptr++ = c>>8;
*ptr++ = c&0xff;
}
diff --git a/src/filters/source/FLICSource/FLICSource.h b/src/filters/source/FLICSource/FLICSource.h
index 5038fb0a6..6df23ec7e 100644
--- a/src/filters/source/FLICSource/FLICSource.h
+++ b/src/filters/source/FLICSource/FLICSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -24,8 +24,7 @@
#include <atlcoll.h>
#pragma pack(push, 1)
-enum
-{
+enum {
FLIC_256_COLOR = 4,
FLIC_DELTA = 7,
FLIC_64_COLOR = 11,
@@ -35,9 +34,8 @@ enum
FLIC_COPY = 16,
FLIC_MINI = 18
};
-
-struct FLIC
-{
+
+struct FLIC {
DWORD size;
WORD id; // 0xaf11 or 0xaf12
WORD frames, x, y, bpp;
@@ -46,38 +44,34 @@ struct FLIC
BYTE reserved[102];
};
-struct FLIC_PREFIX
-{
+struct FLIC_PREFIX {
DWORD size;
WORD id; // 0xf100
WORD chunks;
BYTE reserved[8];
};
-struct FLIC_FRAME
-{
+struct FLIC_FRAME {
DWORD size;
WORD id; // 0xf1fa
WORD chunks;
BYTE reserved[8];
};
-struct FLIC_CHUNK
-{
+struct FLIC_CHUNK {
DWORD size;
WORD type;
};
#pragma pack(pop)
-struct FLIC_FRAME_ENTRY
-{
+struct FLIC_FRAME_ENTRY {
__int64 pos;
bool fKeyframe;
FLIC_FRAME hdr;
};
class __declspec(uuid("17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4"))
-CFLICSource
+ CFLICSource
: public CSource
, public IFileSourceFilter
, public IAMFilterMiscFlags
@@ -89,7 +83,7 @@ public:
virtual ~CFLICSource();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IFileSourceFilter
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
@@ -99,7 +93,7 @@ public:
STDMETHODIMP_(ULONG) GetMiscFlags();
};
-class CFLICStream
+class CFLICStream
: public CSourceStream
, public CSourceSeeking
{
@@ -121,8 +115,10 @@ class CFLICStream
STDMETHODIMP SetRate(double dRate);
HRESULT ChangeStart();
- HRESULT ChangeStop();
- HRESULT ChangeRate() {return S_OK;}
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {
+ return S_OK;
+ }
private:
int m_nLastFrameNum;
@@ -140,17 +136,17 @@ private:
void _deltachunk();
public:
- CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr);
+ CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr);
virtual ~CFLICStream();
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
HRESULT CheckConnect(IPin* pPin);
- HRESULT CheckMediaType(const CMediaType* pMediaType);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
-
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/FLICSource/stdafx.cpp b/src/filters/source/FLICSource/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/FLICSource/stdafx.cpp
+++ b/src/filters/source/FLICSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/FLICSource/stdafx.h b/src/filters/source/FLICSource/stdafx.h
index 62d50a36b..d1c3768d8 100644
--- a/src/filters/source/FLICSource/stdafx.h
+++ b/src/filters/source/FLICSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/FlacSource/FlacSource.cpp b/src/filters/source/FlacSource/FlacSource.cpp
index ab887a244..ea18dabc2 100644
--- a/src/filters/source/FlacSource/FlacSource.cpp
+++ b/src/filters/source/FlacSource/FlacSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -33,23 +33,19 @@
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Audio, &MEDIASUBTYPE_FLAC_FRAMED}
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CFlacSource), L"MPC - Flac Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFlacSource>, NULL, &sudFilter[0]}
};
@@ -58,15 +54,15 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
_T("0"), _T("0,4,,664C6143"));
SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
_T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".flac"),
+ _T("Media Type\\Extensions"), _T(".flac"),
_T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
return AMovieDllRegisterServer2(TRUE);
@@ -113,7 +109,7 @@ CFlacSource::~CFlacSource()
// CFlacStream
-CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
+CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
: CBaseStream(NAME("CFlacStream"), pParent, phr)
, m_bIsEOF (false)
{
@@ -122,42 +118,44 @@ CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
CFileException ex;
HRESULT hr = E_FAIL;
- do
- {
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex))
- {
+ do {
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex)) {
hr = AmHresultFromWin32 (ex.m_lOsError);
break;
}
m_pDecoder = FLAC__stream_decoder_new();
- if (!m_pDecoder) break;
-
- if (FLAC__STREAM_DECODER_INIT_STATUS_OK != FLAC__stream_decoder_init_stream (_DECODER_,
- StreamDecoderRead,
- StreamDecoderSeek,
- StreamDecoderTell,
- StreamDecoderLength,
- StreamDecoderEof,
- StreamDecoderWrite,
- StreamDecoderMetadata,
- StreamDecoderError,
- this))
- {
+ if (!m_pDecoder) {
+ break;
+ }
+
+ if (FLAC__STREAM_DECODER_INIT_STATUS_OK != FLAC__stream_decoder_init_stream (_DECODER_,
+ StreamDecoderRead,
+ StreamDecoderSeek,
+ StreamDecoderTell,
+ StreamDecoderLength,
+ StreamDecoderEof,
+ StreamDecoderWrite,
+ StreamDecoderMetadata,
+ StreamDecoderError,
+ this)) {
break;
}
if (!FLAC__stream_decoder_process_until_end_of_metadata (_DECODER_) ||
- !FLAC__stream_decoder_seek_absolute (_DECODER_, 0))
+ !FLAC__stream_decoder_seek_absolute (_DECODER_, 0)) {
break;
+ }
FLAC__stream_decoder_get_decode_position(_DECODER_, &m_llOffset);
hr = S_OK;
} while (false);
- if(phr) *phr = hr;
+ if(phr) {
+ *phr = hr;
+ }
}
CFlacStream::~CFlacStream()
@@ -167,21 +165,25 @@ CFlacStream::~CFlacStream()
HRESULT CFlacStream::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 = m_nMaxFrameSize;
- 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 CFlacStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
@@ -189,22 +191,24 @@ HRESULT CFlacStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, l
FLAC__uint64 llCurPos;
FLAC__uint64 llNextPos;
- if (m_bDiscontinuity)
- {
+ if (m_bDiscontinuity) {
FLAC__stream_decoder_seek_absolute (_DECODER_, (m_rtPosition * m_i64TotalNumSamples) / m_rtDuration);
}
FLAC__stream_decoder_get_decode_position(_DECODER_, &llCurPos);
-
+
FLAC__stream_decoder_skip_single_frame (_DECODER_);
- if (m_bIsEOF)
+ if (m_bIsEOF) {
return S_FALSE;
+ }
FLAC__stream_decoder_get_decode_position(_DECODER_, &llNextPos);
FLAC__uint64 llCurFile = m_file.GetPosition();
len = llNextPos - llCurPos;
ASSERT (len > 0);
- if (len <= 0) return S_FALSE;
+ if (len <= 0) {
+ return S_FALSE;
+ }
m_file.Seek (llCurPos, CFile::begin);
m_file.Read (pOut, len);
@@ -219,10 +223,9 @@ HRESULT CFlacStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, l
HRESULT CFlacStream::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pFilter->pStateLock());
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition == 0)
- {
+ if(iPosition == 0) {
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = MEDIASUBTYPE_FLAC_FRAMED;
pmt->formattype = FORMAT_WaveFormatEx;
@@ -235,13 +238,11 @@ HRESULT CFlacStream::GetMediaType(int iPosition, CMediaType* pmt)
wfe->nChannels = m_nChannels;
wfe->nBlockAlign = 1;
wfe->wBitsPerSample = m_wBitsPerSample;
- }
- else
- {
+ } else {
return VFW_S_NO_MORE_ITEMS;
}
- pmt->SetTemporalCompression(FALSE);
+ pmt->SetTemporalCompression(FALSE);
return S_OK;
}
@@ -249,12 +250,13 @@ HRESULT CFlacStream::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CFlacStream::CheckMediaType(const CMediaType* pmt)
{
if ( pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_FLAC_FRAMED
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
+ && pmt->subtype == MEDIASUBTYPE_FLAC_FRAMED
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_FLAC) {
return S_OK;
- else
+ } else {
return E_INVALIDARG;
+ }
}
@@ -267,7 +269,7 @@ void CFlacStream::UpdateFromMetadata (void* pBuffer)
m_nChannels = pMetadata->data.stream_info.channels;
m_wBitsPerSample = pMetadata->data.stream_info.bits_per_sample;
m_i64TotalNumSamples = pMetadata->data.stream_info.total_samples;
- m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
+ m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
// === Init members from base classes
GetFileSizeEx (m_file.m_hFile, (LARGE_INTEGER*)&m_llFileSize);
@@ -282,9 +284,9 @@ FLAC__StreamDecoderReadStatus StreamDecoderRead(const FLAC__StreamDecoder *decod
CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
UINT nRead;
- nRead = pThis->GetFile()->Read (buffer, *bytes);
- pThis->m_bIsEOF = (nRead != *bytes);
- *bytes = nRead;
+ nRead = pThis->GetFile()->Read (buffer, *bytes);
+ pThis->m_bIsEOF = (nRead != *bytes);
+ *bytes = nRead;
return (*bytes == 0) ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
@@ -292,7 +294,7 @@ FLAC__StreamDecoderReadStatus StreamDecoderRead(const FLAC__StreamDecoder *decod
FLAC__StreamDecoderSeekStatus StreamDecoderSeek(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
-
+
pThis->m_bIsEOF = false;
pThis->GetFile()->Seek (absolute_byte_offset, CFile::begin);
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
@@ -310,10 +312,9 @@ FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *d
CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
CFile* pFile = pThis->GetFile();
- if (pFile == NULL)
+ if (pFile == NULL) {
return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
- else
- {
+ } else {
*stream_length = pFile->GetLength();
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
}
@@ -344,6 +345,7 @@ void StreamDecoderMetadata(const FLAC__StreamDecoder *decoder, const FLAC__Strea
{
CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
- if (pThis)
+ if (pThis) {
pThis->UpdateFromMetadata ((void*)metadata);
+ }
}
diff --git a/src/filters/source/FlacSource/FlacSource.h b/src/filters/source/FlacSource/FlacSource.h
index 9b486bd77..06add98e1 100644
--- a/src/filters/source/FlacSource/FlacSource.h
+++ b/src/filters/source/FlacSource/FlacSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -27,7 +27,7 @@
class CFlacStream;
class __declspec(uuid("1930D8FF-4739-4e42-9199-3B2EDEAA3BF2"))
-CFlacSource : public CBaseSource<CFlacStream>
+ CFlacSource : public CBaseSource<CFlacStream>
{
public:
CFlacSource(LPUNKNOWN lpunk, HRESULT* phr);
@@ -50,20 +50,22 @@ class CFlacStream : public CBaseStream
int m_nAvgBytesPerSec;
ULONGLONG m_llOffset; // Position of first frame in file
- ULONGLONG m_llFileSize; // Size of the file
+ ULONGLONG m_llFileSize; // Size of the file
public:
- CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
+ CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
virtual ~CFlacStream();
- HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
-
+ HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
+
HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT CheckMediaType(const CMediaType* pMediaType);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
void UpdateFromMetadata (void* pBuffer);
- inline CFile* GetFile() { return &m_file; };
+ inline CFile* GetFile() {
+ return &m_file;
+ };
bool m_bIsEOF;
};
diff --git a/src/filters/source/FlacSource/stdafx.cpp b/src/filters/source/FlacSource/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/FlacSource/stdafx.cpp
+++ b/src/filters/source/FlacSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/FlacSource/stdafx.h b/src/filters/source/FlacSource/stdafx.h
index 62d50a36b..d1c3768d8 100644
--- a/src/filters/source/FlacSource/stdafx.h
+++ b/src/filters/source/FlacSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
index 5e5654e66..13a9ca345 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -31,25 +31,21 @@
#define AVGBUFFERLENGTH 30000000i64
#define MAXBUFFERLENGTH 100000000i64
-static const DWORD s_bitrate[2][16] =
-{
+static const DWORD s_bitrate[2][16] = {
{1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
{1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}
};
-static const DWORD s_freq[4][4] =
-{
+static const DWORD s_freq[4][4] = {
{11025,12000,8000,0},
{0,0,0,0},
{22050,24000,16000,0},
{44100,48000,32000,0}
};
-static const BYTE s_channels[4] =
-{
+static const BYTE s_channels[4] = {
2,2,2,1 // stereo, joint stereo, dual, mono
};
-typedef struct
-{
+typedef struct {
WORD sync;
BYTE version;
BYTE layer;
@@ -58,11 +54,11 @@ typedef struct
BYTE channels;
DWORD framesize;
- bool ExtractHeader(CSocket& socket)
- {
+ bool ExtractHeader(CSocket& socket) {
BYTE buff[4];
- if(4 != socket.Receive(buff, 4, MSG_PEEK))
+ if(4 != socket.Receive(buff, 4, MSG_PEEK)) {
return(false);
+ }
sync = (buff[0]<<4)|(buff[1]>>4)|1;
version = (buff[1]>>3)&3;
@@ -79,23 +75,19 @@ typedef struct
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CShoutcastSource), L"MPC - ShoutcastSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CShoutcastSource>, NULL, &sudFilter[0]}
};
@@ -116,18 +108,18 @@ STDAPI DllUnregisterServer()
class CShoutcastSourceApp : public CFilterApp
{
public:
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
-/*
- if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- AfxMessageBox(_T("AfxWinInit failed!"));
+ BOOL InitInstance() {
+ if(!__super::InitInstance()) {
return FALSE;
}
-*/
- if(!AfxSocketInit(NULL))
- {
+ /*
+ if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
+ {
+ AfxMessageBox(_T("AfxWinInit failed!"));
+ return FALSE;
+ }
+ */
+ if(!AfxSocketInit(NULL)) {
AfxMessageBox(_T("AfxSocketInit failed!"));
return FALSE;
}
@@ -158,9 +150,9 @@ CShoutcastSource::~CShoutcastSource()
STDMETHODIMP CShoutcastSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IFileSourceFilter)
QI(IAMFilterMiscFlags)
QI(IAMOpenProgress)
@@ -170,15 +162,17 @@ STDMETHODIMP CShoutcastSource::NonDelegatingQueryInterface(REFIID riid, void** p
// IFileSourceFilter
-STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
+ if(GetPinCount() > 0) {
return VFW_E_ALREADY_CONNECTED;
+ }
HRESULT hr = E_OUTOFMEMORY;
- if(!(DNew CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
+ if(!(DNew CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr)) {
return hr;
+ }
m_fn = pszFileName;
@@ -187,11 +181,14 @@ STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE*
STDMETHODIMP CShoutcastSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
+ if(!ppszFileName) {
+ return E_POINTER;
+ }
+
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName))
+ if(!(*ppszFileName)) {
return E_OUTOFMEMORY;
+ }
wcscpy(*ppszFileName, m_fn);
@@ -209,10 +206,13 @@ ULONG CShoutcastSource::GetMiscFlags()
STDMETHODIMP CShoutcastSource::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
{
- if(m_iPins == 1)
- {
- if(pllTotal) *pllTotal = 100;
- if(pllCurrent) *pllCurrent = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetBufferFullness();
+ if(m_iPins == 1) {
+ if(pllTotal) {
+ *pllTotal = 100;
+ }
+ if(pllCurrent) {
+ *pllCurrent = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetBufferFullness();
+ }
return S_OK;
}
@@ -230,8 +230,7 @@ STDMETHODIMP CShoutcastSource::get_Title(BSTR* pbstrTitle)
{
CheckPointer(pbstrTitle, E_POINTER);
- if(m_iPins == 1)
- {
+ if(m_iPins == 1) {
*pbstrTitle = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetTitle().AllocSysString();
return S_OK;
}
@@ -250,40 +249,41 @@ CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent,
*phr = S_OK;
CString fn(wfn);
- if(fn.Find(_T("://")) < 0) fn = _T("http://") + fn;
+ if(fn.Find(_T("://")) < 0) {
+ fn = _T("http://") + fn;
+ }
#if defined(REGISTER_FILTER) && defined(DEBUG)
-//fn = _T("http://localhost:8000/");
-//fn = _T("http://64.236.34.141/stream/1005");
-//fn = _T("http://218.145.30.106:11000"); // 128kbps korean
-//fn = _T("http://65.206.46.110:8020"); // 96kbps
-//fn = _T("http://64.236.34.72:80/stream/1003");
-fn = _T("http://64.236.34.72:80/stream/1011");
-//fn = _T("http://218.145.30.106:11000");
-//fn = _T("http://radio.sluchaj.com:8000/radio.ogg"); // ogg
-// http://www.oddsock.org/icecast2yp/ // more ogg via icecast2
+ //fn = _T("http://localhost:8000/");
+ //fn = _T("http://64.236.34.141/stream/1005");
+ //fn = _T("http://218.145.30.106:11000"); // 128kbps korean
+ //fn = _T("http://65.206.46.110:8020"); // 96kbps
+ //fn = _T("http://64.236.34.72:80/stream/1003");
+ fn = _T("http://64.236.34.72:80/stream/1011");
+ //fn = _T("http://218.145.30.106:11000");
+ //fn = _T("http://radio.sluchaj.com:8000/radio.ogg"); // ogg
+ // http://www.oddsock.org/icecast2yp/ // more ogg via icecast2
#endif
- if(!m_url.CrackUrl(fn))
- {
+ if(!m_url.CrackUrl(fn)) {
*phr = E_FAIL;
return;
}
- if(m_url.GetUrlPathLength() == 0)
+ if(m_url.GetUrlPathLength() == 0) {
m_url.SetUrlPath(_T("/"));
+ }
- if(m_url.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER)
+ if(m_url.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER) {
m_url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT);
+ }
- if(m_url.GetScheme() != ATL_URL_SCHEME_HTTP)
- {
+ if(m_url.GetScheme() != ATL_URL_SCHEME_HTTP) {
*phr = E_FAIL;
return;
}
- if(!m_socket.Create() || !m_socket.Connect(m_url))
- {
+ if(!m_socket.Create() || !m_socket.Connect(m_url)) {
*phr = E_FAIL;
return;
}
@@ -304,8 +304,12 @@ void CShoutcastStream::EmptyBuffer()
LONGLONG CShoutcastStream::GetBufferFullness()
{
CAutoLock cAutoLock(&m_queue);
- if(!m_fBuffering) return 100;
- if(m_queue.IsEmpty()) return 0;
+ if(!m_fBuffering) {
+ return 100;
+ }
+ if(m_queue.IsEmpty()) {
+ return 0;
+ }
LONGLONG ret = 100i64*(m_queue.GetTail().rtStart - m_queue.GetHead().rtStart) / AVGBUFFERLENGTH;
return(min(ret, 100));
}
@@ -318,21 +322,25 @@ CString CShoutcastStream::GetTitle()
HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
pProperties->cBuffers = BUFFERS;
pProperties->cbBuffer = MAXFRAMESIZE;
- 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 CShoutcastStream::FillBuffer(IMediaSample* pSample)
@@ -340,31 +348,33 @@ HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
HRESULT hr;
BYTE* pData = NULL;
- if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData) {
return S_FALSE;
+ }
- do
- {
+ do {
// do we have to refill our buffer?
{
CAutoLock cAutoLock(&m_queue);
- if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH)
- break; // nope, that's great
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH) {
+ break; // nope, that's great
+ }
}
TRACE(_T("START BUFFERING\n"));
m_fBuffering = true;
- while(1)
- {
- if(fExitThread) // playback stopped?
+ while(1) {
+ if(fExitThread) { // playback stopped?
return S_FALSE;
+ }
Sleep(50);
CAutoLock cAutoLock(&m_queue);
- if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH)
- break; // this is enough
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH) {
+ break; // this is enough
+ }
}
pSample->SetDiscontinuity(TRUE);
@@ -376,14 +386,12 @@ HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
TRACE(_T("END BUFFERING\n"));
m_fBuffering = false;
- }
- while(false);
+ } while(false);
{
CAutoLock cAutoLock(&m_queue);
ASSERT(!m_queue.IsEmpty());
- if(!m_queue.IsEmpty())
- {
+ if(!m_queue.IsEmpty()) {
mp3frame f = m_queue.RemoveHead();
DWORD len = min(pSample->GetSize(), f.len);
memcpy(pData, f.pData, len);
@@ -400,14 +408,18 @@ HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
{
- CAutoLock cAutoLock(m_pFilter->pStateLock());
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if(iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
- pmt->SetType(&MEDIATYPE_Audio);
- pmt->SetSubtype(&MEDIASUBTYPE_MP3);
- pmt->SetFormatType(&FORMAT_WaveFormatEx);
+ pmt->SetType(&MEDIATYPE_Audio);
+ pmt->SetSubtype(&MEDIASUBTYPE_MP3);
+ pmt->SetFormatType(&FORMAT_WaveFormatEx);
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
memset(wfe, 0, sizeof(WAVEFORMATEX));
@@ -418,14 +430,16 @@ HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
wfe->nBlockAlign = 1;
wfe->wBitsPerSample = 0;
- return NOERROR;
+ return NOERROR;
}
HRESULT CShoutcastStream::CheckMediaType(const CMediaType* pmt)
{
if(pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_MP3
- && pmt->formattype == FORMAT_WaveFormatEx) return S_OK;
+ && pmt->subtype == MEDIASUBTYPE_MP3
+ && pmt->formattype == FORMAT_WaveFormatEx) {
+ return S_OK;
+ }
return E_INVALIDARG;
}
@@ -445,26 +459,28 @@ UINT CShoutcastStream::SocketThreadProc()
CAutoVectorPtr<BYTE> pData;
if(!m_socket.Create() || !m_socket.Connect(m_url)
- || !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE)))
- {
- m_socket.Close();
+ || !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE))) {
+ m_socket.Close();
return 1;
}
REFERENCE_TIME m_rtSampleTime = 0;
-
- while(!fExitThread)
- {
+
+ while(!fExitThread) {
int len = MAXFRAMESIZE;
len = m_socket.Receive(pData, len);
- if(len <= 0) break;
+ if(len <= 0) {
+ break;
+ }
mp3frame f(len);
memcpy(f.pData, pData, len);
f.rtStop = (f.rtStart = m_rtSampleTime) + (10000000i64 * len * 8/m_socket.m_bitrate);
m_rtSampleTime = f.rtStop;
f.title = m_socket.m_title;
- if(f.title.IsEmpty()) f.title = m_socket.m_url;
+ if(f.title.IsEmpty()) {
+ f.title = m_socket.m_url;
+ }
CAutoLock cAutoLock(&m_queue);
m_queue.AddTail(f);
@@ -481,7 +497,9 @@ HRESULT CShoutcastStream::OnThreadCreate()
fExitThread = true;
m_hSocketThread = AfxBeginThread(::SocketThreadProc, this)->m_hThread;
- while(fExitThread) Sleep(10);
+ while(fExitThread) {
+ Sleep(10);
+ }
return NOERROR;
}
@@ -489,7 +507,7 @@ HRESULT CShoutcastStream::OnThreadCreate()
HRESULT CShoutcastStream::OnThreadDestroy()
{
EmptyBuffer();
-
+
fExitThread = true;
m_socket.CancelBlockingCall();
WaitForSingleObject(m_hSocketThread, (DWORD)-1);
@@ -507,81 +525,84 @@ HRESULT CShoutcastStream::Inactive()
int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nFlags)
{
- if(nFlags&MSG_PEEK)
+ if(nFlags&MSG_PEEK) {
return __super::Receive(lpBuf, nBufLen, nFlags);
+ }
- if(m_metaint > 0 && m_nBytesRead + nBufLen > m_metaint)
+ if(m_metaint > 0 && m_nBytesRead + nBufLen > m_metaint) {
nBufLen = m_metaint - m_nBytesRead;
+ }
int len = __super::Receive(lpBuf, nBufLen, nFlags);
- if(len <= 0) return len;
+ if(len <= 0) {
+ return len;
+ }
- if((m_nBytesRead += len) == m_metaint)
- {
+ if((m_nBytesRead += len) == m_metaint) {
m_nBytesRead = 0;
static BYTE buff[255*16], b = 0;
memset(buff, 0, sizeof(buff));
- if(1 == __super::Receive(&b, 1) && b && b*16 == __super::Receive(buff, b*16))
- {
+ if(1 == __super::Receive(&b, 1) && b && b*16 == __super::Receive(buff, b*16)) {
CStringA str = (LPCSTR)buff;
-
+
TRACE(_T("Metainfo: %s\n"), CString(str));
CStringA title("StreamTitle='"), url("StreamUrl='");
-
+
int i = str.Find(title);
- if(i >= 0)
- {
+ if(i >= 0) {
i += title.GetLength();
int j = str.Find('\'', i);
- if(j > i) m_title = str.Mid(i, j - i);
- }
- else
- {
+ if(j > i) {
+ m_title = str.Mid(i, j - i);
+ }
+ } else {
TRACE(_T("!!!!!!!!!Missing StreamTitle!!!!!!!!!\n"));
}
i = str.Find(url);
- if(i >= 0)
- {
+ if(i >= 0) {
i += url.GetLength();
int j = str.Find('\'', i);
- if(j > i) m_url = str.Mid(i, j - i);
+ if(j > i) {
+ m_url = str.Mid(i, j - i);
+ }
}
}
- }
- else if(m_metaint > 0)
- {
+ } else if(m_metaint > 0) {
char* p = (char*)lpBuf;
char* p0 = p;
char* pend = p + len - 13;
- for(; p < pend; p++)
- {
- if(strncmp(p, "StreamTitle='", 13))
+ for(; p < pend; p++) {
+ if(strncmp(p, "StreamTitle='", 13)) {
continue;
+ }
-TRACE(_T("!!!!!!!!!StreamTitle found inside mp3 data!!!!!!!!! offset=%d\n"), p - p0);
-TRACE(_T("resyncing...\n"));
- while(p-- > p0)
- {
- if((BYTE)*p >= 0x20)
+ TRACE(_T("!!!!!!!!!StreamTitle found inside mp3 data!!!!!!!!! offset=%d\n"), p - p0);
+ TRACE(_T("resyncing...\n"));
+ while(p-- > p0) {
+ if((BYTE)*p >= 0x20) {
continue;
+ }
-TRACE(_T("found possible length byte: %d, skipping %d bytes\n"), *p, 1 + *p*16);
+ TRACE(_T("found possible length byte: %d, skipping %d bytes\n"), *p, 1 + *p*16);
p += 1 + *p*16;
len = (p0 + len) - p;
-TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
- if(len <= 0)
- {
-TRACE(_T("nothing to return, reading a bit more in\n"));
- if(len < 0) __super::Receive(lpBuf, -len, nFlags);
+ TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
+ if(len <= 0) {
+ TRACE(_T("nothing to return, reading a bit more in\n"));
+ if(len < 0) {
+ __super::Receive(lpBuf, -len, nFlags);
+ }
int len = __super::Receive(lpBuf, nBufLen, nFlags);
- if(len <= 0) return len;
+ if(len <= 0) {
+ return len;
+ }
}
-
- m_nBytesRead = len;
+
+ m_nBytesRead = len;
memcpy(lpBuf, p, len);
break;
@@ -596,8 +617,9 @@ TRACE(_T("nothing to return, reading a bit more in\n"));
bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
{
- if(!__super::Connect(url.GetHostName(), url.GetPortNumber()))
+ if(!__super::Connect(url.GetHostName(), url.GetPortNumber())) {
return(false);
+ }
CStringA str;
str.Format(
@@ -613,8 +635,7 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
bool fTryAgain = false;
int metaint = 0;
- do
- {
+ do {
int len = Send((BYTE*)(LPCSTR)str, str.GetLength());
UNUSED_ALWAYS(len);
@@ -624,21 +645,22 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
str.Empty();
BYTE cur = 0, prev = 0;
- while(Receive(&cur, 1) == 1 && cur && !(cur == '\n' && prev == '\n'))
- {
- if(cur == '\r')
+ while(Receive(&cur, 1) == 1 && cur && !(cur == '\n' && prev == '\n')) {
+ if(cur == '\r') {
continue;
+ }
- if(cur == '\n')
- {
+ if(cur == '\n') {
str.MakeLower();
- if(str.Find("icy 200 ok") >= 0) fOK = true;
- else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) m_bitrate *= 1000;
- else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) metaint = metaint;
+ if(str.Find("icy 200 ok") >= 0) {
+ fOK = true;
+ } else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) {
+ m_bitrate *= 1000;
+ } else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) {
+ metaint = metaint;
+ }
str.Empty();
- }
- else
- {
+ } else {
str += cur;
}
@@ -646,8 +668,7 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
cur = 0;
}
- if(!fOK && GetLastError() == WSAECONNRESET && !fTryAgain)
- {
+ if(!fOK && GetLastError() == WSAECONNRESET && !fTryAgain) {
str.Format(
"GET %s HTTP/1.0\r\n"
"Icy-MetaData:1\r\n"
@@ -657,15 +678,15 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
"\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
fTryAgain = true;
- }
- else
- {
+ } else {
fTryAgain = false;
}
- }
- while(fTryAgain);
+ } while(fTryAgain);
- if(!fOK || m_bitrate == 0) {Close(); return(false);}
+ if(!fOK || m_bitrate == 0) {
+ Close();
+ return(false);
+ }
m_metaint = metaint;
m_nBytesRead = 0;
@@ -679,12 +700,12 @@ bool CShoutcastStream::CShoutcastSocket::FindSync()
m_channels = (DWORD)-1;
BYTE b;
- for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1))
- {
+ for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1)) {
mp3hdr h;
- if(h.ExtractHeader(*this) && m_bitrate == h.bitrate)
- {
- if(h.bitrate > 1) m_bitrate = h.bitrate;
+ if(h.ExtractHeader(*this) && m_bitrate == h.bitrate) {
+ if(h.bitrate > 1) {
+ m_bitrate = h.bitrate;
+ }
m_freq = h.freq;
m_channels = h.channels;
return(true);
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.h b/src/filters/source/ShoutcastSource/ShoutcastSource.h
index 2c6a9e752..3e873955c 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.h
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -28,7 +28,7 @@
#include <qnetwork.h>
class __declspec(uuid("68F540E9-766F-44d2-AB07-E26CC6D27A79"))
-CShoutcastSource
+ CShoutcastSource
: public CSource
, public IFileSourceFilter
, public IAMFilterMiscFlags
@@ -42,7 +42,7 @@ public:
virtual ~CShoutcastSource();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IFileSourceFilter
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
@@ -52,27 +52,59 @@ public:
STDMETHODIMP_(ULONG) GetMiscFlags();
// IAMOpenProgress
- STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
- STDMETHODIMP AbortOperation();
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ STDMETHODIMP AbortOperation();
// IAMMediaContent
- STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
- STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
- STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
- STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
- STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName) {
+ return E_NOTIMPL;
+ }
STDMETHODIMP get_Title(BSTR* pbstrTitle);
- STDMETHODIMP get_Rating(BSTR* pbstrRating) {return E_NOTIMPL;}
- STDMETHODIMP get_Description(BSTR* pbstrDescription) {return E_NOTIMPL;}
- STDMETHODIMP get_Copyright(BSTR* pbstrCopyright) {return E_NOTIMPL;}
- STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
- STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
- STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
- STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
- STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
- STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
- STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
- STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
+ STDMETHODIMP get_Rating(BSTR* pbstrRating) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_Description(BSTR* pbstrDescription) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {
+ return E_NOTIMPL;
+ }
};
class CShoutcastStream : public CSourceStream
@@ -84,13 +116,19 @@ class CShoutcastStream : public CSourceStream
BYTE* pData;
REFERENCE_TIME rtStart, rtStop;
CString title;
- mp3frame(DWORD len = 0) {this->len = len; pData = len ? DNew BYTE[len] : NULL; rtStart = rtStop = 0;}
- mp3frame(const mp3frame& f) {*this = f;}
- ~mp3frame() {delete pData;}
- mp3frame& operator = (const mp3frame& f)
- {
- if(this != &f)
- {
+ mp3frame(DWORD len = 0) {
+ this->len = len;
+ pData = len ? DNew BYTE[len] : NULL;
+ rtStart = rtStop = 0;
+ }
+ mp3frame(const mp3frame& f) {
+ *this = f;
+ }
+ ~mp3frame() {
+ delete pData;
+ }
+ mp3frame& operator = (const mp3frame& f) {
+ if(this != &f) {
len = f.len;
pData = f.pData;
rtStart = f.rtStart;
@@ -109,7 +147,9 @@ class CShoutcastStream : public CSourceStream
DWORD m_nBytesRead;
public:
- CShoutcastSocket() {m_metaint = m_bitrate = m_freq = m_channels = 0;}
+ CShoutcastSocket() {
+ m_metaint = m_bitrate = m_freq = m_channels = 0;
+ }
int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
DWORD m_metaint, m_bitrate, m_freq, m_channels;
@@ -126,7 +166,7 @@ class CShoutcastStream : public CSourceStream
CString m_title;
public:
- CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr);
+ CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr);
virtual ~CShoutcastStream();
bool fExitThread;
@@ -136,15 +176,17 @@ public:
LONGLONG GetBufferFullness();
CString GetTitle();
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT FillBuffer(IMediaSample* pSample);
- HRESULT CheckMediaType(const CMediaType* pMediaType);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {return E_NOTIMPL;}
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {
+ return E_NOTIMPL;
+ }
- HRESULT OnThreadCreate();
- HRESULT OnThreadDestroy();
+ HRESULT OnThreadCreate();
+ HRESULT OnThreadDestroy();
HRESULT Inactive();
- HRESULT Pause();
+ HRESULT Pause();
};
diff --git a/src/filters/source/ShoutcastSource/stdafx.cpp b/src/filters/source/ShoutcastSource/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/ShoutcastSource/stdafx.cpp
+++ b/src/filters/source/ShoutcastSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/ShoutcastSource/stdafx.h b/src/filters/source/ShoutcastSource/stdafx.h
index 62d50a36b..d1c3768d8 100644
--- a/src/filters/source/ShoutcastSource/stdafx.h
+++ b/src/filters/source/ShoutcastSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/SubtitleSource/SubtitleSource.cpp b/src/filters/source/SubtitleSource/SubtitleSource.cpp
index b470268a9..8bd54eb70 100644
--- a/src/filters/source/SubtitleSource/SubtitleSource.cpp
+++ b/src/filters/source/SubtitleSource/SubtitleSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -32,20 +32,17 @@ static int _ATPF = 400000;
#ifdef REGISTER_FILTER
-const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
-{
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
{&MEDIATYPE_Subtitle, &MEDIASUBTYPE_NULL},
{&MEDIATYPE_Text, &MEDIASUBTYPE_NULL},
{&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
};
-const AMOVIESETUP_PIN sudOpPin[] =
-{
+const AMOVIESETUP_PIN sudOpPin[] = {
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
};
-const AMOVIESETUP_FILTER sudFilter[] =
-{
+const AMOVIESETUP_FILTER sudFilter[] = {
{&__uuidof(CSubtitleSourceASCII), L"MPC - SubtitleSource (S_TEXT/ASCII)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
{&__uuidof(CSubtitleSourceUTF8), L"MPC - SubtitleSource (S_TEXT/UTF8)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
{&__uuidof(CSubtitleSourceSSA), L"MPC - SubtitleSource (S_TEXT/SSA)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
@@ -55,13 +52,12 @@ const AMOVIESETUP_FILTER sudFilter[] =
{&__uuidof(CSubtitleSourceARGB), L"MPC - SubtitleSource (ARGB)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
};
-CFactoryTemplate g_Templates[] =
-{
+CFactoryTemplate g_Templates[] = {
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSubtitleSourceASCII>, NULL, &sudFilter[0]},
{sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSubtitleSourceUTF8>, NULL, &sudFilter[1]},
{sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CSubtitleSourceSSA>, NULL, &sudFilter[2]},
{sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CSubtitleSourceASS>, NULL, &sudFilter[3]},
-// {sudFilter[4].strName, sudFilter[4].clsID, CreateInstance<CSubtitleSourceUSF>, NULL, &sudFilter[4]},
+ // {sudFilter[4].strName, sudFilter[4].clsID, CreateInstance<CSubtitleSourceUSF>, NULL, &sudFilter[4]},
{sudFilter[5].strName, sudFilter[5].clsID, CreateInstance<CSubtitleSourcePreview>, NULL, &sudFilter[5]},
{sudFilter[6].strName, sudFilter[6].clsID, CreateInstance<CSubtitleSourceARGB>, NULL, &sudFilter[6]},
};
@@ -70,37 +66,37 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
-/*
- CString clsid = CStringFromGUID(__uuidof(CSubtitleSourcePreview));
+ /*
+ CString clsid = CStringFromGUID(__uuidof(CSubtitleSourcePreview));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".sub"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".sub"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".srt"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".srt"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".smi"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".smi"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ssa"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ssa"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ass"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ass"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".xss"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".xss"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".usf"),
- _T("Source Filter"), clsid);
-*/
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".usf"),
+ _T("Source Filter"), clsid);
+ */
return AMovieDllRegisterServer2(TRUE);
}
@@ -113,7 +109,7 @@ STDAPI DllUnregisterServer()
DeleteRegKey(_T("Media Type\\Extensions"), _T(".ass"));
DeleteRegKey(_T("Media Type\\Extensions"), _T(".xss"));
DeleteRegKey(_T("Media Type\\Extensions"), _T(".usf"));
-/**/
+ /**/
return AMovieDllRegisterServer2(FALSE);
}
@@ -122,14 +118,17 @@ STDAPI DllUnregisterServer()
class CSubtitleSourceApp : public CFilterApp
{
public:
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
+ BOOL InitInstance() {
+ if(!__super::InitInstance()) {
+ return FALSE;
+ }
_WIDTH = GetProfileInt(_T("SubtitleSource"), _T("w"), 640);
_HEIGHT = GetProfileInt(_T("SubtitleSource"), _T("h"), 480);
_ATPF = GetProfileInt(_T("SubtitleSource"), _T("atpf"), 400000);
- if(_ATPF <= 0) _ATPF = 400000;
+ if(_ATPF <= 0) {
+ _ATPF = 400000;
+ }
WriteProfileInt(_T("SubtitleSource"), _T("w"), _WIDTH);
WriteProfileInt(_T("SubtitleSource"), _T("h"), _HEIGHT);
WriteProfileInt(_T("SubtitleSource"), _T("atpf"), _ATPF);
@@ -157,9 +156,9 @@ CSubtitleSource::~CSubtitleSource()
STDMETHODIMP CSubtitleSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
+ return
QI(IFileSourceFilter)
QI(IAMFilterMiscFlags)
__super::NonDelegatingQueryInterface(riid, ppv);
@@ -167,17 +166,20 @@ STDMETHODIMP CSubtitleSource::NonDelegatingQueryInterface(REFIID riid, void** pp
// IFileSourceFilter
-STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
+ if(GetPinCount() > 0) {
return VFW_E_ALREADY_CONNECTED;
+ }
HRESULT hr = S_OK;
- if(!(DNew CSubtitleStream(pszFileName, this, &hr)))
+ if(!(DNew CSubtitleStream(pszFileName, this, &hr))) {
return E_OUTOFMEMORY;
+ }
- if(FAILED(hr))
+ if(FAILED(hr)) {
return hr;
+ }
m_fn = pszFileName;
@@ -186,10 +188,13 @@ STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* p
STDMETHODIMP CSubtitleSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ if(!ppszFileName) {
+ return E_POINTER;
+ }
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR)))) {
return E_OUTOFMEMORY;
+ }
wcscpy(*ppszFileName, m_fn);
@@ -207,7 +212,7 @@ ULONG CSubtitleSource::GetMiscFlags()
// CSubtitleStream
//
-CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr)
+CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr)
: CSourceStream(NAME("SubtitleStream"), phr, pParent, L"Output")
, CSourceSeeking(NAME("SubtitleStream"), (IPin*)this, phr, &m_cSharedState)
, m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
@@ -218,9 +223,10 @@ CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRE
CString fn(wfn);
- if(!m_rts.Open(fn, DEFAULT_CHARSET))
- {
- if(phr) *phr = E_FAIL;
+ if(!m_rts.Open(fn, DEFAULT_CHARSET)) {
+ if(phr) {
+ *phr = E_FAIL;
+ }
return;
}
@@ -229,12 +235,15 @@ CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRE
m_rts.Sort();
m_rtDuration = 0;
- for(int i = 0, cnt = m_rts.GetCount(); i < cnt; i++)
+ for(int i = 0, cnt = m_rts.GetCount(); i < cnt; i++) {
m_rtDuration = max(m_rtDuration, 10000i64*m_rts[i].end);
+ }
m_rtStop = m_rtDuration;
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ if(phr) {
+ *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ }
}
CSubtitleStream::~CSubtitleStream()
@@ -244,21 +253,20 @@ CSubtitleStream::~CSubtitleStream()
STDMETHODIMP CSubtitleStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CSubtitleStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
+ if(ThreadExists()) {
// next time around the loop, the worker thread will
// pick up the position change.
// We need to flush all the existing data - we must do that here
// as our thread will probably be blocked in GetBuffer otherwise
-
+
m_bFlushing = TRUE;
DeliverBeginFlush();
@@ -267,7 +275,7 @@ void CSubtitleStream::UpdateFromSeek()
// complete the flush
DeliverEndFlush();
- m_bFlushing = FALSE;
+ m_bFlushing = FALSE;
// restart
Run();
@@ -276,8 +284,9 @@ void CSubtitleStream::UpdateFromSeek()
HRESULT CSubtitleStream::SetRate(double dRate)
{
- if(dRate <= 0)
+ if(dRate <= 0) {
return E_INVALIDARG;
+ }
{
CAutoLock lock(CSourceSeeking::m_pLock);
@@ -291,106 +300,107 @@ HRESULT CSubtitleStream::SetRate(double dRate)
HRESULT CSubtitleStream::OnThreadStartPlay()
{
- m_bDiscontinuity = TRUE;
- return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
}
HRESULT CSubtitleStream::ChangeStart()
{
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
OnThreadCreate();
-/*
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
- m_nPosition = (int)(m_rtStart/10000)*1/1000;
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
- int m_nSegments = 0;
- if(!m_rts.SearchSubs((int)(m_rtStart/10000), 25, &m_nPosition, &m_nSegments))
- m_nPosition = m_nSegments;
- }
- else
- {
- m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
- if(m_nPosition < 0) m_nPosition = 0;
- else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
- }
-*/ }
+ /*
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ m_nPosition = (int)(m_rtStart/10000)*1/1000;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ int m_nSegments = 0;
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 25, &m_nPosition, &m_nSegments))
+ m_nPosition = m_nSegments;
+ }
+ else
+ {
+ m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
+ if(m_nPosition < 0) m_nPosition = 0;
+ else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ }
+ */
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CSubtitleStream::ChangeStop()
{
-/*
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop)
- return S_OK;
- }
-*/
- // We're already past the new stop time -- better flush the graph.
- UpdateFromSeek();
+ /*
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop)
+ return S_OK;
+ }
+ */
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CSubtitleStream::OnThreadCreate()
{
- CAutoLock cAutoLockShared(&m_cSharedState);
+ CAutoLock cAutoLockShared(&m_cSharedState);
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32) {
m_nPosition = m_rtStart/_ATPF;
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
+ } else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32) {
int m_nSegments = 0;
- if(!m_rts.SearchSubs((int)(m_rtStart/10000), 10000000/_ATPF, &m_nPosition, &m_nSegments))
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 10000000/_ATPF, &m_nPosition, &m_nSegments)) {
m_nPosition = m_nSegments;
- }
- else
- {
+ }
+ } else {
m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
- if(m_nPosition < 0) m_nPosition = 0;
- else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ if(m_nPosition < 0) {
+ m_nPosition = 0;
+ } else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) {
+ m_nPosition++;
+ }
}
- return CSourceStream::OnThreadCreate();
+ return CSourceStream::OnThreadCreate();
}
HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
-// CAutoLock cAutoLock(m_pFilter->pStateLock());
+ // CAutoLock cAutoLock(m_pFilter->pStateLock());
- ASSERT(pAlloc);
- ASSERT(pProperties);
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
- if(m_mt.majortype == MEDIATYPE_Video)
- {
+ if(m_mt.majortype == MEDIATYPE_Video) {
pProperties->cBuffers = 2;
pProperties->cbBuffer = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biSizeImage;
- }
- else
- {
+ } else {
pProperties->cBuffers = 1;
pProperties->cbBuffer = 0x10000;
}
- 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 CSubtitleStream::FillBuffer(IMediaSample* pSample)
@@ -401,12 +411,12 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
CAutoLock cAutoLockShared(&m_cSharedState);
BYTE* pData = NULL;
- if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData) {
return S_FALSE;
+ }
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -415,12 +425,12 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
int len = 0;
REFERENCE_TIME rtStart, rtStop;
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32) {
rtStart = (REFERENCE_TIME)((m_nPosition*_ATPF - m_rtStart) / m_dRateSeeking);
rtStop = (REFERENCE_TIME)(((m_nPosition+1)*_ATPF - m_rtStart) / m_dRateSeeking);
- if(m_rtStart+rtStart >= m_rtDuration)
+ if(m_rtStart+rtStart >= m_rtDuration) {
return S_FALSE;
+ }
BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
@@ -433,23 +443,24 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
len = spd.h*spd.pitch;
- for(int y = 0; y < spd.h; y++)
+ for(int y = 0; y < spd.h; y++) {
memsetd((DWORD*)(pData + spd.pitch*y), 0xff000000, spd.w*4);
+ }
RECT bbox;
m_rts.Render(spd, m_nPosition*_ATPF, 10000000.0/_ATPF, bbox);
- for(int y = 0; y < spd.h; y++)
- {
+ for(int y = 0; y < spd.h; y++) {
DWORD* p = (DWORD*)(pData + spd.pitch*y);
- for(int x = 0; x < spd.w; x++, p++)
+ for(int x = 0; x < spd.w; x++, p++) {
*p = (0xff000000-(*p&0xff000000))|(*p&0xffffff);
+ }
}
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
+ } else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32) {
const STSSegment* stss = m_rts.GetSegment(m_nPosition);
- if(!stss) return S_FALSE;
+ if(!stss) {
+ return S_FALSE;
+ }
BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
@@ -462,13 +473,15 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
len = spd.h*spd.pitch;
- for(int y = 0; y < spd.h; y++)
- {
+ for(int y = 0; y < spd.h; y++) {
DWORD c1 = 0xff606060, c2 = 0xffa0a0a0;
- if(y&32) c1 ^= c2, c2 ^= c1, c1 ^= c2;
+ if(y&32) {
+ c1 ^= c2, c2 ^= c1, c1 ^= c2;
+ }
DWORD* p = (DWORD*)(pData + spd.pitch*y);
- for(int x = 0; x < spd.w; x+=32, p+=32)
+ for(int x = 0; x < spd.w; x+=32, p+=32) {
memsetd(p, (x&32) ? c1 : c2, min(spd.w-x,32)*4);
+ }
}
RECT bbox;
@@ -476,40 +489,33 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
rtStart = (REFERENCE_TIME)((10000i64*stss->start - m_rtStart) / m_dRateSeeking);
rtStop = (REFERENCE_TIME)((10000i64*stss->end - m_rtStart) / m_dRateSeeking);
- }
- else
- {
- if(m_nPosition >= m_rts.GetCount())
+ } else {
+ if(m_nPosition >= m_rts.GetCount()) {
return S_FALSE;
+ }
STSEntry& stse = m_rts[m_nPosition];
- if(stse.start >= m_rtStop/10000)
+ if(stse.start >= m_rtStop/10000) {
return S_FALSE;
+ }
- if(m_mt.majortype == MEDIATYPE_Subtitle && m_mt.subtype == MEDIASUBTYPE_UTF8)
- {
+ if(m_mt.majortype == MEDIATYPE_Subtitle && m_mt.subtype == MEDIASUBTYPE_UTF8) {
CStringA str = UTF16To8(m_rts.GetStrW(m_nPosition, false));
memcpy((char*)pData, str, len = str.GetLength());
- }
- else if(m_mt.majortype == MEDIATYPE_Subtitle && (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS))
- {
+ } else if(m_mt.majortype == MEDIATYPE_Subtitle && (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS)) {
CStringW line;
- line.Format(L"%d,%d,%s,%s,%d,%d,%d,%s,%s",
- stse.readorder, stse.layer, CStringW(stse.style), CStringW(stse.actor),
- stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top+stse.marginRect.bottom)/2,
- CStringW(stse.effect), m_rts.GetStrW(m_nPosition, true));
+ line.Format(L"%d,%d,%s,%s,%d,%d,%d,%s,%s",
+ stse.readorder, stse.layer, CStringW(stse.style), CStringW(stse.actor),
+ stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top+stse.marginRect.bottom)/2,
+ CStringW(stse.effect), m_rts.GetStrW(m_nPosition, true));
CStringA str = UTF16To8(line);
memcpy((char*)pData, str, len = str.GetLength());
- }
- else if(m_mt.majortype == MEDIATYPE_Text && m_mt.subtype == MEDIASUBTYPE_NULL)
- {
+ } else if(m_mt.majortype == MEDIATYPE_Text && m_mt.subtype == MEDIASUBTYPE_NULL) {
CStringA str = m_rts.GetStrA(m_nPosition, false);
memcpy((char*)pData, str, len = str.GetLength());
- }
- else
- {
+ } else {
return S_FALSE;
}
@@ -525,8 +531,7 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity)
- {
+ if(m_bDiscontinuity) {
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity = FALSE;
}
@@ -541,17 +546,16 @@ HRESULT CSubtitleStream::GetMediaType(CMediaType* pmt)
HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
{
- CAutoLock lock(m_pFilter->pStateLock());
+ CAutoLock lock(m_pFilter->pStateLock());
- CMediaType mt;
- GetMediaType(&mt);
+ CMediaType mt;
+ GetMediaType(&mt);
- if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype)
- {
- return NOERROR;
- }
+ if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype) {
+ return NOERROR;
+ }
- return E_FAIL;
+ return E_FAIL;
}
STDMETHODIMP CSubtitleStream::Notify(IBaseFilter* pSender, Quality q)
@@ -570,7 +574,7 @@ CSubtitleSourceASCII::CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceASCII::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Text);
@@ -578,7 +582,7 @@ HRESULT CSubtitleSourceASCII::GetMediaType(CMediaType* pmt)
pmt->SetFormatType(&FORMAT_None);
pmt->ResetFormatBuffer();
- return NOERROR;
+ return NOERROR;
}
//
@@ -592,7 +596,7 @@ CSubtitleSourceUTF8::CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceUTF8::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Subtitle);
@@ -602,7 +606,7 @@ HRESULT CSubtitleSourceUTF8::GetMediaType(CMediaType* pmt)
memset(psi, 0, pmt->FormatLength());
strcpy(psi->IsoLang, "eng");
- return NOERROR;
+ return NOERROR;
}
//
@@ -616,7 +620,7 @@ CSubtitleSourceSSA::CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Subtitle);
@@ -629,15 +633,17 @@ HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
CFile f;
TCHAR path[_MAX_PATH], fn[_MAX_PATH];
- if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn)) {
return E_FAIL;
+ }
_tremove(fn);
_tcscat(fn, _T(".ssa"));
- if(!sts.SaveAs(fn, EXTSSA, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ if(!sts.SaveAs(fn, EXTSSA, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead)) {
return E_FAIL;
+ }
int len = (int)f.GetLength()-3;
f.Seek(3, CFile::begin);
@@ -651,7 +657,7 @@ HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
_tremove(fn);
- return NOERROR;
+ return NOERROR;
}
//
@@ -665,7 +671,7 @@ CSubtitleSourceASS::CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Subtitle);
@@ -678,15 +684,17 @@ HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
CFile f;
TCHAR path[_MAX_PATH], fn[_MAX_PATH];
- if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn)) {
return E_FAIL;
+ }
_tremove(fn);
_tcscat(fn, _T(".ass"));
- if(!sts.SaveAs(fn, EXTASS, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ if(!sts.SaveAs(fn, EXTASS, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead)) {
return E_FAIL;
+ }
int len = (int)f.GetLength();
@@ -699,7 +707,7 @@ HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
_tremove(fn);
- return NOERROR;
+ return NOERROR;
}
//
@@ -713,7 +721,7 @@ CSubtitleSourceUSF::CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceUSF::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Subtitle);
@@ -724,7 +732,7 @@ HRESULT CSubtitleSourceUSF::GetMediaType(CMediaType* pmt)
strcpy(psi->IsoLang, "eng");
// TODO: ...
- return NOERROR;
+ return NOERROR;
}
//
@@ -738,7 +746,7 @@ CSubtitleSourcePreview::CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourcePreview::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Video);
@@ -754,7 +762,7 @@ HRESULT CSubtitleSourcePreview::GetMediaType(CMediaType* pmt)
pvih->bmiHeader.biPlanes = 1;
pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
- return NOERROR;
+ return NOERROR;
}
//
@@ -768,7 +776,7 @@ CSubtitleSourceARGB::CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr)
HRESULT CSubtitleSourceARGB::GetMediaType(CMediaType* pmt)
{
- CAutoLock cAutoLock(pStateLock());
+ CAutoLock cAutoLock(pStateLock());
pmt->InitMediaType();
pmt->SetType(&MEDIATYPE_Video);
@@ -785,5 +793,5 @@ HRESULT CSubtitleSourceARGB::GetMediaType(CMediaType* pmt)
pvih->bmiHeader.biPlanes = 1;
pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
- return NOERROR;
+ return NOERROR;
}
diff --git a/src/filters/source/SubtitleSource/SubtitleSource.h b/src/filters/source/SubtitleSource/SubtitleSource.h
index 459db7b6a..071a13e4a 100644
--- a/src/filters/source/SubtitleSource/SubtitleSource.h
+++ b/src/filters/source/SubtitleSource/SubtitleSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -37,7 +37,7 @@ public:
virtual ~CSubtitleSource();
DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IFileSourceFilter
STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
@@ -46,10 +46,10 @@ public:
// IAMFilterMiscFlags
STDMETHODIMP_(ULONG) GetMiscFlags();
- virtual HRESULT GetMediaType(CMediaType* pmt) = 0;
+ virtual HRESULT GetMediaType(CMediaType* pmt) = 0;
};
-class CSubtitleStream
+class CSubtitleStream
: public CSourceStream
, public CSourceSeeking
{
@@ -66,28 +66,30 @@ class CSubtitleStream
STDMETHODIMP SetRate(double dRate);
HRESULT ChangeStart();
- HRESULT ChangeStop();
- HRESULT ChangeRate() {return S_OK;}
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {
+ return S_OK;
+ }
protected:
CRenderedTextSubtitle m_rts;
public:
- CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr);
+ CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr);
virtual ~CSubtitleStream();
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT FillBuffer(IMediaSample* pSample);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT GetMediaType(CMediaType* pmt);
HRESULT CheckMediaType(const CMediaType* pmt);
STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
class __declspec(uuid("E44CA3B5-A0FF-41A0-AF16-42429B1095EA"))
-CSubtitleSourceASCII : public CSubtitleSource
+ CSubtitleSourceASCII : public CSubtitleSource
{
public:
CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr);
@@ -96,7 +98,7 @@ public:
};
class __declspec(uuid("87864E0F-7073-4E39-B802-143DE0ED4964"))
-CSubtitleSourceUTF8 : public CSubtitleSource
+ CSubtitleSourceUTF8 : public CSubtitleSource
{
public:
CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr);
@@ -105,7 +107,7 @@ public:
};
class __declspec(uuid("18316B1A-5877-4CC4-85FD-EDE65CD489EC"))
-CSubtitleSourceSSA : public CSubtitleSource
+ CSubtitleSourceSSA : public CSubtitleSource
{
public:
CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr);
@@ -114,7 +116,7 @@ public:
};
class __declspec(uuid("416782BC-1D87-48C0-8F65-F113A5CB8E15"))
-CSubtitleSourceASS : public CSubtitleSource
+ CSubtitleSourceASS : public CSubtitleSource
{
public:
CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr);
@@ -123,7 +125,7 @@ public:
};
class __declspec(uuid("D7215AFC-DFE6-483B-9AF3-6BBECFF14CF4"))
-CSubtitleSourceUSF : public CSubtitleSource
+ CSubtitleSourceUSF : public CSubtitleSource
{
public:
CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr);
@@ -132,7 +134,7 @@ public:
};
class __declspec(uuid("932E75D4-BBD4-4A0F-9071-6728FBDC4C98"))
-CSubtitleSourcePreview : public CSubtitleSource
+ CSubtitleSourcePreview : public CSubtitleSource
{
public:
CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr);
@@ -141,7 +143,7 @@ public:
};
class __declspec(uuid("CF0D7280-527D-415E-BA02-56017484D73E"))
-CSubtitleSourceARGB : public CSubtitleSource
+ CSubtitleSourceARGB : public CSubtitleSource
{
public:
CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr);
diff --git a/src/filters/source/SubtitleSource/stdafx.cpp b/src/filters/source/SubtitleSource/stdafx.cpp
index 13934d005..bea3f980a 100644
--- a/src/filters/source/SubtitleSource/stdafx.cpp
+++ b/src/filters/source/SubtitleSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/src/filters/source/SubtitleSource/stdafx.h b/src/filters/source/SubtitleSource/stdafx.h
index 62d50a36b..d1c3768d8 100644
--- a/src/filters/source/SubtitleSource/stdafx.h
+++ b/src/filters/source/SubtitleSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.