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:
authortetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
committertetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
commita9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch)
tree2dab453d94d5e003379a6cc895eceb84c80e23ec /src/filters/transform/AVI2AC3Filter
parentaafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (diff)
astyle formatting cleanup to make the sourcecode more accessible
switch used: astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren http://astyle.sourceforge.net/ git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1783 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/AVI2AC3Filter')
-rw-r--r--src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp798
-rw-r--r--src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h30
-rw-r--r--src/filters/transform/AVI2AC3Filter/resource.h2
-rw-r--r--src/filters/transform/AVI2AC3Filter/stdafx.cpp8
-rw-r--r--src/filters/transform/AVI2AC3Filter/stdafx.h8
5 files changed, 423 insertions, 423 deletions
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
index d4ad8c14e..16915d94a 100644
--- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
+++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -31,13 +31,13 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -48,7 +48,7 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CAVI2AC3Filter), L"MPC - AVI<->AC3/DTS", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CAVI2AC3Filter), L"MPC - AVI<->AC3/DTS", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
@@ -60,12 +60,12 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -79,9 +79,9 @@ CFilterApp theApp;
//
CAVI2AC3Filter::CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
+ : CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CAVI2AC3Filter::~CAVI2AC3Filter()
@@ -90,432 +90,432 @@ CAVI2AC3Filter::~CAVI2AC3Filter()
HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
{
- HRESULT hr;
-
- BYTE* pIn = NULL;
- if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
- BYTE* pInOrg = pIn;
-
- long len = pSample->GetActualDataLength();
- if(len <= 0) return S_FALSE;
-
- BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
- BYTE* pOutOrg = pOut;
-
- int size = pOutSample->GetSize();
-
- if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
- && (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType())))
- {
- if(*(DWORD*)pIn == 0xBA010000)
- {
- pIn += 14;
- }
-
- if(*(DWORD*)pIn == 0xBD010000)
- {
- pIn += 8 + 1 + pIn[8] + 1 + 3;
- }
-
- len -= (pInOrg - pIn);
-
- if(size < len) return E_FAIL;
-
- memcpy(pOut, pIn, len);
- pOut += len;
- }
- else if((CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
- && (CheckAC3(&m_pOutput->CurrentMediaType()) || CheckDTS(&m_pOutput->CurrentMediaType())))
- {
- if((m_pOutput->CurrentMediaType().majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
- || m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
- && (len + 12 + 3) >= 0x10000) // damn, this can happen if the interleave time is too big
- {
- REFERENCE_TIME rtStart = 0, rtStop = 1;
- bool fHasTime = (S_OK == pSample->GetTime(&rtStart, &rtStop));
-
- bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
-
- int pos = 0;
- while(pos < len)
- {
- int curlen = min(len - pos, 2013);
- pos += 2013;
-
- CComPtr<IMediaSample> pOutSample;
- hr = InitializeOutputSample(pSample, &pOutSample);
-
- if(fDiscontinuity)
- {
- if(fHasTime)
- {
- rtStop = rtStart + (rtStop - rtStart) * curlen / len;
- pOutSample->SetTime(&rtStart, &rtStop);
- }
-
- fDiscontinuity = false;
- }
- else
- {
- pOutSample->SetTime(NULL, NULL);
- pOutSample->SetDiscontinuity(FALSE);
- }
-
- BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
- BYTE* pOutOrg = pOut;
-
- int size = pOutSample->GetSize();
-
- const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
- const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
-
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- if(size < curlen + 32 + 3) return E_FAIL;
-
- 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)
- };
-
- memcpy(pOut, &PESHeader, sizeof(PESHeader));
- pOut += sizeof(PESHeader);
-
- majortype = &MEDIATYPE_MPEG2_PES;
- }
-
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- if(size < curlen + 20 + 3) return E_FAIL;
-
- BYTE Private1Header[] =
- {
- 0x00,0x00,0x01,0xBD, // private stream 1 id
- 0x07,0xEC, // packet length (TODO: modify it later)
- 0x81,0x80, // marker, original, PTS - flags
- 0x08, // packet data starting offset
- 0x21,0x00,0x01,0x00,0x01, // PTS (0)
- 0xFF,0xFF,0xFF, // stuffing
- 0x80, // stream id (0)
- 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
- };
-
- int packetlen = curlen + 12 + 3;
- ASSERT(packetlen <= 0xffff);
- Private1Header[4] = (packetlen>>8)&0xff;
- Private1Header[5] = packetlen&0xff;
-
- if(*subtype == MEDIASUBTYPE_DTS)
- {
- Private1Header[17] += 8;
- }
-
- if(*subtype == MEDIASUBTYPE_DOLBY_AC3)
- {
- for(int i = 0; i < curlen; i++)
- {
- if(*(DWORD*)&pIn[i] == 0x770B)
- {
- i++;
- Private1Header[19] = (i>>8)&0xff;
- Private1Header[20] = i&0xff;
- break;
- }
- }
- }
- else if(*subtype == MEDIASUBTYPE_DTS)
- {
- for(int i = 0; i < curlen; i++)
- {
- if(*(DWORD*)&pIn[i] == 0x0180FE7F)
- {
- i++;
- Private1Header[19] = (i>>8)&0xff;
- Private1Header[20] = i&0xff;
- break;
- }
- }
- }
-
- memcpy(pOut, &Private1Header, sizeof(Private1Header));
- pOut += sizeof(Private1Header);
-
- majortype = &MEDIATYPE_Audio;
- }
-
- if(*majortype == MEDIATYPE_Audio)
- {
- if(size < curlen) return E_FAIL;
- memcpy(pOut, pIn, curlen);
- pIn += curlen;
- pOut += curlen;
- }
-
- pOutSample->SetActualDataLength(pOut - pOutOrg);
-
- hr = m_pOutput->Deliver(pOutSample);
- }
-
- return S_FALSE;
- }
- else // phew, we can do the easier way
- {
- const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
- const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
-
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- if(size < len + 32 + 3) return E_FAIL;
-
- 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)
- };
-
- memcpy(pOut, &PESHeader, sizeof(PESHeader));
- pOut += sizeof(PESHeader);
-
- majortype = &MEDIATYPE_MPEG2_PES;
- }
-
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- if(size < len + 20 + 3) return E_FAIL;
-
- BYTE Private1Header[] =
- {
- 0x00,0x00,0x01,0xBD, // private stream 1 id
- 0x07,0xEC, // packet length (TODO: modify it later)
- 0x81,0x80, // marker, original, PTS - flags
- 0x08, // packet data starting offset
- 0x21,0x00,0x01,0x00,0x01, // PTS (0)
- 0xFF,0xFF,0xFF, // stuffing
- 0x80, // stream id (0)
- 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
- };
-
- int packetlen = len + 12 + 3;
- ASSERT(packetlen <= 0xffff);
- Private1Header[4] = (packetlen>>8)&0xff;
- Private1Header[5] = packetlen&0xff;
-
- if(*subtype == MEDIASUBTYPE_DTS)
- {
- Private1Header[17] += 8;
- }
-
- memcpy(pOut, &Private1Header, sizeof(Private1Header));
- pOut += sizeof(Private1Header);
-
- majortype = &MEDIATYPE_Audio;
- }
-
- if(*majortype == MEDIATYPE_Audio)
- {
- if(size < len) return E_FAIL;
-
- memcpy(pOut, pIn, len);
- pIn += len;
- pOut += len;
- }
- }
- }
- else
- {
- return E_FAIL;
- }
-
- pOutSample->SetActualDataLength(pOut - pOutOrg);
-
- return S_OK;
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ BYTE* pInOrg = pIn;
+
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ && (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if(*(DWORD*)pIn == 0xBA010000)
+ {
+ pIn += 14;
+ }
+
+ if(*(DWORD*)pIn == 0xBD010000)
+ {
+ pIn += 8 + 1 + pIn[8] + 1 + 3;
+ }
+
+ len -= (pInOrg - pIn);
+
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pOut += len;
+ }
+ else if((CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ && (CheckAC3(&m_pOutput->CurrentMediaType()) || CheckDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if((m_pOutput->CurrentMediaType().majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ || m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
+ && (len + 12 + 3) >= 0x10000) // damn, this can happen if the interleave time is too big
+ {
+ REFERENCE_TIME rtStart = 0, rtStop = 1;
+ bool fHasTime = (S_OK == pSample->GetTime(&rtStart, &rtStop));
+
+ bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
+
+ int pos = 0;
+ while(pos < len)
+ {
+ int curlen = min(len - pos, 2013);
+ pos += 2013;
+
+ CComPtr<IMediaSample> pOutSample;
+ hr = InitializeOutputSample(pSample, &pOutSample);
+
+ if(fDiscontinuity)
+ {
+ if(fHasTime)
+ {
+ rtStop = rtStart + (rtStop - rtStart) * curlen / len;
+ pOutSample->SetTime(&rtStart, &rtStop);
+ }
+
+ fDiscontinuity = false;
+ }
+ else
+ {
+ pOutSample->SetTime(NULL, NULL);
+ pOutSample->SetDiscontinuity(FALSE);
+ }
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < curlen + 32 + 3) return E_FAIL;
+
+ 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)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < curlen + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00, 0x00, 0x01, 0xBD, // private stream 1 id
+ 0x07, 0xEC, // packet length (TODO: modify it later)
+ 0x81, 0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21, 0x00, 0x01, 0x00, 0x01, // PTS (0)
+ 0xFF, 0xFF, 0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01, 0x00, 0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = curlen + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen >> 8) & 0xff;
+ Private1Header[5] = packetlen & 0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ if(*subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x770B)
+ {
+ i++;
+ Private1Header[19] = (i >> 8) & 0xff;
+ Private1Header[20] = i & 0xff;
+ break;
+ }
+ }
+ }
+ else if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x0180FE7F)
+ {
+ i++;
+ Private1Header[19] = (i >> 8) & 0xff;
+ Private1Header[20] = i & 0xff;
+ break;
+ }
+ }
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < curlen) return E_FAIL;
+ memcpy(pOut, pIn, curlen);
+ pIn += curlen;
+ pOut += curlen;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ hr = m_pOutput->Deliver(pOutSample);
+ }
+
+ return S_FALSE;
+ }
+ else // phew, we can do the easier way
+ {
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < len + 32 + 3) return E_FAIL;
+
+ 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)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < len + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00, 0x00, 0x01, 0xBD, // private stream 1 id
+ 0x07, 0xEC, // packet length (TODO: modify it later)
+ 0x81, 0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21, 0x00, 0x01, 0x00, 0x01, // PTS (0)
+ 0xFF, 0xFF, 0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01, 0x00, 0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = len + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen >> 8) & 0xff;
+ Private1Header[5] = packetlen & 0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pIn += len;
+ pOut += len;
+ }
+ }
+ }
+ else
+ {
+ return E_FAIL;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ return S_OK;
}
bool CAVI2AC3Filter::CheckAC3(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
}
bool CAVI2AC3Filter::CheckDTS(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DTS;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DTS;
}
bool CAVI2AC3Filter::CheckWAVEAC3(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
}
bool CAVI2AC3Filter::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;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
}
HRESULT CAVI2AC3Filter::CheckInputType(const CMediaType* mtIn)
{
- bool fWaveFormatEx = !!(mtIn->formattype == FORMAT_WaveFormatEx);
+ bool fWaveFormatEx = !!(mtIn->formattype == FORMAT_WaveFormatEx);
- return CheckAC3(mtIn) && fWaveFormatEx || CheckDTS(mtIn) && fWaveFormatEx
- || CheckWAVEAC3(mtIn) || CheckWAVEDTS(mtIn)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return CheckAC3(mtIn) && fWaveFormatEx || CheckDTS(mtIn) && fWaveFormatEx
+ || CheckWAVEAC3(mtIn) || CheckWAVEDTS(mtIn)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CAVI2AC3Filter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return CheckAC3(mtIn) && CheckWAVEAC3(mtOut)
- || CheckWAVEAC3(mtIn) && CheckAC3(mtOut)
- || CheckDTS(mtIn) && CheckWAVEDTS(mtOut)
- || CheckWAVEDTS(mtIn) && CheckDTS(mtOut)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return CheckAC3(mtIn) && CheckWAVEAC3(mtOut)
+ || CheckWAVEAC3(mtIn) && CheckAC3(mtOut)
+ || CheckDTS(mtIn) && CheckWAVEDTS(mtOut)
+ || CheckWAVEDTS(mtIn) && CheckDTS(mtOut)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- pAllocatorIn->GetProperties(pProperties);
+ pAllocatorIn->GetProperties(pProperties);
- pProperties->cBuffers = 2;
- pProperties->cbBuffer = max(pProperties->cbBuffer, 1024*1024); // this should be enough...
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = 2;
+ pProperties->cbBuffer = max(pProperties->cbBuffer, 1024 * 1024); // this should be enough...
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- const GUID& majortype = m_pInput->CurrentMediaType().majortype;
- const GUID& subtype = m_pInput->CurrentMediaType().subtype;
-
- if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
- {
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
-
- pMediaType->majortype = MEDIATYPE_Audio;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->nAvgBytesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nAvgBytesPerSec;
- wfe->nSamplesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nSamplesPerSec;
- wfe->wBitsPerSample = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->wBitsPerSample;
- wfe->nChannels = 2;
- wfe->nBlockAlign = 1;
-
- if(subtype == MEDIASUBTYPE_DOLBY_AC3)
- {
- pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
- wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- }
- else if(subtype == MEDIASUBTYPE_DTS)
- {
- pMediaType->subtype = MEDIASUBTYPE_WAVE_DTS;
- wfe->wFormatTag = WAVE_FORMAT_DVD_DTS;
- }
- else
- {
- return E_INVALIDARG;
- }
- }
- else if(CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
- {
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 4) return VFW_S_NO_MORE_ITEMS;
-
- if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
- {
- pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- DOLBYAC3WAVEFORMAT* wfe = (DOLBYAC3WAVEFORMAT*)pMediaType->AllocFormatBuffer(sizeof(DOLBYAC3WAVEFORMAT));
- memset(wfe, 0, sizeof(DOLBYAC3WAVEFORMAT));
- // unfortunately we can't tell what we are going to get in transform,
- // so we just set the most common values and hope that the ac3 decoder
- // is flexible enough (it is usually :) to find out these from the bitstream
- wfe->wfx.cbSize = sizeof(DOLBYAC3WAVEFORMAT) - sizeof(WAVEFORMATEX);
- wfe->wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- wfe->wfx.nSamplesPerSec = 48000;
- wfe->wfx.nChannels = 6;
- wfe->bBigEndian = TRUE;
- }
- else if(subtype == MEDIASUBTYPE_WAVE_DTS)
- {
- pMediaType->subtype = MEDIASUBTYPE_DTS;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- // same case as with ac3, but this time we don't even know the structure
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = WAVE_FORMAT_PCM;
- wfe->nSamplesPerSec = 48000;
- wfe->nChannels = 6;
- }
- else
- {
- return E_INVALIDARG;
- }
-
- switch(iPosition)
- {
- case 0:
- pMediaType->majortype = MEDIATYPE_Audio;
- break;
- case 1:
- pMediaType->ResetFormatBuffer();
- pMediaType->formattype = FORMAT_None;
- case 2:
- pMediaType->majortype = MEDIATYPE_MPEG2_PES;
- break;
- case 3:
- pMediaType->ResetFormatBuffer();
- pMediaType->formattype = FORMAT_None;
- case 4:
- pMediaType->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- else
- {
- return VFW_S_NO_MORE_ITEMS;
- }
-
- return S_OK;
+ const GUID& majortype = m_pInput->CurrentMediaType().majortype;
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pMediaType->majortype = MEDIATYPE_Audio;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->nAvgBytesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nAvgBytesPerSec;
+ wfe->nSamplesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nSamplesPerSec;
+ wfe->wBitsPerSample = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->wBitsPerSample;
+ wfe->nChannels = 2;
+ wfe->nBlockAlign = 1;
+
+ if(subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
+ wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ }
+ else if(subtype == MEDIASUBTYPE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DTS;
+ wfe->wFormatTag = WAVE_FORMAT_DVD_DTS;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+ }
+ else if(CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 4) return VFW_S_NO_MORE_ITEMS;
+
+ if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ DOLBYAC3WAVEFORMAT* wfe = (DOLBYAC3WAVEFORMAT*)pMediaType->AllocFormatBuffer(sizeof(DOLBYAC3WAVEFORMAT));
+ memset(wfe, 0, sizeof(DOLBYAC3WAVEFORMAT));
+ // unfortunately we can't tell what we are going to get in transform,
+ // so we just set the most common values and hope that the ac3 decoder
+ // is flexible enough (it is usually :) to find out these from the bitstream
+ wfe->wfx.cbSize = sizeof(DOLBYAC3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+ wfe->wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ wfe->wfx.nSamplesPerSec = 48000;
+ wfe->wfx.nChannels = 6;
+ wfe->bBigEndian = TRUE;
+ }
+ else if(subtype == MEDIASUBTYPE_WAVE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DTS;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ // same case as with ac3, but this time we don't even know the structure
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nSamplesPerSec = 48000;
+ wfe->nChannels = 6;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+
+ switch(iPosition)
+ {
+ case 0:
+ pMediaType->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 2:
+ pMediaType->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 4:
+ pMediaType->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+ return S_OK;
}
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
index 30d36fa51..1bc126606 100644
--- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
+++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -49,18 +49,18 @@ typedef struct tagDOLBYAC3WAVEFORMAT
[uuid("93230DD0-7B3C-4efb-AFBB-DC380FEC9E6B")]
class CAVI2AC3Filter : public CTransformFilter
{
- bool CheckAC3(const CMediaType* pmt);
- bool CheckDTS(const CMediaType* pmt);
- bool CheckWAVEAC3(const CMediaType* pmt);
- bool CheckWAVEDTS(const CMediaType* pmt);
+ bool CheckAC3(const CMediaType* pmt);
+ bool CheckDTS(const CMediaType* pmt);
+ bool CheckWAVEAC3(const CMediaType* pmt);
+ bool CheckWAVEDTS(const CMediaType* pmt);
public:
- CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CAVI2AC3Filter();
+ CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CAVI2AC3Filter();
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
};
diff --git a/src/filters/transform/AVI2AC3Filter/resource.h b/src/filters/transform/AVI2AC3Filter/resource.h
index 599923e8b..b4c366537 100644
--- a/src/filters/transform/AVI2AC3Filter/resource.h
+++ b/src/filters/transform/AVI2AC3Filter/resource.h
@@ -3,7 +3,7 @@
// Used by avi2ac3filter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/transform/AVI2AC3Filter/stdafx.cpp b/src/filters/transform/AVI2AC3Filter/stdafx.cpp
index 0ad87fbc7..a97315dee 100644
--- a/src/filters/transform/AVI2AC3Filter/stdafx.cpp
+++ b/src/filters/transform/AVI2AC3Filter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/AVI2AC3Filter/stdafx.h b/src/filters/transform/AVI2AC3Filter/stdafx.h
index c35359c38..a9f666228 100644
--- a/src/filters/transform/AVI2AC3Filter/stdafx.h
+++ b/src/filters/transform/AVI2AC3Filter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/