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>2012-02-05 13:27:07 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2012-02-05 13:27:07 +0400
commit6cb2939b677159a85147c6500835c194ee1ccf86 (patch)
tree54994b57d8df3203b276d15ee73c46d227ea6826 /src/filters
parente736ccc10964dfcd571d1b0f07327819c31a63a9 (diff)
apply astyle
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4039 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters')
-rw-r--r--src/filters/FilterApp.cpp2
-rw-r--r--src/filters/InternalPropertyPage.cpp54
-rw-r--r--src/filters/InternalPropertyPage.h4
-rw-r--r--src/filters/PinInfoWnd.cpp32
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxer.cpp98
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp48
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp138
-rw-r--r--src/filters/muxer/BaseMuxer/BitStream.cpp16
-rw-r--r--src/filters/muxer/DSMMuxer/DSMMuxer.cpp68
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp122
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.h4
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp258
-rw-r--r--src/filters/muxer/WavDest/WavDest.cpp36
-rw-r--r--src/filters/parser/AviSplitter/AviFile.cpp154
-rw-r--r--src/filters/parser/AviSplitter/AviReportWnd.cpp56
-rw-r--r--src/filters/parser/AviSplitter/AviSplitter.cpp214
-rw-r--r--src/filters/parser/BaseSplitter/AsyncReader.cpp46
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitter.cpp278
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitter.h124
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFile.cpp44
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp468
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.h10
-rw-r--r--src/filters/parser/BaseSplitter/MultiFiles.cpp2
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitter.cpp48
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitterFile.cpp110
-rw-r--r--src/filters/parser/FLVSplitter/FLVSplitter.cpp154
-rw-r--r--src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp14
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp484
-rw-r--r--src/filters/parser/MP4Splitter/MP4SplitterFile.cpp2
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaFile.cpp232
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp330
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaSplitter.h2
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitter.cpp26
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitterFile.cpp90
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.cpp423
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.h2
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.cpp382
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.h27
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp16
-rw-r--r--src/filters/parser/OggSplitter/OggFile.cpp20
-rw-r--r--src/filters/parser/OggSplitter/OggSplitter.cpp270
-rw-r--r--src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp592
-rw-r--r--src/filters/parser/SSFSplitter/SSFSplitter.cpp34
-rw-r--r--src/filters/parser/StreamDriveThru/StreamDriveThru.cpp72
-rw-r--r--src/filters/reader/CDDAReader/CDDAReader.cpp64
-rw-r--r--src/filters/reader/CDXAReader/CDXAReader.cpp92
-rw-r--r--src/filters/reader/UDPReader/UDPReader.cpp94
-rw-r--r--src/filters/reader/VTSReader/VTSReader.cpp26
-rw-r--r--src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp232
-rw-r--r--src/filters/renderer/MpcAudioRenderer/MpcAudioRendererSettingsWnd.cpp52
-rw-r--r--src/filters/renderer/SyncClock/Interfaces.h2
-rw-r--r--src/filters/renderer/SyncClock/SyncClock.cpp6
-rw-r--r--src/filters/renderer/SyncClock/SyncClock.h2
-rw-r--r--src/filters/renderer/SyncClock/stdafx.cpp2
-rw-r--r--src/filters/renderer/SyncClock/stdafx.h2
-rw-r--r--src/filters/renderer/VideoRenderers/AllocatorCommon.cpp8
-rw-r--r--src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp4
-rw-r--r--src/filters/renderer/VideoRenderers/D3DFont.cpp146
-rw-r--r--src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp72
-rw-r--r--src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp108
-rw-r--r--src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp104
-rw-r--r--src/filters/renderer/VideoRenderers/DX9RenderingEngine.h2
-rw-r--r--src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp40
-rw-r--r--src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp90
-rw-r--r--src/filters/renderer/VideoRenderers/IPinHook.cpp78
-rw-r--r--src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp12
-rw-r--r--src/filters/renderer/VideoRenderers/OuterEVR.h6
-rw-r--r--src/filters/renderer/VideoRenderers/OuterVMR.cpp16
-rw-r--r--src/filters/renderer/VideoRenderers/OuterVMR.h12
-rw-r--r--src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp26
-rw-r--r--src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp16
-rw-r--r--src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp20
-rw-r--r--src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp44
-rw-r--r--src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp54
-rw-r--r--src/filters/renderer/VideoRenderers/SyncRenderer.cpp296
-rw-r--r--src/filters/renderer/VideoRenderers/SyncRenderer.h2
-rw-r--r--src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp64
-rw-r--r--src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp86
-rw-r--r--src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp44
-rw-r--r--src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h4
-rw-r--r--src/filters/source/BaseSource/BaseSource.cpp14
-rw-r--r--src/filters/source/BaseSource/BaseSource.h12
-rw-r--r--src/filters/source/D2VSource/D2VSource.cpp44
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.cpp144
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.h2
-rw-r--r--src/filters/source/FLACSource/FLACSource.cpp10
-rw-r--r--src/filters/source/FLICSource/FLICSource.cpp132
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.cpp132
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.h2
-rw-r--r--src/filters/source/SubtitleSource/SubtitleSource.cpp86
-rw-r--r--src/filters/switcher/AudioSwitcher/Audio.cpp48
-rw-r--r--src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp182
-rw-r--r--src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp258
-rw-r--r--src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp100
-rw-r--r--src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp164
-rw-r--r--src/filters/transform/BufferFilter/BufferFilter.cpp54
-rw-r--r--src/filters/transform/DeCSSFilter/DeCSSFilter.cpp48
-rw-r--r--src/filters/transform/MPCVideoDec/CpuId.cpp40
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoder.cpp8
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp16
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp8
-rw-r--r--src/filters/transform/MPCVideoDec/FfmpegContext.c88
-rw-r--r--src/filters/transform/MPCVideoDec/H264RandomAccess.cpp86
-rw-r--r--src/filters/transform/MPCVideoDec/H264RandomAccess.h18
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp196
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h4
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp18
-rw-r--r--src/filters/transform/MPCVideoDec/stdafx.cpp4
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecFilter.cpp478
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp32
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp424
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h4
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp14
-rw-r--r--src/filters/transform/VSFilter/AvgLines.cpp34
-rw-r--r--src/filters/transform/VSFilter/Copy.cpp66
-rw-r--r--src/filters/transform/VSFilter/DirectVobSub.cpp128
-rw-r--r--src/filters/transform/VSFilter/DirectVobSubFilter.cpp456
-rw-r--r--src/filters/transform/VSFilter/DirectVobSubPropPage.cpp196
-rw-r--r--src/filters/transform/VSFilter/Scale2x.cpp40
-rw-r--r--src/filters/transform/VSFilter/StyleEditorDialog.cpp32
-rw-r--r--src/filters/transform/VSFilter/Systray.cpp86
-rw-r--r--src/filters/transform/VSFilter/VSFilter.cpp12
-rw-r--r--src/filters/transform/VSFilter/plugins.cpp102
123 files changed, 5779 insertions, 5777 deletions
diff --git a/src/filters/FilterApp.cpp b/src/filters/FilterApp.cpp
index 059fcda74..bba89e1c0 100644
--- a/src/filters/FilterApp.cpp
+++ b/src/filters/FilterApp.cpp
@@ -32,7 +32,7 @@ CFilterApp::CFilterApp()
BOOL CFilterApp::InitInstance()
{
- if(!__super::InitInstance()) {
+ if (!__super::InitInstance()) {
return FALSE;
}
diff --git a/src/filters/InternalPropertyPage.cpp b/src/filters/InternalPropertyPage.cpp
index 9694d1b4c..fa9dc0ba3 100644
--- a/src/filters/InternalPropertyPage.cpp
+++ b/src/filters/InternalPropertyPage.cpp
@@ -37,17 +37,17 @@ CInternalPropertyPageWnd::CInternalPropertyPageWnd()
BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd)
{
- if(!pPageSite || !pRect) {
+ if (!pPageSite || !pRect) {
return FALSE;
}
m_pPageSite = pPageSite;
- if(!m_font.m_hObject) {
+ if (!m_font.m_hObject) {
CString face;
WORD height;
extern BOOL AFXAPI AfxGetPropSheetFont(CString& strFace, WORD& wSize, BOOL bWizard); // yay
- if(!AfxGetPropSheetFont(face, height, FALSE)) {
+ if (!AfxGetPropSheetFont(face, height, FALSE)) {
return FALSE;
}
@@ -59,15 +59,15 @@ BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRec
::ReleaseDC(0, hDC);
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET;
- if(!m_font.CreateFontIndirect(&lf)) {
+ if (!m_font.CreateFontIndirect(&lf)) {
return FALSE;
}
lf.lfHeight -= -1;
_tcscpy(lf.lfFaceName, _T("Lucida Console"));
- if(!m_monospacefont.CreateFontIndirect(&lf)) {
+ if (!m_monospacefont.CreateFontIndirect(&lf)) {
_tcscpy(lf.lfFaceName, _T("Courier New"));
- if(!m_monospacefont.CreateFontIndirect(&lf)) {
+ if (!m_monospacefont.CreateFontIndirect(&lf)) {
return FALSE;
}
}
@@ -83,7 +83,7 @@ BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRec
}
LPCTSTR wc = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, 0, (HBRUSH)(COLOR_BTNFACE + 1));
- if(!CreateEx(0, wc, _T("CInternalPropertyPageWnd"), WS_CHILDWINDOW, *pRect, pParentWnd, 0)) {
+ if (!CreateEx(0, wc, _T("CInternalPropertyPageWnd"), WS_CHILDWINDOW, *pRect, pParentWnd, 0)) {
return FALSE;
}
@@ -94,7 +94,7 @@ BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRec
BOOL CInternalPropertyPageWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
- if(message == WM_COMMAND || message == WM_HSCROLL || message == WM_VSCROLL) {
+ if (message == WM_COMMAND || message == WM_HSCROLL || message == WM_VSCROLL) {
SetDirty(true);
}
@@ -112,15 +112,15 @@ CInternalPropertyPage::CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr)
: CUnknown(_T("CInternalPropertyPage"), lpunk)
, m_pWnd(NULL)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
CInternalPropertyPage::~CInternalPropertyPage()
{
- if(m_pWnd) {
- if(m_pWnd->m_hWnd) {
+ if (m_pWnd) {
+ if (m_pWnd->m_hWnd) {
ASSERT(0);
m_pWnd->DestroyWindow();
}
@@ -142,7 +142,7 @@ STDMETHODIMP CInternalPropertyPage::SetPageSite(IPropertyPageSite* pPageSite)
{
CAutoLock cAutoLock(this);
- if(pPageSite && m_pPageSite || !pPageSite && !m_pPageSite) {
+ if (pPageSite && m_pPageSite || !pPageSite && !m_pPageSite) {
return E_UNEXPECTED;
}
@@ -159,15 +159,15 @@ STDMETHODIMP CInternalPropertyPage::Activate(HWND hwndParent, LPCRECT pRect, BOO
CheckPointer(pRect, E_POINTER);
- if(!m_pWnd || m_pWnd->m_hWnd || m_pUnks.IsEmpty()) {
+ if (!m_pWnd || m_pWnd->m_hWnd || m_pUnks.IsEmpty()) {
return E_UNEXPECTED;
}
- if(!m_pWnd->Create(m_pPageSite, pRect, CWnd::FromHandle(hwndParent))) {
+ if (!m_pWnd->Create(m_pPageSite, pRect, CWnd::FromHandle(hwndParent))) {
return E_OUTOFMEMORY;
}
- if(!m_pWnd->OnActivate()) {
+ if (!m_pWnd->OnActivate()) {
m_pWnd->DestroyWindow();
return E_FAIL;
}
@@ -184,7 +184,7 @@ STDMETHODIMP CInternalPropertyPage::Deactivate()
CAutoLock cAutoLock(this);
- if(!m_pWnd || !m_pWnd->m_hWnd) {
+ if (!m_pWnd || !m_pWnd->m_hWnd) {
return E_UNEXPECTED;
}
@@ -204,7 +204,7 @@ STDMETHODIMP CInternalPropertyPage::GetPageInfo(PROPPAGEINFO* pPageInfo)
LPOLESTR pszTitle;
HRESULT hr = AMGetWideString(CStringW(GetWindowTitle()), &pszTitle);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -222,25 +222,25 @@ STDMETHODIMP CInternalPropertyPage::SetObjects(ULONG cObjects, LPUNKNOWN* ppUnk)
{
CAutoLock cAutoLock(this);
- if(cObjects && m_pWnd || !cObjects && !m_pWnd) {
+ if (cObjects && m_pWnd || !cObjects && !m_pWnd) {
return E_UNEXPECTED;
}
m_pUnks.RemoveAll();
- if(cObjects > 0) {
+ if (cObjects > 0) {
CheckPointer(ppUnk, E_POINTER);
- for(ULONG i = 0; i < cObjects; i++) {
+ for (ULONG i = 0; i < cObjects; i++) {
m_pUnks.AddTail(ppUnk[i]);
}
m_pWnd = GetWindow();
- if(!m_pWnd) {
+ if (!m_pWnd) {
return E_OUTOFMEMORY;
}
- if(!m_pWnd->OnConnect(m_pUnks)) {
+ if (!m_pWnd->OnConnect(m_pUnks)) {
delete m_pWnd;
m_pWnd = NULL;
@@ -263,11 +263,11 @@ STDMETHODIMP CInternalPropertyPage::Show(UINT nCmdShow)
CAutoLock cAutoLock(this);
- if(!m_pWnd) {
+ if (!m_pWnd) {
return E_UNEXPECTED;
}
- if((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE)) {
+ if ((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE)) {
return E_INVALIDARG;
}
@@ -285,7 +285,7 @@ STDMETHODIMP CInternalPropertyPage::Move(LPCRECT pRect)
CheckPointer(pRect, E_POINTER);
- if(!m_pWnd) {
+ if (!m_pWnd) {
return E_UNEXPECTED;
}
@@ -307,11 +307,11 @@ STDMETHODIMP CInternalPropertyPage::Apply()
CAutoLock cAutoLock(this);
- if(!m_pWnd || m_pUnks.IsEmpty() || !m_pPageSite) {
+ if (!m_pWnd || m_pUnks.IsEmpty() || !m_pPageSite) {
return E_UNEXPECTED;
}
- if(m_pWnd->GetDirty() && m_pWnd->OnApply()) {
+ if (m_pWnd->GetDirty() && m_pWnd->OnApply()) {
m_pWnd->SetDirty(false);
}
diff --git a/src/filters/InternalPropertyPage.h b/src/filters/InternalPropertyPage.h
index 39e012012..be0c3723c 100644
--- a/src/filters/InternalPropertyPage.h
+++ b/src/filters/InternalPropertyPage.h
@@ -47,8 +47,8 @@ public:
void SetDirty(bool fDirty = true) {
m_fDirty = fDirty;
- if(m_pPageSite) {
- if(fDirty) {
+ if (m_pPageSite) {
+ if (fDirty) {
m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
} else {
m_pPageSite->OnStatusChange(PROPPAGESTATUS_CLEAN);
diff --git a/src/filters/PinInfoWnd.cpp b/src/filters/PinInfoWnd.cpp
index a9b192f44..a96589912 100644
--- a/src/filters/PinInfoWnd.cpp
+++ b/src/filters/PinInfoWnd.cpp
@@ -40,11 +40,11 @@ bool CPinInfoWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks
m_pBF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pBF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pBF = pUnks.GetNext(pos))) {
;
}
- if(!m_pBF) {
+ if (!m_pBF) {
return false;
}
@@ -59,7 +59,7 @@ void CPinInfoWnd::OnDisconnect()
static WNDPROC OldControlProc;
static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, LPARAM lParam)
{
- if(message == WM_KEYDOWN) {
+ if (message == WM_KEYDOWN) {
if (LOWORD(wParam)==VK_ESCAPE) {
return 0; // just ignore ESCAPE in edit control
}
@@ -84,17 +84,17 @@ bool CPinInfoWnd::OnActivate()
m_pin_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CPoint(30, 0), CSize(450, 200)), this, IDC_PP_COMBO1);
BeginEnumPins(m_pBF, pEP, pPin) {
CPinInfo pi;
- if(FAILED(pPin->QueryPinInfo(&pi))) {
+ if (FAILED(pPin->QueryPinInfo(&pi))) {
continue;
}
CString str = CString(pi.achName);
- if(!str.Find(_T("Apple"))) {
+ if (!str.Find(_T("Apple"))) {
str.Delete(0,1);
}
CString dir = _T("[?] ");
- if(pi.dir == PINDIR_INPUT) {
+ if (pi.dir == PINDIR_INPUT) {
dir = _T("[IN] ");
- } else if(pi.dir == PINDIR_OUTPUT) {
+ } else if (pi.dir == PINDIR_OUTPUT) {
dir = _T("[OUT] ");
}
m_pin_combo.SetItemDataPtr(m_pin_combo.AddString(dir + str), pPin);
@@ -109,7 +109,7 @@ bool CPinInfoWnd::OnActivate()
OnCbnSelchangeCombo1();
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -129,7 +129,7 @@ bool CPinInfoWnd::OnApply()
{
OnDeactivate();
- if(m_pBF) {
+ if (m_pBF) {
}
return true;
@@ -158,12 +158,12 @@ void CPinInfoWnd::OnCbnSelchangeCombo1()
m_info_edit.SetWindowText(_T(""));
int i = m_pin_combo.GetCurSel();
- if(i < 0) {
+ if (i < 0) {
return;
}
CComPtr<IPin> pPin = (IPin*)m_pin_combo.GetItemDataPtr(i);
- if(!pPin) {
+ if (!pPin) {
return;
}
@@ -197,7 +197,7 @@ void CPinInfoWnd::OnCbnSelchangeCombo1()
CMediaTypeEx cmt;
CComPtr<IPin> pPinTo;
- if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
+ if (SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
str.Format(_T("- Connected to:\n\nCLSID: %s\nFilter: %s\nPin: %s\n\n"),
CString(CStringFromGUID(GetCLSID(pPinTo))),
CString(GetFilterName(GetFilterFromPin(pPinTo))),
@@ -207,11 +207,11 @@ void CPinInfoWnd::OnCbnSelchangeCombo1()
AddLine(_T("- Connection media type:\n\n"));
- if(SUCCEEDED(pPin->ConnectionMediaType(&cmt))) {
+ if (SUCCEEDED(pPin->ConnectionMediaType(&cmt))) {
CAtlList<CString> sl;
cmt.Dump(sl);
POSITION pos = sl.GetHeadPosition();
- while(pos) {
+ while (pos) {
AddLine(sl.GetNext(pos) + '\n');
}
}
@@ -227,13 +227,13 @@ void CPinInfoWnd::OnCbnSelchangeCombo1()
str.Format(_T("- Enumerated media type %d:\n\n"), iMT++);
AddLine(str);
- if(cmt.majortype != GUID_NULL && mt == cmt) {
+ if (cmt.majortype != GUID_NULL && mt == cmt) {
AddLine(_T("Set as the current media type\n\n"));
} else {
CAtlList<CString> sl;
mt.Dump(sl);
POSITION pos = sl.GetHeadPosition();
- while(pos) {
+ while (pos) {
AddLine(sl.GetNext(pos) + '\n');
}
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
index c5ff73bf0..810c6936a 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
@@ -30,7 +30,7 @@ CBaseMuxerFilter::CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& cl
: CBaseFilter(NAME("CBaseMuxerFilter"), pUnk, this, clsid)
, m_rtCurrent(0)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
m_pOutput.Attach(DNew CBaseMuxerOutputPin(L"Output", this, this, phr));
@@ -62,9 +62,9 @@ STDMETHODIMP CBaseMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** p
void CBaseMuxerFilter::AddInput()
{
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBasePin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) {
+ if (!pPin->IsConnected()) {
return;
}
}
@@ -74,7 +74,7 @@ void CBaseMuxerFilter::AddInput()
name.Format(L"Input %d", m_pInputs.GetCount()+1);
CBaseMuxerInputPin* pInputPin = NULL;
- if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {
+ if (FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {
ASSERT(0);
return;
}
@@ -83,7 +83,7 @@ void CBaseMuxerFilter::AddInput()
name.Format(L"~Output %d", m_pRawOutputs.GetCount()+1);
CBaseMuxerRawOutputPin* pRawOutputPin = NULL;
- if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {
+ if (FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {
ASSERT(0);
return;
}
@@ -120,10 +120,10 @@ DWORD CBaseMuxerFilter::ThreadProc()
POSITION pos;
- while(1) {
+ while (1) {
DWORD cmd = GetRequest();
- switch(cmd) {
+ switch (cmd) {
default:
case CMD_EXIT:
CAMThread::m_hThread = NULL;
@@ -135,9 +135,9 @@ DWORD CBaseMuxerFilter::ThreadProc()
m_pPins.RemoveAll();
pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBaseMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected()) {
+ if (pPin->IsConnected()) {
m_pActivePins.AddTail(pPin);
m_pPins.AddTail(pPin);
}
@@ -152,23 +152,23 @@ DWORD CBaseMuxerFilter::ThreadProc()
try {
MuxHeaderInternal();
- while(!CheckRequest(NULL) && m_pActivePins.GetCount()) {
- if(m_State == State_Paused) {
+ while (!CheckRequest(NULL) && m_pActivePins.GetCount()) {
+ if (m_State == State_Paused) {
Sleep(10);
continue;
}
CAutoPtr<MuxerPacket> pPacket = GetPacket();
- if(!pPacket) {
+ if (!pPacket) {
Sleep(1);
continue;
}
- if(pPacket->IsTimeValid()) {
+ if (pPacket->IsTimeValid()) {
m_rtCurrent = pPacket->rtStart;
}
- if(pPacket->IsEOS()) {
+ if (pPacket->IsEOS()) {
m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
}
@@ -176,14 +176,14 @@ DWORD CBaseMuxerFilter::ThreadProc()
}
MuxFooterInternal();
- } catch(HRESULT hr) {
+ } catch (HRESULT hr) {
CComQIPtr<IMediaEventSink>(m_pGraph)->Notify(EC_ERRORABORT, hr, 0);
}
m_pOutput->DeliverEndOfStream();
pos = m_pRawOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pRawOutputs.GetNext(pos)->DeliverEndOfStream();
}
@@ -204,7 +204,7 @@ void CBaseMuxerFilter::MuxHeaderInternal()
{
TRACE(_T("MuxHeader\n"));
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
+ if (CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
MuxHeader(pBitStream);
}
@@ -213,9 +213,9 @@ void CBaseMuxerFilter::MuxHeaderInternal()
//
POSITION pos = m_pPins.GetHeadPosition();
- while(pos) {
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
+ while (pos) {
+ if (CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if (CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
pOutput->MuxHeader(pInput->CurrentMediaType());
}
}
@@ -231,14 +231,14 @@ void CBaseMuxerFilter::MuxPacketInternal(const MuxerPacket* pPacket)
!!(pPacket->flags & MuxerPacket::bogus),
pPacket->rtStart/10000, pPacket->rtStop/10000);
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
+ if (CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
MuxPacket(pBitStream, pPacket);
}
MuxPacket(pPacket);
- if(CBaseMuxerInputPin* pInput = pPacket->pPin)
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
+ if (CBaseMuxerInputPin* pInput = pPacket->pPin)
+ if (CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
}
}
@@ -247,7 +247,7 @@ void CBaseMuxerFilter::MuxFooterInternal()
{
TRACE(_T("MuxFooter\n"));
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
+ if (CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream()) {
MuxFooter(pBitStream);
}
@@ -256,9 +256,9 @@ void CBaseMuxerFilter::MuxFooterInternal()
//
POSITION pos = m_pPins.GetHeadPosition();
- while(pos) {
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
+ while (pos) {
+ if (CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if (CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin())) {
pOutput->MuxFooter(pInput->CurrentMediaType());
}
}
@@ -271,23 +271,23 @@ CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket()
int i = int(m_pActivePins.GetCount());
POSITION pos = m_pActivePins.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBaseMuxerInputPin* pPin = m_pActivePins.GetNext(pos);
CAutoLock cAutoLock(&pPin->m_csQueue);
- if(!pPin->m_queue.GetCount()) {
+ if (!pPin->m_queue.GetCount()) {
continue;
}
MuxerPacket* p = pPin->m_queue.GetHead();
- if(p->IsBogus() || !p->IsTimeValid() || p->IsEOS()) {
+ if (p->IsBogus() || !p->IsTimeValid() || p->IsEOS()) {
pPinMin = pPin;
i = 0;
break;
}
- if(p->rtStart < rtMin) {
+ if (p->rtStart < rtMin) {
rtMin = p->rtStart;
pPinMin = pPin;
}
@@ -297,11 +297,11 @@ CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket()
CAutoPtr<MuxerPacket> pPacket;
- if(pPinMin && i == 0) {
+ if (pPinMin && i == 0) {
pPacket = pPinMin->PopPacket();
} else {
pos = m_pActivePins.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pActivePins.GetNext(pos)->m_evAcceptPacket.Set();
}
}
@@ -320,22 +320,22 @@ CBasePin* CBaseMuxerFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pInputs.GetCount()) {
- if(POSITION pos = m_pInputs.FindIndex(n)) {
+ if (n >= 0 && n < (int)m_pInputs.GetCount()) {
+ if (POSITION pos = m_pInputs.FindIndex(n)) {
return m_pInputs.GetAt(pos);
}
}
n -= int(m_pInputs.GetCount());
- if(n == 0 && m_pOutput) {
+ if (n == 0 && m_pOutput) {
return m_pOutput;
}
n--;
- if(n >= 0 && n < (int)m_pRawOutputs.GetCount()) {
- if(POSITION pos = m_pRawOutputs.FindIndex(n)) {
+ if (n >= 0 && n < (int)m_pRawOutputs.GetCount()) {
+ if (POSITION pos = m_pRawOutputs.FindIndex(n)) {
return m_pRawOutputs.GetAt(pos);
}
}
@@ -350,7 +350,7 @@ STDMETHODIMP CBaseMuxerFilter::Stop()
CAutoLock cAutoLock(this);
HRESULT hr = __super::Stop();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -366,11 +366,11 @@ STDMETHODIMP CBaseMuxerFilter::Pause()
FILTER_STATE fs = m_State;
HRESULT hr = __super::Pause();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(fs == State_Stopped && m_pOutput) {
+ if (fs == State_Stopped && m_pOutput) {
CAMThread::Create();
CallWorker(CMD_RUN);
}
@@ -383,7 +383,7 @@ STDMETHODIMP CBaseMuxerFilter::Run(REFERENCE_TIME tStart)
CAutoLock cAutoLock(this);
HRESULT hr = __super::Run(tStart);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -400,7 +400,7 @@ STDMETHODIMP CBaseMuxerFilter::GetCapabilities(DWORD* pCapabilities)
STDMETHODIMP CBaseMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
DWORD caps;
@@ -439,9 +439,9 @@ STDMETHODIMP CBaseMuxerFilter::GetDuration(LONGLONG* pDuration)
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration();
- if(rt > *pDuration) {
+ if (rt > *pDuration) {
*pDuration = rt;
}
}
@@ -469,15 +469,15 @@ STDMETHODIMP CBaseMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentF
{
FILTER_STATE fs;
- if(SUCCEEDED(GetState(0, &fs)) && fs == State_Stopped) {
+ if (SUCCEEDED(GetState(0, &fs)) && fs == State_Stopped) {
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBasePin* pPin = m_pInputs.GetNext(pos);
CComQIPtr<IMediaSeeking> pMS = pPin->GetConnected();
- if(!pMS) {
+ if (!pMS) {
pMS = GetFilterFromPin(pPin->GetConnected());
}
- if(pMS) {
+ if (pMS) {
pMS->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
index 8c34c6743..a95fc592e 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
@@ -65,14 +65,14 @@ bool CBaseMuxerInputPin::IsSubtitleStream()
void CBaseMuxerInputPin::PushPacket(CAutoPtr<MuxerPacket> pPacket)
{
- for(int i = 0; m_pFilter->IsActive() && !m_bFlushing
+ for (int i = 0; m_pFilter->IsActive() && !m_bFlushing
&& !m_evAcceptPacket.Wait(1)
&& i < 1000;
i++) {
;
}
- if(!m_pFilter->IsActive() || m_bFlushing) {
+ if (!m_pFilter->IsActive() || m_bFlushing) {
return;
}
@@ -80,7 +80,7 @@ void CBaseMuxerInputPin::PushPacket(CAutoPtr<MuxerPacket> pPacket)
m_queue.AddTail(pPacket);
- if(m_queue.GetCount() >= MAXQUEUESIZE) {
+ if (m_queue.GetCount() >= MAXQUEUESIZE) {
m_evAcceptPacket.Reset();
}
}
@@ -91,11 +91,11 @@ CAutoPtr<MuxerPacket> CBaseMuxerInputPin::PopPacket()
CAutoLock cAutoLock(&m_csQueue);
- if(m_queue.GetCount()) {
+ if (m_queue.GetCount()) {
pPacket = m_queue.RemoveHead();
}
- if(m_queue.GetCount() < MAXQUEUESIZE) {
+ if (m_queue.GetCount() < MAXQUEUESIZE) {
m_evAcceptPacket.Set();
}
@@ -104,9 +104,9 @@ CAutoPtr<MuxerPacket> CBaseMuxerInputPin::PopPacket()
HRESULT CBaseMuxerInputPin::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->formattype == FORMAT_WaveFormatEx) {
+ if (pmt->formattype == FORMAT_WaveFormatEx) {
WORD wFormatTag = ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag;
- if((wFormatTag == WAVE_FORMAT_PCM
+ if ((wFormatTag == WAVE_FORMAT_PCM
|| wFormatTag == WAVE_FORMAT_EXTENSIBLE
|| wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
&& pmt->subtype != FOURCCMap(wFormatTag)
@@ -130,7 +130,7 @@ HRESULT CBaseMuxerInputPin::CheckMediaType(const CMediaType* pmt)
HRESULT CBaseMuxerInputPin::BreakConnect()
{
HRESULT hr = __super::BreakConnect();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -144,7 +144,7 @@ HRESULT CBaseMuxerInputPin::BreakConnect()
HRESULT CBaseMuxerInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -152,27 +152,27 @@ HRESULT CBaseMuxerInputPin::CompleteConnect(IPin* pReceivePin)
m_rtDuration = 0;
CComQIPtr<IMediaSeeking> pMS;
- if((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin)) {
+ if ((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin)) {
pMS->GetDuration(&m_rtDuration);
}
// properties
- for(CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
- if(CComQIPtr<IDSMPropertyBag> pPB = pPin) {
+ for (CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
+ if (CComQIPtr<IDSMPropertyBag> pPB = pPin) {
ULONG cProperties = 0;
- if(SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0) {
- for(ULONG iProperty = 0; iProperty < cProperties; iProperty++) {
+ if (SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0) {
+ for (ULONG iProperty = 0; iProperty < cProperties; iProperty++) {
PROPBAG2 PropBag;
memset(&PropBag, 0, sizeof(PropBag));
ULONG cPropertiesReturned = 0;
- if(FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned))) {
+ if (FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned))) {
continue;
}
HRESULT hr;
CComVariant var;
- if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr)) {
+ if (SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr)) {
SetProperty(PropBag.pstrName, &var);
}
@@ -215,7 +215,7 @@ STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample)
CAutoLock cAutoLock(&m_csReceive);
HRESULT hr = __super::Receive(pSample);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -224,35 +224,35 @@ STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample)
long len = pSample->GetActualDataLength();
BYTE* pData = NULL;
- if(FAILED(pSample->GetPointer(&pData)) || !pData) {
+ if (FAILED(pSample->GetPointer(&pData)) || !pData) {
return S_OK;
}
pPacket->pData.SetCount(len);
memcpy(pPacket->pData.GetData(), pData, len);
- if(S_OK == pSample->IsSyncPoint() || m_mt.majortype == MEDIATYPE_Audio && !m_mt.bTemporalCompression) {
+ if (S_OK == pSample->IsSyncPoint() || m_mt.majortype == MEDIATYPE_Audio && !m_mt.bTemporalCompression) {
pPacket->flags |= MuxerPacket::syncpoint;
}
- if(S_OK == pSample->GetTime(&pPacket->rtStart, &pPacket->rtStop)) {
+ if (S_OK == pSample->GetTime(&pPacket->rtStart, &pPacket->rtStop)) {
pPacket->flags |= MuxerPacket::timevalid;
pPacket->rtStart += m_tStart;
pPacket->rtStop += m_tStart;
- if((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart) {
+ if ((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart) {
pPacket->flags &= ~MuxerPacket::syncpoint;
pPacket->flags |= MuxerPacket::bogus;
}
m_rtMaxStart = max(m_rtMaxStart, pPacket->rtStart);
- } else if(pPacket->flags & MuxerPacket::syncpoint) {
+ } else if (pPacket->flags & MuxerPacket::syncpoint) {
pPacket->flags &= ~MuxerPacket::syncpoint;
pPacket->flags |= MuxerPacket::bogus;
}
- if(S_OK == pSample->IsDiscontinuity()) {
+ if (S_OK == pSample->IsDiscontinuity()) {
pPacket->flags |= MuxerPacket::discontinuity;
}
@@ -268,7 +268,7 @@ STDMETHODIMP CBaseMuxerInputPin::EndOfStream()
CAutoLock cAutoLock(&m_csReceive);
HRESULT hr = __super::EndOfStream();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
index cccf16a47..6a020c826 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
@@ -40,8 +40,8 @@ CBaseMuxerOutputPin::CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CC
IBitStream* CBaseMuxerOutputPin::GetBitStream()
{
- if(!m_pBitStream) {
- if(CComQIPtr<IStream> pStream = GetConnected()) {
+ if (!m_pBitStream) {
+ if (CComQIPtr<IStream> pStream = GetConnected()) {
m_pBitStream = DNew CBitStream(pStream, true);
}
}
@@ -67,11 +67,11 @@ HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_P
pProperties->cbBuffer = 1;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -90,10 +90,10 @@ HRESULT CBaseMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -139,50 +139,50 @@ STDMETHODIMP CBaseMuxerRawOutputPin::NonDelegatingQueryInterface(REFIID riid, vo
void CBaseMuxerRawOutputPin::MuxHeader(const CMediaType& mt)
{
CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) {
+ if (!pBitStream) {
return;
}
const BYTE utf8bom[3] = {0xef, 0xbb, 0xbf};
- if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) {
+ if ((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) {
MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.Format();
- for(DWORD i = 0; i < vih->cbSequenceHeader-2; i += 2) {
+ for (DWORD i = 0; i < vih->cbSequenceHeader-2; i += 2) {
pBitStream->BitWrite(0x00000001, 32);
WORD size = (((BYTE*)vih->dwSequenceHeader)[i+0]<<8) | ((BYTE*)vih->dwSequenceHeader)[i+1];
pBitStream->ByteWrite(&((BYTE*)vih->dwSequenceHeader)[i+2], size);
i += size;
}
- } else if(mt.subtype == MEDIASUBTYPE_UTF8) {
+ } else if (mt.subtype == MEDIASUBTYPE_UTF8) {
pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
- } else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) {
+ } else if (mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) {
SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
BYTE* p = (BYTE*)si + si->dwOffset;
- if(memcmp(utf8bom, p, 3) != 0) {
+ if (memcmp(utf8bom, p, 3) != 0) {
pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
}
CStringA str((char*)p, mt.FormatLength() - (p - mt.Format()));
pBitStream->StrWrite(str + '\n', true);
- if(str.Find("[Events]") < 0) {
+ if (str.Find("[Events]") < 0) {
pBitStream->StrWrite("\n\n[Events]\n", true);
}
- } else if(mt.subtype == MEDIASUBTYPE_SSF) {
+ } else if (mt.subtype == MEDIASUBTYPE_SSF) {
DWORD dwOffset = ((SUBTITLEINFO*)mt.pbFormat)->dwOffset;
try {
m_ssf.Parse(ssf::MemoryInputStream(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, false, false));
- } catch(ssf::Exception&) {}
- } else if(mt.subtype == MEDIASUBTYPE_VOBSUB) {
+ } catch (ssf::Exception&) {}
+ } else if (mt.subtype == MEDIASUBTYPE_VOBSUB) {
m_idx.RemoveAll();
- } else if(mt.majortype == MEDIATYPE_Audio
- && (mt.subtype == MEDIASUBTYPE_PCM
- || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
- || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
- || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
- && mt.formattype == FORMAT_WaveFormatEx) {
+ } else if (mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx) {
pBitStream->BitWrite('RIFF', 32);
pBitStream->BitWrite(0, 32); // file length - 8, set later
pBitStream->BitWrite('WAVE', 32);
@@ -199,46 +199,46 @@ void CBaseMuxerRawOutputPin::MuxHeader(const CMediaType& mt)
void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket)
{
CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) {
+ if (!pBitStream) {
return;
}
const BYTE* pData = pPacket->pData.GetData();
const int DataSize = int(pPacket->pData.GetCount());
- if(mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx) {
+ if (mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
int profile = 0;
int srate_idx = 11;
- if(92017 <= wfe->nSamplesPerSec) {
+ if (92017 <= wfe->nSamplesPerSec) {
srate_idx = 0;
- } else if(75132 <= wfe->nSamplesPerSec) {
+ } else if (75132 <= wfe->nSamplesPerSec) {
srate_idx = 1;
- } else if(55426 <= wfe->nSamplesPerSec) {
+ } else if (55426 <= wfe->nSamplesPerSec) {
srate_idx = 2;
- } else if(46009 <= wfe->nSamplesPerSec) {
+ } else if (46009 <= wfe->nSamplesPerSec) {
srate_idx = 3;
- } else if(37566 <= wfe->nSamplesPerSec) {
+ } else if (37566 <= wfe->nSamplesPerSec) {
srate_idx = 4;
- } else if(27713 <= wfe->nSamplesPerSec) {
+ } else if (27713 <= wfe->nSamplesPerSec) {
srate_idx = 5;
- } else if(23004 <= wfe->nSamplesPerSec) {
+ } else if (23004 <= wfe->nSamplesPerSec) {
srate_idx = 6;
- } else if(18783 <= wfe->nSamplesPerSec) {
+ } else if (18783 <= wfe->nSamplesPerSec) {
srate_idx = 7;
- } else if(13856 <= wfe->nSamplesPerSec) {
+ } else if (13856 <= wfe->nSamplesPerSec) {
srate_idx = 8;
- } else if(11502 <= wfe->nSamplesPerSec) {
+ } else if (11502 <= wfe->nSamplesPerSec) {
srate_idx = 9;
- } else if(9391 <= wfe->nSamplesPerSec) {
+ } else if (9391 <= wfe->nSamplesPerSec) {
srate_idx = 10;
}
int channels = wfe->nChannels;
- if(wfe->cbSize >= 2) {
+ if (wfe->cbSize >= 2) {
BYTE* p = (BYTE*)(wfe+1);
profile = (p[0]>>3)-1;
srate_idx = ((p[0]&7)<<1)|((p[1]&0x80)>>7);
@@ -255,22 +255,22 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
hdr[6] = 0xfc;
pBitStream->ByteWrite(hdr, sizeof(hdr));
- } else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) {
+ } else if ((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) {
const BYTE* p = pData;
int i = DataSize;
- while(i >= 4) {
+ while (i >= 4) {
DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
i -= len + 4;
p += len + 4;
}
- if(i == 0) {
+ if (i == 0) {
p = pData;
i = DataSize;
- while(i >= 4) {
+ while (i >= 4) {
DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
pBitStream->BitWrite(0x00000001, 32);
@@ -278,7 +278,7 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
p += 4;
i -= 4;
- if(len > i || len == 1) {
+ if (len > i || len == 1) {
len = i;
ASSERT(0);
}
@@ -291,10 +291,10 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
return;
}
- } else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text) {
+ } else if (mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text) {
CStringA str((char*)pData, DataSize);
str.Trim();
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
return;
}
@@ -310,10 +310,10 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
pBitStream->StrWrite(str, true);
return;
- } else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) {
+ } else if (mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) {
CStringA str((char*)pData, DataSize);
str.Trim();
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
return;
}
@@ -324,7 +324,7 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
CAtlList<CStringA> sl;
Explode(str, sl, ',', fields);
- if(sl.GetCount() < fields) {
+ if (sl.GetCount() < fields) {
return;
}
@@ -335,13 +335,13 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
CStringA left = sl.RemoveHead();
CStringA right = sl.RemoveHead();
CStringA top = sl.RemoveHead();
- if(fields == 10) {
+ if (fields == 10) {
top += ',' + sl.RemoveHead(); // bottom
}
CStringA effect = sl.RemoveHead();
str = sl.RemoveHead();
- if(mt.subtype == MEDIASUBTYPE_SSA) {
+ if (mt.subtype == MEDIASUBTYPE_SSA) {
layer = "Marked=0";
}
@@ -355,15 +355,15 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
pBitStream->StrWrite(str, true);
return;
- } else if(mt.subtype == MEDIASUBTYPE_SSF) {
+ } else if (mt.subtype == MEDIASUBTYPE_SSF) {
float start = (float)pPacket->rtStart / 10000000;
float stop = (float)pPacket->rtStop / 10000000;
m_ssf.Append(ssf::WCharInputStream(UTF8To16(CStringA((char*)pData, DataSize))), start, stop, true);
return;
- } else if(mt.subtype == MEDIASUBTYPE_VOBSUB) {
+ } else if (mt.subtype == MEDIASUBTYPE_VOBSUB) {
bool fTimeValid = pPacket->IsTimeValid();
- if(fTimeValid) {
+ if (fTimeValid) {
idx_t i;
i.rt = pPacket->rtStart;
i.fp = pBitStream->GetPos();
@@ -372,7 +372,7 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
int DataSizeLeft = DataSize;
- while(DataSizeLeft > 0) {
+ while (DataSizeLeft > 0) {
int BytesAvail = 0x7ec - (fTimeValid ? 9 : 4);
int Size = min(BytesAvail, DataSizeLeft);
int Padding = 0x800 - Size - 20 - (fTimeValid ? 9 : 4);
@@ -382,7 +382,7 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
pBitStream->BitWrite(0x000003f8, 32);
pBitStream->BitWrite(0x000001bd, 32);
- if(fTimeValid) {
+ if (fTimeValid) {
pBitStream->BitWrite(Size+9, 16);
pBitStream->BitWrite(0x8180052100010001ui64, 64);
} else {
@@ -397,12 +397,12 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
pData += Size;
DataSizeLeft -= Size;
- if(Padding > 0) {
+ if (Padding > 0) {
Padding -= 6;
ASSERT(Padding >= 0);
pBitStream->BitWrite(0x000001be, 32);
pBitStream->BitWrite(Padding, 16);
- while(Padding-- > 0) {
+ while (Padding-- > 0) {
pBitStream->BitWrite(0xff, 8);
}
}
@@ -411,12 +411,12 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
}
return;
- } else if(mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
+ } else if (mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
// This code is probably totally broken for anything but 16 bits
- for(int i = 0, bps = wfe->wBitsPerSample/8; i < DataSize; i += bps)
- for(int j = bps-1; j >= 0; j--) {
+ for (int i = 0, bps = wfe->wBitsPerSample/8; i < DataSize; i += bps)
+ for (int j = bps-1; j >= 0; j--) {
pBitStream->BitWrite(pData[i+j], 8);
}
@@ -430,11 +430,11 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket*
void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
{
CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) {
+ if (!pBitStream) {
return;
}
- if(mt.majortype == MEDIATYPE_Audio
+ if (mt.majortype == MEDIATYPE_Audio
&& (mt.subtype == MEDIASUBTYPE_PCM
|| mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
|| mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
@@ -452,22 +452,22 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
size -= sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength();
pBitStream->Seek(sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength() + 4);
pBitStream->ByteWrite(&size, 4);
- } else if(mt.subtype == MEDIASUBTYPE_SSF) {
+ } else if (mt.subtype == MEDIASUBTYPE_SSF) {
ssf::WCharOutputStream s;
try {
m_ssf.Dump(s);
- } catch(ssf::Exception&) {}
+ } catch (ssf::Exception&) {}
CStringA str = UTF16To8(s.GetString());
pBitStream->StrWrite(str, true);
- } else if(mt.subtype == MEDIASUBTYPE_VOBSUB) {
- if(CComQIPtr<IFileSinkFilter> pFSF = GetFilterFromPin(GetConnected())) {
+ } else if (mt.subtype == MEDIASUBTYPE_VOBSUB) {
+ if (CComQIPtr<IFileSinkFilter> pFSF = GetFilterFromPin(GetConnected())) {
WCHAR* fn = NULL;
- if(SUCCEEDED(pFSF->GetCurFile(&fn, NULL))) {
+ if (SUCCEEDED(pFSF->GetCurFile(&fn, NULL))) {
CPathW p(fn);
p.RenameExtension(L".idx");
CoTaskMemFree(fn);
- if(FILE* f = _tfopen(CString((LPCWSTR)p), _T("w"))) {
+ if (FILE* f = _tfopen(CString((LPCWSTR)p), _T("w"))) {
SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
_ftprintf(f, _T("%s\n"), _T("# VobSub index file, v7 (do not modify this line!)"));
@@ -475,18 +475,18 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
fwrite(mt.Format() + si->dwOffset, mt.FormatLength() - si->dwOffset, 1, f);
CString iso6391 = ISO6392To6391(si->IsoLang);
- if(iso6391.IsEmpty()) {
+ if (iso6391.IsEmpty()) {
iso6391 = _T("--");
}
_ftprintf(f, _T("\nlangidx: 0\n\nid: %s, index: 0\n"), iso6391);
CString alt = CString(CStringW(si->TrackName));
- if(!alt.IsEmpty()) {
+ if (!alt.IsEmpty()) {
_ftprintf(f, _T("alt: %s\n"), alt);
}
POSITION pos = m_idx.GetHeadPosition();
- while(pos) {
+ while (pos) {
const idx_t& i = m_idx.GetNext(pos);
DVD_HMSF_TIMECODE start = RT2HMSF(i.rt, 25);
_ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
diff --git a/src/filters/muxer/BaseMuxer/BitStream.cpp b/src/filters/muxer/BaseMuxer/BitStream.cpp
index 355cc19ff..902e32c17 100644
--- a/src/filters/muxer/BaseMuxer/BitStream.cpp
+++ b/src/filters/muxer/BaseMuxer/BitStream.cpp
@@ -87,12 +87,12 @@ STDMETHODIMP CBitStream::ByteWrite(const void* pData, int len)
BitFlush();
- if(len > 0) {
+ if (len > 0) {
ULONG cbWritten = 0;
hr = m_pStream->Write(pData, len, &cbWritten);
ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) {
+ if (m_fThrowError && FAILED(hr)) {
throw hr;
}
}
@@ -106,7 +106,7 @@ STDMETHODIMP CBitStream::BitWrite(UINT64 data, int len)
ASSERT(len >= 0 && len <= 64);
- if(len > 56) {
+ if (len > 56) {
BitWrite(data >> 56, len - 56);
len = 56;
}
@@ -115,13 +115,13 @@ STDMETHODIMP CBitStream::BitWrite(UINT64 data, int len)
m_bitbuff |= data & ((1ui64 << len) - 1);
m_bitlen += len;
- while(m_bitlen >= 8) {
+ while (m_bitlen >= 8) {
BYTE b = (BYTE)(m_bitbuff >> (m_bitlen - 8));
hr = m_pStream->Write(&b, 1, NULL);
m_bitlen -= 8;
ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) {
+ if (m_fThrowError && FAILED(hr)) {
throw E_FAIL;
}
}
@@ -133,14 +133,14 @@ STDMETHODIMP CBitStream::BitFlush()
{
HRESULT hr = S_OK;
- if(m_bitlen > 0) {
+ if (m_bitlen > 0) {
ASSERT(m_bitlen < 8);
BYTE b = (BYTE)(m_bitbuff << (8 - m_bitlen));
hr = m_pStream->Write(&b, 1, NULL);
m_bitlen = 0;
ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) {
+ if (m_fThrowError && FAILED(hr)) {
throw E_FAIL;
}
}
@@ -152,7 +152,7 @@ STDMETHODIMP CBitStream::StrWrite(LPCSTR pData, BOOL bFixNewLine)
{
CStringA str = pData;
- if(bFixNewLine) {
+ if (bFixNewLine) {
str.Replace("\r", "");
str.Replace("\n", "\r\n");
}
diff --git a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
index ecf02d6bb..1e9a8c6c8 100644
--- a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
+++ b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
@@ -73,7 +73,7 @@ template<typename T> static T myabs(T n)
static int GetByteLength(UINT64 data, int min = 0)
{
int i = 7;
- while(i >= min && ((BYTE*)&data)[i] == 0) {
+ while (i >= min && ((BYTE*)&data)[i] == 0) {
i--;
}
return ++i;
@@ -88,7 +88,7 @@ CDSMMuxerFilter::CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap, b
, m_fAutoChap(fAutoChap)
, m_fAutoRes(fAutoRes)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -124,9 +124,9 @@ void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
int len = 1;
CSimpleMap<CStringA, CStringA> si;
- for(int i = 0; i < GetSize(); i++) {
+ for (int i = 0; i < GetSize(); i++) {
CStringA key = CStringA(CString(GetKeyAt(i))), value = UTF16To8(GetValueAt(i));
- if(key.GetLength() != 4) {
+ if (key.GetLength() != 4) {
continue;
}
si.Add(key, value);
@@ -135,7 +135,7 @@ void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
MuxPacketHeader(pBS, DSMP_FILEINFO, len);
pBS->BitWrite(DSMF_VERSION, 8);
- for(int i = 0; i < si.GetSize(); i++) {
+ for (int i = 0; i < si.GetSize(); i++) {
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
@@ -148,19 +148,19 @@ void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
int len = 1;
CSimpleMap<CStringA, CStringA> si;
- for(int i = 0; i < pPin->GetSize(); i++) {
+ for (int i = 0; i < pPin->GetSize(); i++) {
CStringA key = CStringA(CString(pPin->GetKeyAt(i))), value = UTF16To8(pPin->GetValueAt(i));
- if(key.GetLength() != 4) {
+ if (key.GetLength() != 4) {
continue;
}
si.Add(key, value);
len += 4 + value.GetLength() + 1;
}
- if(len > 1) {
+ if (len > 1) {
MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
pBS->BitWrite(pPin->GetID(), 8);
- for(int i = 0; i < si.GetSize(); i++) {
+ for (int i = 0; i < si.GetSize(); i++) {
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
@@ -186,7 +186,7 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
MuxFileInfo(pBS);
POSITION pos = m_pPins.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBaseMuxerInputPin* pPin = m_pPins.GetNext(pos);
const CMediaType& mt = pPin->CurrentMediaType();
@@ -213,17 +213,17 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
CComQIPtr<IDSMChapterBag> pCB = (IUnknown*)(INonDelegatingUnknown*)this;
pos = m_pPins.GetHeadPosition();
- while(pos) {
- for(CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
- if(m_fAutoRes) {
+ while (pos) {
+ for (CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
+ if (m_fAutoRes) {
CComQIPtr<IDSMResourceBag> pPB = GetFilterFromPin(pPin);
- if(pPB && !pRBs.Find(pPB)) {
+ if (pPB && !pRBs.Find(pPB)) {
pRBs.AddTail(pPB);
}
}
- if(m_fAutoChap) {
- if(!pCB || pCB->ChapGetCount() == 0) {
+ if (m_fAutoChap) {
+ if (!pCB || pCB->ChapGetCount() == 0) {
pCB = GetFilterFromPin(pPin);
}
}
@@ -233,14 +233,14 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
// resources
pos = pRBs.GetHeadPosition();
- while(pos) {
+ while (pos) {
IDSMResourceBag* pRB = pRBs.GetNext(pos);
- for(DWORD i = 0, j = pRB->ResGetCount(); i < j; i++) {
+ for (DWORD i = 0, j = pRB->ResGetCount(); i < j; i++) {
CComBSTR name, desc, mime;
BYTE* pData = NULL;
DWORD len = 0;
- if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL))) {
+ if (SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL))) {
CStringA utf8_name = UTF16To8(name);
CStringA utf8_desc = UTF16To8(desc);
CStringA utf8_mime = UTF16To8(mime);
@@ -266,17 +266,17 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
// chapters
- if(pCB) {
+ if (pCB) {
CAtlList<CDSMChapter> chapters;
REFERENCE_TIME rtPrev = 0;
int len = 0;
pCB->ChapSort();
- for(DWORD i = 0; i < pCB->ChapGetCount(); i++) {
+ for (DWORD i = 0; i < pCB->ChapGetCount(); i++) {
CDSMChapter c;
CComBSTR name;
- if(SUCCEEDED(pCB->ChapGet(i, &c.rt, &name))) {
+ if (SUCCEEDED(pCB->ChapGet(i, &c.rt, &name))) {
REFERENCE_TIME rtDiff = c.rt - rtPrev;
rtPrev = c.rt;
c.rt = rtDiff;
@@ -286,11 +286,11 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
}
}
- if(chapters.GetCount()) {
+ if (chapters.GetCount()) {
MuxPacketHeader(pBS, DSMP_CHAPTERS, len);
pos = chapters.GetHeadPosition();
- while(pos) {
+ while (pos) {
CDSMChapter& c = chapters.GetNext(pos);
CStringA name = UTF16To8(c.name);
int irt = GetByteLength(myabs(c.rt));
@@ -306,17 +306,17 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
void CDSMMuxerFilter::MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket)
{
- if(pPacket->IsEOS()) {
+ if (pPacket->IsEOS()) {
return;
}
- if(pPacket->pPin->CurrentMediaType().majortype == MEDIATYPE_Text) {
+ if (pPacket->pPin->CurrentMediaType().majortype == MEDIATYPE_Text) {
CStringA str((char*)pPacket->pData.GetData(), pPacket->pData.GetCount());
str.Replace("\xff", " ");
str.Replace("&nbsp;", " ");
str.Replace("&nbsp", " ");
str.Trim();
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
return;
}
}
@@ -326,7 +326,7 @@ void CDSMMuxerFilter::MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket)
REFERENCE_TIME rtTimeStamp = _I64_MIN, rtDuration = 0;
int iTimeStamp = 0, iDuration = 0;
- if(pPacket->IsTimeValid()) {
+ if (pPacket->IsTimeValid()) {
rtTimeStamp = pPacket->rtStart;
rtDuration = max(pPacket->rtStop - pPacket->rtStart, 0);
@@ -362,7 +362,7 @@ void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
UINT64 fpPrev = 0, fp;
POSITION pos = m_isps.GetHeadPosition();
- while(pos) {
+ while (pos) {
IndexedSyncPoint& isp = m_isps.GetNext(pos);
TRACE(_T("sp[%d]: %I64d %I64x\n"), isp.id, isp.rt, isp.fp);
@@ -382,7 +382,7 @@ void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
MuxPacketHeader(pBS, DSMP_SYNCPOINTS, len);
pos = isps.GetHeadPosition();
- while(pos) {
+ while (pos) {
IndexedSyncPoint& isp = isps.GetNext(pos);
int irt = GetByteLength(myabs(isp.rt));
@@ -405,7 +405,7 @@ void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
// FIXME: the very last syncpoints won't get moved to m_isps because there are no more syncpoints to trigger it!
- if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint()) {
+ if (fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint()) {
return;
}
@@ -423,7 +423,7 @@ void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
SyncPoint& tail = !m_sps.IsEmpty() ? m_sps.GetTail() : sp;
REFERENCE_TIME rtfp = !m_isps.IsEmpty() ? m_isps.GetTail().rtfp : _I64_MIN;
- if(head.rtStart > rtfp + 1000000) { // 100ms limit, just in case every stream had only keyframes, then sycnpoints would be too frequent
+ if (head.rtStart > rtfp + 1000000) { // 100ms limit, just in case every stream had only keyframes, then sycnpoints would be too frequent
IndexedSyncPoint isp;
isp.id = head.id;
isp.rt = tail.rtStart;
@@ -434,10 +434,10 @@ void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
}
POSITION pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
POSITION cur = pos;
SyncPoint& sp2 = m_sps.GetNext(pos);
- if(sp2.id == sp.id && sp2.rtStop <= sp.rtStop || sp2.rtStop <= sp.rtStart) {
+ if (sp2.id == sp.id && sp2.rtStop <= sp.rtStop || sp2.rtStop <= sp.rtStart) {
m_sps.RemoveAt(cur);
}
}
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
index 14660e5b9..3eabda81f 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
@@ -27,7 +27,7 @@ using namespace MatroskaWriter;
static void bswap(BYTE* s, int len)
{
- for(BYTE* d = s + len-1; s < d; s++, d--) {
+ for (BYTE* d = s + len-1; s < d; s++, d--) {
*s ^= *d, *d ^= *s, *s ^= *d;
}
}
@@ -66,13 +66,13 @@ HRESULT CID::HeaderWrite(IStream* pStream)
MatroskaWriter::QWORD CBinary::Size(bool fWithHeader)
{
- if(GetCount() == 0) {
+ if (GetCount() == 0) {
return 0;
}
MatroskaWriter::QWORD len = 0;
len += GetCount();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -80,7 +80,7 @@ MatroskaWriter::QWORD CBinary::Size(bool fWithHeader)
HRESULT CBinary::Write(IStream* pStream)
{
- if(GetCount() == 0) {
+ if (GetCount() == 0) {
return S_OK;
}
@@ -90,13 +90,13 @@ HRESULT CBinary::Write(IStream* pStream)
MatroskaWriter::QWORD CANSI::Size(bool fWithHeader)
{
- if(GetLength() == 0) {
+ if (GetLength() == 0) {
return 0;
}
MatroskaWriter::QWORD len = 0;
len += GetLength();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -104,7 +104,7 @@ MatroskaWriter::QWORD CANSI::Size(bool fWithHeader)
HRESULT CANSI::Write(IStream* pStream)
{
- if(GetLength() == 0) {
+ if (GetLength() == 0) {
return S_OK;
}
@@ -114,13 +114,13 @@ HRESULT CANSI::Write(IStream* pStream)
MatroskaWriter::QWORD CUTF8::Size(bool fWithHeader)
{
- if(GetLength() == 0) {
+ if (GetLength() == 0) {
return 0;
}
MatroskaWriter::QWORD len = 0;
len += UTF16To8(*this).GetLength();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -128,7 +128,7 @@ MatroskaWriter::QWORD CUTF8::Size(bool fWithHeader)
HRESULT CUTF8::Write(IStream* pStream)
{
- if(GetLength() == 0) {
+ if (GetLength() == 0) {
return S_OK;
}
@@ -140,13 +140,13 @@ HRESULT CUTF8::Write(IStream* pStream)
template<class T, class BASE>
MatroskaWriter::QWORD CSimpleVar<T, BASE>::Size(bool fWithHeader)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return 0;
}
MatroskaWriter::QWORD len = 0;
len += sizeof(T);
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -155,7 +155,7 @@ MatroskaWriter::QWORD CSimpleVar<T, BASE>::Size(bool fWithHeader)
template<class T, class BASE>
HRESULT CSimpleVar<T, BASE>::Write(IStream* pStream)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return S_OK;
}
@@ -167,23 +167,23 @@ HRESULT CSimpleVar<T, BASE>::Write(IStream* pStream)
MatroskaWriter::QWORD CUInt::Size(bool fWithHeader)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return 0;
}
MatroskaWriter::QWORD len = 0;
- if(m_val == 0) {
+ if (m_val == 0) {
len++;
} else {
- for(int i = 8; i > 0; i--) {
- if(((0xffi64<<((i-1)*8))&m_val)) {
+ for (int i = 8; i > 0; i--) {
+ if (((0xffi64<<((i-1)*8))&m_val)) {
len += i;
break;
}
}
}
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -191,7 +191,7 @@ MatroskaWriter::QWORD CUInt::Size(bool fWithHeader)
HRESULT CUInt::Write(IStream* pStream)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return S_OK;
}
@@ -205,27 +205,27 @@ HRESULT CUInt::Write(IStream* pStream)
MatroskaWriter::QWORD CInt::Size(bool fWithHeader)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return 0;
}
MatroskaWriter::QWORD len = 0;
- if(m_val == 0) {
+ if (m_val == 0) {
len++;
} else {
UINT64 val = m_val >= 0 ? m_val : -m_val;
- for(int i = 8; i > 0; i--) {
- if(((0xffi64<<((i-1)*8))&val)) {
+ for (int i = 8; i > 0; i--) {
+ if (((0xffi64<<((i-1)*8))&val)) {
len += i;
- if(m_val < 0 && !(m_val&(0x80<<(i-1)))) {
+ if (m_val < 0 && !(m_val&(0x80<<(i-1)))) {
len++;
}
break;
}
}
}
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -233,7 +233,7 @@ MatroskaWriter::QWORD CInt::Size(bool fWithHeader)
HRESULT CInt::Write(IStream* pStream)
{
- if(!m_fSet) {
+ if (!m_fSet) {
return S_OK;
}
@@ -247,13 +247,13 @@ HRESULT CInt::Write(IStream* pStream)
MatroskaWriter::QWORD CLength::Size(bool fWithHeader)
{
- if(m_len == 0x00FFFFFFFFFFFFFFi64) {
+ if (m_len == 0x00FFFFFFFFFFFFFFi64) {
return 8;
}
MatroskaWriter::QWORD len = 0;
- for(int i = 1; i <= 8; i++) {
- if(!(m_len&(~((1i64<<(7*i))-1))) && (m_len&((1i64<<(7*i))-1)) != ((1i64<<(7*i))-1)) {
+ for (int i = 1; i <= 8; i++) {
+ if (!(m_len&(~((1i64<<(7*i))-1))) && (m_len&((1i64<<(7*i))-1)) != ((1i64<<(7*i))-1)) {
len += i;
break;
}
@@ -294,7 +294,7 @@ MatroskaWriter::QWORD EBML::Size(bool fWithHeader)
len += DocType.Size();
len += DocTypeVersion.Size();
len += DocTypeReadVersion.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -345,7 +345,7 @@ MatroskaWriter::QWORD Info::Size(bool fWithHeader)
len += Title.Size();
len += MuxingApp.Size();
len += WritingApp.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -399,7 +399,7 @@ MatroskaWriter::QWORD Track::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += TrackEntries.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -461,13 +461,13 @@ MatroskaWriter::QWORD TrackEntry::Size(bool fWithHeader)
len += CodecDecodeAll.Size();
len += TrackOverlay.Size();
len += DefaultDuration.Size();
- if(DescType == TypeVideo) {
+ if (DescType == TypeVideo) {
len += v.Size();
}
- if(DescType == TypeAudio) {
+ if (DescType == TypeAudio) {
len += a.Size();
}
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -495,10 +495,10 @@ HRESULT TrackEntry::Write(IStream* pStream)
CodecDecodeAll.Write(pStream);
TrackOverlay.Write(pStream);
DefaultDuration.Write(pStream);
- if(DescType == TypeVideo) {
+ if (DescType == TypeVideo) {
v.Write(pStream);
}
- if(DescType == TypeAudio) {
+ if (DescType == TypeAudio) {
a.Write(pStream);
}
return S_OK;
@@ -534,7 +534,7 @@ MatroskaWriter::QWORD Video::Size(bool fWithHeader)
len += ColourSpace.Size();
len += GammaValue.Size();
len += FramePerSec.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -575,7 +575,7 @@ MatroskaWriter::QWORD Audio::Size(bool fWithHeader)
len += Channels.Size();
len += ChannelPositions.Size();
len += BitDepth.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -607,7 +607,7 @@ MatroskaWriter::QWORD Cluster::Size(bool fWithHeader)
len += Position.Size();
len += PrevSize.Size();
len += BlockGroups.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -642,7 +642,7 @@ MatroskaWriter::QWORD BlockGroup::Size(bool fWithHeader)
len += ReferenceVirtual.Size();
len += CodecState.Size();
len += Block.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -670,22 +670,22 @@ MatroskaWriter::QWORD CBlock::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += TrackNumber.Size() + 2 + 1; // TrackNumber + TimeCode + Lacing
- if(BlockData.GetCount() > 1) {
+ if (BlockData.GetCount() > 1) {
len += 1; // nBlockData
POSITION pos = BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* b = BlockData.GetNext(pos);
- if(pos) {
+ if (pos) {
len += b->GetCount()/255 + 1;
}
}
}
POSITION pos = BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* b = BlockData.GetNext(pos);
len += b->GetCount();
}
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -700,18 +700,18 @@ HRESULT CBlock::Write(IStream* pStream)
pStream->Write(&t, 2, NULL);
BYTE Lacing = 0;
BYTE n = BlockData.GetCount();
- if(n > 1) {
+ if (n > 1) {
Lacing |= 2;
}
pStream->Write(&Lacing, 1, NULL);
- if(n > 1) {
+ if (n > 1) {
pStream->Write(&n, 1, NULL);
POSITION pos = BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* b = BlockData.GetNext(pos);
- if(pos) {
+ if (pos) {
int len = b->GetCount();
- while(len >= 0) {
+ while (len >= 0) {
n = min(len, 255);
pStream->Write(&n, 1, NULL);
len -= 255;
@@ -720,7 +720,7 @@ HRESULT CBlock::Write(IStream* pStream)
}
}
POSITION pos = BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* b = BlockData.GetNext(pos);
pStream->Write(b->GetData(), b->GetCount(), NULL);
}
@@ -736,7 +736,7 @@ MatroskaWriter::QWORD Cue::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += CuePoints.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -760,7 +760,7 @@ MatroskaWriter::QWORD CuePoint::Size(bool fWithHeader)
MatroskaWriter::QWORD len = 0;
len += CueTime.Size();
len += CueTrackPositions.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -791,7 +791,7 @@ MatroskaWriter::QWORD CueTrackPosition::Size(bool fWithHeader)
len += CueBlockNumber.Size();
len += CueCodecState.Size();
// len += CueReferences.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -817,7 +817,7 @@ MatroskaWriter::QWORD Seek::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += SeekHeads.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -840,7 +840,7 @@ MatroskaWriter::QWORD SeekID::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += m_id.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -864,7 +864,7 @@ MatroskaWriter::QWORD SeekHead::Size(bool fWithHeader)
MatroskaWriter::QWORD len = 0;
len += ID.Size();
len += Position.Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -887,7 +887,7 @@ MatroskaWriter::QWORD Tags::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
// len += .Size();
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -910,7 +910,7 @@ MatroskaWriter::QWORD Void::Size(bool fWithHeader)
{
MatroskaWriter::QWORD len = 0;
len += m_len;
- if(fWithHeader) {
+ if (fWithHeader) {
len += HeaderSize(len);
}
return len;
@@ -921,7 +921,7 @@ HRESULT Void::Write(IStream* pStream)
HeaderWrite(pStream);
BYTE buff[64];
memset(buff, 0x80, sizeof(buff));
- for(int len = (int)m_len; len > 0; len -= sizeof(buff)) {
+ for (int len = (int)m_len; len > 0; len -= sizeof(buff)) {
pStream->Write(buff, (ULONG)min(sizeof(buff), len), NULL);
}
return S_OK;
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
index 477d9c990..d34bc7d0b 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
@@ -167,7 +167,7 @@ namespace MatroskaWriter
QWORD Size(bool fWithHeader = true) {
QWORD len = 0;
POSITION pos = GetHeadPosition();
- while(pos) {
+ while (pos) {
len += GetNext(pos)->Size(fWithHeader);
}
return len;
@@ -175,7 +175,7 @@ namespace MatroskaWriter
HRESULT Write(IStream* pStream) {
HRESULT hr;
POSITION pos = GetHeadPosition();
- while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) {
+ while (pos) if (FAILED(hr = GetNext(pos)->Write(pStream))) {
return hr;
}
return S_OK;
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
index cc1fe52ab..8b8c04f9d 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
@@ -75,7 +75,7 @@ CMatroskaMuxerFilter::CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr)
, m_rtCurrent(0)
, m_fNegative(true), m_fPositive(false)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -109,9 +109,9 @@ UINT CMatroskaMuxerFilter::GetTrackNumber(CBasePin* pPin)
UINT nTrackNumber = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
nTrackNumber++;
- if(m_pInputs.GetNext(pos) == pPin) {
+ if (m_pInputs.GetNext(pos) == pPin) {
return nTrackNumber;
}
}
@@ -122,9 +122,9 @@ UINT CMatroskaMuxerFilter::GetTrackNumber(CBasePin* pPin)
void CMatroskaMuxerFilter::AddInput()
{
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBasePin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) {
+ if (!pPin->IsConnected()) {
return;
}
}
@@ -146,13 +146,13 @@ CBasePin* CMatroskaMuxerFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pInputs.GetCount()) {
- if(POSITION pos = m_pInputs.FindIndex(n)) {
+ if (n >= 0 && n < (int)m_pInputs.GetCount()) {
+ if (POSITION pos = m_pInputs.FindIndex(n)) {
return m_pInputs.GetAt(pos);
}
}
- if(n == m_pInputs.GetCount() && m_pOutput) {
+ if (n == m_pInputs.GetCount() && m_pOutput) {
return m_pOutput;
}
@@ -165,7 +165,7 @@ STDMETHODIMP CMatroskaMuxerFilter::Stop()
HRESULT hr;
- if(FAILED(hr = __super::Stop())) {
+ if (FAILED(hr = __super::Stop())) {
return hr;
}
@@ -182,11 +182,11 @@ STDMETHODIMP CMatroskaMuxerFilter::Pause()
HRESULT hr;
- if(FAILED(hr = __super::Pause())) {
+ if (FAILED(hr = __super::Pause())) {
return hr;
}
- if(fs == State_Stopped && m_pOutput) {
+ if (fs == State_Stopped && m_pOutput) {
CAMThread::Create();
CallWorker(CMD_RUN);
}
@@ -200,7 +200,7 @@ STDMETHODIMP CMatroskaMuxerFilter::Run(REFERENCE_TIME tStart)
HRESULT hr;
- if(FAILED(hr = __super::Run(tStart))) {
+ if (FAILED(hr = __super::Run(tStart))) {
return hr;
}
@@ -226,7 +226,7 @@ STDMETHODIMP CMatroskaMuxerFilter::GetCapabilities(DWORD* pCapabilities)
STDMETHODIMP CMatroskaMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
DWORD caps;
@@ -265,9 +265,9 @@ STDMETHODIMP CMatroskaMuxerFilter::GetDuration(LONGLONG* pDuration)
CheckPointer(pDuration, E_POINTER);
*pDuration = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur;
- if(rt > *pDuration) {
+ if (rt > *pDuration) {
*pDuration = rt;
}
}
@@ -353,14 +353,14 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
{
CComQIPtr<IStream> pStream;
- if(!m_pOutput || !(pStream = m_pOutput->GetConnected())) {
- while(1) {
+ if (!m_pOutput || !(pStream = m_pOutput->GetConnected())) {
+ while (1) {
DWORD cmd = GetRequest();
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
CAMThread::m_hThread = NULL;
}
Reply(S_OK);
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
return 0;
}
}
@@ -385,7 +385,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
// TODO
MatroskaWriter::QWORD voidlen = 100;
- if(rtDur > 0) {
+ if (rtDur > 0) {
voidlen += int(1.0 * rtDur / MAXCLUSTERTIME / 10000 + 0.5) * 20;
} else {
voidlen += int(1.0 * 1000*60*60*24 / MAXCLUSTERTIME + 0.5) * 20; // when no duration is known, allocate for 24 hours (~340k)
@@ -459,17 +459,17 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
CAtlList<CMatroskaMuxerInputPin*> pActivePins;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected()) {
+ if (pPin->IsConnected()) {
pActivePins.AddTail(pPin);
}
}
- while(1) {
+ while (1) {
DWORD cmd = GetRequest();
- switch(cmd) {
+ switch (cmd) {
default:
case CMD_EXIT:
CAMThread::m_hThread = NULL;
@@ -484,8 +484,8 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
INT64 lastcuetimecode = (INT64)-1;
UINT64 nBlocksInCueTrack = 0;
- while(!CheckRequest(NULL)) {
- if(m_State == State_Paused) {
+ while (!CheckRequest(NULL)) {
+ if (m_State == State_Paused) {
Sleep(10);
continue;
}
@@ -495,28 +495,28 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
REFERENCE_TIME rtMin = _I64_MAX;
pos = pActivePins.GetHeadPosition();
- while(pos) {
+ while (pos) {
CMatroskaMuxerInputPin* pTmp = pActivePins.GetNext(pos);
CAutoLock cAutoLock(&pTmp->m_csQueue);
- if(pTmp->m_blocks.GetCount() == 0 && pTmp->m_fEndOfStreamReceived) {
+ if (pTmp->m_blocks.GetCount() == 0 && pTmp->m_fEndOfStreamReceived) {
pActivePins.RemoveAt(pActivePins.Find(pTmp));
continue;
}
- if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle) {
+ if (pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle) {
nPinsNeeded++;
}
- if(pTmp->m_blocks.GetCount() > 0) {
- if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle) {
+ if (pTmp->m_blocks.GetCount() > 0) {
+ if (pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle) {
nPinsGotSomething++;
}
- if(pTmp->m_blocks.GetCount() > 0) {
+ if (pTmp->m_blocks.GetCount() > 0) {
REFERENCE_TIME rt = pTmp->m_blocks.GetHead()->Block.TimeCode;
- if(rt < rtMin) {
+ if (rt < rtMin) {
rtMin = rt;
pPin = pTmp;
}
@@ -524,25 +524,25 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
}
}
- if(pActivePins.GetCount() == 0) {
+ if (pActivePins.GetCount() == 0) {
break;
}
- if(!pPin || nPinsNeeded > nPinsGotSomething || !pPin && nPinsGotSomething == 0) {
+ if (!pPin || nPinsNeeded > nPinsGotSomething || !pPin && nPinsGotSomething == 0) {
Sleep(1);
continue;
}
- if(!fTracksWritten) {
+ if (!fTracksWritten) {
CNode<Track> Tracks;
CAutoPtr<Track> pT(DNew Track());
POSITION pos = pActivePins.GetHeadPosition();
- for(int i = 1; pos; i++) {
+ for (int i = 1; pos; i++) {
CMatroskaMuxerInputPin* pPin = pActivePins.GetNext(pos);
CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
*pTE = *pPin->GetTrackEntry();
- if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo) {
+ if (TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo) {
TrackNumber = pTE->TrackNumber;
}
pT->TrackEntries.AddTail(pTE);
@@ -550,7 +550,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
Tracks.AddTail(pT);
Tracks.Write(pStream);
- if(TrackNumber == 0) {
+ if (TrackNumber == 0) {
TrackNumber = 1;
}
@@ -566,9 +566,9 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
b = pPin->m_blocks.RemoveHead();
}
- if(b) {
- if(fFirstBlock) {
- if(b->Block.TimeCode < 0 && m_fNegative || b->Block.TimeCode > 0 && m_fPositive) {
+ if (b) {
+ if (fFirstBlock) {
+ if (b->Block.TimeCode < 0 && m_fNegative || b->Block.TimeCode > 0 && m_fPositive) {
firstTimeCode = b->Block.TimeCode;
}
fFirstBlock = false;
@@ -584,13 +584,13 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
(int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
*/
- if(b->Block.TimeCode < SHRT_MIN /*0*/) {
+ if (b->Block.TimeCode < SHRT_MIN /*0*/) {
ASSERT(0);
continue;
}
- while((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode) {
- if(!c.BlockGroups.IsEmpty()) {
+ while ((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode) {
+ if (!c.BlockGroups.IsEmpty()) {
sh.Attach(DNew SeekHead());
sh->ID.Set(c.GetID()/*0x1F43B675*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
@@ -604,17 +604,17 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
nBlocksInCueTrack = 0;
}
- if(b->Block.TrackNumber == TrackNumber) {
+ if (b->Block.TrackNumber == TrackNumber) {
nBlocksInCueTrack++;
}
- if(b->ReferenceBlock == 0 && b->Block.TrackNumber == TrackNumber) {
+ if (b->ReferenceBlock == 0 && b->Block.TrackNumber == TrackNumber) {
ULONGLONG clusterpos = GetStreamPosition(pStream) - segpos;
- if(lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode) {
+ if (lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode) {
CAutoPtr<CueTrackPosition> ctp(DNew CueTrackPosition());
ctp->CueTrack.Set(b->Block.TrackNumber);
ctp->CueClusterPosition.Set(clusterpos);
- if(c.BlockGroups.GetCount() > 0) {
+ if (c.BlockGroups.GetCount() > 0) {
ctp->CueBlockNumber.Set(nBlocksInCueTrack);
}
CAutoPtr<CuePoint> cp(DNew CuePoint());
@@ -635,7 +635,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
}
}
- if(!c.BlockGroups.IsEmpty()) {
+ if (!c.BlockGroups.IsEmpty()) {
sh.Attach(DNew SeekHead());
sh->ID.Set(c.GetID()/*0x1F43B675*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
@@ -644,7 +644,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
c.Write(pStream);
}
- if(!cue.CuePoints.IsEmpty()) {
+ if (!cue.CuePoints.IsEmpty()) {
sh.Attach(DNew SeekHead());
sh->ID.Set(cue.GetID()/*0x1C53BB6B*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
@@ -669,18 +669,18 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
ASSERT(len >= 0 && len != 1);
seek.Write(pStream);
- if(len == 0) {
+ if (len == 0) {
// nothing to do
- } else if(len >= 2) {
- for(int i = 0; i < 8; i++) {
- if(len >= (1<<i*7)-2 && len <= (1<<(i+1)*7)-2) {
+ } else if (len >= 2) {
+ for (int i = 0; i < 8; i++) {
+ if (len >= (1<<i*7)-2 && len <= (1<<(i+1)*7)-2) {
Void(len-2-i).Write(pStream);
break;
}
}
}
- if(abs(m_rtCurrent - (REFERENCE_TIME)info.Duration*10000) > 10000000i64) {
+ if (abs(m_rtCurrent - (REFERENCE_TIME)info.Duration*10000) > 10000000i64) {
info.Duration.Set(m_rtCurrent / 10000 + 1);
}
@@ -751,7 +751,7 @@ HRESULT CMatroskaMuxerInputPin::BreakConnect()
{
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
@@ -764,13 +764,13 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
m_rtDur = 0;
CComQIPtr<IMediaSeeking> pMS;
- if((pMS = GetFilterFromPin(pPin)) || (pMS = pPin)) {
+ if ((pMS = GetFilterFromPin(pPin)) || (pMS = pPin)) {
pMS->GetDuration(&m_rtDur);
}
@@ -784,18 +784,18 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
hr = E_FAIL;
- if(m_mt.majortype == MEDIATYPE_Video) {
+ if (m_mt.majortype == MEDIATYPE_Video) {
m_pTE->TrackType.Set(TrackEntry::TypeVideo);
- if(m_mt.formattype == FORMAT_VideoInfo
+ if (m_mt.formattype == FORMAT_VideoInfo
&& m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
|| m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40) {
m_pTE->CodecID.Set("V_REAL/RV00");
m_pTE->CodecID.SetAt(9, (BYTE)(m_mt.subtype.Data1>>16));
- if(m_mt.formattype == FORMAT_VideoInfo) {
+ if (m_mt.formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
- if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER)) {
+ if (m_mt.cbFormat > sizeof(VIDEOINFOHEADER)) {
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER));
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER), m_pTE->CodecPrivate.GetCount());
}
@@ -803,12 +803,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0) {
+ if (vih->AvgTimePerFrame > 0) {
m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
}
- } else if(m_mt.formattype == FORMAT_VideoInfo2) {
+ } else if (m_mt.formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
- if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER2)) {
+ if (m_mt.cbFormat > sizeof(VIDEOINFOHEADER2)) {
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER2));
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER2), m_pTE->CodecPrivate.GetCount());
}
@@ -816,7 +816,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0) {
+ if (vih->AvgTimePerFrame > 0) {
m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
}
m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
@@ -827,7 +827,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
}
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_VideoInfo) {
+ } else if (m_mt.formattype == FORMAT_VideoInfo) {
m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
@@ -837,12 +837,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->DescType = TrackEntry::DescVideo;
m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0) {
+ if (vih->AvgTimePerFrame > 0) {
m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
}
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_VideoInfo2) {
+ } else if (m_mt.formattype == FORMAT_VideoInfo2) {
m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
@@ -854,12 +854,12 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
- if(vih->AvgTimePerFrame > 0) {
+ if (vih->AvgTimePerFrame > 0) {
m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
}
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_DiracVideoInfo) {
+ } else if (m_mt.formattype == FORMAT_DiracVideoInfo) {
m_pTE->CodecID.Set("V_DIRAC");
DIRACINFOHEADER* vih = (DIRACINFOHEADER*)m_mt.pbFormat;
@@ -871,7 +871,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->v.PixelHeight.Set(abs(vih->hdr.bmiHeader.biHeight));
// m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
// m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
- if(vih->hdr.AvgTimePerFrame > 0) {
+ if (vih->hdr.AvgTimePerFrame > 0) {
m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
}
@@ -911,10 +911,10 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
hr = S_OK;
}
*/
- } else if(m_mt.majortype == MEDIATYPE_Audio) {
+ } else if (m_mt.majortype == MEDIATYPE_Audio) {
m_pTE->TrackType.Set(TrackEntry::TypeAudio);
- if(m_mt.formattype == FORMAT_WaveFormatEx
+ if (m_mt.formattype == FORMAT_WaveFormatEx
&& ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_AAC
&& m_mt.cbFormat >= sizeof(WAVEFORMATEX)+2) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -928,7 +928,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
int exttype = 0;
int rate2 = rate1;
- if(wfe->cbSize >= 5) {
+ if (wfe->cbSize >= 5) {
profile = 4;
exttype = (p[2]<<3)|(p[3]>>5);
@@ -937,13 +937,13 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
ASSERT((p[4]>>7) == 1);
rate2 = ((p[4]>>3)&15);
- if(rate2 < rate1) {
+ if (rate2 < rate1) {
m_pTE->a.OutputSamplingFrequency.Set((float)nSamplesPerSec);
nSamplesPerSec /= 2;
}
}
- switch(profile) {
+ switch (profile) {
default:
case 0:
m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN");
@@ -970,8 +970,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3) {
m_pTE->CodecID.Set("A_AC3");
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -981,8 +981,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS) {
m_pTE->CodecID.Set("A_DTS");
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -992,8 +992,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_FLAC) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_FLAC) {
m_pTE->CodecID.Set("A_FLAC");
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -1002,19 +1002,19 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.Channels.Set(wfe->nChannels);
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
- if(wfe->cbSize) {
+ if (wfe->cbSize) {
m_pTE->CodecPrivate.SetCount(wfe->cbSize);
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(WAVEFORMATEX), wfe->cbSize);
}
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx
- && (m_mt.subtype == MEDIASUBTYPE_14_4
- || m_mt.subtype == MEDIASUBTYPE_28_8
- || m_mt.subtype == MEDIASUBTYPE_ATRC
- || m_mt.subtype == MEDIASUBTYPE_COOK
- || m_mt.subtype == MEDIASUBTYPE_DNET
- || m_mt.subtype == MEDIASUBTYPE_SIPR)) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx
+ && (m_mt.subtype == MEDIASUBTYPE_14_4
+ || m_mt.subtype == MEDIASUBTYPE_28_8
+ || m_mt.subtype == MEDIASUBTYPE_ATRC
+ || m_mt.subtype == MEDIASUBTYPE_COOK
+ || m_mt.subtype == MEDIASUBTYPE_DNET
+ || m_mt.subtype == MEDIASUBTYPE_SIPR)) {
CStringA id;
id.Format("A_REAL/%c%c%c%c",
(char)((m_mt.subtype.Data1>>0)&0xff),
@@ -1026,7 +1026,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
DWORD cbSize = sizeof(WAVEFORMATEX) + wfe->cbSize;
- if(m_mt.cbFormat > cbSize) {
+ if (m_mt.cbFormat > cbSize) {
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - cbSize);
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + cbSize, m_pTE->CodecPrivate.GetCount());
}
@@ -1036,8 +1036,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM) {
m_pTE->CodecID.Set("A_PCM/INT/LIT");
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -1047,7 +1047,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_WaveFormatEx) {
+ } else if (m_mt.formattype == FORMAT_WaveFormatEx) {
m_pTE->CodecID.Set("A_MS/ACM");
WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
@@ -1059,7 +1059,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_VorbisFormat) {
+ } else if (m_mt.formattype == FORMAT_VorbisFormat) {
m_pTE->CodecID.Set("A_VORBIS");
VORBISFORMAT* pvf = (VORBISFORMAT*)m_mt.pbFormat;
@@ -1070,7 +1070,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
// m_pTE->CodecPrivate will be filled later
hr = S_OK;
- } else if(m_mt.formattype == FORMAT_VorbisFormat2) {
+ } else if (m_mt.formattype == FORMAT_VorbisFormat2) {
m_pTE->CodecID.Set("A_VORBIS");
VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)m_mt.pbFormat;
@@ -1080,10 +1080,10 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_pTE->a.BitDepth.Set(pvf2->BitsPerSample);
int len = 1;
- for(int i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
len += pvf2->HeaderSize[i]/255 + 1;
}
- for(int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
len += pvf2->HeaderSize[i];
}
m_pTE->CodecPrivate.SetCount(len);
@@ -1092,8 +1092,8 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
BYTE* dst = m_pTE->CodecPrivate.GetData();
*dst++ = 2;
- for(int i = 0; i < 2; i++)
- for(int len = pvf2->HeaderSize[i]; len >= 0; len -= 255) {
+ for (int i = 0; i < 2; i++)
+ for (int len = pvf2->HeaderSize[i]; len >= 0; len -= 255) {
*dst++ = min(len, 255);
}
@@ -1112,14 +1112,14 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
hr = S_OK;
}
- } else if(m_mt.majortype == MEDIATYPE_Text) {
+ } else if (m_mt.majortype == MEDIATYPE_Text) {
m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
- if(m_mt.formattype == FORMAT_None) {
+ if (m_mt.formattype == FORMAT_None) {
m_pTE->CodecID.Set("S_TEXT/ASCII");
hr = S_OK;
}
- } else if(m_mt.majortype == MEDIATYPE_Subtitle) {
+ } else if (m_mt.majortype == MEDIATYPE_Subtitle) {
m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
m_pTE->CodecID.Set(
@@ -1130,18 +1130,18 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
m_mt.subtype == MEDIASUBTYPE_VOBSUB ? "S_VOBSUB" :
"");
- if(!m_pTE->CodecID.IsEmpty()) {
+ if (!m_pTE->CodecID.IsEmpty()) {
hr = S_OK;
SUBTITLEINFO* psi = (SUBTITLEINFO*)m_mt.pbFormat;
- if(psi->dwOffset) {
+ if (psi->dwOffset) {
m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - psi->dwOffset);
memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + psi->dwOffset, m_pTE->CodecPrivate.GetCount());
}
}
}
- if(S_OK == hr) {
+ if (S_OK == hr) {
(static_cast<CMatroskaMuxerFilter*>(m_pFilter))->AddInput();
}
@@ -1183,17 +1183,17 @@ STDMETHODIMP CMatroskaMuxerInputPin::EndFlush()
STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
{
- if(m_fEndOfStreamReceived) {
+ if (m_fEndOfStreamReceived) {
/*ASSERT(0);*/
return S_FALSE;
}
CAutoLock cAutoLock(&m_csReceive);
- while(m_fActive) {
+ while (m_fActive) {
{
CAutoLock cAutoLock2(&m_csQueue);
- if(m_blocks.GetCount() < MAXBLOCKS) {
+ if (m_blocks.GetCount() < MAXBLOCKS) {
break;
}
}
@@ -1201,13 +1201,13 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
Sleep(1);
}
- if(!m_fActive) {
+ if (!m_fActive) {
return S_FALSE;
}
HRESULT hr;
- if(FAILED(hr = __super::Receive(pSample))) {
+ if (FAILED(hr = __super::Receive(pSample))) {
return hr;
}
@@ -1219,7 +1219,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
REFERENCE_TIME rtStart = -1, rtStop = -1;
hr = pSample->GetTime(&rtStart, &rtStop);
- if(FAILED(hr) || rtStart == -1 || rtStop == -1) {
+ if (FAILED(hr) || rtStart == -1 || rtStop == -1) {
TRACE(_T("No timestamp was set on the sample!!!"));
m_pFilter->NotifyEvent(EC_ERRORABORT, VFW_E_SAMPLE_TIME_NOT_SET, 0);
return VFW_E_SAMPLE_TIME_NOT_SET;
@@ -1237,18 +1237,18 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
pSample->IsPreroll() == S_OK ? 1 : 0,
pSample->IsSyncPoint() == S_OK ? 1 : 0);
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3) {
+ if (m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3) {
CAutoPtr<CBinary> data(DNew CBinary(0));
data->SetCount(len);
memcpy(data->GetData(), pData, len);
m_pVorbisHdrs.Add(data);
- if(m_pVorbisHdrs.GetCount() == 3) {
+ if (m_pVorbisHdrs.GetCount() == 3) {
int len = 1;
- for(int i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
len += m_pVorbisHdrs[i]->GetCount()/255 + 1;
}
- for(int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
len += m_pVorbisHdrs[i]->GetCount();
}
m_pTE->CodecPrivate.SetCount(len);
@@ -1256,12 +1256,12 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
BYTE* dst = m_pTE->CodecPrivate.GetData();
*dst++ = 2;
- for(int i = 0; i < 2; i++)
- for(int len = m_pVorbisHdrs[i]->GetCount(); len >= 0; len -= 255) {
+ for (int i = 0; i < 2; i++)
+ for (int len = m_pVorbisHdrs[i]->GetCount(); len >= 0; len -= 255) {
*dst++ = min(len, 255);
}
- for(int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
memcpy(dst, m_pVorbisHdrs[i]->GetData(), m_pVorbisHdrs[i]->GetCount());
dst += m_pVorbisHdrs[i]->GetCount();
}
@@ -1270,7 +1270,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
return S_OK;
}
- if(m_mt.formattype == FORMAT_WaveFormatEx
+ if (m_mt.formattype == FORMAT_WaveFormatEx
&& (((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM
|| ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3)) {
pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
@@ -1285,7 +1285,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
return S_OK;
}
*/
- if((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/) {
+ if ((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/) {
ASSERT(m_rtLastStart - rtStart <= 0);
REFERENCE_TIME rtDiff = m_rtLastStart - rtStart;
b->ReferenceBlock.Set((rtDiff + (rtDiff >= 0 ? 5000 : -5000)) / 10000);
@@ -1296,7 +1296,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
b->Block.TimeCode = (rtStart + 5000) / 10000;
b->Block.TimeCodeStop = (rtStop + 5000) / 10000;
- if(m_pTE->TrackType == TrackEntry::TypeSubtitle) {
+ if (m_pTE->TrackType == TrackEntry::TypeSubtitle) {
b->BlockDuration.Set((rtStop - rtStart + 5000) / 10000);
}
@@ -1318,7 +1318,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::EndOfStream()
{
HRESULT hr;
- if(FAILED(hr = __super::EndOfStream())) {
+ if (FAILED(hr = __super::EndOfStream())) {
return hr;
}
@@ -1361,11 +1361,11 @@ HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCAT
pProperties->cbBuffer = 1;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -1384,10 +1384,10 @@ HRESULT CMatroskaMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
diff --git a/src/filters/muxer/WavDest/WavDest.cpp b/src/filters/muxer/WavDest/WavDest.cpp
index 05d68a2a5..ca876cf74 100644
--- a/src/filters/muxer/WavDest/WavDest.cpp
+++ b/src/filters/muxer/WavDest/WavDest.cpp
@@ -73,9 +73,9 @@ CFilterApp theApp;
CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
: CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
{
- if(SUCCEEDED(*phr)) {
- if(CWavDestOutputPin* pOut = DNew CWavDestOutputPin(this, phr)) {
- if(SUCCEEDED(*phr)) {
+ if (SUCCEEDED(*phr)) {
+ if (CWavDestOutputPin* pOut = DNew CWavDestOutputPin(this, phr)) {
+ if (SUCCEEDED(*phr)) {
m_pOutput = pOut;
} else {
delete pOut;
@@ -85,8 +85,8 @@ CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
return;
}
- if(CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In")) {
- if(SUCCEEDED(*phr)) {
+ if (CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In")) {
+ if (SUCCEEDED(*phr)) {
m_pInput = pIn;
} else {
delete pIn;
@@ -113,7 +113,7 @@ HRESULT CWavDestFilter::Receive(IMediaSample* pSample)
HRESULT hr = CTransformFilter::Receive(pSample);
// don't update the count if Deliver() downstream fails.
- if(hr != S_OK) {
+ if (hr != S_OK) {
m_cbWavData = cbOld;
}
@@ -125,14 +125,14 @@ HRESULT CWavDestFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
REFERENCE_TIME rtStart, rtEnd;
HRESULT hr = Copy(pIn, pOut);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
// Prepare it for writing
LONG lActual = pOut->GetActualDataLength();
- if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) { // overflow
+ if (m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) { // overflow
return E_FAIL;
}
@@ -163,12 +163,12 @@ HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
// Copy the sample times
REFERENCE_TIME TimeStart, TimeEnd;
- if(NOERROR == pSource->GetTime(&TimeStart, &TimeEnd)) {
+ if (NOERROR == pSource->GetTime(&TimeStart, &TimeEnd)) {
pDest->SetTime(&TimeStart, &TimeEnd);
}
LONGLONG MediaStart, MediaEnd;
- if(pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR) {
+ if (pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR) {
pDest->SetMediaTime(&MediaStart, &MediaEnd);
}
@@ -194,7 +194,7 @@ HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
ASSERT(iPosition == 0 || iPosition == 1);
- if(iPosition == 0) {
+ if (iPosition == 0) {
pMediaType->SetType(&MEDIATYPE_Stream);
pMediaType->SetSubtype(&MEDIASUBTYPE_WAVE);
return S_OK;
@@ -205,7 +205,7 @@ HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -219,7 +219,7 @@ HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPER
CComPtr<IMemAllocator> pInAlloc;
ALLOCATOR_PROPERTIES InProps;
- if(SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
+ if (SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
&& SUCCEEDED(hr = pInAlloc->GetProperties(&InProps))) {
pProperties->cbBuffer = InProps.cbBuffer;
} else {
@@ -229,13 +229,13 @@ HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPER
ASSERT(pProperties->cbBuffer);
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties,&Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties,&Actual))) {
return hr;
}
ASSERT(Actual.cBuffers == 1);
- if(pProperties->cBuffers > Actual.cBuffers
+ if (pProperties->cBuffers > Actual.cBuffers
|| pProperties->cbBuffer > Actual.cbBuffer) {
return E_FAIL;
}
@@ -278,7 +278,7 @@ HRESULT CWavDestFilter::StopStreaming()
}
HRESULT hr = ((IMemInputPin *) pDwnstrmInputPin)->QueryInterface(IID_IStream, (void **)&pStream);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
BYTE *pb = (BYTE *)_alloca(m_cbHeader);
RIFFLIST *pRiffWave = (RIFFLIST *)pb;
@@ -300,7 +300,7 @@ HRESULT CWavDestFilter::StopStreaming()
ZeroMemory(&li, sizeof(li));
hr = pStream->Seek(li, STREAM_SEEK_SET, 0);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = pStream->Write(pb, m_cbHeader, 0);
}
pStream->Release();
@@ -321,7 +321,7 @@ STDMETHODIMP CWavDestOutputPin::EnumMediaTypes(IEnumMediaTypes** ppEnum)
HRESULT CWavDestOutputPin::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_WAVE) {
+ if (pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_WAVE) {
return S_OK;
} else {
return S_FALSE;
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp
index 20583dc7e..27957bc18 100644
--- a/src/filters/parser/AviSplitter/AviFile.cpp
+++ b/src/filters/parser/AviSplitter/AviFile.cpp
@@ -30,7 +30,7 @@
CAviFile::CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
m_isamv = false;
@@ -41,7 +41,7 @@ HRESULT CAviFile::Init()
{
Seek(0);
DWORD dw[3];
- if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV '))) {
+ if (S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV '))) {
return E_FAIL;
}
@@ -49,25 +49,25 @@ HRESULT CAviFile::Init()
Seek(0);
HRESULT hr = Parse(0, GetLength());
UNUSED_ALWAYS(hr);
- if(m_movis.GetCount() == 0) { // FAILED(hr) is allowed as long as there was a movi chunk found
+ if (m_movis.GetCount() == 0) { // FAILED(hr) is allowed as long as there was a movi chunk found
return E_FAIL;
}
- if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0) {
+ if (m_avih.dwStreams == 0 && m_strms.GetCount() > 0) {
m_avih.dwStreams = m_strms.GetCount();
}
- if(m_avih.dwStreams != m_strms.GetCount()) {
+ if (m_avih.dwStreams != m_strms.GetCount()) {
return E_FAIL;
}
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
- if(s->strh.fccType != FCC('auds')) {
+ if (s->strh.fccType != FCC('auds')) {
continue;
}
WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
- if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
+ if (wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
&& s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec) {
// correcting encoder bugs...
s->strh.dwScale = 1152;
@@ -89,7 +89,7 @@ HRESULT CAviFile::BuildAMVIndex()
DWORD ulSize;
memset (&NewChunk, 0, sizeof(strm_t::chunk));
- while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK)) {
+ while ((Read(ulType) == S_OK) && (Read(ulSize) == S_OK)) {
switch (ulType) {
case FCC('00dc'): // 01bw : JPeg
NewChunk.size = ulSize;
@@ -119,16 +119,16 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
CAutoPtr<strm_t> strm;
- while(S_OK == hr && GetPos() < end) {
+ while (S_OK == hr && GetPos() < end) {
UINT64 pos = GetPos();
DWORD id = 0, size;
- if(S_OK != Read(id) || id == 0) {
+ if (S_OK != Read(id) || id == 0) {
return E_FAIL;
}
- if(id == FCC('RIFF') || id == FCC('LIST')) {
- if(S_OK != Read(size) || S_OK != Read(id)) {
+ if (id == FCC('RIFF') || id == FCC('LIST')) {
+ if (S_OK != Read(size) || S_OK != Read(id)) {
return E_FAIL;
}
@@ -143,7 +143,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
TCHAR((id>>16)&0xff),
TCHAR((id>>24)&0xff));
- if(id == FCC('movi')) {
+ if (id == FCC('movi')) {
m_movis.AddTail(pos);
if (m_isamv) {
BuildAMVIndex();
@@ -152,7 +152,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
hr = Parse(id, pos + size);
}
} else {
- if(S_OK != Read(size)) {
+ if (S_OK != Read(size)) {
return E_FAIL;
}
@@ -162,8 +162,8 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
TCHAR((id>>16)&0xff),
TCHAR((id>>24)&0xff));
- if(parentid == FCC('INFO') && size > 0) {
- switch(id) {
+ if (parentid == FCC('INFO') && size > 0) {
+ switch (id) {
case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
@@ -188,7 +188,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
case FCC('ITCH'): { // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
CStringA str;
- if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) {
+ if (S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) {
return E_FAIL;
}
m_info[id] = str;
@@ -197,22 +197,22 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
}
}
- switch(id) {
+ switch (id) {
case FCC('amvh'):
case FCC('avih'):
m_avih.fcc = id;
m_avih.cb = size;
- if(S_OK != Read(m_avih, 8)) {
+ if (S_OK != Read(m_avih, 8)) {
return E_FAIL;
}
break;
case FCC('strh'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
strm->strh.fcc = FCC('strh');
strm->strh.cb = size;
- if(S_OK != Read(strm->strh, 8)) {
+ if (S_OK != Read(strm->strh, 8)) {
return E_FAIL;
}
if (m_isamv) {
@@ -223,16 +223,16 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
}
break;
case FCC('strn'):
- if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) {
+ if (S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) {
return E_FAIL;
}
break;
case FCC('strf'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
strm->strf.SetCount(size);
- if(S_OK != ByteRead(strm->strf.GetData(), size)) {
+ if (S_OK != ByteRead(strm->strf.GetData(), size)) {
return E_FAIL;
}
if (m_isamv) {
@@ -252,7 +252,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
break;
case FCC('indx'):
- if(!strm) {
+ if (!strm) {
strm.Attach(DNew strm_t());
}
ASSERT(strm->indx == NULL);
@@ -270,7 +270,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
strm->indx.Attach(pSuperIndex);
strm->indx->fcc = FCC('indx');
strm->indx->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) {
+ if (S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) {
return E_FAIL;
}
ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
@@ -278,7 +278,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
}
break;
case FCC('dmlh'):
- if(S_OK != Read(m_dmlh)) {
+ if (S_OK != Read(m_dmlh)) {
return E_FAIL;
}
break;
@@ -290,7 +290,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
m_idx1->fcc = FCC('idx1');
m_idx1->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) {
+ if (S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) {
return E_FAIL;
}
break;
@@ -309,7 +309,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
Seek(pos + size);
}
- if(strm) {
+ if (strm) {
m_strms.Add(strm);
}
@@ -320,13 +320,13 @@ REFERENCE_TIME CAviFile::GetTotalTime()
{
REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
t = max(t, t2);
}
- if(t == 0) {
+ if (t == 0) {
t = 10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames;
}
@@ -339,26 +339,26 @@ HRESULT CAviFile::BuildIndex()
DWORD nSuperIndexes = 0;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
- if(s->indx && s->indx->nEntriesInUse > 0) {
+ if (s->indx && s->indx->nEntriesInUse > 0) {
++nSuperIndexes;
}
}
- if(nSuperIndexes == m_avih.dwStreams) {
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ if (nSuperIndexes == m_avih.dwStreams) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
DWORD nEntriesInUse = 0;
- for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
+ for (DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
AVISTDINDEX stdidx;
- if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex))) {
+ if (S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex))) {
EmptyIndex();
return E_FAIL;
}
@@ -371,16 +371,16 @@ HRESULT CAviFile::BuildIndex()
DWORD frame = 0;
UINT64 size = 0;
- for(DWORD j = 0; j < idx->nEntriesInUse; ++j) {
+ for (DWORD j = 0; j < idx->nEntriesInUse; ++j) {
Seek(idx->aIndex[j].qwOffset);
CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
- if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize) || p->qwBaseOffset >= GetLength()) {
+ if (!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize) || p->qwBaseOffset >= GetLength()) {
EmptyIndex();
return E_FAIL;
}
- for(DWORD k = 0; k < p->nEntriesInUse; ++k) {
+ for (DWORD k = 0; k < p->nEntriesInUse; ++k) {
s->cs[frame].size = size;
s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
@@ -388,7 +388,7 @@ HRESULT CAviFile::BuildIndex()
s->cs[frame].fChunkHdr = false;
s->cs[frame].orgsize = p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK;
- if(m_idx1) {
+ if (m_idx1) {
s->cs[frame].filepos -= 8;
s->cs[frame].fChunkHdr = true;
}
@@ -400,29 +400,29 @@ HRESULT CAviFile::BuildIndex()
s->totalsize = size;
}
- } else if(AVIOLDINDEX* idx = m_idx1) {
+ } else if (AVIOLDINDEX* idx = m_idx1) {
DWORD len = idx->cb / sizeof(idx->aIndex[0]);
UINT64 offset = m_movis.GetHead() + 8;
//detect absolute chunk addressing (TODO: read AVI specification and make it better)
- if(idx->aIndex[0].dwOffset > offset) {
+ if (idx->aIndex[0].dwOffset > offset) {
DWORD id;
Seek(offset + idx->aIndex[0].dwOffset);
Read(id);
- if(id != idx->aIndex[0].dwChunkId) {
+ if (id != idx->aIndex[0].dwChunkId) {
TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
offset = 0;
}
}
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
// calculate the number of frames and set index size before using it
DWORD nFrames = 0;
- for(DWORD j = 0; j < len; ++j) {
- if(TRACKNUM(idx->aIndex[j].dwChunkId) == i) {
+ for (DWORD j = 0; j < len; ++j) {
+ if (TRACKNUM(idx->aIndex[j].dwChunkId) == i) {
++nFrames;
}
}
@@ -431,10 +431,10 @@ HRESULT CAviFile::BuildIndex()
//read index
DWORD frame = 0;
UINT64 size = 0;
- for(DWORD j = 0; j < len; ++j) {
+ for (DWORD j = 0; j < len; ++j) {
DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
- if(TrackNumber == i) {
+ if (TrackNumber == i) {
s->cs[frame].size = size;
s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags&AVIIF_KEYFRAME)
@@ -453,7 +453,7 @@ HRESULT CAviFile::BuildIndex()
}
m_idx1.Free();
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->indx.Free();
}
@@ -462,7 +462,7 @@ HRESULT CAviFile::BuildIndex()
void CAviFile::EmptyIndex()
{
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
strm_t* s = m_strms[i];
s->cs.RemoveAll();
s->totalsize = 0;
@@ -471,14 +471,14 @@ void CAviFile::EmptyIndex()
bool CAviFile::IsInterleaved(bool fKeepInfo)
{
- if(m_strms.GetCount() < 2) {
+ if (m_strms.GetCount() < 2) {
return true;
}
/*
if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
return true;
*/
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
}
@@ -490,23 +490,23 @@ bool CAviFile::IsInterleaved(bool fKeepInfo)
int end = 0;
- while(1) {
+ while (1) {
UINT64 fpmin = _I64_MAX;
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
- if(curchunk >= cs.GetCount()) {
+ if (curchunk >= cs.GetCount()) {
continue;
}
UINT64 fp = cs[curchunk].filepos;
- if(fp < fpmin) {
+ if (fp < fpmin) {
fpmin = fp;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
@@ -514,7 +514,7 @@ bool CAviFile::IsInterleaved(bool fKeepInfo)
DWORD& curchunk = curchunks[n];
UINT64& cursize = cursizes[n];
- if(!s->IsRawSubtitleStream()) {
+ if (!s->IsRawSubtitleStream()) {
strm_t::chunk2& cs2 = s->cs2[curchunk];
cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)>>13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
//cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)/10000);
@@ -531,28 +531,28 @@ bool CAviFile::IsInterleaved(bool fKeepInfo)
bool fInterleaved = true;
- while(fInterleaved) {
+ while (fInterleaved) {
strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
- if(curchunk >= m_strms[i]->cs2.GetCount()) {
+ if (curchunk >= m_strms[i]->cs2.GetCount()) {
continue;
}
strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t) {
+ if (cs2.t < cs2min.t) {
cs2min = cs2;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
++curchunks[n];
- if(cs2last.t != (DWORD)-1 && abs((int)cs2min.n - (int)cs2last.n) >= 1000) {
+ if (cs2last.t != (DWORD)-1 && abs((int)cs2min.n - (int)cs2last.n) >= 1000) {
fInterleaved = false;
}
@@ -562,9 +562,9 @@ bool CAviFile::IsInterleaved(bool fKeepInfo)
delete [] curchunks;
delete [] cursizes;
- if(fInterleaved && !fKeepInfo) {
+ if (fInterleaved && !fKeepInfo) {
// this is not needed anymore, let's save a little memory then
- for(DWORD i = 0; i < m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < m_avih.dwStreams; ++i) {
m_strms[i]->cs2.RemoveAll();
}
}
@@ -577,7 +577,7 @@ REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
if (frame == 0 || strh.dwRate == 0) {
return 0;
}
- if(strh.fccType == FCC('auds')) {
+ if (strh.fccType == FCC('auds')) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
if (wfe->nBlockAlign == 0) {
return 0;
@@ -589,22 +589,22 @@ REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
return (REFERENCE_TIME)ceil(10000000.0 * frame * strh.dwScale / strh.dwRate);
// need calculate in double, because the (10000000ui64 * frame * strh.dwScale) can give overflow (verified in practice)
// "ceil" is necessary to compensate for framenumber->reftime->framenumber conversion
-}
+}
DWORD CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
{
DWORD frame;
if (strh.dwScale == 0 || rt <= 0 || cs.GetCount() == 0) {
- frame = 0;
- } else if (strh.fccType == FCC('auds')) {
+ frame = 0;
+ } else if (strh.fccType == FCC('auds')) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
UINT64 size = (UINT64)(double(rt) * wfe->nBlockAlign * strh.dwRate / (strh.dwScale * 10000000.0));
// need calculate in double, because the (rt * wfe->nBlockAlign * strh.dwRate) can give overflow
frame = 1;
- for(; frame < cs.GetCount(); ++frame) {
- if(cs[frame].size > size) {
+ for (; frame < cs.GetCount(); ++frame) {
+ if (cs[frame].size > size) {
break;
}
}
@@ -623,8 +623,8 @@ DWORD CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
DWORD CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
{
DWORD i = GetFrame(rt);
- for(; i > 0; i--) {
- if(cs[i].fKeyFrame) {
+ for (; i > 0; i--) {
+ if (cs[i].fKeyFrame) {
break;
}
}
@@ -633,7 +633,7 @@ DWORD CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
DWORD CAviFile::strm_t::GetChunkSize(DWORD size)
{
- if(strh.fccType == FCC('auds')) {
+ if (strh.fccType == FCC('auds')) {
WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
size = nBlockAlign ? (size + (nBlockAlign-1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
}
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp
index d7d8a3a16..9802ff28e 100644
--- a/src/filters/parser/AviSplitter/AviReportWnd.cpp
+++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp
@@ -15,9 +15,9 @@ bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningT
m_nChunks = 0;
m_rtDur = 0;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
unsigned int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt == 0) {
+ if (cnt == 0) {
continue;
}
CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
@@ -77,7 +77,7 @@ bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningT
//
- if(!fShowWarningText) {
+ if (!fShowWarningText) {
m_message.ShowWindow(SW_HIDE);
m_checkbox.ShowWindow(SW_HIDE);
r = cr;
@@ -122,7 +122,7 @@ void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p)
r.bottom -= GRAPHFOOTER;
r2.top = r.bottom;
- if(r.PtInRect(p)) {
+ if (r.PtInRect(p)) {
SetCapture();
int x = p.x - r.left;
@@ -143,18 +143,18 @@ void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p)
CString str;
str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
SetWindowText(str);
- } else if(r2.PtInRect(p)) {
+ } else if (r2.PtInRect(p)) {
SetCapture();
int dist = m_graph.GetChunkDist(p.x - r2.left);
CString str;
str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
- if(dist >= 1000) {
+ if (dist >= 1000) {
str += _T(" - over the limit!");
}
str += ")";
SetWindowText(str);
- } else if(GetCapture() == this) {
+ } else if (GetCapture() == this) {
SetWindowText(TITLE);
ReleaseCapture();
@@ -171,7 +171,7 @@ CAviPlotterWnd::CAviPlotterWnd()
bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
{
- if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0)) {
+ if (!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0)) {
return false;
}
@@ -191,15 +191,15 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
{
CPen pen(PS_DOT, 1, 0x008000);
CPen* pOldPen = m_dc.SelectObject(&pen);
- for(int y = 0, dy = max(h/10,1); y < h; y += dy) {
- if(y == 0) {
+ for (int y = 0, dy = max(h/10,1); y < h; y += dy) {
+ if (y == 0) {
continue;
}
m_dc.MoveTo(0, y);
m_dc.LineTo(w, y);
}
- for(int x = 0, dx = max(w/10,1); x < w; x += dx) {
- if(x == 0) {
+ for (int x = 0, dx = max(w/10,1); x < w; x += dx) {
+ if (x == 0) {
continue;
}
m_dc.MoveTo(x, 0);
@@ -232,7 +232,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
- for(DWORD i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < pAF->m_avih.dwStreams; ++i, y += dy) {
+ for (DWORD i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < pAF->m_avih.dwStreams; ++i, y += dy) {
m_dc.SetTextColor(clr[i % pAF->m_avih.dwStreams]);
m_dc.SetBkMode(TRANSPARENT);
CString str;
@@ -242,9 +242,9 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
DWORD nmax = 0, tmax = 0;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
unsigned int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt == 0) {
+ if (cnt == 0) {
continue;
}
CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
@@ -252,16 +252,16 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
tmax = max(tmax, c2.t);
}
- if(nmax > 0 && tmax > 0) {
+ if (nmax > 0 && tmax > 0) {
CAtlArray<CPen> pen;
pen.SetCount(pAF->m_avih.dwStreams);
- for(size_t i = 0; i < pen.GetCount(); ++i) {
+ for (size_t i = 0; i < pen.GetCount(); ++i) {
pen[i].CreatePen(PS_SOLID, 2, clr[i]);
}
CAtlArray<CPoint> pp;
pp.SetCount(pAF->m_avih.dwStreams);
- for(size_t i = 0; i < pen.GetCount(); ++i) {
+ for (size_t i = 0; i < pen.GetCount(); ++i) {
pp[i].SetPoint(-1, -1);
}
@@ -273,22 +273,22 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
CAviFile::strm_t::chunk2 cs2last = {(DWORD)-1, 0};
- while(1) {
+ while (1) {
CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
DWORD n = (DWORD)-1;
- for(DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
+ for (DWORD i = 0; i < pAF->m_avih.dwStreams; ++i) {
DWORD curchunk = curchunks[i];
- if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) {
+ if (curchunk >= pAF->m_strms[i]->cs2.GetCount()) {
continue;
}
CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t) {
+ if (cs2.t < cs2min.t) {
cs2min = cs2;
n = i;
}
}
- if(n == -1) {
+ if (n == -1) {
break;
}
@@ -296,9 +296,9 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
CPoint p;
p.x = (int)(1.0 * w * cs2min.t / tmax);
p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
- if(pp[n] != p) {
+ if (pp[n] != p) {
CPen* pOldPen = m_dc.SelectObject(&pen[n]);
- if(pp[n] == CPoint(-1, -1)) {
+ if (pp[n] == CPoint(-1, -1)) {
m_dc.MoveTo(p);
} else {
m_dc.MoveTo(pp[n]);
@@ -310,8 +310,8 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
int dist = abs((int)cs2min.n - (int)cs2last.n);
- if(cs2last.t != (DWORD)-1 /*&& dist >= 1000*/) {
- if(p.x >= 0 && p.x < w) {
+ if (cs2last.t != (DWORD)-1 /*&& dist >= 1000*/) {
+ if (p.x >= 0 && p.x < w) {
m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
}
}
@@ -323,7 +323,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
CPen red(PS_SOLID, 1, 0x0000ff);
CPen green(PS_SOLID, 1, 0x00ff00);
- for(int x = 0; x < w; ++x) {
+ for (int x = 0; x < w; ++x) {
CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
m_dc.MoveTo(x, h);
m_dc.LineTo(x, h + GRAPHFOOTER);
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp
index 7022434cd..517a02e5d 100644
--- a/src/filters/parser/AviSplitter/AviSplitter.cpp
+++ b/src/filters/parser/AviSplitter/AviSplitter.cpp
@@ -80,7 +80,7 @@ public:
CAviSplitterApp() {}
BOOL InitInstance() {
- if(!__super::InitInstance()) {
+ if (!__super::InitInstance()) {
return FALSE;
}
DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
@@ -137,7 +137,7 @@ STDMETHODIMP CAviSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, AviSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -154,20 +154,20 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_tFrame.Free();
m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
- if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown)) {
+ if (SUCCEEDED(hr) && (fShowWarningText || fShiftDown)) {
#ifdef REGISTER_FILTER
AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
- if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown) {
+ if (!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown) {
CAviReportWnd wnd;
fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
@@ -179,7 +179,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
*/
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -189,15 +189,15 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bool fHasIndex = false;
- for(unsigned int i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); ++i)
- if(m_pFile->m_strms[i]->cs.GetCount() > 0) {
+ for (unsigned int i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); ++i)
+ if (m_pFile->m_strms[i]->cs.GetCount() > 0) {
fHasIndex = true;
}
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(fHasIndex && s->cs.GetCount() == 0) {
+ if (fHasIndex && s->cs.GetCount() == 0) {
continue;
}
@@ -206,7 +206,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CStringW name, label;
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
label = L"Video";
ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
@@ -214,7 +214,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
mt.majortype = MEDIATYPE_Video;
- switch(pbmi->biCompression) {
+ switch (pbmi->biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -239,13 +239,13 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
memset(mt.Format(), 0, mt.FormatLength());
memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
- if(s->strh.dwRate > 0) {
+ if (s->strh.dwRate > 0) {
pvih->AvgTimePerFrame = 10000000ui64 * s->strh.dwScale / s->strh.dwRate;
}
- if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0) {
+ if (s->cs.GetCount() && pvih->AvgTimePerFrame > 0) {
UINT64 size = 0;
- for(unsigned int i = 0; i < s->cs.GetCount(); ++i) {
+ for (unsigned int i = 0; i < s->cs.GetCount(); ++i) {
size += s->cs[i].orgsize;
}
pvih->dwBitRate = (DWORD)(10000000.0 * size * 8 / (s->cs.GetCount() * pvih->AvgTimePerFrame) + 0.5);
@@ -256,7 +256,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
? s->strh.dwSuggestedBufferSize*3/2
: (pvih->bmiHeader.biWidth*pvih->bmiHeader.biHeight*4));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva')) {
+ } else if (s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva')) {
label = L"Audio";
ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
@@ -264,7 +264,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)s->strf.GetData();
- if(pwfe->nBlockAlign == 0) {
+ if (pwfe->nBlockAlign == 0) {
continue;
}
@@ -277,20 +277,20 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mt.formattype = FORMAT_WaveFormatEx;
mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
pwfe = (WAVEFORMATEX*)mt.Format();
- if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) {
+ if (s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) {
pwfe->cbSize = 0;
}
- if(pwfe->wFormatTag == WAVE_FORMAT_PCM) {
+ if (pwfe->wFormatTag == WAVE_FORMAT_PCM) {
pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
}
- if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
+ if (pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
}
mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
? s->strh.dwSuggestedBufferSize*3/2
: (pwfe->nChannels*pwfe->nSamplesPerSec*32>>3));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('mids')) {
+ } else if (s->strh.fccType == FCC('mids')) {
label = L"Midi";
mt.majortype = MEDIATYPE_Midi;
@@ -300,7 +300,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
? s->strh.dwSuggestedBufferSize*3/2
: (1024*1024));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('txts')) {
+ } else if (s->strh.fccType == FCC('txts')) {
label = L"Text";
mt.majortype = MEDIATYPE_Text;
@@ -310,7 +310,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
? s->strh.dwSuggestedBufferSize*3/2
: (1024*1024));
mts.Add(mt);
- } else if(s->strh.fccType == FCC('iavs')) {
+ } else if (s->strh.fccType == FCC('iavs')) {
label = L"Interleaved";
ASSERT(s->strh.fccHandler == FCC('dvsd'));
@@ -325,7 +325,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.Add(mt);
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
continue;
}
@@ -333,7 +333,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
//Put filename at front sometime(eg. ~temp.avi) will cause filter graph
//stop check this pin. Not sure the reason exactly. but it happens.
//If you know why, please emailto: tomasen@gmail.com
- if(s->strn.IsEmpty()) {
+ if (s->strn.IsEmpty()) {
name.Format(L"%s %u", label, i);
} else {
name.Format(L"%s (%s %u)", CStringW(s->strn), label, i);
@@ -346,12 +346,12 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
POSITION pos = m_pFile->m_info.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD fcc;
CStringA value;
m_pFile->m_info.GetNextAssoc(pos, fcc, value);
- switch(fcc) {
+ switch (fcc) {
case FCC('INAM'):
SetProperty(L"TITL", CStringW(value));
break;
@@ -376,7 +376,7 @@ bool CAviSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CAviSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -384,13 +384,13 @@ bool CAviSplitterFilter::DemuxInit()
bool fReIndex = false;
- for(DWORD i = 0; i < m_pFile->m_avih.dwStreams && !fReIndex; ++i) {
- if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i)) {
+ for (DWORD i = 0; i < m_pFile->m_avih.dwStreams && !fReIndex; ++i) {
+ if (m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i)) {
fReIndex = true;
}
}
- if(fReIndex) {
+ if (fReIndex) {
m_pFile->EmptyIndex();
m_fAbort = false;
@@ -404,7 +404,7 @@ bool CAviSplitterFilter::DemuxInit()
m_pFile->Seek(0);
ReIndex(m_pFile->GetLength(), pSize);
- if(m_fAbort) {
+ if (m_fAbort) {
m_pFile->EmptyIndex();
}
@@ -419,37 +419,37 @@ HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize)
{
HRESULT hr = S_OK;
- while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort) {
+ while (S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort) {
__int64 pos = m_pFile->GetPos();
DWORD id = 0, size;
- if(S_OK != m_pFile->Read(id) || id == 0) {
+ if (S_OK != m_pFile->Read(id) || id == 0) {
return E_FAIL;
}
- if(id == FCC('RIFF') || id == FCC('LIST')) {
- if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id)) {
+ if (id == FCC('RIFF') || id == FCC('LIST')) {
+ if (S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id)) {
return E_FAIL;
}
size += (size&1) + 8;
- if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec ')) {
+ if (id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec ')) {
hr = ReIndex(pos + size, pSize);
}
} else {
- if(S_OK != m_pFile->Read(size)) {
+ if (S_OK != m_pFile->Read(size)) {
return E_FAIL;
}
DWORD TrackNumber = TRACKNUM(id);
- if(TrackNumber < m_pFile->m_strms.GetCount()) {
+ if (TrackNumber < m_pFile->m_strms.GetCount()) {
CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
WORD type = TRACKTYPE(id);
- if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
+ if (type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
|| type == 'iv' || type == '__' || type == 'xx') {
CAviFile::strm_t::chunk c;
c.filepos = pos;
@@ -474,8 +474,8 @@ HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize)
m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
@@ -493,26 +493,26 @@ void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt/10000));
- if(rt > 0) {
+ if (rt > 0) {
UINT64 minfp = _I64_MAX;
- for(unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
+ for (unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
DWORD f = s->GetKeyFrame(rt);
UINT64 fp = s->cs[f].filepos;
- if(!s->IsRawSubtitleStream()) {
+ if (!s->IsRawSubtitleStream()) {
minfp = min(minfp, fp);
}
}
- for(unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
+ for (unsigned int j = 0; j < m_pFile->m_strms.GetCount(); ++j) {
CAviFile::strm_t* s = m_pFile->m_strms[j];
- for(unsigned int i = 0; i < s->cs.GetCount(); ++i) {
+ for (unsigned int i = 0; i < s->cs.GetCount(); ++i) {
CAviFile::strm_t::chunk& c = s->cs[i];
- if(c.filepos >= minfp) {
+ if (c.filepos >= minfp) {
m_tFrame[j] = i;
break;
}
@@ -532,31 +532,31 @@ bool CAviSplitterFilter::DemuxLoop()
fDiscontinuity.SetCount(nTracks);
memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
unsigned int minTrack = nTracks;
UINT64 minFilePos = _I64_MAX;
- for(unsigned int i = 0; i < nTracks; ++i) {
+ for (unsigned int i = 0; i < nTracks; ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
DWORD f = m_tFrame[i];
- if(f >= (DWORD)s->cs.GetCount()) {
+ if (f >= (DWORD)s->cs.GetCount()) {
continue;
}
bool fUrgent = s->IsRawSubtitleStream();
- if(fUrgent || s->cs[f].filepos < minFilePos) {
+ if (fUrgent || s->cs[f].filepos < minFilePos) {
minTrack = i;
minFilePos = s->cs[f].filepos;
}
- if(fUrgent) {
+ if (fUrgent) {
break;
}
}
- if(minTrack == nTracks) {
+ if (minTrack == nTracks) {
break;
}
@@ -569,9 +569,9 @@ bool CAviSplitterFilter::DemuxLoop()
DWORD size = 0;
- if(s->cs[f].fChunkHdr) {
+ if (s->cs[f].fChunkHdr) {
DWORD id = 0;
- if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
+ if (S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
|| S_OK != m_pFile->Read(size)) {
fDiscontinuity[minTrack] = true;
break;
@@ -582,7 +582,7 @@ bool CAviSplitterFilter::DemuxLoop()
? s->cs[f+1].size - s->cs[f].size
: s->totalsize - s->cs[f].size;
- if(expectedsize != s->GetChunkSize(size)) {
+ if (expectedsize != s->GetChunkSize(size)) {
fDiscontinuity[minTrack] = true;
//ASSERT(0);
break;
@@ -600,7 +600,7 @@ bool CAviSplitterFilter::DemuxLoop()
p->rtStop = s->GetRefTime(f+1, f+1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
p->SetCount(size);
- if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount()))) {
+ if (S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount()))) {
return true; // break;
}
/*
@@ -613,7 +613,7 @@ bool CAviSplitterFilter::DemuxLoop()
hr = DeliverPacket(p);
fDiscontinuity[minTrack] = false;
- } while(0);
+ } while (0);
++f;
}
@@ -628,10 +628,10 @@ STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration)
CheckPointer(pDuration, E_POINTER);
CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
- if(m_timeformat == TIME_FORMAT_FRAME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ if (m_timeformat == TIME_FORMAT_FRAME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
*pDuration = s->cs.GetCount();
return S_OK;
}
@@ -649,7 +649,7 @@ STDMETHODIMP CAviSplitterFilter::IsFormatSupported(const GUID* pFormat)
{
CheckPointer(pFormat, E_POINTER);
HRESULT hr = __super::IsFormatSupported(pFormat);
- if(S_OK == hr) {
+ if (S_OK == hr) {
return hr;
}
return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
@@ -671,7 +671,7 @@ STDMETHODIMP CAviSplitterFilter::IsUsingTimeFormat(const GUID* pFormat)
STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
{
CheckPointer(pFormat, E_POINTER);
- if(S_OK != IsFormatSupported(pFormat)) {
+ if (S_OK != IsFormatSupported(pFormat)) {
return E_FAIL;
}
m_timeformat = *pFormat;
@@ -681,14 +681,14 @@ STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
STDMETHODIMP CAviSplitterFilter::GetStopPosition(LONGLONG* pStop)
{
CheckPointer(pStop, E_POINTER);
- if(FAILED(__super::GetStopPosition(pStop))) {
+ if (FAILED(__super::GetStopPosition(pStop))) {
return E_FAIL;
}
- if(m_timeformat == TIME_FORMAT_MEDIA_TIME) {
+ if (m_timeformat == TIME_FORMAT_MEDIA_TIME) {
return S_OK;
}
LONGLONG rt = *pStop;
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) {
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
return S_OK;
@@ -701,22 +701,22 @@ STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID
const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
- if(TargetFormat == SourceFormat) {
+ if (TargetFormat == SourceFormat) {
*pTarget = Source;
return S_OK;
- } else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ } else if (TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
+ if (s->strh.fccType == FCC('vids')) {
*pTarget = s->GetFrame(Source);
return S_OK;
}
}
- } else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME) {
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ } else if (TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids')) {
- if(Source < 0 || Source >= s->cs.GetCount()) {
+ if (s->strh.fccType == FCC('vids')) {
+ if (Source < 0 || Source >= s->cs.GetCount()) {
return E_FAIL;
}
CAviFile::strm_t::chunk& c = s->cs[(size_t)Source];
@@ -732,16 +732,16 @@ STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID
STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
HRESULT hr;
- if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME) {
+ if (FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME) {
return hr;
}
- if(pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) {
+ if (pCurrent)
+ if (FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if(pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) {
+ if (pStop)
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
@@ -750,11 +750,11 @@ STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pSto
HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- if(m_timeformat != TIME_FORMAT_FRAME) {
+ if (m_timeformat != TIME_FORMAT_FRAME) {
return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
- if(!pCurrent && !pStop
+ if (!pCurrent && !pStop
|| (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
&& (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) {
return S_OK;
@@ -764,17 +764,17 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D
rtCurrent = m_rtCurrent,
rtStop = m_rtStop;
- if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
&& FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwStopFlags&AM_SEEKING_PositioningBitsMask)
&& FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME))) {
return E_FAIL;
}
- if(pCurrent)
- switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pCurrent)
+ switch (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -788,8 +788,8 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D
break;
}
- if(pStop)
- switch(dwStopFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pStop)
+ switch (dwStopFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -803,14 +803,14 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D
break;
}
- if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
&& pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) {
+ if (FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) {
return E_FAIL;
}
- if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ if ((dwStopFlags&AM_SEEKING_PositioningBitsMask)
&& pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) {
+ if (FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) {
return E_FAIL;
}
@@ -821,7 +821,7 @@ HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, D
STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
@@ -829,20 +829,20 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
nKFs = 0;
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) {
+ if (s->strh.fccType != FCC('vids')) {
continue;
}
- for(unsigned int j = 0; j < s->cs.GetCount(); ++j) {
+ for (unsigned int j = 0; j < s->cs.GetCount(); ++j) {
CAviFile::strm_t::chunk& c = s->cs[j];
- if(c.fKeyFrame) {
+ if (c.fKeyFrame) {
++nKFs;
}
}
- if(nKFs == s->cs.GetCount()) {
+ if (nKFs == s->cs.GetCount()) {
hr = S_FALSE;
}
@@ -857,25 +857,25 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
- for(unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
+ for (unsigned int i = 0; i < m_pFile->m_strms.GetCount(); ++i) {
CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) {
+ if (s->strh.fccType != FCC('vids')) {
continue;
}
bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
- for(unsigned int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; ++j) {
- if(s->cs[j].fKeyFrame) {
+ for (unsigned int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; ++j) {
+ if (s->cs[j].fKeyFrame) {
pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
}
}
@@ -912,13 +912,13 @@ HRESULT CAviSplitterOutputPin::CheckConnect(IPin* pPin)
{
int iPosition = 0;
CMediaType mt;
- while(S_OK == GetMediaType(iPosition++, &mt)) {
- if(mt.majortype == MEDIATYPE_Video
+ while (S_OK == GetMediaType(iPosition++, &mt)) {
+ if (mt.majortype == MEDIATYPE_Video
&& (mt.subtype == FOURCCMap(FCC('IV32'))
|| mt.subtype == FOURCCMap(FCC('IV31'))
|| mt.subtype == FOURCCMap(FCC('IF09')))) {
CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
- if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer) {
+ if (clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer) {
return E_FAIL;
}
}
diff --git a/src/filters/parser/BaseSplitter/AsyncReader.cpp b/src/filters/parser/BaseSplitter/AsyncReader.cpp
index c0217ae4d..42be1f26c 100644
--- a/src/filters/parser/BaseSplitter/AsyncReader.cpp
+++ b/src/filters/parser/BaseSplitter/AsyncReader.cpp
@@ -37,7 +37,7 @@ CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr)
, m_lOsError(0)
{
hr = Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_len = GetLength();
}
}
@@ -49,7 +49,7 @@ CAsyncFileReader::CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items,
, m_lOsError(0)
{
hr = OpenFiles(Items, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_len = GetLength();
}
}
@@ -71,44 +71,44 @@ STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE*
{
do {
try {
- if((ULONGLONG)llPosition+lLength > GetLength()) {
+ if ((ULONGLONG)llPosition+lLength > GetLength()) {
return E_FAIL; // strange, but the Seek below can return llPosition even if the file is not that big (?)
}
- if((ULONGLONG)llPosition != Seek(llPosition, begin)) {
+ if ((ULONGLONG)llPosition != Seek(llPosition, begin)) {
return E_FAIL;
}
- if((UINT)lLength < Read(pBuffer, lLength)) {
+ if ((UINT)lLength < Read(pBuffer, lLength)) {
return E_FAIL;
}
#if 0 // def DEBUG
static __int64 s_total = 0, s_laststoppos = 0;
s_total += lLength;
- if(s_laststoppos > llPosition) {
+ if (s_laststoppos > llPosition) {
TRACE(_T("[%I64d - %I64d] %d (%I64d)\n"), llPosition, llPosition + lLength, lLength, s_total);
}
s_laststoppos = llPosition + lLength;
#endif
return S_OK;
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
m_lOsError = e->m_lOsError;
e->Delete();
Sleep(1);
CString fn = m_strFileName;
try {
Close();
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
e->Delete();
}
try {
Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan);
- } catch(CFileException* e) {
+ } catch (CFileException* e) {
e->Delete();
}
m_strFileName = fn;
}
- } while(m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
+ } while (m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
return E_FAIL;
}
@@ -116,10 +116,10 @@ STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE*
STDMETHODIMP CAsyncFileReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
LONGLONG len = m_len >= 0 ? m_len : GetLength();
- if(pTotal) {
+ if (pTotal) {
*pTotal = len;
}
- if(pAvailable) {
+ if (pAvailable) {
*pAvailable = len;
}
return S_OK;
@@ -144,13 +144,13 @@ STDMETHODIMP_(LPCTSTR) CAsyncFileReader::GetFileName()
CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
: CAsyncFileReader(url, hr)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
return;
}
m_url = url;
- if(CAMThread::Create()) {
+ if (CAMThread::Create()) {
CallWorker(CMD_INIT);
}
@@ -160,11 +160,11 @@ CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
CAsyncUrlReader::~CAsyncUrlReader()
{
- if(ThreadExists()) {
+ if (ThreadExists()) {
CallWorker(CMD_EXIT);
}
- if(!m_fn.IsEmpty()) {
+ if (!m_fn.IsEmpty()) {
CMultiFiles::Close();
DeleteFile(m_fn);
}
@@ -174,7 +174,7 @@ CAsyncUrlReader::~CAsyncUrlReader()
STDMETHODIMP CAsyncUrlReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
- if(pTotal) {
+ if (pTotal) {
*pTotal = 0;
}
return __super::Length(NULL, pAvailable);
@@ -187,7 +187,7 @@ DWORD CAsyncUrlReader::ThreadProc()
AfxSocketInit(NULL);
DWORD cmd = GetRequest();
- if(cmd != CMD_INIT) {
+ if (cmd != CMD_INIT) {
Reply((DWORD)E_FAIL);
return (DWORD)-1;
}
@@ -198,21 +198,21 @@ DWORD CAsyncUrlReader::ThreadProc()
TCHAR path[_MAX_PATH], fn[_MAX_PATH];
CFile fout;
- if(GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
+ if (GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
&& fout.Open(fn, modeCreate|modeWrite|shareDenyWrite|typeBinary)) {
m_fn = fn;
char buff[1024];
int len = fin->Read(buff, sizeof(buff));
- if(len > 0) {
+ if (len > 0) {
fout.Write(buff, len);
}
Reply(S_OK);
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
int len = fin->Read(buff, sizeof(buff));
- if(len > 0) {
+ if (len > 0) {
fout.Write(buff, len);
}
}
@@ -221,7 +221,7 @@ DWORD CAsyncUrlReader::ThreadProc()
}
fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
- } catch(CInternetException* ie) {
+ } catch (CInternetException* ie) {
ie->Delete();
Reply((DWORD)E_FAIL);
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.cpp b/src/filters/parser/BaseSplitter/BaseSplitter.cpp
index 589dd2d2f..6c621ff2d 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitter.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitter.cpp
@@ -44,10 +44,10 @@ void CPacketQueue::Add(CAutoPtr<Packet> p)
{
CAutoLock cAutoLock(this);
- if(p) {
+ if (p) {
m_size += p->GetDataSize();
- if(p->bAppendable && !p->bDiscontinuity && !p->pmt
+ if (p->bAppendable && !p->bDiscontinuity && !p->pmt
&& p->rtStart == Packet::INVALID_TIME
&& !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME) {
Packet* tail = GetTail();
@@ -70,7 +70,7 @@ CAutoPtr<Packet> CPacketQueue::Remove()
CAutoLock cAutoLock(this);
ASSERT(__super::GetCount() > 0);
CAutoPtr<Packet> p = RemoveHead();
- if(p) {
+ if (p) {
m_size -= p->GetDataSize();
}
return p;
@@ -138,7 +138,7 @@ HRESULT CBaseSplitterInputPin::CheckMediaType(const CMediaType* pmt)
HRESULT CBaseSplitterInputPin::CheckConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
@@ -149,11 +149,11 @@ HRESULT CBaseSplitterInputPin::BreakConnect()
{
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this))) {
+ if (FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this))) {
return hr;
}
@@ -166,7 +166,7 @@ HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
@@ -174,7 +174,7 @@ HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin)
m_pAsyncReader = pPin;
CheckPointer(m_pAsyncReader, E_NOINTERFACE);
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this))) {
+ if (FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this))) {
return hr;
}
@@ -239,7 +239,7 @@ STDMETHODIMP CBaseSplitterOutputPin::NonDelegatingQueryInterface(REFIID riid, vo
HRESULT CBaseSplitterOutputPin::SetName(LPCWSTR pName)
{
CheckPointer(pName, E_POINTER);
- if(m_pName) {
+ if (m_pName) {
delete [] m_pName;
}
m_pName = DNew WCHAR[wcslen(pName)+1];
@@ -259,17 +259,17 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO
pProperties->cbBuffer = max(m_mt.lSampleSize, 1);
// TODO: is this still needed ?
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat) {
+ if (m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat) {
// oh great, the oggds vorbis decoder assumes there will be two at least, stupid thing...
pProperties->cBuffers = max(pProperties->cBuffers, 2);
}
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -279,8 +279,8 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO
HRESULT CBaseSplitterOutputPin::CheckMediaType(const CMediaType* pmt)
{
- for(size_t i = 0; i < m_mts.GetCount(); i++) {
- if(*pmt == m_mts[i]) {
+ for (size_t i = 0; i < m_mts.GetCount(); i++) {
+ if (*pmt == m_mts[i]) {
return S_OK;
}
}
@@ -292,10 +292,10 @@ HRESULT CBaseSplitterOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if((size_t)iPosition >= m_mts.GetCount()) {
+ if ((size_t)iPosition >= m_mts.GetCount()) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -315,7 +315,7 @@ HRESULT CBaseSplitterOutputPin::Active()
{
CAutoLock cAutoLock(m_pLock);
- if(m_Connected) {
+ if (m_Connected) {
Create();
}
@@ -326,7 +326,7 @@ HRESULT CBaseSplitterOutputPin::Inactive()
{
CAutoLock cAutoLock(m_pLock);
- if(ThreadExists()) {
+ if (ThreadExists()) {
CallWorker(CMD_EXIT);
}
@@ -341,7 +341,7 @@ HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
m_hrDeliver = S_FALSE;
m_queue.RemoveAll();
HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
- if(S_OK != hr) {
+ if (S_OK != hr) {
m_eEndFlush.Set();
}
return(hr);
@@ -349,7 +349,7 @@ HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
{
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
@@ -363,15 +363,15 @@ HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
- if(m_fFlushing) {
+ if (m_fFlushing) {
return S_FALSE;
}
m_rtStart = tStart;
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
MakeISCRHappy();
@@ -395,17 +395,17 @@ HRESULT CBaseSplitterOutputPin::QueueEndOfStream()
HRESULT CBaseSplitterOutputPin::QueuePacket(CAutoPtr<Packet> p)
{
- if(!ThreadExists()) {
+ if (!ThreadExists()) {
return S_FALSE;
}
- while(S_OK == m_hrDeliver
+ while (S_OK == m_hrDeliver
&& (!(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()
|| m_queue.GetSize() > MAXPACKETSIZE*100)) {
Sleep(1);
}
- if(S_OK != m_hrDeliver) {
+ if (S_OK != m_hrDeliver) {
return m_hrDeliver;
}
@@ -430,11 +430,11 @@ bool CBaseSplitterOutputPin::IsActive()
do {
CComPtr<IPin> pPinTo;
CComQIPtr<IStreamSwitcherInputPin> pSSIP;
- if(S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive()) {
+ if (S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive()) {
return false;
}
pPin = GetFirstPin(GetFilterFromPin(pPinTo), PINDIR_OUTPUT);
- } while(pPin);
+ } while (pPin);
return true;
}
@@ -449,25 +449,25 @@ DWORD CBaseSplitterOutputPin::ThreadProc()
// fix for Microsoft DTV-DVD Video Decoder - video freeze after STOP/PLAY
bool iHaaliRenderConnect = false;
CComPtr<IPin> pPinTo = this, pTmp;
- while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
+ while (pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
pTmp = NULL;
CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
- if(GetCLSID(pBF) == CLSID_DXR) { // Haali Renderer
+ if (GetCLSID(pBF) == CLSID_DXR) { // Haali Renderer
iHaaliRenderConnect = true;
break;
}
pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
}
- if(IsConnected() && !iHaaliRenderConnect) {
+ if (IsConnected() && !iHaaliRenderConnect) {
GetConnected()->BeginFlush();
GetConnected()->EndFlush();
}
- while(1) {
+ while (1) {
Sleep(1);
DWORD cmd;
- if(CheckRequest(&cmd)) {
+ if (CheckRequest(&cmd)) {
m_hThread = NULL;
cmd = GetRequest();
Reply(S_OK);
@@ -481,12 +481,12 @@ DWORD CBaseSplitterOutputPin::ThreadProc()
{
CAutoLock cAutoLock(&m_queue);
- if((cnt = m_queue.GetCount()) > 0) {
+ if ((cnt = m_queue.GetCount()) > 0) {
p = m_queue.Remove();
}
}
- if(S_OK == m_hrDeliver && cnt > 0) {
+ if (S_OK == m_hrDeliver && cnt > 0) {
ASSERT(!m_fFlushing);
m_fFlushed = false;
@@ -499,13 +499,13 @@ DWORD CBaseSplitterOutputPin::ThreadProc()
m_eEndFlush.Wait(); // .. so we have to wait until it is done
- if(hr != S_OK && !m_fFlushed) { // and only report the error in m_hrDeliver if we didn't flush the stream
+ if (hr != S_OK && !m_fFlushed) { // and only report the error in m_hrDeliver if we didn't flush the stream
// CAutoLock cAutoLock(&m_csQueueLock);
m_hrDeliver = hr;
break;
}
}
- } while(--cnt > 0);
+ } while (--cnt > 0);
}
}
@@ -515,19 +515,19 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
INT_PTR nBytes = p->GetCount();
- if(nBytes == 0) {
+ if (nBytes == 0) {
return S_OK;
}
m_brs.nBytesSinceLastDeliverTime += nBytes;
- if(p->rtStart != Packet::INVALID_TIME) {
- if(m_brs.rtLastDeliverTime == Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
+ if (m_brs.rtLastDeliverTime == Packet::INVALID_TIME) {
m_brs.rtLastDeliverTime = p->rtStart;
m_brs.nBytesSinceLastDeliverTime = 0;
}
- if(m_brs.rtLastDeliverTime + 10000000 < p->rtStart) {
+ if (m_brs.rtLastDeliverTime + 10000000 < p->rtStart) {
REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
double secs, bits;
@@ -554,7 +554,7 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
double dRate = 1.0;
- if(SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate))) {
+ if (SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate))) {
p->rtStart = (REFERENCE_TIME)((double)p->rtStart / dRate);
p->rtStop = (REFERENCE_TIME)((double)p->rtStop / dRate);
}
@@ -562,43 +562,43 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
do {
CComPtr<IMediaSample> pSample;
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
+ if (S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
break;
}
- if(nBytes > pSample->GetSize()) {
+ if (nBytes > pSample->GetSize()) {
pSample.Release();
ALLOCATOR_PROPERTIES props, actual;
- if(S_OK != (hr = m_pAllocator->GetProperties(&props))) {
+ if (S_OK != (hr = m_pAllocator->GetProperties(&props))) {
break;
}
props.cbBuffer = nBytes*3/2;
- if(props.cBuffers > 1) {
- if(S_OK != (hr = __super::DeliverBeginFlush())) {
+ if (props.cBuffers > 1) {
+ if (S_OK != (hr = __super::DeliverBeginFlush())) {
break;
}
- if(S_OK != (hr = __super::DeliverEndFlush())) {
+ if (S_OK != (hr = __super::DeliverEndFlush())) {
break;
}
}
- if(S_OK != (hr = m_pAllocator->Decommit())) {
+ if (S_OK != (hr = m_pAllocator->Decommit())) {
break;
}
- if(S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) {
+ if (S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) {
break;
}
- if(S_OK != (hr = m_pAllocator->Commit())) {
+ if (S_OK != (hr = m_pAllocator->Commit())) {
break;
}
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
+ if (S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) {
break;
}
}
- if(p->pmt) {
+ if (p->pmt) {
pSample->SetMediaType(p->pmt);
p->bDiscontinuity = true;
@@ -619,32 +619,32 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
ASSERT(!p->bSyncPoint || fTimeValid);
BYTE* pData = NULL;
- if(S_OK != (hr = pSample->GetPointer(&pData)) || !pData) {
+ if (S_OK != (hr = pSample->GetPointer(&pData)) || !pData) {
break;
}
memcpy(pData, p->GetData(), nBytes);
- if(S_OK != (hr = pSample->SetActualDataLength(nBytes))) {
+ if (S_OK != (hr = pSample->SetActualDataLength(nBytes))) {
break;
}
- if(S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) {
+ if (S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) {
break;
}
- if(S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) {
+ if (S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) {
break;
}
- if(S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) {
+ if (S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) {
break;
}
- if(S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) {
+ if (S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) {
break;
}
- if(S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) {
+ if (S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) {
break;
}
- if(S_OK != (hr = Deliver(pSample))) {
+ if (S_OK != (hr = Deliver(pSample))) {
break;
}
- } while(false);
+ } while (false);
return hr;
}
@@ -652,12 +652,12 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
void CBaseSplitterOutputPin::MakeISCRHappy()
{
CComPtr<IPin> pPinTo = this, pTmp;
- while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
+ while (pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
pTmp = NULL;
CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
- if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) { // ISCR
+ if (GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) { // ISCR
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)-1;
p->rtStart = -1;
@@ -783,7 +783,7 @@ CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT*
, m_rtLastStop(_I64_MIN)
, m_priority(THREAD_PRIORITY_NORMAL)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -804,7 +804,7 @@ STDMETHODIMP CBaseSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void*
*ppv = NULL;
- if(m_pInput && riid == __uuidof(IFileSourceFilter)) {
+ if (m_pInput && riid == __uuidof(IFileSourceFilter)) {
return E_NOINTERFACE;
}
@@ -838,11 +838,11 @@ DWORD CBaseSplitterFilter::GetOutputTrackNum(CBaseSplitterOutputPin* pPin)
CAutoLock cAutoLock(&m_csPinMap);
POSITION pos = m_pPinMap.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNum;
CBaseSplitterOutputPin* pPinTmp;
m_pPinMap.GetNextAssoc(pos, TrackNum, pPinTmp);
- if(pPinTmp == pPin) {
+ if (pPinTmp == pPin) {
return TrackNum;
}
}
@@ -855,9 +855,9 @@ HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDs
CAutoLock cAutoLock(&m_csPinMap);
CBaseSplitterOutputPin* pPin;
- if(m_pPinMap.Lookup(TrackNumSrc, pPin)) {
- if(CComQIPtr<IPin> pPinTo = pPin->GetConnected()) {
- if(pmt && S_OK != pPinTo->QueryAccept(pmt)) {
+ if (m_pPinMap.Lookup(TrackNumSrc, pPin)) {
+ if (CComQIPtr<IPin> pPinTo = pPin->GetConnected()) {
+ if (pmt && S_OK != pPinTo->QueryAccept(pmt)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -865,7 +865,7 @@ HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDs
m_pPinMap.RemoveKey(TrackNumSrc);
m_pPinMap[TrackNumDst] = pPin;
- if(pmt) {
+ if (pmt) {
CAutoLock cAutoLock(&m_csmtnew);
m_mtnew[TrackNumDst] = *pmt;
}
@@ -880,7 +880,7 @@ HRESULT CBaseSplitterFilter::AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitter
{
CAutoLock cAutoLock(&m_csPinMap);
- if(!pPin) {
+ if (!pPin) {
return E_INVALIDARG;
}
m_pPinMap[TrackNum] = pPin;
@@ -895,13 +895,13 @@ HRESULT CBaseSplitterFilter::DeleteOutputs()
m_pRetiredOutputs.RemoveAll();
CAutoLock cAutoLockF(this);
- if(m_State != State_Stopped) {
+ if (m_State != State_Stopped) {
return VFW_E_NOT_STOPPED;
}
- while(m_pOutputs.GetCount()) {
+ while (m_pOutputs.GetCount()) {
CAutoPtr<CBaseSplitterOutputPin> pPin = m_pOutputs.RemoveHead();
- if(IPin* pPinTo = pPin->GetConnected()) {
+ if (IPin* pPinTo = pPin->GetConnected()) {
pPinTo->Disconnect();
}
pPin->Disconnect();
@@ -930,7 +930,7 @@ void CBaseSplitterFilter::DeliverBeginFlush()
{
m_fFlushing = true;
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->DeliverBeginFlush();
}
}
@@ -938,7 +938,7 @@ void CBaseSplitterFilter::DeliverBeginFlush()
void CBaseSplitterFilter::DeliverEndFlush()
{
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->DeliverEndFlush();
}
m_fFlushing = false;
@@ -947,18 +947,18 @@ void CBaseSplitterFilter::DeliverEndFlush()
DWORD CBaseSplitterFilter::ThreadProc()
{
- if(m_pSyncReader) {
+ if (m_pSyncReader) {
m_pSyncReader->SetBreakEvent(GetRequestHandle());
}
- if(!DemuxInit()) {
- while(1) {
+ if (!DemuxInit()) {
+ while (1) {
DWORD cmd = GetRequest();
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
CAMThread::m_hThread = NULL;
}
Reply(S_OK);
- if(cmd == CMD_EXIT) {
+ if (cmd == CMD_EXIT) {
return 0;
}
}
@@ -967,8 +967,8 @@ DWORD CBaseSplitterFilter::ThreadProc()
m_eEndFlush.Set();
m_fFlushing = false;
- for(DWORD cmd = (DWORD)-1; ; cmd = GetRequest()) {
- if(cmd == CMD_EXIT) {
+ for (DWORD cmd = (DWORD)-1; ; cmd = GetRequest()) {
+ if (cmd == CMD_EXIT) {
m_hThread = NULL;
Reply(S_OK);
return 0;
@@ -981,7 +981,7 @@ DWORD CBaseSplitterFilter::ThreadProc()
DemuxSeek(m_rtStart);
- if(cmd != (DWORD)-1) {
+ if (cmd != (DWORD)-1) {
Reply(S_OK);
}
@@ -990,9 +990,9 @@ DWORD CBaseSplitterFilter::ThreadProc()
m_pActivePins.RemoveAll();
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !m_fFlushing) {
+ while (pos && !m_fFlushing) {
CBaseSplitterOutputPin* pPin = m_pOutputs.GetNext(pos);
- if(pPin->IsConnected() && pPin->IsActive()) {
+ if (pPin->IsConnected() && pPin->IsActive()) {
m_pActivePins.AddTail(pPin);
pPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
}
@@ -1000,10 +1000,10 @@ DWORD CBaseSplitterFilter::ThreadProc()
do {
m_bDiscontinuitySent.RemoveAll();
- } while(!DemuxLoop());
+ } while (!DemuxLoop());
pos = m_pActivePins.GetHeadPosition();
- while(pos && !CheckRequest(&cmd)) {
+ while (pos && !CheckRequest(&cmd)) {
m_pActivePins.GetNext(pos)->QueueEndOfStream();
}
}
@@ -1019,11 +1019,11 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p)
HRESULT hr = S_FALSE;
CBaseSplitterOutputPin* pPin = GetOutputPin(p->TrackNumber);
- if(!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin)) {
+ if (!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin)) {
return S_FALSE;
}
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_rtCurrent = p->rtStart;
p->rtStart -= m_rtStart;
@@ -1036,13 +1036,13 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p)
CAutoLock cAutoLock(&m_csmtnew);
CMediaType mt;
- if(m_mtnew.Lookup(p->TrackNumber, mt)) {
+ if (m_mtnew.Lookup(p->TrackNumber, mt)) {
p->pmt = CreateMediaType(&mt);
m_mtnew.RemoveKey(p->TrackNumber);
}
}
- if(!m_bDiscontinuitySent.Find(p->TrackNumber)) {
+ if (!m_bDiscontinuitySent.Find(p->TrackNumber)) {
p->bDiscontinuity = TRUE;
}
@@ -1059,19 +1059,19 @@ HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p)
hr = pPin->QueuePacket(p);
- if(S_OK != hr) {
- if(POSITION pos = m_pActivePins.Find(pPin)) {
+ if (S_OK != hr) {
+ if (POSITION pos = m_pActivePins.Find(pPin)) {
m_pActivePins.RemoveAt(pos);
}
- if(!m_pActivePins.IsEmpty()) { // only die when all pins are down
+ if (!m_pActivePins.IsEmpty()) { // only die when all pins are down
hr = S_OK;
}
return hr;
}
- if(bDiscontinuity) {
+ if (bDiscontinuity) {
m_bDiscontinuitySent.AddTail(TrackNumber);
}
@@ -1083,16 +1083,16 @@ bool CBaseSplitterFilter::IsAnyPinDrying()
int totalcount = 0, totalsize = 0;
POSITION pos = m_pActivePins.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos);
int count = pPin->QueueCount();
int size = pPin->QueueSize();
- if(!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE)) {
+ if (!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE)) {
// if(m_priority != THREAD_PRIORITY_ABOVE_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
- if(m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3)) {
+ if (m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3)) {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
}
m_priority = THREAD_PRIORITY_BELOW_NORMAL;
@@ -1103,16 +1103,16 @@ bool CBaseSplitterFilter::IsAnyPinDrying()
totalsize += size;
}
- if(m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
+ if (m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL);
}
m_priority = THREAD_PRIORITY_NORMAL;
}
- if(totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE) {
+ if (totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE) {
return true;
}
@@ -1123,9 +1123,9 @@ HRESULT CBaseSplitterFilter::BreakConnect(PIN_DIRECTION dir, CBasePin* pPin)
{
CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
DeleteOutputs();
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
} else {
return E_UNEXPECTED;
}
@@ -1137,13 +1137,13 @@ HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin)
{
CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CBaseSplitterInputPin* pIn = static_cast<CBaseSplitterInputPin*>(pPin);
HRESULT hr;
CComPtr<IAsyncReader> pAsyncReader;
- if(FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
+ if (FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
|| FAILED(hr = DeleteOutputs())
|| FAILED(hr = CreateOutputs(pAsyncReader))) {
return hr;
@@ -1152,7 +1152,7 @@ HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin)
ChapSort();
m_pSyncReader = pAsyncReader;
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
m_pRetiredOutputs.RemoveAll();
} else {
return E_UNEXPECTED;
@@ -1170,13 +1170,13 @@ CBasePin* CBaseSplitterFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pOutputs.GetCount()) {
- if(POSITION pos = m_pOutputs.FindIndex(n)) {
+ if (n >= 0 && n < (int)m_pOutputs.GetCount()) {
+ if (POSITION pos = m_pOutputs.FindIndex(n)) {
return m_pOutputs.GetAt(pos);
}
}
- if(n == (int)m_pOutputs.GetCount() && m_pInput) {
+ if (n == (int)m_pOutputs.GetCount() && m_pInput) {
return m_pInput;
}
@@ -1192,7 +1192,7 @@ STDMETHODIMP CBaseSplitterFilter::Stop()
DeliverEndFlush();
HRESULT hr;
- if(FAILED(hr = __super::Stop())) {
+ if (FAILED(hr = __super::Stop())) {
return hr;
}
@@ -1206,11 +1206,11 @@ STDMETHODIMP CBaseSplitterFilter::Pause()
FILTER_STATE fs = m_State;
HRESULT hr;
- if(FAILED(hr = __super::Pause())) {
+ if (FAILED(hr = __super::Pause())) {
return hr;
}
- if(fs == State_Stopped) {
+ if (fs == State_Stopped) {
Create();
}
@@ -1222,7 +1222,7 @@ STDMETHODIMP CBaseSplitterFilter::Run(REFERENCE_TIME tStart)
CAutoLock cAutoLock(this);
HRESULT hr;
- if(FAILED(hr = __super::Run(tStart))) {
+ if (FAILED(hr = __super::Run(tStart))) {
return hr;
}
@@ -1243,10 +1243,10 @@ STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYP
if (BuildPlaylist (pszFileName, Items))
pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(Items, hr);
- else
+ else
pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
- if(FAILED(hr)
+ if (FAILED(hr)
|| FAILED(hr = DeleteOutputs())
|| FAILED(hr = CreateOutputs(pAsyncReader)))
{
@@ -1258,7 +1258,7 @@ STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYP
{
POSITION pos = Chapters.GetHeadPosition();
int i = 1;
- while(pos)
+ while (pos)
{
CString str;
CHdmvClipInfo::PlaylistChapter& chap = Chapters.GetNext(pos);
@@ -1282,7 +1282,7 @@ STDMETHODIMP CBaseSplitterFilter::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TY
{
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
wcscpy(*ppszFileName, m_fn);
@@ -1310,15 +1310,15 @@ STDMETHODIMP CBaseSplitterFilter::GetCapabilities(DWORD* pCapabilities)
STDMETHODIMP CBaseSplitterFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
DWORD caps;
GetCapabilities(&caps);
- if((caps&*pCapabilities) == 0) {
+ if ((caps&*pCapabilities) == 0) {
return E_FAIL;
}
- if(caps == *pCapabilities) {
+ if (caps == *pCapabilities) {
return S_OK;
}
return S_FALSE;
@@ -1378,10 +1378,10 @@ STDMETHODIMP CBaseSplitterFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurre
STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- if(pCurrent) {
+ if (pCurrent) {
*pCurrent = m_rtCurrent;
}
- if(pStop) {
+ if (pStop) {
*pStop = m_rtStop;
}
return S_OK;
@@ -1389,7 +1389,7 @@ STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pSt
STDMETHODIMP CBaseSplitterFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
{
- if(pEarliest) {
+ if (pEarliest) {
*pEarliest = 0;
}
return GetDuration(pLatest);
@@ -1414,7 +1414,7 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent,
{
CAutoLock cAutoLock(this);
- if(!pCurrent && !pStop
+ if (!pCurrent && !pStop
|| (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
&& (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) {
return S_OK;
@@ -1424,8 +1424,8 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent,
rtCurrent = m_rtCurrent,
rtStop = m_rtStop;
- if(pCurrent)
- switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pCurrent)
+ switch (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -1439,8 +1439,8 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent,
break;
}
- if(pStop)
- switch(dwStopFlags&AM_SEEKING_PositioningBitsMask) {
+ if (pStop)
+ switch (dwStopFlags&AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
break;
case AM_SEEKING_AbsolutePositioning:
@@ -1454,11 +1454,11 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent,
break;
}
- if(m_rtCurrent == rtCurrent && m_rtStop == rtStop) {
+ if (m_rtCurrent == rtCurrent && m_rtStop == rtStop) {
return S_OK;
}
- if(m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id)) {
+ if (m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id)) {
m_LastSeekers.AddTail(id);
return S_OK;
}
@@ -1473,7 +1473,7 @@ HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent,
m_rtNewStart = m_rtCurrent = rtCurrent;
m_rtNewStop = rtStop;
- if(ThreadExists()) {
+ if (ThreadExists()) {
DeliverBeginFlush();
CallWorker(CMD_SEEK);
DeliverEndFlush();
@@ -1536,7 +1536,7 @@ STDMETHODIMP CBaseSplitterFilter::get_ExSeekCapabilities(long* pExCapabilities)
{
CheckPointer(pExCapabilities, E_POINTER);
*pExCapabilities = AM_EXSEEK_CANSEEK;
- if(ChapGetCount()) {
+ if (ChapGetCount()) {
*pExCapabilities |= AM_EXSEEK_MARKERSEEK;
}
return S_OK;
@@ -1554,7 +1554,7 @@ STDMETHODIMP CBaseSplitterFilter::get_CurrentMarker(long* pCurrentMarker)
CheckPointer(pCurrentMarker, E_POINTER);
REFERENCE_TIME rt = m_rtCurrent;
long i = ChapLookup(&rt);
- if(i < 0) {
+ if (i < 0) {
return E_FAIL;
}
*pCurrentMarker = i+1;
@@ -1565,7 +1565,7 @@ STDMETHODIMP CBaseSplitterFilter::GetMarkerTime(long MarkerNum, double* pMarkerT
{
CheckPointer(pMarkerTime, E_POINTER);
REFERENCE_TIME rt;
- if(FAILED(ChapGet((int)MarkerNum-1, &rt))) {
+ if (FAILED(ChapGet((int)MarkerNum-1, &rt))) {
return E_FAIL;
}
*pMarkerTime = (double)rt / 10000000;
@@ -1602,7 +1602,7 @@ STDMETHODIMP CBaseSplitterFilter::GetStatus(int i, int& samples, int& size)
{
CAutoLock cAutoLock(m_pLock);
- if(POSITION pos = m_pOutputs.FindIndex(i)) {
+ if (POSITION pos = m_pOutputs.FindIndex(i)) {
CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos);
samples = pPin->QueueCount();
size = pPin->QueueSize();
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.h b/src/filters/parser/BaseSplitter/BaseSplitter.h
index 6916cb760..b35e16f91 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitter.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitter.h
@@ -33,66 +33,66 @@
#include "../../../DSUtil/FontInstaller.h"
enum {
- /* various PCM "codecs" */
- FF_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
- FF_CODEC_ID_PCM_S16LE= 0x10000,
- FF_CODEC_ID_PCM_S16BE,
- FF_CODEC_ID_PCM_U16LE,
- FF_CODEC_ID_PCM_U16BE,
- FF_CODEC_ID_PCM_S8,
- FF_CODEC_ID_PCM_U8,
- FF_CODEC_ID_PCM_MULAW,
- FF_CODEC_ID_PCM_ALAW,
- FF_CODEC_ID_PCM_S32LE,
- FF_CODEC_ID_PCM_S32BE,
- FF_CODEC_ID_PCM_U32LE,
- FF_CODEC_ID_PCM_U32BE,
- FF_CODEC_ID_PCM_S24LE,
- FF_CODEC_ID_PCM_S24BE,
- FF_CODEC_ID_PCM_U24LE,
- FF_CODEC_ID_PCM_U24BE,
- FF_CODEC_ID_PCM_S24DAUD,
- FF_CODEC_ID_PCM_ZORK,
- FF_CODEC_ID_PCM_S16LE_PLANAR,
- FF_CODEC_ID_PCM_DVD,
- FF_CODEC_ID_PCM_F32BE,
- FF_CODEC_ID_PCM_F32LE,
- FF_CODEC_ID_PCM_F64BE,
- FF_CODEC_ID_PCM_F64LE,
- FF_CODEC_ID_PCM_BLURAY,
- FF_CODEC_ID_PCM_LXF,
- FF_CODEC_ID_S302M,
-
- /* various ADPCM codecs */
- FF_CODEC_ID_ADPCM_IMA_QT= 0x11000,
- FF_CODEC_ID_ADPCM_IMA_WAV,
- FF_CODEC_ID_ADPCM_IMA_DK3,
- FF_CODEC_ID_ADPCM_IMA_DK4,
- FF_CODEC_ID_ADPCM_IMA_WS,
- FF_CODEC_ID_ADPCM_IMA_SMJPEG,
- FF_CODEC_ID_ADPCM_MS,
- FF_CODEC_ID_ADPCM_4XM,
- FF_CODEC_ID_ADPCM_XA,
- FF_CODEC_ID_ADPCM_ADX,
- FF_CODEC_ID_ADPCM_EA,
- FF_CODEC_ID_ADPCM_G726,
- FF_CODEC_ID_ADPCM_CT,
- FF_CODEC_ID_ADPCM_SWF,
- FF_CODEC_ID_ADPCM_YAMAHA,
- FF_CODEC_ID_ADPCM_SBPRO_4,
- FF_CODEC_ID_ADPCM_SBPRO_3,
- FF_CODEC_ID_ADPCM_SBPRO_2,
- FF_CODEC_ID_ADPCM_THP,
- FF_CODEC_ID_ADPCM_IMA_AMV,
- FF_CODEC_ID_ADPCM_EA_R1,
- FF_CODEC_ID_ADPCM_EA_R3,
- FF_CODEC_ID_ADPCM_EA_R2,
- FF_CODEC_ID_ADPCM_IMA_EA_SEAD,
- FF_CODEC_ID_ADPCM_IMA_EA_EACS,
- FF_CODEC_ID_ADPCM_EA_XAS,
- FF_CODEC_ID_ADPCM_EA_MAXIS_XA,
- FF_CODEC_ID_ADPCM_IMA_ISS,
- FF_CODEC_ID_ADPCM_G722,
+ /* various PCM "codecs" */
+ FF_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ FF_CODEC_ID_PCM_S16LE= 0x10000,
+ FF_CODEC_ID_PCM_S16BE,
+ FF_CODEC_ID_PCM_U16LE,
+ FF_CODEC_ID_PCM_U16BE,
+ FF_CODEC_ID_PCM_S8,
+ FF_CODEC_ID_PCM_U8,
+ FF_CODEC_ID_PCM_MULAW,
+ FF_CODEC_ID_PCM_ALAW,
+ FF_CODEC_ID_PCM_S32LE,
+ FF_CODEC_ID_PCM_S32BE,
+ FF_CODEC_ID_PCM_U32LE,
+ FF_CODEC_ID_PCM_U32BE,
+ FF_CODEC_ID_PCM_S24LE,
+ FF_CODEC_ID_PCM_S24BE,
+ FF_CODEC_ID_PCM_U24LE,
+ FF_CODEC_ID_PCM_U24BE,
+ FF_CODEC_ID_PCM_S24DAUD,
+ FF_CODEC_ID_PCM_ZORK,
+ FF_CODEC_ID_PCM_S16LE_PLANAR,
+ FF_CODEC_ID_PCM_DVD,
+ FF_CODEC_ID_PCM_F32BE,
+ FF_CODEC_ID_PCM_F32LE,
+ FF_CODEC_ID_PCM_F64BE,
+ FF_CODEC_ID_PCM_F64LE,
+ FF_CODEC_ID_PCM_BLURAY,
+ FF_CODEC_ID_PCM_LXF,
+ FF_CODEC_ID_S302M,
+
+ /* various ADPCM codecs */
+ FF_CODEC_ID_ADPCM_IMA_QT= 0x11000,
+ FF_CODEC_ID_ADPCM_IMA_WAV,
+ FF_CODEC_ID_ADPCM_IMA_DK3,
+ FF_CODEC_ID_ADPCM_IMA_DK4,
+ FF_CODEC_ID_ADPCM_IMA_WS,
+ FF_CODEC_ID_ADPCM_IMA_SMJPEG,
+ FF_CODEC_ID_ADPCM_MS,
+ FF_CODEC_ID_ADPCM_4XM,
+ FF_CODEC_ID_ADPCM_XA,
+ FF_CODEC_ID_ADPCM_ADX,
+ FF_CODEC_ID_ADPCM_EA,
+ FF_CODEC_ID_ADPCM_G726,
+ FF_CODEC_ID_ADPCM_CT,
+ FF_CODEC_ID_ADPCM_SWF,
+ FF_CODEC_ID_ADPCM_YAMAHA,
+ FF_CODEC_ID_ADPCM_SBPRO_4,
+ FF_CODEC_ID_ADPCM_SBPRO_3,
+ FF_CODEC_ID_ADPCM_SBPRO_2,
+ FF_CODEC_ID_ADPCM_THP,
+ FF_CODEC_ID_ADPCM_IMA_AMV,
+ FF_CODEC_ID_ADPCM_EA_R1,
+ FF_CODEC_ID_ADPCM_EA_R3,
+ FF_CODEC_ID_ADPCM_EA_R2,
+ FF_CODEC_ID_ADPCM_IMA_EA_SEAD,
+ FF_CODEC_ID_ADPCM_IMA_EA_EACS,
+ FF_CODEC_ID_ADPCM_EA_XAS,
+ FF_CODEC_ID_ADPCM_EA_MAXIS_XA,
+ FF_CODEC_ID_ADPCM_IMA_ISS,
+ FF_CODEC_ID_ADPCM_G722,
};
class Packet : public CAtlArray<BYTE>
@@ -108,7 +108,7 @@ public:
bDiscontinuity = bAppendable = FALSE;
}
virtual ~Packet() {
- if(pmt) {
+ if (pmt) {
DeleteMediaType(pmt);
}
}
@@ -254,7 +254,7 @@ public:
return m_hThread;
}
void SetThreadPriority(int nPriority) {
- if(m_hThread) {
+ if (m_hThread) {
::SetThreadPriority(m_hThread, nPriority);
}
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
index 4e8f55d5a..568952518 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
@@ -35,7 +35,7 @@ CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, in
, m_bitbuff(0), m_bitlen(0)
, m_cachepos(0), m_cachelen(0)
{
- if(!m_pAsyncReader) {
+ if (!m_pAsyncReader) {
hr = E_UNEXPECTED;
return;
}
@@ -47,12 +47,12 @@ CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, in
m_fRandomAccess = total > 0 && total == available;
m_len = total;
- if(FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0) {
+ if (FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0) {
hr = E_FAIL;
return;
}
- if(!SetCacheSize(cachelen)) {
+ if (!SetCacheSize(cachelen)) {
hr = E_OUTOFMEMORY;
return;
}
@@ -65,7 +65,7 @@ bool CBaseSplitterFile::SetCacheSize(int cachelen)
m_pCache.Free();
m_cachetotal = 0;
m_pCache.Allocate((size_t)cachelen);
- if(!m_pCache) {
+ if (!m_pCache) {
return false;
}
m_cachetotal = cachelen;
@@ -87,9 +87,9 @@ __int64 CBaseSplitterFile::GetAvailable()
__int64 CBaseSplitterFile::GetLength(bool fUpdate)
{
- if(m_fStreaming) {
+ if (m_fStreaming) {
m_len = GetAvailable();
- } else if(fUpdate) {
+ } else if (fUpdate) {
LONGLONG total = 0, available;
m_pAsyncReader->Length(&total, &available);
m_len = total;
@@ -111,16 +111,16 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
HRESULT hr = S_OK;
- if(!m_fRandomAccess) {
+ if (!m_fRandomAccess) {
LONGLONG total = 0, available = -1;
m_pAsyncReader->Length(&total, &available);
- if(total == available) {
+ if (total == available) {
m_fRandomAccess = true;
OnComplete();
}
}
- if(m_cachetotal == 0 || !m_pCache) {
+ if (m_cachetotal == 0 || !m_pCache) {
hr = m_pAsyncReader->SyncRead(m_pos, (long)len, pData);
m_pos += len;
return hr;
@@ -128,7 +128,7 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
BYTE* pCache = m_pCache;
- if(m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen) {
+ if (m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen) {
__int64 minlen = min(len, m_cachelen - (m_pos - m_cachepos));
memcpy(pData, &pCache[m_pos - m_cachepos], (size_t)minlen);
@@ -138,9 +138,9 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
pData += minlen;
}
- while(len > m_cachetotal) {
+ while (len > m_cachetotal) {
hr = m_pAsyncReader->SyncRead(m_pos, (long)m_cachetotal, pData);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -149,16 +149,16 @@ HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
pData += m_cachetotal;
}
- while(len > 0) {
+ while (len > 0) {
__int64 tmplen = GetLength();
__int64 maxlen = min(tmplen - m_pos, m_cachetotal);
__int64 minlen = min(len, maxlen);
- if(minlen <= 0) {
+ if (minlen <= 0) {
return S_FALSE;
}
hr = m_pAsyncReader->SyncRead(m_pos, (long)maxlen, pCache);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -179,9 +179,9 @@ UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek)
{
ASSERT(nBits >= 0 && nBits <= 64);
- while(m_bitlen < nBits) {
+ while (m_bitlen < nBits) {
m_bitbuff <<= 8;
- if(S_OK != Read((BYTE*)&m_bitbuff, 1)) {
+ if (S_OK != Read((BYTE*)&m_bitbuff, 1)) {
return 0; // EOF? // ASSERT(0);
}
m_bitlen += 8;
@@ -191,7 +191,7 @@ UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek)
UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
- if(!fPeek) {
+ if (!fPeek) {
m_bitbuff &= ((1ui64 << bitlen) - 1);
m_bitlen = bitlen;
}
@@ -218,7 +218,7 @@ HRESULT CBaseSplitterFile::ByteRead(BYTE* pData, __int64 len)
UINT64 CBaseSplitterFile::UExpGolombRead()
{
int n = -1;
- for(BYTE b = 0; !b; n++) {
+ for (BYTE b = 0; !b; n++) {
b = BitRead(1);
}
return (1ui64 << n) - 1 + BitRead(n);
@@ -234,12 +234,12 @@ HRESULT CBaseSplitterFile::HasMoreData(__int64 len, DWORD ms)
{
__int64 available = GetLength() - GetPos();
- if(!m_fStreaming) {
+ if (!m_fStreaming) {
return available < 1 ? E_FAIL : S_OK;
}
- if(available < len) {
- if(ms > 0) {
+ if (available < len) {
+ if (ms > 0) {
Sleep(ms);
}
return S_FALSE;
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
index 7a318a9fb..b6ea8fb10 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
@@ -50,11 +50,11 @@ bool CBaseSplitterFileEx::NextMpegStartCode(BYTE& code, __int64 len)
BitByteAlign();
DWORD dw = (DWORD)-1;
do {
- if(len-- == 0 || !GetRemaining()) {
+ if (len-- == 0 || !GetRemaining()) {
return false;
}
dw = (dw << 8) | (BYTE)BitRead(8);
- } while((dw&0xffffff00) != 0x00000100);
+ } while ((dw&0xffffff00) != 0x00000100);
code = (BYTE)(dw&0xff);
return true;
}
@@ -69,7 +69,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h)
BYTE b = (BYTE)BitRead(8, true);
- if((b&0xf1) == 0x21) {
+ if ((b&0xf1) == 0x21) {
h.type = mpeg1;
EXECUTE_ASSERT(BitRead(4) == 2);
@@ -84,7 +84,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h)
MARKER; // 14..0
h.bitrate = BitRead(22);
MARKER;
- } else if((b&0xc4) == 0x44) {
+ } else if ((b&0xc4) == 0x44) {
h.type = mpeg2;
EXECUTE_ASSERT(BitRead(2) == 1);
@@ -103,7 +103,7 @@ bool CBaseSplitterFileEx::Read(pshdr& h)
MARKER;
BitRead(5); // reserved
UINT64 stuffing = BitRead(3);
- while(stuffing-- > 0) {
+ while (stuffing-- > 0) {
EXECUTE_ASSERT(BitRead(8) == 0xff);
}
} else {
@@ -133,7 +133,7 @@ bool CBaseSplitterFileEx::Read(pssyshdr& h)
EXECUTE_ASSERT((BitRead(8)&0x7f) == 0x7f); // reserved (should be 0xff, but not in reality)
- for(len -= 6; len > 3; len -= 3) { // TODO: also store these, somewhere, if needed
+ for (len -= 6; len > 3; len -= 3) { // TODO: also store these, somewhere, if needed
UINT64 stream_id = BitRead(8);
UNUSED_ALWAYS(stream_id);
EXECUTE_ASSERT(BitRead(2) == 3);
@@ -148,42 +148,42 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
{
memset(&h, 0, sizeof(h));
- if(!(code >= 0xbd && code < 0xf0 || code == 0xfd)) { // 0xfd => blu-ray (.m2ts)
+ if (!(code >= 0xbd && code < 0xf0 || code == 0xfd)) { // 0xfd => blu-ray (.m2ts)
return false;
}
h.len = (WORD)BitRead(16);
- if(code == 0xbe || code == 0xbf) {
+ if (code == 0xbe || code == 0xbf) {
return true;
}
// mpeg1 stuffing (ff ff .. , max 16x)
- for(int i = 0; i < 16 && BitRead(8, true) == 0xff; i++) {
+ for (int i = 0; i < 16 && BitRead(8, true) == 0xff; i++) {
BitRead(8);
- if(h.len) {
+ if (h.len) {
h.len--;
}
}
h.type = (BYTE)BitRead(2, true) == mpeg2 ? mpeg2 : mpeg1;
- if(h.type == mpeg1) {
+ if (h.type == mpeg1) {
BYTE b = (BYTE)BitRead(2);
- if(b == 1) {
+ if (b == 1) {
h.std_buff_size = (BitRead(1)?1024:128)*BitRead(13);
- if(h.len) {
+ if (h.len) {
h.len -= 2;
}
b = (BYTE)BitRead(2);
}
- if(b == 0) {
+ if (b == 0) {
h.fpts = (BYTE)BitRead(1);
h.fdts = (BYTE)BitRead(1);
}
- } else if(h.type == mpeg2) {
+ } else if (h.type == mpeg2) {
EXECUTE_ASSERT(BitRead(2) == mpeg2);
h.scrambling = (BYTE)BitRead(2);
h.priority = (BYTE)BitRead(1);
@@ -200,16 +200,16 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
h.extension = (BYTE)BitRead(1);
h.hdrlen = (BYTE)BitRead(8);
} else {
- if(h.len) while(h.len-- > 0) {
+ if (h.len) while (h.len-- > 0) {
BitRead(8);
}
return false;
}
- if(h.fpts) {
- if(h.type == mpeg2) {
+ if (h.fpts) {
+ if (h.type == mpeg2) {
BYTE b = (BYTE)BitRead(4);
- if(!(h.fdts && b == 3 || !h.fdts && b == 2)) {/*ASSERT(0); */return false;}
+ if (!(h.fdts && b == 3 || !h.fdts && b == 2)) {/*ASSERT(0); */return false;}
}
h.pts = 0;
@@ -222,8 +222,8 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
h.pts = 10000*h.pts/90 + m_rtPTSOffset;
}
- if(h.fdts) {
- if((BYTE)BitRead(4) != 1) {/*ASSERT(0); */return false;}
+ if (h.fdts) {
+ if ((BYTE)BitRead(4) != 1) {/*ASSERT(0); */return false;}
h.dts = 0;
h.dts |= BitRead(3) << 30;
@@ -237,35 +237,35 @@ bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
// skip to the end of header
- if(h.type == mpeg1) {
- if(!h.fpts && !h.fdts && BitRead(4) != 0xf) {
+ if (h.type == mpeg1) {
+ if (!h.fpts && !h.fdts && BitRead(4) != 0xf) {
/*ASSERT(0);*/ return false;
}
- if(h.len) {
+ if (h.len) {
h.len--;
- if(h.pts) {
+ if (h.pts) {
h.len -= 4;
}
- if(h.dts) {
+ if (h.dts) {
h.len -= 5;
}
}
}
- if(h.type == mpeg2) {
- if(h.len) {
+ if (h.type == mpeg2) {
+ if (h.len) {
h.len -= 3+h.hdrlen;
}
int left = h.hdrlen;
- if(h.fpts) {
+ if (h.fpts) {
left -= 5;
}
- if(h.fdts) {
+ if (h.fdts) {
left -= 5;
}
- while(left-- > 0) {
+ while (left-- > 0) {
BitRead(8);
}
/*
@@ -289,13 +289,13 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
BYTE id = 0;
- while(GetPos() < endpos && id != 0xb3) {
- if(!NextMpegStartCode(id, len)) {
+ while (GetPos() < endpos && id != 0xb3) {
+ if (!NextMpegStartCode(id, len)) {
return false;
}
}
- if(id != 0xb3) {
+ if (id != 0xb3) {
return false;
}
@@ -312,14 +312,14 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
h.constrained = BitRead(1);
h.fiqm = BitRead(1);
- if(h.fiqm)
- for(int i = 0; i < countof(h.iqm); i++) {
+ if (h.fiqm)
+ for (int i = 0; i < countof(h.iqm); i++) {
h.iqm[i] = (BYTE)BitRead(8);
}
h.fniqm = BitRead(1);
- if(h.fniqm)
- for(int i = 0; i < countof(h.niqm); i++) {
+ if (h.fniqm)
+ for (int i = 0; i < countof(h.niqm); i++) {
h.niqm[i] = (BYTE)BitRead(8);
}
@@ -337,7 +337,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
__int64 shextpos = 0, shextlen = 0;
- if(NextMpegStartCode(id, 8) && id == 0xb5) { // sequence header ext
+ if (NextMpegStartCode(id, 8) && id == 0xb5) { // sequence header ext
shextpos = GetPos() - 4;
h.startcodeid = BitRead(4);
@@ -370,22 +370,22 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
h.bitrate = h.bitrate == (1<<30)-1 ? 0 : h.bitrate * 400;
DWORD a = h.arx, b = h.ary;
- while(a) {
+ while (a) {
DWORD tmp = a;
a = b % tmp;
b = tmp;
}
- if(b) {
+ if (b) {
h.arx /= b, h.ary /= b;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
pmt->majortype = MEDIATYPE_Video;
- if(type == mpeg1) {
+ if (type == mpeg1) {
pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
pmt->formattype = FORMAT_MPEGVideo;
int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
@@ -401,13 +401,13 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
vi->cbSequenceHeader = shlen + shextlen;
Seek(shpos);
ByteRead((BYTE*)&vi->bSequenceHeader[0], shlen);
- if(shextpos && shextlen) {
+ if (shextpos && shextlen) {
Seek(shextpos);
}
ByteRead((BYTE*)&vi->bSequenceHeader[0] + shlen, shextlen);
pmt->SetFormat((BYTE*)vi, len);
delete [] vi;
- } else if(type == mpeg2) {
+ } else if (type == mpeg2) {
pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
pmt->formattype = FORMAT_MPEG2_VIDEO;
int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
@@ -425,7 +425,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
vi->cbSequenceHeader = shlen + shextlen;
Seek(shpos);
ByteRead((BYTE*)&vi->dwSequenceHeader[0], shlen);
- if(shextpos && shextlen) {
+ if (shextpos && shextlen) {
Seek(shextpos);
}
ByteRead((BYTE*)&vi->dwSequenceHeader[0] + shlen, shextlen);
@@ -444,11 +444,11 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
int syncbits = fAllowV25 ? 11 : 12;
- for(; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--) {
+ for (; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--) {
BitRead(8);
}
- if(len < 4) {
+ if (len < 4) {
return false;
}
@@ -466,12 +466,12 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
h.original = BitRead(1);
h.emphasis = BitRead(2);
- if(h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2) {
+ if (h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2) {
return false;
}
- if(h.version == 3 && h.layer == 2) {
- if((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
+ if (h.version == 3 && h.layer == 2) {
+ if ((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
&& (h.bitrate >= 11 && h.bitrate <= 14) && h.channels == 3) {
return false;
}
@@ -502,7 +502,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
static int brtblcol[][4] = {{0,3,4,4},{0,0,1,2}};
int bitrate = 1000*brtbl[h.bitrate][brtblcol[h.version&1][h.layer]];
- if(bitrate == 0) {
+ if (bitrate == 0) {
return false;
}
@@ -517,7 +517,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
h.rtDuration = 10000000i64 * (h.layer == 1 ? 384 : l3ext ? 576 : 1152) / h.nSamplesPerSec;// / (h.channels == 3 ? 1 : 2);
h.nBytesPerSec = bitrate / 8;
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -528,7 +528,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
memset(wfe, 0, len);
wfe->cbSize = len - sizeof(WAVEFORMATEX);
- if(h.layer == 3) {
+ if (h.layer == 3) {
wfe->wFormatTag = WAVE_FORMAT_MP3;
/* MPEGLAYER3WAVEFORMAT* f = (MPEGLAYER3WAVEFORMAT*)wfe;
@@ -542,19 +542,19 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p
f->fwHeadMode = 1 << h.channels;
f->fwHeadModeExt = 1 << h.modeext;
f->wHeadEmphasis = h.emphasis+1;
- if(h.privatebit) {
+ if (h.privatebit) {
f->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
}
- if(h.copyright) {
+ if (h.copyright) {
f->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
}
- if(h.original) {
+ if (h.original) {
f->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
}
- if(h.crc == 0) {
+ if (h.crc == 0) {
f->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
}
- if(h.version == 3) {
+ if (h.version == 3) {
f->fwHeadFlags |= ACM_MPEG_ID_MPEG1;
}
f->fwHeadLayer = 1 << (h.layer-1);
@@ -580,11 +580,11 @@ bool CBaseSplitterFileEx::Read(latm_aachdr& h, int len, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- for(; len >= 3 && BitRead(11, true) != 0x2b7; len--) {
+ for (; len >= 3 && BitRead(11, true) != 0x2b7; len--) {
BitRead(8);
}
-
- if(len < 3) {
+
+ if (len < 3) {
return false;
}
@@ -597,14 +597,14 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
memset(&h, 0, sizeof(h));
__int64 pos = 0;
- int found_fake_sync = 0;
+ int found_fake_sync = 0;
- for(;;) {
- for(; len >= 7 && BitRead(12, true) != 0xfff; len--) {
+ for (;;) {
+ for (; len >= 7 && BitRead(12, true) != 0xfff; len--) {
BitRead(8);
}
- if(len < 7) {
+ if (len < 7) {
return false;
}
@@ -627,12 +627,12 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
h.adts_buffer_fullness = BitRead(11);
h.no_raw_data_blocks_in_frame = BitRead(2);
- if(h.fcrc == 0) {
+ if (h.fcrc == 0) {
h.crc = BitRead(16);
}
- if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
- if(found_fake_sync) // skip only one "fake" sync. TODO - find better way to detect and skip "fake" sync
+ if (h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7)) {
+ if (found_fake_sync) // skip only one "fake" sync. TODO - find better way to detect and skip "fake" sync
return false;
found_fake_sync++;
Seek(pos + 1);
@@ -645,7 +645,7 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -676,11 +676,11 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
bool e_ac3 = false;
__int64 startpos = GetPos();
-
+
memset(&h, 0, sizeof(h));
// Parse TrueHD header
- if(!AC3CoreOnly) {
+ if (!AC3CoreOnly) {
BYTE buf[20];
int m_channels;
int m_samplerate;
@@ -688,11 +688,11 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
int fsize = 0;
ByteRead(buf, 20);
-
+
fsize = ParseTrueHDHeader(buf, &m_samplerate, &m_channels, &m_framelength);
- if(fsize) {
+ if (fsize) {
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -701,7 +701,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = MEDIASUBTYPE_DOLBY_TRUEHD;
pmt->formattype = FORMAT_WaveFormatEx;
-
+
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
wfe->wFormatTag = WAVE_FORMAT_UNKNOWN;
wfe->nChannels = m_channels;
@@ -718,18 +718,18 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
Seek(startpos);
- if(find_sync) {
- for(; len >= 7 && BitRead(16, true) != 0x0b77; len--) {
+ if (find_sync) {
+ for (; len >= 7 && BitRead(16, true) != 0x0b77; len--) {
BitRead(8);
}
}
- if(len < 7) {
+ if (len < 7) {
return false;
}
h.sync = (WORD)BitRead(16);
- if(h.sync != 0x0B77) {
+ if (h.sync != 0x0B77) {
return false;
}
@@ -738,26 +738,26 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
h.fscod = BitRead(2);
h.frmsizecod = BitRead(6);
h.bsid = BitRead(5);
- if(h.bsid > 16) {
+ if (h.bsid > 16) {
return false;
}
- if(h.bsid <= 10) {
+ if (h.bsid <= 10) {
/* Normal AC-3 */
- if(h.fscod == 3) {
+ if (h.fscod == 3) {
return false;
}
- if(h.frmsizecod > 37) {
+ if (h.frmsizecod > 37) {
return false;
}
h.bsmod = BitRead(3);
h.acmod = BitRead(3);
- if(h.acmod == 2) {
+ if (h.acmod == 2) {
h.dsurmod = BitRead(2);
}
- if((h.acmod & 1) && h.acmod != 1) {
+ if ((h.acmod & 1) && h.acmod != 1) {
h.cmixlev = BitRead(2);
}
- if(h.acmod & 4) {
+ if (h.acmod & 4) {
h.surmixlev = BitRead(2);
}
h.lfeon = BitRead(1);
@@ -768,17 +768,17 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
Seek(pos);
h.frame_type = BitRead(2);
h.substreamid = BitRead(3);
- if(h.frame_type || h.substreamid) {
+ if (h.frame_type || h.substreamid) {
return false;
}
h.frame_size = (BitRead(11) + 1) << 1;
- if(h.frame_size < 7) {
+ if (h.frame_size < 7) {
return false;
}
h.sr_code = BitRead(2);
- if(h.sr_code == 3) {
+ if (h.sr_code == 3) {
int sr_code2 = BitRead(2);
- if(sr_code2 == 3) {
+ if (sr_code2 == 3) {
return false;
}
h.sample_rate = freq[sr_code2] / 2;
@@ -793,7 +793,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
h.lfeon = BitRead(1);
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -804,7 +804,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
wfe.nChannels = channels[h.acmod] + h.lfeon;
- if(!e_ac3) {
+ if (!e_ac3) {
wfe.nSamplesPerSec = freq[h.fscod] >> h.sr_shift;
static int rate[] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 768, 896, 1024, 1152, 1280};
wfe.nAvgBytesPerSec = ((rate[h.frmsizecod>>1] * 1000) >> h.sr_shift) / 8;
@@ -816,7 +816,7 @@ bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt, bool find_sy
wfe.nBlockAlign = (WORD)(1536 * wfe.nAvgBytesPerSec / wfe.nSamplesPerSec);
pmt->majortype = MEDIATYPE_Audio;
- if(e_ac3) {
+ if (e_ac3) {
pmt->subtype = MEDIASUBTYPE_DOLBY_DDPLUS;
} else {
pmt->subtype = MEDIASUBTYPE_DOLBY_AC3;
@@ -831,18 +831,18 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy
{
memset(&h, 0, sizeof(h));
- if(find_sync) {
- for(; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--) {
+ if (find_sync) {
+ for (; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--) {
BitRead(8);
}
}
- if(len < 10) {
+ if (len < 10) {
return false;
}
h.sync = (DWORD)BitRead(32);
- if(h.sync != 0x7ffe8001) {
+ if (h.sync != 0x7ffe8001) {
return false;
}
@@ -867,7 +867,7 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy
h.predictor_history = BitRead(1);
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -877,7 +877,7 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt, bool find_sy
static int channels[] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
- if(h.amode < countof(channels)) {
+ if (h.amode < countof(channels)) {
wfe.nChannels = channels[h.amode];
if (h.lfe > 0) {
++wfe.nChannels;
@@ -927,7 +927,7 @@ bool CBaseSplitterFileEx::Read(hdmvlpcmhdr& h, CMediaType* pmt)
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -969,11 +969,11 @@ bool CBaseSplitterFileEx::Read(lpcmhdr& h, CMediaType* pmt)
h.channels = BitRead(3);
h.drc = (BYTE)BitRead(8);
- if(h.quantwordlen == 3 || h.reserved1 || h.reserved2) {
+ if (h.quantwordlen == 3 || h.reserved1 || h.reserved2) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1011,7 +1011,7 @@ bool CBaseSplitterFileEx::Read(dvdspuhdr& h, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1026,7 +1026,7 @@ bool CBaseSplitterFileEx::Read(hdmvsubhdr& h, CMediaType* pmt, const char* langu
{
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1047,7 +1047,7 @@ bool CBaseSplitterFileEx::Read(svcdspuhdr& h, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1062,7 +1062,7 @@ bool CBaseSplitterFileEx::Read(cvdspuhdr& h, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1077,23 +1077,23 @@ bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- if(BitRead(16, true) != 'SS') {
+ if (BitRead(16, true) != 'SS') {
return false;
}
__int64 pos = GetPos();
- while(BitRead(16, true) == 'SS') {
+ while (BitRead(16, true) == 'SS') {
DWORD tag = (DWORD)BitRead(32, true);
DWORD size = 0;
- if(tag == 'SShd') {
+ if (tag == 'SShd') {
BitRead(32);
ByteRead((BYTE*)&size, sizeof(size));
ASSERT(size == 0x18);
Seek(GetPos());
ByteRead((BYTE*)&h, sizeof(h));
- } else if(tag == 'SSbd') {
+ } else if (tag == 'SSbd') {
BitRead(32);
ByteRead((BYTE*)&size, sizeof(size));
break;
@@ -1102,7 +1102,7 @@ bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt)
Seek(pos);
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1130,7 +1130,7 @@ bool CBaseSplitterFileEx::Read(ps2subhdr& h, CMediaType* pmt)
{
memset(&h, 0, sizeof(h));
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1147,19 +1147,19 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
BitByteAlign();
- if(m_tslen == 0) {
+ if (m_tslen == 0) {
__int64 pos = GetPos();
- for(int i = 0; i < 192; i++) {
- if(BitRead(8, true) == 0x47) {
+ for (int i = 0; i < 192; i++) {
+ if (BitRead(8, true) == 0x47) {
__int64 pos = GetPos();
Seek(pos + 188);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
m_tslen = 188; // TS stream
break;
}
Seek(pos + 192);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
m_tslen = 192; // M2TS stream
break;
}
@@ -1170,19 +1170,19 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
Seek(pos);
- if(m_tslen == 0) {
+ if (m_tslen == 0) {
return false;
}
}
- if(fSync) {
- for(int i = 0; i < m_tslen; i++) {
- if(BitRead(8, true) == 0x47) {
- if(i == 0) {
+ if (fSync) {
+ for (int i = 0; i < m_tslen; i++) {
+ if (BitRead(8, true) == 0x47) {
+ if (i == 0) {
break;
}
Seek(GetPos()+m_tslen);
- if(BitRead(8, true) == 0x47) {
+ if (BitRead(8, true) == 0x47) {
Seek(GetPos()-m_tslen);
break;
}
@@ -1190,13 +1190,13 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
BitRead(8);
- if(i == m_tslen-1) {
+ if (i == m_tslen-1) {
return false;
}
}
}
- if(BitRead(8, true) != 0x47) {
+ if (BitRead(8, true) != 0x47) {
return false;
}
@@ -1214,10 +1214,10 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
h.bytes = 188 - 4;
- if(h.adapfield) {
+ if (h.adapfield) {
h.length = (BYTE)BitRead(8);
- if(h.length > 0) {
+ if (h.length > 0) {
h.discontinuity = BitRead(1);
h.randomaccess = BitRead(1);
h.priority = BitRead(1);
@@ -1229,7 +1229,7 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
int i = 1;
- if(h.fPCR) {
+ if (h.fPCR) {
h.PCR = BitRead(33);
BitRead(6);
UINT64 PCRExt = BitRead(9);
@@ -1239,14 +1239,14 @@ bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
ASSERT(i <= h.length);
- for(; i < h.length; i++) {
+ for (; i < h.length; i++) {
BitRead(8);
}
}
h.bytes -= h.length+1;
- if(h.bytes < 0) {
+ if (h.bytes < 0) {
ASSERT(0);
return false;
}
@@ -1259,7 +1259,7 @@ bool CBaseSplitterFileEx::Read(trsechdr& h)
memset(&h, 0, sizeof(h));
BYTE pointer_field = BitRead(8);
- while(pointer_field-- > 0) {
+ while (pointer_field-- > 0) {
BitRead(8);
}
h.table_id = BitRead(8);
@@ -1282,16 +1282,16 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
BitByteAlign();
- if(fSync) {
- for(int i = 0; i < 65536; i++) {
- if((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64) {
+ if (fSync) {
+ for (int i = 0; i < 65536; i++) {
+ if ((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64) {
break;
}
BitRead(8);
}
}
- if((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64) {
+ if ((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64) {
return false;
}
@@ -1305,26 +1305,26 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
h.prebytes = BitRead(2);
h.length = (WORD)BitRead(16);
- if(h.length > 6136) {
+ if (h.length > 6136) {
return false;
}
__int64 pos = GetPos();
- if(h.streamid == 1 && h.fpts) {
+ if (h.streamid == 1 && h.fpts) {
h.pts = 10000*BitRead(32)/90 + m_rtPTSOffset;
- } else if(h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0)) {
+ } else if (h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0)) {
BYTE b;
- if(!NextMpegStartCode(b, 4)) {
+ if (!NextMpegStartCode(b, 4)) {
return false;
}
peshdr h2;
- if(!Read(h2, b)) {
+ if (!Read(h2, b)) {
return false;
}
// Maybe bug, code before: if(h.fpts = h2.fpts) h.pts = h2.pts;
h.fpts = h2.fpts;
- if(h.fpts) {
+ if (h.fpts) {
h.pts = h2.pts;
}
}
@@ -1339,12 +1339,12 @@ bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
int CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
{
unsigned int cnt = gb.UExpGolombRead(); // cpb_cnt_minus1
- if(cnt > 32U)
+ if (cnt > 32U)
return -1;
gb.BitRead(4); // bit_rate_scale
gb.BitRead(4); // cpb_size_scale
- for(unsigned int i = 0; i <= cnt; i++ ) {
+ for (unsigned int i = 0; i <= cnt; i++ ) {
gb.UExpGolombRead(); // bit_rate_value_minus1
gb.UExpGolombRead(); // cpb_size_value_minus1
gb.BitRead(1); // cbr_flag
@@ -1354,7 +1354,7 @@ int CBaseSplitterFileEx::HrdParameters(CGolombBuffer& gb)
gb.BitRead(5); // cpb_removal_delay_length_minus1
gb.BitRead(5); // dpb_output_delay_length_minus1
gb.BitRead(5); // time_offset_length
-
+
return 0;
}
@@ -1362,13 +1362,13 @@ void CBaseSplitterFileEx::RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length)
{
int si=0;
int di=0;
- while(si+2<length) {
+ while (si+2<length) {
//remove escapes (very rare 1:2^22)
- if(src[si+2]>3) {
+ if (src[si+2]>3) {
dst[di++]= src[si++];
dst[di++]= src[si++];
- } else if(src[si]==0 && src[si+1]==0) {
- if(src[si+2]==3) { //escape
+ } else if (src[si]==0 && src[si+1]==0) {
+ if (src[si+2]==3) { //escape
dst[di++]= 0;
dst[di++]= 0;
si+=3;
@@ -1391,23 +1391,23 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
// First try search for the start code
DWORD _dwStartCode = BitRead(32, true);
- while(GetPos() < endpos+4 &&
+ while (GetPos() < endpos+4 &&
(_dwStartCode & 0xFFFFFF1F) != 0x101 && // Coded slide of a non-IDR
(_dwStartCode & 0xFFFFFF1F) != 0x105 && // Coded slide of an IDR
(_dwStartCode & 0xFFFFFF1F) != 0x107 && // Sequence Parameter Set
(_dwStartCode & 0xFFFFFF1F) != 0x108 && // Picture Parameter Set
(_dwStartCode & 0xFFFFFF1F) != 0x109 && // Access Unit Delimiter
(_dwStartCode & 0xFFFFFF1F) != 0x10f // Subset Sequence Parameter Set (MVC)
- ) {
+ ) {
BitRead(8);
_dwStartCode = BitRead(32, true);
}
- if(GetPos() >= endpos+4) {
+ if (GetPos() >= endpos+4) {
return false;
}
// At least a SPS (normal or subset) and a PPS is required
- while(GetPos() < endpos+4 && (!(h.spspps[index_sps].complete || h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat))
+ while (GetPos() < endpos+4 && (!(h.spspps[index_sps].complete || h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat))
{
BYTE id = h.lastid;
repeat = false;
@@ -1415,19 +1415,19 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
// Get array index from NAL unit type
spsppsindex index = index_unknown;
- if((id&0x60) != 0) {
- if((id&0x9f) == 0x07) {
+ if ((id&0x60) != 0) {
+ if ((id&0x9f) == 0x07) {
index = index_sps;
- } else if((id&0x9f) == 0x0F) {
+ } else if ((id&0x9f) == 0x0F) {
index = index_subsetsps;
- } else if((id&0x9f) == 0x08) {
+ } else if ((id&0x9f) == 0x08) {
index = h.spspps[index_pps1].complete ? index_pps2 : index_pps1;
}
}
// Search for next start code
DWORD dwStartCode = BitRead(32, true);
- while(GetPos() < endpos+4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100) {
+ while (GetPos() < endpos+4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100) {
BitRead(8);
dwStartCode = BitRead(32, true);
}
@@ -1436,7 +1436,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
// Skip start code
__int64 pos;
- if(GetPos() < endpos+4) {
+ if (GetPos() < endpos+4) {
if (dwStartCode == 0x00000001)
BitRead(32);
else
@@ -1449,11 +1449,11 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
}
// The SPS or PPS might be fragmented, copy data into buffer until NAL is complete
- if(index >= 0) {
- if(h.spspps[index].complete) {
+ if (index >= 0) {
+ if (h.spspps[index].complete) {
// Don't handle SPS/PPS twice
continue;
- } else if(pos > nalstartpos) {
+ } else if (pos > nalstartpos) {
// Copy into buffer
Seek(nalstartpos);
unsigned int bufsize = countof(h.spspps[index].buffer);
@@ -1464,7 +1464,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
//ASSERT(h.spspps[index].size < bufsize); // disable for better debug ...
- if(h.spspps[index].size >= bufsize || dwStartCode == 0x00000001 || (dwStartCode & 0xFFFFFF00) == 0x00000100) {
+ if (h.spspps[index].size >= bufsize || dwStartCode == 0x00000001 || (dwStartCode & 0xFFFFFF00) == 0x00000100) {
if (Read(h, index)) {
h.spspps[index].complete = true;
h.spspps[index].size -= 4;
@@ -1481,20 +1481,20 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
}
// Exit and wait for next packet if there is no SPS and PPS yet
- if((!h.spspps[index_sps].complete && !h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat) {
+ if ((!h.spspps[index_sps].complete && !h.spspps[index_subsetsps].complete) || !h.spspps[index_pps1].complete || repeat) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
{
// Calculate size of extra data
int extra = 0;
- for(int i = 0; i < 4; i++) {
- if(h.spspps[i].complete)
+ for (int i = 0; i < 4; i++) {
+ if (h.spspps[i].complete)
extra += 2+(h.spspps[i].size);
}
@@ -1513,15 +1513,15 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
memset(vi, 0, len);
// vi->hdr.dwBitRate = ;
vi->hdr.AvgTimePerFrame = h.AvgTimePerFrame;
- if(!h.sar.num) h.sar.num = 1;
- if(!h.sar.den) h.sar.den = 1;
+ if (!h.sar.num) h.sar.num = 1;
+ if (!h.sar.den) h.sar.den = 1;
CSize aspect(h.width * h.sar.num, h.height * h.sar.den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
- if(aspect.cx * 2 < aspect.cy) {
+ if (aspect.cx * 2 < aspect.cy) {
delete[] vi;
return false;
}
@@ -1545,8 +1545,8 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
// Copy extra data
BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
- for(int i = 0; i < 4; i++) {
- if(h.spspps[i].complete) {
+ for (int i = 0; i < 4; i++) {
+ if (h.spspps[i].complete) {
*p++ = (h.spspps[i].size) >> 8;
*p++ = (h.spspps[i].size) & 0xff;
memcpy(p, h.spspps[i].buffer, h.spspps[i].size);
@@ -1567,7 +1567,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
static BYTE levels[] = {10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51};
// Only care about SPS and subset SPS
- if(index != index_sps && index != index_subsetsps)
+ if (index != index_sps && index != index_subsetsps)
return true;
// Manage escape codes
@@ -1578,35 +1578,35 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
gb.BitRead(8); // nal_unit_type
h.profile = (BYTE)gb.BitRead(8);
bool b_ident = false;
- for(int i = 0; i<sizeof(profiles); i++) {
- if(h.profile == profiles[i]) {
+ for (int i = 0; i<sizeof(profiles); i++) {
+ if (h.profile == profiles[i]) {
b_ident = true;
break;
}
}
- if(!b_ident)
+ if (!b_ident)
return false;
gb.BitRead(8);
h.level = (BYTE)gb.BitRead(8);
b_ident = false;
- for(int i = 0; i<sizeof(levels); i++) {
- if(h.level == levels[i]) {
+ for (int i = 0; i<sizeof(levels); i++) {
+ if (h.level == levels[i]) {
b_ident = true;
break;
}
}
- if(!b_ident)
+ if (!b_ident)
return false;
unsigned int sps_id = gb.UExpGolombRead(); // seq_parameter_set_id
- if(sps_id >= 32)
+ if (sps_id >= 32)
return false;
UINT64 chroma_format_idc = 0;
- if(h.profile >= 100) { // high profile
+ if (h.profile >= 100) { // high profile
chroma_format_idc = gb.UExpGolombRead();
- if(chroma_format_idc == 3) { // chroma_format_idc
+ if (chroma_format_idc == 3) { // chroma_format_idc
gb.BitRead(1); // residue_transform_flag
}
@@ -1615,10 +1615,10 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
gb.BitRead(1); // qpprime_y_zero_transform_bypass_flag
- if(gb.BitRead(1)) { // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++) {
- if(gb.BitRead(1)) { // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
+ if (gb.BitRead(1)) { // seq_scaling_matrix_present_flag
+ for (int i = 0; i < 8; i++) {
+ if (gb.BitRead(1)) { // seq_scaling_list_present_flag
+ for (int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
next = (next + gb.SExpGolombRead() + 256) & 255;
}
}
@@ -1630,24 +1630,24 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
UINT64 pic_order_cnt_type = gb.UExpGolombRead();
- if(pic_order_cnt_type == 0) {
+ if (pic_order_cnt_type == 0) {
gb.UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- } else if(pic_order_cnt_type == 1) {
+ } else if (pic_order_cnt_type == 1) {
gb.BitRead(1); // delta_pic_order_always_zero_flag
gb.SExpGolombRead(); // offset_for_non_ref_pic
gb.SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
- if(num_ref_frames_in_pic_order_cnt_cycle >= 256)
+ if (num_ref_frames_in_pic_order_cnt_cycle >= 256)
return false;
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
+ for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
gb.SExpGolombRead(); // offset_for_ref_frame[i]
}
- } else if(pic_order_cnt_type != 2) {
+ } else if (pic_order_cnt_type != 2) {
return false;
}
UINT64 ref_frame_count = gb.UExpGolombRead(); // num_ref_frames
- if (ref_frame_count > 30)
+ if (ref_frame_count > 30)
return false;
gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
@@ -1655,29 +1655,29 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
UINT64 pic_height_in_map_units_minus1 = gb.UExpGolombRead();
BYTE frame_mbs_only_flag = (BYTE)gb.BitRead(1);
- if(!frame_mbs_only_flag) {
+ if (!frame_mbs_only_flag) {
gb.BitRead(1); // mb_adaptive_frame_field_flag
}
BYTE direct_8x8_inference_flag = (BYTE)gb.BitRead(1); // direct_8x8_inference_flag
- if(!frame_mbs_only_flag && !direct_8x8_inference_flag) {
+ if (!frame_mbs_only_flag && !direct_8x8_inference_flag) {
return false;
}
- if(gb.BitRead(1)) { // frame_cropping_flag
+ if (gb.BitRead(1)) { // frame_cropping_flag
h.crop_left = gb.UExpGolombRead(); // frame_cropping_rect_left_offset
h.crop_right = gb.UExpGolombRead(); // frame_cropping_rect_right_offset
h.crop_top = gb.UExpGolombRead(); // frame_cropping_rect_top_offset
h.crop_bottom = gb.UExpGolombRead(); // frame_cropping_rect_bottom_offset
}
- if(gb.BitRead(1)) { // vui_parameters_present_flag
- if(gb.BitRead(1)) { // aspect_ratio_info_present_flag
+ if (gb.BitRead(1)) { // vui_parameters_present_flag
+ if (gb.BitRead(1)) { // aspect_ratio_info_present_flag
BYTE aspect_ratio_idc = gb.BitRead(8); // aspect_ratio_idc
- if(255==(BYTE)aspect_ratio_idc) {
+ if (255==(BYTE)aspect_ratio_idc) {
h.sar.num = gb.BitRead(16); // sar_width
h.sar.den = gb.BitRead(16); // sar_height
- } else if(aspect_ratio_idc < 17) {
+ } else if (aspect_ratio_idc < 17) {
h.sar.num = pixel_aspect[aspect_ratio_idc][0];
h.sar.den = pixel_aspect[aspect_ratio_idc][1];
} else {
@@ -1688,24 +1688,24 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
h.sar.den = 1;
}
- if(gb.BitRead(1)) { // overscan_info_present_flag
+ if (gb.BitRead(1)) { // overscan_info_present_flag
gb.BitRead(1); // overscan_appropriate_flag
}
- if(gb.BitRead(1)) { // video_signal_type_present_flag
+ if (gb.BitRead(1)) { // video_signal_type_present_flag
gb.BitRead(3); // video_format
gb.BitRead(1); // video_full_range_flag
- if(gb.BitRead(1)) { // colour_description_present_flag
+ if (gb.BitRead(1)) { // colour_description_present_flag
gb.BitRead(8); // colour_primaries
gb.BitRead(8); // transfer_characteristics
gb.BitRead(8); // matrix_coefficients
}
}
- if(gb.BitRead(1)) { // chroma_location_info_present_flag
+ if (gb.BitRead(1)) { // chroma_location_info_present_flag
gb.UExpGolombRead(); // chroma_sample_loc_type_top_field
gb.UExpGolombRead(); // chroma_sample_loc_type_bottom_field
}
- if(gb.BitRead(1)) { // timing_info_present_flag
+ if (gb.BitRead(1)) { // timing_info_present_flag
__int64 num_units_in_tick = gb.BitRead(32);
__int64 time_scale = gb.BitRead(32);
/*long fixed_frame_rate_flag = */gb.BitRead(1);
@@ -1728,21 +1728,21 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
}
bool nalflag = !!gb.BitRead(1); // nal_hrd_parameters_present_flag
- if(nalflag) {
- if(HrdParameters(gb)<0)
+ if (nalflag) {
+ if (HrdParameters(gb)<0)
return false;
}
bool vlcflag = !!gb.BitRead(1); // vlc_hrd_parameters_present_flag
- if(vlcflag) {
- if(HrdParameters(gb)<0)
+ if (vlcflag) {
+ if (HrdParameters(gb)<0)
return false;
}
- if(nalflag || vlcflag) {
- gb.BitRead(1); // low_delay_hrd_flag
+ if (nalflag || vlcflag) {
+ gb.BitRead(1); // low_delay_hrd_flag
}
gb.BitRead(1); // pic_struct_present_flag
- if(gb.BitRead(1)) { // bitstream_restriction_flag
+ if (gb.BitRead(1)) { // bitstream_restriction_flag
gb.BitRead(1); // motion_vectors_over_pic_boundaries_flag
gb.UExpGolombRead(); // max_bytes_per_pic_denom
gb.UExpGolombRead(); // max_bits_per_mb_denom
@@ -1751,19 +1751,19 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
UINT64 num_reorder_frames = gb.UExpGolombRead(); // num_reorder_frames
gb.UExpGolombRead(); // max_dec_frame_buffering
- if(gb.GetSize() < gb.GetPos()){
+ if (gb.GetSize() < gb.GetPos()) {
num_reorder_frames = 0;
}
- if(num_reorder_frames > 16U)
+ if (num_reorder_frames > 16U)
return false;
}
}
- if(index == index_subsetsps) {
- if(h.profile == 83 || h.profile == 86) {
+ if (index == index_subsetsps) {
+ if (h.profile == 83 || h.profile == 86) {
// TODO: SVC extensions
return false;
- } else if(h.profile == 118 || h.profile == 128) {
+ } else if (h.profile == 118 || h.profile == 128) {
gb.BitRead(1); // bit_equal_to_one
// seq_parameter_set_mvc_extension
@@ -1838,18 +1838,18 @@ bool CBaseSplitterFileEx::Read(avchdr& h, spsppsindex index)
BYTE CHROMA444 = (chroma_format_idc == 3);
h.width = 16 * mb_Width - (2>>CHROMA444) * min(h.crop_right, (8<<CHROMA444)-1);
- if(frame_mbs_only_flag) {
+ if (frame_mbs_only_flag) {
h.height = 16 * mb_Height - (2>>CHROMA444) * min(h.crop_bottom, (8<<CHROMA444)-1);
} else {
h.height = 16 * mb_Height - (4>>CHROMA444) * min(h.crop_bottom, (8<<CHROMA444)-1);
}
- if(h.height<100 || h.width<100) {
+ if (h.height<100 || h.width<100) {
return false;
}
- if(h.height == 1088) {
- h.height = 1080; // Prevent blur lines
+ if (h.height == 1088) {
+ h.height = 1080; // Prevent blur lines
}
return true;
@@ -1893,17 +1893,17 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
h.finterpflag = BitRead (1);
BitRead (1); // reserved
h.psf = BitRead (1);
- if(BitRead (1)) {
+ if (BitRead (1)) {
int ar = 0;
BitRead (14);
BitRead (14);
- if(BitRead (1)) {
+ if (BitRead (1)) {
ar = BitRead (4);
}
- if(ar && ar < 14) {
+ if (ar && ar < 14) {
h.sar.num = pixel_aspect[ar][0];
h.sar.den = pixel_aspect[ar][1];
- } else if(ar == 15) {
+ } else if (ar == 15) {
h.sar.num = BitRead (8);
h.sar.den = BitRead (8);
}
@@ -1912,15 +1912,15 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
ff_vc1_fps_dr[2] = { 1000, 1001 };
- if(BitRead (1)) {
- if(BitRead (1)) {
+ if (BitRead (1)) {
+ if (BitRead (1)) {
nFrameRateNum = 32;
nFrameRateDen = BitRead (16) + 1;
} else {
int nr, dr;
nr = BitRead (8);
dr = BitRead (4);
- if(nr && nr < 8 && dr && dr < 3) {
+ if (nr && nr < 8 && dr && dr < 3) {
nFrameRateNum = ff_vc1_fps_dr[dr - 1];
nFrameRateDen = ff_vc1_fps_nr[nr - 1] * 1000;
}
@@ -1939,11 +1939,11 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
}
}
- if(!extrapos || !extralen) {
+ if (!extrapos || !extralen) {
return false;
}
- if(!pmt) {
+ if (!pmt) {
return true;
}
@@ -1963,14 +1963,14 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt, int guid_fla
memset(vi, 0, len);
vi->AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
- if(!h.sar.num) h.sar.num = 1;
- if(!h.sar.den) h.sar.den = 1;
+ if (!h.sar.num) h.sar.num = 1;
+ if (!h.sar.den) h.sar.den = 1;
CSize aspect = CSize(h.width * h.sar.num, h.height * h.sar.den);
- if(h.width == h.sar.num && h.height == h.sar.den) {
+ if (h.width == h.sar.num && h.height == h.sar.den) {
aspect = CSize(h.width, h.height);
}
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
index 9866c1891..52b1bab04 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
@@ -26,7 +26,7 @@
#define MAX_SPSPPS 256 // Max size for a SPS/PPS packet
class CGolombBuffer;
-static const byte pixel_aspect[17][2]={
+static const byte pixel_aspect[17][2]= {
{0, 1},
{1, 1},
{12, 11},
@@ -369,10 +369,10 @@ public:
UINT64 crop_left, crop_right, crop_top, crop_bottom;
__int64 AvgTimePerFrame;
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
spsppsdata spspps[4];
BYTE lastid;
@@ -399,10 +399,10 @@ public:
BYTE finterpflag;
BYTE psf;
unsigned int width, height;
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
};
struct dvbsub {
diff --git a/src/filters/parser/BaseSplitter/MultiFiles.cpp b/src/filters/parser/BaseSplitter/MultiFiles.cpp
index cd08aec72..ca0a5c8cd 100644
--- a/src/filters/parser/BaseSplitter/MultiFiles.cpp
+++ b/src/filters/parser/BaseSplitter/MultiFiles.cpp
@@ -59,7 +59,7 @@ BOOL CMultiFiles::OpenFiles(CAtlList<CHdmvClipInfo::PlaylistItem>& files, UINT n
REFERENCE_TIME rtDur = 0;
Reset();
- while(pos) {
+ while (pos) {
CHdmvClipInfo::PlaylistItem& s = files.GetNext(pos);
m_strFiles.Add(s.m_strFileName);
if (!OpenPart(nPos)) {
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.cpp b/src/filters/parser/DSMSplitter/DSMSplitter.cpp
index 8ec453c3f..3ed71b3b3 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitter.cpp
+++ b/src/filters/parser/DSMSplitter/DSMSplitter.cpp
@@ -101,7 +101,7 @@ STDMETHODIMP CDSMSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, DSMSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -121,10 +121,10 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CDSMSplitterFile(pAsyncReader, hr, *this, *this));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -135,7 +135,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CAtlArray<BYTE> ids;
POSITION pos = m_pFile->m_mts.GetStartPosition();
- while(pos) {
+ while (pos) {
BYTE id;
CMediaType mt;
m_pFile->m_mts.GetNextAssoc(pos, id, mt);
@@ -144,7 +144,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
qsort(ids.GetData(), ids.GetCount(), sizeof(BYTE), compare_id);
- for(size_t i = 0; i < ids.GetCount(); i++) {
+ for (size_t i = 0; i < ids.GetCount(); i++) {
BYTE id = ids[i];
CMediaType& mt = m_pFile->m_mts[id];
@@ -159,26 +159,26 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
name.Empty();
pos = m_pFile->m_sim[id].GetStartPosition();
- while(pos) {
+ while (pos) {
CStringA key;
CStringW value;
m_pFile->m_sim[id].GetNextAssoc(pos, key, value);
pPinOut->SetProperty(CStringW(key), value);
- if(key == "NAME") {
+ if (key == "NAME") {
name = value;
}
- if(key == "LANG") if((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
+ if (key == "LANG") if ((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
lang = value;
}
}
- if(!name.IsEmpty() || !lang.IsEmpty()) {
- if(!name.IsEmpty()) {
- if(!lang.IsEmpty()) {
+ if (!name.IsEmpty() || !lang.IsEmpty()) {
+ if (!name.IsEmpty()) {
+ if (!lang.IsEmpty()) {
name += L" (" + lang + L")";
}
- } else if(!lang.IsEmpty()) {
+ } else if (!lang.IsEmpty()) {
name = lang;
}
pPinOut->SetName(name);
@@ -188,18 +188,18 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
pos = m_pFile->m_fim.GetStartPosition();
- while(pos) {
+ while (pos) {
CStringA key;
CStringW value;
m_pFile->m_fim.GetNextAssoc(pos, key, value);
SetProperty(CStringW(key), value);
}
- for(size_t i = 0; i < m_resources.GetCount(); i++) {
+ for (size_t i = 0; i < m_resources.GetCount(); i++) {
const CDSMResource& r = m_resources[i];
- if(r.mime == "application/x-truetype-font" ||
- r.mime == "application/x-font-ttf" ||
- r.mime == "application/vnd.ms-opentype") {
+ if (r.mime == "application/x-truetype-font" ||
+ r.mime == "application/x-font-ttf" ||
+ r.mime == "application/vnd.ms-opentype") {
//m_fontinst.InstallFont(r.data);
m_fontinst.InstallFontMemory(r.data.GetData(), r.data.GetCount());
}
@@ -223,20 +223,20 @@ bool CDSMSplitterFilter::DemuxLoop()
{
HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
dsmp_t type;
UINT64 len;
- if(!m_pFile->Sync(type, len)) {
+ if (!m_pFile->Sync(type, len)) {
continue;
}
__int64 pos = m_pFile->GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
CAutoPtr<Packet> p(DNew Packet());
- if(m_pFile->Read(len, p)) {
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (m_pFile->Read(len, p)) {
+ if (p->rtStart != Packet::INVALID_TIME) {
p->rtStart -= m_pFile->m_rtFirst;
p->rtStop -= m_pFile->m_rtFirst;
}
@@ -266,12 +266,12 @@ STDMETHODIMP CDSMSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
CheckPointer(pKFs, E_POINTER);
CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
// these aren't really the keyframes, but quicky accessable points in the stream
- for(nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++) {
+ for (nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++) {
pKFs[nKFs] = m_pFile->m_sps[nKFs].rt;
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
index 2219844c0..715864b87 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
+++ b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
@@ -8,7 +8,7 @@ CDSMSplitterFile::CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResou
, m_rtFirst(0)
, m_rtDuration(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
@@ -19,7 +19,7 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha
{
Seek(0);
- if(BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO) {
+ if (BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO) {
return E_FAIL;
}
@@ -38,64 +38,64 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha
// examine the beginning of the file ...
- while(Sync(type, len, 0)) {
+ while (Sync(type, len, 0)) {
__int64 pos = GetPos();
- if(type == DSMP_MEDIATYPE) {
+ if (type == DSMP_MEDIATYPE) {
BYTE id;
CMediaType mt;
- if(Read(len, id, mt)) {
+ if (Read(len, id, mt)) {
m_mts[id] = mt;
}
- } else if(type == DSMP_SAMPLE) {
+ } else if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
m_rtFirst = p.rtStart;
break;
}
- } else if(type == DSMP_FILEINFO) {
- if((BYTE)BitRead(8) > DSMF_VERSION) {
+ } else if (type == DSMP_FILEINFO) {
+ if ((BYTE)BitRead(8) > DSMF_VERSION) {
return E_FAIL;
}
Read(len-1, m_fim);
- } else if(type == DSMP_STREAMINFO) {
+ } else if (type == DSMP_STREAMINFO) {
Read(len-1, m_sim[(BYTE)BitRead(8)]);
- } else if(type == DSMP_SYNCPOINTS) {
+ } else if (type == DSMP_SYNCPOINTS) {
Read(len, m_sps);
- } else if(type == DSMP_RESOURCE) {
+ } else if (type == DSMP_RESOURCE) {
Read(len, res);
- } else if(type == DSMP_CHAPTERS) {
+ } else if (type == DSMP_CHAPTERS) {
Read(len, chap);
}
Seek(pos + len);
}
- if(type != DSMP_SAMPLE) {
+ if (type != DSMP_SAMPLE) {
return E_FAIL;
}
// ... and the end
- if(IsRandomAccess())
- for(int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++) {
+ if (IsRandomAccess())
+ for (int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++) {
__int64 seekpos = max(0, (__int64)GetLength()-i*limit);
Seek(seekpos);
- while(Sync(type, len, limit) && GetPos() < seekpos+limit) {
+ while (Sync(type, len, limit) && GetPos() < seekpos+limit) {
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
m_rtDuration = max(m_rtDuration, p.rtStop - m_rtFirst); // max isn't really needed, only for safety
i = j;
}
- } else if(type == DSMP_SYNCPOINTS) {
+ } else if (type == DSMP_SYNCPOINTS) {
Read(len, m_sps);
- } else if(type == DSMP_RESOURCE) {
+ } else if (type == DSMP_RESOURCE) {
Read(len, res);
- } else if(type == DSMP_CHAPTERS) {
+ } else if (type == DSMP_CHAPTERS) {
Read(len, chap);
}
@@ -103,7 +103,7 @@ HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& cha
}
}
- if(m_rtFirst < 0) {
+ if (m_rtFirst < 0) {
m_rtDuration += m_rtFirst;
m_rtFirst = 0;
}
@@ -123,8 +123,8 @@ bool CDSMSplitterFile::Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64
limit += DSMSW_SIZE;
- for(UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8)) {
- if(limit-- <= 0 || GetRemaining() <= 2) {
+ for (UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8)) {
+ if (limit-- <= 0 || GetRemaining() <= 2) {
return false;
}
}
@@ -147,7 +147,7 @@ bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt)
ByteRead((BYTE*)&mt.formattype, sizeof(mt.formattype));
len -= 5 + sizeof(GUID)*3;
ASSERT(len >= 0);
- if(len > 0) {
+ if (len > 0) {
mt.AllocFormatBuffer((LONG)len);
ByteRead(mt.Format(), mt.FormatLength());
} else {
@@ -158,7 +158,7 @@ bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt)
bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
{
- if(!p) {
+ if (!p) {
return false;
}
@@ -168,7 +168,7 @@ bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
int iTimeStamp = (int)BitRead(3);
int iDuration = (int)BitRead(3);
- if(fSign && !iTimeStamp) {
+ if (fSign && !iTimeStamp) {
ASSERT(!iDuration);
p->rtStart = Packet::INVALID_TIME;
p->rtStop = Packet::INVALID_TIME + 1;
@@ -177,7 +177,7 @@ bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
p->rtStop = p->rtStart + BitRead(iDuration<<3);
}
- if(fData) {
+ if (fData) {
p->SetCount((INT_PTR)len - (2 + iTimeStamp + iDuration));
ByteRead(p->GetData(), p->GetCount());
}
@@ -190,7 +190,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps)
SyncPoint sp = {0, 0};
sps.RemoveAll();
- while(len > 0) {
+ while (len > 0) {
bool fSign = !!BitRead(1);
int iTimeStamp = (int)BitRead(3);
int iFilePos = (int)BitRead(3);
@@ -203,7 +203,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps)
len -= 1 + iTimeStamp + iFilePos;
}
- if(len != 0) {
+ if (len != 0) {
sps.RemoveAll();
return false;
}
@@ -215,7 +215,7 @@ bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps)
bool CDSMSplitterFile::Read(__int64 len, CStreamInfoMap& im)
{
- while(len >= 5) {
+ while (len >= 5) {
CStringA key;
ByteRead((BYTE*)key.GetBufferSetLength(4), 4);
len -= 4;
@@ -237,7 +237,7 @@ bool CDSMSplitterFile::Read(__int64 len, IDSMResourceBagImpl& res)
len -= Read(len, r.desc);
len -= Read(len, r.mime);
- if(compression != 0) {
+ if (compression != 0) {
return false; // TODO
}
@@ -253,7 +253,7 @@ bool CDSMSplitterFile::Read(__int64 len, IDSMChapterBagImpl& chap)
{
CDSMChapter c(0, L"");
- while(len > 0) {
+ while (len > 0) {
bool fSign = !!BitRead(1);
int iTimeStamp = (int)BitRead(3);
BitRead(4); // reserved
@@ -276,7 +276,7 @@ __int64 CDSMSplitterFile::Read(__int64 len, CStringW& str)
char c;
CStringA s;
__int64 i = 0;
- while(i++ < len && (c = (char)BitRead(8)) != 0) {
+ while (i++ < len && (c = (char)BitRead(8)) != 0) {
s += c;
}
str = UTF8To16(s);
@@ -285,12 +285,12 @@ __int64 CDSMSplitterFile::Read(__int64 len, CStringW& str)
__int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
{
- if(/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1) {
+ if (/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1) {
int i = range_bsearch(m_sps, m_rtFirst + rt);
return i >= 0 ? m_sps[i].fp : 0;
}
- if(m_rtDuration <= 0 || rt <= m_rtFirst) {
+ if (m_rtDuration <= 0 || rt <= m_rtFirst) {
return 0;
}
@@ -303,21 +303,21 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
__int64 minpos = 0, maxpos = GetLength();
- for(int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++) {
+ for (int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++) {
Seek((minpos + maxpos) / 2);
- while(GetPos() < maxpos) {
- if(!Sync(syncpos, type, len)) {
+ while (GetPos() < maxpos) {
+ if (!Sync(syncpos, type, len)) {
continue;
}
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0) {
+ if (dt >= 0) {
maxpos = max((__int64)syncpos - 65536, minpos);
} else {
minpos = syncpos;
@@ -334,18 +334,18 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
Seek(minpos);
- while(GetRemaining()) {
- if(!Sync(syncpos, type, len)) {
+ while (GetRemaining()) {
+ if (!Sync(syncpos, type, len)) {
continue;
}
__int64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0) {
+ if (dt >= 0) {
maxpos = (__int64)syncpos;
break;
}
@@ -361,11 +361,11 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
{
POSITION pos = m_mts.GetStartPosition();
- while(pos) {
+ while (pos) {
BYTE id;
CMediaType mt;
m_mts.GetNextAssoc(pos, id, mt);
- if(mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
+ if (mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle) {
ids[id] = 0;
}
}
@@ -373,19 +373,19 @@ __int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
__int64 ret = maxpos;
- while(maxpos > 0 && !ids.IsEmpty()) {
+ while (maxpos > 0 && !ids.IsEmpty()) {
minpos = max(0, maxpos - 65536);
Seek(minpos);
- while(Sync(syncpos, type, len) && GetPos() < maxpos) {
+ while (Sync(syncpos, type, len) && GetPos() < maxpos) {
UINT64 pos = GetPos();
- if(type == DSMP_SAMPLE) {
+ if (type == DSMP_SAMPLE) {
Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint) {
+ if (Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint) {
BYTE id = (BYTE)p.TrackNumber, tmp;
- if(ids.Lookup(id, tmp)) {
+ if (ids.Lookup(id, tmp)) {
ids.RemoveKey((BYTE)p.TrackNumber);
ret = min(ret, (__int64)syncpos);
}
diff --git a/src/filters/parser/FLVSplitter/FLVSplitter.cpp b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
index ccc0ee1b9..d56aade66 100644
--- a/src/filters/parser/FLVSplitter/FLVSplitter.cpp
+++ b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
@@ -27,12 +27,12 @@
#include <moreuuids.h>
enum {
- FLV_CODECID_H263 = 2,
- FLV_CODECID_SCREEN = 3,
- FLV_CODECID_VP6 = 4,
- FLV_CODECID_VP6A = 5,
- FLV_CODECID_SCREEN2 = 6,
- FLV_CODECID_H264 = 7,
+ FLV_CODECID_H263 = 2,
+ FLV_CODECID_SCREEN = 3,
+ FLV_CODECID_VP6 = 4,
+ FLV_CODECID_VP6A = 5,
+ FLV_CODECID_SCREEN2 = 6,
+ FLV_CODECID_H264 = 7,
};
#ifdef REGISTER_FILTER
@@ -105,7 +105,7 @@ STDMETHODIMP CFLVSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, FlvSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -114,7 +114,7 @@ STDMETHODIMP CFLVSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
bool CFLVSplitterFilter::ReadTag(Tag& t)
{
- if(m_pFile->GetRemaining() < 15) {
+ if (m_pFile->GetRemaining() < 15) {
return false;
}
@@ -130,7 +130,7 @@ bool CFLVSplitterFilter::ReadTag(Tag& t)
bool CFLVSplitterFilter::ReadTag(AudioTag& at)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -144,7 +144,7 @@ bool CFLVSplitterFilter::ReadTag(AudioTag& at)
bool CFLVSplitterFilter::ReadTag(VideoTag& vt)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -157,7 +157,7 @@ bool CFLVSplitterFilter::ReadTag(VideoTag& vt)
#ifndef NOVIDEOTWEAK
bool CFLVSplitterFilter::ReadTag(VideoTweak& vt)
{
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return false;
}
@@ -172,7 +172,7 @@ bool CFLVSplitterFilter::Sync(__int64& pos)
{
m_pFile->Seek(pos);
- while(m_pFile->GetRemaining() >= 15) {
+ while (m_pFile->GetRemaining() >= 15) {
__int64 limit = m_pFile->GetRemaining();
while (true) {
BYTE b = m_pFile->BitRead(8);
@@ -190,7 +190,7 @@ bool CFLVSplitterFilter::Sync(__int64& pos)
Tag ct;
if (ReadTag(ct)) {
__int64 next = m_pFile->GetPos() + ct.DataSize;
- if(next == m_pFile->GetLength() - 4) {
+ if (next == m_pFile->GetLength() - 4) {
m_pFile->Seek(pos);
return true;
} else if (next <= m_pFile->GetLength() - 19) {
@@ -222,10 +222,10 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -233,7 +233,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- if(m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1) {
+ if (m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1) {
return E_FAIL;
}
@@ -255,8 +255,8 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(m_DataOffset);
- for(int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio); i++) {
- if(!t.DataSize) continue; // skip empty Tag
+ for (int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio); i++) {
+ if (!t.DataSize) continue; // skip empty Tag
UINT64 next = m_pFile->GetPos() + t.DataSize;
@@ -272,12 +272,12 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
prevTagSize = t.DataSize + 11;
- if(t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio) {
+ if (t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio) {
UNREFERENCED_PARAMETER(at);
AudioTag at;
name = L"Audio";
- if(ReadTag(at)) {
+ if (ReadTag(at)) {
int dataSize = t.DataSize - 1;
fTypeFlagsAudio = false;
@@ -290,7 +290,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
wfe->wBitsPerSample = 8*(at.SoundSize+1);
wfe->nChannels = at.SoundType+1;
- switch(at.SoundFormat) {
+ switch (at.SoundFormat) {
case 0: // FLV_CODECID_PCM_BE
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_PCM);
name += L" PCM";
@@ -316,11 +316,11 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
case 2: // FLV_CODECID_MP3
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
name += L" MP3";
-
+
{
CBaseSplitterFileEx::mpahdr h;
CMediaType mt2;
- if(m_pFile->Read(h, 4, false, &mt2)) {
+ if (m_pFile->Read(h, 4, false, &mt2)) {
mt = mt2;
}
}
@@ -386,10 +386,10 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- } else if(t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo) {
+ } else if (t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo) {
UNREFERENCED_PARAMETER(vt);
VideoTag vt;
- if(ReadTag(vt) && vt.FrameType == 1) {
+ if (ReadTag(vt) && vt.FrameType == 1) {
int dataSize = t.DataSize - 1;
fTypeFlagsVideo = false;
@@ -404,15 +404,15 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
int w, h, arx, ary;
- switch(vt.CodecID) {
+ switch (vt.CodecID) {
case FLV_CODECID_H263: // H.263
- if(m_pFile->BitRead(17) != 1) {
+ if (m_pFile->BitRead(17) != 1) {
break;
}
m_pFile->BitRead(13); // Version (5), TemporalReference (8)
- switch(BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) { // w00t
+ switch (BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) { // w00t
case 0:
case 1:
vih->bmiHeader.biWidth = (WORD)m_pFile->BitRead(8*(PictureSize+1));
@@ -432,7 +432,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
break;
}
- if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
+ if (!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
break;
}
@@ -446,7 +446,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->BitRead(4);
vih->bmiHeader.biHeight = m_pFile->BitRead(12);
- if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
+ if (!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) {
break;
}
@@ -490,7 +490,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
ary = m_pFile->BitRead(8) * 16;
arx = m_pFile->BitRead(8) * 16;
- if(arx && arx != w || ary && ary != h) {
+ if (arx && arx != w || ary && ary != h) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
vih2->dwPictAspectRatioX = arx;
@@ -540,31 +540,31 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
vih->dwLevel = (BYTE)m_pFile->BitRead(8);
m_pFile->UExpGolombRead(); // seq_parameter_set_id
UINT64 chroma_format_idc = 0;
- if(vih->dwProfile >= 100) { // high profile
+ if (vih->dwProfile >= 100) { // high profile
chroma_format_idc = m_pFile->UExpGolombRead();
- if(chroma_format_idc == 3) { // chroma_format_idc
+ if (chroma_format_idc == 3) { // chroma_format_idc
m_pFile->BitRead(1); // residue_transform_flag
}
m_pFile->UExpGolombRead(); // bit_depth_luma_minus8
m_pFile->UExpGolombRead(); // bit_depth_chroma_minus8
m_pFile->BitRead(1); // qpprime_y_zero_transform_bypass_flag
- if(m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++)
- if(m_pFile->BitRead(1)) // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
+ if (m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
+ for (int i = 0; i < 8; i++)
+ if (m_pFile->BitRead(1)) // seq_scaling_list_present_flag
+ for (int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
next = (next + m_pFile->SExpGolombRead() + 256) & 255;
}
}
m_pFile->UExpGolombRead(); // log2_max_frame_num_minus4
UINT64 pic_order_cnt_type = m_pFile->UExpGolombRead();
- if(pic_order_cnt_type == 0) {
+ if (pic_order_cnt_type == 0) {
m_pFile->UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- } else if(pic_order_cnt_type == 1) {
+ } else if (pic_order_cnt_type == 1) {
m_pFile->BitRead(1); // delta_pic_order_always_zero_flag
m_pFile->SExpGolombRead(); // offset_for_non_ref_pic
m_pFile->SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = m_pFile->UExpGolombRead();
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
+ for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
m_pFile->SExpGolombRead(); // offset_for_ref_frame[i]
}
}
@@ -573,7 +573,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
UINT64 pic_width_in_mbs_minus1 = m_pFile->UExpGolombRead();
UINT64 pic_height_in_map_units_minus1 = m_pFile->UExpGolombRead();
BYTE frame_mbs_only_flag = (BYTE)m_pFile->BitRead(1);
- if(!frame_mbs_only_flag) {
+ if (!frame_mbs_only_flag) {
m_pFile->BitRead(1); // mb_adaptive_frame_field_flag
}
m_pFile->BitRead(1); // direct_8x8_inference_flag
@@ -583,24 +583,24 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
UINT64 crop_top = 0;
UINT64 crop_bottom = 0;
- if(crop) {
+ if (crop) {
crop_left = m_pFile->UExpGolombRead(); // frame_cropping_rect_left_offset
crop_right = m_pFile->UExpGolombRead(); // frame_cropping_rect_right_offset
crop_top = m_pFile->UExpGolombRead(); // frame_cropping_rect_top_offset
crop_bottom = m_pFile->UExpGolombRead(); // frame_cropping_rect_bottom_offset
}
- struct sar{
+ struct sar {
BYTE num;
BYTE den;
- }sar;
+ } sar;
- if(m_pFile->BitRead(1)) { // vui_parameters_present_flag
- if(m_pFile->BitRead(1)) { // aspect_ratio_info_present_flag
+ if (m_pFile->BitRead(1)) { // vui_parameters_present_flag
+ if (m_pFile->BitRead(1)) { // aspect_ratio_info_present_flag
BYTE aspect_ratio_idc = m_pFile->BitRead(8); // aspect_ratio_idc
- if(255==(BYTE)aspect_ratio_idc) {
+ if (255==(BYTE)aspect_ratio_idc) {
sar.num = m_pFile->BitRead(16); // sar_width
sar.den = m_pFile->BitRead(16); // sar_height
- } else if(aspect_ratio_idc < 17) {
+ } else if (aspect_ratio_idc < 17) {
sar.num = pixel_aspect[aspect_ratio_idc][0];
sar.den = pixel_aspect[aspect_ratio_idc][1];
} else {
@@ -617,16 +617,16 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
UINT64 Width, Height;
Width = 16 * mb_Width - (2>>CHROMA444) * min(crop_right, (8<<CHROMA444)-1);
- if(frame_mbs_only_flag) {
+ if (frame_mbs_only_flag) {
Height = 16 * mb_Height - (2>>CHROMA444) * min(crop_bottom, (8<<CHROMA444)-1);
} else {
Height = 16 * mb_Height - (4>>CHROMA444) * min(crop_bottom, (8<<CHROMA444)-1);
}
- if(!sar.num) sar.num = 1;
- if(!sar.den) sar.den = 1;
+ if (!sar.num) sar.num = 1;
+ if (!sar.den) sar.den = 1;
CSize aspect(Width * sar.num, Height * sar.den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
@@ -659,7 +659,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end) {
+ if (src + len > src_end || dst + len > dst_end) {
ASSERT(0);
break;
}
@@ -682,9 +682,9 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- if(mt.subtype != GUID_NULL) {
+ if (mt.subtype != GUID_NULL) {
CAtlArray<CMediaType> mts;
- if(mt.subtype == FOURCCMap(MAKEFOURCC('A','S','W','F'))) {
+ if (mt.subtype == FOURCCMap(MAKEFOURCC('A','S','W','F'))) {
mts.InsertAt(0, ff_mtype);
}
mts.Add(mt);
@@ -695,18 +695,18 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(next);
}
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
__int64 pos = max(m_DataOffset, m_pFile->GetLength() - 256 * 1024);
- if(Sync(pos)) {
+ if (Sync(pos)) {
Tag t;
AudioTag at;
VideoTag vt;
- while(ReadTag(t)) {
+ while (ReadTag(t)) {
UINT64 next = m_pFile->GetPos() + t.DataSize;
- if(t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)) {
+ if (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)) {
m_rtDuration = max(m_rtDuration, 10000i64 * t.TimeStamp);
}
@@ -728,7 +728,7 @@ bool CFLVSplitterFilter::DemuxInit()
void CFLVSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(!m_rtDuration || rt <= 0) {
+ if (!m_rtDuration || rt <= 0) {
m_pFile->Seek(m_DataOffset);
} else if (!m_IgnorePrevSizes) {
NormalSeek(rt);
@@ -744,7 +744,7 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
__int64 pos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
- if(!Sync(pos)) {
+ if (!Sync(pos)) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
return;
@@ -754,8 +754,8 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
AudioTag at;
VideoTag vt;
- while(ReadTag(t)) {
- if(10000i64 * t.TimeStamp >= rt) {
+ while (ReadTag(t)) {
+ if (10000i64 * t.TimeStamp >= rt) {
m_pFile->Seek(m_pFile->GetPos() - 15);
break;
}
@@ -763,13 +763,13 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
m_pFile->Seek(m_pFile->GetPos() + t.DataSize);
}
- while(m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t)) {
+ while (m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t)) {
UINT64 prev = m_pFile->GetPos() - 15 - t.PreviousTagSize - 4;
- if(10000i64 * t.TimeStamp <= rt) {
- if(t.TagType == 8 && ReadTag(at)) {
+ if (10000i64 * t.TimeStamp <= rt) {
+ if (t.TagType == 8 && ReadTag(at)) {
fAudio = false;
- } else if(t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
+ } else if (t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
fVideo = false;
}
}
@@ -777,7 +777,7 @@ void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
m_pFile->Seek(prev);
}
- if(fAudio || fVideo) {
+ if (fAudio || fVideo) {
ASSERT(0);
m_pFile->Seek(m_DataOffset);
}
@@ -844,24 +844,24 @@ bool CFLVSplitterFilter::DemuxLoop()
AudioTag at = {};
VideoTag vt = {};
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
- if(!ReadTag(t)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ if (!ReadTag(t)) {
break;
}
__int64 next = m_pFile->GetPos() + t.DataSize;
- if((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))) {
+ if ((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))) {
UINT32 tsOffset = 0;
- if(t.TagType == 9) {
- if(vt.FrameType == 5) {
+ if (t.TagType == 9) {
+ if (vt.FrameType == 5) {
goto NextTag; // video info/command frame
}
- if(vt.CodecID == 4) {
+ if (vt.CodecID == 4) {
m_pFile->BitRead(8);
- } else if(vt.CodecID == 5) {
+ } else if (vt.CodecID == 5) {
m_pFile->BitRead(32);
- } else if(vt.CodecID == 7) {
+ } else if (vt.CodecID == 7) {
if (m_pFile->BitRead(8) != 1) {
goto NextTag;
}
@@ -870,7 +870,7 @@ bool CFLVSplitterFilter::DemuxLoop()
tsOffset = (tsOffset + 0xff800000) ^ 0xff800000; // sign extension
}
}
- if(t.TagType == 8 && at.SoundFormat == 10) {
+ if (t.TagType == 8 && at.SoundFormat == 10) {
if (m_pFile->BitRead(8) != 1) {
goto NextTag;
}
diff --git a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
index 4e42bf718..2824094a2 100644
--- a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
+++ b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
@@ -22,7 +22,7 @@ void AP4_AsyncReaderStream::AddReference()
void AP4_AsyncReaderStream::Release()
{
ASSERT(m_refs > 0);
- if(--m_refs == 0) {
+ if (--m_refs == 0) {
delete this;
}
}
@@ -31,25 +31,25 @@ AP4_Result AP4_AsyncReaderStream::Read(void* buffer, AP4_Size bytesToRead, AP4_S
{
__int64 bytesAvail = m_pFile->GetRemaining();
- if(bytesAvail < (long long)bytesToRead) {
- if(bytesRead) {
+ if (bytesAvail < (long long)bytesToRead) {
+ if (bytesRead) {
*bytesRead = bytesAvail;
}
bytesToRead = bytesAvail;
}
- if(bytesAvail == 0) {
+ if (bytesAvail == 0) {
return AP4_ERROR_EOS;
}
- if(FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead))) {
- if(bytesRead) {
+ if (FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead))) {
+ if (bytesRead) {
*bytesRead = 0;
}
return AP4_ERROR_READ_FAILED;
}
- if(bytesRead) {
+ if (bytesRead) {
*bytesRead = bytesToRead;
}
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
index f88de531b..62d46bd18 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
@@ -150,7 +150,7 @@ STDMETHODIMP CMP4SplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, MP4SourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -159,7 +159,7 @@ STDMETHODIMP CMP4SplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
void SetTrackName(CString *TrackName, CString Suffix)
{
- if(TrackName->IsEmpty()) {
+ if (TrackName->IsEmpty()) {
*TrackName = Suffix;
} else {
*TrackName += _T(" - ");
@@ -179,10 +179,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CMP4SplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -192,26 +192,26 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_framesize.SetSize(640, 480);
- if(AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie()) {
- for(AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
+ if (AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie()) {
+ for (AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
item;
item = item->GetNext()) {
AP4_Track* track = item->GetData();
- if(track->GetType() != AP4_Track::TYPE_VIDEO
+ if (track->GetType() != AP4_Track::TYPE_VIDEO
&& track->GetType() != AP4_Track::TYPE_AUDIO
&& track->GetType() != AP4_Track::TYPE_TEXT
&& track->GetType() != AP4_Track::TYPE_SUBP) {
continue;
}
- if(b_HasVideo && track->GetType() == AP4_Track::TYPE_VIDEO) {
+ if (b_HasVideo && track->GetType() == AP4_Track::TYPE_VIDEO) {
continue;
}
AP4_Sample sample;
- if(!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF) {
+ if (!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF) {
continue;
}
@@ -231,41 +231,41 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
AP4_DataBuffer empty;
- if(AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex())) {
+ if (AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex())) {
AP4_MpegSampleDescription* mpeg_desc = NULL;
- if(desc->GetType() == AP4_SampleDescription::TYPE_MPEG) {
+ if (desc->GetType() == AP4_SampleDescription::TYPE_MPEG) {
mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
- } else if(desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
+ } else if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc);
mpeg_desc = isma_desc->GetOriginalSampleDescription();
}
- if(mpeg_desc) {
+ if (mpeg_desc) {
CStringW TypeString = CStringW(mpeg_desc->GetObjectTypeString(mpeg_desc->GetObjectTypeId()));
- if((TypeString.Find(_T("UNKNOWN")) == -1) && (TypeString.Find(_T("INVALID")) == -1)) {
+ if ((TypeString.Find(_T("UNKNOWN")) == -1) && (TypeString.Find(_T("INVALID")) == -1)) {
SetTrackName(&TrackName, TypeString);
}
}
- if(AP4_MpegVideoSampleDescription* video_desc =
+ if (AP4_MpegVideoSampleDescription* video_desc =
dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc)) {
const AP4_DataBuffer* di = video_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = &empty;
}
LONG biWidth = (LONG)video_desc->GetWidth();
LONG biHeight = (LONG)video_desc->GetHeight();
- if(!biWidth || !biHeight) {
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (!biWidth || !biHeight) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
biWidth = tkhd->GetWidth()>>16;
biHeight = tkhd->GetHeight()>>16;
}
}
- if(!biWidth || !biHeight) {
+ if (!biWidth || !biHeight) {
continue;
}
@@ -279,7 +279,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
vih->bmiHeader.biHeight = biHeight;
memcpy(vih + 1, di->GetData(), di->GetDataSize());
- switch(video_desc->GetObjectTypeId()) {
+ switch (video_desc->GetObjectTypeId()) {
case AP4_MPEG4_VISUAL_OTI:
mt.subtype = FOURCCMap('v4pm');
mt.formattype = FORMAT_MPEG2Video;
@@ -333,7 +333,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::seqhdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -345,7 +345,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::seqhdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -353,13 +353,13 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown video OBI: %02x\n"), video_desc->GetObjectTypeId());
}
- } else if(AP4_MpegAudioSampleDescription* audio_desc =
- dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc)) {
+ } else if (AP4_MpegAudioSampleDescription* audio_desc =
+ dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc)) {
const AP4_DataBuffer* di = audio_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = &empty;
}
@@ -377,13 +377,13 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
memcpy(wfe + 1, di->GetData(), di->GetDataSize());
- switch(audio_desc->GetObjectTypeId()) {
+ switch (audio_desc->GetObjectTypeId()) {
case AP4_MPEG4_AUDIO_OTI:
case AP4_MPEG2_AAC_AUDIO_MAIN_OTI: // ???
case AP4_MPEG2_AAC_AUDIO_LC_OTI: // ???
case AP4_MPEG2_AAC_AUDIO_SSRP_OTI: // ???
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- if(wfe->cbSize >= 2 && wfe->nChannels < 8) {
+ if (wfe->cbSize >= 2 && wfe->nChannels < 8) {
wfe->nChannels = (((BYTE*)(wfe+1))[1]>>3) & 0xf;
wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
}
@@ -396,7 +396,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::mpahdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), false, &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), false, &mt2)) {
mt = mt2;
}
}
@@ -410,7 +410,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(sample.GetOffset());
CBaseSplitterFileEx::dtshdr h;
CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2)) {
+ if (m_pFile->Read(h, sample.GetSize(), &mt2)) {
mt = mt2;
}
}
@@ -418,28 +418,28 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown audio OBI: %02x\n"), audio_desc->GetObjectTypeId());
}
- } else if(AP4_MpegSystemSampleDescription* system_desc =
- dynamic_cast<AP4_MpegSystemSampleDescription*>(desc)) {
+ } else if (AP4_MpegSystemSampleDescription* system_desc =
+ dynamic_cast<AP4_MpegSystemSampleDescription*>(desc)) {
const AP4_DataBuffer* di = system_desc->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = &empty;
}
- switch(system_desc->GetObjectTypeId()) {
+ switch (system_desc->GetObjectTypeId()) {
case AP4_NERO_VOBSUB:
- if(di->GetDataSize() >= 16*4) {
+ if (di->GetDataSize() >= 16*4) {
CSize size(720, 576);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
size.cx = tkhd->GetWidth()>>16;
size.cy = tkhd->GetHeight()>>16;
}
const AP4_Byte* pal = di->GetData();
CAtlList<CStringA> sl;
- for(int i = 0; i < 16*4; i += 4) {
+ for (int i = 0; i < 16*4; i += 4) {
BYTE y = (pal[i+1]-16)*255/219;
BYTE u = pal[i+2];
BYTE v = pal[i+3];
@@ -473,14 +473,14 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
break;
}
- if(mt.subtype == GUID_NULL) {
+ if (mt.subtype == GUID_NULL) {
TRACE(_T("Unknown audio OBI: %02x\n"), system_desc->GetObjectTypeId());
}
- } else if(AP4_UnknownSampleDescription* unknown_desc =
- dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
+ } else if (AP4_UnknownSampleDescription* unknown_desc =
+ dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
- if(dynamic_cast<AP4_TextSampleEntry*>(sample_entry)
+ if (dynamic_cast<AP4_TextSampleEntry*>(sample_entry)
|| dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
mt.majortype = MEDIATYPE_Subtitle;
mt.subtype = MEDIASUBTYPE_ASS2;
@@ -506,22 +506,22 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.Add(mt);
}
}
- } else if(AP4_Avc1SampleEntry* avc1 = dynamic_cast<AP4_Avc1SampleEntry*>(
+ } else if (AP4_Avc1SampleEntry* avc1 = dynamic_cast<AP4_Avc1SampleEntry*>(
track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd/avc1"))) {
- if(AP4_AvcCAtom* avcC = dynamic_cast<AP4_AvcCAtom*>(avc1->GetChild(AP4_ATOM_TYPE_AVCC))) {
+ if (AP4_AvcCAtom* avcC = dynamic_cast<AP4_AvcCAtom*>(avc1->GetChild(AP4_ATOM_TYPE_AVCC))) {
SetTrackName(&TrackName, _T("MPEG4 Video (H264)"));
const AP4_DataBuffer* di = avcC->GetDecoderInfo();
- if(!di) {
+ if (!di) {
di = &empty;
}
int num = 1;
int den = 1;
- if(AP4_PaspAtom* pasp = dynamic_cast<AP4_PaspAtom*>(avc1->GetChild(AP4_ATOM_TYPE_PASP))) {
+ if (AP4_PaspAtom* pasp = dynamic_cast<AP4_PaspAtom*>(avc1->GetChild(AP4_ATOM_TYPE_PASP))) {
num = pasp->GetNum();
den = pasp->GetDen();
}
- if(num <= 0 || den <= 0) { // if bad AR
+ if (num <= 0 || den <= 0) { // if bad AR
num = den = 1; // then reset AR
}
@@ -543,7 +543,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CSize aspect(vih->hdr.bmiHeader.biWidth * num, vih->hdr.bmiHeader.biHeight * den);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
vih->hdr.dwPictAspectRatioX = aspect.cx;
@@ -563,10 +563,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE* src_end = (BYTE*)data + size;
BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + size;
- for(int i = 0; i < 2; i++) {
- for(int n = *src++ & 0x1f; n > 0; n--) {
+ for (int i = 0; i < 2; i++) {
+ for (int n = *src++ & 0x1f; n > 0; n--) {
int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end) {
+ if (src + len > src_end || dst + len > dst_end) {
ASSERT(0);
break;
}
@@ -583,11 +583,11 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.Add(mt);
b_HasVideo = true;
}
- } else if(AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
- track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd"))) {
+ } else if (AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd"))) {
const AP4_DataBuffer& db = stsd->GetDataBuffer();
- for(AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
+ for (AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
item;
item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
@@ -595,22 +595,22 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
AP4_Atom::Type type = atom->GetType();
DWORD fourcc;
- if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0)) {
+ if ((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0)) {
fourcc = type & 0xffff;
- } else if(type == AP4_ATOM_TYPE__MP3) {
+ } else if (type == AP4_ATOM_TYPE__MP3) {
SetTrackName(&TrackName, _T("MPEG Audio (MP3)"));
fourcc = 0x0055;
- } else if((type == AP4_ATOM_TYPE__AC3) || (type == AP4_ATOM_TYPE_SAC3) || (type == AP4_ATOM_TYPE_EAC3)) {
- if(type == AP4_ATOM_TYPE_EAC3) {
+ } else if ((type == AP4_ATOM_TYPE__AC3) || (type == AP4_ATOM_TYPE_SAC3) || (type == AP4_ATOM_TYPE_EAC3)) {
+ if (type == AP4_ATOM_TYPE_EAC3) {
SetTrackName(&TrackName, _T("AC-3 Audio"));
} else {
SetTrackName(&TrackName, _T("Enhanced AC-3 audio"));
}
fourcc = 0x2000;
- } else if(type == AP4_ATOM_TYPE_MP4A) {
+ } else if (type == AP4_ATOM_TYPE_MP4A) {
SetTrackName(&TrackName, _T("MPEG-2 Audio AAC"));
fourcc = WAVE_FORMAT_AAC;
- } else if(type == AP4_ATOM_TYPE_NMOS) {
+ } else if (type == AP4_ATOM_TYPE_NMOS) {
SetTrackName(&TrackName, _T("NellyMoser Audio"));
fourcc = MAKEFOURCC('N','E','L','L');
} else {
@@ -621,7 +621,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
((type << 24) & 0xff000000);
}
- if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom)) {
+ if (AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom)) {
mt.majortype = MEDIATYPE_Video;
mt.subtype = FOURCCMap(fourcc);
mt.formattype = FORMAT_VideoInfo;
@@ -642,7 +642,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
_strlwr((char*)&buff);
AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
- if(typelwr != fourcc) {
+ if (typelwr != fourcc) {
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
mts.Add(mt);
b_HasVideo = true;
@@ -651,48 +651,48 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
_strupr((char*)&buff);
AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
- if(typeupr != fourcc) {
+ if (typeupr != fourcc) {
mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
mts.Add(mt);
b_HasVideo = true;
}
break;
- } else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom)) {
+ } else if (AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom)) {
if (ase->GetEndian()==1) {
if (type==AP4_ATOM_TYPE_IN24 || type==AP4_ATOM_TYPE_IN32 ||
type==AP4_ATOM_TYPE_FL32 || type==AP4_ATOM_TYPE_FL64) {
fourcc = type; //reverse fourcc
}
}
-
+
DWORD nSampleRate = ase->GetSampleRate();
WORD nChannels = ase->GetChannelCount();
DWORD nAvgBytesPerSec = 0;
- if(type == AP4_ATOM_TYPE_EAC3) {
+ if (type == AP4_ATOM_TYPE_EAC3) {
AP4_Sample sample;
AP4_DataBuffer sample_data;
AP4_Cardinal SampleCount = track->GetSampleCount();
- if(SampleCount) {
+ if (SampleCount) {
track->ReadSample(1, sample, sample_data);
const AP4_Byte* data = sample_data.GetData();
AP4_Size size = sample_data.GetDataSize();
CGolombBuffer gb((BYTE *)data, size);
- for(; size >= 7 && gb.BitRead(16, true) != 0x0b77; size--) {
+ for (; size >= 7 && gb.BitRead(16, true) != 0x0b77; size--) {
gb.BitRead(8);
}
WORD sync = (WORD)gb.BitRead(16);
- if((size >= 7) && (sync == 0x0b77)) {
+ if ((size >= 7) && (sync == 0x0b77)) {
static int freq[] = {48000, 44100, 32000, 0};
BYTE num_blocks;
gb.BitRead(2);
gb.BitRead(3);
WORD frame_size = (gb.BitRead(11) + 1) << 1;
BYTE sr_code = gb.BitRead(2);
- if(sr_code == 3) {
+ if (sr_code == 3) {
BYTE sr_code2 = gb.BitRead(2);
nSampleRate = freq[sr_code2] / 2;
} else {
@@ -713,7 +713,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mt.formattype = FORMAT_WaveFormatEx;
wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + (type == AP4_ATOM_TYPE_MP4A ? 0 : db.GetDataSize()));
memset(wfe, 0, mt.FormatLength());
- if(!(fourcc & 0xffff0000)) {
+ if (!(fourcc & 0xffff0000)) {
wfe->wFormatTag = (WORD)fourcc;
}
wfe->nSamplesPerSec = nSampleRate;
@@ -727,7 +727,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
} else {
mt.subtype = FOURCCMap(fourcc);
}
- if(type != AP4_ATOM_TYPE_MP4A) {
+ if (type != AP4_ATOM_TYPE_MP4A) {
wfe->cbSize = db.GetDataSize();
memcpy(wfe+1, db.GetData(), db.GetDataSize());
}
@@ -740,12 +740,12 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
continue;
}
REFERENCE_TIME rtDuration = 10000i64 * track->GetDurationMs();
- if(m_rtDuration < rtDuration) {
+ if (m_rtDuration < rtDuration) {
m_rtDuration = rtDuration;
}
@@ -754,19 +754,19 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CStringW name, lang;
name.Format(L"Output %d", id);
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
name = TrackName;
}
- if(!TrackLanguage.IsEmpty()) {
- if(TrackLanguage != L"und") {
+ if (!TrackLanguage.IsEmpty()) {
+ if (TrackLanguage != L"und") {
name += " (" + TrackLanguage + ")";
}
}
- for(int i = 0, j = mts.GetCount(); i < j; i++) {
+ for (int i = 0, j = mts.GetCount(); i < j; i++) {
BITMAPINFOHEADER bih;
- if(ExtractBIH(&mts[i], &bih)) {
+ if (ExtractBIH(&mts[i], &bih)) {
m_framesize.cx = bih.biWidth;
m_framesize.cy = abs(bih.biHeight);
}
@@ -774,10 +774,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
pPinOut->SetProperty(L"NAME", TrackName);
}
- if(!TrackLanguage.IsEmpty()) {
+ if (!TrackLanguage.IsEmpty()) {
pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
}
@@ -785,7 +785,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_trackpos[id] = trackpos();
- if(mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2) {
+ if (mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2) {
LPCWSTR postfix = L" (plain text)";
mts[0].subtype = MEDIASUBTYPE_UTF8;
@@ -797,10 +797,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
- if(!TrackName.IsEmpty()) {
+ if (!TrackName.IsEmpty()) {
pPinOut->SetProperty(L"NAME", TrackName + postfix);
}
- if(!TrackLanguage.IsEmpty()) {
+ if (!TrackLanguage.IsEmpty()) {
pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
}
@@ -808,10 +808,10 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- if(AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl"))) {
+ if (AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl"))) {
AP4_Array<AP4_ChplAtom::AP4_Chapter>& chapters = chpl->GetChapters();
- for(AP4_Cardinal i = 0; i < chapters.ItemCount(); i++) {
+ for (AP4_Cardinal i = 0; i < chapters.ItemCount(); i++) {
AP4_ChplAtom::AP4_Chapter& chapter = chapters[i];
ChapAppend(chapter.Time, UTF8To16(ConvertMBCS(chapter.Name.c_str(), ANSI_CHARSET, CP_UTF8))); // this is b0rked, thx to nero :P
}
@@ -819,29 +819,29 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
ChapSort();
}
- if(AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst"))) {
+ if (AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst"))) {
CStringW title, artist, writer, album, year, appl, desc, gen, track;
- for(AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
+ for (AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
item;
item = item->GetNext()) {
- if(AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData())) {
- if(AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA))) {
+ if (AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData())) {
+ if (AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA))) {
const AP4_DataBuffer* db = data->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRKN) {
- if(db->GetDataSize() >= 4) {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRKN) {
+ if (db->GetDataSize() >= 4) {
unsigned short n = (db->GetData()[2] << 8) | db->GetData()[3];
- if(n > 0 && n < 100) {
+ if (n > 0 && n < 100) {
track.Format(L"%02d", n);
- } else if(n >= 100) {
+ } else if (n >= 100) {
track.Format(L"%d", n);
}
}
} else {
CStringW str = UTF8To16(CStringA((LPCSTR)db->GetData(), db->GetDataSize()));
- switch(atom->GetType()) {
+ switch (atom->GetType()) {
case AP4_ATOM_TYPE_NAM:
title = str;
break;
@@ -872,33 +872,33 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- if(!title.IsEmpty()) {
- if(!track.IsEmpty()) {
+ if (!title.IsEmpty()) {
+ if (!track.IsEmpty()) {
title = track + L" - " + title;
}
- if(!album.IsEmpty()) {
+ if (!album.IsEmpty()) {
title = album + L" - " + title;
}
- if(!year.IsEmpty()) {
+ if (!year.IsEmpty()) {
title += L" - " + year;
}
- if(!gen.IsEmpty()) {
+ if (!gen.IsEmpty()) {
title += L" - " + gen;
}
SetProperty(L"TITL", title);
}
- if(!artist.IsEmpty()) {
+ if (!artist.IsEmpty()) {
SetProperty(L"AUTH", artist);
- } else if(!writer.IsEmpty()) {
+ } else if (!writer.IsEmpty()) {
SetProperty(L"AUTH", writer);
}
- if(!appl.IsEmpty()) {
+ if (!appl.IsEmpty()) {
SetProperty(L"APPL", appl);
}
- if(!desc.IsEmpty()) {
+ if (!desc.IsEmpty()) {
SetProperty(L"DESC", desc);
}
}
@@ -916,7 +916,7 @@ bool CMP4SplitterFilter::DemuxInit()
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
pPair->m_value.index = 0;
@@ -925,7 +925,7 @@ bool CMP4SplitterFilter::DemuxInit()
AP4_Track* track = movie->GetTrack(pPair->m_key);
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(0, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(0, sample))) {
pPair->m_value.ts = sample.GetCts();
}
}
@@ -940,29 +940,29 @@ void CMP4SplitterFilter::DemuxSeek(REFERENCE_TIME rt)
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index))) {
+ if (AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index))) {
pPair->m_value.index = 0;
}
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample))) {
pPair->m_value.ts = sample.GetCts();
}
// FIXME: slow search & stss->m_Entries is private
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
- if(stss->m_Entries.ItemCount() > 0) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (stss->m_Entries.ItemCount() > 0) {
AP4_Cardinal i = -1;
- while(++i < stss->m_Entries.ItemCount() && stss->m_Entries[i]-1 <= pPair->m_value.index) {
+ while (++i < stss->m_Entries.ItemCount() && stss->m_Entries[i]-1 <= pPair->m_value.index) {
;
}
- if(i > 0) {
+ if (i > 0) {
i--;
}
pPair->m_value.index = stss->m_Entries[i]-1;
@@ -990,7 +990,7 @@ static CStringW ConvertTX3GToSSA(
int str_len = str.GetLength();
SSACharacter* chars = DNew SSACharacter[str_len];
- for(int i = 0; i < str_len; i++) {
+ for (int i = 0; i < str_len; i++) {
chars[i].c = str[i];
}
str.Empty();
@@ -1002,32 +1002,32 @@ static CStringW ConvertTX3GToSSA(
int align = 2;
signed char h = (signed char)desc.HorizontalJustification;
signed char v = (signed char)desc.VerticalJustification;
- if(h == 0 && v < 0) {
+ if (h == 0 && v < 0) {
align = 1;
- } else if(h > 0 && v < 0) {
+ } else if (h > 0 && v < 0) {
align = 2;
- } else if(h < 0 && v < 0) {
+ } else if (h < 0 && v < 0) {
align = 3;
- } else if(h == 0 && v > 0) {
+ } else if (h == 0 && v > 0) {
align = 4;
- } else if(h > 0 && v > 0) {
+ } else if (h > 0 && v > 0) {
align = 5;
- } else if(h < 0 && v > 0) {
+ } else if (h < 0 && v > 0) {
align = 6;
- } else if(h == 0 && v == 0) {
+ } else if (h == 0 && v == 0) {
align = 7;
- } else if(h > 0 && v == 0) {
+ } else if (h > 0 && v == 0) {
align = 8;
- } else if(h < 0 && v == 0) {
+ } else if (h < 0 && v == 0) {
align = 9;
}
str.Format(L"{\\an%d}%s", align, CStringW(str));
- if(!font.CompareNoCase(L"serif")) {
+ if (!font.CompareNoCase(L"serif")) {
font = L"Times New Roman";
- } else if(!font.CompareNoCase(L"sans-serif")) {
+ } else if (!font.CompareNoCase(L"sans-serif")) {
font = L"Arial";
- } else if(!font.CompareNoCase(L"monospace")) {
+ } else if (!font.CompareNoCase(L"monospace")) {
font = L"Courier New";
}
str.Format(L"{\\fn%s}%s", font, CStringW(str));
@@ -1055,7 +1055,7 @@ static CStringW ConvertTX3GToSSA(
const AP4_Byte* hclr = (const AP4_Byte*)&desc.BackgroundColor;
- while(size > 8) {
+ while (size > 8) {
DWORD tag_size = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
DWORD tag = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
@@ -1065,11 +1065,11 @@ static CStringW ConvertTX3GToSSA(
tag_size -= 8;
const AP4_Byte* next = mods + tag_size;
- if(tag == 'styl') {
+ if (tag == 'styl') {
WORD styl_count = (mods[0]<<8)|(mods[1]);
mods += 2;
- while(styl_count-- > 0) {
+ while (styl_count-- > 0) {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
@@ -1083,11 +1083,11 @@ static CStringW ConvertTX3GToSSA(
const AP4_Byte* color = mods;
mods += 4;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", color[2], color[1], color[0], 255 - color[3]);
@@ -1103,19 +1103,19 @@ static CStringW ConvertTX3GToSSA(
chars[end-1].post += font_flags;
}
}
- } else if(tag == 'hclr') {
+ } else if (tag == 'hclr') {
hclr = mods;
- } else if(tag == 'hlit') {
+ } else if (tag == 'hlit') {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\3c%02x%02x%02x\\3a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
@@ -1125,20 +1125,20 @@ static CStringW ConvertTX3GToSSA(
chars[start].pre += L"{\\bord0.1}";
chars[end-1].post += L"{\\bord}";
}
- } else if(tag == 'blnk') {
+ } else if (tag == 'blnk') {
WORD start = (mods[0]<<8)|(mods[1]);
mods += 2;
WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
// cheap...
- for(int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha) {
+ for (int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha) {
CStringW s;
s.Format(L"{\\t(%d, %d, \\alpha&H%02x&)}", i, i + 750, alpha);
chars[start].pre += s;
@@ -1146,7 +1146,7 @@ static CStringW ConvertTX3GToSSA(
chars[end-1].post += L"{\\alpha}";
}
- } else if(tag == 'tbox') {
+ } else if (tag == 'tbox') {
rbox.top = (mods[0]<<8)|(mods[1]);
mods += 2;
rbox.left = (mods[0]<<8)|(mods[1]);
@@ -1155,13 +1155,13 @@ static CStringW ConvertTX3GToSSA(
mods += 2;
rbox.right = (mods[0]<<8)|(mods[1]);
mods += 2;
- } else if(tag == 'krok' && !(desc.DisplayFlags & 0x800)) {
+ } else if (tag == 'krok' && !(desc.DisplayFlags & 0x800)) {
DWORD start_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
WORD krok_count = (mods[0]<<8)|(mods[1]);
mods += 2;
- while(krok_count-- > 0) {
+ while (krok_count-- > 0) {
DWORD end_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]);
mods += 4;
WORD start = (mods[0]<<8)|(mods[1]);
@@ -1169,11 +1169,11 @@ static CStringW ConvertTX3GToSSA(
WORD end = (mods[0]<<8)|(mods[1]);
mods += 2;
- if(end > str_len) {
+ if (end > str_len) {
end = str_len;
}
- if(start < end) {
+ if (start < end) {
CStringW s;
s.Format(L"{\\kt%d\\kf%d}", start_time/10, (end_time - start_time)/10);
@@ -1192,7 +1192,7 @@ static CStringW ConvertTX3GToSSA(
// continous karaoke
- if(desc.DisplayFlags & 0x800) {
+ if (desc.DisplayFlags & 0x800) {
CStringW s;
s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
@@ -1200,17 +1200,17 @@ static CStringW ConvertTX3GToSSA(
int breaks = 0;
- for(int i = 0, j = 0; i <= str_len; i++) {
- if(chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
+ for (int i = 0, j = 0; i <= str_len; i++) {
+ if (chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
breaks++;
}
}
- if(str_len > breaks) {
+ if (str_len > breaks) {
float dur = (float)max(durationms - 500, 0) / 10;
- for(int i = 0, j = 0; i <= str_len; i++) {
- if(i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
+ for (int i = 0, j = 0; i <= str_len; i++) {
+ if (i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/) {
s.Format(L"{\\kf%d}", (int)(dur * (i - j) / (str_len - breaks)));
chars[j].pre += s;
j = i+1;
@@ -1221,10 +1221,10 @@ static CStringW ConvertTX3GToSSA(
//
- for(int i = 0; i < str_len; i++) {
+ for (int i = 0; i < str_len; i++) {
str += chars[i].pre;
str += chars[i].c;
- if(desc.DisplayFlags & 0x20000) {
+ if (desc.DisplayFlags & 0x20000) {
str += L"\\N";
}
str += chars[i].post;
@@ -1234,7 +1234,7 @@ static CStringW ConvertTX3GToSSA(
//
- if(rbox.IsRectEmpty()) {
+ if (rbox.IsRectEmpty()) {
rbox.SetRect(0, 0, framesize.cx, framesize.cy);
}
rbox.OffsetRect(translation);
@@ -1243,11 +1243,11 @@ static CStringW ConvertTX3GToSSA(
rbox2.DeflateRect(2, 2);
CRect r(0,0,0,0);
- if(rbox2.Height() > 0) {
+ if (rbox2.Height() > 0) {
r.top = rbox2.top;
r.bottom = framesize.cy - rbox2.bottom;
}
- if(rbox2.Width() > 0) {
+ if (rbox2.Width() > 0) {
r.left = rbox2.left;
r.right = framesize.cx - rbox2.right;
}
@@ -1268,30 +1268,30 @@ bool CMP4SplitterFilter::DemuxLoop()
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
CAtlMap<DWORD, trackpos>::CPair* pPairNext = NULL;
REFERENCE_TIME rtNext = 0;
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
- if(!pPin->IsConnected()) {
+ if (!pPin->IsConnected()) {
continue;
}
REFERENCE_TIME rt = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * pPair->m_value.ts);
- if(pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext)) {
+ if (pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext)) {
pPairNext = pPair;
rtNext = rt;
}
}
- if(!pPairNext) {
+ if (!pPairNext) {
break;
}
@@ -1302,7 +1302,7 @@ bool CMP4SplitterFilter::DemuxLoop()
AP4_Sample sample;
AP4_DataBuffer data;
- if(pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
+ if (pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
const CMediaType& mt = pPin->CurrentMediaType();
CAutoPtr<Packet> p(DNew Packet());
@@ -1312,25 +1312,25 @@ bool CMP4SplitterFilter::DemuxLoop()
p->bSyncPoint = TRUE;
// FIXME: slow search & stss->m_Entries is private
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
- if(stss->m_Entries.ItemCount() > 0) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (stss->m_Entries.ItemCount() > 0) {
p->bSyncPoint = FALSE;
AP4_Cardinal i = -1;
- while(++i < stss->m_Entries.ItemCount())
- if(stss->m_Entries[i]-1 == pPairNext->m_value.index) {
+ while (++i < stss->m_Entries.ItemCount())
+ if (stss->m_Entries[i]-1 == pPairNext->m_value.index) {
p->bSyncPoint = TRUE;
}
}
}
//
- if(track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1) {
+ if (track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
int nBlockAlign = 1200;
- if(wfe->nBlockAlign > 1) {
+ if (wfe->nBlockAlign > 1) {
nBlockAlign = wfe->nBlockAlign;
pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
}
@@ -1339,40 +1339,40 @@ bool CMP4SplitterFilter::DemuxLoop()
TRACE(_T("track->GetSampleCount() %d %d "), track->GetSampleCount(),pPairNext->m_value.index);
int fFirst = true;
- while(AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
+ while (AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data))) {
AP4_Size size = data.GetDataSize();
const AP4_Byte* ptr = data.GetData();
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
p->Add(ptr[i]);
}
- if(fFirst) {
+ if (fFirst) {
p->rtStart = p->rtStop = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
fFirst = false;
}
p->rtStop += (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
- if(pPairNext->m_value.index+1 >= track->GetSampleCount() || (int)p->GetCount() >= nBlockAlign) {
+ if (pPairNext->m_value.index+1 >= track->GetSampleCount() || (int)p->GetCount() >= nBlockAlign) {
break;
}
pPairNext->m_value.index++;
}
- } else if(track->GetType() == AP4_Track::TYPE_TEXT) {
+ } else if (track->GetType() == AP4_Track::TYPE_TEXT) {
CStringA dlgln_bkg, dlgln_plaintext;
const AP4_Byte* ptr = data.GetData();
AP4_Size avail = data.GetDataSize();
- if(avail > 2) {
+ if (avail > 2) {
AP4_UI16 size = (ptr[0] << 8) | ptr[1];
- if(size <= avail-2) {
+ if (size <= avail-2) {
CStringA str;
- if(size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff) {
+ if (size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff) {
CStringW wstr = CStringW((LPCWSTR)&ptr[2], size/2);
- for(int i = 0; i < wstr.GetLength(); i++) {
+ for (int i = 0; i < wstr.GetLength(); i++) {
wstr.SetAt(i, ((WORD)wstr[i] >> 8) | ((WORD)wstr[i] << 8));
}
str = UTF16To8(wstr);
@@ -1382,34 +1382,34 @@ bool CMP4SplitterFilter::DemuxLoop()
CStringA dlgln = str;
- if(mt.subtype == MEDIASUBTYPE_ASS2) {
+ if (mt.subtype == MEDIASUBTYPE_ASS2) {
AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
dlgln_plaintext = str;
CPoint translation(0, 0);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
+ if (AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD))) {
AP4_Float x, y;
tkhd->GetTranslation(x, y);
translation.SetPoint((int)x, (int)y);
}
- if(AP4_UnknownSampleDescription* unknown_desc = dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
+ if (AP4_UnknownSampleDescription* unknown_desc = dynamic_cast<AP4_UnknownSampleDescription*>(desc)) { // TEMP
AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
- if(AP4_TextSampleEntry* text = dynamic_cast<AP4_TextSampleEntry*>(sample_entry)) {
+ if (AP4_TextSampleEntry* text = dynamic_cast<AP4_TextSampleEntry*>(sample_entry)) {
const AP4_TextSampleEntry::AP4_TextDescription& d = text->GetDescription();
// TODO
- } else if(AP4_Tx3gSampleEntry* tx3g = dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
+ } else if (AP4_Tx3gSampleEntry* tx3g = dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry)) {
const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc = tx3g->GetDescription();
CStringW font = L"Arial";
- if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(tx3g->GetChild(AP4_ATOM_TYPE_FTAB))) {
+ if (AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(tx3g->GetChild(AP4_ATOM_TYPE_FTAB))) {
AP4_String Name;
- if(AP4_SUCCEEDED(ftab->LookupFont(desc.Style.Font.Id, Name))) {
+ if (AP4_SUCCEEDED(ftab->LookupFont(desc.Style.Font.Id, Name))) {
font = Name.c_str();
}
}
@@ -1425,7 +1425,7 @@ bool CMP4SplitterFilter::DemuxLoop()
const AP4_Byte* bclr = (const AP4_Byte*)&desc.BackgroundColor;
- if(bclr[3]) {
+ if (bclr[3]) {
CPoint tl = rbox.TopLeft();
rbox.OffsetRect(-tl.x, -tl.y);
@@ -1450,7 +1450,7 @@ bool CMP4SplitterFilter::DemuxLoop()
}
}
- if(!dlgln_bkg.IsEmpty()) {
+ if (!dlgln_bkg.IsEmpty()) {
CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber;
p2->rtStart = p->rtStart;
@@ -1460,7 +1460,7 @@ bool CMP4SplitterFilter::DemuxLoop()
hr = DeliverPacket(p2);
}
- if(!dlgln_plaintext.IsEmpty()) {
+ if (!dlgln_plaintext.IsEmpty()) {
CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber ^ 0x80402010;
p2->rtStart = p->rtStart;
@@ -1477,7 +1477,7 @@ bool CMP4SplitterFilter::DemuxLoop()
{
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample))) {
pPairNext->m_value.ts = sample.GetCts();
}
}
@@ -1493,23 +1493,23 @@ STDMETHODIMP CMP4SplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
CheckPointer(m_pFile, E_UNEXPECTED);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO) {
+ if (track->GetType() != AP4_Track::TYPE_VIDEO) {
continue;
}
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
nKFs = stss->m_Entries.ItemCount();
return S_OK;
}
@@ -1524,32 +1524,32 @@ STDMETHODIMP CMP4SplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
CheckPointer(pKFs, E_POINTER);
CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
POSITION pos = m_trackpos.GetStartPosition();
- while(pos) {
+ while (pos) {
CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO) {
+ if (track->GetType() != AP4_Track::TYPE_VIDEO) {
continue;
}
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
+ if (AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss"))) {
nKFs = 0;
- for(AP4_Cardinal i = 0; i < stss->m_Entries.ItemCount(); i++) {
+ for (AP4_Cardinal i = 0; i < stss->m_Entries.ItemCount(); i++) {
AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(stss->m_Entries[i]-1, sample))) {
+ if (AP4_SUCCEEDED(track->GetSample(stss->m_Entries[i]-1, sample))) {
pKFs[nKFs++] = 10000000i64 * sample.GetCts() / track->GetMediaTimeScale();
}
}
@@ -1584,8 +1584,8 @@ CMPEG4VideoSplitterFilter::CMPEG4VideoSplitterFilter(LPUNKNOWN pUnk, HRESULT* ph
void CMPEG4VideoSplitterFilter::SkipUserData()
{
m_pFile->BitByteAlign();
- while(m_pFile->BitRead(32, true) == 0x000001b2)
- while(m_pFile->BitRead(24, true) != 0x000001) {
+ while (m_pFile->BitRead(32, true) == 0x000001b2)
+ while (m_pFile->BitRead(24, true) != 0x000001) {
m_pFile->BitRead(8);
}
}
@@ -1598,10 +1598,10 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -1617,31 +1617,31 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE pary = 1;
REFERENCE_TIME atpf = 400000;
- if(m_pFile->BitRead(24, true) != 0x000001) {
+ if (m_pFile->BitRead(24, true) != 0x000001) {
return E_FAIL;
}
BYTE id;
- while(m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos())) {
- if(id == 0xb5) {
+ while (m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos())) {
+ if (id == 0xb5) {
BYTE is_visual_object_identifier = (BYTE)m_pFile->BitRead(1);
- if(is_visual_object_identifier) {
+ if (is_visual_object_identifier) {
BYTE visual_object_verid = (BYTE)m_pFile->BitRead(4);
BYTE visual_object_priority = (BYTE)m_pFile->BitRead(3);
}
BYTE visual_object_type = (BYTE)m_pFile->BitRead(4);
- if(visual_object_type == 1 || visual_object_type == 2) {
+ if (visual_object_type == 1 || visual_object_type == 2) {
BYTE video_signal_type = (BYTE)m_pFile->BitRead(1);
- if(video_signal_type) {
+ if (video_signal_type) {
BYTE video_format = (BYTE)m_pFile->BitRead(3);
BYTE video_range = (BYTE)m_pFile->BitRead(1);
BYTE colour_description = (BYTE)m_pFile->BitRead(1);
- if(colour_description) {
+ if (colour_description) {
BYTE colour_primaries = (BYTE)m_pFile->BitRead(8);
BYTE transfer_characteristics = (BYTE)m_pFile->BitRead(8);
BYTE matrix_coefficients = (BYTE)m_pFile->BitRead(8);
@@ -1651,29 +1651,29 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
SkipUserData();
- if(visual_object_type == 1) {
- if(m_pFile->BitRead(24) != 0x000001) {
+ if (visual_object_type == 1) {
+ if (m_pFile->BitRead(24) != 0x000001) {
break;
}
BYTE video_object_start_code = (BYTE)m_pFile->BitRead(8);
- if(video_object_start_code < 0x00 || video_object_start_code > 0x1f) {
+ if (video_object_start_code < 0x00 || video_object_start_code > 0x1f) {
break;
}
- if(m_pFile->BitRead(24) != 0x000001) {
+ if (m_pFile->BitRead(24) != 0x000001) {
break;
}
BYTE video_object_layer_start_code = (DWORD)m_pFile->BitRead(8);
- if(video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f) {
+ if (video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f) {
break;
}
BYTE random_accessible_vol = (BYTE)m_pFile->BitRead(1);
BYTE video_object_type_indication = (BYTE)m_pFile->BitRead(8);
- if(video_object_type_indication == 0x12) { // Fine Granularity Scalable
+ if (video_object_type_indication == 0x12) { // Fine Granularity Scalable
break; // huh
}
@@ -1681,14 +1681,14 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE video_object_layer_verid = 0;
- if(is_object_layer_identifier) {
+ if (is_object_layer_identifier) {
video_object_layer_verid = (BYTE)m_pFile->BitRead(4);
BYTE video_object_layer_priority = (BYTE)m_pFile->BitRead(3);
}
BYTE aspect_ratio_info = (BYTE)m_pFile->BitRead(4);
- switch(aspect_ratio_info) {
+ switch (aspect_ratio_info) {
default:
ASSERT(0);
break;
@@ -1720,32 +1720,32 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE vol_control_parameters = (BYTE)m_pFile->BitRead(1);
- if(vol_control_parameters) {
+ if (vol_control_parameters) {
BYTE chroma_format = (BYTE)m_pFile->BitRead(2);
BYTE low_delay = (BYTE)m_pFile->BitRead(1);
BYTE vbv_parameters = (BYTE)m_pFile->BitRead(1);
- if(vbv_parameters) {
+ if (vbv_parameters) {
WORD first_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD latter_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD first_half_vbv_buffer_size = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
BYTE latter_half_vbv_buffer_size = (BYTE)m_pFile->BitRead(3);
WORD first_half_vbv_occupancy = (WORD)m_pFile->BitRead(11);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD latter_half_vbv_occupancy = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
}
@@ -1753,43 +1753,43 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE video_object_layer_shape = (BYTE)m_pFile->BitRead(2);
- if(video_object_layer_shape == 3 && video_object_layer_verid != 1) {
+ if (video_object_layer_shape == 3 && video_object_layer_verid != 1) {
BYTE video_object_layer_shape_extension = (BYTE)m_pFile->BitRead(4);
}
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
WORD vop_time_increment_resolution = (WORD)m_pFile->BitRead(16);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
BYTE fixed_vop_rate = (BYTE)m_pFile->BitRead(1);
- if(fixed_vop_rate) {
+ if (fixed_vop_rate) {
int bits = 0;
- for(WORD i = vop_time_increment_resolution; i; i /= 2) {
+ for (WORD i = vop_time_increment_resolution; i; i /= 2) {
bits++;
}
WORD fixed_vop_time_increment = m_pFile->BitRead(bits);
- if(fixed_vop_time_increment) {
+ if (fixed_vop_time_increment) {
atpf = 10000000i64 * fixed_vop_time_increment / vop_time_increment_resolution;
}
}
- if(video_object_layer_shape != 2) {
- if(video_object_layer_shape == 0) {
- if(!m_pFile->BitRead(1)) {
+ if (video_object_layer_shape != 2) {
+ if (video_object_layer_shape == 0) {
+ if (!m_pFile->BitRead(1)) {
break;
}
width = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
height = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) {
+ if (!m_pFile->BitRead(1)) {
break;
}
}
@@ -1800,12 +1800,12 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
// ...
}
}
- } else if(id == 0xb6) {
+ } else if (id == 0xb6) {
m_seqhdrsize = m_pFile->GetPos() - 4;
}
}
- if(!width || !height) {
+ if (!width || !height) {
return E_FAIL;
}
@@ -1866,19 +1866,19 @@ bool CMPEG4VideoSplitterFilter::DemuxLoop()
DWORD sync = ~0;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
- for(int i = 0; i < 65536; i++) { // don't call CheckRequest so often
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining()) {
+ for (int i = 0; i < 65536; i++) { // don't call CheckRequest so often
bool eof = !m_pFile->GetRemaining();
- if(p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof)) {
+ if (p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof)) {
hr = DeliverPacket(p);
}
- if(eof) {
+ if (eof) {
break;
}
- if(!p) {
+ if (!p) {
p.Attach(DNew Packet());
p->SetCount(0, 1024);
p->TrackNumber = 0;
diff --git a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
index 88ce5ebfa..b7331bba4 100644
--- a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
+++ b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
@@ -6,7 +6,7 @@ CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr)
: CBaseSplitterFileEx(pReader, hr, DEFAULT_CACHE_LENGTH, false)
, m_pAp4File(NULL)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
index 027b97b41..092e19334 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
+++ b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
@@ -32,7 +32,7 @@ static void LOG(LPCTSTR fmt, ...)
{
va_list args;
va_start(args, fmt);
- if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at"))) {
+ if (FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at"))) {
fseek(f, 0, 2);
_vftprintf(f, fmt, args);
fclose(f);
@@ -62,7 +62,7 @@ using namespace MatroskaReader;
static void bswap(BYTE* s, int len)
{
- for(BYTE* d = s + len-1; s < d; s++, d--) {
+ for (BYTE* d = s + len-1; s < d; s++, d--) {
*s ^= *d, *d ^= *s, *s ^= *d;
}
}
@@ -75,7 +75,7 @@ CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
, m_rtOffset(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -84,17 +84,17 @@ CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
HRESULT CMatroskaFile::Init()
{
DWORD dw;
- if(FAILED(Read(dw)) || dw != 0x1A45DFA3) {
+ if (FAILED(Read(dw)) || dw != 0x1A45DFA3) {
return E_FAIL;
}
CMatroskaNode Root(this);
- if(FAILED(Parse(&Root))) {
+ if (FAILED(Parse(&Root))) {
return E_FAIL;
}
CAutoPtr<CMatroskaNode> pSegment, pCluster;
- if((pSegment = Root.Child(0x18538067))
+ if ((pSegment = Root.Child(0x18538067))
&& (pCluster = pSegment->Child(0x1F43B675))) {
Cluster c0;
c0.ParseTimeCode(pCluster);
@@ -108,7 +108,7 @@ template <class T>
HRESULT CMatroskaFile::Read(T& var)
{
HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
- if(S_OK == hr) {
+ if (S_OK == hr) {
bswap((BYTE*)&var, sizeof(var));
}
return hr;
@@ -119,12 +119,12 @@ HRESULT CMatroskaFile::Parse(CMatroskaNode* pMN0)
BeginChunk
case 0x1A45DFA3:
m_ebml.Parse(pMN);
- if((m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION) && m_ebml.DocType != DOCTYPE_WEBM) {
+ if ((m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION) && m_ebml.DocType != DOCTYPE_WEBM) {
return E_FAIL;
}
break;
case 0x18538067:
- if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) {
+ if (m_segment.SegmentInfo.SegmentUID.IsEmpty()) {
m_segment.ParseMinimal(pMN);
}
break;
@@ -198,14 +198,14 @@ HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0)
len = pMN0->m_len;
CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
- if(!pMN) {
+ if (!pMN) {
return S_FALSE;
}
int n = 0;
do {
- switch(pMN->m_id) {
+ switch (pMN->m_id) {
case 0x1549A966:
SegmentInfo.Parse(pMN);
n++;
@@ -222,37 +222,37 @@ HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0)
Cues.Parse(pMN);
break;
}
- } while(n < 3 && pMN->Next());
+ } while (n < 3 && pMN->Next());
- if(!pMN->IsRandomAccess()) {
+ if (!pMN->IsRandomAccess()) {
return S_OK;
}
- while(MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos())) {
+ while (MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos())) {
pMN->SeekTo(pos);
pMN->Parse();
- if(pMN->m_id != 0x114D9B74) {
+ if (pMN->m_id != 0x114D9B74) {
ASSERT(0);
break;
}
MetaSeekInfo.Parse(pMN);
}
- if(n == 3) {
- if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false))) {
+ if (n == 3) {
+ if (Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false))) {
do {
Cues.Parse(pMN);
- } while(pMN->Next(true));
+ } while (pMN->Next(true));
}
- if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false))) {
+ if (Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false))) {
do {
Chapters.Parse(pMN); /*BIG UGLY HACK:*/
break;
- } while(pMN->Next(true));
+ } while (pMN->Next(true));
}
- if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false))) {
+ if (Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false))) {
do {
Attachments.Parse(pMN); /*BIG UGLY HACK:*/
break;
@@ -268,26 +268,26 @@ UINT64 Segment::GetMasterTrack()
UINT64 TrackNumber = 0, AltTrackNumber = 0;
POSITION pos1 = Tracks.GetHeadPosition();
- while(pos1 && TrackNumber == 0) {
+ while (pos1 && TrackNumber == 0) {
Track* pT = Tracks.GetNext(pos1);
POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2 && TrackNumber == 0) {
+ while (pos2 && TrackNumber == 0) {
TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
TrackNumber = pTE->TrackNumber;
break;
- } else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0) {
AltTrackNumber = pTE->TrackNumber;
}
}
}
- if(TrackNumber == 0) {
+ if (TrackNumber == 0) {
TrackNumber = AltTrackNumber;
}
- if(TrackNumber == 0) {
+ if (TrackNumber == 0) {
TrackNumber = 1;
}
@@ -296,14 +296,14 @@ UINT64 Segment::GetMasterTrack()
ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
{
- if(ChapterUID == id) {
+ if (ChapterUID == id) {
return(this);
}
POSITION pos = ChapterAtoms.GetHeadPosition();
- while(pos) {
+ while (pos) {
ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
- if(ca) {
+ if (ca) {
return ca;
}
}
@@ -314,14 +314,14 @@ ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
ChapterAtom* Segment::FindChapterAtom(UINT64 id, int nEditionEntry)
{
POSITION pos1 = Chapters.GetHeadPosition();
- while(pos1) {
+ while (pos1) {
Chapter* c = Chapters.GetNext(pos1);
POSITION pos2 = c->EditionEntries.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
EditionEntry* ee = c->EditionEntries.GetNext(pos2);
- if(nEditionEntry-- == 0) {
+ if (nEditionEntry-- == 0) {
return id == 0 ? ee : ee->FindChapterAtom(id);
}
}
@@ -470,12 +470,12 @@ case 0x23314F:
TrackTimecodeScale.Parse(pMN);
break;
case 0xE0:
- if(S_OK == v.Parse(pMN)) {
+ if (S_OK == v.Parse(pMN)) {
DescType |= DescVideo;
}
break;
case 0xE1:
- if(S_OK == a.Parse(pMN)) {
+ if (S_OK == a.Parse(pMN)) {
DescType |= DescAudio;
}
break;
@@ -496,29 +496,29 @@ static int cesort(const void* a, const void* b)
bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
{
- if(ces.ce.GetCount() == 0) {
+ if (ces.ce.GetCount() == 0) {
return true;
}
CAtlArray<ContentEncoding*> cearray;
POSITION pos = ces.ce.GetHeadPosition();
- while(pos) {
+ while (pos) {
cearray.Add(ces.ce.GetNext(pos));
}
qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
- for(int i = cearray.GetCount()-1; i >= 0; i--) {
+ for (int i = cearray.GetCount()-1; i >= 0; i--) {
ContentEncoding* ce = cearray[i];
- if(!(ce->ContentEncodingScope & Scope)) {
+ if (!(ce->ContentEncodingScope & Scope)) {
continue;
}
- if(ce->ContentEncodingType == ContentEncoding::Compression) {
- if(!data.Decompress(ce->cc)) {
+ if (ce->ContentEncodingType == ContentEncoding::Compression) {
+ if (!data.Decompress(ce->cc)) {
return false;
}
- } else if(ce->ContentEncodingType == ContentEncoding::Encryption) {
+ } else if (ce->ContentEncodingType == ContentEncoding::Encryption) {
// TODO
return false;
}
@@ -720,7 +720,7 @@ case 0xE8:
TimeSlices.Parse(pMN);
break;
case 0x75A1:
- if(fFull) {
+ if (fFull) {
ba.Parse(pMN);
}
break;
@@ -737,7 +737,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
TimeCode.Set(s);
Lacing.Parse(pMN);
- if(!fFull) {
+ if (!fFull) {
return S_OK;
}
@@ -746,7 +746,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
MatroskaReader::QWORD FrameSize;
BYTE FramesInLaceLessOne;
- switch((Lacing & 0x06) >> 1) {
+ switch ((Lacing & 0x06) >> 1) {
case 0:
// No lacing
lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
@@ -755,13 +755,13 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
// Xiph lacing
BYTE n;
pMN->Read(n);
- while(n-- > 0) {
+ while (n-- > 0) {
BYTE b;
MatroskaReader::QWORD len = 0;
do {
pMN->Read(b);
len += b;
- } while(b == 0xff);
+ } while (b == 0xff);
lens.AddTail(len);
tlen += len;
}
@@ -772,7 +772,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
pMN->Read(FramesInLaceLessOne);
FramesInLaceLessOne++;
FrameSize = ((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen)) / FramesInLaceLessOne;
- while(FramesInLaceLessOne-- > 0) {
+ while (FramesInLaceLessOne-- > 0) {
lens.AddTail(FrameSize);
}
break;
@@ -788,7 +788,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
CSignedLength DiffSize;
FrameSize = FirstFrameSize;
- while(FramesInLaceLessOne--) {
+ while (FramesInLaceLessOne--) {
DiffSize.Parse(pMN);
FrameSize += DiffSize;
lens.AddTail(FrameSize);
@@ -799,7 +799,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
}
POSITION pos = lens.GetHeadPosition();
- while(pos) {
+ while (pos) {
MatroskaReader::QWORD len = lens.GetNext(pos);
CAutoPtr<CBinary> p(DNew CBinary());
p->SetCount((INT_PTR)len);
@@ -1012,7 +1012,7 @@ HRESULT CBinary::Parse(CMatroskaNode* pMN)
bool CBinary::Compress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB) {
+ if (cc.ContentCompAlgo == ContentCompression::ZLIB) {
int res;
z_stream c_stream;
@@ -1020,7 +1020,7 @@ bool CBinary::Compress(ContentCompression& cc)
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
- if(Z_OK != (res = deflateInit(&c_stream, 9))) {
+ if (Z_OK != (res = deflateInit(&c_stream, 9))) {
return false;
}
@@ -1033,11 +1033,11 @@ bool CBinary::Compress(ContentCompression& cc)
dst = (BYTE*)realloc(dst, ++n*10);
c_stream.next_out = &dst[(n-1)*10];
c_stream.avail_out = 10;
- if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res) {
+ if (Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res) {
free(dst);
return false;
}
- } while(0 == c_stream.avail_out && Z_STREAM_END != res);
+ } while (0 == c_stream.avail_out && Z_STREAM_END != res);
deflateEnd(&c_stream);
@@ -1054,7 +1054,7 @@ bool CBinary::Compress(ContentCompression& cc)
bool CBinary::Decompress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB) {
+ if (cc.ContentCompAlgo == ContentCompression::ZLIB) {
int res;
z_stream d_stream;
@@ -1062,7 +1062,7 @@ bool CBinary::Decompress(ContentCompression& cc)
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
- if(Z_OK != (res = inflateInit(&d_stream))) {
+ if (Z_OK != (res = inflateInit(&d_stream))) {
return false;
}
@@ -1075,11 +1075,11 @@ bool CBinary::Decompress(ContentCompression& cc)
dst = (unsigned char *)realloc(dst, ++n*1000);
d_stream.next_out = &dst[(n-1)*1000];
d_stream.avail_out = 1000;
- if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res) {
+ if (Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res) {
free(dst);
return false;
}
- } while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+ } while (0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
inflateEnd(&d_stream);
@@ -1089,7 +1089,7 @@ bool CBinary::Decompress(ContentCompression& cc)
free(dst);
return true;
- } else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP) {
+ } else if (cc.ContentCompAlgo == ContentCompression::HDRSTRIP) {
InsertArrayAt(0, &cc.ContentCompSettings);
}
@@ -1102,7 +1102,7 @@ HRESULT CANSI::Parse(CMatroskaNode* pMN)
MatroskaReader::QWORD len = pMN->m_len;
CHAR c;
- while(len-- > 0 && SUCCEEDED(pMN->Read(c))) {
+ while (len-- > 0 && SUCCEEDED(pMN->Read(c))) {
*this += c;
}
@@ -1113,7 +1113,7 @@ HRESULT CUTF8::Parse(CMatroskaNode* pMN)
{
Empty();
CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len)) {
+ if (!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len)) {
return E_FAIL;
}
buff[pMN->m_len] = 0;
@@ -1124,10 +1124,10 @@ HRESULT CUTF8::Parse(CMatroskaNode* pMN)
HRESULT CUInt::Parse(CMatroskaNode* pMN)
{
m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++) {
+ for (int i = 0; i < (int)pMN->m_len; i++) {
m_val <<= 8;
HRESULT hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1138,9 +1138,9 @@ HRESULT CUInt::Parse(CMatroskaNode* pMN)
HRESULT CInt::Parse(CMatroskaNode* pMN)
{
m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++) {
+ for (int i = 0; i < (int)pMN->m_len; i++) {
HRESULT hr = pMN->Read(*((BYTE*)&m_val+7-i));
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1154,14 +1154,14 @@ HRESULT CFloat::Parse(CMatroskaNode* pMN)
HRESULT hr = E_FAIL;
m_val = 0;
- if(pMN->m_len == 4) {
+ if (pMN->m_len == 4) {
float val = 0;
hr = pMN->Read(val);
m_val = val;
- } else if(pMN->m_len == 8) {
+ } else if (pMN->m_len == 8) {
hr = pMN->Read(m_val);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
m_fValid = true;
}
return hr;
@@ -1182,32 +1182,32 @@ HRESULT CID::Parse(CMatroskaNode* pMN)
BYTE b = 0;
HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
int nMoreBytes = 0;
- if((b&0x80) == 0x80) {
+ if ((b&0x80) == 0x80) {
m_val = b&0xff;
nMoreBytes = 0;
- } else if((b&0xc0) == 0x40) {
+ } else if ((b&0xc0) == 0x40) {
m_val = b&0x7f;
nMoreBytes = 1;
- } else if((b&0xe0) == 0x20) {
+ } else if ((b&0xe0) == 0x20) {
m_val = b&0x3f;
nMoreBytes = 2;
- } else if((b&0xf0) == 0x10) {
+ } else if ((b&0xf0) == 0x10) {
m_val = b&0x1f;
nMoreBytes = 3;
} else {
return E_FAIL;
}
- while(nMoreBytes-- > 0) {
+ while (nMoreBytes-- > 0) {
m_val <<= 8;
hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -1223,34 +1223,34 @@ HRESULT CLength::Parse(CMatroskaNode* pMN)
BYTE b = 0;
HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
int nMoreBytes = 0;
- if((b&0x80) == 0x80) {
+ if ((b&0x80) == 0x80) {
m_val = b&0x7f;
nMoreBytes = 0;
- } else if((b&0xc0) == 0x40) {
+ } else if ((b&0xc0) == 0x40) {
m_val = b&0x3f;
nMoreBytes = 1;
- } else if((b&0xe0) == 0x20) {
+ } else if ((b&0xe0) == 0x20) {
m_val = b&0x1f;
nMoreBytes = 2;
- } else if((b&0xf0) == 0x10) {
+ } else if ((b&0xf0) == 0x10) {
m_val = b&0x0f;
nMoreBytes = 3;
- } else if((b&0xf8) == 0x08) {
+ } else if ((b&0xf8) == 0x08) {
m_val = b&0x07;
nMoreBytes = 4;
- } else if((b&0xfc) == 0x04) {
+ } else if ((b&0xfc) == 0x04) {
m_val = b&0x03;
nMoreBytes = 5;
- } else if((b&0xfe) == 0x02) {
+ } else if ((b&0xfe) == 0x02) {
m_val = b&0x01;
nMoreBytes = 6;
- } else if((b&0xff) == 0x01) {
+ } else if ((b&0xff) == 0x01) {
m_val = b&0x00;
nMoreBytes = 7;
} else {
@@ -1261,20 +1261,20 @@ HRESULT CLength::Parse(CMatroskaNode* pMN)
MatroskaReader::QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
- while(nMoreBytes-- > 0) {
+ while (nMoreBytes-- > 0) {
m_val <<= 8;
hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(m_val == UnknownSize) {
+ if (m_val == UnknownSize) {
m_val = pMN->GetLength() - pMN->GetPos();
TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
}
- if(m_fSigned) {
+ if (m_fSigned) {
m_val -= (UnknownSize >> 1);
}
@@ -1335,7 +1335,7 @@ HRESULT CNode<T>::Parse(CMatroskaNode* pMN)
{
CAutoPtr<T> p(DNew T());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN))) {
+ if (!p || FAILED(hr = p->Parse(pMN))) {
return hr;
}
AddTail(p);
@@ -1346,7 +1346,7 @@ HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull)
{
CAutoPtr<BlockGroup> p(DNew BlockGroup());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) {
+ if (!p || FAILED(hr = p->Parse(pMN, fFull))) {
return hr;
}
AddTail(p);
@@ -1357,7 +1357,7 @@ HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull)
{
CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) {
+ if (!p || FAILED(hr = p->Parse(pMN, fFull))) {
return hr;
}
AddTail(p);
@@ -1385,7 +1385,7 @@ CMatroskaNode::CMatroskaNode(CMatroskaNode* pParent)
HRESULT CMatroskaNode::Parse()
{
m_filepos = GetPos();
- if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this))) {
+ if (FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this))) {
return E_FAIL;
}
m_start = GetPos();
@@ -1394,12 +1394,12 @@ HRESULT CMatroskaNode::Parse()
CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
{
- if(m_len == 0) {
+ if (m_len == 0) {
return CAutoPtr<CMatroskaNode>();
}
SeekTo(m_start);
CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
- if(id && !pMN->Find(id, fSearch)) {
+ if (id && !pMN->Find(id, fSearch)) {
pMN.Free();
}
return pMN;
@@ -1407,22 +1407,22 @@ CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
bool CMatroskaNode::Next(bool fSame)
{
- if(!m_pParent) {
+ if (!m_pParent) {
return false;
}
CID id = m_id;
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
+ while (m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
SeekTo(m_start+m_len);
- if(FAILED(Parse())) {
- if(!Resync()) {
+ if (FAILED(Parse())) {
+ if (!Resync()) {
return false;
}
}
- if(!fSame || m_id == id) {
+ if (!fSame || m_id == id) {
return true;
}
}
@@ -1436,11 +1436,11 @@ bool CMatroskaNode::Find(DWORD id, bool fSearch)
? FindPos(id)
: 0;
- if(pos) {
+ if (pos) {
SeekTo(pos);
Parse();
- } else if(fSearch) {
- while(m_id != id && Next()) {
+ } else if (fSearch) {
+ while (m_id != id && Next()) {
;
}
}
@@ -1479,13 +1479,13 @@ MatroskaReader::QWORD CMatroskaNode::FindPos(DWORD id, MatroskaReader::QWORD sta
Segment& sm = m_pMF->m_segment;
POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
- while(pos) {
+ while (pos) {
Seek* s = sm.MetaSeekInfo.GetNext(pos);
POSITION pos2 = s->SeekHeads.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
SeekHead* sh = s->SeekHeads.GetNext(pos2);
- if(sh->SeekID == id && sh->SeekPosition+sm.pos >= start) {
+ if (sh->SeekID == id && sh->SeekPosition+sm.pos >= start) {
return sh->SeekPosition+sm.pos;
}
}
@@ -1509,31 +1509,31 @@ CAutoPtr<CMatroskaNode> CMatroskaNode::GetFirstBlock()
{
CAutoPtr<CMatroskaNode> pNode = Child();
do {
- if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) {
+ if (pNode->m_id == 0xA0 || pNode->m_id == 0xA3) {
return pNode;
}
- } while(pNode->Next());
+ } while (pNode->Next());
return CAutoPtr<CMatroskaNode>();
}
bool CMatroskaNode::NextBlock()
{
- if(!m_pParent) {
+ if (!m_pParent) {
return false;
}
CID id = m_id;
- while(m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
+ while (m_start+m_len < m_pParent->m_start+m_pParent->m_len) {
SeekTo(m_start+m_len);
- if(FAILED(Parse())) {
- if(!Resync()) {
+ if (FAILED(Parse())) {
+ if (!Resync()) {
return false;
}
}
- if(m_id == 0xA0 || m_id == 0xA3) {
+ if (m_id == 0xA0 || m_id == 0xA3) {
return true;
}
}
@@ -1543,11 +1543,11 @@ bool CMatroskaNode::NextBlock()
bool CMatroskaNode::Resync()
{
- if(m_pParent->m_id == 0x18538067) { /*segment?*/
+ if (m_pParent->m_id == 0x18538067) { /*segment?*/
SeekTo(m_filepos);
- for(BYTE b = 0; S_OK == Read(b); b = 0) {
- if((b&0xf0) != 0x10) {
+ for (BYTE b = 0; S_OK == Read(b); b = 0) {
+ if ((b&0xf0) != 0x10) {
continue;
}
@@ -1555,7 +1555,7 @@ bool CMatroskaNode::Resync()
Read((BYTE*)&dw+1, 3);
bswap((BYTE*)&dw, 4);
- switch(dw) {
+ switch (dw) {
case 0x1549A966: // SegmentInfo
case 0x114D9B74: // MetaSeekInfo
case 0x1654AE6B: // Tracks
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
index ca36e6d76..5b41014d2 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
+++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
@@ -111,7 +111,7 @@ STDMETHODIMP CMatroskaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, MatroskaSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -132,10 +132,10 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CAtlArray<TrackEntry*> pinOutTE;
m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -147,16 +147,16 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bool bHasVideo = 0;
POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
- while(pos) {
+ while (pos) {
Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2) {
+ while (pos2) {
TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
bool isSub = false;
- if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData)) {
+ if (!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData)) {
continue;
}
@@ -170,18 +170,18 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mt.SetSampleSize(1);
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
Name.Format(L"Video %d", iVideo++);
mt.majortype = MEDIATYPE_Video;
- if(CodecID == "V_MS/VFW/FOURCC") {
+ if (CodecID == "V_MS/VFW/FOURCC") {
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
memset(mt.Format(), 0, mt.FormatLength());
memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
- switch(pvih->bmiHeader.biCompression) {
+ switch (pvih->bmiHeader.biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -197,19 +197,19 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
}
if (!bHasVideo) {
- mts.Add(mt);
+ mts.Add(mt);
if (mt.subtype == MEDIASUBTYPE_WVC1) {
mt.subtype = MEDIASUBTYPE_WVC1_CYBERLINK;
mts.Add(mt);
}
}
bHasVideo = true;
- } else if(CodecID == "V_UNCOMPRESSED") {
- } else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6) {
+ } else if (CodecID == "V_UNCOMPRESSED") {
+ } else if (CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6) {
BYTE sps = pTE->CodecPrivate[5] & 0x1f;
std::vector<BYTE> avcC;
- for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++) {
+ for (int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++) {
avcC.push_back(pTE->CodecPrivate[i]);
}
@@ -277,9 +277,9 @@ avcsuccess:
memcpy(pSequenceHeader, data.GetData(), data.GetCount());
pm2vi->cbSequenceHeader = data.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_MPEG4/") == 0) {
+ } else if (CodecID.Find("V_MPEG4/") == 0) {
mt.subtype = FOURCCMap('V4PM');
mt.formattype = FORMAT_MPEG2Video;
MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
@@ -294,9 +294,9 @@ avcsuccess:
memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_REAL/RV") == 0) {
+ } else if (CodecID.Find("V_REAL/RV") == 0) {
mt.subtype = FOURCCMap('00VR' + ((CodecID[9]-0x30)<<16));
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
@@ -307,9 +307,9 @@ avcsuccess:
pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID == "V_DIRAC") {
+ } else if (CodecID == "V_DIRAC") {
mt.subtype = MEDIASUBTYPE_DiracVideo;
mt.formattype = FORMAT_DiracVideoInfo;
DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
@@ -325,20 +325,20 @@ avcsuccess:
dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID == "V_MPEG2") {
+ } else if (CodecID == "V_MPEG2") {
BYTE* seqhdr = pTE->CodecPrivate.GetData();
DWORD len = pTE->CodecPrivate.GetCount();
int w = pTE->v.PixelWidth;
int h = pTE->v.PixelHeight;
- if(MakeMPEG2MediaType(mt, seqhdr, len, w, h)) {
+ if (MakeMPEG2MediaType(mt, seqhdr, len, w, h)) {
if (!bHasVideo)
mts.Add(mt);
bHasVideo = true;
}
- } else if(CodecID == "V_THEORA") {
+ } else if (CodecID == "V_THEORA") {
BYTE* thdr = pTE->CodecPrivate.GetData() + 3;
mt.majortype = MEDIATYPE_Video;
@@ -354,7 +354,7 @@ avcsuccess:
vih->hdr.bmiHeader.biBitCount = 24;
int nFpsNum = (thdr[22]<<24)|(thdr[23]<<16)|(thdr[24]<<8)|thdr[25];
int nFpsDenum = (thdr[26]<<24)|(thdr[27]<<16)|(thdr[28]<<8)|thdr[29];
- if(nFpsNum) {
+ if (nFpsNum) {
vih->hdr.AvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * nFpsDenum / nFpsNum);
}
vih->hdr.dwPictAspectRatioX = (thdr[14]<<16)|(thdr[15]<<8)|thdr[16];
@@ -365,9 +365,9 @@ avcsuccess:
memcpy (&vih->dwSequenceHeader, pTE->CodecPrivate.GetData(), vih->cbSequenceHeader);
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
- } else if(CodecID.Find("V_VP8") == 0) {
+ } else if (CodecID.Find("V_VP8") == 0) {
mt.subtype = FOURCCMap('08PV');
mt.formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
@@ -378,7 +378,7 @@ avcsuccess:
pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
if (!bHasVideo)
- mts.Add(mt);
+ mts.Add(mt);
bHasVideo = true;
}
/*
@@ -395,15 +395,15 @@ avcsuccess:
*/
REFERENCE_TIME AvgTimePerFrame = 0;
- if(pTE->v.FramePerSec > 0) {
+ if (pTE->v.FramePerSec > 0) {
AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
- } else if(pTE->DefaultDuration > 0) {
+ } else if (pTE->DefaultDuration > 0) {
AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
}
- if(AvgTimePerFrame) {
- for(size_t i = 0; i < mts.GetCount(); i++) {
- if(mts[i].formattype == FORMAT_VideoInfo
+ if (AvgTimePerFrame) {
+ for (size_t i = 0; i < mts.GetCount(); i++) {
+ if (mts[i].formattype == FORMAT_VideoInfo
|| mts[i].formattype == FORMAT_VideoInfo2
|| mts[i].formattype == FORMAT_MPEG2Video) {
((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
@@ -411,9 +411,9 @@ avcsuccess:
}
}
- if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0) {
- for(size_t i = 0; i < mts.GetCount(); i++) {
- if(mts[i].formattype == FORMAT_VideoInfo) {
+ if (pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0) {
+ for (size_t i = 0; i < mts.GetCount(); i++) {
+ if (mts[i].formattype == FORMAT_VideoInfo) {
mt = mts[i];
DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
@@ -426,16 +426,16 @@ avcsuccess:
CSize aspect(pTE->v.DisplayWidth, pTE->v.DisplayHeight);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = aspect.cx;
((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = aspect.cy;
mts.InsertAt(i++, mt);
- } else if(mts[i].formattype == FORMAT_MPEG2Video) {
+ } else if (mts[i].formattype == FORMAT_MPEG2Video) {
CSize aspect(pTE->v.DisplayWidth, pTE->v.DisplayHeight);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = aspect.cx;
@@ -443,7 +443,7 @@ avcsuccess:
}
}
}
- } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio) {
Name.Format(L"Audio %d", iAudio++);
mt.majortype = MEDIATYPE_Audio;
@@ -459,7 +459,7 @@ avcsuccess:
static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
- if(id2ft.IsEmpty()) {
+ if (id2ft.IsEmpty()) {
id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
id2ft["A_MPEG/L1"] = WAVE_FORMAT_MPEG;
@@ -476,8 +476,8 @@ avcsuccess:
}
int wFormatTag;
- if(id2ft.Lookup(CodecID, wFormatTag)) {
- if(wFormatTag < 0) {
+ if (id2ft.Lookup(CodecID, wFormatTag)) {
+ if (wFormatTag < 0) {
wFormatTag = -wFormatTag;
wfe->cbSize = pTE->CodecPrivate.GetCount();
wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
@@ -491,11 +491,11 @@ avcsuccess:
}
mts.Add(mt);
- if(wFormatTag == WAVE_FORMAT_FLAC) {
+ if (wFormatTag == WAVE_FORMAT_FLAC) {
mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
mts.InsertAt(0, mt);
}
- } else if(CodecID == "A_PCM/INT/LIT") {
+ } else if (CodecID == "A_PCM/INT/LIT") {
mt.subtype = MEDIASUBTYPE_PCM;
if (pTE->a.Channels <= 2 && pTE->a.BitDepth <= 16) {
wfe->wFormatTag = WAVE_FORMAT_PCM;
@@ -516,7 +516,7 @@ avcsuccess:
mt.SetSampleSize(wfex->Format.nBlockAlign);
}
mts.Add(mt);
- } else if(CodecID == "A_MS/ACM") {
+ } else if (CodecID == "A_MS/ACM") {
wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
if (wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE && wfe->cbSize == 22) {
@@ -524,26 +524,26 @@ avcsuccess:
}
else mt.subtype = FOURCCMap(wfe->wFormatTag);
mts.Add(mt);
- } else if(CodecID == "A_VORBIS") {
+ } else if (CodecID == "A_VORBIS") {
BYTE* p = pTE->CodecPrivate.GetData();
CAtlArray<int> sizes;
- for(BYTE n = *p++; n > 0; n--) {
+ for (BYTE n = *p++; n > 0; n--) {
int size = 0;
do {
size += *p;
- } while(*p++ == 0xff);
+ } while (*p++ == 0xff);
sizes.Add(size);
}
int totalsize = 0;
- for(size_t i = 0; i < sizes.GetCount(); i++) {
+ for (size_t i = 0; i < sizes.GetCount(); i++) {
totalsize += sizes[i];
}
sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
totalsize += sizes[sizes.GetCount()-1];
- if(sizes.GetCount() == 3) {
+ if (sizes.GetCount() == 3) {
mt.subtype = MEDIASUBTYPE_Vorbis2;
mt.formattype = FORMAT_VorbisFormat2;
VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
@@ -552,7 +552,7 @@ avcsuccess:
pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
- for(size_t i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++) {
+ for (size_t i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++) {
memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
}
@@ -567,22 +567,22 @@ avcsuccess:
vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = (DWORD)-1;
mts.Add(mt);
- } else if(CodecID.Find("A_AAC/") == 0) {
+ } else if (CodecID.Find("A_AAC/") == 0) {
mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
wfe->cbSize = 2;
int profile;
- if(CodecID.Find("/MAIN") > 0) {
+ if (CodecID.Find("/MAIN") > 0) {
profile = 0;
- } else if(CodecID.Find("/SBR") > 0) {
+ } else if (CodecID.Find("/SBR") > 0) {
profile = -1;
- } else if(CodecID.Find("/LC") > 0) {
+ } else if (CodecID.Find("/LC") > 0) {
profile = 1;
- } else if(CodecID.Find("/SSR") > 0) {
+ } else if (CodecID.Find("/SSR") > 0) {
profile = 2;
- } else if(CodecID.Find("/LTP") > 0) {
+ } else if (CodecID.Find("/LTP") > 0) {
profile = 3;
} else {
continue;
@@ -592,14 +592,14 @@ avcsuccess:
mts.Add(mt);
- if(profile < 0) {
+ if (profile < 0) {
wfe->cbSize = cbSize;
wfe->nSamplesPerSec *= 2;
wfe->nAvgBytesPerSec *= 2;
mts.InsertAt(0, mt);
}
- } else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11) {
+ } else if (CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11) {
mt.subtype = FOURCCMap((DWORD)CodecID[7]|((DWORD)CodecID[8]<<8)|((DWORD)CodecID[9]<<16)|((DWORD)CodecID[10]<<24));
mt.bTemporalCompression = TRUE;
wfe->cbSize = pTE->CodecPrivate.GetCount();
@@ -608,8 +608,8 @@ avcsuccess:
wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
mts.Add(mt);
}
- } else if(pTE->TrackType == TrackEntry::TypeSubtitle) {
- if(iSubtitle == 1) {
+ } else if (pTE->TrackType == TrackEntry::TypeSubtitle) {
+ if (iSubtitle == 1) {
InstallFonts();
}
@@ -617,7 +617,7 @@ avcsuccess:
mt.SetSampleSize(1);
- if(CodecID == "S_TEXT/ASCII") {
+ if (CodecID == "S_TEXT/ASCII") {
mt.majortype = MEDIATYPE_Text;
mt.subtype = MEDIASUBTYPE_NULL;
mt.formattype = FORMAT_None;
@@ -650,14 +650,14 @@ avcsuccess:
CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
MEDIASUBTYPE_NULL;
- if(mt.subtype != MEDIASUBTYPE_NULL) {
+ if (mt.subtype != MEDIASUBTYPE_NULL) {
mts.Add(mt);
isSub = true;
}
}
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
continue;
}
@@ -675,10 +675,10 @@ avcsuccess:
HRESULT hr;
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin(pTE->MinCache, pTE->DefaultDuration / 100, mts, Name, this, this, &hr));
- if(!pTE->Name.IsEmpty()) {
+ if (!pTE->Name.IsEmpty()) {
pPinOut->SetProperty(L"NAME", pTE->Name);
}
- if(pTE->Language.GetLength() == 3) {
+ if (pTE->Language.GetLength() == 3) {
pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
}
@@ -693,7 +693,7 @@ avcsuccess:
}
}
- for(size_t i = 0; i < pinOut.GetCount(); i++) {
+ for (size_t i = 0; i < pinOut.GetCount(); i++) {
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
pPinOut.Attach(pinOut[i]);
@@ -709,7 +709,7 @@ avcsuccess:
Info& info = m_pFile->m_segment.SegmentInfo;
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
m_rtDuration = (REFERENCE_TIME)(info.Duration * info.TimeCodeScale / 100);
}
@@ -735,17 +735,17 @@ avcsuccess:
{
POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos) {
+ while (pos) {
Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
POSITION pos = pA->AttachedFiles.GetHeadPosition();
- while(pos) {
+ while (pos) {
AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
CAtlArray<BYTE> pData;
pData.SetCount(pF->FileDataLen);
m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount()))) {
+ if (SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount()))) {
ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
}
}
@@ -754,11 +754,11 @@ avcsuccess:
// chapters
- if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0)) {
+ if (ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0)) {
CStringA str;
str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
CStringA ChapLanguage = CStringA(ISO6391To6392(str));
- if(ChapLanguage.GetLength() < 3) {
+ if (ChapLanguage.GetLength() < 3) {
ChapLanguage = "eng";
}
@@ -772,26 +772,26 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int
{
CStringW tabs('+', level);
- if(!tabs.IsEmpty()) {
+ if (!tabs.IsEmpty()) {
tabs += ' ';
}
POSITION pos = parent->ChapterAtoms.GetHeadPosition();
- while(pos) {
+ while (pos) {
// ChapUID zero not allow by Matroska specs
UINT64 ChapUID = parent->ChapterAtoms.GetNext(pos)->ChapterUID;
ChapterAtom* ca = (ChapUID == 0) ? NULL : m_pFile->m_segment.FindChapterAtom(ChapUID);
- if(ca) {
+ if (ca) {
CStringW name, first;
POSITION pos = ca->ChapterDisplays.GetHeadPosition();
- while(pos) {
+ while (pos) {
ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
- if(first.IsEmpty()) {
+ if (first.IsEmpty()) {
first = cd->ChapString;
}
- if(cd->ChapLanguage == lng) {
+ if (cd->ChapLanguage == lng) {
name = cd->ChapString;
}
}
@@ -800,7 +800,7 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int
ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, name);
- if(!ca->ChapterAtoms.IsEmpty()) {
+ if (!ca->ChapterAtoms.IsEmpty()) {
SetupChapters(lng, ca, level+1);
}
}
@@ -811,22 +811,22 @@ void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int
void CMatroskaSplitterFilter::InstallFonts()
{
POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos) {
+ while (pos) {
Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
POSITION p2 = pA->AttachedFiles.GetHeadPosition();
- while(p2) {
+ while (p2) {
AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
- if(pF->FileMimeType == "application/x-truetype-font" ||
- pF->FileMimeType == "application/x-font-ttf" ||
- pF->FileMimeType == "application/vnd.ms-opentype") {
+ if (pF->FileMimeType == "application/x-truetype-font" ||
+ pF->FileMimeType == "application/x-font-ttf" ||
+ pF->FileMimeType == "application/vnd.ms-opentype") {
// assume this is a font resource
- if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen]) {
+ if (BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen]) {
m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen))) {
+ if (SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen))) {
//m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
m_fontinst.InstallFontMemory(pData, (UINT)pF->FileDataLen);
}
@@ -843,28 +843,28 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample()
HRESULT hr;
POSITION pos = m_pTrackEntryMap.GetStartPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNumber = 0;
TrackEntry* pTE = NULL;
m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
- if(!(pTE && pPin && pPin->IsConnected())) {
+ if (!(pTE && pPin && pPin->IsConnected())) {
continue;
}
- if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
+ if (pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
&& pTE->CodecPrivate.GetCount() > 0) {
BYTE* ptr = pTE->CodecPrivate.GetData();
CAtlList<int> sizes;
long last = 0;
- for(BYTE n = *ptr++; n > 0; n--) {
+ for (BYTE n = *ptr++; n > 0; n--) {
int size = 0;
do {
size += *ptr;
- } while(*ptr++ == 0xff);
+ } while (*ptr++ == 0xff);
sizes.AddTail(size);
last += size;
}
@@ -873,7 +873,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample()
hr = S_OK;
POSITION pos = sizes.GetHeadPosition();
- while(pos && SUCCEEDED(hr)) {
+ while (pos && SUCCEEDED(hr)) {
long len = sizes.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet());
@@ -888,7 +888,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample()
hr = DeliverPacket(p);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
}
}
@@ -900,7 +900,7 @@ bool CMatroskaSplitterFilter::DemuxInit()
SetThreadName((DWORD)-1, "CMatroskaSplitterFilter");
CMatroskaNode Root(m_pFile);
- if(!m_pFile
+ if (!m_pFile
|| !(m_pSegment = Root.Child(0x18538067))
|| !(m_pCluster = m_pSegment->Child(0x1F43B675))) {
return false;
@@ -908,7 +908,7 @@ bool CMatroskaSplitterFilter::DemuxInit()
// reindex if needed
- if(m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0) {
+ if (m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0) {
m_nOpenProgress = 0;
m_pFile->m_segment.SegmentInfo.Duration.Set(0);
@@ -933,18 +933,18 @@ bool CMatroskaSplitterFilter::DemuxInit()
m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
}
}
- } while(!m_fAbort && m_pCluster->Next(true));
+ } while (!m_fAbort && m_pCluster->Next(true));
m_nOpenProgress = 100;
- if(!m_fAbort) {
+ if (!m_fAbort) {
m_pFile->m_segment.Cues.AddTail(pCue);
}
@@ -962,7 +962,7 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
m_pCluster = m_pSegment->Child(0x1F43B675);
m_pBlock.Free();
- if(rt > 0) {
+ if (rt > 0) {
rt += m_pFile->m_rtOffset;
MatroskaReader::QWORD lastCueClusterPosition = (MatroskaReader::QWORD)-1;
@@ -972,26 +972,26 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
UINT64 TrackNumber = s.GetMasterTrack();
POSITION pos1 = s.Cues.GetHeadPosition();
- while(pos1) {
+ while (pos1) {
Cue* pCue = s.Cues.GetNext(pos1);
POSITION pos2 = pCue->CuePoints.GetTailPosition();
- while(pos2) {
+ while (pos2) {
CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
- if(rt < s.GetRefTime(pCuePoint->CueTime)) {
+ if (rt < s.GetRefTime(pCuePoint->CueTime)) {
continue;
}
POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
- while(pos3) {
+ while (pos3) {
CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
- if(TrackNumber != pCueTrackPositions->CueTrack) {
+ if (TrackNumber != pCueTrackPositions->CueTrack) {
continue;
}
- if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition) {
+ if (lastCueClusterPosition == pCueTrackPositions->CueClusterPosition) {
continue;
}
@@ -1014,47 +1014,47 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
Cluster c;
c.ParseTimeCode(m_pCluster);
- if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock()) {
+ if (CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock()) {
bool fPassedCueTime = false;
do {
CBlockGroupNode bgn;
- if(pBlock->m_id == 0xA0) {
+ if (pBlock->m_id == 0xA0) {
bgn.Parse(pBlock, true);
- } else if(pBlock->m_id == 0xA3) {
+ } else if (pBlock->m_id == 0xA3) {
CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) {
+ if (!(bg->Block.Lacing & 0x80)) {
bg->ReferenceBlock.Set(0); // not a kf
}
bgn.AddTail(bg);
}
POSITION pos4 = bgn.GetHeadPosition();
- while(!fPassedCueTime && pos4) {
+ while (!fPassedCueTime && pos4) {
BlockGroup* bg = bgn.GetNext(pos4);
- if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
+ if (bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
|| rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) { // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
fPassedCueTime = true;
- } else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid()) {
+ } else if (bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid()) {
fFoundKeyFrame = true;
m_pBlock = pBlock->Copy();
}
}
- } while(!fPassedCueTime && pBlock->NextBlock());
+ } while (!fPassedCueTime && pBlock->NextBlock());
}
}
- if(fFoundKeyFrame) {
+ if (fFoundKeyFrame) {
pos1 = pos2 = pos3 = NULL;
}
}
}
}
- if(!m_pBlock) {
+ if (!m_pBlock) {
m_pCluster = m_pSegment->Child(0x1F43B675);
}
}
@@ -1070,28 +1070,28 @@ bool CMatroskaSplitterFilter::DemuxLoop()
Cluster c;
c.ParseTimeCode(m_pCluster);
- if(!m_pBlock) {
+ if (!m_pBlock) {
m_pBlock = m_pCluster->GetFirstBlock();
}
- if(!m_pBlock) {
+ if (!m_pBlock) {
continue;
}
do {
CBlockGroupNode bgn;
- if(m_pBlock->m_id == 0xA0) {
+ if (m_pBlock->m_id == 0xA0) {
bgn.Parse(m_pBlock, true);
- } else if(m_pBlock->m_id == 0xA3) {
+ } else if (m_pBlock->m_id == 0xA3) {
CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(m_pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) {
+ if (!(bg->Block.Lacing & 0x80)) {
bg->ReferenceBlock.Set(0); // not a kf
}
bgn.AddTail(bg);
}
- while(bgn.GetCount() && SUCCEEDED(hr)) {
+ while (bgn.GetCount() && SUCCEEDED(hr)) {
CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
p->bg = bgn.RemoveHead();
@@ -1108,13 +1108,13 @@ bool CMatroskaSplitterFilter::DemuxLoop()
p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
// Fix subtitle with duration = 0
- if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid()) {
+ if (pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid()) {
p->bg->BlockDuration.Set(1); // just setting it to be valid
p->rtStop = p->rtStart;
}
POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
pTE->Expand(*pb, ContentEncoding::AllFrameContents);
}
@@ -1125,11 +1125,11 @@ bool CMatroskaSplitterFilter::DemuxLoop()
hr = DeliverPacket(p);
}
- } while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
+ } while (m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
m_pBlock.Free();
- } while(m_pFile->GetPos() < (__int64)(m_pFile->m_segment.pos + m_pFile->m_segment.len)
- && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
+ } while (m_pFile->GetPos() < (__int64)(m_pFile->m_segment.pos + m_pFile->m_segment.len)
+ && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
m_pCluster.Free();
@@ -1140,7 +1140,7 @@ bool CMatroskaSplitterFilter::DemuxLoop()
STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
@@ -1149,7 +1149,7 @@ STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
nKFs = 0;
POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos) {
+ while (pos) {
nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
}
@@ -1161,21 +1161,21 @@ STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENC
CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos1 && nKFsTmp < nKFs) {
+ while (pos1 && nKFsTmp < nKFs) {
Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
POSITION pos2 = pCue->CuePoints.GetHeadPosition();
- while(pos2 && nKFsTmp < nKFs) {
+ while (pos2 && nKFsTmp < nKFs) {
pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
}
}
@@ -1231,11 +1231,11 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
// send out the last remaining packets from the queue
- while(m_rob.GetCount()) {
+ while (m_rob.GetCount()) {
MatroskaPacket* mp = m_rob.RemoveHead();
- if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid()) {
+ if (m_rob.GetCount() && !mp->bg->BlockDuration.IsValid()) {
mp->rtStop = m_rob.GetHead()->rtStart;
- } else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0) {
+ } else if (m_rob.GetCount() == 0 && m_rtDefaultDuration > 0) {
mp->rtStop = mp->rtStart + m_rtDefaultDuration;
}
@@ -1243,9 +1243,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
m_tos.AddTail(to);
}
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1256,7 +1256,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
- if(!mp) {
+ if (!mp) {
return __super::DeliverPacket(p);
}
@@ -1271,11 +1271,11 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
POSITION pos = m_rob.GetTailPosition();
_ASSERTE(m_nMinCache > 0);
- for(int i = m_nMinCache - 1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; --i) {
+ for (int i = m_nMinCache - 1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; --i) {
m_rob.GetPrev(pos);
}
- if(!pos) {
+ if (!pos) {
m_rob.AddHead(mp);
} else {
m_rob.InsertAfter(pos, mp);
@@ -1283,15 +1283,15 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
mp = NULL;
- if(m_rob.GetCount() == m_nMinCache + 1) {
+ if (m_rob.GetCount() == m_nMinCache + 1) {
ASSERT(m_nMinCache > 0);
pos = m_rob.GetHeadPosition();
MatroskaPacket* mp1 = m_rob.GetNext(pos);
MatroskaPacket* mp2 = m_rob.GetNext(pos);
- if(!mp1->bg->BlockDuration.IsValid()) {
+ if (!mp1->bg->BlockDuration.IsValid()) {
mp1->bg->BlockDuration.Set(1); // just to set it valid
- if(mp1->rtStart >= mp2->rtStart) {
+ if (mp1->rtStart >= mp2->rtStart) {
/* CString str;
str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
AfxMessageBox(str);
@@ -1303,9 +1303,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
}
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
mp = m_packets.GetHead();
- if(!mp->bg->BlockDuration.IsValid()) {
+ if (!mp->bg->BlockDuration.IsValid()) {
break;
}
@@ -1314,7 +1314,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
m_tos.AddTail(to);
HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1326,7 +1326,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
{
HRESULT hr = S_FALSE;
- if(m_tos.GetCount()) {
+ if (m_tos.GetCount()) {
timeoverride to = m_tos.RemoveHead();
// if(p->TrackNumber == 2)
TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
@@ -1343,7 +1343,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
rtStop = p->rtStart + rtDelta;
POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
tmp->bDiscontinuity = p->bDiscontinuity;
@@ -1351,7 +1351,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
tmp->rtStart = rtStart;
tmp->rtStop = rtStop;
tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
- if(S_OK != (hr = DeliverPacket(tmp))) {
+ if (S_OK != (hr = DeliverPacket(tmp))) {
break;
}
@@ -1362,9 +1362,9 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
p->bDiscontinuity = false;
}
- if(m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4)) {
+ if (m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4)) {
POSITION pos = p->bg->ba.bm.GetHeadPosition();
- while(pos) {
+ while (pos) {
const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
@@ -1373,7 +1373,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
tmp->rtStart = p->rtStart;
tmp->rtStop = p->rtStop;
tmp->Copy(bm->BlockAdditional);
- if(S_OK != (hr = DeliverPacket(tmp))) {
+ if (S_OK != (hr = DeliverPacket(tmp))) {
break;
}
}
@@ -1386,7 +1386,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
TrackEntry* CMatroskaSplitterFilter::GetTrackEntryAt(UINT aTrackIdx)
{
- if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount()) {
+ if (aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount()) {
return NULL;
}
return m_pOrderedTrackArray[aTrackIdx];
@@ -1400,7 +1400,7 @@ STDMETHODIMP_(UINT) CMatroskaSplitterFilter::GetTrackCount()
STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return FALSE;
}
@@ -1408,7 +1408,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct
pStructureToFill->FlagForced = !!pTE->FlagForced;
pStructureToFill->FlagLacing = !!pTE->FlagLacing;
strncpy(pStructureToFill->Language, pTE->Language, 3);
- if(pStructureToFill->Language[0] == '\0') {
+ if (pStructureToFill->Language[0] == '\0') {
strncpy(pStructureToFill->Language, "eng", 3);
}
pStructureToFill->Language[3] = '\0';
@@ -1421,11 +1421,11 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct
STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return FALSE;
}
- if(pTE->TrackType == TrackEntry::TypeVideo) {
+ if (pTE->TrackType == TrackEntry::TypeVideo) {
TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
@@ -1434,7 +1434,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx
pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
- } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ } else if (pTE->TrackType == TrackEntry::TypeAudio) {
TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
pTEIA->Channels = (UINT)pTE->a.Channels;
@@ -1450,7 +1450,7 @@ STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->Name.AllocSysString();
@@ -1459,7 +1459,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecID.ToString().AllocSysString();
@@ -1468,7 +1468,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecName.AllocSysString();
@@ -1477,7 +1477,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecInfoURL.AllocSysString();
@@ -1486,7 +1486,7 @@ STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecDownloadURL(UINT aTrackIdx)
{
TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL) {
+ if (pTE == NULL) {
return NULL;
}
return pTE->CodecDownloadURL.AllocSysString();
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
index 9913040cd..9fb03dd10 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
+++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
@@ -36,7 +36,7 @@ protected:
int GetDataSize() {
int size = 0;
POSITION pos = bg->Block.BlockData.GetHeadPosition();
- while(pos) {
+ while (pos) {
size += bg->Block.BlockData.GetNext(pos)->GetCount();
}
return size;
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.cpp b/src/filters/parser/MpaSplitter/MpaSplitter.cpp
index d30ad5a5f..37aca92f8 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitter.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitter.cpp
@@ -98,7 +98,7 @@ STDMETHODIMP CMpaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, MpaSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -114,10 +114,10 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CMpaSplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -132,22 +132,22 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
CStringW str, title;
- if(m_pFile->m_tags.Lookup('TIT2', str)) {
+ if (m_pFile->m_tags.Lookup('TIT2', str)) {
title = str;
}
- if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) {
+ if (m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) {
title += L" (" + str + L")";
}
- if(!title.IsEmpty()) {
+ if (!title.IsEmpty()) {
SetProperty(L"TITL", title);
}
- if(m_pFile->m_tags.Lookup('TPE1', str)) {
+ if (m_pFile->m_tags.Lookup('TPE1', str)) {
SetProperty(L"AUTH", str);
}
- if(m_pFile->m_tags.Lookup('TCOP', str)) {
+ if (m_pFile->m_tags.Lookup('TCOP', str)) {
SetProperty(L"CPYR", str);
}
- if(m_pFile->m_tags.Lookup('COMM', str)) {
+ if (m_pFile->m_tags.Lookup('COMM', str)) {
SetProperty(L"DESC", str);
}
@@ -167,7 +167,7 @@ STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration)
bool CMpaSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CMpaSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -181,7 +181,7 @@ void CMpaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
__int64 startpos = m_pFile->GetStartPos();
__int64 endpos = m_pFile->GetEndPos();
- if(rt <= 0 || m_pFile->GetDuration() <= 0) {
+ if (rt <= 0 || m_pFile->GetDuration() <= 0) {
m_pFile->Seek(startpos);
m_rtStart = 0;
} else {
@@ -198,8 +198,8 @@ bool CMpaSplitterFilter::DemuxLoop()
int FrameSize;
REFERENCE_TIME rtDuration;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9) {
- if(!m_pFile->Sync(FrameSize, rtDuration)) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9) {
+ if (!m_pFile->Sync(FrameSize, rtDuration)) {
Sleep(1);
continue;
}
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
index fddbc1737..f14a79221 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
@@ -82,7 +82,7 @@ CMpaSplitterFile::CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
, m_totalbps(0)
, m_bIsVBR(false)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = Init();
}
}
@@ -94,14 +94,14 @@ HRESULT CMpaSplitterFile::Init()
Seek(0);
- if(BitRead(24, true) == 0x000001) {
+ if (BitRead(24, true) == 0x000001) {
return E_FAIL;
}
- if(m_endpos > 128 && IsRandomAccess()) {
+ if (m_endpos > 128 && IsRandomAccess()) {
Seek(m_endpos - 128);
- if(BitRead(24) == 'TAG') {
+ if (BitRead(24) == 'TAG') {
m_endpos -= 128;
CStringA str;
@@ -128,13 +128,13 @@ HRESULT CMpaSplitterFile::Init()
// track
LPCSTR s = str;
- if(s[28] == 0 && s[29] != 0) {
+ if (s[28] == 0 && s[29] != 0) {
m_tags['TRCK'].Format(L"%d", s[29]);
}
// genre
BYTE genre = (BYTE)BitRead(8);
- if(genre < countof(s_genre)) {
+ if (genre < countof(s_genre)) {
m_tags['TCON'] = CStringW(s_genre[genre]);
}
}
@@ -144,7 +144,7 @@ HRESULT CMpaSplitterFile::Init()
bool MP3_find = false;
- while(BitRead(24, true) == 'ID3') {
+ while (BitRead(24, true) == 'ID3') {
MP3_find = true;
BitRead(24);
@@ -156,19 +156,19 @@ HRESULT CMpaSplitterFile::Init()
BYTE flags = (BYTE)BitRead(8);
UNUSED_ALWAYS(flags);
DWORD size = 0;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 21;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 14;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7) << 7;
- if(BitRead(1) != 0) {
+ if (BitRead(1) != 0) {
return E_FAIL;
}
size |= BitRead(7);
@@ -177,10 +177,10 @@ HRESULT CMpaSplitterFile::Init()
// TODO: read extended header
- if(major <= 4) {
+ if (major <= 4) {
__int64 pos = GetPos();
- while(pos < m_startpos) {
+ while (pos < m_startpos) {
Seek(pos);
DWORD tag = (DWORD)BitRead(32);
@@ -194,11 +194,11 @@ HRESULT CMpaSplitterFile::Init()
pos += 4+4+2+size;
- if(!size || pos >= m_startpos) {
+ if (!size || pos >= m_startpos) {
break;
}
- if(tag == 'TIT2'
+ if (tag == 'TIT2'
|| tag == 'TPE1'
|| tag == 'TALB'
|| tag == 'TYER'
@@ -212,16 +212,16 @@ HRESULT CMpaSplitterFile::Init()
CStringA str;
CStringW wstr;
- if(encoding > 0 && size >= 2 && bom == 0xfffe) {
+ if (encoding > 0 && size >= 2 && bom == 0xfffe) {
BitRead(16);
size = (size - 2) / 2;
ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
m_tags[tag] = wstr.Trim();
- } else if(encoding > 0 && size >= 2 && bom == 0xfeff) {
+ } else if (encoding > 0 && size >= 2 && bom == 0xfeff) {
BitRead(16);
size = (size - 2) / 2;
ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
- for(int i = 0, j = wstr.GetLength(); i < j; i++) {
+ for (int i = 0, j = wstr.GetLength(); i < j; i++) {
wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
}
m_tags[tag] = wstr.Trim();
@@ -235,7 +235,7 @@ HRESULT CMpaSplitterFile::Init()
Seek(m_startpos);
- for(int i = 0; i < (1<<20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++) {
+ for (int i = 0; i < (1<<20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++) {
BitRead(8), m_startpos++;
}
}
@@ -244,16 +244,16 @@ HRESULT CMpaSplitterFile::Init()
__int64 startpos;
__int64 syncpos;
-
- if(!MP3_find) { // if no 'ID3' tag at begin of file
+
+ if (!MP3_find) { // if no 'ID3' tag at begin of file
Seek(m_startpos);
searchlen = min(m_endpos - m_startpos, 4);
- if(Read(m_mpahdr, searchlen, true, &m_mt)) {
+ if (Read(m_mpahdr, searchlen, true, &m_mt)) {
MP3_find = true;
}
}
- if(MP3_find) {
+ if (MP3_find) {
__int64 startpos_mp3 = m_startpos;
while (m_mode == none) {
searchlen = min(m_endpos - startpos_mp3, 0x200);
@@ -263,7 +263,7 @@ HRESULT CMpaSplitterFile::Init()
syncpos = startpos_mp3 + searchlen;
// Check for a valid MPA header
- if(Read(m_mpahdr, searchlen, true, &m_mt)) {
+ if (Read(m_mpahdr, searchlen, true, &m_mt)) {
m_mode = mpa;
syncpos = GetPos();
@@ -271,7 +271,7 @@ HRESULT CMpaSplitterFile::Init()
// make sure the first frame is followed by another of the same kind (validates m_mpahdr basically)
Seek(startpos + m_mpahdr.FrameSize);
- if(!Sync(4)) {
+ if (!Sync(4)) {
m_mode = none;
} else {
break;
@@ -290,37 +290,37 @@ HRESULT CMpaSplitterFile::Init()
searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
Seek(m_startpos);
- if(m_mode == none && Read(m_aachdr, searchlen, &m_mt)) {
+ if (m_mode == none && Read(m_aachdr, searchlen, &m_mt)) {
m_mode = mp4a;
startpos = GetPos() - (m_aachdr.fcrc?7:9);
// make sure the first frame is followed by another of the same kind (validates m_aachdr basically)
Seek(startpos + m_aachdr.aac_frame_length);
- if(!Sync(9)) {
+ if (!Sync(9)) {
m_mode = none;
}
}
- if(m_mode == none) {
+ if (m_mode == none) {
return E_FAIL;
}
m_startpos = startpos;
- if(m_mode == mpa) {
+ if (m_mode == mpa) {
DWORD m_dwFrames = 0; // total number of frames
Seek(m_startpos + MPA_HEADER_SIZE + 32);
- if(BitRead(32, true) == 'Xing' || BitRead(32, true) == 'Info') {
+ if (BitRead(32, true) == 'Xing' || BitRead(32, true) == 'Info') {
TRACE(_T("CMpaSplitterFile - Xing VBR header found\n"));
BitRead(32); // Skip ID tag
DWORD dwFlags = BitRead(32);
// extract total number of frames in file
- if(dwFlags & FRAMES_FLAG)
+ if (dwFlags & FRAMES_FLAG)
m_dwFrames = BitRead(32);
- } else if(BitRead(32, true) == 'VBRI') {
+ } else if (BitRead(32, true) == 'VBRI') {
TRACE(_T("CMpaSplitterFile - VBRI header found\n"));
BitRead(32); // Skip ID tag
@@ -332,8 +332,8 @@ HRESULT CMpaSplitterFile::Init()
m_dwFrames = BitRead(32); // extract total number of frames in file
}
- if(m_dwFrames) {
-
+ if (m_dwFrames) {
+
bool l3ext = m_mpahdr.layer == 3 && !(m_mpahdr.version&1);
DWORD m_dwSamplesPerFrame = m_mpahdr.layer == 1 ? 384 : l3ext ? 576 : 1152;
@@ -348,11 +348,11 @@ HRESULT CMpaSplitterFile::Init()
REFERENCE_TIME rtFrameDur, rtPrevDur = -1;
clock_t start = clock();
int i = 0;
- while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC) {
+ while (Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC) {
TRACE(_T("%I64d\n"), m_rtDuration);
Seek(GetPos() + FrameSize);
i = rtPrevDur == m_rtDuration ? i+1 : 0;
- if(i == 10) {
+ if (i == 10) {
break;
}
rtPrevDur = m_rtDuration;
@@ -372,11 +372,11 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi
{
__int64 endpos = min(m_endpos, GetPos() + limit);
- if(m_mode == mpa) {
- while(GetPos() <= endpos - 4) {
+ if (m_mode == mpa) {
+ while (GetPos() <= endpos - 4) {
mpahdr h;
- if(Read(h, endpos - GetPos(), true)) {
+ if (Read(h, endpos - GetPos(), true)) {
if (m_mpahdr.version == h.version
&& m_mpahdr.layer == h.layer
&& m_mpahdr.channels == h.channels) {
@@ -392,11 +392,11 @@ bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limi
break;
}
}
- } else if(m_mode == mp4a) {
- while(GetPos() <= endpos - 9) {
+ } else if (m_mode == mp4a) {
+ while (GetPos() <= endpos - 9) {
aachdr h;
- if(Read(h, endpos - GetPos())) {
+ if (Read(h, endpos - GetPos())) {
if (m_aachdr.version == h.version
&& m_aachdr.layer == h.layer
&& m_aachdr.channels == h.channels) {
@@ -422,11 +422,11 @@ void CMpaSplitterFile::AdjustDuration(int nBytesPerSec)
{
ASSERT(nBytesPerSec);
- if(!m_bIsVBR) {
+ if (!m_bIsVBR) {
int rValue;
- if(!m_pos2bps.Lookup(GetPos(), rValue)) {
+ if (!m_pos2bps.Lookup(GetPos(), rValue)) {
m_totalbps += nBytesPerSec;
- if(!m_totalbps) {
+ if (!m_totalbps) {
return;
}
m_pos2bps.SetAt(GetPos(), nBytesPerSec);
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
index a7d6562cd..a3687b505 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
@@ -31,34 +31,34 @@
TCHAR* MPEG2_Profile[]=
{
- L"0",
- L"High Profile",
- L"Spatially Scalable Profile",
- L"SNR Scalable Profile",
- L"Main Profile",
- L"Simple Profile",
- L"6",
- L"7",
+ L"0",
+ L"High Profile",
+ L"Spatially Scalable Profile",
+ L"SNR Scalable Profile",
+ L"Main Profile",
+ L"Simple Profile",
+ L"6",
+ L"7",
};
TCHAR* MPEG2_Level[]=
{
- L"0",
- L"1",
- L"2",
- L"3",
- L"High Level",
- L"4",
- L"High1440 Level",
- L"5",
- L"Main Level",
- L"6",
- L"Low Level",
- L"7",
- L"8",
- L"9",
- L"10",
- L"11",
+ L"0",
+ L"1",
+ L"2",
+ L"3",
+ L"High Level",
+ L"4",
+ L"High1440 Level",
+ L"5",
+ L"Main Level",
+ L"6",
+ L"Low Level",
+ L"7",
+ L"8",
+ L"9",
+ L"10",
+ L"11",
};
#ifdef REGISTER_FILTER
@@ -229,10 +229,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str
Infos.AddTail(Temp);
}
- if(bIsMPEG2) {
+ if (bIsMPEG2) {
Infos.AddTail(MPEG2_Profile[pInfo->dwProfile]);
- } else
- if (pInfo->dwProfile) {
+ } else if (pInfo->dwProfile) {
if (bIsAVC) {
switch (pInfo->dwProfile) {
case 44:
@@ -274,10 +273,9 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str
}
}
- if(bIsMPEG2) {
+ if (bIsMPEG2) {
Infos.AddTail(MPEG2_Level[pInfo->dwLevel]);
- } else
- if (pInfo->dwLevel) {
+ } else if (pInfo->dwLevel) {
if (bIsAVC) {
Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel)/10.0));
} else {
@@ -465,7 +463,7 @@ CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Str
bool bFirst = true;
- for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos)) {
+ for (POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos)) {
CString& String = Infos.GetAt(pos);
if (bFirst) {
@@ -503,38 +501,38 @@ CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLS
TCHAR buff[256];
ULONG len;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"), KEY_READ)) {
DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("UseFastStreamChange"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("UseFastStreamChange"), dw)) {
m_useFastStreamChange = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSub"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSub"), dw)) {
m_ForcedSub = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("TrackPriority"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("TrackPriority"), dw)) {
m_TrackPriority = !!dw;
}
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(_T("AudioLanguageOrder"), buff, &len)) {
- m_csAudioLanguageOrder = CString(buff);
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("AudioLanguageOrder"), buff, &len)) {
+ m_csAudioLanguageOrder = CString(buff);
}
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(_T("SubtitlesLanguageOrder"), buff, &len)) {
- m_csSubtitlesLanguageOrder = CString(buff);
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("SubtitlesLanguageOrder"), buff, &len)) {
+ m_csSubtitlesLanguageOrder = CString(buff);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("VC1_Decoder_Output"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("VC1_Decoder_Output"), dw)) {
m_nVC1_GuidFlag = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AC3CoreOnly"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("AC3CoreOnly"), dw)) {
m_AC3CoreOnly = dw;
}
}
@@ -545,7 +543,7 @@ CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLS
m_csSubtitlesLanguageOrder = AfxGetApp()->GetProfileString(IDS_R_SETTINGS, IDS_RS_SUBTITLESLANGORDER, _T(""));
m_csAudioLanguageOrder = AfxGetApp()->GetProfileString(IDS_R_SETTINGS, IDS_RS_AUDIOSLANGORDER, _T(""));
m_nVC1_GuidFlag = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Splitter"), _T("VC1_Decoder_Output"), m_nVC1_GuidFlag);
- if(m_nVC1_GuidFlag<1 || m_nVC1_GuidFlag>3) m_nVC1_GuidFlag = 1;
+ if (m_nVC1_GuidFlag<1 || m_nVC1_GuidFlag>3) m_nVC1_GuidFlag = 1;
m_AC3CoreOnly = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Splitter"), _T("AC3CoreOnly"), m_AC3CoreOnly);
#endif
}
@@ -594,7 +592,7 @@ STDMETHODIMP CMpegSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, MpegSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -643,35 +641,35 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
HRESULT hr;
BYTE b;
- if(m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es) {
- if(!m_pFile->NextMpegStartCode(b)) {
+ if (m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es) {
+ if (!m_pFile->NextMpegStartCode(b)) {
return S_FALSE;
}
- if(b == 0xba) { // program stream header
+ if (b == 0xba) { // program stream header
CMpegSplitterFile::pshdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
- } else if(b == 0xbb) { // program stream system header
+ } else if (b == 0xbb) { // program stream system header
CMpegSplitterFile::pssyshdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
}
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if (b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if ((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
{
CMpegSplitterFile::peshdr h;
- if(!m_pFile->Read(h, b) || !h.len) {
+ if (!m_pFile->Read(h, b) || !h.len) {
return S_FALSE;
}
- if(h.type == CMpegSplitterFile::mpeg2 && h.scrambling) {
+ if (h.type == CMpegSplitterFile::mpeg2 && h.scrambling) {
ASSERT(0);
return E_FAIL;
}
@@ -680,7 +678,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
DWORD TrackNumber = m_pFile->AddStream(0, b, h.len);
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -696,10 +694,10 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
}
m_pFile->Seek(pos + h.len);
}
- } else if(m_pFile->m_type == CMpegSplitterFile::ts) {
+ } else if (m_pFile->m_type == CMpegSplitterFile::ts) {
CMpegSplitterFile::trhdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
@@ -708,20 +706,20 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
m_pFile->UpdatePrograms(h, false);
- if(h.payload && ISVALIDPID(h.pid)) {
+ if (h.payload && ISVALIDPID(h.pid)) {
DWORD TrackNumber = h.pid;
CMpegSplitterFile::peshdr h2;
- if(h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) { // pes packet
- if(h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling) {
+ if (h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) { // pes packet
+ if (h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling) {
ASSERT(0);
return E_FAIL;
}
TrackNumber = m_pFile->AddStream(h.pid, b, h.bytes - (DWORD)(m_pFile->GetPos() - pos));
}
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -746,9 +744,9 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
}
m_pFile->Seek(h.next);
- } else if(m_pFile->m_type == CMpegSplitterFile::pva) {
+ } else if (m_pFile->m_type == CMpegSplitterFile::pva) {
CMpegSplitterFile::pvahdr h;
- if(!m_pFile->Read(h)) {
+ if (!m_pFile->Read(h)) {
return S_FALSE;
}
@@ -756,7 +754,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
__int64 pos = m_pFile->GetPos();
- if(GetOutputPin(TrackNumber)) {
+ if (GetOutputPin(TrackNumber)) {
CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
@@ -789,17 +787,17 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
ReadClipInfo (GetPartFilename(pAsyncReader));
m_pFile.Attach(DNew CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo, m_nVC1_GuidFlag, m_ForcedSub, m_TrackPriority, m_AC3CoreOnly));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
- if(m_pFile->m_type == CMpegSplitterFile::ps) {
- if(m_pInput && m_pInput->IsConnected() && (GetCLSID(m_pInput->GetConnected()) == GUIDFromCString(_T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")))){ // MPC VTS Reader
+ if (m_pFile->m_type == CMpegSplitterFile::ps) {
+ if (m_pInput && m_pInput->IsConnected() && (GetCLSID(m_pInput->GetConnected()) == GUIDFromCString(_T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")))) { // MPC VTS Reader
pTI = GetFilterFromPin(m_pInput->GetConnected());
}
}
@@ -823,29 +821,29 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
int Idx_audio = 99;
int Idx_subpic = 99;
- if(!m_csAudioLanguageOrder.IsEmpty()) {
+ if (!m_csAudioLanguageOrder.IsEmpty()) {
int tPos = 0;
lang = m_csAudioLanguageOrder.Tokenize(_T(",; "), tPos);
- while(tPos != -1) {
- if(!lang.IsEmpty()) lang_list_audio.AddTail(lang);
+ while (tPos != -1) {
+ if (!lang.IsEmpty()) lang_list_audio.AddTail(lang);
lang = m_csAudioLanguageOrder.Tokenize(_T(",; "), tPos);
}
- if(!lang.IsEmpty()) lang_list_audio.AddTail(lang);
+ if (!lang.IsEmpty()) lang_list_audio.AddTail(lang);
}
- if(!m_csSubtitlesLanguageOrder.IsEmpty()) {
+ if (!m_csSubtitlesLanguageOrder.IsEmpty()) {
int tPos = 0;
lang = m_csSubtitlesLanguageOrder.Tokenize(_T(",; "), tPos);
- while(tPos != -1) {
- if(!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
+ while (tPos != -1) {
+ if (!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
lang = m_csSubtitlesLanguageOrder.Tokenize(_T(",; "), tPos);
}
- if(!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
+ if (!lang.IsEmpty()) lang_list_subpic.AddTail(lang);
}
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
CAtlArray<CMediaType> mts;
mts.Add(s.mt);
@@ -866,7 +864,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CString lang_name = _T("");
m_pFile->m_pPMT_Lang.Lookup(s.pid, lang_name);
-
+
lang_name = pTI ? pTI->GetTrackName(s.ps1id) : lang_name;
CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
@@ -881,15 +879,15 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
CString str_tmp = str;
str_tmp.MakeLower();
- if(i == CMpegSplitterFile::audio) {
- if(lang_list_audio.GetCount()>0) {
+ if (i == CMpegSplitterFile::audio) {
+ if (lang_list_audio.GetCount()>0) {
int idx = 0;
POSITION pos = lang_list_audio.GetHeadPosition();
- while(pos) {
+ while (pos) {
lang = lang_list_audio.GetNext(pos).MakeLower();
- if(-1 != str_tmp.Find(lang)) {
- if(idx<Idx_audio) {
- cs_audioProgram = str;
+ if (-1 != str_tmp.Find(lang)) {
+ if (idx<Idx_audio) {
+ cs_audioProgram = str;
Idx_audio = idx;
break;
}
@@ -897,16 +895,16 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
idx++;
}
}
- if(!Idx_audio && !cs_audioProgram.IsEmpty()) break;
+ if (!Idx_audio && !cs_audioProgram.IsEmpty()) break;
}
- if(i == CMpegSplitterFile::subpic) {
- if(lang_list_subpic.GetCount()>0) {
+ if (i == CMpegSplitterFile::subpic) {
+ if (lang_list_subpic.GetCount()>0) {
int idx = 0;
POSITION pos = lang_list_subpic.GetHeadPosition();
- while(pos) {
+ while (pos) {
lang = lang_list_subpic.GetNext(pos).MakeLower();
- if(-1 != str_tmp.Find(lang)) {
- if(idx<Idx_subpic) {
+ if (-1 != str_tmp.Find(lang)) {
+ if (idx<Idx_subpic) {
cs_subpicProgram = str;
Idx_subpic = idx;
break;
@@ -915,7 +913,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
idx++;
}
}
- if(!Idx_subpic && !cs_subpicProgram.IsEmpty()) break;
+ if (!Idx_subpic && !cs_subpicProgram.IsEmpty()) break;
}
}
}
@@ -923,9 +921,9 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
CAtlArray<CMediaType> mts;
mts.Add(s.mt);
@@ -949,7 +947,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
lang_name = pTI ? pTI->GetTrackName(s.ps1id) : lang_name;
CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType, lang_name);
-
+
if (!FormatDesc.IsEmpty()) {
str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
} else if (pStreamName) {
@@ -964,41 +962,40 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
(static_cast<CMpegSplitterOutputPin*>(pPinOut.m_p))->SetMaxShift (_I64_MAX);
}
- if(i == CMpegSplitterFile::audio) {
- if(!cs_audioProgram.IsEmpty()) {
- if((!cs_audioProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
+ if (i == CMpegSplitterFile::audio) {
+ if (!cs_audioProgram.IsEmpty()) {
+ if ((!cs_audioProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
} else {
- if(S_OK == AddOutputPin(s, pPinOut)) {
+ if (S_OK == AddOutputPin(s, pPinOut)) {
break;
}
}
}
- else
- if(i == CMpegSplitterFile::subpic) {
- if(!cs_subpicProgram.IsEmpty()) {
- if((!cs_subpicProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
+ else if (i == CMpegSplitterFile::subpic) {
+ if (!cs_subpicProgram.IsEmpty()) {
+ if ((!cs_subpicProgram.Compare(str)) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
} else {
- if((m_pFile->m_streams[CMpegSplitterFile::subpic].GetCount() == 1) && (S_OK == AddOutputPin(s, pPinOut))) {
+ if ((m_pFile->m_streams[CMpegSplitterFile::subpic].GetCount() == 1) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
- } else if((s.pid != NO_SUBTITLE_PID) && (S_OK == AddOutputPin(s, pPinOut))) {
+ } else if ((s.pid != NO_SUBTITLE_PID) && (S_OK == AddOutputPin(s, pPinOut))) {
break;
}
}
} else {
- if(S_OK == AddOutputPin(s, pPinOut)) {
+ if (S_OK == AddOutputPin(s, pPinOut)) {
break;
}
}
}
}
- if(m_rtPlaylistDuration) {
+ if (m_rtPlaylistDuration) {
m_rtNewStop = m_rtStop = m_rtDuration = m_rtPlaylistDuration;
- } else if(m_pFile->IsRandomAccess() && m_pFile->m_rate) {
+ } else if (m_pFile->IsRandomAccess() && m_pFile->m_rate) {
m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * m_pFile->GetLength() / m_pFile->m_rate;
}
@@ -1008,7 +1005,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bool CMpegSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CMpegSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -1021,12 +1018,12 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
CAtlList<CMpegSplitterFile::stream>* pMasterStream = m_pFile->GetMasterStream();
- if(!pMasterStream) {
+ if (!pMasterStream) {
ASSERT(0);
return;
}
- if(m_pFile->IsStreaming()) {
+ if (m_pFile->IsStreaming()) {
m_pFile->Seek(max(0, m_pFile->GetLength() - 100*1024));
m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead());
return;
@@ -1034,7 +1031,7 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
REFERENCE_TIME rtPreroll = 10000000;
- if(rt <= rtPreroll || m_rtDuration <= 0) {
+ if (rt <= rtPreroll || m_rtDuration <= 0) {
m_pFile->Seek(0);
} else {
__int64 len = m_pFile->GetLength();
@@ -1044,33 +1041,33 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
REFERENCE_TIME rtmax = rt - rtPreroll;
REFERENCE_TIME rtmin = rtmax - 5000000;
- if(m_rtStartOffset == 0)
- for(int i = 0; i < countof(m_pFile->m_streams)-1; i++) {
+ if (m_rtStartOffset == 0)
+ for (int i = 0; i < countof(m_pFile->m_streams)-1; i++) {
POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
DWORD TrackNum = m_pFile->m_streams[i].GetNext(pos);
CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNum);
- if(pPin && pPin->IsConnected()) {
+ if (pPin && pPin->IsConnected()) {
m_pFile->Seek(seekpos);
__int64 curpos = seekpos;
REFERENCE_TIME pdt = _I64_MIN;
- for(int j = 0; j < 10; j++) {
+ for (int j = 0; j < 10; j++) {
REFERENCE_TIME rt = m_pFile->NextPTS(TrackNum);
- if(rt < 0) {
+ if (rt < 0) {
break;
}
REFERENCE_TIME dt = rt - rtmax;
- if(dt > 0 && dt == pdt) {
+ if (dt > 0 && dt == pdt) {
dt = 10000000i64;
}
- if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0) {
+ if (rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0) {
minseekpos = min(minseekpos, curpos);
break;
}
@@ -1084,7 +1081,7 @@ void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
}
}
- if(minseekpos != _I64_MAX) {
+ if (minseekpos != _I64_MAX) {
seekpos = minseekpos;
} else {
// this file is probably screwed up, try plan B, seek simply by bitrate
@@ -1104,9 +1101,9 @@ bool CMpegSplitterFilter::DemuxLoop()
REFERENCE_TIME rtStartOffset = m_rtStartOffset ? m_rtStartOffset : m_pFile->m_rtMin;
HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL)) {
- if((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
- if((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ if ((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
+ if ((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE) {
Sleep(1);
}
}
@@ -1133,7 +1130,7 @@ STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams)
*pcStreams = 0;
- for(int i = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0; i < countof(m_pFile->m_streams); i++) {
(*pcStreams) += m_pFile->m_streams[i].GetCount();
}
@@ -1142,37 +1139,37 @@ STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams)
STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
+ if (!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
return E_NOTIMPL;
}
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
int cnt = m_pFile->m_streams[i].GetCount();
- if(lIndex >= j && lIndex < j+cnt) {
+ if (lIndex >= j && lIndex < j+cnt) {
lIndex -= j;
POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) {
+ if (!pos) {
return E_UNEXPECTED;
}
CMpegSplitterFile::stream& to = m_pFile->m_streams[i].GetAt(pos);
pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& from = m_pFile->m_streams[i].GetNext(pos);
- if(!GetOutputPin(from)) {
+ if (!GetOutputPin(from)) {
continue;
}
- if(m_useFastStreamChange) {
+ if (m_useFastStreamChange) {
PauseGraph;
ResumeGraph;
}
HRESULT hr;
- if(FAILED(hr = RenameOutputPin(from, to, &to.mt))) {
+ if (FAILED(hr = RenameOutputPin(from, to, &to.mt))) {
return hr;
}
@@ -1182,22 +1179,22 @@ STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
const CHdmvClipInfo::Stream *pClipInfo;
const CMpegSplitterFile::program* p = m_pFile->FindProgram(to.pid, iProgram, pClipInfo);
- if(p!=NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv()) {
- for(int k = 0; k < countof(m_pFile->m_streams); k++) {
- if(k == i) {
+ if (p!=NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv()) {
+ for (int k = 0; k < countof(m_pFile->m_streams); k++) {
+ if (k == i) {
continue;
}
pos = m_pFile->m_streams[k].GetHeadPosition();
- while(pos) {
+ while (pos) {
CMpegSplitterFile::stream& from = m_pFile->m_streams[k].GetNext(pos);
- if(!GetOutputPin(from)) {
+ if (!GetOutputPin(from)) {
continue;
}
- for(int l = 0; l < countof(p->streams); l++) {
- if(const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid)) {
- if(from != *s) {
+ for (int l = 0; l < countof(p->streams); l++) {
+ if (const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid)) {
+ if (from != *s) {
hr = RenameOutputPin(from, *s, &s->mt);
}
break;
@@ -1322,47 +1319,47 @@ bool CMpegSplitterFile::stream::operator < (const stream &_Other) const
STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
+ for (int i = 0, j = 0; i < countof(m_pFile->m_streams); i++) {
int cnt = m_pFile->m_streams[i].GetCount();
- if(lIndex >= j && lIndex < j+cnt) {
+ if (lIndex >= j && lIndex < j+cnt) {
lIndex -= j;
POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) {
+ if (!pos) {
return E_UNEXPECTED;
}
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetAt(pos);
CHdmvClipInfo::Stream* pStream = m_ClipInfo.FindStream (s.pid);
- if(ppmt) {
+ if (ppmt) {
*ppmt = CreateMediaType(&s.mt);
}
- if(pdwFlags) {
+ if (pdwFlags) {
*pdwFlags = GetOutputPin(s) ? (AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE) : 0;
}
- if(plcid) {
+ if (plcid) {
*plcid = pStream ? pStream->m_LCID : 0;
}
- if(pdwGroup) {
+ if (pdwGroup) {
*pdwGroup = i;
}
- if(ppObject) {
+ if (ppObject) {
*ppObject = NULL;
}
- if(ppUnk) {
+ if (ppUnk) {
*ppUnk = NULL;
}
- if(ppszName) {
+ if (ppszName) {
CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
CStringW str;
if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID) {
str = NO_SUBTITLE_NAME;
- if(plcid) {
+ if (plcid) {
*plcid = (LCID)LCID_NOSUBTITLES;
}
} else {
@@ -1390,7 +1387,7 @@ STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
}
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
- if(*ppszName == NULL) {
+ if (*ppszName == NULL) {
return E_OUTOFMEMORY;
}
@@ -1421,13 +1418,13 @@ STDMETHODIMP CMpegSplitterFilter::CreatePage(const GUID& guid, IPropertyPage** p
{
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMpegSplitterSettingsWnd)) {
+ if (guid == __uuidof(CMpegSplitterSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMpegSplitterSettingsWnd>(NULL, &hr))->AddRef();
}
@@ -1439,7 +1436,7 @@ STDMETHODIMP CMpegSplitterFilter::Apply()
{
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Splitter"))) {
key.SetDWORDValue(_T("UseFastStreamChange"), m_useFastStreamChange);
key.SetDWORDValue(_T("ForcedSub"), m_ForcedSub);
key.SetDWORDValue(_T("TrackPriority"), m_TrackPriority);
@@ -1607,12 +1604,12 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
CAutoLock cAutoLock(this);
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
REFERENCE_TIME rt = p->rtStart + m_rtOffset;
// Filter invalid PTS (if too different from previous packet)
- if(m_rtPrev != Packet::INVALID_TIME)
- if(_abs64(rt - m_rtPrev) > m_rtMaxShift) {
+ if (m_rtPrev != Packet::INVALID_TIME)
+ if (_abs64(rt - m_rtPrev) > m_rtMaxShift) {
m_rtOffset += m_rtPrev - rt;
}
@@ -1630,22 +1627,22 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
- if(m_mt.subtype == MEDIASUBTYPE_AAC) { // special code for aac, the currently available decoders only like whole frame samples
- if(m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0)) {
+ if (m_mt.subtype == MEDIASUBTYPE_AAC) { // special code for aac, the currently available decoders only like whole frame samples
+ if (m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0)) {
m_p.Free();
}
- if(!m_p) {
+ if (!m_p) {
BYTE* base = p->GetData();
BYTE* s = base;
BYTE* e = s + p->GetCount();
- for(; s < e; s++) {
- if(*s != 0xff) {
+ for (; s < e; s++) {
+ if (*s != 0xff) {
continue;
}
- if(s == e-1 || (s[1]&0xf6) == 0xf0) {
+ if (s == e-1 || (s[1]&0xf6) == 0xf0) {
memmove(base, s, e - s);
p->SetCount(e - s);
m_p = p;
@@ -1656,7 +1653,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
m_p->Append(*p);
}
- while(m_p && m_p->GetCount() > 9) {
+ while (m_p && m_p->GetCount() > 9) {
BYTE* base = m_p->GetData();
BYTE* s = base;
BYTE* e = s + m_p->GetCount();
@@ -1664,15 +1661,15 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
bool crc = !(s[1]&1);
s += 7;
len -= 7;
- if(crc) {
+ if (crc) {
s += 2, len -= 2;
}
- if(e - s < len) {
+ if (e - s < len) {
break;
}
- if(len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0)) {
+ if (len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0)) {
m_p.Free();
break;
}
@@ -1698,22 +1695,22 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
m_p->SetCount(e - s);
HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
- if(m_p && p) {
- if(!m_p->bDiscontinuity) {
+ if (m_p && p) {
+ if (!m_p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
}
- if(!m_p->bSyncPoint) {
+ if (!m_p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
}
- if(m_p->rtStart == Packet::INVALID_TIME) {
+ if (m_p->rtStart == Packet::INVALID_TIME) {
m_p->rtStart = p->rtStart, m_p->rtStop = p->rtStop;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1722,8 +1719,8 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
return S_OK;
- } else if(m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva') || m_mt.subtype == FOURCCMap('CVMA') || m_mt.subtype == FOURCCMap('CVME')) {
- if(!m_p) {
+ } else if (m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva') || m_mt.subtype == FOURCCMap('CVMA') || m_mt.subtype == FOURCCMap('CVME')) {
+ if (!m_p) {
m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity;
@@ -1746,12 +1743,12 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
MOVE_TO_H264_START_CODE(start, end);
- while(start <= end-4) {
+ while (start <= end-4) {
BYTE* next = start+1;
MOVE_TO_H264_START_CODE(next, end);
- if(next >= end-4) {
+ if (next >= end-4) {
break;
}
@@ -1799,20 +1796,20 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
m_pl.AddTail(p2);
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_p->rtStart = p->rtStart;
m_p->rtStop = p->rtStop;
p->rtStart = Packet::INVALID_TIME;
}
- if(p->bDiscontinuity) {
+ if (p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
p->bDiscontinuity = FALSE;
}
- if(p->bSyncPoint) {
+ if (p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
p->bSyncPoint = FALSE;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1821,44 +1818,44 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
start = next;
}
- if(start > m_p->GetData()) {
+ if (start > m_p->GetData()) {
m_p->RemoveAt(0, start - m_p->GetData());
}
REFERENCE_TIME rtStart = Packet::INVALID_TIME, rtStop = Packet::INVALID_TIME;
- for(POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos)) {
- if(pos == m_pl.GetHeadPosition()) {
+ for (POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos)) {
+ if (pos == m_pl.GetHeadPosition()) {
continue;
}
Packet* pPacket = m_pl.GetAt(pos);
BYTE* pData = pPacket->GetData();
- if((pData[4]&0x1f) == 0x09) {
+ if ((pData[4]&0x1f) == 0x09) {
m_fHasAccessUnitDelimiters = true;
}
- if((pData[4]&0x1f) == 0x09 || (!m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)) {
+ if ((pData[4]&0x1f) == 0x09 || (!m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)) {
if (pPacket->rtStart == Packet::INVALID_TIME && rtStart != Packet::INVALID_TIME) {
pPacket->rtStart = rtStart;
pPacket->rtStop = rtStop;
}
-/*
- if(pPacket->rtStart == Packet::INVALID_TIME) {
- continue;
- }
-*/
+ /*
+ if(pPacket->rtStart == Packet::INVALID_TIME) {
+ continue;
+ }
+ */
p = m_pl.RemoveHead();
- while(pos != m_pl.GetHeadPosition()) {
+ while (pos != m_pl.GetHeadPosition()) {
CAutoPtr<Packet> p2 = m_pl.RemoveHead();
p->Append(*p2);
}
HRESULT hr = __super::DeliverPacket(p);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
}
@@ -1869,8 +1866,8 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
return S_OK;
- } else if(m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw') || m_mt.subtype == MEDIASUBTYPE_WVC1_CYBERLINK || m_mt.subtype == MEDIASUBTYPE_WVC1_ARCSOFT) { // just like aac, this has to be starting nalus, more can be packed together
- if(!m_p) {
+ } else if (m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw') || m_mt.subtype == MEDIASUBTYPE_WVC1_CYBERLINK || m_mt.subtype == MEDIASUBTYPE_WVC1_ARCSOFT) { // just like aac, this has to be starting nalus, more can be packed together
+ if (!m_p) {
m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity;
@@ -1892,7 +1889,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
BYTE* end = start + m_p->GetCount();
bool bSeqFound = false;
- while(start <= end-4) {
+ while (start <= end-4) {
if (*(DWORD*)start == 0x0D010000) {
bSeqFound = true;
break;
@@ -1902,10 +1899,10 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
start++;
}
- while(start <= end-4) {
+ while (start <= end-4) {
BYTE* next = start+1;
- while(next <= end-4) {
+ while (next <= end-4) {
if (*(DWORD*)next == 0x0D010000) {
if (bSeqFound) {
break;
@@ -1917,7 +1914,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
next++;
}
- if(next >= end-4) {
+ if (next >= end-4) {
break;
}
@@ -1944,24 +1941,24 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
p2->SetData(start, next - start);
HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
- if(p->rtStart != Packet::INVALID_TIME) {
+ if (p->rtStart != Packet::INVALID_TIME) {
m_p->rtStart = p->rtStop; //p->rtStart; //Sebastiii for enable VC1 decoding in FFDshow (no more shutter)
m_p->rtStop = p->rtStop;
p->rtStart = Packet::INVALID_TIME;
}
- if(p->bDiscontinuity) {
+ if (p->bDiscontinuity) {
m_p->bDiscontinuity = p->bDiscontinuity;
p->bDiscontinuity = FALSE;
}
- if(p->bSyncPoint) {
+ if (p->bSyncPoint) {
m_p->bSyncPoint = p->bSyncPoint;
p->bSyncPoint = FALSE;
}
- if(m_p->pmt) {
+ if (m_p->pmt) {
DeleteMediaType(m_p->pmt);
}
@@ -1972,7 +1969,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
bSeqFound = (*(DWORD*)start == 0x0D010000);
}
- if(start > m_p->GetData()) {
+ if (start > m_p->GetData()) {
m_p->RemoveAt(0, start - m_p->GetData());
}
@@ -2016,15 +2013,15 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
else if (!p->pmt) {
return S_OK;
}
- // HDMV LPCM
+ // HDMV LPCM
} else if (m_mt.subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
BYTE* start = p->GetData();
p->SetData(start + 4, p->GetCount() - 4);
- // Dolby_AC3
- } else if ((m_type == CMpegSplitterFile::ts) &&
- (m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3) &&
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->StreamIsTrueHD(p->TrackNumber) &&
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
+ // Dolby_AC3
+ } else if ((m_type == CMpegSplitterFile::ts) &&
+ (m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3) &&
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->StreamIsTrueHD(p->TrackNumber) &&
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
if (p->GetCount() < 8) {
return S_OK; // Should be invalid packet
}
@@ -2032,7 +2029,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
if (*(WORD*)start != 0x770b) { // skip none AC3
return S_OK;
}
- // TrueHD
+ // TrueHD
} else if (m_mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD && (static_cast<CMpegSplitterFilter*>(m_pFilter))->GetTrueHD() != 2) {
if (p->GetCount() < 8) {
return S_OK; // Should be invalid packet
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.h b/src/filters/parser/MpegSplitter/MpegSplitter.h
index 9a5872238..e58d84158 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.h
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.h
@@ -47,7 +47,7 @@
\
if(_fs == State_Running && _pMS) \
_pMC->Run(); \
-
+
class __declspec(uuid("DC257063-045F-4BE2-BD5B-E12279C464F0"))
CMpegSplitterFilter
: public CBaseSplitterFilter
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
index 93cecf54d..76df3392a 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
@@ -43,7 +43,7 @@ CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bo
, m_AC3CoreOnly(AC3CoreOnly)
, m_init(false)
{
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = Init(pAsyncReader);
}
}
@@ -58,64 +58,64 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
Seek(0);
- if(m_type == us) {
- if(BitRead(32, true) == 'TFrc') {
+ if (m_type == us) {
+ if (BitRead(32, true) == 'TFrc') {
Seek(0x67c);
}
int cnt = 0, limit = 4;
- for(trhdr h; cnt < limit && Read(h); cnt++) {
+ for (trhdr h; cnt < limit && Read(h); cnt++) {
Seek(h.next);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = ts;
}
}
Seek(0);
- if(m_type == us) {
- if(BitRead(32, true) == 'TFrc') {
+ if (m_type == us) {
+ if (BitRead(32, true) == 'TFrc') {
Seek(0xE80);
}
int cnt = 0, limit = 4;
- for(trhdr h; cnt < limit && Read(h); cnt++) {
+ for (trhdr h; cnt < limit && Read(h); cnt++) {
Seek(h.next);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = ts;
}
}
Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
int cnt = 0, limit = 4;
- for(pvahdr h; cnt < limit && Read(h); cnt++) {
+ for (pvahdr h; cnt < limit && Read(h); cnt++) {
Seek(GetPos() + h.length);
}
- if(cnt >= limit) {
+ if (cnt >= limit) {
m_type = pva;
}
}
Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
BYTE b;
- for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++) {
- if(b == 0xba) {
+ for (int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++) {
+ if (b == 0xba) {
pshdr h;
- if(Read(h)) {
+ if (Read(h)) {
m_type = ps;
m_rate = int(h.bitrate/8);
break;
}
- } else if((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
- || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
- // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
- || b == 0xbd) { // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ } else if ((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
+ || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
+ // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ || b == 0xbd) { // private stream 1, 0xbd, ac3/dts/lpcm/subpic
peshdr h;
- if(Read(h, b) && BitRead(24, true) == 0x000001) {
+ if (Read(h, b) && BitRead(24, true) == 0x000001) {
m_type = es;
}
}
@@ -124,75 +124,75 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
Seek(0);
- if(m_type == us) {
+ if (m_type == us) {
return E_FAIL;
}
// min/max pts & bitrate
m_rtMin = m_posMin = _I64_MAX;
m_rtMax = m_posMax = 0;
-
+
m_init = true;
- if(IsRandomAccess() || IsStreaming()) {
- if(IsStreaming()) {
- for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
+ if (IsRandomAccess() || IsStreaming()) {
+ if (IsStreaming()) {
+ for (int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
;
}
}
CAtlList<__int64> fps;
- for(int i = 0, j = 5; i <= j; i++) {
+ for (int i = 0, j = 5; i <= j; i++) {
fps.AddTail(i*GetLength()/j);
}
- for(__int64 pfp = 0; fps.GetCount(); ) {
+ for (__int64 pfp = 0; fps.GetCount(); ) {
__int64 fp = fps.RemoveHead();
fp = min(GetLength() - MEGABYTE/8, fp);
fp = max(pfp, fp);
__int64 nfp = fp + (pfp == 0 ? 10*MEGABYTE : MEGABYTE/8);
- if(FAILED(hr = SearchStreams(fp, nfp, pAsyncReader))) {
+ if (FAILED(hr = SearchStreams(fp, nfp, pAsyncReader))) {
return hr;
}
pfp = nfp;
}
} else {
- if(FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader))) {
+ if (FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader))) {
return hr;
}
}
- if(m_type == ts) {
- if(IsRandomAccess() || IsStreaming()) {
- if(IsStreaming()) {
- for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
+ if (m_type == ts) {
+ if (IsRandomAccess() || IsStreaming()) {
+ if (IsStreaming()) {
+ for (int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++) {
;
}
}
CAtlList<__int64> fps;
- for(int i = 0, j = 5; i <= j; i++) {
+ for (int i = 0, j = 5; i <= j; i++) {
fps.AddTail(i*GetLength()/j);
}
- for(__int64 pfp = 0; fps.GetCount(); ) {
+ for (__int64 pfp = 0; fps.GetCount(); ) {
__int64 fp = fps.RemoveHead();
fp = min(GetLength() - MEGABYTE/8, fp);
fp = max(pfp, fp);
__int64 nfp = fp + (pfp == 0 ? 10*MEGABYTE : MEGABYTE/8);
- if(FAILED(hr = SearchStreams(fp, nfp, pAsyncReader, TRUE))) {
+ if (FAILED(hr = SearchStreams(fp, nfp, pAsyncReader, TRUE))) {
return hr;
}
pfp = nfp;
}
} else {
- if(FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader, TRUE))) {
+ if (FAILED(hr = SearchStreams(0, MEGABYTE/8, pAsyncReader, TRUE))) {
return hr;
}
}
}
- if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0) {
+ if (m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0) {
return E_FAIL;
}
@@ -205,7 +205,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
#if (0)
// normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
// (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
+ if (indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
m_rate = detected_rate;
} else {
; // TODO: in this case disable seeking, or try doing something less drastical...
@@ -213,8 +213,8 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
#endif
// Add fake Subtitle stream ...
- if(m_type == ts) {
- if(m_streams[video].GetCount()) {
+ if (m_type == ts) {
+ if (m_streams[video].GetCount()) {
if (!m_bIsHdmv && m_streams[subpic].GetCount()) {
stream s;
s.pid = NO_SUBTITLE_PID;
@@ -227,7 +227,7 @@ HRESULT CMpegSplitterFile::Init(IAsyncReader* pAsyncReader)
}
}
} else {
- if(m_streams[video].GetCount() && m_streams[subpic].GetCount()) {
+ if (m_streams[video].GetCount() && m_streams[subpic].GetCount()) {
stream s;
s.pid = NO_SUBTITLE_PID;
s.mt.majortype = m_streams[subpic].GetHead().mt.majortype;
@@ -246,7 +246,7 @@ void CMpegSplitterFile::OnComplete(IAsyncReader* pAsyncReader)
{
__int64 pos = GetPos();
- if(SUCCEEDED(SearchStreams(GetLength() - 500*1024, GetLength(), pAsyncReader, TRUE))) {
+ if (SUCCEEDED(SearchStreams(GetLength() - 500*1024, GetLength(), pAsyncReader, TRUE))) {
int indicated_rate = m_rate;
int detected_rate = int(m_rtMax > m_rtMin ? 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin) : 0);
@@ -254,7 +254,7 @@ void CMpegSplitterFile::OnComplete(IAsyncReader* pAsyncReader)
#if (0)
// normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
// (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
+ if (indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024) {
m_rate = detected_rate;
} else {
; // TODO: in this case disable seeking, or try doing something less drastical...
@@ -272,9 +272,9 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
BYTE b;
- while(GetRemaining()) {
- if(m_type == ps || m_type == es) {
- if(!NextMpegStartCode(b)) { // continue;
+ while (GetRemaining()) {
+ if (m_type == ps || m_type == es) {
+ if (!NextMpegStartCode(b)) { // continue;
ASSERT(0);
break;
}
@@ -282,19 +282,19 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
rtpos = GetPos()-4;
#if (EVO_SUPPORT == 0)
- if(b >= 0xbd && b < 0xf0)
+ if (b >= 0xbd && b < 0xf0)
#else
- if((b >= 0xbd && b < 0xf0) || (b == 0xfd))
+ if ((b >= 0xbd && b < 0xf0) || (b == 0xfd))
#endif
{
peshdr h;
- if(!Read(h, b) || !h.len) {
+ if (!Read(h, b) || !h.len) {
continue;
}
__int64 pos = GetPos();
- if(h.fpts && AddStream(0, b, h.len) == TrackNum) {
+ if (h.fpts && AddStream(0, b, h.len) == TrackNum) {
//ASSERT(h.pts >= m_rtMin && h.pts <= m_rtMax);
rt = h.pts;
break;
@@ -302,18 +302,18 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
Seek(pos + h.len);
}
- } else if(m_type == ts) {
+ } else if (m_type == ts) {
trhdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
rtpos = GetPos()-4;
- if(h.payload && h.payloadstart && ISVALIDPID(h.pid)) {
+ if (h.payload && h.payloadstart && ISVALIDPID(h.pid)) {
peshdr h2;
- if(NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
- if(h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum)) {
+ if (NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
+ if (h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum)) {
//ASSERT(h2.pts >= m_rtMin && h2.pts <= m_rtMax);
rt = h2.pts;
break;
@@ -322,23 +322,23 @@ REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
}
Seek(h.next);
- } else if(m_type == pva) {
+ } else if (m_type == pva) {
pvahdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
- if(h.fpts) {
+ if (h.fpts) {
rt = h.pts;
break;
}
}
}
- if(rtpos >= 0) {
+ if (rtpos >= 0) {
Seek(rtpos);
}
- if(rt >= 0) {
+ if (rt >= 0) {
rt -= m_rtMin;
}
@@ -350,49 +350,49 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
Seek(start);
stop = min(stop, GetLength());
- while(GetPos() < stop) {
+ while (GetPos() < stop) {
BYTE b;
- if(m_type == ps || m_type == es) {
- if(!NextMpegStartCode(b)) {
+ if (m_type == ps || m_type == es) {
+ if (!NextMpegStartCode(b)) {
continue;
}
- if(b == 0xba) { // program stream header
+ if (b == 0xba) { // program stream header
pshdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
m_rate = int(h.bitrate/8);
- } else if(b == 0xbb) { // program stream system header
+ } else if (b == 0xbb) { // program stream system header
pssyshdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
}
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if (b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if ((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
{
peshdr h;
- if(!Read(h, b)) {
+ if (!Read(h, b)) {
continue;
}
- if(h.type == mpeg2 && h.scrambling) {
+ if (h.type == mpeg2 && h.scrambling) {
ASSERT(0);
return E_FAIL;
}
- if(h.fpts) {
- if(m_rtMin == _I64_MAX) {
+ if (h.fpts) {
+ if (m_rtMin == _I64_MAX) {
m_rtMin = h.pts;
m_posMin = GetPos();
TRACE ("m_rtMin(SearchStreams)=%S\n", ReftimeToString(m_rtMin));
}
- if(m_rtMin < h.pts && m_rtMax < h.pts) {
+ if (m_rtMin < h.pts && m_rtMax < h.pts) {
m_rtMax = h.pts;
m_posMax = GetPos();
TRACE ("m_rtMax(SearchStreams)=%S\n", ReftimeToString(m_rtMax));
@@ -401,13 +401,13 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
__int64 pos = GetPos();
AddStream(0, b, h.len);
- if(h.len) {
+ if (h.len) {
Seek(pos + h.len);
}
}
- } else if(m_type == ts) {
+ } else if (m_type == ts) {
trhdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
@@ -415,22 +415,22 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
UpdatePrograms(h);
- if(h.payload && ISVALIDPID(h.pid)) {
+ if (h.payload && ISVALIDPID(h.pid)) {
peshdr h2;
- if(h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
- if(h2.type == mpeg2 && h2.scrambling) {
+ if (h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) { // pes packet
+ if (h2.type == mpeg2 && h2.scrambling) {
ASSERT(0);
return E_FAIL;
}
- if(h2.fpts && CalcDuration && GetMasterStream() && GetMasterStream()->GetHead() == h.pid) {
- if((m_rtMin == _I64_MAX) || (m_rtMin > h2.pts)) {
+ if (h2.fpts && CalcDuration && GetMasterStream() && GetMasterStream()->GetHead() == h.pid) {
+ if ((m_rtMin == _I64_MAX) || (m_rtMin > h2.pts)) {
m_rtMin = h2.pts;
m_posMin = GetPos();
TRACE ("m_rtMin(SearchStreams)=%S, PID=%d\n", ReftimeToString(m_rtMin), h.pid);
}
- if(m_rtMin < h2.pts && m_rtMax < h2.pts) {
+ if (m_rtMin < h2.pts && m_rtMax < h2.pts) {
m_rtMax = h2.pts;
m_posMax = GetPos();
TRACE ("m_rtMax(SearchStreams)=%S, PID=%d\n", ReftimeToString(m_rtMax), h.pid);
@@ -457,25 +457,25 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
b = 0;
}
- if(!CalcDuration) {
+ if (!CalcDuration) {
AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - pos)));
}
}
Seek(h.next);
- } else if(m_type == pva) {
+ } else if (m_type == pva) {
pvahdr h;
- if(!Read(h)) {
+ if (!Read(h)) {
continue;
}
- if(h.fpts) {
- if(m_rtMin == _I64_MAX) {
+ if (h.fpts) {
+ if (m_rtMin == _I64_MAX) {
m_rtMin = h.pts;
m_posMin = GetPos();
}
- if(m_rtMin < h.pts && m_rtMax < h.pts) {
+ if (m_rtMin < h.pts && m_rtMax < h.pts) {
m_rtMax = h.pts;
m_posMax = GetPos();
}
@@ -483,13 +483,13 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
__int64 pos = GetPos();
- if(h.streamid == 1) {
+ if (h.streamid == 1) {
AddStream(h.streamid, 0xe0, h.length);
- } else if(h.streamid == 2) {
+ } else if (h.streamid == 2) {
AddStream(h.streamid, 0xc0, h.length);
}
- if(h.length) {
+ if (h.length) {
Seek(pos + h.length);
}
}
@@ -500,8 +500,8 @@ HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop, IAsyncRead
DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
{
- if(pid) {
- if(pesid) {
+ if (pid) {
+ if (pesid) {
m_pid2pes[pid] = pesid;
} else {
m_pid2pes.Lookup(pid, pesid);
@@ -514,24 +514,24 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
int type = unknown;
- if(pesid >= 0xe0 && pesid < 0xf0) { // mpeg video
+ if (pesid >= 0xe0 && pesid < 0xf0) { // mpeg video
__int64 pos = GetPos();
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::seqhdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
type = video;
}
}
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
// PPS and SPS can be present on differents packets
// and can also be split into multiple packets
if (!avch.Lookup(pid))
memset(&avch[pid], 0, sizeof(CMpegSplitterFile::avchdr));
#if defined(MVC_SUPPORT)
- if(!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt))
+ if (!m_streams[video].Find(s) && !m_streams[stereo].Find(s) && Read(avch[pid], len, &s.mt))
{
if (avch[pid].spspps[index_subsetsps].complete)
type = stereo;
@@ -539,64 +539,64 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
type = video;
}
#else
- if(!m_streams[video].Find(s) && Read(avch[pid], len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(avch[pid], len, &s.mt)) {
type = video;
}
#endif
}
- } else if(pesid >= 0xc0 && pesid < 0xe0) { // mpeg audio
+ } else if (pesid >= 0xc0 && pesid < 0xe0) { // mpeg audio
__int64 pos = GetPos();
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::aachdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
}
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::mpahdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, false, &s.mt)) {
type = audio;
}
}
- } else if(pesid == 0xbd || pesid == 0xfd) { // private stream 1
- if(s.pid) {
- if(!m_streams[audio].Find(s) && !m_streams[video].Find(s)) {
+ } else if (pesid == 0xbd || pesid == 0xfd) { // private stream 1
+ if (s.pid) {
+ if (!m_streams[audio].Find(s) && !m_streams[video].Find(s)) {
__int64 pos = GetPos();
// AC3
- if(type == unknown) {
+ if (type == unknown) {
CMpegSplitterFile::ac3hdr h;
- if(Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1))) {
+ if (Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1))) {
type = audio;
}
}
// DTS
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::dtshdr h;
- if(Read(h, len, &s.mt, false)) {
+ if (Read(h, len, &s.mt, false)) {
type = audio;
}
}
// VC1
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
type = video;
}
}
// DVB subtitles
- if(type == unknown) {
+ if (type == unknown) {
Seek(pos);
CMpegSplitterFile::dvbsub h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt)) {
type = subpic;
}
}
@@ -604,7 +604,7 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
int iProgram;
const CHdmvClipInfo::Stream *pClipInfo;
const program* pProgram = FindProgram (s.pid, iProgram, pClipInfo);
- if((type == unknown) && (pProgram != NULL)) {
+ if ((type == unknown) && (pProgram != NULL)) {
PES_STREAM_TYPE StreamType = INVALID;
Seek(pos);
@@ -613,14 +613,14 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
switch (StreamType) {
case AUDIO_STREAM_LPCM : {
CMpegSplitterFile::hdmvlpcmhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, &s.mt)) {
type = audio;
}
}
break;
case PRESENTATION_GRAPHICS_STREAM : {
CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL)) {
m_bIsHdmv = true;
type = subpic;
}
@@ -628,15 +628,15 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
break;
}
}
- } else if((m_AC3CoreOnly != 1) && m_init){
+ } else if ((m_AC3CoreOnly != 1) && m_init) {
int iProgram;
const CHdmvClipInfo::Stream *pClipInfo;
const program* pProgram = FindProgram (s.pid, iProgram, pClipInfo);
- if((type == unknown) && (pProgram != NULL) && AUDIO_STREAM_AC3_TRUE_HD == pProgram->streams[iProgram].type) {
+ if ((type == unknown) && (pProgram != NULL) && AUDIO_STREAM_AC3_TRUE_HD == pProgram->streams[iProgram].type) {
const stream* source = m_streams[audio].FindStream(s.pid);
- if(source && source->mt.subtype == MEDIASUBTYPE_DOLBY_AC3) {
+ if (source && source->mt.subtype == MEDIASUBTYPE_DOLBY_AC3) {
CMpegSplitterFile::ac3hdr h;
- if(Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1)) && s.mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
+ if (Read(h, len, &s.mt, false, (m_AC3CoreOnly == 1)) && s.mt.subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
m_streams[audio].Replace((stream&)*source, s, this);
}
}
@@ -646,7 +646,7 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
#if (EVO_SUPPORT != 0)
else if (pesid == 0xfd) { // TODO EVO SUPPORT
CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
+ if (!m_streams[video].Find(s) && Read(h, len, &s.mt, m_nVC1_GuidFlag)) {
type = video;
}
}
@@ -656,98 +656,98 @@ DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
WORD w = (WORD)BitRead(16, true);
DWORD dw = (DWORD)BitRead(32, true);
- if(b >= 0x80 && b < 0x88 || w == 0x0b77) { // ac3
+ if (b >= 0x80 && b < 0x88 || w == 0x0b77) { // ac3
s.ps1id = (b >= 0x80 && b < 0x88) ? (BYTE)(BitRead(32) >> 24) : 0x80;
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) { // dts
+ } else if (b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) { // dts
s.ps1id = (b >= 0x88 && b < 0x90) ? (BYTE)(BitRead(32) >> 24) : 0x88;
CMpegSplitterFile::dtshdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(b >= 0xa0 && b < 0xa8) { // lpcm
+ } else if (b >= 0xa0 && b < 0xa8) { // lpcm
s.ps1id = (b >= 0xa0 && b < 0xa8) ? (BYTE)(BitRead(32) >> 24) : 0xa0;
CMpegSplitterFile::lpcmhdr h;
- if(Read(h, &s.mt) && !m_streams[audio].Find(s)) { // note the reversed order, the header should be stripped always even if it's not a new stream
+ if (Read(h, &s.mt) && !m_streams[audio].Find(s)) { // note the reversed order, the header should be stripped always even if it's not a new stream
type = audio;
}
- } else if(b >= 0x20 && b < 0x40) { // DVD subpic
+ } else if (b >= 0x20 && b < 0x40) { // DVD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::dvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(b >= 0x70 && b < 0x80) { // SVCD subpic
+ } else if (b >= 0x70 && b < 0x80) { // SVCD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::svcdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(b >= 0x00 && b < 0x10) { // CVD subpic
+ } else if (b >= 0x00 && b < 0x10) { // CVD subpic
s.ps1id = (BYTE)BitRead(8);
CMpegSplitterFile::cvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
- } else if(w == 0xffa0 || w == 0xffa1) { // ps2-mpg audio
+ } else if (w == 0xffa0 || w == 0xffa1) { // ps2-mpg audio
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0xa000 | track id
CMpegSplitterFile::ps2audhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, &s.mt)) {
type = audio;
}
- } else if(w == 0xff90) { // ps2-mpg ac3 or subtitles
+ } else if (w == 0xff90) { // ps2-mpg ac3 or subtitles
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
w = (WORD)BitRead(16, true);
- if(w == 0x0b77) {
+ if (w == 0x0b77) {
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
- } else if(w == 0x0000) { // usually zero...
+ } else if (w == 0x0000) { // usually zero...
CMpegSplitterFile::ps2subhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt)) {
type = subpic;
}
}
}
#if (EVO_SUPPORT != 0)
- else if(b >= 0xc0 && b < 0xc8) { // dolby digital +
+ else if (b >= 0xc0 && b < 0xc8) { // dolby digital +
s.ps1id = (BYTE)BitRead(8);
s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
w = (WORD)BitRead(16, true);
- if(w == 0x0b77) {
+ if (w == 0x0b77) {
CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
+ if (!m_streams[audio].Find(s) && Read(h, len, &s.mt)) {
type = audio;
}
}
}
#endif
}
- } else if(pesid == 0xbe) { // padding
- } else if(pesid == 0xbf) { // private stream 2
+ } else if (pesid == 0xbe) { // padding
+ } else if (pesid == 0xbf) { // private stream 2
}
- if(type != unknown && !m_streams[type].Find(s)) {
- if(s.pid) {
- for(int i = 0; i < unknown; i++) {
- if(m_streams[i].Find(s)) {
+ if (type != unknown && !m_streams[type].Find(s)) {
+ if (s.pid) {
+ for (int i = 0; i < unknown; i++) {
+ if (m_streams[i].Find(s)) {
/*ASSERT(0);*/
return s;
}
@@ -768,7 +768,7 @@ void CMpegSplitterFile::AddHdmvPGStream(WORD pid, const char* language_code)
s.pesid = 0xbd;
CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code)) {
+ if (!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code)) {
m_streams[subpic].Insert(s, this);
}
}
@@ -789,38 +789,38 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang)
{
CAutoLock cAutoLock(&m_csProps);
- if(h.payload && h.payloadstart && h.pid == 0) {
+ if (h.payload && h.payloadstart && h.pid == 0) {
trsechdr h2;
- if(Read(h2) && h2.table_id == 0) {
+ if (Read(h2) && h2.table_id == 0) {
CAtlMap<WORD, bool> newprograms;
int len = h2.section_length;
len -= 5+4;
- for(int i = len/4; i > 0; i--) {
+ for (int i = len/4; i > 0; i--) {
WORD program_number = (WORD)BitRead(16);
BYTE reserved = (BYTE)BitRead(3);
WORD pid = (WORD)BitRead(13);
UNUSED_ALWAYS(reserved);
- if(program_number != 0) {
+ if (program_number != 0) {
m_programs[pid].program_number = program_number;
newprograms[program_number] = true;
}
}
POSITION pos = m_programs.GetStartPosition();
- while(pos) {
+ while (pos) {
const CAtlMap<WORD, program>::CPair* pPair = m_programs.GetNext(pos);
- if(!newprograms.Lookup(pPair->m_value.program_number)) {
+ if (!newprograms.Lookup(pPair->m_value.program_number)) {
m_programs.RemoveKey(pPair->m_key);
}
}
}
- } else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid)) {
- if(h.payload && h.payloadstart) {
+ } else if (CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid)) {
+ if (h.payload && h.payloadstart) {
trsechdr h2;
- if(Read(h2) && h2.table_id == 2) {
+ if (Read(h2) && h2.table_id == 2) {
int len = h2.section_length;
len -= 5+4;
@@ -829,8 +829,8 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang)
CGolombBuffer gb(buffer, len);
int max_len = h.bytes - 9;
-
- if(len > max_len) {
+
+ if (len > max_len) {
memset(pPair->m_value.ts_buffer, 0, sizeof(pPair->m_value.ts_buffer));
pPair->m_value.ts_len_cur = max_len;
pPair->m_value.ts_len_packet = len;
@@ -841,9 +841,9 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang)
}
}
} else {
- if(pPair->m_value.ts_len_cur > 0) {
+ if (pPair->m_value.ts_len_cur > 0) {
int len = pPair->m_value.ts_len_packet - pPair->m_value.ts_len_cur;
- if(len > h.bytes) {
+ if (len > h.bytes) {
ByteRead(pPair->m_value.ts_buffer + pPair->m_value.ts_len_cur, h.bytes);
pPair->m_value.ts_len_cur += h.bytes;
} else {
@@ -858,7 +858,7 @@ void CMpegSplitterFile::UpdatePrograms(const trhdr& h, bool UpdateLang)
void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLang)
{
- if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(pid))
+ if (CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(pid))
{
memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
@@ -873,14 +873,14 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa
UNUSED_ALWAYS(reserved2);
len -= (4 + program_info_length);
- if(len <= 0)
+ if (len <= 0)
return;
- while(program_info_length-- > 0) {
+ while (program_info_length-- > 0) {
gb.BitRead(8);
}
- for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
+ for (int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++) {
BYTE stream_type = (BYTE)gb.BitRead(8);
BYTE nreserved1 = (BYTE)gb.BitRead(3);
WORD pid = (WORD)gb.BitRead(13);
@@ -891,14 +891,14 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa
pPair->m_value.streams[i].pid = pid;
pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
-
- if(m_ForcedSub) {
- if(stream_type == PRESENTATION_GRAPHICS_STREAM) {
+
+ if (m_ForcedSub) {
+ if (stream_type == PRESENTATION_GRAPHICS_STREAM) {
stream s;
s.pid = pid;
CMpegSplitterFile::hdmvsubhdr hdr;
- if(Read(hdr, &s.mt, NULL)) {
- if(!m_streams[subpic].Find(s)) {
+ if (Read(hdr, &s.mt, NULL)) {
+ if (!m_streams[subpic].Find(s)) {
m_streams[subpic].Insert(s, this);
}
}
@@ -906,43 +906,43 @@ void CMpegSplitterFile::UpdatePrograms(CGolombBuffer gb, WORD pid, bool UpdateLa
}
len -= (5 + ES_info_length);
- if(len < 0)
+ if (len < 0)
break;
- if(ES_info_length<=2)
+ if (ES_info_length<=2)
continue;
- if(UpdateLang) {
+ if (UpdateLang) {
int info_length = ES_info_length;
- for(;;) {
+ for (;;) {
BYTE descriptor_tag = gb.BitRead(8);
BYTE descriptor_length = gb.BitRead(8);
info_length -= (2 + descriptor_length);
- if(info_length < 0)
+ if (info_length < 0)
break;
char ch[4];
- switch(descriptor_tag) {
+ switch (descriptor_tag) {
case 0x0a: // ISO 639 language descriptor
case 0x56: // Teletext descriptor
case 0x59: // Subtitling descriptor
gb.ReadBuffer((BYTE *)ch, 3);
ch[3] = 0;
- for(int i = 3; i < descriptor_length; i++) {
+ for (int i = 3; i < descriptor_length; i++) {
gb.BitRead(8);
}
- if(!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
+ if (!(ch[0] == 'u' && ch[1] == 'n' && ch[2] == 'd')) {
m_pPMT_Lang[pid] = ISO6392ToLanguage(ch);
}
break;
default:
- for(int i = 0; i < descriptor_length; i++) {
+ for (int i = 0; i < descriptor_length; i++) {
gb.BitRead(8);
}
break;
}
- if(info_length<=2) break;
+ if (info_length<=2) break;
}
} else {
- while(ES_info_length-- > 0) {
+ while (ES_info_length-- > 0) {
gb.BitRead(8);
}
}
@@ -970,11 +970,11 @@ const CMpegSplitterFile::program* CMpegSplitterFile::FindProgram(WORD pid, int &
POSITION pos = m_programs.GetStartPosition();
- while(pos) {
+ while (pos) {
program* p = &m_programs.GetNextValue(pos);
- for(int i = 0; i < countof(p->streams); i++) {
- if(p->streams[i].pid == pid) {
+ for (int i = 0; i < countof(p->streams); i++) {
+ if (p->streams[i].pid == pid) {
iStream = i;
return p;
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.h b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
index 300dd30c1..46c4f23ec 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.h
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
@@ -78,21 +78,22 @@ public:
}
};
- enum {video, audio, subpic,
+ enum {video, audio, subpic,
#if defined(MVC_SUPPORT)
- stereo,
+ stereo,
#endif
- unknown};
+ unknown
+ };
class CStreamList : public CAtlList<stream>
{
public:
void Insert(stream& s, CMpegSplitterFile *_pFile) {
s.m_pFile = _pFile;
- if(_pFile->m_TrackPriority) {
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ if (_pFile->m_TrackPriority) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
stream& s2 = GetAt(pos);
- if(s < s2) {
+ if (s < s2) {
InsertBefore(pos, s);
return;
}
@@ -100,9 +101,9 @@ public:
AddTail(s);
} else {
AddTail(s);
- if(GetCount() > 1) {
+ if (GetCount() > 1) {
for (size_t j=0; j<GetCount(); j++) {
- for(size_t i=0; i<GetCount()-1; i++) {
+ for (size_t i=0; i<GetCount()-1; i++) {
if (GetAt(FindIndex(i)) > GetAt(FindIndex(i+1))) {
SwapElements(FindIndex(i), FindIndex(i+1));
}
@@ -115,9 +116,9 @@ public:
void Replace(stream& source, stream& dest, CMpegSplitterFile *_pFile) {
source.m_pFile = _pFile;
dest.m_pFile = _pFile;
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
stream& s = GetAt(pos);
- if(source == s) {
+ if (source == s) {
SetAt(pos, dest);
return;
}
@@ -130,15 +131,15 @@ public:
type == audio ? L"Audio" :
type == subpic ? L"Subtitle" :
#if defined(MVC_SUPPORT)
- type == stereo ? L"Stereo" :
+ type == stereo ? L"Stereo" :
#endif
L"Unknown";
}
const stream* FindStream(int pid) {
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
+ for (POSITION pos = GetHeadPosition(); pos; GetNext(pos)) {
const stream& s = GetAt(pos);
- if(s.pid == pid) {
+ if (s.pid == pid) {
return &s;
}
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp b/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp
index ff194e856..b813d4d37 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitterSettingsWnd.cpp
@@ -42,11 +42,11 @@ bool CMpegSplitterSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUn
m_pMSF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMSF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMSF = pUnks.GetNext(pos))) {
;
}
- if(!m_pMSF) {
+ if (!m_pMSF) {
return false;
}
@@ -63,7 +63,7 @@ bool CMpegSplitterSettingsWnd::OnActivate()
int nPosY = 10;
m_grpDefault.Create (ResStr(IDS_OPTIONS_CAPTION), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 320, nPosY+285), this, (UINT)IDC_STATIC);
-
+
nPosY += VERTICAL_SPACING;
m_cbFastStreamChange.Create (ResStr(IDS_MPEGSPLITTER_FSTREAM_CHANGE), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING, nPosY, 305, nPosY+15), this, IDC_PP_FAST_STREAM_SELECT);
@@ -72,7 +72,7 @@ bool CMpegSplitterSettingsWnd::OnActivate()
nPosY += VERTICAL_SPACING;
m_cbTrackPriority.Create (_T("Change Audio-track Priority"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING, nPosY, 305, nPosY+15), this, IDC_PP_TRACK_PRIORITY);
-
+
nPosY += VERTICAL_SPACING;
m_txtAudioLanguageOrder.Create (ResStr(IDS_MPEGSPLITTER_LANG_ORDER), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 200, nPosY+15), this, (UINT)IDC_STATIC);
nPosY += 15;
@@ -101,7 +101,7 @@ bool CMpegSplitterSettingsWnd::OnActivate()
m_cbAC3Core.Create (_T("AC-3 Core"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE, CRect (LEFT_SPACING + 15 + 95, nPosY, LEFT_SPACING + 15 + 185, nPosY+20), this, IDC_PP_AC3CORE);
m_cbAsIs.Create (_T("As Source"), WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE, CRect (LEFT_SPACING + 15 + 190, nPosY, LEFT_SPACING + 15 + 260, nPosY+20), this, IDC_PP_ASIS);
- if(m_pMSF) {
+ if (m_pMSF) {
m_cbFastStreamChange.SetCheck(m_pMSF->GetFastStreamChange());
m_cbForcedSub.SetCheck(m_pMSF->GetForcedSub());
m_cbTrackPriority.SetCheck(m_pMSF->GetTrackPriority());
@@ -119,7 +119,7 @@ bool CMpegSplitterSettingsWnd::OnActivate()
#endif
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -134,14 +134,14 @@ bool CMpegSplitterSettingsWnd::OnApply()
{
OnDeactivate();
- if(m_pMSF) {
+ if (m_pMSF) {
m_pMSF->SetFastStreamChange(m_cbFastStreamChange.GetCheck());
m_pMSF->SetForcedSub(m_cbForcedSub.GetCheck());
m_pMSF->SetTrackPriority(m_cbTrackPriority.GetCheck());
m_pMSF->SetVC1_GuidFlag(m_cbVC1_GuidFlag.GetCurSel() + 1);
m_pMSF->SetTrueHD(m_cbTrueHD.GetCheck() ? 0 : m_cbAC3Core.GetCheck() ? 1 : 2);
-#ifdef REGISTER_FILTER
+#ifdef REGISTER_FILTER
CString str = _T("");
m_edtAudioLanguageOrder.GetWindowText(str);
m_pMSF->SetAudioLanguageOrder(str.GetBuffer());
diff --git a/src/filters/parser/OggSplitter/OggFile.cpp b/src/filters/parser/OggSplitter/OggFile.cpp
index 6df7d81cf..ac7ce7227 100644
--- a/src/filters/parser/OggSplitter/OggFile.cpp
+++ b/src/filters/parser/OggSplitter/OggFile.cpp
@@ -4,7 +4,7 @@
COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -13,7 +13,7 @@ COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr)
HRESULT COggFile::Init()
{
Seek(0);
- if(!Sync()) {
+ if (!Sync()) {
return E_FAIL;
}
@@ -25,11 +25,11 @@ bool COggFile::Sync(HANDLE hBreak)
__int64 start = GetPos();
DWORD dw;
- for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
+ for (__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
&& ((i&0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
i++, Seek(start + i)) {
- if(dw == 'SggO') {
+ if (dw == 'SggO') {
Seek(start + i);
return true;
}
@@ -51,27 +51,27 @@ bool COggFile::Read(OggPage& page, bool fFull, HANDLE hBreak)
page.m_lens.RemoveAll();
page.SetCount(0);
- if(!Read(page.m_hdr, hBreak)) {
+ if (!Read(page.m_hdr, hBreak)) {
return false;
}
int pagelen = 0, packetlen = 0;
- for(BYTE i = 0; i < page.m_hdr.number_page_segments; i++) {
+ for (BYTE i = 0; i < page.m_hdr.number_page_segments; i++) {
BYTE b;
- if(S_OK != ByteRead(&b, 1)) {
+ if (S_OK != ByteRead(&b, 1)) {
return false;
}
packetlen += b;
- if(1/*b < 0xff*/) {
+ if (1/*b < 0xff*/) {
page.m_lens.AddTail(packetlen);
pagelen += packetlen;
packetlen = 0;
}
}
- if(fFull) {
+ if (fFull) {
page.SetCount(pagelen);
- if(S_OK != ByteRead(page.GetData(), page.GetCount())) {
+ if (S_OK != ByteRead(page.GetData(), page.GetCount())) {
return false;
}
} else {
diff --git a/src/filters/parser/OggSplitter/OggSplitter.cpp b/src/filters/parser/OggSplitter/OggSplitter.cpp
index 8851b8053..c770f2007 100644
--- a/src/filters/parser/OggSplitter/OggSplitter.cpp
+++ b/src/filters/parser/OggSplitter/OggSplitter.cpp
@@ -100,13 +100,13 @@ public:
return(pos >= 0 && pos < m_len);
}
unsigned int showbits(int cnt) { // a bit unclean, but works and can read backwards too! :P
- if(!hasbits(cnt)) {
+ if (!hasbits(cnt)) {
ASSERT(0);
return 0;
}
unsigned int ret = 0, off = 0;
BYTE* p = m_p;
- if(cnt < 0) {
+ if (cnt < 0) {
p += (m_pos+cnt)>>3;
off = (m_pos+cnt)&7;
cnt = abs(cnt);
@@ -120,7 +120,7 @@ public:
off = 0;
cnt -= 8 - off;
}
- while(cnt > 0) {
+ while (cnt > 0) {
ret |= (*p++&((1<<min(cnt,8))-1)) << off;
off += 8;
cnt -= 8;
@@ -158,7 +158,7 @@ STDMETHODIMP COggSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, OggSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -174,10 +174,10 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew COggFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -189,14 +189,14 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile->Seek(0);
OggPage page;
- for(int i = 0, nWaitForMore = 0; m_pFile->Read(page), i<100; i++) {
+ for (int i = 0, nWaitForMore = 0; m_pFile->Read(page), i<100; i++) {
BYTE* p = page.GetData();
- if(!p) {
+ if (!p) {
break;
}
- if(!(page.m_hdr.header_type_flag & OggPageHeader::continued)) {
- if(!memcmp(p, "fishead", 7) || !memcmp(p, "fisbone", 7)) {
+ if (!(page.m_hdr.header_type_flag & OggPageHeader::continued)) {
+ if (!memcmp(p, "fishead", 7) || !memcmp(p, "fisbone", 7)) {
continue;
}
@@ -207,42 +207,42 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
HRESULT hr;
- if(type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6)) {
- if(type == 0x80) {
+ if (type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6)) {
+ if (type == 0x80) {
name.Format(L"Theora %d", i);
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
pPinOut.Attach(DNew COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
nWaitForMore++;
}
- } else if(type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first)) {
+ } else if (type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first)) {
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- if(!memcmp(p, "vorbis", 6)) {
+ if (!memcmp(p, "vorbis", 6)) {
name.Format(L"Vorbis %d", i);
pPinOut.Attach(DNew COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
nWaitForMore++;
- } else if(!memcmp(p, "video", 5)) {
+ } else if (!memcmp(p, "video", 5)) {
name.Format(L"Video %d", i);
pPinOut.Attach(DNew COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "audio", 5)) {
+ } else if (!memcmp(p, "audio", 5)) {
name.Format(L"Audio %d", i);
pPinOut.Attach(DNew COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "text", 4)) {
+ } else if (!memcmp(p, "text", 4)) {
name.Format(L"Text %d", i);
pPinOut.Attach(DNew COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- } else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35)) {
+ } else if (!memcmp(p, "Direct Show Samples embedded in Ogg", 35)) {
name.Format(L"DirectShow %d", i);
pPinOut.Attach(DNew COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
}
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- } else if(type == 3 && !memcmp(p, "vorbis", 6)) {
- if(COggSplitterOutputPin* pOggPin =
+ } else if (type == 3 && !memcmp(p, "vorbis", 6)) {
+ if (COggSplitterOutputPin* pOggPin =
dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
pOggPin->AddComment(p+6, page.GetCount()-6-1);
}
- } else if(type == 0x7F && page.GetCount()>12 && *(long*)(p+8) == 0x43614C66) { // Flac
+ } else if (type == 0x7F && page.GetCount()>12 && *(long*)(p+8) == 0x43614C66) { // Flac
// Ogg Flac : method 1
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
name.Format(L"Flac %d", i);
@@ -258,37 +258,37 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
pPinOut.Attach(DNew COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
}
- } else if(!(type&1) && nWaitForMore == 0) {
+ } else if (!(type&1) && nWaitForMore == 0) {
break;
}
}
- if(COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
p->UnpackInitPage(page);
- if(p->IsInitialized()) {
+ if (p->IsInitialized()) {
nWaitForMore--;
}
}
- if(COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
p->UnpackInitPage(page);
- if(p->IsInitialized()) {
+ if (p->IsInitialized()) {
nWaitForMore--;
}
}
}
- if(m_pOutputs.IsEmpty()) {
+ if (m_pOutputs.IsEmpty()) {
return E_FAIL;
}
- if(m_pFile->IsRandomAccess()) {
+ if (m_pFile->IsRandomAccess()) {
m_pFile->Seek(max(m_pFile->GetLength()-65536, 0));
OggPage page;
- while(m_pFile->Read(page)) {
+ while (m_pFile->Read(page)) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin || page.m_hdr.granule_position == -1) {
+ if (!pOggPin || page.m_hdr.granule_position == -1) {
continue;
}
REFERENCE_TIME rt = pOggPin->GetRefTime(page.m_hdr.granule_position);
@@ -309,19 +309,19 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
tagmap[L"DESCRIPTION"] = L"DESC";
POSITION pos2 = tagmap.GetStartPosition();
- while(pos2) {
+ while (pos2) {
CStringW oggtag, dsmtag;
tagmap.GetNextAssoc(pos2, oggtag, dsmtag);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) {
+ if (!pOggPin) {
continue;
}
CStringW value = pOggPin->GetComment(oggtag);
- if(!value.IsEmpty()) {
+ if (!value.IsEmpty()) {
SetProperty(dsmtag, value);
break;
}
@@ -329,27 +329,27 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !ChapGetCount()) {
+ while (pos && !ChapGetCount()) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) {
+ if (!pOggPin) {
continue;
}
- for(int i = 1; pOggPin; i++) {
+ for (int i = 1; pOggPin; i++) {
CStringW key;
key.Format(L"CHAPTER%02d", i);
CStringW time = pOggPin->GetComment(key);
- if(time.IsEmpty()) {
+ if (time.IsEmpty()) {
break;
}
key.Format(L"CHAPTER%02dNAME", i);
CStringW name = pOggPin->GetComment(key);
- if(name.IsEmpty()) {
+ if (name.IsEmpty()) {
name.Format(L"Chapter %d", i);
}
int h, m, s, ms;
WCHAR c;
- if(7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
+ if (7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
break;
}
REFERENCE_TIME rt = ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000;
@@ -364,7 +364,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bool COggSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "COggSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
@@ -373,9 +373,9 @@ bool COggSplitterFilter::DemuxInit()
void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0 ) {
+ if (rt <= 0 ) {
m_pFile->Seek(0);
- } else if(m_rtDuration > 0) {
+ } else if (m_rtDuration > 0) {
// oh, the horror...
__int64 len = m_pFile->GetLength();
@@ -384,19 +384,19 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
REFERENCE_TIME rtMinDiff = _I64_MAX;
- while(1) {
+ while (1) {
__int64 endpos = startpos;
REFERENCE_TIME rtPos = -1;
OggPage page;
m_pFile->Seek(startpos);
- while(m_pFile->Read(page, false)) {
- if(page.m_hdr.granule_position == -1) {
+ while (m_pFile->Read(page, false)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin) {
+ if (!pOggPin) {
ASSERT(0);
continue;
}
@@ -409,10 +409,10 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
__int64 rtDiff = rtPos - rt;
- if(rtDiff < 0) {
+ if (rtDiff < 0) {
rtDiff = -rtDiff;
- if(rtDiff < 1000000 || rtDiff >= rtMinDiff) {
+ if (rtDiff < 1000000 || rtDiff >= rtMinDiff) {
m_pFile->Seek(startpos);
break;
}
@@ -422,17 +422,17 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
__int64 newpos = startpos;
- if(rtPos < rt && rtPos < m_rtDuration) {
+ if (rtPos < rt && rtPos < m_rtDuration) {
newpos = startpos + (__int64)((1.0*(rt - rtPos)/(m_rtDuration - rtPos)) * (len - startpos)) + 1024;
- if(newpos < endpos) {
+ if (newpos < endpos) {
newpos = endpos + 1024;
}
- } else if(rtPos > rt && rtPos > 0) {
+ } else if (rtPos > rt && rtPos > 0) {
newpos = startpos - (__int64)((1.0*(rtPos - rt)/(rtPos - 0)) * (startpos - 0)) - 1024;
- if(newpos >= startpos) {
+ if (newpos >= startpos) {
newpos = startpos - 1024;
}
- } else if(rtPos == rt) {
+ } else if (rtPos == rt) {
m_pFile->Seek(startpos);
break;
} else {
@@ -449,51 +449,51 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
m_pFile->Seek(startpos);
POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
COggSplitterOutputPin* pPin = dynamic_cast<COggSplitterOutputPin*>(static_cast<CBaseSplitterOutputPin*>(m_pOutputs.GetNext(pos)));
- if(!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin)) {
+ if (!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin)) {
continue;
}
bool fKeyFrameFound = false, fSkipKeyFrame = true;
__int64 endpos = _I64_MAX;
- while(!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0) {
+ while (!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0) {
OggPage page;
- while(!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page)) {
- if(page.m_hdr.granule_position == -1) {
+ while (!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
continue;
}
- if(pPin->GetRefTime(page.m_hdr.granule_position) > rt) {
+ if (pPin->GetRefTime(page.m_hdr.granule_position) > rt) {
break;
}
- if(!fKeyFrameFound) {
+ if (!fKeyFrameFound) {
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(p->bSyncPoint) {
+ while (p = pPin->GetPacket()) {
+ if (p->bSyncPoint) {
fKeyFrameFound = true;
fSkipKeyFrame = p->fSkip;
}
}
- if(fKeyFrameFound) {
+ if (fKeyFrameFound) {
break;
}
} else {
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(!p->fSkip) {
+ while (p = pPin->GetPacket()) {
+ if (!p->fSkip) {
fSkipKeyFrame = false;
break;
}
@@ -501,7 +501,7 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
}
}
- if(!(fKeyFrameFound && !fSkipKeyFrame)) {
+ if (!(fKeyFrameFound && !fSkipKeyFrame)) {
endpos = startpos;
startpos = max(startpos - 10*65536, 0);
}
@@ -516,25 +516,25 @@ void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
fKeyFrameFound = false;
OggPage page;
- while(!fKeyFrameFound && m_pFile->Read(page)) {
- if(page.m_hdr.granule_position == -1) {
+ while (!fKeyFrameFound && m_pFile->Read(page)) {
+ if (page.m_hdr.granule_position == -1) {
continue;
}
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
+ if (pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number))) {
continue;
}
REFERENCE_TIME rtPos = pPin->GetRefTime(page.m_hdr.granule_position);
- if(rtPos > rt) {
+ if (rtPos > rt) {
break;
}
pPin->UnpackPage(page);
CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket()) {
- if(p->bSyncPoint) {
+ while (p = pPin->GetPacket()) {
+ if (p->bSyncPoint) {
fKeyFrameFound = true;
break;
}
@@ -556,22 +556,22 @@ bool COggSplitterFilter::DemuxLoop()
HRESULT hr = S_OK;
OggPage page;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle())) {
+ while (SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle())) {
COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin) {
+ if (!pOggPin) {
ASSERT(0);
continue;
}
- if(!pOggPin->IsConnected()) {
+ if (!pOggPin->IsConnected()) {
continue;
}
- if(FAILED(hr = pOggPin->UnpackPage(page))) {
+ if (FAILED(hr = pOggPin->UnpackPage(page))) {
ASSERT(0);
break;
}
CAutoPtr<OggPacket> p;
- while(!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket())) {
- if(!p->fSkip) {
+ while (!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket())) {
+ if (!p->fSkip) {
hr = DeliverPacket(p);
}
}
@@ -605,24 +605,24 @@ void COggSplitterOutputPin::AddComment(BYTE* p, int len)
{
bitstream bs(p, len);
bs.getbits(bs.getbits(32)*8);
- for(int n = bs.getbits(32); n-- > 0; ) {
+ for (int n = bs.getbits(32); n-- > 0; ) {
CStringA str;
- for(int len = bs.getbits(32); len-- > 0; ) {
+ for (int len = bs.getbits(32); len-- > 0; ) {
str += (CHAR)bs.getbits(8);
}
CAtlList<CStringA> sl;
Explode(str, sl, '=', 2);
- if(sl.GetCount() == 2) {
+ if (sl.GetCount() == 2) {
CAutoPtr<CComment> p(DNew CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
- if(p->m_key == L"LANGUAGE") {
+ if (p->m_key == L"LANGUAGE") {
CString lang = ISO6392ToLanguage(sl.GetTail()), iso6392 = LanguageToISO6392(CString(p->m_value));
- if(p->m_value.GetLength() == 3 && !lang.IsEmpty()) {
+ if (p->m_value.GetLength() == 3 && !lang.IsEmpty()) {
SetName(CStringW(lang));
SetProperty(L"LANG", p->m_value);
- } else if(!iso6392.IsEmpty()) {
+ } else if (!iso6392.IsEmpty()) {
SetName(p->m_value);
SetProperty(L"LANG", CStringW(iso6392));
} else {
@@ -642,9 +642,9 @@ CStringW COggSplitterOutputPin::GetComment(CStringW key)
key.MakeUpper();
CAtlList<CStringW> sl;
POSITION pos = m_pComments.GetHeadPosition();
- while(pos) {
+ while (pos) {
CComment* p = m_pComments.GetNext(pos);
- if(key == p->m_key) {
+ if (key == p->m_key) {
sl.AddTail(p->m_value);
}
}
@@ -663,7 +663,7 @@ void COggSplitterOutputPin::ResetState(DWORD seqnum)
HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
{
- if(m_lastseqnum != page.m_hdr.page_sequence_number - 1) {
+ if (m_lastseqnum != page.m_hdr.page_sequence_number - 1) {
ResetState(page.m_hdr.page_sequence_number);
return S_FALSE; // FIXME
} else {
@@ -671,18 +671,18 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
}
POSITION first = page.m_lens.GetHeadPosition();
- while(first && page.m_lens.GetAt(first) == 255) {
+ while (first && page.m_lens.GetAt(first) == 255) {
page.m_lens.GetNext(first);
}
- if(!first) {
+ if (!first) {
first = page.m_lens.GetTailPosition();
}
POSITION last = page.m_lens.GetTailPosition();
- while(last && page.m_lens.GetAt(last) == 255) {
+ while (last && page.m_lens.GetAt(last) == 255) {
page.m_lens.GetPrev(last);
}
- if(!last) {
+ if (!last) {
last = page.m_lens.GetTailPosition();
}
@@ -690,36 +690,36 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
int i = 0, j = 0, len = 0;
- for(POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos)) {
+ for (POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos)) {
len = page.m_lens.GetAt(pos);
j += len;
- if(len < 255 || pos == page.m_lens.GetTailPosition()) {
- if(first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued)) {
+ if (len < 255 || pos == page.m_lens.GetTailPosition()) {
+ if (first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued)) {
// ASSERT(m_lastpacket);
- if(m_lastpacket) {
+ if (m_lastpacket) {
int size = m_lastpacket->GetCount();
m_lastpacket->SetCount(size + j-i);
memcpy(m_lastpacket->GetData() + size, pData + i, j-i);
CAutoLock csAutoLock(&m_csPackets);
- if(len < 255) {
+ if (len < 255) {
m_packets.AddTail(m_lastpacket);
}
}
} else {
CAutoPtr<OggPacket> p(DNew OggPacket());
- if(last == pos && page.m_hdr.granule_position != -1) {
+ if (last == pos && page.m_hdr.granule_position != -1) {
p->bDiscontinuity = m_fSkip;
REFERENCE_TIME rtLast = m_rtLast;
m_rtLast = GetRefTime(page.m_hdr.granule_position);
// some bad encodings have a +/-1 frame difference from the normal timeline,
// but these seem to cancel eachother out nicely so we can just ignore them
// to make it play a bit more smooth.
- if(abs(rtLast - m_rtLast) == GetRefTime(1)) {
+ if (abs(rtLast - m_rtLast) == GetRefTime(1)) {
m_rtLast = rtLast; // FIXME
}
m_fSkip = false;
@@ -727,19 +727,19 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
p->TrackNumber = page.m_hdr.bitstream_serial_number;
- if(S_OK == UnpackPacket(p, pData + i, j-i)) {
+ if (S_OK == UnpackPacket(p, pData + i, j-i)) {
//if(p->TrackNumber == 1)
//TRACE(_T("[%d]: %d, %I64d -> %I64d (skip=%d, disc=%d, sync=%d)\n"),
// (int)p->TrackNumber, p->GetCount(), p->rtStart, p->rtStop,
// (int)m_fSkip, (int)p->bDiscontinuity, (int)p->bSyncPoint);
- if(p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60) {
+ if (p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60) {
CAutoLock csAutoLock(&m_csPackets);
m_rtLast = p->rtStop;
p->fSkip = m_fSkip;
- if(len < 255) {
+ if (len < 255) {
m_packets.AddTail(p);
} else {
m_lastpacket = p;
@@ -761,7 +761,7 @@ CAutoPtr<OggPacket> COggSplitterOutputPin::GetPacket()
{
CAutoPtr<OggPacket> p;
CAutoLock csAutoLock(&m_csPackets);
- if(m_packets.GetCount()) {
+ if (m_packets.GetCount()) {
p = m_packets.RemoveHead();
}
return p;
@@ -824,16 +824,16 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page)
{
HRESULT hr = __super::UnpackPage(page);
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
Packet* p = m_packets.GetHead();
- if(p->GetCount() >= 6 && p->GetAt(0) == 0x05) {
+ if (p->GetCount() >= 6 && p->GetAt(0) == 0x05) {
// yeah, right, we are going to be parsing this backwards! :P
bitstream bs(p->GetData(), p->GetCount(), true);
- while(bs.hasbits(-1) && bs.getbits(-1) != 1) {
+ while (bs.hasbits(-1) && bs.getbits(-1) != 1) {
;
}
- for(int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++) {
+ for (int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++) {
unsigned int modes = bs.showbits(-6) + 1;
unsigned int mapping = bs.getbits(-8);
@@ -842,7 +842,7 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page)
unsigned int blockflag = bs.getbits(-1);
UNUSED_ALWAYS(mapping);
- if(transformtype != 0 || windowtype != 0) {
+ if (transformtype != 0 || windowtype != 0) {
ASSERT(modes == cnt);
UNREFERENCED_PARAMETER(modes);
break;
@@ -853,7 +853,7 @@ HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page)
}
int cnt = m_initpackets.GetCount();
- if(cnt <= 3 && (p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2)) {
+ if (cnt <= 3 && (p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2)) {
VORBISFORMAT2* vf2 = (VORBISFORMAT2*)m_mts[0].Format();
vf2->HeaderSize[cnt] = p->GetCount();
int len = m_mts[0].FormatLength();
@@ -874,16 +874,16 @@ REFERENCE_TIME COggVorbisOutputPin::GetRefTime(__int64 granule_position)
HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(len > 0 && m_blockflags.GetCount()) {
+ if (len > 0 && m_blockflags.GetCount()) {
bitstream bs(pData, len);
- if(bs.getbits(1) == 0) {
+ if (bs.getbits(1) == 0) {
int x = m_blockflags.GetCount()-1, n = 0;
- while(x) {
+ while (x) {
n++;
x >>= 1;
}
DWORD blocksize = m_blocksize[m_blockflags[bs.getbits(n)]?1:0];
- if(m_lastblocksize) {
+ if (m_lastblocksize) {
m_rtLast += GetRefTime((m_lastblocksize + blocksize) >> 2);
}
m_lastblocksize = blocksize;
@@ -900,7 +900,7 @@ HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i
HRESULT COggVorbisOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0)&1)) {
+ if (p->GetCount() > 0 && (p->GetAt(0)&1)) {
return S_OK;
}
@@ -913,9 +913,9 @@ HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_
m_lastblocksize = 0;
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis) {
+ if (m_mt.subtype == MEDIASUBTYPE_Vorbis) {
POSITION pos = m_initpackets.GetHeadPosition();
- while(pos) {
+ while (pos) {
Packet* pi = m_initpackets.GetNext(pos);
CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
@@ -941,7 +941,7 @@ COggFlacOutputPin::COggFlacOutputPin(BYTE* h, int nCount, LPCWSTR pName, CBaseFi
Buffer.BitRead(1); // Last-metadata-block flag
if (Buffer.BitRead(7) != 0) { // Should be a STREAMINFO block
- if(phr) {
+ if (phr) {
*phr = VFW_E_INVALID_FILE_FORMAT;
}
return;
@@ -999,7 +999,7 @@ HRESULT COggFlacOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int
HRESULT COggFlacOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0)&1)) {
+ if (p->GetCount() > 0 && (p->GetAt(0)&1)) {
return S_OK;
}
@@ -1012,9 +1012,9 @@ HRESULT COggFlacOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TI
m_lastblocksize = 0;
- if(m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED) {
+ if (m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED) {
POSITION pos = m_initpackets.GetHeadPosition();
- while(pos) {
+ while (pos) {
Packet* pi = m_initpackets.GetNext(pos);
CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
@@ -1038,7 +1038,7 @@ COggDirectShowOutputPin::COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pNa
memcpy((AM_MEDIA_TYPE*)&mt, pmt, FIELD_OFFSET(AM_MEDIA_TYPE, pUnk));
mt.SetFormat((BYTE*)(pmt+1), pmt->cbFormat);
mt.SetSampleSize(1);
- if(mt.majortype == MEDIATYPE_Video) { // TODO: find samples for audio and find out what to return in GetRefTime...
+ if (mt.majortype == MEDIATYPE_Video) { // TODO: find samples for audio and find out what to return in GetRefTime...
m_mts.Add(mt);
}
}
@@ -1047,9 +1047,9 @@ REFERENCE_TIME COggDirectShowOutputPin::GetRefTime(__int64 granule_position)
{
REFERENCE_TIME rt = 0;
- if(m_mt.majortype == MEDIATYPE_Video) {
+ if (m_mt.majortype == MEDIATYPE_Video) {
rt = granule_position * ((VIDEOINFOHEADER*)m_mt.Format())->AvgTimePerFrame;
- } else if(m_mt.majortype == MEDIATYPE_Audio) {
+ } else if (m_mt.majortype == MEDIATYPE_Audio) {
rt = granule_position; // ((WAVEFORMATEX*)m_mt.Format())-> // TODO
}
@@ -1062,15 +1062,15 @@ HRESULT COggDirectShowOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pDat
BYTE hdr = pData[i++];
- if(!(hdr&1)) {
+ if (!(hdr&1)) {
// TODO: verify if this was still present in the old format (haven't found one sample yet)
BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
__int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++) {
+ for (int j = 0; j < nLenBytes; j++) {
Length |= (__int64)pData[i++] << (j << 3);
}
- if(len < i) {
+ if (len < i) {
ASSERT(0);
return E_FAIL;
}
@@ -1109,14 +1109,14 @@ HRESULT COggStreamOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i
BYTE hdr = pData[i++];
- if(!(hdr&1)) {
+ if (!(hdr&1)) {
BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
__int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++) {
+ for (int j = 0; j < nLenBytes; j++) {
Length |= (__int64)pData[i++] << (j << 3);
}
- if(len < i) {
+ if (len < i) {
ASSERT(0);
return E_FAIL;
}
@@ -1154,7 +1154,7 @@ COggVideoOutputPin::COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseF
pvih->bmiHeader.biHeight = h->v.h;
pvih->bmiHeader.biBitCount = (WORD)h->bps;
pvih->bmiHeader.biCompression = mt.subtype.Data1;
- switch(pvih->bmiHeader.biCompression) {
+ switch (pvih->bmiHeader.biCompression) {
case BI_RGB:
case BI_BITFIELDS:
mt.subtype =
@@ -1239,7 +1239,7 @@ COggTheoraOutputPin::COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pF
vih->hdr.bmiHeader.biBitCount = 24;
m_nFpsNum = (p[22]<<24)|(p[23]<<16)|(p[24]<<8)|p[25];
m_nFpsDenum = (p[26]<<24)|(p[27]<<16)|(p[28]<<8)|p[29];
- if(m_nFpsNum) {
+ if (m_nFpsNum) {
m_rtAvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * m_nFpsDenum / m_nFpsNum);
vih->hdr.AvgTimePerFrame = m_rtAvgTimePerFrame;
}
@@ -1261,7 +1261,7 @@ HRESULT COggTheoraOutputPin::UnpackInitPage(OggPage& page)
{
HRESULT hr = __super::UnpackPage(page);
- while(m_packets.GetCount()) {
+ while (m_packets.GetCount()) {
Packet* p = m_packets.GetHead();
CMediaType& mt = m_mts[0];
@@ -1300,7 +1300,7 @@ REFERENCE_TIME COggTheoraOutputPin::GetRefTime(__int64 granule_position)
HRESULT COggTheoraOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(!pData) {
+ if (!pData) {
return E_FAIL;
}
@@ -1309,7 +1309,7 @@ HRESULT COggTheoraOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i
p->rtStop = m_rtLast+1;
p->SetData(pData, len);
- if(!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video) {
+ if (!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video) {
p->rtStop = p->rtStart + ((MPEG2VIDEOINFO*)m_mt.Format())->hdr.AvgTimePerFrame;
}
diff --git a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
index aeb975c10..0329135d6 100644
--- a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
+++ b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
@@ -38,7 +38,7 @@ template<typename T>
static void bswap(T& var)
{
BYTE* s = (BYTE*)&var;
- for(BYTE* d = s + sizeof(var)-1; s < d; s++, d--) {
+ for (BYTE* d = s + sizeof(var)-1; s < d; s++, d--) {
*s ^= *d, *d ^= *s, *s ^= *d;
}
}
@@ -193,7 +193,7 @@ STDMETHODIMP CRealMediaSplitterFilter::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, RMSourceName);
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -206,7 +206,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
DWORD dw;
- if(FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.') {
+ if (FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.') {
return E_FAIL;
}
}
@@ -216,10 +216,10 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CRMFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
@@ -230,12 +230,12 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtStop = 10000i64*m_pFile->m_p.tDuration;
POSITION pos = m_pFile->m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
MediaProperies* pmp = m_pFile->m_mps.GetNext(pos);
CStringW name;
name.Format(L"Output %02d", pmp->stream);
- if(!pmp->name.IsEmpty()) {
+ if (!pmp->name.IsEmpty()) {
name += L" (" + CStringW(pmp->name) + L")";
}
@@ -244,7 +244,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CMediaType mt;
mt.SetSampleSize(max(pmp->maxPacketSize*16/**/, 1));
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
mt.majortype = MEDIATYPE_Video;
mt.formattype = FORMAT_VideoInfo;
@@ -259,7 +259,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
ASSERT(rvi.fcc1 == 'ODIV');
mt.subtype = FOURCCMap(rvi.fcc2);
- if(rvi.fps > 0x10000) {
+ if (rvi.fps > 0x10000) {
pvih->AvgTimePerFrame = REFERENCE_TIME(10000000i64 / ((float)rvi.fps/0x10000));
}
pvih->dwBitRate = pmp->avgBitRate;
@@ -273,7 +273,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.Add(mt);
- if(pmp->width > 0 && pmp->height > 0) {
+ if (pmp->width > 0 && pmp->height > 0) {
BITMAPINFOHEADER bmi = pvih->bmiHeader;
mt.formattype = FORMAT_VideoInfo2;
VIDEOINFOHEADER2* pvih2 = (VIDEOINFOHEADER2*)mt.ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2) + pmp->typeSpecData.GetCount());
@@ -287,7 +287,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.InsertAt(0, mt);
}
- } else if(pmp->mime == "audio/x-pn-realaudio") {
+ } else if (pmp->mime == "audio/x-pn-realaudio") {
mt.majortype = MEDIATYPE_Audio;
mt.formattype = FORMAT_WaveFormatEx;
mt.bTemporalCompression = 1;
@@ -305,8 +305,8 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
fccstr[4] = 0;
BYTE* fmt = pmp->typeSpecData.GetData();
- for(size_t i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++) {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
+ for (size_t i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++) {
+ if (fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
break;
}
}
@@ -316,7 +316,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
BYTE* extra = NULL;
- if(rai.version2 == 4) {
+ if (rai.version2 == 4) {
rainfo4 rai4 = *(rainfo4*)fmt;
rai4.bswap();
pwfe->nChannels = rai4.channels;
@@ -328,11 +328,11 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
p += len;
len = *p++;
ASSERT(len == 4);
- if(len == 4) {
+ if (len == 4) {
fcc = MAKEFOURCC(p[0],p[1],p[2],p[3]);
}
extra = p + len + 3;
- } else if(rai.version2 == 5) {
+ } else if (rai.version2 == 5) {
rainfo5 rai5 = *(rainfo5*)fmt;
rai5.bswap();
pwfe->nChannels = rai5.channels;
@@ -351,7 +351,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bswap(fcc);
- switch(fcc) {
+ switch (fcc) {
case '14_4':
pwfe->wFormatTag = WAVE_FORMAT_14_4;
break;
@@ -378,19 +378,19 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
break;
}
- if(pwfe->wFormatTag) {
+ if (pwfe->wFormatTag) {
mts.Add(mt);
- if(fcc == 'DNET') {
+ if (fcc == 'DNET') {
mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3);
mts.InsertAt(0, mt);
- } else if(fcc == 'RAAC' || fcc == 'RACP') {
+ } else if (fcc == 'RAAC' || fcc == 'RACP') {
mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_AAC);
int extralen = *(DWORD*)extra;
extra += 4;
::bswap(extralen);
ASSERT(*extra == 2); // always 2? why? what does it mean?
- if(*extra == 2) {
+ if (*extra == 2) {
extra++;
extralen--;
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + extralen);
@@ -403,7 +403,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
mts.InsertAt(0, mt);
}
}
- } else if(pmp->mime == "logical-fileinfo") {
+ } else if (pmp->mime == "logical-fileinfo") {
CAtlMap<CStringA, CStringA, CStringElementTraits<CStringA> > lfi;
CStringA key, value;
@@ -415,19 +415,19 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
bswap(cnt);
p += 4;
- if(cnt > 0xffff) { // different format?
+ if (cnt > 0xffff) { // different format?
p += 2;
cnt = p <= end-4 ? *(DWORD*)p : 0;
bswap(cnt);
p += 4;
}
- while(p < end-4 && cnt-- > 0) {
+ while (p < end-4 && cnt-- > 0) {
BYTE* base = p;
DWORD len = *(DWORD*)p;
bswap(len);
p += 4;
- if(base + len > end) {
+ if (base + len > end) {
break;
}
@@ -452,20 +452,20 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
POSITION pos = lfi.GetStartPosition();
- while(pos) {
+ while (pos) {
lfi.GetNextAssoc(pos, key, value);
int n = 0;
- if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
+ if (key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
&& (n = strtol(key.Mid(7), NULL, 10)) > 0) {
int h, m, s, ms;
char c;
- if(7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
+ if (7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) {
continue;
}
key.Format("CHAPTER%02dNAME", n);
- if(!lfi.Lookup(key, value) || value.IsEmpty()) {
+ if (!lfi.Lookup(key, value) || value.IsEmpty()) {
value.Format("Chapter %d", n);
}
@@ -476,7 +476,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
}
}
- if(mts.IsEmpty()) {
+ if (mts.IsEmpty()) {
TRACE(_T("Unsupported RealMedia stream (%d): %s\n"), pmp->stream, CString(pmp->mime));
continue;
}
@@ -484,20 +484,20 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
HRESULT hr;
CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
- if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut))) {
- if(!m_rtStop) {
+ if (SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut))) {
+ if (!m_rtStop) {
m_pFile->m_p.tDuration = max(m_pFile->m_p.tDuration, pmp->tDuration);
}
}
}
pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos; stream++) {
+ for (DWORD stream = 0; pos; stream++) {
CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
CStringW name;
name.Format(L"Subtitle %02d", stream);
- if(!s.name.IsEmpty()) {
+ if (!s.name.IsEmpty()) {
name += L" (" + CStringW(CString(s.name)) + L")";
}
@@ -528,13 +528,13 @@ bool CRealMediaSplitterFilter::DemuxInit()
{
SetThreadName((DWORD)-1, "CRealMediaSplitterFilter");
- if(!m_pFile) {
+ if (!m_pFile) {
return false;
}
// reindex if needed
- if(m_pFile->m_irs.GetCount() == 0) {
+ if (m_pFile->m_irs.GetCount() == 0) {
m_nOpenProgress = 0;
m_rtDuration = 0;
@@ -544,24 +544,24 @@ bool CRealMediaSplitterFilter::DemuxInit()
UINT32 nPacket = 0;
POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos && !m_fAbort) {
+ while (pos && !m_fAbort) {
DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
m_pFile->Seek(pdc->pos);
- for(UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++) {
+ for (UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++) {
UINT64 filepos = m_pFile->GetPos();
HRESULT hr;
MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph, false))) {
+ if (S_OK != (hr = m_pFile->Read(mph, false))) {
break;
}
m_rtDuration = max((__int64)(10000i64*mph.tStart), m_rtDuration);
- if(mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart) {
+ if (mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart) {
CAutoPtr<IndexRecord> pir(DNew IndexRecord);
pir->tStart = mph.tStart;
pir->ptrFilePos = (UINT32)filepos;
@@ -574,8 +574,8 @@ bool CRealMediaSplitterFilter::DemuxInit()
m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
DWORD cmd;
- if(CheckRequest(&cmd)) {
- if(cmd == CMD_EXIT) {
+ if (CheckRequest(&cmd)) {
+ if (cmd == CMD_EXIT) {
m_fAbort = true;
} else {
Reply(S_OK);
@@ -586,7 +586,7 @@ bool CRealMediaSplitterFilter::DemuxInit()
m_nOpenProgress = 100;
- if(m_fAbort) {
+ if (m_fAbort) {
m_pFile->m_irs.RemoveAll();
}
@@ -602,7 +602,7 @@ bool CRealMediaSplitterFilter::DemuxInit()
void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0) {
+ if (rt <= 0) {
m_seekpos = m_pFile->m_dcs.GetHeadPosition();
m_seekpacket = 0;
m_seekfilepos = m_pFile->m_dcs.GetHead()->pos;
@@ -610,23 +610,23 @@ void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
m_seekpos = NULL;
POSITION pos = m_pFile->m_irs.GetTailPosition();
- while(pos && !m_seekpos) {
+ while (pos && !m_seekpos) {
IndexRecord* pir = m_pFile->m_irs.GetPrev(pos);
- if(pir->tStart <= rt/10000) {
+ if (pir->tStart <= rt/10000) {
m_seekpacket = pir->packet;
pos = m_pFile->m_dcs.GetTailPosition();
- while(pos && !m_seekpos) {
+ while (pos && !m_seekpos) {
POSITION tmp = pos;
DataChunk* pdc = m_pFile->m_dcs.GetPrev(pos);
- if(pdc->pos <= pir->ptrFilePos) {
+ if (pdc->pos <= pir->ptrFilePos) {
m_seekpos = tmp;
m_seekfilepos = pir->ptrFilePos;
POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos != m_seekpos) {
+ while (pos != m_seekpos) {
m_seekpacket -= m_pFile->m_dcs.GetNext(pos)->nPackets;
}
}
@@ -669,7 +669,7 @@ void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
}
}
- if(!m_seekpos) {
+ if (!m_seekpos) {
m_seekpos = m_pFile->m_dcs.GetHeadPosition();
m_seekpacket = 0;
m_seekfilepos = m_pFile->m_dcs.GetAt(m_seekpos)->pos;
@@ -683,7 +683,7 @@ bool CRealMediaSplitterFilter::DemuxLoop()
POSITION pos;
pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++) {
+ for (DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++) {
CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet);
@@ -717,14 +717,14 @@ bool CRealMediaSplitterFilter::DemuxLoop()
}
pos = m_seekpos;
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
m_pFile->Seek(m_seekfilepos > 0 ? m_seekfilepos : pdc->pos);
- for(UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++) {
+ for (UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++) {
MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph))) {
+ if (S_OK != (hr = m_pFile->Read(mph))) {
break;
}
@@ -748,7 +748,7 @@ bool CRealMediaSplitterFilter::DemuxLoop()
STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
nKFs = m_pFile->m_irs.GetCount();
@@ -760,16 +760,16 @@ STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFEREN
CheckPointer(pFormat, E_POINTER);
CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) {
+ if (!m_pFile) {
return E_UNEXPECTED;
}
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) {
+ if (*pFormat != TIME_FORMAT_MEDIA_TIME) {
return E_INVALIDARG;
}
UINT nKFsTmp = 0;
POSITION pos = m_pFile->m_irs.GetHeadPosition();
- for(int i = 0; pos && nKFsTmp < nKFs; i++) {
+ for (int i = 0; pos && nKFsTmp < nKFs; i++) {
pKFs[nKFsTmp++] = 10000i64*m_pFile->m_irs.GetNext(pos)->tStart;
}
nKFs = nKFsTmp;
@@ -804,7 +804,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
{
HRESULT hr;
- if(m_segments.GetCount() == 0) {
+ if (m_segments.GetCount() == 0) {
m_segments.Clear();
return S_OK;
}
@@ -819,7 +819,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
DWORD len = 0, total = 0;
POSITION pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
segment* s = m_segments.GetNext(pos);
len = max(len, s->offset + s->data.GetCount());
total += s->data.GetCount();
@@ -833,14 +833,14 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
*pData++ = m_segments.fMerged ? 0 : m_segments.GetCount()-1;
- if(m_segments.fMerged) {
+ if (m_segments.fMerged) {
*((DWORD*)pData) = 1;
pData += 4;
*((DWORD*)pData) = 0;
pData += 4;
} else {
pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
*((DWORD*)pData) = 1;
pData += 4;
*((DWORD*)pData) = m_segments.GetNext(pos)->offset;
@@ -849,7 +849,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
}
pos = m_segments.GetHeadPosition();
- while(pos) {
+ while (pos) {
segment* s = m_segments.GetNext(pos);
memcpy(pData + s->offset, s->data.GetData(), s->data.GetCount());
}
@@ -867,15 +867,15 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
ASSERT(p->rtStart < p->rtStop);
- if(m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
+ if (m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
WORD* s = (WORD*)p->GetData();
WORD* e = s + p->GetCount()/2;
- while(s < e) {
+ while (s < e) {
bswap(*s++);
}
}
- if(m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ if (m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
|| m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40
|| m_mt.subtype == MEDIASUBTYPE_RV41) {
CAutoLock cAutoLock(&m_csQueue);
@@ -884,27 +884,27 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
BYTE* pIn = p->GetData();
BYTE* pInOrg = pIn;
- if(m_segments.rtStart != p->rtStart) {
- if(S_OK != (hr = DeliverSegments())) {
+ if (m_segments.rtStart != p->rtStart) {
+ if (S_OK != (hr = DeliverSegments())) {
return hr;
}
}
- if(!m_segments.fDiscontinuity && p->bDiscontinuity) {
+ if (!m_segments.fDiscontinuity && p->bDiscontinuity) {
m_segments.fDiscontinuity = true;
}
m_segments.fSyncPoint = !!p->bSyncPoint;
m_segments.rtStart = p->rtStart;
- while(pIn - pInOrg < len) {
+ while (pIn - pInOrg < len) {
BYTE hdr = *pIn++;
DWORD packetlen = 0, packetoffset = 0;
- if((hdr&0xc0) == 0x40) {
+ if ((hdr&0xc0) == 0x40) {
pIn++;
packetlen = len - (pIn - pInOrg);
} else {
- if((hdr&0x40) == 0) {
+ if ((hdr&0x40) == 0) {
pIn++; //BYTE subseq = (*pIn++)&0x7f;
}
@@ -913,10 +913,10 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
var = (var<<8)|(*pIn++); \
GetWORD(packetlen);
- if(packetlen&0x8000) {
+ if (packetlen&0x8000) {
m_segments.fMerged = true;
}
- if((packetlen&0x4000) == 0) {
+ if ((packetlen&0x4000) == 0) {
GetWORD(packetlen);
packetlen &= 0x3fffffff;
} else {
@@ -924,7 +924,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
}
GetWORD(packetoffset);
- if((packetoffset&0x4000) == 0) {
+ if ((packetoffset&0x4000) == 0) {
GetWORD(packetoffset);
packetoffset &= 0x3fffffff;
} else {
@@ -933,9 +933,9 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
#undef GetWORD
- if((hdr&0xc0) == 0xc0) {
+ if ((hdr&0xc0) == 0xc0) {
m_segments.rtStart = 10000i64*packetoffset - m_rtStart, packetoffset = 0;
- } else if((hdr&0xc0) == 0x80) {
+ } else if ((hdr&0xc0) == 0x80) {
packetoffset = packetlen - packetoffset;
}
@@ -952,14 +952,14 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
pIn += len2;
- if((hdr&0x80) || packetoffset+len2 >= packetlen) {
- if(S_OK != (hr = DeliverSegments())) {
+ if ((hdr&0x80) || packetoffset+len2 >= packetlen) {
+ if (S_OK != (hr = DeliverSegments())) {
return hr;
}
}
}
- } else if(m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
- || m_mt.subtype == MEDIASUBTYPE_AAC) {
+ } else if (m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
+ || m_mt.subtype == MEDIASUBTYPE_AAC) {
BYTE* ptr = p->GetData()+2;
CAtlList<WORD> sizes;
@@ -967,7 +967,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
int remaining = p->GetCount()-2;
int expected = *(ptr-1)>>4;
- while(total < remaining) {
+ while (total < remaining) {
int size = (ptr[0]<<8)|(ptr[1]);
sizes.AddTail(size);
total += size;
@@ -985,7 +985,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
BOOL bDiscontinuity = p->bDiscontinuity;
POSITION pos = sizes.GetHeadPosition();
- while(pos) {
+ while (pos) {
WORD size = sizes.GetNext(pos);
CAutoPtr<Packet> p(DNew Packet);
@@ -996,7 +996,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
p->SetData(ptr, size);
ptr += size;
bDiscontinuity = false;
- if(S_OK != (hr = __super::DeliverPacket(p))) {
+ if (S_OK != (hr = __super::DeliverPacket(p))) {
break;
}
}
@@ -1025,7 +1025,7 @@ CRealMediaSourceFilter::CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
CRMFile::CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr)
: CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
hr = Init();
@@ -1043,7 +1043,7 @@ HRESULT CRMFile::Read(ChunkHdr& hdr)
{
memset(&hdr, 0, sizeof(hdr));
HRESULT hr;
- if(S_OK != (hr = Read(hdr.object_id))
+ if (S_OK != (hr = Read(hdr.object_id))
|| S_OK != (hr = Read(hdr.size))
|| S_OK != (hr = Read(hdr.object_version))) {
return hr;
@@ -1059,15 +1059,15 @@ HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull)
HRESULT hr;
UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) {
+ if (S_OK != (hr = Read(object_version))) {
return hr;
}
- if(object_version != 0 && object_version != 1) {
+ if (object_version != 0 && object_version != 1) {
return S_OK;
}
UINT8 flags;
- if(S_OK != (hr = Read(mph.len))
+ if (S_OK != (hr = Read(mph.len))
|| S_OK != (hr = Read(mph.stream))
|| S_OK != (hr = Read(mph.tStart))
|| S_OK != (hr = Read(mph.reserved))
@@ -1083,9 +1083,9 @@ HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull)
ASSERT(len >= 0);
len = max(len, 0);
- if(fFull) {
+ if (fFull) {
mph.pData.SetCount(len);
- if(mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len))) {
+ if (mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len))) {
return hr;
}
} else {
@@ -1104,148 +1104,148 @@ HRESULT CRMFile::Init()
HRESULT hr;
ChunkHdr hdr;
- while(GetRemaining() && S_OK == (hr = Read(hdr))) {
+ while (GetRemaining() && S_OK == (hr = Read(hdr))) {
__int64 pos = GetPos() - sizeof(hdr);
- if(fFirstChunk && hdr.object_id != '.RMF') {
+ if (fFirstChunk && hdr.object_id != '.RMF') {
return E_FAIL;
}
fFirstChunk = false;
- if(pos + hdr.size > GetLength() && hdr.object_id != 'DATA') { // truncated?
+ if (pos + hdr.size > GetLength() && hdr.object_id != 'DATA') { // truncated?
break;
}
- if(hdr.object_id == 0x2E7261FD) { // '.ra+0xFD'
+ if (hdr.object_id == 0x2E7261FD) { // '.ra+0xFD'
return E_FAIL;
}
- if(hdr.object_version == 0) {
- switch(hdr.object_id) {
+ if (hdr.object_version == 0) {
+ switch (hdr.object_id) {
case '.RMF':
- if(S_OK != (hr = Read(m_fh.version))) {
+ if (S_OK != (hr = Read(m_fh.version))) {
return hr;
}
- if(hdr.size == 0x10) {
+ if (hdr.size == 0x10) {
WORD w = 0;
- if(S_OK != (hr = Read(w))) {
+ if (S_OK != (hr = Read(w))) {
return hr;
}
m_fh.nHeaders = w;
- } else if(S_OK != (hr = Read(m_fh.nHeaders))) {
+ } else if (S_OK != (hr = Read(m_fh.nHeaders))) {
return hr;
}
break;
case 'CONT':
UINT16 slen;
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) {
return hr;
}
break;
case 'PROP':
- if(S_OK != (hr = Read(m_p.maxBitRate))) {
+ if (S_OK != (hr = Read(m_p.maxBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.avgBitRate))) {
+ if (S_OK != (hr = Read(m_p.avgBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.maxPacketSize))) {
+ if (S_OK != (hr = Read(m_p.maxPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.avgPacketSize))) {
+ if (S_OK != (hr = Read(m_p.avgPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.nPackets))) {
+ if (S_OK != (hr = Read(m_p.nPackets))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.tDuration))) {
+ if (S_OK != (hr = Read(m_p.tDuration))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.tPreroll))) {
+ if (S_OK != (hr = Read(m_p.tPreroll))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.ptrIndex))) {
+ if (S_OK != (hr = Read(m_p.ptrIndex))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.ptrData))) {
+ if (S_OK != (hr = Read(m_p.ptrData))) {
return hr;
}
- if(S_OK != (hr = Read(m_p.nStreams))) {
+ if (S_OK != (hr = Read(m_p.nStreams))) {
return hr;
}
UINT16 flags;
- if(S_OK != (hr = Read(flags))) {
+ if (S_OK != (hr = Read(flags))) {
return hr;
}
m_p.flags = (Properies::flags_t)flags;
break;
case 'MDPR': {
CAutoPtr<MediaProperies> mp(DNew MediaProperies);
- if(S_OK != (hr = Read(mp->stream))) {
+ if (S_OK != (hr = Read(mp->stream))) {
return hr;
}
- if(S_OK != (hr = Read(mp->maxBitRate))) {
+ if (S_OK != (hr = Read(mp->maxBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(mp->avgBitRate))) {
+ if (S_OK != (hr = Read(mp->avgBitRate))) {
return hr;
}
- if(S_OK != (hr = Read(mp->maxPacketSize))) {
+ if (S_OK != (hr = Read(mp->maxPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(mp->avgPacketSize))) {
+ if (S_OK != (hr = Read(mp->avgPacketSize))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tStart))) {
+ if (S_OK != (hr = Read(mp->tStart))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tPreroll))) {
+ if (S_OK != (hr = Read(mp->tPreroll))) {
return hr;
}
- if(S_OK != (hr = Read(mp->tDuration))) {
+ if (S_OK != (hr = Read(mp->tDuration))) {
return hr;
}
UINT8 slen;
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) {
return hr;
}
- if(S_OK != (hr = Read(slen))) {
+ if (S_OK != (hr = Read(slen))) {
return hr;
}
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) {
+ if (slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) {
return hr;
}
UINT32 tsdlen;
- if(S_OK != (hr = Read(tsdlen))) {
+ if (S_OK != (hr = Read(tsdlen))) {
return hr;
}
mp->typeSpecData.SetCount(tsdlen);
- if(tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) {
+ if (tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) {
return hr;
}
mp->width = mp->height = 0;
@@ -1255,10 +1255,10 @@ HRESULT CRMFile::Init()
}
case 'DATA': {
CAutoPtr<DataChunk> dc(DNew DataChunk);
- if(S_OK != (hr = Read(dc->nPackets))) {
+ if (S_OK != (hr = Read(dc->nPackets))) {
return hr;
}
- if(S_OK != (hr = Read(dc->ptrNext))) {
+ if (S_OK != (hr = Read(dc->ptrNext))) {
return hr;
}
dc->pos = GetPos();
@@ -1268,33 +1268,33 @@ HRESULT CRMFile::Init()
}
case 'INDX': {
IndexChunkHeader ich;
- if(S_OK != (hr = Read(ich.nIndices))) {
+ if (S_OK != (hr = Read(ich.nIndices))) {
return hr;
}
- if(S_OK != (hr = Read(ich.stream))) {
+ if (S_OK != (hr = Read(ich.stream))) {
return hr;
}
- if(S_OK != (hr = Read(ich.ptrNext))) {
+ if (S_OK != (hr = Read(ich.ptrNext))) {
return hr;
}
int stream = GetMasterStream();
- while(ich.nIndices-- > 0) {
+ while (ich.nIndices-- > 0) {
UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) {
+ if (S_OK != (hr = Read(object_version))) {
return hr;
}
- if(object_version == 0) {
+ if (object_version == 0) {
CAutoPtr<IndexRecord> ir(DNew IndexRecord);
- if(S_OK != (hr = Read(ir->tStart))) {
+ if (S_OK != (hr = Read(ir->tStart))) {
return hr;
}
- if(S_OK != (hr = Read(ir->ptrFilePos))) {
+ if (S_OK != (hr = Read(ir->ptrFilePos))) {
return hr;
}
- if(S_OK != (hr = Read(ir->packet))) {
+ if (S_OK != (hr = Read(ir->packet))) {
return hr;
}
- if(ich.stream == stream) {
+ if (ich.stream == stream) {
m_irs.AddTail(ir);
}
}
@@ -1302,17 +1302,17 @@ HRESULT CRMFile::Init()
break;
}
case '.SUB':
- if(hdr.size > sizeof(hdr)) {
+ if (hdr.size > sizeof(hdr)) {
int size = hdr.size - sizeof(hdr);
CAutoVectorPtr<char> buff;
- if(!buff.Allocate(size)) {
+ if (!buff.Allocate(size)) {
return E_OUTOFMEMORY;
}
char* p = buff;
- if(S_OK != (hr = ByteRead((BYTE*)p, size))) {
+ if (S_OK != (hr = ByteRead((BYTE*)p, size))) {
return hr;
}
- for(char* end = p + size; p < end; ) {
+ for (char* end = p + size; p < end; ) {
subtitle s;
s.name = p;
p += s.name.GetLength()+1;
@@ -1327,7 +1327,7 @@ HRESULT CRMFile::Init()
}
}
- if(hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA') {
+ if (hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA') {
hdr.size = GetPos() - pos;
}
@@ -1336,7 +1336,7 @@ HRESULT CRMFile::Init()
|| GetPos() == pos + sizeof(hdr));
pos += hdr.size;
- if(pos > GetPos()) {
+ if (pos > GetPos()) {
Seek(pos);
}
}
@@ -1352,7 +1352,7 @@ unsigned int GetBits2(int n, unsigned char*& p, unsigned int& bit_offset, unsign
bit_offset += n;
bit_buffer <<= n;
- if(bit_offset > (32-16)) {
+ if (bit_offset > (32-16)) {
p += bit_offset >> 3;
bit_offset &= 7;
bit_buffer = (unsigned int)p[0] << 24;
@@ -1382,25 +1382,25 @@ void GetDimensions(unsigned char* p, unsigned int* wi, unsigned int* hi)
GetBits(13);
w = cw[GetBits(3)];
- if(w == 0) {
+ if (w == 0) {
do {
c = GetBits(8);
w += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
c = GetBits(3);
h = ch1[c];
- if(h == 0) {
+ if (h == 0) {
c = ((c << 1) | GetBits(1)) & 3;
h = ch2[c];
- if(h == 0) {
+ if (h == 0) {
do {
c = GetBits(8);
h += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
}
@@ -1451,25 +1451,25 @@ void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi,
GetBits(16);
w = cw[GetBits(3)];
- if(w == 0) {
+ if (w == 0) {
do {
c = GetBits(8);
w += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
c = GetBits(3);
h = ch1[c];
- if(h == 0) {
+ if (h == 0) {
c = ((c << 1) | GetBits(1)) & 3;
h = ch2[c];
- if(h == 0) {
+ if (h == 0) {
do {
c = GetBits(8);
h += (c << 2);
- } while(c == 255);
+ } while (c == 255);
}
}
@@ -1480,23 +1480,23 @@ void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi,
void CRMFile::GetDimensions()
{
POSITION pos = m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
UINT64 filepos = GetPos();
MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
pmp->width = pmp->height = 0;
rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
rvi.bswap();
- if(rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR') {
+ if (rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR') {
continue;
}
MediaPacketHeader mph;
- while(S_OK == Read(mph)) {
- if(mph.stream != pmp->stream || mph.len == 0
+ while (S_OK == Read(mph)) {
+ if (mph.stream != pmp->stream || mph.len == 0
|| !(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG)) {
continue;
}
@@ -1508,10 +1508,10 @@ void CRMFile::GetDimensions()
BYTE hdr = *p++;
DWORD packetlen = 0, packetoffset = 0;
- if((hdr&0xc0) == 0x40) {
+ if ((hdr&0xc0) == 0x40) {
packetlen = len - (++p - p0);
} else {
- if((hdr&0x40) == 0) {
+ if ((hdr&0x40) == 0) {
p++;
}
@@ -1520,7 +1520,7 @@ void CRMFile::GetDimensions()
var = (var<<8)|(*p++); \
GetWORD(packetlen);
- if((packetlen&0x4000) == 0) {
+ if ((packetlen&0x4000) == 0) {
GetWORD(packetlen);
packetlen &= 0x3fffffff;
} else {
@@ -1528,7 +1528,7 @@ void CRMFile::GetDimensions()
}
GetWORD(packetoffset);
- if((packetoffset&0x4000) == 0) {
+ if ((packetoffset&0x4000) == 0) {
GetWORD(packetoffset);
packetoffset &= 0x3fffffff;
} else {
@@ -1537,9 +1537,9 @@ void CRMFile::GetDimensions()
#undef GetWORD
- if((hdr&0xc0) == 0xc0) {
+ if ((hdr&0xc0) == 0xc0) {
packetoffset = 0;
- } else if((hdr&0xc0) == 0x80) {
+ } else if ((hdr&0xc0) == 0x80) {
packetoffset = packetlen - packetoffset;
}
@@ -1548,15 +1548,15 @@ void CRMFile::GetDimensions()
len = min(len - (p - p0), packetlen - packetoffset);
- if(len > 0) {
+ if (len > 0) {
bool repeat_field;
- if(rvi.fcc2 == '14VR') {
+ if (rvi.fcc2 == '14VR') {
::GetDimensions_X10(p, &pmp->width, &pmp->height, &pmp->interlaced, &pmp->top_field_first, &repeat_field);
} else {
::GetDimensions(p, &pmp->width, &pmp->height);
}
- if(rvi.w == pmp->width && rvi.h == pmp->height) {
+ if (rvi.w == pmp->width && rvi.h == pmp->height) {
pmp->width = pmp->height = 0;
}
@@ -1574,17 +1574,17 @@ int CRMFile::GetMasterStream()
int s1 = -1, s2 = -1;
POSITION pos = m_mps.GetHeadPosition();
- while(pos) {
+ while (pos) {
MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo") {
+ if (pmp->mime == "video/x-pn-realvideo") {
s1 = pmp->stream;
break;
- } else if(pmp->mime == "audio/x-pn-realaudio" && s2 == -1) {
+ } else if (pmp->mime == "audio/x-pn-realaudio" && s2 == -1) {
s2 = pmp->stream;
}
}
- if(s1 == -1) {
+ if (s1 == -1) {
s1 = s2;
}
@@ -1608,7 +1608,7 @@ CRealVideoDecoder::CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
CRealVideoDecoder::~CRealVideoDecoder()
{
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
}
}
@@ -1630,16 +1630,16 @@ HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt)
{11, rvi.w, rvi.h, 0, 0, rvi.type1, 1, rvi.type2};
#pragma pack(pop)
- if(FAILED(hr = RVInit(&i, &m_dwCookie))) {
+ if (FAILED(hr = RVInit(&i, &m_dwCookie))) {
return hr;
}
- if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002) {
+ if (rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002) {
int nWidthHeight = (1+((rvi.type1>>16)&7));
UINT32* pWH = DNew UINT32[nWidthHeight*2];
pWH[0] = rvi.w;
pWH[1] = rvi.h;
- for(int i = 2; i < nWidthHeight*2; i++) {
+ for (int i = 2; i < nWidthHeight*2; i++) {
pWH[i] = rvi.morewh[i-2]*4;
}
#pragma pack(push, 1)
@@ -1659,7 +1659,7 @@ HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt)
void CRealVideoDecoder::FreeRV()
{
- if(m_dwCookie) {
+ if (m_dwCookie) {
RVFree(m_dwCookie);
m_dwCookie = 0;
}
@@ -1672,12 +1672,12 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
HRESULT hr;
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
long len = pIn->GetActualDataLength();
- if(len <= 0) {
+ if (len <= 0) {
return S_OK; // nothing to do
}
@@ -1703,7 +1703,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
pDataIn += offset;
- if(m_fDropFrames && m_timestamp+1 == transform_in.timestamp) {
+ if (m_fDropFrames && m_timestamp+1 == transform_in.timestamp) {
m_timestamp = transform_in.timestamp;
return S_OK;
}
@@ -1714,7 +1714,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
::GetDimensions_X10(pDataIn, &tmp1, &tmp2, &interlaced, &tmp3, &tmp4);
int size = tmp1*tmp2;
- if( m_lastBuffSizeDim < size ) {
+ if ( m_lastBuffSizeDim < size ) {
_aligned_free(m_pI420);
_aligned_free(m_pI420Tmp);
@@ -1748,19 +1748,19 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
m_timestamp = transform_in.timestamp;
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("RV returned an error code!!!\n"));
ASSERT(!(transform_out.unk1&1)); // error allowed when the "render" flag is not set
// return hr;
}
- if(pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1)) {
+ if (pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1)) {
return S_OK;
}
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
+ if (/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
&& */ FAILED(hr = GetDeliveryBuffer(m_w, m_h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
@@ -1768,7 +1768,7 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
BYTE* pI420[3] = {m_pI420, m_pI420Tmp, NULL};
- if(interlaced) {
+ if (interlaced) {
int size = m_w*m_h;
DeinterlaceBlend(pI420[1], pI420[0], m_w, m_h, m_w, m_w);
DeinterlaceBlend(pI420[1]+size, pI420[0]+size, m_w/2, m_h/2, m_w/2, m_w/2);
@@ -1776,10 +1776,10 @@ HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
}
- if(transform_out.w != m_w || transform_out.h != m_h) {
+ if (transform_out.w != m_w || transform_out.h != m_h) {
Resize(pI420[0], transform_out.w, transform_out.h, pI420[1], m_w, m_h);
// only one of these can be true, and when it happens the result image must be in the tmp buffer
- if(transform_out.w == m_w || transform_out.h == m_h) {
+ if (transform_out.w == m_w || transform_out.h == m_h) {
pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
}
}
@@ -1803,21 +1803,21 @@ void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD
int si = wi*hi, so = wo*ho;
ASSERT(((si*so)&3) == 0);
- if(wi < wo) {
+ if (wi < wo) {
ResizeWidth(pIn, wi, hi, pOut, wo, ho);
ResizeWidth(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
ResizeWidth(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
- if(hi == ho) {
+ if (hi == ho) {
return;
}
ResizeHeight(pOut, wo, hi, pIn, wo, ho);
ResizeHeight(pOut + so, wo/2, hi/2, pIn + so, wo/2, ho/2);
ResizeHeight(pOut + so + so/4, wo/2, hi/2, pIn + so + so/4, wo/2, ho/2);
- } else if(hi < ho) {
+ } else if (hi < ho) {
ResizeHeight(pIn, wi, hi, pOut, wo, ho);
ResizeHeight(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
ResizeHeight(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
- if(wi == wo) {
+ if (wi == wo) {
return;
}
ASSERT(0); // this is uncreachable code, but anyway... looks nice being so symmetric
@@ -1829,8 +1829,8 @@ void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD
void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- for(DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo) {
- if(wi == wo) {
+ for (DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo) {
+ if (wi == wo) {
memcpy(pOut, pIn, wo);
} else {
ResizeRow(pIn, wi, 1, pOut, wo, 1);
@@ -1840,10 +1840,10 @@ void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, D
void CRealVideoDecoder::ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- if(hi == ho) {
+ if (hi == ho) {
memcpy(pOut, pIn, wo*ho);
} else {
- for(DWORD x = 0; x < wo; x++, pIn++, pOut++) {
+ for (DWORD x = 0; x < wo; x++, pIn++, pOut++) {
ResizeRow(pIn, hi, wo, pOut, ho, wo);
}
}
@@ -1853,8 +1853,8 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW
{
ASSERT(wi < wo);
- if(dpo == 1) {
- for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
+ if (dpo == 1) {
+ for (DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
// pOut[i] = pIn[j>>16];
{
BYTE* p = &pIn[j>>16];
@@ -1864,7 +1864,7 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW
*pOut = pIn[wi-1];
} else {
- for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
+ for (DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
// *pOut = pIn[dpi*(j>>16)];
{
BYTE* p = &pIn[dpi*(j>>16)];
@@ -1878,7 +1878,7 @@ void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DW
HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Video
+ if (mtIn->majortype != MEDIATYPE_Video
|| mtIn->subtype != MEDIASUBTYPE_RV20
&& mtIn->subtype != MEDIASUBTYPE_RV30
&& mtIn->subtype != MEDIASUBTYPE_RV40
@@ -1886,16 +1886,16 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(mtIn->formattype == FORMAT_VideoInfo2) {
+ if (mtIn->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mtIn->Format();
- if(vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
+ if (vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
|| vih2->dwPictAspectRatioY < vih2->bmiHeader.biHeight) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
- if(!m_pInput->IsConnected()) {
- if(m_hDrvDll) {
+ if (!m_pInput->IsConnected()) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
m_hDrvDll = NULL;
}
@@ -1912,37 +1912,37 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
oldpath = buff;
TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
oldpath += '\\';
}
key.Close();
}
len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
newpath = buff;
TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
newpath += '\\';
}
key.Close();
}
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + newdll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + newdll);
}
paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + olddll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + olddll);
}
paths.AddTail(olddll); // default dll paths
@@ -1952,39 +1952,39 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
if (pos) {
m_hDrvDll = LoadLibrary(paths.GetNext(pos));
}
- } while(pos && !m_hDrvDll);
+ } while (pos && !m_hDrvDll);
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420CustomMessage");
RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV20toYUV420Free");
RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420HiveMessage");
RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV20toYUV420Init");
RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV20toYUV420Transform");
- if(!RVCustomMessage) {
+ if (!RVCustomMessage) {
RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420CustomMessage");
}
- if(!RVFree) {
+ if (!RVFree) {
RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV40toYUV420Free");
}
- if(!RVHiveMessage) {
+ if (!RVHiveMessage) {
RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420HiveMessage");
}
- if(!RVInit) {
+ if (!RVInit) {
RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV40toYUV420Init");
}
- if(!RVTransform) {
+ if (!RVTransform) {
RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV40toYUV420Transform");
}
}
- if(!m_hDrvDll || !RVCustomMessage
+ if (!m_hDrvDll || !RVCustomMessage
|| !RVFree || !RVHiveMessage
|| !RVInit || !RVTransform) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(FAILED(InitRV(mtIn))) {
+ if (FAILED(InitRV(mtIn))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -1994,9 +1994,9 @@ HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(m_pOutput && m_pOutput->IsConnected()) {
+ if (m_pOutput && m_pOutput->IsConnected()) {
BITMAPINFOHEADER bih1, bih2;
- if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ if (ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
&& abs(bih1.biHeight) != abs(bih2.biHeight)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2008,7 +2008,7 @@ HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaTy
HRESULT CRealVideoDecoder::StartStreaming()
{
const CMediaType& mt = m_pInput->CurrentMediaType();
- if(FAILED(InitRV(&mt))) {
+ if (FAILED(InitRV(&mt))) {
return E_FAIL;
}
@@ -2050,10 +2050,10 @@ HRESULT CRealVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tSto
HRESULT CRealVideoDecoder::AlterQuality(Quality q)
{
- if(q.Late > 500*10000i64) {
+ if (q.Late > 500*10000i64) {
m_fDropFrames = true;
}
- if(q.Late <= 0) {
+ if (q.Late <= 0) {
m_fDropFrames = false;
}
// TRACE(_T("CRealVideoDecoder::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
@@ -2071,7 +2071,7 @@ CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
, m_hDrvDll(NULL)
, m_dwCookie(0)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -2079,7 +2079,7 @@ CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
CRealAudioDecoder::~CRealAudioDecoder()
{
// FreeRA();
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
}
}
@@ -2090,7 +2090,7 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
HRESULT hr;
- if(RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
+ if (RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
|| RAOpenCodec && FAILED(hr = RAOpenCodec(&m_dwCookie))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2101,13 +2101,13 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
// cbSize being really sizeof(WAVEFORMATEX) is less than this,
// especially with our rm splitter ;)
DWORD cbSize = pwfe->cbSize;
- if(cbSize == sizeof(WAVEFORMATEX)) {
+ if (cbSize == sizeof(WAVEFORMATEX)) {
ASSERT(0);
cbSize = 0;
}
WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) {
+ if (!wBitsPerSample) {
wBitsPerSample = 16;
}
@@ -2125,21 +2125,21 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
CAutoVectorPtr<BYTE> pBuff;
- if(pmt->subtype == MEDIASUBTYPE_AAC) {
+ if (pmt->subtype == MEDIASUBTYPE_AAC) {
pBuff.Allocate(cbSize+1);
pBuff[0] = 0x02;
memcpy(pBuff+1, pwfe+1, cbSize);
initdata.extralen = cbSize+1;
initdata.extra = pBuff;
} else {
- if(pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) { // must have type_specific_data appended
+ if (pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) { // must have type_specific_data appended
return VFW_E_TYPE_NOT_ACCEPTED;
}
BYTE* fmt = pmt->Format() + sizeof(WAVEFORMATEX) + cbSize;
- for(int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++) {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
+ for (int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++) {
+ if (fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a') {
break;
}
}
@@ -2149,21 +2149,21 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
BYTE* p;
- if(m_rai.version2 == 4) {
+ if (m_rai.version2 == 4) {
p = (BYTE*)((rainfo4*)fmt+1);
int len = *p++;
p += len;
len = *p++;
p += len;
ASSERT(len == 4);
- } else if(m_rai.version2 == 5) {
+ } else if (m_rai.version2 == 5) {
p = (BYTE*)((rainfo5*)fmt+1);
} else {
return VFW_E_TYPE_NOT_ACCEPTED;
}
p += 3;
- if(m_rai.version2 == 5) {
+ if (m_rai.version2 == 5) {
p++;
}
@@ -2173,15 +2173,15 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
initdata.extra = p + 4;
}
- if(FAILED(hr = RAInitDecoder(m_dwCookie, &initdata))) {
+ if (FAILED(hr = RAInitDecoder(m_dwCookie, &initdata))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(RASetPwd) {
+ if (RASetPwd) {
RASetPwd(m_dwCookie, "Ardubancel Quazanga");
}
- if(RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor))) {
+ if (RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2190,7 +2190,7 @@ HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
void CRealAudioDecoder::FreeRA()
{
- if(m_dwCookie) {
+ if (m_dwCookie) {
RAFreeDecoder(m_dwCookie);
RACloseCodec(m_dwCookie);
m_dwCookie = 0;
@@ -2204,19 +2204,19 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA) {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pIn);
}
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
BYTE* pDataInOrg = pDataIn;
UNUSED_ALWAYS(pDataInOrg);
long len = pIn->GetActualDataLength();
- if(len <= 0) {
+ if (len <= 0) {
return S_OK;
}
@@ -2227,7 +2227,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
return S_OK;
*/
- if(S_OK == pIn->IsSyncPoint()) {
+ if (S_OK == pIn->IsSyncPoint()) {
m_bufflen = 0;
m_rtBuffStart = rtStart;
m_fBuffDiscontinuity = pIn->IsDiscontinuity() == S_OK;
@@ -2240,7 +2240,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
int h = m_rai.sub_packet_h;
int sps = m_rai.sub_packet_size;
- if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
+ if (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RACP
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_AAC) {
src = pDataIn;
@@ -2252,17 +2252,17 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
len = w*h;
- if(m_bufflen >= len) {
+ if (m_bufflen >= len) {
ASSERT(m_bufflen == len);
src = m_buff;
dst = m_buff + len;
- if(sps > 0
+ if (sps > 0
&& (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_COOK
|| m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_ATRC)) {
- for(int y = 0; y < h; y++) {
- for(int x = 0, w2 = w / sps; x < w2; x++) {
+ for (int y = 0; y < h; y++) {
+ for (int x = 0, w2 = w / sps; x < w2; x++) {
// TRACE(_T("--- %d, %d\n"), (h*x+((h+1)/2)*(y&1)+(y>>1)), sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
memcpy(dst + sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), src, sps);
src += sps;
@@ -2271,7 +2271,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
src = m_buff + len;
dst = m_buff + len*2;
- } else if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR) {
+ } else if (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR) {
// http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-August/010569.html
static BYTE sipr_swaps[38][2]= {
@@ -2283,19 +2283,19 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
};
int bs=h*w*2/96; // nibbles per subpacket
- for(int n=0; n<38; n++) {
+ for (int n=0; n<38; n++) {
int i=bs*sipr_swaps[n][0];
int o=bs*sipr_swaps[n][1];
// swap nibbles of block 'i' with 'o' TODO: optimize
- for(int j=0; j<bs; j++) {
+ for (int j=0; j<bs; j++) {
int x=(i&1) ? (src[(i>>1)]>>4) : (src[(i>>1)]&15);
int y=(o&1) ? (src[(o>>1)]>>4) : (src[(o>>1)]&15);
- if(o&1) {
+ if (o&1) {
src[(o>>1)]=(src[(o>>1)]&0x0F)|(x<<4);
} else {
src[(o>>1)]=(src[(o>>1)]&0xF0)|x;
}
- if(i&1) {
+ if (i&1) {
src[(i>>1)]=(src[(i>>1)]&0x0F)|(y<<4);
} else {
src[(i>>1)]=(src[(i>>1)]&0xF0)|y;
@@ -2312,16 +2312,16 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
rtStart = m_rtBuffStart;
- for(; src < dst; src += w) {
+ for (; src < dst; src += w) {
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
+ if (FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -2329,7 +2329,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
hr = RADecode(m_dwCookie, src, w, pDataOut, &len, -1);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("RA returned an error code!!!\n"));
continue;
// return hr;
@@ -2350,7 +2350,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
- if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut))) {
+ if (rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut))) {
return hr;
}
@@ -2364,7 +2364,7 @@ HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Audio
+ if (mtIn->majortype != MEDIATYPE_Audio
|| mtIn->subtype != MEDIASUBTYPE_14_4
&& mtIn->subtype != MEDIASUBTYPE_28_8
&& mtIn->subtype != MEDIASUBTYPE_ATRC
@@ -2377,8 +2377,8 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(!m_pInput->IsConnected()) {
- if(m_hDrvDll) {
+ if (!m_pInput->IsConnected()) {
+ if (m_hDrvDll) {
FreeLibrary(m_hDrvDll);
m_hDrvDll = NULL;
}
@@ -2394,7 +2394,7 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
0
};
- if(!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc)) {
+ if (!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc)) {
_tcscpy(fourcc, _T("RAAC"));
}
@@ -2404,37 +2404,37 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
CRegKey key;
TCHAR buff[_MAX_PATH];
ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
oldpath = buff;
TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
oldpath += '\\';
}
key.Close();
}
len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ if (ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
&& ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0) {
newpath = buff;
TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') {
+ if (c != '\\' && c != '/') {
newpath += '\\';
}
key.Close();
}
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + newdll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + newdll);
}
paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) {
+ if (!newpath.IsEmpty()) {
paths.AddTail(newpath + olddll);
}
- if(!oldpath.IsEmpty()) {
+ if (!oldpath.IsEmpty()) {
paths.AddTail(oldpath + olddll);
}
paths.AddTail(olddll); // default dll paths
@@ -2444,9 +2444,9 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
if (pos) {
m_hDrvDll = LoadLibrary(paths.GetNext(pos));
}
- } while(pos && !m_hDrvDll);
+ } while (pos && !m_hDrvDll);
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
RACloseCodec = (PCloseCodec)GetProcAddress(m_hDrvDll, "RACloseCodec");
RADecode = (PDecode)GetProcAddress(m_hDrvDll, "RADecode");
RAFlush = (PFlush)GetProcAddress(m_hDrvDll, "RAFlush");
@@ -2460,25 +2460,25 @@ HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
RASetPwd = (PSetPwd)GetProcAddress(m_hDrvDll, "RASetPwd");
}
- if(!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
+ if (!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
|| !RAFreeDecoder || !RAGetFlavorProperty || !RAInitDecoder
|| !(RAOpenCodec || RAOpenCodec2) /*|| !RASetFlavor*/) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(m_hDrvDll) {
+ if (m_hDrvDll) {
char buff[_MAX_PATH];
GetModuleFileNameA(m_hDrvDll, buff, MAX_PATH);
CPathA p(buff);
p.RemoveFileSpec();
p.AddBackslash();
m_dllpath = p.m_strPath;
- if(RASetDLLAccessPath) {
+ if (RASetDLLAccessPath) {
RASetDLLAccessPath("DT_Codecs=" + m_dllpath);
}
}
- if(FAILED(InitRA(mtIn))) {
+ if (FAILED(InitRA(mtIn))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -2504,20 +2504,20 @@ HRESULT CRealAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaTy
HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
CComPtr<IMemAllocator> pAllocatorIn;
m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) {
+ if (!wBitsPerSample) {
wBitsPerSample = 16;
}
@@ -2529,7 +2529,7 @@ HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -2540,7 +2540,7 @@ HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR
HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -2548,14 +2548,14 @@ HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
pmt->subtype = MEDIASUBTYPE_PCM;
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) {
+ if (iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) {
return VFW_S_NO_MORE_ITEMS;
}
- if(!pwfe->wBitsPerSample) {
+ if (!pwfe->wBitsPerSample) {
pwfe->wBitsPerSample = 16;
}
@@ -2564,7 +2564,7 @@ HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
pwfe->nAvgBytesPerSec = pwfe->nSamplesPerSec*pwfe->nBlockAlign;
- if(iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6) {
+ if (iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6) {
static DWORD chmask[] = {
KSAUDIO_SPEAKER_DIRECTOUT,
KSAUDIO_SPEAKER_MONO,
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.cpp b/src/filters/parser/SSFSplitter/SSFSplitter.cpp
index 6c8532e57..bf1cf34d4 100644
--- a/src/filters/parser/SSFSplitter/SSFSplitter.cpp
+++ b/src/filters/parser/SSFSplitter/SSFSplitter.cpp
@@ -81,10 +81,10 @@ namespace ssf
}
int NextByte() {
- if(!m_pFile) {
+ if (!m_pFile) {
ThrowError(_T("m_pFile is NULL"));
}
- if(!m_pFile->GetRemaining()) {
+ if (!m_pFile->GetRemaining()) {
return EOS;
}
return (int)m_pFile->BitRead(8);
@@ -96,10 +96,10 @@ int CSSFSplitterFilter::SegmentItemEx::Compare(const void* a, const void* b)
{
const SegmentItemEx* si1 = (const SegmentItemEx*)a;
const SegmentItemEx* si2 = (const SegmentItemEx*)b;
- if(si1->start < si2->start) {
+ if (si1->start < si2->start) {
return -1;
}
- if(si2->start < si1->start) {
+ if (si2->start < si1->start) {
return +1;
}
return 0;
@@ -122,17 +122,17 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Free();
m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
- if(!m_pFile) {
+ if (!m_pFile) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pFile.Free();
return hr;
}
try {
m_ssf.Parse(ssf::InputStreamBSF(m_pFile));
- } catch(ssf::Exception&) {
+ } catch (ssf::Exception&) {
return E_FAIL;
}
@@ -141,17 +141,17 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_rtNewStart = m_rtCurrent = 0;
m_rtNewStop = m_rtStop = m_rtDuration = 0;
- if(ssf::Reference* pRootRef = m_ssf.GetRootRef()) {
+ if (ssf::Reference* pRootRef = m_ssf.GetRootRef()) {
ssf::WCharOutputStream s;
ssf::StringMapW<float> offset;
POSITION pos = pRootRef->m_nodes.GetHeadPosition();
- while(pos) {
- if(ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos))) {
+ while (pos) {
+ if (ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos))) {
try {
ssf::Definition::Time time;
- if(pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue()) {
+ if (pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue()) {
SegmentItemEx si;
si.pDef = pDef;
si.start = time.start.value;
@@ -162,7 +162,7 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
continue;
}
- } catch(ssf::Exception&) {
+ } catch (ssf::Exception&) {
}
pDef->Dump(s);
@@ -193,16 +193,16 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
CAtlArray<SegmentItemEx> subs;
subs.SetCount(m_subs.GetCount());
pos = m_subs.GetHeadPosition();
- for(size_t i = 0; pos; i++) {
+ for (size_t i = 0; pos; i++) {
subs.SetAt(i, m_subs.GetNext(pos));
}
qsort(subs.GetData(), subs.GetCount(), sizeof(SegmentItemEx), SegmentItemEx::Compare);
m_subs.RemoveAll();
- for(size_t i = 0; i < subs.GetCount(); i++) {
+ for (size_t i = 0; i < subs.GetCount(); i++) {
m_subs.AddTail(subs[i]);
}
- if(!m_ssf.m_segments.IsEmpty()) {
+ if (!m_ssf.m_segments.IsEmpty()) {
m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64*m_ssf.m_segments.GetTail().m_stop;
}
}
@@ -218,7 +218,7 @@ bool CSSFSplitterFilter::DemuxInit()
void CSSFSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0) {
+ if (rt <= 0) {
} else {
// TODO
}
@@ -230,7 +230,7 @@ bool CSSFSplitterFilter::DemuxLoop()
POSITION pos = m_subs.GetHeadPosition();
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
+ while (pos && SUCCEEDED(hr) && !CheckRequest(NULL)) {
SegmentItemEx& si = m_subs.GetNext(pos);
ssf::WCharOutputStream s;
diff --git a/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
index 8e5e09192..b6cac313a 100644
--- a/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
+++ b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
@@ -72,7 +72,7 @@ CStreamDriveThruFilter::CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr)
: CBaseFilter(NAME("CStreamDriveThruFilter"), pUnk, &m_csLock, __uuidof(this))
, m_position(0)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -106,10 +106,10 @@ STDMETHODIMP CStreamDriveThruFilter::NonDelegatingQueryInterface(REFIID riid, vo
DWORD CStreamDriveThruFilter::ThreadProc()
{
- while(1) {
+ while (1) {
DWORD cmd = GetRequest();
- switch(cmd) {
+ switch (cmd) {
default:
case CMD_EXIT:
Reply(S_OK);
@@ -127,7 +127,7 @@ DWORD CStreamDriveThruFilter::ThreadProc()
CComPtr<IAsyncReader> pAsyncReader;
CComPtr<IStream> pStream;
- if(!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
+ if (!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
|| !m_pOutput || !m_pOutput->IsConnected() || FAILED(m_pOutput->GetStream(&pStream))) {
break;
}
@@ -135,16 +135,16 @@ DWORD CStreamDriveThruFilter::ThreadProc()
LARGE_INTEGER li = {0};
ULARGE_INTEGER uli = {0};
- if(FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
+ if (FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
|| FAILED(pStream->SetSize(uli))) {
break;
}
- if(CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected())) {
+ if (CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected())) {
pFSF->SetMode(AM_FILE_OVERWRITE);
LPOLESTR pfn;
- if(SUCCEEDED(pFSF->GetCurFile(&pfn, NULL))) {
+ if (SUCCEEDED(pFSF->GetCurFile(&pfn, NULL))) {
pFSF->SetFileName(pfn, NULL);
CoTaskMemFree(pfn);
}
@@ -154,23 +154,23 @@ DWORD CStreamDriveThruFilter::ThreadProc()
BYTE buff[PACKETSIZE];
do {
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
CAutoLock csAutoLock(&m_csLock);
LONGLONG total = 0, available = 0;
- if(FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total) {
+ if (FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total) {
cmd = CMD_STOP;
break;
}
LONG size = (LONG)min(PACKETSIZE, total - m_position);
- if(FAILED(pAsyncReader->SyncRead(m_position, size, buff))) {
+ if (FAILED(pAsyncReader->SyncRead(m_position, size, buff))) {
cmd = CMD_STOP;
break;
}
ULONG written = 0;
- if(FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written) {
+ if (FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written) {
cmd = CMD_STOP;
break;
}
@@ -178,24 +178,24 @@ DWORD CStreamDriveThruFilter::ThreadProc()
m_position += size;
}
- if(cmd == CMD_PAUSE) {
+ if (cmd == CMD_PAUSE) {
Reply(S_OK); // reply to CMD_PAUSE
- while(!CheckRequest(&cmd)) {
+ while (!CheckRequest(&cmd)) {
Sleep(50);
}
Reply(S_OK); // reply to something
}
- } while(cmd == CMD_RUN);
+ } while (cmd == CMD_RUN);
uli.QuadPart = m_position;
pStream->SetSize(uli);
- if(CComPtr<IPin> pPin = m_pOutput->GetConnected()) {
+ if (CComPtr<IPin> pPin = m_pOutput->GetConnected()) {
pPin->EndOfStream();
}
- } while(false);
+ } while (false);
break;
}
@@ -213,9 +213,9 @@ CBasePin* CStreamDriveThruFilter::GetPin(int n)
{
CAutoLock csAutoLock(&m_csLock);
- if(n == 0) {
+ if (n == 0) {
return m_pInput;
- } else if(n == 1) {
+ } else if (n == 1) {
return m_pOutput;
}
@@ -226,7 +226,7 @@ STDMETHODIMP CStreamDriveThruFilter::Stop()
{
HRESULT hr;
- if(FAILED(hr = __super::Stop())) {
+ if (FAILED(hr = __super::Stop())) {
return hr;
}
@@ -239,7 +239,7 @@ STDMETHODIMP CStreamDriveThruFilter::Pause()
{
HRESULT hr;
- if(FAILED(hr = __super::Pause())) {
+ if (FAILED(hr = __super::Pause())) {
return hr;
}
@@ -252,7 +252,7 @@ STDMETHODIMP CStreamDriveThruFilter::Run(REFERENCE_TIME tStart)
{
HRESULT hr;
- if(FAILED(hr = __super::Run(tStart))) {
+ if (FAILED(hr = __super::Run(tStart))) {
return hr;
}
@@ -272,7 +272,7 @@ STDMETHODIMP CStreamDriveThruFilter::CheckCapabilities(DWORD* pCapabilities)
{
CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) {
+ if (*pCapabilities == 0) {
return S_OK;
}
@@ -314,9 +314,9 @@ STDMETHODIMP CStreamDriveThruFilter::GetDuration(LONGLONG* pDuration)
CheckPointer(pDuration, E_POINTER);
CheckPointer(m_pInput, VFW_E_NOT_CONNECTED);
- if(CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected()) {
+ if (CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected()) {
LONGLONG total, available;
- if(SUCCEEDED(pAsyncReader->Length(&total, &available))) {
+ if (SUCCEEDED(pAsyncReader->Length(&total, &available))) {
*pDuration = total;
return S_OK;
}
@@ -415,11 +415,11 @@ HRESULT CStreamDriveThruInputPin::CheckConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
- if(!CComQIPtr<IAsyncReader>(pPin)) {
+ if (!CComQIPtr<IAsyncReader>(pPin)) {
return E_NOINTERFACE;
}
@@ -430,7 +430,7 @@ HRESULT CStreamDriveThruInputPin::BreakConnect()
{
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
@@ -443,7 +443,7 @@ HRESULT CStreamDriveThruInputPin::CompleteConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
@@ -509,11 +509,11 @@ HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOC
pProperties->cbBuffer = PACKETSIZE;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -532,10 +532,10 @@ HRESULT CStreamDriveThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -551,11 +551,11 @@ HRESULT CStreamDriveThruOutputPin::CheckConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin))) {
+ if (FAILED(hr = __super::CheckConnect(pPin))) {
return hr;
}
- if(!CComQIPtr<IStream>(pPin)) {
+ if (!CComQIPtr<IStream>(pPin)) {
return E_NOINTERFACE;
}
@@ -566,7 +566,7 @@ HRESULT CStreamDriveThruOutputPin::BreakConnect()
{
HRESULT hr;
- if(FAILED(hr = __super::BreakConnect())) {
+ if (FAILED(hr = __super::BreakConnect())) {
return hr;
}
@@ -579,7 +579,7 @@ HRESULT CStreamDriveThruOutputPin::CompleteConnect(IPin* pPin)
{
HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin))) {
+ if (FAILED(hr = __super::CompleteConnect(pPin))) {
return hr;
}
diff --git a/src/filters/reader/CDDAReader/CDDAReader.cpp b/src/filters/reader/CDDAReader/CDDAReader.cpp
index b8211bb8d..b000a43bb 100644
--- a/src/filters/reader/CDDAReader/CDDAReader.cpp
+++ b/src/filters/reader/CDDAReader/CDDAReader.cpp
@@ -49,7 +49,7 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- if(GetVersion()&0x80000000) {
+ if (GetVersion()&0x80000000) {
::MessageBox(NULL, _T("Sorry, this will only run on Windows NT based operating system."), _T("CDDA Reader"), MB_OK);
return E_NOTIMPL;
}
@@ -90,12 +90,12 @@ CFilterApp theApp;
CCDDAReader::CCDDAReader(IUnknown* pUnk, HRESULT* phr)
: CAsyncReader(NAME("CCDDAReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
- if(GetVersion()&0x80000000) {
- if(phr) {
+ if (GetVersion()&0x80000000) {
+ if (phr) {
*phr = E_NOTIMPL;
}
return;
@@ -120,7 +120,7 @@ STDMETHODIMP CCDDAReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
STDMETHODIMP CCDDAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName)) {
+ if (!m_stream.Load(pszFileName)) {
return E_FAIL;
}
@@ -139,7 +139,7 @@ STDMETHODIMP CCDDAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
CheckPointer(ppszFileName, E_POINTER);
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -174,7 +174,7 @@ STDMETHODIMP CCDDAReader::get_AuthorName(BSTR* pbstrAuthorName)
{
CheckPointer(pbstrAuthorName, E_POINTER);
CString str = m_stream.m_trackArtist;
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
str = m_stream.m_discArtist;
}
*pbstrAuthorName = str.AllocSysString();
@@ -185,7 +185,7 @@ STDMETHODIMP CCDDAReader::get_Title(BSTR* pbstrTitle)
{
CheckPointer(pbstrTitle, E_POINTER);
CString str = m_stream.m_trackTitle;
- if(str.IsEmpty()) {
+ if (str.IsEmpty()) {
str = m_stream.m_discTitle;
}
*pbstrTitle = str.AllocSysString();
@@ -274,7 +274,7 @@ CCDDAStream::CCDDAStream()
CCDDAStream::~CCDDAStream()
{
- if(m_hDrive != INVALID_HANDLE_VALUE) {
+ if (m_hDrive != INVALID_HANDLE_VALUE) {
CloseHandle(m_hDrive);
m_hDrive = INVALID_HANDLE_VALUE;
}
@@ -286,31 +286,31 @@ bool CCDDAStream::Load(const WCHAR* fnw)
int iDriveLetter = path.Find(_T(":\\"))-1;
int iTrackIndex = CString(path).MakeLower().Find(_T(".cda"))-1;
- if(iDriveLetter < 0 || iTrackIndex <= iDriveLetter) {
+ if (iDriveLetter < 0 || iTrackIndex <= iDriveLetter) {
return false;
}
CString drive = CString(_T("\\\\.\\")) + path[iDriveLetter] + _T(":");
- while(iTrackIndex > 0 && _istdigit(path[iTrackIndex-1])) {
+ while (iTrackIndex > 0 && _istdigit(path[iTrackIndex-1])) {
iTrackIndex--;
}
- if(1 != _stscanf(path.Mid(iTrackIndex), _T("%d"), &iTrackIndex)) {
+ if (1 != _stscanf(path.Mid(iTrackIndex), _T("%d"), &iTrackIndex)) {
return false;
}
- if(m_hDrive != INVALID_HANDLE_VALUE) {
+ if (m_hDrive != INVALID_HANDLE_VALUE) {
CloseHandle(m_hDrive);
m_hDrive = INVALID_HANDLE_VALUE;
}
m_hDrive = CreateFile(drive, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
- if(m_hDrive == INVALID_HANDLE_VALUE) {
+ if (m_hDrive == INVALID_HANDLE_VALUE) {
return false;
}
DWORD BytesReturned;
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &m_TOC, sizeof(m_TOC), &BytesReturned, 0)
+ if (!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &m_TOC, sizeof(m_TOC), &BytesReturned, 0)
|| !(m_TOC.FirstTrack <= iTrackIndex && iTrackIndex <= m_TOC.LastTrack)) {
CloseHandle(m_hDrive);
m_hDrive = INVALID_HANDLE_VALUE;
@@ -319,13 +319,13 @@ bool CCDDAStream::Load(const WCHAR* fnw)
// MMC-3 Draft Revision 10g: Table 222 – Q Sub-channel control field
m_TOC.TrackData[iTrackIndex-1].Control &= 5;
- if(!(m_TOC.TrackData[iTrackIndex-1].Control == 0 || m_TOC.TrackData[iTrackIndex-1].Control == 1)) {
+ if (!(m_TOC.TrackData[iTrackIndex-1].Control == 0 || m_TOC.TrackData[iTrackIndex-1].Control == 1)) {
CloseHandle(m_hDrive);
m_hDrive = INVALID_HANDLE_VALUE;
return false;
}
- if(m_TOC.TrackData[iTrackIndex-1].Control&8) {
+ if (m_TOC.TrackData[iTrackIndex-1].Control&8) {
m_header.frm.pcm.wf.nChannels = 4;
}
@@ -344,7 +344,7 @@ bool CCDDAStream::Load(const WCHAR* fnw)
TOCEx.SessionTrack = iTrackIndex;
WORD size = 0;
ASSERT(MINIMUM_CDROM_READ_TOC_EX_SIZE == sizeof(size));
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), &size, sizeof(size), &BytesReturned, 0)) {
+ if (!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), &size, sizeof(size), &BytesReturned, 0)) {
break;
}
@@ -354,7 +354,7 @@ bool CCDDAStream::Load(const WCHAR* fnw)
pCDTextData.Allocate(size);
memset(pCDTextData, 0, size);
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), pCDTextData, size, &BytesReturned, 0)) {
+ if (!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), pCDTextData, size, &BytesReturned, 0)) {
break;
}
@@ -362,13 +362,13 @@ bool CCDDAStream::Load(const WCHAR* fnw)
CDROM_TOC_CD_TEXT_DATA_BLOCK* pDesc = ((CDROM_TOC_CD_TEXT_DATA*)(BYTE*)pCDTextData)->Descriptors;
CStringArray str[16];
- for(int i = 0; i < 16; i++) {
+ for (int i = 0; i < 16; i++) {
str[i].SetSize(1+m_TOC.LastTrack);
}
CString last;
- for(int i = 0; size >= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK); i++, size -= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK), pDesc++) {
- if(pDesc->TrackNumber > m_TOC.LastTrack) {
+ for (int i = 0; size >= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK); i++, size -= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK), pDesc++) {
+ if (pDesc->TrackNumber > m_TOC.LastTrack) {
continue;
}
@@ -386,14 +386,14 @@ bool CCDDAStream::Load(const WCHAR* fnw)
: CString(CStringW((WCHAR*)pDesc->WText+tlen+1, lenW-(tlen+1))))
: _T("");
- if((pDesc->PackType -= 0x80) >= 0x10) {
+ if ((pDesc->PackType -= 0x80) >= 0x10) {
continue;
}
- if(pDesc->CharacterPosition == 0) {
+ if (pDesc->CharacterPosition == 0) {
str[pDesc->PackType][pDesc->TrackNumber] = text;
- } else if(pDesc->CharacterPosition <= 0xf) {
- if(pDesc->CharacterPosition < 0xf && last.GetLength() > 0) {
+ } else if (pDesc->CharacterPosition <= 0xf) {
+ if (pDesc->CharacterPosition < 0xf && last.GetLength() > 0) {
str[pDesc->PackType][pDesc->TrackNumber] = last + text;
} else {
str[pDesc->PackType][pDesc->TrackNumber] += text;
@@ -407,7 +407,7 @@ bool CCDDAStream::Load(const WCHAR* fnw)
m_trackTitle = str[0][iTrackIndex];
m_discArtist = str[1][0];
m_trackArtist = str[1][iTrackIndex];
- } while(0);
+ } while (0);
return true;
@@ -415,7 +415,7 @@ bool CCDDAStream::Load(const WCHAR* fnw)
HRESULT CCDDAStream::SetPointer(LONGLONG llPos)
{
- if(llPos < 0 || llPos > m_llLength) {
+ if (llPos < 0 || llPos > m_llLength) {
return S_FALSE;
}
m_llPosition = llPos;
@@ -432,7 +432,7 @@ HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
LONGLONG pos = m_llPosition;
size_t len = (size_t)dwBytesToRead;
- if(pos < sizeof(m_header) && len > 0) {
+ if (pos < sizeof(m_header) && len > 0) {
size_t l = (size_t)min(len, sizeof(m_header) - pos);
memcpy(pbBuffer, &((BYTE*)&m_header)[pos], l);
pbBuffer += l;
@@ -442,7 +442,7 @@ HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
pos -= sizeof(m_header);
- while(pos >= 0 && pos < m_llLength && len > 0) {
+ while (pos >= 0 && pos < m_llLength && len > 0) {
RAW_READ_INFO rawreadinfo;
rawreadinfo.SectorCount = 1;
rawreadinfo.TrackMode = CDDA;
@@ -467,7 +467,7 @@ HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
len -= l;
}
- if(pdwBytesRead) {
+ if (pdwBytesRead) {
*pdwBytesRead = pbBuffer - pbBufferOrg;
}
m_llPosition += pbBuffer - pbBufferOrg;
@@ -478,7 +478,7 @@ HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
LONGLONG CCDDAStream::Size(LONGLONG* pSizeAvailable)
{
LONGLONG size = sizeof(m_header) + m_llLength;
- if(pSizeAvailable) {
+ if (pSizeAvailable) {
*pSizeAvailable = size;
}
return size;
diff --git a/src/filters/reader/CDXAReader/CDXAReader.cpp b/src/filters/reader/CDXAReader/CDXAReader.cpp
index 3bbb81bde..5fd451f21 100644
--- a/src/filters/reader/CDXAReader/CDXAReader.cpp
+++ b/src/filters/reader/CDXAReader/CDXAReader.cpp
@@ -100,7 +100,7 @@ static DWORD build_edc(const void* in, unsigned from, unsigned upto)
const BYTE* p = (BYTE*)in + from;
DWORD result = 0;
- for(; from < upto; from++) {
+ for (; from < upto; from++) {
result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
}
@@ -162,7 +162,7 @@ CFilterApp theApp;
CCDXAReader::CCDXAReader(IUnknown* pUnk, HRESULT* phr)
: CAsyncReader(NAME("CCDXAReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -183,7 +183,7 @@ STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt)
CMediaType mt;
m_mt = mt;
- if(!m_stream.Load(pszFileName)) {
+ if (!m_stream.Load(pszFileName)) {
return E_FAIL;
}
@@ -198,12 +198,12 @@ STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt)
STDMETHODIMP CCDXAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -227,7 +227,7 @@ CCDXAStream::CCDXAStream()
CCDXAStream::~CCDXAStream()
{
- if(m_hFile != INVALID_HANDLE_VALUE) {
+ if (m_hFile != INVALID_HANDLE_VALUE) {
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
}
@@ -235,20 +235,20 @@ CCDXAStream::~CCDXAStream()
bool CCDXAStream::Load(const WCHAR* fnw)
{
- if(m_hFile != INVALID_HANDLE_VALUE) {
+ if (m_hFile != INVALID_HANDLE_VALUE) {
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
}
m_hFile = CreateFile(CString(fnw), GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
- if(m_hFile == INVALID_HANDLE_VALUE) {
+ if (m_hFile == INVALID_HANDLE_VALUE) {
return false;
}
BYTE hdr[RIFFCDXA_HEADER_SIZE];
DWORD NumberOfBytesRead;
- if(!ReadFile(m_hFile, (LPVOID)hdr, RIFFCDXA_HEADER_SIZE, &NumberOfBytesRead, NULL)
+ if (!ReadFile(m_hFile, (LPVOID)hdr, RIFFCDXA_HEADER_SIZE, &NumberOfBytesRead, NULL)
|| *((DWORD*)&hdr[0]) != 'FFIR' || *((DWORD*)&hdr[8]) != 'AXDC'
|| *((DWORD*)&hdr[4]) != (*((DWORD*)&hdr[0x28])+0x24)) {
CloseHandle(m_hFile);
@@ -261,7 +261,7 @@ bool CCDXAStream::Load(const WCHAR* fnw)
m_llLength = int((size.QuadPart - RIFFCDXA_HEADER_SIZE) / RAW_SECTOR_SIZE) * RAW_DATA_SIZE;
- if(!LookForMediaSubType()) {
+ if (!LookForMediaSubType()) {
m_llPosition = m_llLength = 0;
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
@@ -287,11 +287,11 @@ HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
PBYTE pbBufferOrg = pbBuffer;
LONGLONG pos = m_llPosition;
- while(pos >= 0 && pos < m_llLength && dwBytesToRead > 0) {
+ while (pos >= 0 && pos < m_llLength && dwBytesToRead > 0) {
UINT sector = m_nFirstSector + int(pos/RAW_DATA_SIZE);
__int64 offset = pos%RAW_DATA_SIZE;
- if(m_nBufferedSector != (int)sector) {
+ if (m_nBufferedSector != (int)sector) {
LARGE_INTEGER FilePointer;
FilePointer.QuadPart = RIFFCDXA_HEADER_SIZE + sector*RAW_SECTOR_SIZE;
SetFilePointerEx(m_hFile, FilePointer, &FilePointer, FILE_BEGIN);
@@ -301,18 +301,18 @@ HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
DWORD NumberOfBytesRead = 0;
int nRetries = 3;
- while(nRetries--) {
+ while (nRetries--) {
NumberOfBytesRead = 0;
- if(!ReadFile(m_hFile, m_sector, RAW_SECTOR_SIZE, &NumberOfBytesRead, NULL)
+ if (!ReadFile(m_hFile, m_sector, RAW_SECTOR_SIZE, &NumberOfBytesRead, NULL)
|| NumberOfBytesRead != RAW_SECTOR_SIZE) {
break;
}
- if(*(DWORD*)&m_sector[RAW_SECTOR_SIZE-4] == 0) { // no CRC? it happens...
+ if (*(DWORD*)&m_sector[RAW_SECTOR_SIZE-4] == 0) { // no CRC? it happens...
break;
}
- if(build_edc(m_sector, RAW_SYNC_SIZE + RAW_HEADER_SIZE, RAW_SECTOR_SIZE) == 0) {
+ if (build_edc(m_sector, RAW_SYNC_SIZE + RAW_HEADER_SIZE, RAW_SECTOR_SIZE) == 0) {
break;
}
@@ -330,12 +330,12 @@ HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
dwBytesToRead -= l;
}
- if(pdwBytesRead) {
+ if (pdwBytesRead) {
*pdwBytesRead = pbBuffer - pbBufferOrg;
}
m_llPosition += pbBuffer - pbBufferOrg;
- if(dwBytesToRead != 0) {
+ if (dwBytesToRead != 0) {
return S_FALSE;
}
@@ -344,7 +344,7 @@ HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDW
LONGLONG CCDXAStream::Size(LONGLONG* pSizeAvailable)
{
- if(pSizeAvailable) {
+ if (pSizeAvailable) {
*pSizeAvailable = m_llLength;
}
return m_llLength;
@@ -375,22 +375,22 @@ bool CCDXAStream::LookForMediaSubType()
m_llPosition = 0;
- for(int iSectorsRead = 0;
+ for (int iSectorsRead = 0;
Read(buff, RAW_DATA_SIZE, 1, NULL) == S_OK && iSectorsRead < 1000;
iSectorsRead++) {
- if(*((DWORD*)&buff[0]) == 0xba010000) {
+ if (*((DWORD*)&buff[0]) == 0xba010000) {
m_llPosition = 0;
m_llLength -= iSectorsRead*RAW_DATA_SIZE;
m_nFirstSector = iSectorsRead;
- if((buff[4]&0xc4) == 0x44) {
+ if ((buff[4]&0xc4) == 0x44) {
m_subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
- } else if((buff[4]&0xf1) == 0x21) {
+ } else if ((buff[4]&0xf1) == 0x21) {
m_subtype = MEDIASUBTYPE_MPEG1System;
}
return !!(m_subtype != MEDIASUBTYPE_NULL);
- } else if(*((DWORD*)&buff[0]) == 'SggO') {
+ } else if (*((DWORD*)&buff[0]) == 'SggO') {
m_llPosition = 0;
m_llLength -= iSectorsRead*RAW_DATA_SIZE;
m_nFirstSector = iSectorsRead;
@@ -398,7 +398,7 @@ bool CCDXAStream::LookForMediaSubType()
m_subtype = MEDIASUBTYPE_Ogg;
return true;
- } else if(*((DWORD*)&buff[0]) == 0xA3DF451A) {
+ } else if (*((DWORD*)&buff[0]) == 0xA3DF451A) {
m_llPosition = 0;
m_llLength -= iSectorsRead*RAW_DATA_SIZE;
m_nFirstSector = iSectorsRead;
@@ -406,7 +406,7 @@ bool CCDXAStream::LookForMediaSubType()
m_subtype = MEDIASUBTYPE_Matroska;
return true;
- } else if(*((DWORD*)&buff[0]) == 'FMR.') {
+ } else if (*((DWORD*)&buff[0]) == 'FMR.') {
m_llPosition = 0;
m_llLength -= iSectorsRead*RAW_DATA_SIZE;
m_nFirstSector = iSectorsRead;
@@ -414,7 +414,7 @@ bool CCDXAStream::LookForMediaSubType()
m_subtype = MEDIASUBTYPE_RealMedia;
return true;
- } else if(*((DWORD*)&buff[0]) == 'FFIR' && *((DWORD*)&buff[8]) == ' IVA') {
+ } else if (*((DWORD*)&buff[0]) == 'FFIR' && *((DWORD*)&buff[8]) == ' IVA') {
m_llPosition = 0;
m_llLength = min(m_llLength, *((DWORD*)&buff[4])+8);
m_nFirstSector = iSectorsRead;
@@ -422,8 +422,8 @@ bool CCDXAStream::LookForMediaSubType()
m_subtype = MEDIASUBTYPE_Avi;
return true;
- } else if(*((DWORD*)&buff[4]) == 'voom' || *((DWORD*)&buff[4]) == 'tadm'
- || *((DWORD*)&buff[4]) == 'pytf' && *((DWORD*)&buff[8]) == 'mosi' && *((DWORD*)&buff[16]) == '14pm') {
+ } else if (*((DWORD*)&buff[4]) == 'voom' || *((DWORD*)&buff[4]) == 'tadm'
+ || *((DWORD*)&buff[4]) == 'pytf' && *((DWORD*)&buff[8]) == 'mosi' && *((DWORD*)&buff[16]) == '14pm') {
m_llPosition = 0;
m_llLength -= iSectorsRead*RAW_DATA_SIZE;
m_nFirstSector = iSectorsRead;
@@ -438,22 +438,22 @@ bool CCDXAStream::LookForMediaSubType()
CRegKey majorkey;
CString majortype = _T("\\Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}");
- if(ERROR_SUCCESS == majorkey.Open(HKEY_CLASSES_ROOT, majortype, KEY_READ)) {
+ if (ERROR_SUCCESS == majorkey.Open(HKEY_CLASSES_ROOT, majortype, KEY_READ)) {
TCHAR subtype[256+1];
DWORD len = 256;
- for(int i = 0; ERROR_SUCCESS == majorkey.EnumKey(i, subtype, &len); i++, len = 256) {
+ for (int i = 0; ERROR_SUCCESS == majorkey.EnumKey(i, subtype, &len); i++, len = 256) {
CRegKey subkey;
- if(ERROR_SUCCESS != subkey.Open(HKEY_CLASSES_ROOT, majortype + _T("\\") + subtype, KEY_READ)) {
+ if (ERROR_SUCCESS != subkey.Open(HKEY_CLASSES_ROOT, majortype + _T("\\") + subtype, KEY_READ)) {
continue;
}
- for(int j = 0; true; j++) {
+ for (int j = 0; true; j++) {
TCHAR number[10];
_stprintf(number, sizeof(number)/sizeof(TCHAR), _T("%d"), j);
TCHAR pattern[256+1];
ULONG len = 256;
- if(ERROR_SUCCESS != subkey.QueryStringValue(number, pattern, &len)) {
+ if (ERROR_SUCCESS != subkey.QueryStringValue(number, pattern, &len)) {
break;
}
@@ -466,13 +466,13 @@ bool CCDXAStream::LookForMediaSubType()
int nMatches = 0, nTries = 0;
- for(int k = 0, l; nTries >= 0 && (l = p.Find(',', k)) >= 0; k = l+1, nTries++) {
+ for (int k = 0, l; nTries >= 0 && (l = p.Find(',', k)) >= 0; k = l+1, nTries++) {
CString s = p.Mid(k, l-k);
TRACE(s + '\n');
TCHAR* end = NULL;
- switch(nTries&3) {
+ switch (nTries&3) {
case 0:
offset = _tcstol(s, &end, 10);
break;
@@ -490,27 +490,27 @@ bool CCDXAStream::LookForMediaSubType()
break;
}
- if(nTries >= 0 && (nTries&3) == 3) {
- if(cb > 0 && val.GetCount() > 0 && cb == val.GetCount()) {
- if(offset >= 0 && S_OK == SetPointer(offset)
+ if (nTries >= 0 && (nTries&3) == 3) {
+ if (cb > 0 && val.GetCount() > 0 && cb == val.GetCount()) {
+ if (offset >= 0 && S_OK == SetPointer(offset)
|| S_OK == SetPointer(m_llLength + offset)) {
CAutoVectorPtr<BYTE> pData;
- if(pData.Allocate(cb)) {
+ if (pData.Allocate(cb)) {
DWORD BytesRead = 0;
- if(S_OK == Read(pData, cb, 1, &BytesRead) && cb == BytesRead) {
- if(mask.GetCount() < cb) {
+ if (S_OK == Read(pData, cb, 1, &BytesRead) && cb == BytesRead) {
+ if (mask.GetCount() < cb) {
size_t i = mask.GetCount();
mask.SetCount(cb);
- for(; i < cb; i++) {
+ for (; i < cb; i++) {
mask[i] = 0xff;
}
}
- for(unsigned int i = 0; i < cb; i++) {
+ for (unsigned int i = 0; i < cb; i++) {
pData[i] &= (BYTE)mask[i];
}
- if(memcmp(pData, val.GetData(), cb) == 0) {
+ if (memcmp(pData, val.GetData(), cb) == 0) {
nMatches++;
}
}
@@ -525,7 +525,7 @@ bool CCDXAStream::LookForMediaSubType()
}
}
- if(nMatches > 0 && nMatches*4 == nTries) {
+ if (nMatches > 0 && nMatches*4 == nTries) {
m_subtype = GUIDFromCString(subtype);
return S_OK;
}
diff --git a/src/filters/reader/UDPReader/UDPReader.cpp b/src/filters/reader/UDPReader/UDPReader.cpp
index 1fe035f6a..3025e8f3a 100644
--- a/src/filters/reader/UDPReader/UDPReader.cpp
+++ b/src/filters/reader/UDPReader/UDPReader.cpp
@@ -74,7 +74,7 @@ CFilterApp theApp;
CUDPReader::CUDPReader(IUnknown* pUnk, HRESULT* phr)
: CAsyncReader(NAME("CUDPReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -96,7 +96,7 @@ STDMETHODIMP CUDPReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
STDMETHODIMP CUDPReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName)) {
+ if (!m_stream.Load(pszFileName)) {
return E_FAIL;
}
@@ -112,12 +112,12 @@ STDMETHODIMP CUDPReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
STDMETHODIMP CUDPReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -142,15 +142,15 @@ CUDPStream::~CUDPStream()
void CUDPStream::Clear()
{
- if(m_socket !=INVALID_SOCKET) {
+ if (m_socket !=INVALID_SOCKET) {
closesocket(m_socket);
m_socket = INVALID_SOCKET;
}
- if(CAMThread::ThreadExists()) {
+ if (CAMThread::ThreadExists()) {
CAMThread::CallWorker(CMD_EXIT);
CAMThread::Close();
}
- while(!m_packets.IsEmpty()) {
+ while (!m_packets.IsEmpty()) {
delete m_packets.RemoveHead();
}
m_pos = m_len = 0;
@@ -161,18 +161,18 @@ void CUDPStream::Append(BYTE* buff, int len)
{
CAutoLock cAutoLock(&m_csLock);
- if(m_packets.GetCount() > 1) {
+ if (m_packets.GetCount() > 1) {
__int64 size = m_packets.GetTail()->m_end - m_packets.GetHead()->m_start;
- if(!m_drop && (m_pos >= BUFF_SIZE_FIRST && size >= BUFF_SIZE_FIRST || size >= 2*BUFF_SIZE_FIRST)) {
+ if (!m_drop && (m_pos >= BUFF_SIZE_FIRST && size >= BUFF_SIZE_FIRST || size >= 2*BUFF_SIZE_FIRST)) {
m_drop = true;
TRACE(_T("DROP ON\n"));
- } else if(m_drop && size <= BUFF_SIZE_FIRST) {
+ } else if (m_drop && size <= BUFF_SIZE_FIRST) {
m_drop = false;
TRACE(_T("DROP OFF\n"));
}
- if(m_drop) {
+ if (m_drop) {
return;
}
}
@@ -195,7 +195,7 @@ bool CUDPStream::Load(const WCHAR* fnw)
CAtlList<CStringW> sl;
Explode(url, sl, ':');
- if(sl.GetCount() != 3) {
+ if (sl.GetCount() != 3) {
return false;
}
@@ -205,23 +205,23 @@ bool CUDPStream::Load(const WCHAR* fnw)
m_ip = CString(sl.RemoveHead()).TrimLeft('/');
int port = _wtoi(Explode(sl.RemoveHead(), sl, '/', 2));
- if(port < 0 || port > 0xffff) {
+ if (port < 0 || port > 0xffff) {
return false;
}
m_port = port;
- if(sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype))) {
+ if (sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype))) {
m_subtype = MEDIASUBTYPE_NULL; // TODO: detect subtype
}
CAMThread::Create();
- if(FAILED(CAMThread::CallWorker(CMD_RUN))) {
+ if (FAILED(CAMThread::CallWorker(CMD_RUN))) {
Clear();
return false;
}
clock_t start = clock();
- while(clock() - start < 3000 && m_len < 1000000) {
+ while (clock() - start < 3000 && m_len < 1000000) {
Sleep(100);
}
@@ -232,7 +232,7 @@ HRESULT CUDPStream::SetPointer(LONGLONG llPos)
{
CAutoLock cAutoLock(&m_csLock);
- if(m_packets.IsEmpty() && llPos != 0
+ if (m_packets.IsEmpty() && llPos != 0
|| !m_packets.IsEmpty() && llPos < m_packets.GetHead()->m_start
|| !m_packets.IsEmpty() && llPos > m_packets.GetTail()->m_end) {
TRACE(_T("CUDPStream: SetPointer error\n"));
@@ -251,15 +251,15 @@ HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
DWORD len = dwBytesToRead;
BYTE* ptr = pbBuffer;
- while(len > 0 && !m_packets.IsEmpty()) {
+ while (len > 0 && !m_packets.IsEmpty()) {
POSITION pos = m_packets.GetHeadPosition();
- while(pos && len > 0) {
+ while (pos && len > 0) {
packet_t* p = m_packets.GetNext(pos);
- if(p->m_start <= m_pos && m_pos < p->m_end) {
+ if (p->m_start <= m_pos && m_pos < p->m_end) {
int size;
- if(m_pos < p->m_start) {
+ if (m_pos < p->m_start) {
ASSERT(0);
size = min(len, p->m_start - m_pos);
memset(ptr, 0, size);
@@ -274,8 +274,8 @@ HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
len -= size;
}
- if(p->m_end <= m_pos - 2048 && BUFF_SIZE_FIRST <= m_pos) {
- while(m_packets.GetHeadPosition() != pos) {
+ if (p->m_end <= m_pos - 2048 && BUFF_SIZE_FIRST <= m_pos) {
+ while (m_packets.GetHeadPosition() != pos) {
delete m_packets.RemoveHead();
}
}
@@ -283,7 +283,7 @@ HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
}
}
- if(pdwBytesRead) {
+ if (pdwBytesRead) {
*pdwBytesRead = ptr - pbBuffer;
}
@@ -293,7 +293,7 @@ HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
LONGLONG CUDPStream::Size(LONGLONG* pSizeAvailable)
{
CAutoLock cAutoLock(&m_csLock);
- if(pSizeAvailable) {
+ if (pSizeAvailable) {
*pSizeAvailable = m_len;
}
return 0;
@@ -329,24 +329,24 @@ DWORD CUDPStream::ThreadProc()
imr.imr_multiaddr.s_addr = inet_addr(CStringA(m_ip));
imr.imr_interface.s_addr = INADDR_ANY;
- if((m_socket = socket(AF_INET, SOCK_DGRAM, 0))!=INVALID_SOCKET) {
+ if ((m_socket = socket(AF_INET, SOCK_DGRAM, 0))!=INVALID_SOCKET) {
/* u_long argp = 1;
ioctlsocket(m_socket, FIONBIO, &argp);
*/
DWORD dw = TRUE;
- if(setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&dw, sizeof(dw))==SOCKET_ERROR) {
+ if (setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&dw, sizeof(dw))==SOCKET_ERROR) {
closesocket(m_socket);
m_socket = INVALID_SOCKET;
}
- if(bind(m_socket, (struct sockaddr*)&addr, sizeof(addr))==SOCKET_ERROR) {
+ if (bind(m_socket, (struct sockaddr*)&addr, sizeof(addr))==SOCKET_ERROR) {
closesocket(m_socket);
m_socket = INVALID_SOCKET;
}
- if(IN_MULTICAST(htonl(imr.imr_multiaddr.s_addr))) {
+ if (IN_MULTICAST(htonl(imr.imr_multiaddr.s_addr))) {
int ret = setsockopt(m_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&imr, sizeof(imr));
- if(ret < 0) {
+ if (ret < 0) {
ret = ::WSAGetLastError();
}
ret = ret;
@@ -362,22 +362,22 @@ DWORD CUDPStream::ThreadProc()
// log = _tfopen(_T("c:\\udp.txt"), _T("wt"));
#endif
- while(1) {
+ while (1) {
DWORD cmd = GetRequest();
- switch(cmd) {
+ switch (cmd) {
default:
case CMD_EXIT:
- if(m_socket!=INVALID_SOCKET) {
+ if (m_socket!=INVALID_SOCKET) {
closesocket(m_socket);
m_socket = INVALID_SOCKET;
}
WSACleanup();
#ifdef _DEBUG
- if(dump) {
+ if (dump) {
fclose(dump);
}
- if(log) {
+ if (log) {
fclose(log);
}
#endif
@@ -390,23 +390,23 @@ DWORD CUDPStream::ThreadProc()
char buff[65536*2];
int buffsize = 0;
- for(unsigned int i = 0; ; i++) {
- if(!(i&0xff)) {
- if(CheckRequest(NULL)) {
+ for (unsigned int i = 0; ; i++) {
+ if (!(i&0xff)) {
+ if (CheckRequest(NULL)) {
break;
}
}
int fromlen = sizeof(addr);
int len = recvfrom(m_socket, &buff[buffsize], 65536, 0, (SOCKADDR*)&addr, &fromlen);
- if(len <= 0) {
+ if (len <= 0) {
Sleep(1);
continue;
}
#ifdef _DEBUG
- if(log) {
- if(buffsize >= len && !memcmp(&buff[buffsize-len], &buff[buffsize], len)) {
+ if (log) {
+ if (buffsize >= len && !memcmp(&buff[buffsize-len], &buff[buffsize], len)) {
DWORD pid = ((buff[buffsize+1]<<8)|buff[buffsize+2])&0x1fff;
DWORD counter = buff[buffsize+3]&0xf;
_ftprintf(log, _T("%04d %2d DUP\n"), pid, counter);
@@ -416,24 +416,24 @@ DWORD CUDPStream::ThreadProc()
buffsize += len;
- if(buffsize >= 65536 || m_len == 0) {
+ if (buffsize >= 65536 || m_len == 0) {
#ifdef _DEBUG
- if(dump) {
+ if (dump) {
fwrite(buff, buffsize, 1, dump);
}
- if(log) {
+ if (log) {
static BYTE pid2counter[0x2000];
static bool init = false;
- if(!init) {
+ if (!init) {
memset(pid2counter, 0, sizeof(pid2counter));
init = true;
}
- for(int i = 0; i < buffsize; i += 188) {
+ for (int i = 0; i < buffsize; i += 188) {
DWORD pid = ((buff[i+1]<<8)|buff[i+2])&0x1fff;
DWORD counter = buff[i+3]&0xf;
- if(pid2counter[pid] != ((counter-1+16)&15)) {
+ if (pid2counter[pid] != ((counter-1+16)&15)) {
_ftprintf(log, _T("%04x %2d -> %2d\n"), pid, pid2counter[pid], counter);
}
pid2counter[pid] = counter;
diff --git a/src/filters/reader/VTSReader/VTSReader.cpp b/src/filters/reader/VTSReader/VTSReader.cpp
index 75e1f620b..4967433b6 100644
--- a/src/filters/reader/VTSReader/VTSReader.cpp
+++ b/src/filters/reader/VTSReader/VTSReader.cpp
@@ -46,7 +46,7 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- if(GetVersion()&0x80000000) {
+ if (GetVersion()&0x80000000) {
return E_NOTIMPL;
}
@@ -81,12 +81,12 @@ CFilterApp theApp;
CVTSReader::CVTSReader(IUnknown* pUnk, HRESULT* phr)
: CAsyncReader(NAME("CVTSReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
- if(GetVersion()&0x80000000) {
- if(phr) {
+ if (GetVersion()&0x80000000) {
+ if (phr) {
*phr = E_NOTIMPL;
}
return;
@@ -115,7 +115,7 @@ STDMETHODIMP CVTSReader::QueryFilterInfo(FILTER_INFO* pInfo)
wcscpy(pInfo->achName, VTSReaderName);
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -126,7 +126,7 @@ STDMETHODIMP CVTSReader::QueryFilterInfo(FILTER_INFO* pInfo)
STDMETHODIMP CVTSReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName)) {
+ if (!m_stream.Load(pszFileName)) {
return E_FAIL;
}
@@ -149,12 +149,12 @@ STDMETHODIMP CVTSReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
STDMETHODIMP CVTSReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -237,9 +237,9 @@ HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
DWORD len = dwBytesToRead;
BYTE* ptr = pbBuffer;
- while(len > 0) {
+ while (len > 0) {
BYTE buff[2048];
- if(!m_vob->Read(buff)) {
+ if (!m_vob->Read(buff)) {
break;
}
@@ -249,7 +249,7 @@ HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
m_off = (m_off + size)&2047;
- if(m_off > 0) {
+ if (m_off > 0) {
m_vob->Seek(m_vob->GetPosition()-1);
}
@@ -257,7 +257,7 @@ HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
len -= size;
}
- if(pdwBytesRead) {
+ if (pdwBytesRead) {
*pdwBytesRead = ptr - pbBuffer;
}
@@ -267,7 +267,7 @@ HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWO
LONGLONG CVTSStream::Size(LONGLONG* pSizeAvailable)
{
LONGLONG len = 2048i64*m_vob->GetLength();
- if(pSizeAvailable) {
+ if (pSizeAvailable) {
*pSizeAvailable = len;
}
return(len);
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
index 40de4c814..d7eabe73f 100644
--- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
@@ -101,23 +101,23 @@ CFilterApp theApp;
static GUID lpSoundGUID = {0xdef00000, 0x9c6d, 0x47ed, {0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03}}; //DSDEVID_DefaultPlayback from dsound.h
-bool CALLBACK DSEnumProc2(LPGUID lpGUID,
- LPCTSTR lpszDesc,
- LPCTSTR lpszDrvName,
- LPVOID lpContext )
+bool CALLBACK DSEnumProc2(LPGUID lpGUID,
+ LPCTSTR lpszDesc,
+ LPCTSTR lpszDrvName,
+ LPVOID lpContext )
{
CString *pStr = (CString *)lpContext;
ASSERT ( pStr );
CString strGUID = *pStr;
- if (lpGUID != NULL) // NULL only for "Primary Sound Driver".
- {
- if(strGUID == lpszDesc) {
+ if (lpGUID != NULL) // NULL only for "Primary Sound Driver".
+ {
+ if (strGUID == lpszDesc) {
memcpy((VOID *)&lpSoundGUID, lpGUID, sizeof(GUID));
}
- }
+ }
- return TRUE;
+ return TRUE;
}
CMpcAudioRenderer::CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr)
@@ -152,18 +152,18 @@ CMpcAudioRenderer::CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr)
TCHAR buff[256];
ULONG len;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"), KEY_READ)) {
DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("UseWasapi"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("UseWasapi"), dw)) {
m_useWASAPI = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("MuteFastForward"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("MuteFastForward"), dw)) {
m_bMuteFastForward = !!dw;
}
len = sizeof(buff)/sizeof(buff[0]);
memset(buff, 0, sizeof(buff));
- if(ERROR_SUCCESS == key.QueryStringValue(_T("SoundDevice"), buff, &len)) {
- m_csSound_Device = CString(buff);
+ if (ERROR_SUCCESS == key.QueryStringValue(_T("SoundDevice"), buff, &len)) {
+ m_csSound_Device = CString(buff);
}
}
#else
@@ -242,7 +242,7 @@ HRESULT CMpcAudioRenderer::CheckMediaType(const CMediaType *pmt)
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(m_useWASAPI) {
+ if (m_useWASAPI) {
hr=CheckAudioClient((WAVEFORMATEX *)NULL);
if (FAILED(hr)) {
TRACE(_T("CMpcAudioRenderer::CheckMediaType Error on check audio client\n"));
@@ -570,13 +570,13 @@ STDMETHODIMP CMpcAudioRenderer::CreatePage(const GUID& guid, IPropertyPage** ppP
{
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMpcAudioRendererSettingsWnd)) {
+ if (guid == __uuidof(CMpcAudioRendererSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMpcAudioRendererSettingsWnd>(NULL, &hr))->AddRef();
}
@@ -588,7 +588,7 @@ STDMETHODIMP CMpcAudioRenderer::Apply()
{
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"))) {
key.SetDWORDValue(_T("UseWasapi"), m_useWASAPIAfterRestart);
key.SetDWORDValue(_T("MuteFastForward"), m_bMuteFastForward);
key.SetStringValue(_T("SoundDevice"), m_csSound_Device);
@@ -1079,115 +1079,115 @@ HRESULT CMpcAudioRenderer::CheckAudioClient(WAVEFORMATEX *pWaveFormatEx)
HRESULT CMpcAudioRenderer::GetAvailableAudioDevices(IMMDeviceCollection **ppMMDevices)
{
- HRESULT hr;
-
- CComPtr<IMMDeviceEnumerator> enumerator;
- TRACE(_T("CMpcAudioRenderer::GetAvailableAudioDevices\n"));
- hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
-
- if (FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::GetAvailableAudioDevices - failed to get MMDeviceEnumerator\n"));
- return S_FALSE;
- }
-
- //IMMDevice* pEndpoint = NULL;
- //IPropertyStore* pProps = NULL;
- //LPWSTR pwszID = NULL;
-
- enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, ppMMDevices);
- UINT count(0);
- hr = (*ppMMDevices)->GetCount(&count);
- return hr;
+ HRESULT hr;
+
+ CComPtr<IMMDeviceEnumerator> enumerator;
+ TRACE(_T("CMpcAudioRenderer::GetAvailableAudioDevices\n"));
+ hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
+
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::GetAvailableAudioDevices - failed to get MMDeviceEnumerator\n"));
+ return S_FALSE;
+ }
+
+ //IMMDevice* pEndpoint = NULL;
+ //IPropertyStore* pProps = NULL;
+ //LPWSTR pwszID = NULL;
+
+ enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, ppMMDevices);
+ UINT count(0);
+ hr = (*ppMMDevices)->GetCount(&count);
+ return hr;
}
HRESULT CMpcAudioRenderer::GetAudioDevice(IMMDevice **ppMMDevice)
{
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice\n"));
-
- CComPtr<IMMDeviceEnumerator> enumerator;
- IMMDeviceCollection* devices;
- IPropertyStore* pProps = NULL;
- HRESULT hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
-
- if (hr != S_OK)
- {
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - failed to create MMDeviceEnumerator!\n"));
- return hr;
- }
-
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - Target end point: %s\n"), m_csSound_Device);
-
- if (GetAvailableAudioDevices(&devices) == S_OK && devices)
- {
- UINT count(0);
- hr = devices->GetCount(&count);
- if (hr != S_OK)
- {
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetCount failed: (0x%08x)\n"), hr);
- return hr;
- }
-
- for (ULONG i = 0 ; i < count ; i++)
- {
- LPWSTR pwszID = NULL;
- IMMDevice *endpoint = NULL;
- hr = devices->Item(i, &endpoint);
- if (hr == S_OK)
- {
- hr = endpoint->GetId(&pwszID);
- if (hr == S_OK)
- {
- if(endpoint->OpenPropertyStore(STGM_READ, &pProps) == S_OK)
- {
-
- PROPVARIANT varName;
- PropVariantInit(&varName);
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice\n"));
+
+ CComPtr<IMMDeviceEnumerator> enumerator;
+ IMMDeviceCollection* devices;
+ IPropertyStore* pProps = NULL;
+ HRESULT hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
+
+ if (hr != S_OK)
+ {
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - failed to create MMDeviceEnumerator!\n"));
+ return hr;
+ }
- // Found the configured audio endpoint
- if ((pProps->GetValue(PKEY_Device_FriendlyName, &varName) == S_OK) && (m_csSound_Device == varName.pwszVal))
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - Target end point: %s\n"), m_csSound_Device);
+
+ if (GetAvailableAudioDevices(&devices) == S_OK && devices)
+ {
+ UINT count(0);
+ hr = devices->GetCount(&count);
+ if (hr != S_OK)
+ {
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetCount failed: (0x%08x)\n"), hr);
+ return hr;
+ }
+
+ for (ULONG i = 0 ; i < count ; i++)
+ {
+ LPWSTR pwszID = NULL;
+ IMMDevice *endpoint = NULL;
+ hr = devices->Item(i, &endpoint);
+ if (hr == S_OK)
+ {
+ hr = endpoint->GetId(&pwszID);
+ if (hr == S_OK)
{
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetId OK, num: (%d), pwszVal: %s, pwszID: %s\n"), i, varName.pwszVal, pwszID);
- enumerator->GetDevice(pwszID, ppMMDevice);
- SAFE_RELEASE(devices);
- *(ppMMDevice) = endpoint;
- CoTaskMemFree(pwszID);
- pwszID = NULL;
- PropVariantClear(&varName);
- SAFE_RELEASE(pProps);
- return S_OK;
+ if (endpoint->OpenPropertyStore(STGM_READ, &pProps) == S_OK)
+ {
+
+ PROPVARIANT varName;
+ PropVariantInit(&varName);
+
+ // Found the configured audio endpoint
+ if ((pProps->GetValue(PKEY_Device_FriendlyName, &varName) == S_OK) && (m_csSound_Device == varName.pwszVal))
+ {
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetId OK, num: (%d), pwszVal: %s, pwszID: %s\n"), i, varName.pwszVal, pwszID);
+ enumerator->GetDevice(pwszID, ppMMDevice);
+ SAFE_RELEASE(devices);
+ *(ppMMDevice) = endpoint;
+ CoTaskMemFree(pwszID);
+ pwszID = NULL;
+ PropVariantClear(&varName);
+ SAFE_RELEASE(pProps);
+ return S_OK;
+ }
+ else
+ {
+ PropVariantClear(&varName);
+ SAFE_RELEASE(pProps);
+ SAFE_RELEASE(endpoint);
+ CoTaskMemFree(pwszID);
+ pwszID = NULL;
+ }
+ }
}
else
{
- PropVariantClear(&varName);
- SAFE_RELEASE(pProps);
- SAFE_RELEASE(endpoint);
- CoTaskMemFree(pwszID);
- pwszID = NULL;
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetId failed: (0x%08x)\n"), hr);
}
}
- }
- else
- {
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->GetId failed: (0x%08x)\n"), hr);
- }
- }
- else
- {
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->Item failed: (0x%08x)\n"), hr);
- }
-
- CoTaskMemFree(pwszID);
- pwszID = NULL;
- }
- }
-
- TRACE(_T("CMpcAudioRenderer::GetAudioDevice - Unable to find selected audio device, using the default end point!\n"));
- hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, ppMMDevice);
-
- SAFE_RELEASE(devices);
-
- return hr;
+ else
+ {
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - devices->Item failed: (0x%08x)\n"), hr);
+ }
+
+ CoTaskMemFree(pwszID);
+ pwszID = NULL;
+ }
+ }
+
+ TRACE(_T("CMpcAudioRenderer::GetAudioDevice - Unable to find selected audio device, using the default end point!\n"));
+ hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, ppMMDevice);
+
+ SAFE_RELEASE(devices);
+
+ return hr;
}
bool CMpcAudioRenderer::CheckFormatChanged(WAVEFORMATEX *pWaveFormatEx, WAVEFORMATEX **ppNewWaveFormatEx)
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRendererSettingsWnd.cpp b/src/filters/renderer/MpcAudioRenderer/MpcAudioRendererSettingsWnd.cpp
index 1aa5031b0..cf452c85d 100644
--- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRendererSettingsWnd.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRendererSettingsWnd.cpp
@@ -44,11 +44,11 @@ bool CMpcAudioRendererSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID
m_pMAR.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMAR = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMAR = pUnks.GetNext(pos))) {
;
}
- if(!m_pMAR) {
+ if (!m_pMAR) {
return false;
}
@@ -60,26 +60,26 @@ void CMpcAudioRendererSettingsWnd::OnDisconnect()
m_pMAR.Release();
}
-bool CALLBACK DSEnumProc(LPGUID lpGUID,
- LPCTSTR lpszDesc,
- LPCTSTR lpszDrvName,
- LPVOID lpContext )
+bool CALLBACK DSEnumProc(LPGUID lpGUID,
+ LPCTSTR lpszDesc,
+ LPCTSTR lpszDrvName,
+ LPVOID lpContext )
{
- CComboBox *pCombo = (CComboBox*)lpContext;
- ASSERT ( pCombo );
- LPGUID lpTemp = NULL;
-
- if (lpGUID != NULL) // NULL only for "Primary Sound Driver".
- {
- if ((lpTemp = (LPGUID)malloc(sizeof(GUID))) == NULL)
- {
- return TRUE;
- }
- memcpy(lpTemp, lpGUID, sizeof(GUID));
- }
- pCombo->AddString ( lpszDesc );
- free(lpTemp);
- return TRUE;
+ CComboBox *pCombo = (CComboBox*)lpContext;
+ ASSERT ( pCombo );
+ LPGUID lpTemp = NULL;
+
+ if (lpGUID != NULL) // NULL only for "Primary Sound Driver".
+ {
+ if ((lpTemp = (LPGUID)malloc(sizeof(GUID))) == NULL)
+ {
+ return TRUE;
+ }
+ memcpy(lpTemp, lpGUID, sizeof(GUID));
+ }
+ pCombo->AddString ( lpszDesc );
+ free(lpTemp);
+ return TRUE;
}
bool CMpcAudioRendererSettingsWnd::OnActivate()
@@ -94,14 +94,14 @@ bool CMpcAudioRendererSettingsWnd::OnActivate()
nPosY += VERTICAL_SPACING + 5;
m_txtSoundDevice.Create (ResStr (IDS_ARS_SOUND_DEVICE), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 100, nPosY+15), this, (UINT)IDC_STATIC);
m_cbSoundDevice.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (110, nPosY-4, 325, nPosY+90), this, IDC_PP_SOUND_DEVICE);
-
+
SetClassLongPtr(GetDlgItem(IDC_PP_SOUND_DEVICE)->m_hWnd, GCLP_HCURSOR, (long) AfxGetApp()->LoadStandardCursor(IDC_HAND));
DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, (VOID*)&m_cbSoundDevice);
if ( m_cbSoundDevice.GetCount() > 0 ) {
int idx = m_cbSoundDevice.FindString(0, m_pMAR->GetSoundDevice());
- if( idx < 0) {
+ if ( idx < 0) {
m_cbSoundDevice.SetCurSel(0);
}
else {
@@ -112,7 +112,7 @@ bool CMpcAudioRendererSettingsWnd::OnActivate()
m_cbWasapiMode.SetCheck(m_pMAR->GetWasapiMode());
m_cbMuteFastForward.SetCheck(m_pMAR->GetMuteFastForward());
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -127,12 +127,12 @@ bool CMpcAudioRendererSettingsWnd::OnApply()
{
OnDeactivate();
- if(m_pMAR) {
+ if (m_pMAR) {
m_pMAR->SetWasapiMode(m_cbWasapiMode.GetCheck());
m_pMAR->SetMuteFastForward(m_cbMuteFastForward.GetCheck());
CString str;
int idx = m_cbSoundDevice.GetCurSel();
- if( !(idx < 0) ) {
+ if ( !(idx < 0) ) {
m_cbSoundDevice.GetLBText( idx, str );
m_pMAR->SetSoundDevice(str);
}
diff --git a/src/filters/renderer/SyncClock/Interfaces.h b/src/filters/renderer/SyncClock/Interfaces.h
index ae3ee5253..7b8abfcc0 100644
--- a/src/filters/renderer/SyncClock/Interfaces.h
+++ b/src/filters/renderer/SyncClock/Interfaces.h
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
#pragma once
const IID IID_ISyncClock = {0xa62888fb, 0x8e37, 0x44d2, {0x88, 0x50, 0xb3, 0xe3, 0xf2, 0xc1, 0x16, 0x9f}};
diff --git a/src/filters/renderer/SyncClock/SyncClock.cpp b/src/filters/renderer/SyncClock/SyncClock.cpp
index eaa9e871b..39b330bea 100644
--- a/src/filters/renderer/SyncClock/SyncClock.cpp
+++ b/src/filters/renderer/SyncClock/SyncClock.cpp
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
#include "stdafx.h"
#include <InitGuid.h>
#include "SyncClock.h"
@@ -93,9 +93,9 @@ STDMETHODIMP CSyncClockFilter::NonDelegatingQueryInterface( REFIID riid, void **
{
CheckPointer(ppv, E_POINTER);
- if(riid == IID_IReferenceClock) {
+ if (riid == IID_IReferenceClock) {
return GetInterface(static_cast<IReferenceClock*>(&m_Clock), ppv);
- } else if(riid == IID_ISyncClock) {
+ } else if (riid == IID_ISyncClock) {
return GetInterface(static_cast<ISyncClock*>(this), ppv);
} else {
return CBaseFilter::NonDelegatingQueryInterface(riid, ppv);
diff --git a/src/filters/renderer/SyncClock/SyncClock.h b/src/filters/renderer/SyncClock/SyncClock.h
index bbb4e6f71..4ae26ce2c 100644
--- a/src/filters/renderer/SyncClock/SyncClock.h
+++ b/src/filters/renderer/SyncClock/SyncClock.h
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
#pragma once
#include <atlbase.h>
diff --git a/src/filters/renderer/SyncClock/stdafx.cpp b/src/filters/renderer/SyncClock/stdafx.cpp
index a328b326e..26b4ebbee 100644
--- a/src/filters/renderer/SyncClock/stdafx.cpp
+++ b/src/filters/renderer/SyncClock/stdafx.cpp
@@ -19,5 +19,5 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
#include "stdafx.h"
diff --git a/src/filters/renderer/SyncClock/stdafx.h b/src/filters/renderer/SyncClock/stdafx.h
index 800cef726..9cb3f0d17 100644
--- a/src/filters/renderer/SyncClock/stdafx.h
+++ b/src/filters/renderer/SyncClock/stdafx.h
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
#pragma once
#include "../../../DSUtil/SharedInclude.h"
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp
index 62c98d783..5f0a7c23b 100644
--- a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp
+++ b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp
@@ -35,7 +35,7 @@
bool IsVMR9InGraph(IFilterGraph* pFG)
{
BeginEnumFilters(pFG, pEF, pBF)
- if(CComQIPtr<IVMRWindowlessControl9>(pBF)) {
+ if (CComQIPtr<IVMRWindowlessControl9>(pBF)) {
return true;
}
EndEnumFilters
@@ -103,7 +103,7 @@ HRESULT CreateEVR(const CLSID& clsid, HWND hWnd, bool bFullscreen, ISubPicAlloca
*ppAP = DNew DSObjects::CEVRAllocatorPresenter(hWnd, bFullscreen, hr, Error);
(*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
Error += L"\n";
Error += GetWindowsErrorMessage(hr, NULL);
MessageBox(hWnd, Error, L"Error creating EVR Custom renderer", MB_OK | MB_ICONERROR);
@@ -185,8 +185,8 @@ CString GetWindowsErrorMessage(HRESULT _Error, HMODULE _Module)
CString errmsg;
LPVOID lpMsgBuf;
- if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_HMODULE,
- _Module, _Error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_HMODULE,
+ _Module, _Error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL)) {
errmsg = (LPCTSTR)lpMsgBuf;
LocalFree(lpMsgBuf);
}
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp
index 02d41e59a..b72091b36 100644
--- a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp
+++ b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp
@@ -35,7 +35,7 @@
bool IsVMR7InGraph(IFilterGraph* pFG)
{
BeginEnumFilters(pFG, pEF, pBF)
- if(CComQIPtr<IVMRWindowlessControl>(pBF)) {
+ if (CComQIPtr<IVMRWindowlessControl>(pBF)) {
return true;
}
EndEnumFilters
@@ -73,7 +73,7 @@ HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA
(*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
(*ppAP)->Release();
*ppAP = NULL;
}
diff --git a/src/filters/renderer/VideoRenderers/D3DFont.cpp b/src/filters/renderer/VideoRenderers/D3DFont.cpp
index 5b741ad30..e791c2d9f 100644
--- a/src/filters/renderer/VideoRenderers/D3DFont.cpp
+++ b/src/filters/renderer/VideoRenderers/D3DFont.cpp
@@ -131,7 +131,7 @@ HRESULT CD3DFont::CreateGDIFont( HDC hDC, HFONT* pFont )
CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
VARIABLE_PITCH, m_strFontName );
- if( *pFont == NULL ) {
+ if ( *pFont == NULL ) {
return E_FAIL;
}
@@ -152,7 +152,7 @@ HRESULT CD3DFont::PaintAlphabet( HDC hDC, BOOL bMeasureOnly )
TCHAR str[2] = _T("x"); // One-character, null-terminated string
// Calculate the spacing between characters based on line height
- if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
+ if ( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
return E_FAIL;
}
m_dwSpacing = (DWORD) ceil(size.cy * 0.3f);
@@ -162,25 +162,25 @@ HRESULT CD3DFont::PaintAlphabet( HDC hDC, BOOL bMeasureOnly )
DWORD y = 0;
// For each character, draw text on the DC and advance the current position
- for( char c = 32; c < 127; c++ ) {
+ for ( char c = 32; c < 127; c++ ) {
str[0] = c;
- if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
+ if ( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
return E_FAIL;
}
- if( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth ) {
+ if ( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth ) {
x = m_dwSpacing;
y += size.cy + 1;
}
// Check to see if there's room to write the character here
- if( y + size.cy > m_dwTexHeight ) {
+ if ( y + size.cy > m_dwTexHeight ) {
return D3DERR_MOREDATA;
}
- if( !bMeasureOnly ) {
+ if ( !bMeasureOnly ) {
// Perform the actual drawing
- if( 0 == ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL ) ) {
+ if ( 0 == ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL ) ) {
return E_FAIL;
}
@@ -223,7 +223,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
SetMapMode( hDC, MM_TEXT );
hr = CreateGDIFont( hDC, &hFont );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -232,12 +232,12 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
// Calculate the dimensions for the smallest power-of-two texture which
// can hold all the printable characters
m_dwTexWidth = m_dwTexHeight = 128;
- while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) ) {
+ while ( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) ) {
m_dwTexWidth *= 2;
m_dwTexHeight *= 2;
}
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -246,7 +246,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
D3DCAPS9 d3dCaps;
m_pd3dDevice->GetDeviceCaps( &d3dCaps );
- if( m_dwTexWidth > d3dCaps.MaxTextureWidth ) {
+ if ( m_dwTexWidth > d3dCaps.MaxTextureWidth ) {
m_fTextScale = (FLOAT)d3dCaps.MaxTextureWidth / (FLOAT)m_dwTexWidth;
m_dwTexWidth = m_dwTexHeight = d3dCaps.MaxTextureWidth;
@@ -255,7 +255,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
do {
// If we've already tried fitting the new text, the scale is still
// too large. Reduce and try again.
- if( !bFirstRun) {
+ if ( !bFirstRun) {
m_fTextScale *= 0.9f;
}
@@ -264,14 +264,14 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
DeleteObject( SelectObject( hDC, hFontOld ) );
hr = CreateGDIFont( hDC, &hFont );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
hFontOld = (HFONT) SelectObject( hDC, hFont );
bFirstRun = false;
- } while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) );
+ } while ( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) );
}
@@ -279,7 +279,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
hr = m_pd3dDevice->CreateTexture( m_dwTexWidth, m_dwTexHeight, 1,
0, D3DFMT_A4R4G4B4,
D3DPOOL_MANAGED, &m_pTexture, NULL );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -307,7 +307,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
// Paint the alphabet onto the selected bitmap
hr = PaintAlphabet( hDC, false );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -320,9 +320,9 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
BYTE bAlpha; // 4-bit measure of pixel intensity
DWORD x, y;
- for( y=0; y < m_dwTexHeight; y++ ) {
+ for ( y=0; y < m_dwTexHeight; y++ ) {
pDst16 = (WORD*)pDstRow;
- for( x=0; x < m_dwTexWidth; x++ ) {
+ for ( x=0; x < m_dwTexWidth; x++ ) {
bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4);
if (bAlpha > 0) {
*pDst16++ = (WORD) ((bAlpha << 12) | 0x0fff);
@@ -337,7 +337,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
// Done updating texture, so clean up used objects
LCleanReturn:
- if( m_pTexture ) {
+ if ( m_pTexture ) {
m_pTexture->UnlockRect(0);
}
@@ -362,26 +362,26 @@ HRESULT CD3DFont::RestoreDeviceObjects()
// Create vertex buffer for the letters
int vertexSize = max( sizeof(FONT2DVERTEX), sizeof(FONT3DVERTEX ) );
- if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
- D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
- D3DPOOL_DEFAULT, &m_pVB, NULL ) ) ) {
+ if ( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
+ D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
+ D3DPOOL_DEFAULT, &m_pVB, NULL ) ) ) {
return hr;
}
bool bSupportsAlphaBlend = true;
LPDIRECT3D9 pd3d9 = NULL;
- if( SUCCEEDED( m_pd3dDevice->GetDirect3D( &pd3d9 ) ) ) {
+ if ( SUCCEEDED( m_pd3dDevice->GetDirect3D( &pd3d9 ) ) ) {
D3DCAPS9 Caps;
D3DDISPLAYMODE Mode;
LPDIRECT3DSURFACE9 pSurf = NULL;
D3DSURFACE_DESC Desc;
m_pd3dDevice->GetDeviceCaps( &Caps );
m_pd3dDevice->GetDisplayMode( 0, &Mode );
- if( SUCCEEDED( m_pd3dDevice->GetRenderTarget( 0, &pSurf ) ) ) {
+ if ( SUCCEEDED( m_pd3dDevice->GetRenderTarget( 0, &pSurf ) ) ) {
pSurf->GetDesc( &Desc );
- if( FAILED( pd3d9->CheckDeviceFormat( Caps.AdapterOrdinal, Caps.DeviceType, Mode.Format,
- D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE,
- Desc.Format ) ) ) {
+ if ( FAILED( pd3d9->CheckDeviceFormat( Caps.AdapterOrdinal, Caps.DeviceType, Mode.Format,
+ D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE,
+ Desc.Format ) ) ) {
bSupportsAlphaBlend = false;
}
SAFE_RELEASE( pSurf );
@@ -390,7 +390,7 @@ HRESULT CD3DFont::RestoreDeviceObjects()
}
// Create the state blocks for rendering text
- for( UINT which=0; which<2; which++ ) {
+ for ( UINT which=0; which<2; which++ ) {
m_pd3dDevice->BeginStateBlock();
m_pd3dDevice->SetTexture( 0, m_pTexture );
@@ -400,7 +400,7 @@ HRESULT CD3DFont::RestoreDeviceObjects()
m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
}
- if( bSupportsAlphaBlend ) {
+ if ( bSupportsAlphaBlend ) {
m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
@@ -435,7 +435,7 @@ HRESULT CD3DFont::RestoreDeviceObjects()
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
- if( which==0 ) {
+ if ( which==0 ) {
m_pd3dDevice->EndStateBlock( &m_pStateBlockSaved );
} else {
m_pd3dDevice->EndStateBlock( &m_pStateBlockDrawText );
@@ -482,7 +482,7 @@ HRESULT CD3DFont::DeleteDeviceObjects()
//-----------------------------------------------------------------------------
HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
{
- if( NULL==strText || NULL==pSize ) {
+ if ( NULL==strText || NULL==pSize ) {
return E_FAIL;
}
@@ -491,15 +491,15 @@ HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
FLOAT fWidth = 0.0f;
FLOAT fHeight = fRowHeight;
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
fRowWidth = 0.0f;
fHeight += fRowHeight;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -508,7 +508,7 @@ HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
fRowWidth += (tx2-tx1)*m_dwTexWidth - 2*m_dwSpacing;
- if( fRowWidth > fWidth ) {
+ if ( fRowWidth > fWidth ) {
fWidth = fRowWidth;
}
}
@@ -533,7 +533,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
FLOAT fXScale, FLOAT fYScale, DWORD dwColor,
const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -545,7 +545,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
@@ -555,17 +555,17 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
FLOAT fLineHeight = ( m_fTexCoords[0][3] - m_fTexCoords[0][1] ) * m_dwTexHeight;
// Center the text block in the viewport
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
const TCHAR* strTextTmp = strText;
float xFinal = 0.0f;
- while( *strTextTmp ) {
+ while ( *strTextTmp ) {
TCHAR c = *strTextTmp++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
break; // Isn't supported.
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -581,7 +581,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
x = -xFinal/vp.Width;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
y = -fLineHeight/vp.Height;
}
@@ -599,15 +599,15 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
DWORD dwNumTriangles = 0L;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
sx = fStartX;
sy += fYScale*vp.Height;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -622,7 +622,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
w *= (fXScale*vp.Height)/fLineHeight;
h *= (fYScale*vp.Height)/fLineHeight;
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx2, ty2 );
@@ -631,7 +631,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -645,7 +645,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
// Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
@@ -664,7 +664,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -676,25 +676,25 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
// Center the text block in the viewport
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
D3DVIEWPORT9 vp;
m_pd3dDevice->GetViewport( &vp );
const TCHAR* strTextTmp = strText;
float xFinal = 0.0f;
- while( *strTextTmp ) {
+ while ( *strTextTmp ) {
TCHAR c = *strTextTmp++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
break; // Isn't supported.
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -708,7 +708,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
sx = (vp.Width-xFinal)/2.0f;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
D3DVIEWPORT9 vp;
m_pd3dDevice->GetViewport( &vp );
float fLineHeight = ((m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight);
@@ -724,15 +724,15 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
DWORD dwNumTriangles = 0;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
sx = fStartX;
sy += (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -744,7 +744,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
FLOAT w = (tx2-tx1) * m_dwTexWidth / m_fTextScale;
FLOAT h = (ty2-ty1) * m_dwTexHeight / m_fTextScale;
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
@@ -753,7 +753,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -768,7 +768,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
// Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
@@ -786,7 +786,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
//-----------------------------------------------------------------------------
HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -798,7 +798,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT3DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
@@ -808,19 +808,19 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
FLOAT y = 0.0f;
// Center the text block at the origin (not the viewport)
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
SIZE sz;
GetTextExtent( strText, &sz );
x = -(((FLOAT)sz.cx)/10.0f)/2.0f;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
SIZE sz;
GetTextExtent( strText, &sz );
y = -(((FLOAT)sz.cy)/10.0f)/2.0f;
}
// Turn off culling for two-sided text
- if( dwFlags & D3DFONT_TWOSIDED ) {
+ if ( dwFlags & D3DFONT_TWOSIDED ) {
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
}
@@ -834,13 +834,13 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
DWORD dwNumTriangles = 0L;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( (c = *strText++) != 0 ) {
- if( c == '\n' ) {
+ while ( (c = *strText++) != 0 ) {
+ if ( c == '\n' ) {
x = fStartX;
y -= (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight/10.0f;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -852,7 +852,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
FLOAT w = (tx2-tx1) * m_dwTexWidth / ( 10.0f * m_fTextScale );
FLOAT h = (ty2-ty1) * m_dwTexHeight / ( 10.0f * m_fTextScale );
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+0,0), D3DXVECTOR3(0,0,-1), tx1, ty2 );
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+w,y+0,0), D3DXVECTOR3(0,0,-1), tx2, ty2 );
@@ -861,7 +861,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -875,7 +875,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
// Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
diff --git a/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp
index e9dfdddfe..752160d6e 100644
--- a/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp
@@ -34,7 +34,7 @@ using namespace DSObjects;
static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTexture, Vector dst[4], CRect src)
{
- if(!pTexture) {
+ if (!pTexture) {
return E_POINTER;
}
@@ -44,7 +44,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu
do {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(hr = pTexture->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(hr = pTexture->GetSurfaceDesc(&ddsd))) {
break;
}
@@ -62,7 +62,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu
{(float)dst[3].x, (float)dst[3].y, (float)dst[3].z, 1.0f/(float)dst[3].z, (float)src.right / w, (float)src.bottom / h},
};
- for(int i = 0; i < countof(pVertices); i++) {
+ for (int i = 0; i < countof(pVertices); i++) {
pVertices[i].x -= 0.5;
pVertices[i].y -= 0.5;
}
@@ -82,7 +82,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu
//
- if(FAILED(hr = pD3DDev->BeginScene())) {
+ if (FAILED(hr = pD3DDev->BeginScene())) {
break;
}
@@ -96,7 +96,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu
pD3DDev->SetTexture(0, NULL);
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -112,7 +112,7 @@ CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr)
: CSubPicAllocatorPresenterImpl(hWnd, hr, NULL)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
@@ -128,12 +128,12 @@ CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr)
return;
}
- if(FAILED(hr = pDirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL))
+ if (FAILED(hr = pDirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL))
|| FAILED(hr = m_pDD->SetCooperativeLevel(AfxGetMainWnd()->GetSafeHwnd(), DDSCL_NORMAL))) {
return;
}
- if(!(m_pD3D = m_pDD)) {
+ if (!(m_pD3D = m_pDD)) {
hr = E_NOINTERFACE;
return;
}
@@ -153,7 +153,7 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pDD->GetDisplayMode(&ddsd)) ||
+ if (FAILED(m_pDD->GetDisplayMode(&ddsd)) ||
ddsd.ddpfPixelFormat.dwRGBBitCount <= 8) {
return DDERR_INVALIDMODE;
}
@@ -167,12 +167,12 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
INITDDSTRUCT(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL))) {
+ if (FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL))) {
return hr;
}
CComPtr<IDirectDrawClipper> pcClipper;
- if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
+ if (FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
return hr;
}
pcClipper->SetHWnd(0, m_hWnd);
@@ -185,12 +185,12 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
ddsd.ddsCaps.dwCaps = /*DDSCAPS_OFFSCREENPLAIN |*/ DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
ddsd.dwWidth = m_ScreenSize.cx;
ddsd.dwHeight = m_ScreenSize.cy;
- if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL))) {
+ if (FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL))) {
return hr;
}
pcClipper = NULL;
- if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
+ if (FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
return hr;
}
BYTE rgnDataBuffer[1024];
@@ -202,19 +202,19 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
// m_pD3DDev
- if(FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) { // this seems to fail if the desktop size is too large (width or height >2048)
+ if (FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) { // this seems to fail if the desktop size is too large (width or height >2048)
return hr;
}
//
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -248,11 +248,11 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX7SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
- if(!m_pAllocator || FAILED(hr)) {
+ if (!m_pAllocator || FAILED(hr)) {
return E_FAIL;
}
}
@@ -261,11 +261,11 @@ HRESULT CDX7AllocatorPresenter::CreateDevice()
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -294,18 +294,18 @@ HRESULT CDX7AllocatorPresenter::AllocSurfaces()
ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
ddsd.ddsCaps.dwCaps |= DDSCAPS_TEXTURE;
// ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS;
// ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
}
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
// FIXME: eh, dx9 has no problem creating a 32bpp surface under a 16bpp desktop, but dx7 fails here (textures are ok)
DDSURFACEDESC2 ddsd2;
INITDDSTRUCT(ddsd2);
- if(!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ if (!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
&& SUCCEEDED(m_pDD->GetDisplayMode(&ddsd2))
&& ddsd2.ddpfPixelFormat.dwRGBBitCount == 16) {
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
@@ -315,12 +315,12 @@ HRESULT CDX7AllocatorPresenter::AllocSurfaces()
hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
m_pVideoTexture = m_pVideoSurface;
}
@@ -356,7 +356,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll)
CAutoLock cAutoLock(this);
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pPrimary || !m_pBackBuffer || !m_pVideoSurface) {
return false;
@@ -371,7 +371,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll)
CRect rDstPri(m_WindowRect);
MapWindowRect(m_hWnd, HWND_DESKTOP, &rDstPri);
- if(fAll) {
+ if (fAll) {
// clear the backbuffer
CRect rl(0, 0, rDstVid.left, rSrcPri.bottom);
@@ -386,8 +386,8 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll)
// paint the video on the backbuffer
- if(!rDstVid.IsRectEmpty()) {
- if(m_pVideoTexture) {
+ if (!rDstVid.IsRectEmpty()) {
+ if (m_pVideoTexture) {
Vector v[4];
Transform(rDstVid, v);
hr = TextureBlt(m_pD3DDev, m_pVideoTexture, v, rSrcVid);
@@ -409,7 +409,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll)
hr = m_pPrimary->Blt(rDstPri, m_pBackBuffer, rSrcPri, DDBLT_WAIT, NULL);
- if(hr == DDERR_SURFACELOST) {
+ if (hr == DDERR_SURFACELOST) {
m_bPendingResetDevice = true;
SendResetRequest();
return false;
@@ -430,7 +430,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::ResetDevice()
{
HRESULT hr;
DeleteSurfaces();
- if(FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces())) {
//DDERR_UNSUPPORTEDMODE - 0x8876024e
TRACE("ResetDevice failed: 0x%08x\n", (LONG)hr);
m_bDeviceResetRequested = false;
@@ -455,26 +455,26 @@ STDMETHODIMP CDX7AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd))) {
return E_FAIL;
}
- if(ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32) {
+ if (ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32) {
return E_FAIL;
}
DWORD required = sizeof(BITMAPINFOHEADER) + (ddsd.dwWidth*ddsd.dwHeight*32>>3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
INITDDSTRUCT(ddsd);
- if(FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL))) {
+ if (FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL))) {
// TODO
return hr;
}
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
index 192c42406..f4c5a664b 100644
--- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
@@ -74,7 +74,7 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES
{
HINSTANCE hDll;
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -85,7 +85,7 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES
m_pD3DXCreateFont = NULL;
m_pD3DXCreateSprite = NULL;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
(FARPROC&)m_pD3DXLoadSurfaceFromMemory = GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
(FARPROC&)m_pD3DXLoadSurfaceFromSurface = GetProcAddress(hDll, "D3DXLoadSurfaceFromSurface");
(FARPROC&)m_pD3DXCreateLine = GetProcAddress(hDll, "D3DXCreateLine");
@@ -115,13 +115,13 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES
if (m_pDirect3DCreate9Ex) {
m_pDirect3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pDirect3DCreate9Ex(D3D9b_SDK_VERSION, &m_pD3DEx);
}
}
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
- if(!m_pD3D) {
+ if (!m_pD3D) {
m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
}
} else {
@@ -537,8 +537,8 @@ void CDX9AllocatorPresenter::VSyncThread()
m_DetectedRefreshTime = ThisValue;
m_DetectedRefreshTimePrim = 0;
}
- if(_isnan(m_DetectedRefreshTime)) {m_DetectedRefreshTime = 0.0;}
- if(_isnan(m_DetectedRefreshTimePrim)) {m_DetectedRefreshTimePrim = 0.0;}
+ if (_isnan(m_DetectedRefreshTime)) {m_DetectedRefreshTime = 0.0;}
+ if (_isnan(m_DetectedRefreshTimePrim)) {m_DetectedRefreshTimePrim = 0.0;}
ModerateFloat(m_DetectedRefreshTime, ThisValue, m_DetectedRefreshTimePrim, 1.5);
if (m_DetectedRefreshTime > 0.0) {
@@ -709,7 +709,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
CleanupRenderingEngine();
- if(!m_pD3D) {
+ if (!m_pD3D) {
_Error += L"Failed to create D3D9\n";
return E_UNEXPECTED;
}
@@ -792,7 +792,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
} else if (m_bForceInputHighColorResolution || m_bHighColorResolution) {
m_SurfaceType = D3DFMT_A2R10G10B10;
} else {
- if(m_nPCIVendor == PCIV_ATI)
+ if (m_nPCIVendor == PCIV_ATI)
m_SurfaceType = D3DFMT_X8R8G8B8;
else
m_SurfaceType = D3DFMT_A8R8G8B8;
@@ -808,7 +808,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
if (m_bHighColorResolution) {
pp.BackBufferFormat = D3DFMT_A2R10G10B10;
} else {
- pp.BackBufferFormat = D3DFMT_X8R8G8B8;
+ pp.BackBufferFormat = D3DFMT_X8R8G8B8;
}
pp.Windowed = false;
pp.BackBufferCount = 3;
@@ -909,7 +909,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
m_BackbufferType = pp.BackBufferFormat;
}
- while(hr == D3DERR_DEVICELOST) {
+ while (hr == D3DERR_DEVICELOST) {
TRACE("D3DERR_DEVICELOST. Trying to Reset.\n");
hr = m_pD3DDev->TestCooperativeLevel();
}
@@ -927,7 +927,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
m_pD3DDevEx->SetGPUThreadPriority(7);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"CreateDevice failed\n";
CStringW str;
str.Format(L"Error code: 0x%X\n", hr);
@@ -944,12 +944,12 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
InitRenderingEngine();
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -983,11 +983,11 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
@@ -998,13 +998,13 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -1066,7 +1066,7 @@ void CDX9AllocatorPresenter::DeleteSurfaces()
UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter)
{
- if(m_hWnd == NULL || pD3D == NULL) {
+ if (m_hWnd == NULL || pD3D == NULL) {
return D3DADAPTER_DEFAULT;
}
@@ -1074,11 +1074,11 @@ UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter)
m_nPCIVendor = 0;
CRenderersSettings& s = GetRenderersSettings();
- if(bGetAdapter && (pD3D->GetAdapterCount()>1) && (s.D3D9RenderDevice != _T(""))) {
+ if (bGetAdapter && (pD3D->GetAdapterCount()>1) && (s.D3D9RenderDevice != _T(""))) {
TCHAR strGUID[50];
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK) {
if ((::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0) && (s.D3D9RenderDevice == strGUID)) {
m_D3D9Device = adapterIdentifier.Description;
@@ -1090,14 +1090,14 @@ UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter)
}
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(hMonitor == NULL) {
+ if (hMonitor == NULL) {
return D3DADAPTER_DEFAULT;
}
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
- if(hAdpMon == hMonitor) {
- if(bGetAdapter) {
+ if (hAdpMon == hMonitor) {
+ if (bGetAdapter) {
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK) {
m_D3D9Device = adapterIdentifier.Description;
@@ -1185,7 +1185,7 @@ bool CDX9AllocatorPresenter::GetVBlank(int &_ScanLine, int &_bInVBlank, bool _bM
int ScanLine = 0;
_ScanLine = 0;
_bInVBlank = 0;
-
+
if (m_pDirectDraw) {
DWORD ScanLineGet = 0;
m_pDirectDraw->GetScanLine(&ScanLineGet);
@@ -1511,7 +1511,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
LONGLONG StartPaint = pApp->GetPerfCounter();
CAutoLock cRenderLock(&m_RenderLock);
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pVideoSurface) {
if (m_OrderedPaint) {
@@ -1569,7 +1569,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
m_pOSDTexture = NULL;
m_pOSDSurface = NULL;
if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0 && (BYTE *)m_VMR9AlphaBitmapData) {
- if( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
+ if ( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, &m_pOSDTexture, NULL)) ) {
@@ -1633,7 +1633,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
BOOL Data;
//Sleep(5);
LONGLONG FlushStartTime = pApp->GetPerfCounter();
- while(S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH )) {
+ while (S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH )) {
if (!s.m_RenderSettings.iVMRFlushGPUWait) {
break;
}
@@ -1766,7 +1766,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
if (!m_bPendingResetDevice) {
bool fResetDevice = false;
- if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
+ if (hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
TRACE("Reset Device: D3D Device Lost\n");
fResetDevice = true;
}
@@ -1795,17 +1795,17 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
}
}
- if(s.fResetDevice) {
+ if (s.fResetDevice) {
LONGLONG time = GetRenderersData()->GetPerfCounter();
if (time > m_LastAdapterCheck + 20000000) { // check every 2 sec.
m_LastAdapterCheck = time;
#ifdef _DEBUG
D3DDEVICE_CREATION_PARAMETERS Parameters;
- if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
+ if (SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
ASSERT(Parameters.AdapterOrdinal == m_CurrentAdapter);
}
#endif
- if(m_CurrentAdapter != GetAdapter(m_pD3D)) {
+ if (m_CurrentAdapter != GetAdapter(m_pD3D)) {
TRACE("Reset Device: D3D adapter changed\n");
fResetDevice = true;
}
@@ -1817,7 +1817,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
}
}
- if(fResetDevice) {
+ if (fResetDevice) {
m_bPendingResetDevice = true;
SendResetRequest();
}
@@ -1863,7 +1863,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::ResetDevice()
TRACE("ResetDevice\n");
_ASSERT(m_MainThreadId == GetCurrentThreadId());
StopWorkerThreads();
-
+
// In VMR-9 deleting the surfaces before we are told to is bad !
// Can't comment out this because CDX9AllocatorPresenter is used by EVR Custom
// Why is EVR using a presenter for DX9 anyway ?!
@@ -1876,7 +1876,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::ResetDevice()
// In VMR-9 'AllocSurfaces' call is redundant afaik because
// 'CreateDevice' calls 'm_pIVMRSurfAllocNotify->ChangeD3DDevice' which in turn calls
// 'CVMR9AllocatorPresenter::InitializeDevice' which calls 'AllocSurfaces'
- if(FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces())) {
// TODO: We should probably pause player
#ifdef _DEBUG
Error += GetWindowsErrorMessage(hr, NULL);
@@ -2209,14 +2209,14 @@ void CDX9AllocatorPresenter::DrawStats()
strText.Format(L"DirectX SDK : %d", GetRenderersData()->GetDXSdkRelease());
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
-
- if(m_D3D9Device != _T("")) {
+
+ if (m_D3D9Device != _T("")) {
strText = "Render device: " + m_D3D9Device;
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
}
- if(m_Decoder != _T("")) {
+ if (m_Decoder != _T("")) {
strText = "Decoder : " + m_Decoder;
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
@@ -2310,34 +2310,38 @@ STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
m_pVideoSurface[m_nCurSurface]->GetDesc(&desc);
DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
D3DLOCKED_RECT r;
CComPtr<IDirect3DSurface9> pSurface;
- if(m_bFullFloatingPointProcessing || m_bHalfFloatingPointProcessing || m_bHighColorResolution) {
+ if (m_bFullFloatingPointProcessing || m_bHalfFloatingPointProcessing || m_bHighColorResolution) {
CComPtr<IDirect3DSurface9> fSurface = m_pVideoSurface[m_nCurSurface];
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fSurface, NULL))
- || FAILED(hr = m_pD3DXLoadSurfaceFromSurface(fSurface, NULL, NULL, m_pVideoSurface[m_nCurSurface], NULL, NULL, D3DX_DEFAULT, 0))) return hr;
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fSurface, NULL))
+ || FAILED(hr = m_pD3DXLoadSurfaceFromSurface(fSurface, NULL, NULL, m_pVideoSurface[m_nCurSurface], NULL, NULL, D3DX_DEFAULT, 0))) return hr;
pSurface = fSurface;
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
- || FAILED(hr = m_pD3DDev->GetRenderTargetData(fSurface, pSurface))
- || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;}}
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ || FAILED(hr = m_pD3DDev->GetRenderTargetData(fSurface, pSurface))
+ || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;
+ }
+ }
else {
pSurface = m_pVideoSurface[m_nCurSurface];
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
- || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
- || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;}}
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
+ || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;
+ }
+ }
BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib;
memset(bih, 0, sizeof(BITMAPINFOHEADER));
diff --git a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp
index dd8e45cff..2cb4aa516 100644
--- a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp
+++ b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp
@@ -48,16 +48,16 @@ static void AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy)
{
double offset = 0.5;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
v[i].x -= offset;
v[i].y -= offset;
- for(int j = 0; j < max(texcoords-1, 1); j++) {
+ for (int j = 0; j < max(texcoords-1, 1); j++) {
v[i].t[j].u -= offset*dx;
v[i].t[j].v -= offset*dy;
}
- if(texcoords > 1) {
+ if (texcoords > 1) {
v[i].t[texcoords-1].u -= offset;
v[i].t[texcoords-1].v -= offset;
}
@@ -67,13 +67,13 @@ static void AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy)
template<int texcoords>
static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4], D3DTEXTUREFILTERTYPE filter)
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
DWORD FVF = 0;
- switch(texcoords) {
+ switch (texcoords) {
case 1:
FVF = D3DFVF_TEX1;
break;
@@ -113,7 +113,7 @@ static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4]
hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
@@ -134,7 +134,7 @@ static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4]
//
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
pD3DDev->SetTexture(i, NULL);
}
@@ -182,12 +182,12 @@ void CDX9RenderingEngine::CleanupRenderingEngine()
CleanupFinalPass();
POSITION pos = m_pCustomScreenSpacePixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pCustomScreenSpacePixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pCustomPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pCustomPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
@@ -215,10 +215,10 @@ HRESULT CDX9RenderingEngine::CreateVideoSurfaces()
int nTexturesNeeded = settings.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? m_nNbDXSurface : 1;
for (int i = 0; i < nTexturesNeeded; i++) {
- if(FAILED(hr = m_pD3DDev->CreateTexture(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1,
- D3DUSAGE_RENDERTARGET, m_SurfaceType,
- D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateTexture(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1,
+ D3DUSAGE_RENDERTARGET, m_SurfaceType,
+ D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
return hr;
}
@@ -361,7 +361,7 @@ HRESULT CDX9RenderingEngine::RenderVideoDrawPath(IDirect3DSurface9* pRenderTarge
long stop = clock();
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -389,7 +389,7 @@ HRESULT CDX9RenderingEngine::RenderVideoDrawPath(IDirect3DSurface9* pRenderTarge
bool first = true;
POSITION pos = m_pCustomPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CComPtr<IDirect3DSurface9> pTemporarySurface;
hr = m_pTemporaryVideoTextures[dest]->GetSurfaceLevel(0, &pTemporarySurface);
hr = m_pD3DDev->SetRenderTarget(0, pTemporarySurface);
@@ -972,44 +972,44 @@ HRESULT CDX9RenderingEngine::InitFinalPass()
m_pFinalPixelShader = NULL;
if (!m_pDitherTexture) {
- // Create the dither texture
- hr = m_pD3DDev->CreateTexture(DITHER_MATRIX_SIZE, DITHER_MATRIX_SIZE,
- 1,
- D3DUSAGE_DYNAMIC,
- D3DFMT_A16B16G16R16F,
- D3DPOOL_DEFAULT,
- &m_pDitherTexture,
- NULL);
+ // Create the dither texture
+ hr = m_pD3DDev->CreateTexture(DITHER_MATRIX_SIZE, DITHER_MATRIX_SIZE,
+ 1,
+ D3DUSAGE_DYNAMIC,
+ D3DFMT_A16B16G16R16F,
+ D3DPOOL_DEFAULT,
+ &m_pDitherTexture,
+ NULL);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
- D3DLOCKED_RECT lockedRect;
- hr = m_pDitherTexture->LockRect(0, &lockedRect, NULL, D3DLOCK_DISCARD);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ D3DLOCKED_RECT lockedRect;
+ hr = m_pDitherTexture->LockRect(0, &lockedRect, NULL, D3DLOCK_DISCARD);
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
- char* outputRowIterator = static_cast<char*>(lockedRect.pBits);
- for (int y = 0; y < DITHER_MATRIX_SIZE; y++) {
- unsigned short* outputIterator = reinterpret_cast<unsigned short*>(outputRowIterator);
- for (int x = 0; x < DITHER_MATRIX_SIZE; x++) {
- for (int i = 0; i < 4; i++) {
- *outputIterator++ = DITHER_MATRIX[y][x];
+ char* outputRowIterator = static_cast<char*>(lockedRect.pBits);
+ for (int y = 0; y < DITHER_MATRIX_SIZE; y++) {
+ unsigned short* outputIterator = reinterpret_cast<unsigned short*>(outputRowIterator);
+ for (int x = 0; x < DITHER_MATRIX_SIZE; x++) {
+ for (int i = 0; i < 4; i++) {
+ *outputIterator++ = DITHER_MATRIX[y][x];
+ }
}
- }
- outputRowIterator += lockedRect.Pitch;
- }
+ outputRowIterator += lockedRect.Pitch;
+ }
- hr = m_pDitherTexture->UnlockRect(0);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ hr = m_pDitherTexture->UnlockRect(0);
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
}
// Initialize the color management if necessary
@@ -1382,7 +1382,7 @@ HRESULT CDX9RenderingEngine::FinalPass(IDirect3DTexture9* pTexture)
{w, h, 0.5f, 2.0f, 1, 1},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1550,7 +1550,7 @@ HRESULT CDX9RenderingEngine::DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_
HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
{
- if(!pSrc || !pDst) {
+ if (!pSrc || !pDst) {
return E_POINTER;
}
@@ -1560,7 +1560,7 @@ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9*
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
+ if (FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
return E_FAIL;
}
@@ -1577,8 +1577,8 @@ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9*
{(float)dst.left, (float)dst.bottom, 0.5f, 2.0f, (float)src.left / w, (float)src.bottom / h},
{(float)dst.right, (float)dst.bottom, 0.5f, 2.0f, (float)src.right / w, (float)src.bottom / h},
};
-
- for(int i = 0; i < countof(pVertices); i++) {
+
+ for (int i = 0; i < countof(pVertices); i++) {
pVertices[i].x -= 0.5;
pVertices[i].y -= 0.5;
}
diff --git a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h
index 38ffe2a27..acdae17cb 100644
--- a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h
+++ b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h
@@ -95,7 +95,7 @@ namespace DSObjects
CStringA m_SourceTarget;
HRESULT Compile(CPixelShaderCompiler *pCompiler) {
HRESULT hr = pCompiler->CompileShader(m_SourceData, "main", m_SourceTarget, 0, &m_pPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
diff --git a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp
index da927616e..6547c513b 100644
--- a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp
@@ -37,7 +37,7 @@ CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &
: CSubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -47,7 +47,7 @@ CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &
CDXRAllocatorPresenter::~CDXRAllocatorPresenter()
{
- if(m_pSRCB) {
+ if (m_pSRCB) {
// nasty, but we have to let it know about our death somehow
((CSubRenderCallback*)(ISubRenderCallback*)m_pSRCB)->SetDXRAP(NULL);
}
@@ -73,8 +73,8 @@ STDMETHODIMP CDXRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, vo
return GetInterface((IVMRWindowlessControl*)this, ppv);
*/
- if(riid != IID_IUnknown && m_pDXR) {
- if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
+ if (riid != IID_IUnknown && m_pDXR) {
+ if (SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
return S_OK;
}
}
@@ -87,7 +87,7 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
CheckPointer(pD3DDev, E_POINTER);
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -121,11 +121,11 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
return E_FAIL;
}
}
@@ -135,11 +135,11 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(m_SubPicProvider) {
+ if (m_SubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider);
}
@@ -152,7 +152,7 @@ HRESULT CDXRAllocatorPresenter::Render(
{
__super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player
SetTime(rtStart);
- if(atpf > 0 && m_pSubPicQueue) {
+ if (atpf > 0 && m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(10000000.0 / atpf);
}
AlphaBltSubPic(CSize(width, height));
@@ -165,22 +165,22 @@ STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
CheckPointer(ppRenderer, E_POINTER);
- if(m_pDXR) {
+ if (m_pDXR) {
return E_UNEXPECTED;
}
m_pDXR.CoCreateInstance(CLSID_DXR, GetOwner());
- if(!m_pDXR) {
+ if (!m_pDXR) {
return E_FAIL;
}
CComQIPtr<ISubRender> pSR = m_pDXR;
- if(!pSR) {
+ if (!pSR) {
m_pDXR = NULL;
return E_FAIL;
}
m_pSRCB = DNew CSubRenderCallback(this);
- if(FAILED(pSR->SetCallback(m_pSRCB))) {
+ if (FAILED(pSR->SetCallback(m_pSRCB))) {
m_pDXR = NULL;
return E_FAIL;
}
@@ -198,12 +198,12 @@ STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
STDMETHODIMP_(void) CDXRAllocatorPresenter::SetPosition(RECT w, RECT v)
{
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->SetDefaultSourcePosition();
pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
}
- if(CComQIPtr<IVideoWindow> pVW = m_pDXR) {
+ if (CComQIPtr<IVideoWindow> pVW = m_pDXR) {
pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
}
}
@@ -212,12 +212,12 @@ STDMETHODIMP_(SIZE) CDXRAllocatorPresenter::GetVideoSize(bool fCorrectAR)
{
SIZE size = {0, 0};
- if(!fCorrectAR) {
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (!fCorrectAR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->GetVideoSize(&size.cx, &size.cy);
}
} else {
- if(CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
+ if (CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
}
}
@@ -233,7 +233,7 @@ STDMETHODIMP_(bool) CDXRAllocatorPresenter::Paint(bool fAll)
STDMETHODIMP CDXRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
{
HRESULT hr = E_NOTIMPL;
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
}
return hr;
diff --git a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp
index 1f126b4bc..4634b9db1 100644
--- a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp
@@ -297,18 +297,18 @@ STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
CComPtr<IMFVideoRenderer> pMFVR;
CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF;
CComQIPtr<IEVRFilterConfig> pConfig = pBF;
- if(SUCCEEDED(hr)) {
- if(FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
+ if (SUCCEEDED(hr)) {
+ if (FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
break;
}
}
hr = pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoRenderer, (void**)&pMFVR);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = QueryInterface (__uuidof(IMFVideoPresenter), (void**)&pVP);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = pMFVR->InitializeRenderer (NULL, pVP);
}
@@ -322,7 +322,7 @@ STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
m_fUseInternalTimer = false;
#endif
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
*ppRenderer = NULL;
} else {
*ppRenderer = pBF.Detach();
@@ -341,27 +341,27 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::Paint(bool fAll)
STDMETHODIMP CEVRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
HRESULT hr;
- if(riid == __uuidof(IMFClockStateSink)) {
+ if (riid == __uuidof(IMFClockStateSink)) {
hr = GetInterface((IMFClockStateSink*)this, ppv);
- } else if(riid == __uuidof(IMFVideoPresenter)) {
+ } else if (riid == __uuidof(IMFVideoPresenter)) {
hr = GetInterface((IMFVideoPresenter*)this, ppv);
- } else if(riid == __uuidof(IMFTopologyServiceLookupClient)) {
+ } else if (riid == __uuidof(IMFTopologyServiceLookupClient)) {
hr = GetInterface((IMFTopologyServiceLookupClient*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDeviceID)) {
+ } else if (riid == __uuidof(IMFVideoDeviceID)) {
hr = GetInterface((IMFVideoDeviceID*)this, ppv);
- } else if(riid == __uuidof(IMFGetService)) {
+ } else if (riid == __uuidof(IMFGetService)) {
hr = GetInterface((IMFGetService*)this, ppv);
- } else if(riid == __uuidof(IMFAsyncCallback)) {
+ } else if (riid == __uuidof(IMFAsyncCallback)) {
hr = GetInterface((IMFAsyncCallback*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDisplayControl)) {
+ } else if (riid == __uuidof(IMFVideoDisplayControl)) {
hr = GetInterface((IMFVideoDisplayControl*)this, ppv);
- } else if(riid == __uuidof(IEVRTrustedVideoPlugin)) {
+ } else if (riid == __uuidof(IEVRTrustedVideoPlugin)) {
hr = GetInterface((IEVRTrustedVideoPlugin*)this, ppv);
- } else if(riid == IID_IQualProp) {
+ } else if (riid == IID_IQualProp) {
hr = GetInterface((IQualProp*)this, ppv);
- } else if(riid == __uuidof(IMFRateSupport)) {
+ } else if (riid == __uuidof(IMFRateSupport)) {
hr = GetInterface((IMFRateSupport*)this, ppv);
- } else if(riid == __uuidof(IDirect3DDeviceManager9))
+ } else if (riid == __uuidof(IDirect3DDeviceManager9))
// hr = GetInterface((IDirect3DDeviceManager9*)this, ppv);
{
hr = m_pD3DManager->QueryInterface (__uuidof(IDirect3DDeviceManager9), (void**) ppv);
@@ -764,7 +764,7 @@ HRESULT CEVRAllocatorPresenter::CreateProposedOutputType(IMFMediaType* pMixerTyp
bool bDoneSomething = true;
- if(m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) { //if any of these is 0, it will stuck into a infinite loop
+ if (m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) { //if any of these is 0, it will stuck into a infinite loop
while (bDoneSomething) {
bDoneSomething = false;
INT MinNum = min(m_AspectRatio.cx, m_AspectRatio.cy);
@@ -924,13 +924,13 @@ HRESULT CEVRAllocatorPresenter::GetMediaTypeMerit(IMFMediaType* pType, int* pMer
break;
case FCC('AYUV'):
*pMerit = 3;
- break;
- case D3DFMT_X8R8G8B8:
- if (m_bForceInputHighColorResolution) {
+ break;
+ case D3DFMT_X8R8G8B8:
+ if (m_bForceInputHighColorResolution) {
*pMerit = 63;
- } else {
+ } else {
*pMerit = 1;
- }
+ }
break;
case D3DFMT_A8R8G8B8:// an accepted format, but fails on most surface types
case D3DFMT_A8B8G8R8:
@@ -1245,7 +1245,7 @@ STDMETHODIMP CEVRAllocatorPresenter::GetIdealVideoSize(SIZE *pszMin, SIZE *pszMa
D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
pszMax->cx = d3ddm.Width;
pszMax->cy = d3ddm.Height;
}
@@ -1439,16 +1439,16 @@ STDMETHODIMP CEVRAllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpH
// This function should be called...
ASSERT (FALSE);
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -1480,7 +1480,7 @@ STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(IMFMediaType* pMediaType)
}
if (SUCCEEDED(hr)) {
- for(int i = 0; i < m_nNbDXSurface; i++) {
+ for (int i = 0; i < m_nNbDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
@@ -1581,9 +1581,9 @@ void CEVRAllocatorPresenter::GetMixerThread()
ExtractAvgTimePerFrame (&mt, m_rtTimePerFrame);
m_bInterlaced = ExtractInterlaced(&mt);
-
+
CComPtr<IPin> pPinTo;
- if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
+ if (SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
m_Decoder = GetFilterName(GetFilterFromPin(pPinTo));
}
}
@@ -1593,7 +1593,7 @@ void CEVRAllocatorPresenter::GetMixerThread()
}
// Update internal subtitle clock
- if(m_fUseInternalTimer && m_pSubPicQueue) {
+ if (m_fUseInternalTimer && m_pSubPicQueue) {
m_fps = (float)(10000000.0 / m_rtTimePerFrame);
m_pSubPicQueue->SetFPS(m_fps);
}
@@ -1856,7 +1856,7 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::ResetDevice()
bool bResult = __super::ResetDevice();
- for(int i = 0; i < m_nNbDXSurface; i++) {
+ for (int i = 0; i < m_nNbDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
HRESULT hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
@@ -1904,7 +1904,7 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::DisplayChange()
m_bSyncStatsAvailable = false;
bool bResult = __super::DisplayChange();
-
+
return bResult;
}
@@ -2012,18 +2012,18 @@ void CEVRAllocatorPresenter::RenderThread()
m_pcFrames++;
bStepForward = true;
m_nStepCount = 0;
-/*
- } else if (m_nStepCount > 0) {
- pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
- ++m_OrderedPaint;
- if (!g_bExternalSubtitleTime) {
- __super::SetTime (g_tSegmentStart + nsSampleTime);
- }
- Paint(true);
- m_nDroppedUpdate = 0;
- CompleteFrameStep (false);
- bStepForward = true;
-*/
+ /*
+ } else if (m_nStepCount > 0) {
+ pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
+ ++m_OrderedPaint;
+ if (!g_bExternalSubtitleTime) {
+ __super::SetTime (g_tSegmentStart + nsSampleTime);
+ }
+ Paint(true);
+ m_nDroppedUpdate = 0;
+ CompleteFrameStep (false);
+ bStepForward = true;
+ */
} else if ((m_nRenderState == Started)) {
LONGLONG CurrentCounter = GetRenderersData()->GetPerfCounter();
// Calculate wake up timer
diff --git a/src/filters/renderer/VideoRenderers/IPinHook.cpp b/src/filters/renderer/VideoRenderers/IPinHook.cpp
index d982ba47a..ed671b30a 100644
--- a/src/filters/renderer/VideoRenderers/IPinHook.cpp
+++ b/src/filters/renderer/VideoRenderers/IPinHook.cpp
@@ -191,7 +191,7 @@ static HRESULT ( STDMETHODCALLTYPE *ReceiveOrg )( IMemInputPinC * This, IMediaSa
static HRESULT STDMETHODCALLTYPE ReceiveMineI(IMemInputPinC * This, IMediaSample *pSample)
{
REFERENCE_TIME rtStart, rtStop;
- if(pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop))) {
+ if (pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop))) {
g_tSampleStart = rtStart;
}
return ReceiveOrg(This, pSample);
@@ -201,7 +201,7 @@ static HRESULT STDMETHODCALLTYPE ReceiveMine(IMemInputPinC * This, IMediaSample
{
// Support ffdshow queueing.
// To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with CMainFrame::OnPlayPause.
- if(queue_ffdshow_support) {
+ if (queue_ffdshow_support) {
CAutoLock lck(&g_ffdshowReceive);
return ReceiveMineI(This,pSample);
}
@@ -236,7 +236,7 @@ void UnhookNewSegmentAndReceive()
bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
{
- if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) {
+ if (!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) {
return false;
}
@@ -250,7 +250,7 @@ bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
// Casimir666 : change sizeof(IPinC) to sizeof(IPinCVtbl) to fix crash with EVR hack on Vista!
res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), PAGE_WRITECOPY, &flOldProtect);
- if(NewSegmentOrg == NULL) {
+ if (NewSegmentOrg == NULL) {
NewSegmentOrg = pPinC->lpVtbl->NewSegment;
}
pPinC->lpVtbl->NewSegment = NewSegmentMine; // Function sets global variable(s)
@@ -258,7 +258,7 @@ bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
// Casimir666 : change sizeof(IMemInputPinC) to sizeof(IMemInputPinCVtbl) to fix crash with EVR hack on Vista!
res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), PAGE_WRITECOPY, &flOldProtect);
- if(ReceiveOrg == NULL) {
+ if (ReceiveOrg == NULL) {
ReceiveOrg = pMemInputPinC->lpVtbl->Receive;
}
pMemInputPinC->lpVtbl->Receive = ReceiveMine; // Function sets global variable(s)
@@ -301,10 +301,10 @@ static void LOG_TOFILE(LPCTSTR FileName, LPCTSTR fmt, ...)
va_list args;
va_start(args, fmt);
int nCount = _vsctprintf(fmt, args) + 1;
- if(TCHAR* buff = DNew TCHAR[nCount]) {
+ if (TCHAR* buff = DNew TCHAR[nCount]) {
FILE* f;
_vstprintf_s(buff, nCount, fmt, args);
- if(_tfopen_s(&f, FileName, _T("at")) == 0) {
+ if (_tfopen_s(&f, FileName, _T("at")) == 0) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
@@ -322,7 +322,7 @@ static void LOG(LPCTSTR fmt, ...)
TCHAR buff[3000];
FILE* f;
_vstprintf_s(buff, countof(buff), fmt, args);
- if(_tfopen_s(&f, LOG_FILE_DXVA, _T("at")) == 0) {
+ if (_tfopen_s(&f, LOG_FILE_DXVA, _T("at")) == 0) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
@@ -332,7 +332,7 @@ static void LOG(LPCTSTR fmt, ...)
}
static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n)
{
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
LOG(_T("%s[%d].dwSize = %d"), prefix, i, p[i].dwSize);
LOG(_T("%s[%d].dwFlags = %08x"), prefix, i, p[i].dwFlags);
LOG(_T("%s[%d].dwFourCC = %4.4hs"), prefix, i, &p[i].dwFourCC);
@@ -346,7 +346,7 @@ static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n)
static void LOGUDI(LPCTSTR prefix, const AMVAUncompDataInfo* p, int n)
{
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
LOG(_T("%s[%d].dwUncompWidth = %d"), prefix, i, p[i].dwUncompWidth);
LOG(_T("%s[%d].dwUncompHeight = %d"), prefix, i, p[i].dwUncompHeight);
@@ -711,7 +711,7 @@ static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(IAMVideoAccelerato
{
LOG(_T("\nGetVideoAcceleratorGUIDs"));
- if(pdwNumGuidsSupported) {
+ if (pdwNumGuidsSupported) {
LOG(_T("[in] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
}
@@ -719,11 +719,11 @@ static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(IAMVideoAccelerato
LOG(_T("hr = %08x"), hr);
- if(pdwNumGuidsSupported) {
+ if (pdwNumGuidsSupported) {
LOG(_T("[out] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
- if(pGuidsSupported) {
- for(DWORD i = 0; i < *pdwNumGuidsSupported; i++) {
+ if (pGuidsSupported) {
+ for (DWORD i = 0; i < *pdwNumGuidsSupported; i++) {
LOG(_T("[out] pGuidsSupported[%d] = %s"), i, CStringFromGUID(pGuidsSupported[i]));
}
}
@@ -736,11 +736,11 @@ static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(IAMVideoAccelerat
{
LOG(_T("\nGetUncompFormatsSupported"));
- if(pGuid) {
+ if (pGuid) {
LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
}
- if(pdwNumFormatsSupported) {
+ if (pdwNumFormatsSupported) {
LOG(_T("[in] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
}
@@ -748,10 +748,10 @@ static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(IAMVideoAccelerat
LOG(_T("hr = %08x"), hr);
- if(pdwNumFormatsSupported) {
+ if (pdwNumFormatsSupported) {
LOG(_T("[out] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
- if(pFormatsSupported) {
+ if (pFormatsSupported) {
LOGPF(_T("[out] pFormatsSupported"), pFormatsSupported, *pdwNumFormatsSupported);
}
}
@@ -775,14 +775,14 @@ static HRESULT STDMETHODCALLTYPE GetCompBufferInfoMine(IAMVideoAcceleratorC * Th
{
LOG(_T("\nGetCompBufferInfo"));
- if(pGuid) {
+ if (pGuid) {
g_guidDXVADecoder = *pGuid;
g_nDXVAVersion = 1;
#ifdef _DEBUG
LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
- if(pdwNumTypesCompBuffers) {
+ if (pdwNumTypesCompBuffers) {
LOG(_T("[in] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
}
#endif
@@ -820,14 +820,14 @@ static HRESULT STDMETHODCALLTYPE BeginFrameMine(IAMVideoAcceleratorC * This, con
{
LOG(_T("\nBeginFrame"));
- if(amvaBeginFrameInfo) {
+ if (amvaBeginFrameInfo) {
LOG(_T("[in] amvaBeginFrameInfo->dwDestSurfaceIndex = %08x"), amvaBeginFrameInfo->dwDestSurfaceIndex);
LOG(_T("[in] amvaBeginFrameInfo->pInputData = %08x"), amvaBeginFrameInfo->pInputData);
LOG(_T("[in] amvaBeginFrameInfo->dwSizeInputData = %08x"), amvaBeginFrameInfo->dwSizeInputData);
LOG(_T("[in] amvaBeginFrameInfo->pOutputData = %08x"), amvaBeginFrameInfo->pOutputData);
LOG(_T("[in] amvaBeginFrameInfo->dwSizeOutputData = %08x"), amvaBeginFrameInfo->dwSizeOutputData);
}
- if(amvaBeginFrameInfo && (amvaBeginFrameInfo->dwSizeInputData == 4)) {
+ if (amvaBeginFrameInfo && (amvaBeginFrameInfo->dwSizeInputData == 4)) {
LOG(_T("[in] amvaBeginFrameInfo->pInputData => dwDestSurfaceIndex = %ld "),
((DWORD*)amvaBeginFrameInfo->pInputData)[0]);
}
@@ -844,7 +844,7 @@ static HRESULT STDMETHODCALLTYPE EndFrameMine(IAMVideoAcceleratorC * This, const
{
LOG(_T("\nEndFrame"));
- if(pEndFrameInfo) {
+ if (pEndFrameInfo) {
LOG(_T("[in] pEndFrameInfo->dwSizeMiscData = %08x"), pEndFrameInfo->dwSizeMiscData);
LOG(_T("[in] pEndFrameInfo->pMiscData = %08x"), pEndFrameInfo->pMiscData);
@@ -904,7 +904,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d
#ifdef _DEBUG
LOG(_T("\nExecute"));
LOG(_T("[in] dwFunction = %08x"), dwFunction);
- if(lpPrivateInputData) {
+ if (lpPrivateInputData) {
if (dwFunction == 0x01000000) {
DXVA_BufferDescription* pBuffDesc = (DXVA_BufferDescription*)lpPrivateInputData;
@@ -951,7 +951,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d
LOG(_T("[in] lpPrivateOutputData = %08x"), lpPrivateOutputData);
LOG(_T("[in] cbPrivateOutputData = %08x"), cbPrivateOutputData);
LOG(_T("[in] dwNumBuffers = %08x"), dwNumBuffers);
- if(pamvaBufferInfo) {
+ if (pamvaBufferInfo) {
for (DWORD i=0; i<dwNumBuffers; i++) {
LOG(_T("[in] pamvaBufferInfo, buffer description %d"), i);
LOG(_T("[in] pamvaBufferInfo->dwTypeIndex = %08x"), pamvaBufferInfo[i].dwTypeIndex);
@@ -1000,7 +1000,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d
LOG(_T("hr = %08x"), hr);
- if(lpPrivateOutputData && (dwFunction == 0x01000000)) {
+ if (lpPrivateOutputData && (dwFunction == 0x01000000)) {
LOG(_T("[out] *lpPrivateOutputData : Result = %08x"), ((DWORD*)lpPrivateOutputData)[0]);
}
@@ -1038,42 +1038,42 @@ void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC)
res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_WRITECOPY, &flOldProtect);
#ifdef _DEBUG
- if(GetVideoAcceleratorGUIDsOrg == NULL) {
+ if (GetVideoAcceleratorGUIDsOrg == NULL) {
GetVideoAcceleratorGUIDsOrg = pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs;
}
- if(GetUncompFormatsSupportedOrg == NULL) {
+ if (GetUncompFormatsSupportedOrg == NULL) {
GetUncompFormatsSupportedOrg = pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported;
}
- if(GetInternalMemInfoOrg == NULL) {
+ if (GetInternalMemInfoOrg == NULL) {
GetInternalMemInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo;
}
#endif
- if(GetCompBufferInfoOrg == NULL) {
+ if (GetCompBufferInfoOrg == NULL) {
GetCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo;
}
#ifdef _DEBUG
- if(GetInternalCompBufferInfoOrg == NULL) {
+ if (GetInternalCompBufferInfoOrg == NULL) {
GetInternalCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo;
}
- if(BeginFrameOrg == NULL) {
+ if (BeginFrameOrg == NULL) {
BeginFrameOrg = pAMVideoAcceleratorC->lpVtbl->BeginFrame;
}
- if(EndFrameOrg == NULL) {
+ if (EndFrameOrg == NULL) {
EndFrameOrg = pAMVideoAcceleratorC->lpVtbl->EndFrame;
}
- if(GetBufferOrg == NULL) {
+ if (GetBufferOrg == NULL) {
GetBufferOrg = pAMVideoAcceleratorC->lpVtbl->GetBuffer;
}
- if(ReleaseBufferOrg == NULL) {
+ if (ReleaseBufferOrg == NULL) {
ReleaseBufferOrg = pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer;
}
- if(ExecuteOrg == NULL) {
+ if (ExecuteOrg == NULL) {
ExecuteOrg = pAMVideoAcceleratorC->lpVtbl->Execute;
}
- if(QueryRenderStatusOrg == NULL) {
+ if (QueryRenderStatusOrg == NULL) {
QueryRenderStatusOrg = pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus;
}
- if(DisplayFrameOrg == NULL) {
+ if (DisplayFrameOrg == NULL) {
DisplayFrameOrg = pAMVideoAcceleratorC->lpVtbl->DisplayFrame;
}
@@ -1143,7 +1143,7 @@ public :
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
- if(riid == __uuidof(IDirectXVideoDecoder)) {
+ if (riid == __uuidof(IDirectXVideoDecoder)) {
return GetInterface((IDirectXVideoDecoder*)this, ppv);
} else {
return __super::NonDelegatingQueryInterface(riid, ppv);
diff --git a/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp b/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp
index 4fd82c1f4..9dd33c1e7 100644
--- a/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp
+++ b/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp
@@ -45,10 +45,10 @@ void CMacrovisionKicker::SetInner(IUnknown* pUnk)
STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- if(riid == __uuidof(IUnknown)) {
+ if (riid == __uuidof(IUnknown)) {
return __super::NonDelegatingQueryInterface(riid, ppv);
}
- if(riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner)) {
+ if (riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner)) {
return GetInterface((IKsPropertySet*)this, ppv);
}
@@ -61,8 +61,8 @@ STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void**
STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
- if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
/*&& DataLength == 4 && *(DWORD*)pPropertyData*/) {
TRACE(_T("Oops, no-no-no, no macrovision please\n"));
return S_OK;
@@ -76,7 +76,7 @@ STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstance
STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
}
@@ -85,7 +85,7 @@ STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstance
STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
}
diff --git a/src/filters/renderer/VideoRenderers/OuterEVR.h b/src/filters/renderer/VideoRenderers/OuterEVR.h
index ac941c75e..de8897aea 100644
--- a/src/filters/renderer/VideoRenderers/OuterEVR.h
+++ b/src/filters/renderer/VideoRenderers/OuterEVR.h
@@ -48,7 +48,7 @@ namespace DSObjects
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
HRESULT hr;
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
if (riid == __uuidof(IMediaFilter)) {
@@ -62,8 +62,8 @@ namespace DSObjects
}
hr = m_pEVR ? m_pEVR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pEVR && FAILED(hr)) {
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (m_pEVR && FAILED(hr)) {
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
}
diff --git a/src/filters/renderer/VideoRenderers/OuterVMR.cpp b/src/filters/renderer/VideoRenderers/OuterVMR.cpp
index a243cccf1..34e88f5a3 100644
--- a/src/filters/renderer/VideoRenderers/OuterVMR.cpp
+++ b/src/filters/renderer/VideoRenderers/OuterVMR.cpp
@@ -28,7 +28,7 @@
using namespace DSObjects;
STDMETHODIMP COuterVMR9::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
return pWC9->GetNativeVideoSize(lpWidth, lpHeight, lpARWidth, lpARHeight);
}
@@ -36,7 +36,7 @@ STDMETHODIMP COuterVMR9::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG*
}
STDMETHODIMP COuterVMR9::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
return pWC9->GetVideoPosition(lpSRCRect, lpDSTRect);
}
@@ -44,7 +44,7 @@ STDMETHODIMP COuterVMR9::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) {
}
STDMETHODIMP COuterVMR9::GetAspectRatioMode(DWORD* lpAspectRatioMode) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
*lpAspectRatioMode = VMR_ARMODE_NONE;
return S_OK;
}
@@ -54,7 +54,7 @@ STDMETHODIMP COuterVMR9::GetAspectRatioMode(DWORD* lpAspectRatioMode) {
// IVideoWindow
STDMETHODIMP COuterVMR9::get_Width(long* pWidth) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pWidth = d.Width();
@@ -65,7 +65,7 @@ STDMETHODIMP COuterVMR9::get_Width(long* pWidth) {
}
STDMETHODIMP COuterVMR9::get_Height(long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pHeight = d.Height();
@@ -98,7 +98,7 @@ STDMETHODIMP COuterVMR9::GetSourcePosition(long* pLeft, long* pTop, long* pWidth
}
STDMETHODIMP COuterVMR9::GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pLeft = d.left;
@@ -112,7 +112,7 @@ STDMETHODIMP COuterVMR9::GetDestinationPosition(long* pLeft, long* pTop, long* p
}
STDMETHODIMP COuterVMR9::GetVideoSize(long* pWidth, long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
LONG aw, ah;
// return pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah);
// DVD Nav. bug workaround fix
@@ -125,7 +125,7 @@ STDMETHODIMP COuterVMR9::GetVideoSize(long* pWidth, long* pHeight) {
}
STDMETHODIMP COuterVMR9::GetPreferredAspectRatio(long* plAspectX, long* plAspectY) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
LONG w, h;
return pWC9->GetNativeVideoSize(&w, &h, plAspectX, plAspectY);
}
diff --git a/src/filters/renderer/VideoRenderers/OuterVMR.h b/src/filters/renderer/VideoRenderers/OuterVMR.h
index ec7650f65..567d45c9d 100644
--- a/src/filters/renderer/VideoRenderers/OuterVMR.h
+++ b/src/filters/renderer/VideoRenderers/OuterVMR.h
@@ -53,22 +53,22 @@ namespace DSObjects
HRESULT hr;
// Casimir666 : in renderless mode, do the inlaying in place of VMR
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
hr = m_pVMR ? m_pVMR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pVMR && FAILED(hr)) {
- if(riid == __uuidof(IVideoWindow)) {
+ if (m_pVMR && FAILED(hr)) {
+ if (riid == __uuidof(IVideoWindow)) {
return GetInterface((IVideoWindow*)this, ppv);
}
- if(riid == __uuidof(IBasicVideo)) {
+ if (riid == __uuidof(IBasicVideo)) {
return GetInterface((IBasicVideo*)this, ppv);
}
- if(riid == __uuidof(IBasicVideo2)) {
+ if (riid == __uuidof(IBasicVideo2)) {
return GetInterface((IBasicVideo2*)this, ppv);
}
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
/* if(riid == __uuidof(IVMRWindowlessControl))
diff --git a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
index 75342cde5..fff93a356 100644
--- a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
+++ b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
@@ -35,15 +35,15 @@ CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStay
HINSTANCE hDll;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
m_pD3DXCompileShader = (D3DXCompileShaderPtr)GetProcAddress(hDll, "D3DXCompileShader");
m_pD3DXDisassembleShader = (D3DXDisassembleShaderPtr)GetProcAddress(hDll, "D3DXDisassembleShader");
}
- if(!fStaySilent) {
- if(!hDll) {
+ if (!fStaySilent) {
+ if (!hDll) {
AfxMessageBox(ResStr(IDS_PIXELSHADERCOMPILER_0), MB_OK);
- } else if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
+ } else if (!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
AfxMessageBox(ResStr(IDS_PIXELSHADERCOMPILER_1), MB_OK);
}
}
@@ -62,7 +62,7 @@ HRESULT CPixelShaderCompiler::CompileShader(
CString* disasm,
CString* errmsg)
{
- if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
+ if (!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
return E_FAIL;
}
@@ -71,11 +71,11 @@ HRESULT CPixelShaderCompiler::CompileShader(
CComPtr<ID3DXBuffer> pShader, pDisAsm, pErrorMsgs;
hr = m_pD3DXCompileShader(pSrcData, strlen(pSrcData), NULL, NULL, pFunctionName, pProfile, Flags, &pShader, &pErrorMsgs, NULL);
- if(FAILED(hr)) {
- if(errmsg) {
+ if (FAILED(hr)) {
+ if (errmsg) {
CStringA msg = "Unexpected compiler error";
- if(pErrorMsgs) {
+ if (pErrorMsgs) {
int len = pErrorMsgs->GetBufferSize();
memcpy(msg.GetBufferSetLength(len), pErrorMsgs->GetBufferPointer(), len);
}
@@ -86,19 +86,19 @@ HRESULT CPixelShaderCompiler::CompileShader(
return hr;
}
- if(ppPixelShader) {
- if(!m_pD3DDev) {
+ if (ppPixelShader) {
+ if (!m_pD3DDev) {
return E_FAIL;
}
hr = m_pD3DDev->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), ppPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(disasm) {
+ if (disasm) {
hr = m_pD3DXDisassembleShader((DWORD*)pShader->GetBufferPointer(), FALSE, NULL, &pDisAsm);
- if(SUCCEEDED(hr) && pDisAsm) {
+ if (SUCCEEDED(hr) && pDisAsm) {
*disasm = CStringA((const char*)pDisAsm->GetBufferPointer());
}
}
diff --git a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp
index de1099997..5d2d1fb1b 100644
--- a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp
@@ -65,7 +65,7 @@ HRESULT CQT7AllocatorPresenter::AllocSurfaces()
ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return E_FAIL;
}
@@ -97,7 +97,7 @@ STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm)
m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
HRESULT hr;
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
@@ -106,7 +106,7 @@ STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm)
STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -114,7 +114,7 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd))) {
return E_FAIL;
}
@@ -122,9 +122,9 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
UINT h = abs(bm.bmHeight);
int bpp = bm.bmBitsPixel;
- if((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight) {
+ if ((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromRGBToRGB(
w, h,
(BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount,
@@ -134,14 +134,14 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
}
}
- if(!fOk) {
+ if (!fOk) {
DDBLTFX fx;
INITDDSTRUCT(fx);
fx.dwFillColor = 0;
m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
diff --git a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp
index ff6fe0f8f..3004a7600 100644
--- a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp
@@ -49,9 +49,9 @@ HRESULT CQT9AllocatorPresenter::AllocSurfaces()
m_pVideoSurfaceOff = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
return hr;
}
@@ -73,7 +73,7 @@ STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm)
CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return S_OK;
@@ -81,7 +81,7 @@ STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm)
STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -89,7 +89,7 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
return E_FAIL;
}
@@ -100,9 +100,9 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
- if((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height) {
+ if ((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0))) {
BitBltFromRGBToRGB(
w, h,
(BYTE*)r.pBits, r.Pitch, dbpp,
@@ -112,11 +112,11 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
}
}
- if(!fOk) {
+ if (!fOk) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this color format is not supported"));
diff --git a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp
index 6833d6510..509161ce5 100644
--- a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp
@@ -68,7 +68,7 @@ HRESULT CRM7AllocatorPresenter::AllocSurfaces()
ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return E_FAIL;
}
@@ -88,11 +88,11 @@ HRESULT CRM7AllocatorPresenter::AllocSurfaces()
hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceYUY2, NULL);
- if(FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL))) {
+ if (FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL))) {
m_pVideoSurfaceYUY2 = NULL;
}
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(fx);
fx.dwFillColor = 0x80108010;
m_pVideoSurfaceYUY2->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
@@ -115,7 +115,7 @@ void CRM7AllocatorPresenter::DeleteSurfaces()
STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -123,13 +123,13 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
bool fYUY2 = false;
CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
- if(src.Width() > dst.Width() || src.Height() > dst.Height()) {
+ if (src.Width() > dst.Width() || src.Height() > dst.Height()) {
return E_FAIL;
}
DDSURFACEDESC2 ddsd;
- if(pBitmapInfo->biCompression == '024I') {
+ if (pBitmapInfo->biCompression == '024I') {
DWORD pitch = pBitmapInfo->biWidth;
DWORD size = pitch*abs(pBitmapInfo->biHeight);
@@ -137,22 +137,22 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, y, u, v, pitch);
m_pVideoSurfaceYUY2->Unlock(src2);
fYUY2 = true;
}
} else {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, y, u, v, pitch);
m_pVideoSurfaceOff->Unlock(src2);
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == '2YUY') {
+ } else if (pBitmapInfo->biCompression == '2YUY') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*2;
@@ -161,23 +161,23 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, yvyu, pitch);
m_pVideoSurfaceYUY2->Unlock(src2);
fYUY2 = true;
}
} else {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, yvyu, pitch);
m_pVideoSurfaceOff->Unlock(src2);
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
- || pBitmapInfo->biCompression == 'BGRA') {
+ } else if (pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
@@ -187,9 +187,9 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BYTE* lpSurface = (BYTE*)ddsd.lpSurface;
- if(pBitmapInfo->biHeight > 0) {
+ if (pBitmapInfo->biHeight > 0) {
lpSurface += ddsd.lPitch*(src.Height()-1);
ddsd.lPitch = -ddsd.lPitch;
}
@@ -199,14 +199,14 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
}
}
- if(!fRGB && !fYUY2) {
+ if (!fRGB && !fYUY2) {
DDBLTFX fx;
INITDDSTRUCT(fx);
fx.dwFillColor = 0;
m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
@@ -223,10 +223,10 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
HRESULT hr;
- if(fRGB) {
+ if (fRGB) {
hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceOff, src2, DDBLT_WAIT, NULL);
}
- if(fYUY2) {
+ if (fYUY2) {
hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceYUY2, src2, DDBLT_WAIT, NULL);
}
@@ -240,7 +240,7 @@ STDMETHODIMP CRM7AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBit
CAutoLock cAutoLock(this);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return PNR_NOTIMPL;
diff --git a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp
index eb344cdc5..5eacf168a 100644
--- a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp
@@ -53,21 +53,21 @@ HRESULT CRM9AllocatorPresenter::AllocSurfaces()
HRESULT hr;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
return hr;
}
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL))) {
m_pVideoSurfaceYUY2 = NULL;
}
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0x80108010);
}
@@ -87,7 +87,7 @@ void CRM9AllocatorPresenter::DeleteSurfaces()
STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -95,13 +95,13 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
bool fYUY2 = false;
CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
- if(src.Width() > dst.Width() || src.Height() > dst.Height()) {
+ if (src.Width() > dst.Width() || src.Height() > dst.Height()) {
return E_FAIL;
}
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
return E_FAIL;
}
@@ -109,7 +109,7 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
- if(pBitmapInfo->biCompression == '024I') {
+ if (pBitmapInfo->biCompression == '024I') {
DWORD pitch = pBitmapInfo->biWidth;
DWORD size = pitch*abs(pBitmapInfo->biHeight);
@@ -117,22 +117,22 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, y, u, v, pitch);
m_pVideoSurfaceYUY2->UnlockRect();
fYUY2 = true;
}
} else {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, y, u, v, pitch);
m_pVideoSurfaceOff->UnlockRect();
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == '2YUY') {
+ } else if (pBitmapInfo->biCompression == '2YUY') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*2;
@@ -141,23 +141,23 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, yvyu, pitch);
m_pVideoSurfaceYUY2->UnlockRect();
fYUY2 = true;
}
} else {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, yvyu, pitch);
m_pVideoSurfaceOff->UnlockRect();
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
- || pBitmapInfo->biCompression == 'BGRA') {
+ } else if (pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
@@ -167,9 +167,9 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BYTE* pBits = (BYTE*)r.pBits;
- if(pBitmapInfo->biHeight > 0) {
+ if (pBitmapInfo->biHeight > 0) {
pBits += r.Pitch*(src.Height()-1);
r.Pitch = -r.Pitch;
}
@@ -179,11 +179,11 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
}
}
- if(!fRGB && !fYUY2) {
+ if (!fRGB && !fYUY2) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
@@ -199,10 +199,10 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader*
HRESULT hr;
- if(fRGB) {
+ if (fRGB) {
hr = m_pD3DDev->StretchRect(m_pVideoSurfaceOff, src2, m_pVideoSurface[m_nCurSurface], dst, D3DTEXF_NONE);
}
- if(fYUY2) {
+ if (fYUY2) {
hr = m_pD3DDev->StretchRect(m_pVideoSurfaceYUY2, src2, m_pVideoSurface[m_nCurSurface], dst, D3DTEXF_NONE);
}
@@ -217,7 +217,7 @@ STDMETHODIMP CRM9AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBit
CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return PNR_NOTIMPL;
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp
index 6d6d35f00..03bdafaf4 100644
--- a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp
+++ b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp
@@ -94,7 +94,7 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error):
m_llEstVBlankTime(0),
m_CurrentAdapter(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -105,7 +105,7 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error):
m_pD3DXCreateFont = NULL;
m_pD3DXCreateSprite = NULL;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
(FARPROC &)m_pD3DXLoadSurfaceFromMemory = GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
(FARPROC &)m_pD3DXCreateLine = GetProcAddress(hDll, "D3DXCreateLine");
(FARPROC &)m_pD3DXCreateFont = GetProcAddress(hDll, "D3DXCreateFontW");
@@ -135,16 +135,16 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error):
if (m_pDirect3DCreate9Ex) {
DEBUG_ONLY(_tprintf(_T("m_pDirect3DCreate9Ex\n")));
m_pDirect3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pDirect3DCreate9Ex(D3D9b_SDK_VERSION, &m_pD3DEx);
}
}
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
- if(!m_pD3D) {
+ if (!m_pD3D) {
m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
}
- if(m_pD3D) {
+ if (m_pD3D) {
DEBUG_ONLY(_tprintf(_T("m_pDirect3DCreate9\n")));
}
} else {
@@ -205,16 +205,16 @@ void CBaseAP::AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy)
{
double offset = 0.5;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
v[i].x -= offset;
v[i].y -= offset;
- for(int j = 0; j < max(texcoords-1, 1); j++) {
+ for (int j = 0; j < max(texcoords-1, 1); j++) {
v[i].t[j].u -= offset*dx;
v[i].t[j].v -= offset*dy;
}
- if(texcoords > 1) {
+ if (texcoords > 1) {
v[i].t[texcoords-1].u -= offset;
v[i].t[texcoords-1].v -= offset;
}
@@ -224,12 +224,12 @@ void CBaseAP::AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy)
template<int texcoords>
HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4], D3DTEXTUREFILTERTYPE filter = D3DTEXF_LINEAR)
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
DWORD FVF = 0;
- switch(texcoords) {
+ switch (texcoords) {
case 1:
FVF = D3DFVF_TEX1;
break;
@@ -268,7 +268,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[
hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
@@ -284,7 +284,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[
v[3] = tmp;
hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
pD3DDev->SetTexture(i, NULL);
}
@@ -293,7 +293,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[
HRESULT CBaseAP::DrawRectBase(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<0> v[4])
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
@@ -401,17 +401,17 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
m_pResizerPixelShader[3] = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
- if(!m_pD3D) {
+ if (!m_pD3D) {
_Error += L"Failed to create Direct3D device\n";
return E_UNEXPECTED;
}
@@ -419,7 +419,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
m_CurrentAdapter = GetAdapter(m_pD3D);
- if(FAILED(m_pD3D->GetAdapterDisplayMode(m_CurrentAdapter, &d3ddm))) {
+ if (FAILED(m_pD3D->GetAdapterDisplayMode(m_CurrentAdapter, &d3ddm))) {
_Error += L"Can not retrieve display mode data\n";
return E_UNEXPECTED;
}
@@ -454,7 +454,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
pp.Flags = D3DPRESENTFLAG_VIDEO;
m_bHighColorResolution = s.m_RenderSettings.iEVRHighColorResolution;
if (m_bHighColorResolution) {
- if(FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
+ if (FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
m_strStatsMsg[MSG_ERROR].Format (L"10 bit RGB is not supported by this graphics device in this resolution.");
m_bHighColorResolution = false;
}
@@ -509,7 +509,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
m_DisplayType = d3ddm.Format;
m_bHighColorResolution = s.m_RenderSettings.iEVRHighColorResolution;
if (m_bHighColorResolution) {
- if(FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
+ if (FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
m_strStatsMsg[MSG_ERROR].Format (L"10 bit RGB is not supported by this graphics device in this resolution.");
m_bHighColorResolution = false;
}
@@ -546,7 +546,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
}
}
- while(hr == D3DERR_DEVICELOST) {
+ while (hr == D3DERR_DEVICELOST) {
TRACE("D3DERR_DEVICELOST. Trying to Reset.\n");
hr = m_pD3DDev->TestCooperativeLevel();
}
@@ -565,14 +565,14 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
m_pPSC.Attach(DNew CPixelShaderCompiler(m_pD3DDev, true));
m_filter = D3DTEXF_NONE;
- if(m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR && m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR) {
+ if (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR && m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR) {
m_filter = D3DTEXF_LINEAR;
}
m_bicubicA = 0;
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -606,11 +606,11 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
}
@@ -619,7 +619,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
hr = S_OK;
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
DEBUG_ONLY(_tprintf(_T("m_pSubPicQueue != NULL\n")));
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
@@ -628,12 +628,12 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error)
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -715,19 +715,19 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
m_pResizerPixelShader[3] = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
_Error += L"Can not retrieve display mode data\n";
return E_UNEXPECTED;
}
@@ -755,7 +755,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
} else {
pp.BackBufferFormat = d3ddm.Format;
}
- if(FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
+ if (FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
_Error += L"10 bit RGB is not supported by this graphics device in exclusive mode fullscreen.\n";
return hr;
}
@@ -791,7 +791,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
m_BackbufferType = D3DFMT_A2R10G10B10;
pp.BackBufferFormat = D3DFMT_A2R10G10B10;
}
- if(FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
+ if (FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
_Error += L"10 bit RGB is not supported by this graphics device in windowed mode.\n";
return hr;
}
@@ -830,7 +830,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
m_pPSC.Attach(DNew CPixelShaderCompiler(m_pD3DDev, true));
m_filter = D3DTEXF_NONE;
- if((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR)
+ if ((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR)
&& (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR)) {
m_filter = D3DTEXF_LINEAR;
}
@@ -838,11 +838,11 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
m_bicubicA = 0;
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -876,11 +876,11 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
@@ -891,13 +891,13 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error)
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -928,7 +928,7 @@ HRESULT CBaseAP::AllocSurfaces(D3DFORMAT Format)
CRenderersSettings& s = GetRenderersSettings();
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
m_pVideoSurface[i] = NULL;
}
@@ -938,26 +938,26 @@ HRESULT CBaseAP::AllocSurfaces(D3DFORMAT Format)
m_SurfaceType = Format;
HRESULT hr;
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
int nTexturesNeeded = s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? m_nDXSurface+2 : 1;
- for(int i = 0; i < nTexturesNeeded; i++) {
- if(FAILED(hr = m_pD3DDev->CreateTexture(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
+ for (int i = 0; i < nTexturesNeeded; i++) {
+ if (FAILED(hr = m_pD3DDev->CreateTexture(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
return hr;
}
- if(FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i]))) {
+ if (FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i]))) {
return hr;
}
}
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D) {
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
}
}
} else {
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_pVideoSurface[m_nCurSurface], NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_pVideoSurface[m_nCurSurface], NULL))) {
return hr;
}
}
@@ -971,7 +971,7 @@ void CBaseAP::DeleteSurfaces()
CAutoLock cAutoLock(this);
CAutoLock cRenderLock(&m_allocatorLock);
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
m_pVideoSurface[i] = NULL;
}
@@ -979,18 +979,18 @@ void CBaseAP::DeleteSurfaces()
UINT CBaseAP::GetAdapter(IDirect3D9* pD3D)
{
- if(m_hWnd == NULL || pD3D == NULL) {
+ if (m_hWnd == NULL || pD3D == NULL) {
return D3DADAPTER_DEFAULT;
}
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(hMonitor == NULL) {
+ if (hMonitor == NULL) {
return D3DADAPTER_DEFAULT;
}
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
- if(hAdpMon == hMonitor) {
+ if (hAdpMon == hMonitor) {
return adp;
}
}
@@ -1008,7 +1008,7 @@ bool CBaseAP::ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d)
{
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pSurface->GetDesc(&d3dsd))) {
+ if (FAILED(pSurface->GetDesc(&d3dsd))) {
return false;
}
@@ -1016,25 +1016,25 @@ bool CBaseAP::ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d)
int sw = s.Width(), sh = s.Height();
int dw = d.Width(), dh = d.Height();
- if(d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0
+ if (d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0
|| sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) {
s.SetRectEmpty();
d.SetRectEmpty();
return true;
}
- if(d.right > w) {
+ if (d.right > w) {
s.right -= (d.right-w)*sw/dw;
d.right = w;
}
- if(d.bottom > h) {
+ if (d.bottom > h) {
s.bottom -= (d.bottom-h)*sh/dh;
d.bottom = h;
}
- if(d.left < 0) {
+ if (d.left < 0) {
s.left += (0-d.left)*sw/dw;
d.left = 0;
}
- if(d.top < 0) {
+ if (d.top < 0) {
s.top += (0-d.top)*sh/dh;
d.top = 0;
}
@@ -1089,18 +1089,18 @@ HRESULT CBaseAP::InitResizers(float bicubicA, bool bNeedScreenSizeTexture)
m_pScreenSizeTemporaryTexture[0] = NULL;
m_pScreenSizeTemporaryTexture[1] = NULL;
- for(int i = 0; i < countof(m_pResizerPixelShader); i++) {
+ for (int i = 0; i < countof(m_pResizerPixelShader); i++) {
m_pResizerPixelShader[i] = NULL;
}
- if(m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) {
+ if (m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) {
return E_FAIL;
}
LPCSTR pProfile = m_caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) ? "ps_3_0" : "ps_2_0";
CStringA str;
- if(!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE"))) {
+ if (!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE"))) {
return E_FAIL;
}
@@ -1111,28 +1111,28 @@ HRESULT CBaseAP::InitResizers(float bicubicA, bool bNeedScreenSizeTexture)
LPCSTR pEntries[] = {"main_bilinear", "main_bicubic1pass", "main_bicubic2pass_pass1", "main_bicubic2pass_pass2"};
ASSERT(countof(pEntries) == countof(m_pResizerPixelShader));
- for(int i = 0; i < countof(pEntries); i++) {
+ for (int i = 0; i < countof(pEntries); i++) {
CString ErrorMessage;
CString DissAssembly;
hr = m_pPSC->CompileShader(str, pEntries[i], pProfile, 0, &m_pResizerPixelShader[i], &DissAssembly, &ErrorMessage);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE("%ws", ErrorMessage.GetString());
ASSERT (0);
return hr;
}
}
- if(m_bicubicA || bNeedScreenSizeTexture) {
- if(FAILED(m_pD3DDev->CreateTexture(
- min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[0], NULL))) {
+ if (m_bicubicA || bNeedScreenSizeTexture) {
+ if (FAILED(m_pD3DDev->CreateTexture(
+ min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[0], NULL))) {
ASSERT(0);
m_pScreenSizeTemporaryTexture[0] = NULL; // will do 1 pass then
}
}
- if(m_bicubicA || bNeedScreenSizeTexture) {
- if(FAILED(m_pD3DDev->CreateTexture(
- min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[1], NULL))) {
+ if (m_bicubicA || bNeedScreenSizeTexture) {
+ if (FAILED(m_pD3DDev->CreateTexture(
+ min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[1], NULL))) {
ASSERT(0);
m_pScreenSizeTemporaryTexture[1] = NULL; // will do 1 pass then
}
@@ -1145,7 +1145,7 @@ HRESULT CBaseAP::TextureCopy(IDirect3DTexture9* pTexture)
HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1157,7 +1157,7 @@ HRESULT CBaseAP::TextureCopy(IDirect3DTexture9* pTexture)
{0, h, 0.5f, 2.0f, 0, 1},
{w, h, 0.5f, 2.0f, 1, 1},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1174,7 +1174,7 @@ HRESULT CBaseAP::DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_Rect)
{float(_Rect.left), float(_Rect.bottom), 0.5f, 2.0f, Color},
{float(_Rect.right), float(_Rect.bottom), 0.5f, 2.0f, Color},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1186,7 +1186,7 @@ HRESULT CBaseAP::TextureResize(IDirect3DTexture9* pTexture, Vector dst[4], D3DTE
HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1214,7 +1214,7 @@ HRESULT CBaseAP::TextureResizeBilinear(IDirect3DTexture9* pTexture, Vector dst[4
HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1247,7 +1247,7 @@ HRESULT CBaseAP::TextureResizeBicubic1pass(IDirect3DTexture9* pTexture, Vector d
HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1362,7 +1362,7 @@ HRESULT CBaseAP::TextureResizeBicubic2pass(IDirect3DTexture9* pTexture, Vector d
HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
{
- if(!pSrc || !pDst) {
+ if (!pSrc || !pDst) {
return E_POINTER;
}
@@ -1373,7 +1373,7 @@ HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
do {
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
+ if (FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
break;
}
@@ -1433,7 +1433,7 @@ HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
m_pD3DDev->SetRenderState(D3DRS_DESTBLEND, db);
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -1550,7 +1550,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
llSyncOffset = REFERENCE_TIME(10000.0 * dSyncOffset); // Reference time units (100 ns)
m_llEstVBlankTime = llCurRefTime + llSyncOffset; // Estimated time for the start of next vblank
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pVideoSurface) {
return false;
@@ -1567,18 +1567,18 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
m_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
m_pD3DDev->SetRenderTarget(0, pBackBuffer);
hr = m_pD3DDev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0);
- if(!rDstVid.IsRectEmpty()) {
- if(m_pVideoTexture[m_nCurSurface]) {
+ if (!rDstVid.IsRectEmpty()) {
+ if (m_pVideoTexture[m_nCurSurface]) {
CComPtr<IDirect3DTexture9> pVideoTexture = m_pVideoTexture[m_nCurSurface];
- if(m_pVideoTexture[m_nDXSurface] && m_pVideoTexture[m_nDXSurface+1] && !m_pPixelShaders.IsEmpty()) {
+ if (m_pVideoTexture[m_nDXSurface] && m_pVideoTexture[m_nDXSurface+1] && !m_pPixelShaders.IsEmpty()) {
static __int64 counter = 0;
static long start = clock();
long stop = clock();
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -1598,7 +1598,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
hr = m_pD3DDev->GetRenderTarget(0, &pRT);
POSITION pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
pVideoTexture = m_pVideoTexture[dst];
hr = m_pD3DDev->SetRenderTarget(0, m_pVideoSurface[dst]);
@@ -1610,7 +1610,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
TextureCopy(m_pVideoTexture[src]);
src = dst;
- if(++dst >= m_nDXSurface+2) {
+ if (++dst >= m_nDXSurface+2) {
dst = m_nDXSurface;
}
}
@@ -1626,7 +1626,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
float A = 0;
- switch(iDX9Resizer) {
+ switch (iDX9Resizer) {
case 3:
A = -0.60f;
break;
@@ -1660,13 +1660,13 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
}
}
- if(rSrcVid.Size() != rDstVid.Size()) {
- if(iDX9Resizer == 0 || iDX9Resizer == 1) {
+ if (rSrcVid.Size() != rDstVid.Size()) {
+ if (iDX9Resizer == 0 || iDX9Resizer == 1) {
D3DTEXTUREFILTERTYPE Filter = iDX9Resizer == 0 ? D3DTEXF_POINT : D3DTEXF_LINEAR;
hr = TextureResize(pVideoTexture, dst, Filter, rSrcVid);
- } else if(iDX9Resizer == 2) {
+ } else if (iDX9Resizer == 2) {
hr = TextureResizeBilinear(pVideoTexture, dst, rSrcVid);
- } else if(iDX9Resizer >= 3) {
+ } else if (iDX9Resizer >= 3) {
hr = TextureResizeBicubic2pass(pVideoTexture, dst, rSrcVid);
}
} else {
@@ -1680,7 +1680,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
long stop = clock() + 333;
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -1697,7 +1697,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
int src = 1, dst = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
if (m_pPixelShadersScreenSpace.GetTailPosition() == pos) {
m_pD3DDev->SetRenderTarget(0, pBackBuffer);
} else {
@@ -1719,7 +1719,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
hr = m_pD3DDev->SetPixelShader(NULL);
}
} else {
- if(pBackBuffer) {
+ if (pBackBuffer) {
ClipToSurface(pBackBuffer, rSrcVid, rDstVid);
// rSrcVid has to be aligned on mod2 for yuy2->rgb conversion with StretchRect
rSrcVid.left &= ~1;
@@ -1727,7 +1727,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
rSrcVid.top &= ~1;
rSrcVid.bottom &= ~1;
hr = m_pD3DDev->StretchRect(m_pVideoSurface[m_nCurSurface], rSrcVid, pBackBuffer, rDstVid, m_filter);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return false;
}
}
@@ -1740,7 +1740,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
m_pOSDTexture = NULL;
m_pOSDSurface = NULL;
if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0 && (BYTE *)m_VMR9AlphaBitmapData) {
- if( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
+ if ( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, &m_pOSDTexture, NULL)) ) {
@@ -1777,7 +1777,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL);
}
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
DEBUG_ONLY(_tprintf(_T("Device lost or something\n")));
}
// Calculate timing statistics
@@ -1832,7 +1832,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
}
bool fResetDevice = m_bPendingResetDevice;
- if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET || hr == S_PRESENT_MODE_CHANGED) {
+ if (hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET || hr == S_PRESENT_MODE_CHANGED) {
fResetDevice = true;
}
if (SettingsNeedResetDevice()) {
@@ -1851,17 +1851,17 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
}
}
- if(s.fResetDevice) {
+ if (s.fResetDevice) {
LONGLONG time = GetRenderersData()->GetPerfCounter();
if (time > m_LastAdapterCheck + 20000000) { // check every 2 sec.
m_LastAdapterCheck = time;
#ifdef _DEBUG
D3DDEVICE_CREATION_PARAMETERS Parameters;
- if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
+ if (SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
ASSERT(Parameters.AdapterOrdinal == m_CurrentAdapter);
}
#endif
- if(m_CurrentAdapter != GetAdapter(m_pD3D)) {
+ if (m_CurrentAdapter != GetAdapter(m_pD3D)) {
fResetDevice = true;
}
#ifdef _DEBUG
@@ -1872,7 +1872,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll)
}
}
- if(fResetDevice) {
+ if (fResetDevice) {
m_bPendingResetDevice = true;
SendResetRequest();
}
@@ -1892,7 +1892,7 @@ STDMETHODIMP_(bool) CBaseAP::ResetDevice()
DeleteSurfaces();
HRESULT hr;
CString Error;
- if(FAILED(hr = CreateDXDevice(Error)) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDXDevice(Error)) || FAILED(hr = AllocSurfaces())) {
m_bDeviceResetRequested = false;
return false;
}
@@ -2310,20 +2310,20 @@ STDMETHODIMP CBaseAP::GetDIB(BYTE* lpDib, DWORD* size)
m_pVideoSurface[m_nCurSurface]->GetDesc(&desc);
DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
CComPtr<IDirect3DSurface9> pSurface = m_pVideoSurface[m_nCurSurface];
D3DLOCKED_RECT r;
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
|| FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
|| FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
return hr;
@@ -2365,13 +2365,13 @@ STDMETHODIMP CBaseAP::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScr
pPixelShaders = &m_pPixelShaders;
}
- if(!pSrcData && !pTarget) {
+ if (!pSrcData && !pTarget) {
pPixelShaders->RemoveAll();
m_pD3DDev->SetPixelShader(NULL);
return S_OK;
}
- if(!pSrcData || !pTarget) {
+ if (!pSrcData || !pTarget) {
return E_INVALIDARG;
}
@@ -2382,7 +2382,7 @@ STDMETHODIMP CBaseAP::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScr
CComPtr<IDirect3DPixelShader9> pPixelShader;
HRESULT hr = Shader.Compile(m_pPSC);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -2583,18 +2583,18 @@ STDMETHODIMP CSyncAP::CreateRenderer(IUnknown** ppRenderer)
CComPtr<IMFVideoRenderer> pMFVR;
CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF;
CComQIPtr<IEVRFilterConfig> pConfig = pBF;
- if(SUCCEEDED(hr)) {
- if(FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
+ if (SUCCEEDED(hr)) {
+ if (FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
break;
}
}
hr = pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoRenderer, (void**)&pMFVR);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = QueryInterface(__uuidof(IMFVideoPresenter), (void**)&pVP);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = pMFVR->InitializeRenderer(NULL, pVP);
}
@@ -2602,7 +2602,7 @@ STDMETHODIMP CSyncAP::CreateRenderer(IUnknown** ppRenderer)
CComQIPtr<IMemInputPin> pMemInputPin = pPin;
m_bUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
*ppRenderer = NULL;
} else {
*ppRenderer = pBF.Detach();
@@ -2620,29 +2620,29 @@ STDMETHODIMP_(bool) CSyncAP::Paint(bool fAll)
STDMETHODIMP CSyncAP::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
HRESULT hr;
- if(riid == __uuidof(IMFClockStateSink)) {
+ if (riid == __uuidof(IMFClockStateSink)) {
hr = GetInterface((IMFClockStateSink*)this, ppv);
- } else if(riid == __uuidof(IMFVideoPresenter)) {
+ } else if (riid == __uuidof(IMFVideoPresenter)) {
hr = GetInterface((IMFVideoPresenter*)this, ppv);
- } else if(riid == __uuidof(IMFTopologyServiceLookupClient)) {
+ } else if (riid == __uuidof(IMFTopologyServiceLookupClient)) {
hr = GetInterface((IMFTopologyServiceLookupClient*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDeviceID)) {
+ } else if (riid == __uuidof(IMFVideoDeviceID)) {
hr = GetInterface((IMFVideoDeviceID*)this, ppv);
- } else if(riid == __uuidof(IMFGetService)) {
+ } else if (riid == __uuidof(IMFGetService)) {
hr = GetInterface((IMFGetService*)this, ppv);
- } else if(riid == __uuidof(IMFAsyncCallback)) {
+ } else if (riid == __uuidof(IMFAsyncCallback)) {
hr = GetInterface((IMFAsyncCallback*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDisplayControl)) {
+ } else if (riid == __uuidof(IMFVideoDisplayControl)) {
hr = GetInterface((IMFVideoDisplayControl*)this, ppv);
- } else if(riid == __uuidof(IEVRTrustedVideoPlugin)) {
+ } else if (riid == __uuidof(IEVRTrustedVideoPlugin)) {
hr = GetInterface((IEVRTrustedVideoPlugin*)this, ppv);
- } else if(riid == IID_IQualProp) {
+ } else if (riid == IID_IQualProp) {
hr = GetInterface((IQualProp*)this, ppv);
- } else if(riid == __uuidof(IMFRateSupport)) {
+ } else if (riid == __uuidof(IMFRateSupport)) {
hr = GetInterface((IMFRateSupport*)this, ppv);
- } else if(riid == __uuidof(IDirect3DDeviceManager9)) {
+ } else if (riid == __uuidof(IDirect3DDeviceManager9)) {
hr = m_pD3DManager->QueryInterface (__uuidof(IDirect3DDeviceManager9), (void**) ppv);
- } else if(riid == __uuidof(ISyncClockAdviser)) {
+ } else if (riid == __uuidof(ISyncClockAdviser)) {
hr = GetInterface((ISyncClockAdviser*)this, ppv);
} else {
hr = __super::NonDelegatingQueryInterface(riid, ppv);
@@ -2685,7 +2685,7 @@ STDMETHODIMP CSyncAP::OnClockSetRate(MFTIME hnsSystemTime, float flRate)
bool CSyncAP::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *State, HRESULT &_ReturnValue)
{
CAutoLock lock(&m_SampleQueueLock);
- switch(m_nRenderState) {
+ switch (m_nRenderState) {
case Started:
*State = State_Running;
break;
@@ -2953,7 +2953,7 @@ HRESULT CSyncAP::CreateProposedOutputType(IMFMediaType* pMixerType, IMFMediaType
bool bDoneSomething = true;
- if(m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) {
+ if (m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) {
while (bDoneSomething) {
bDoneSomething = false;
INT MinNum = min(m_AspectRatio.cx, m_AspectRatio.cy);
@@ -3130,7 +3130,7 @@ bool CSyncAP::GetSampleFromMixer()
UINT dwSurface;
bool newSample = false;
- while(SUCCEEDED(hr)) { // Get as many frames as there are and that we have samples for
+ while (SUCCEEDED(hr)) { // Get as many frames as there are and that we have samples for
CComPtr<IMFSample> pSample;
CComPtr<IMFSample> pNewSample;
if (FAILED(GetFreeSample(&pSample))) { // All samples are taken for the moment. Better luck next time
@@ -3268,7 +3268,7 @@ STDMETHODIMP CSyncAP::GetIdealVideoSize(SIZE *pszMin, SIZE *pszMax)
D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
pszMax->cx = d3ddm.Width;
pszMax->cy = d3ddm.Height;
}
@@ -3455,16 +3455,16 @@ STDMETHODIMP CSyncAP::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lp
// This function should be called...
ASSERT (FALSE);
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -3491,7 +3491,7 @@ STDMETHODIMP CSyncAP::InitializeDevice(AM_MEDIA_TYPE* pMediaType)
hr = AllocSurfaces(D3DFMT_X8R8G8B8);
}
- for(int i = 0; i < m_nDXSurface; i++) {
+ for (int i = 0; i < m_nDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
hr = pfMFCreateVideoSampleFromSurface(m_pVideoSurface[i], &pMFSample);
if (SUCCEEDED (hr)) {
@@ -3534,7 +3534,7 @@ void CSyncAP::MixerThread()
CAutoLock AutoLock(&m_ImageProcessingLock);
bNewSample = GetSampleFromMixer();
}
- if(m_bUseInternalTimer && m_pSubPicQueue) {
+ if (m_bUseInternalTimer && m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
}
}
@@ -3771,7 +3771,7 @@ STDMETHODIMP_(bool) CSyncAP::ResetDevice()
bool bResult = __super::ResetDevice();
- for(int i = 0; i < m_nDXSurface; i++) {
+ for (int i = 0; i < m_nDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
HRESULT hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
if (SUCCEEDED (hr)) {
@@ -3897,7 +3897,7 @@ HRESULT CSyncAP::BeginStreaming()
pEVR->QueryFilterInfo(&filterInfo); // This addref's the pGraph member
BeginEnumFilters(filterInfo.pGraph, pEF, pBF)
- if(CComQIPtr<IAMAudioRendererStats> pAS = pBF) {
+ if (CComQIPtr<IAMAudioRendererStats> pAS = pBF) {
m_pAudioStats = pAS;
};
EndEnumFilters
@@ -3925,7 +3925,7 @@ HRESULT CreateSyncRenderer(const CLSID& clsid, HWND hWnd, bool bFullscreen, ISub
*ppAP = DNew CSyncAP(hWnd, bFullscreen, hr, Error);
(*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
Error += L"\n";
Error += GetWindowsErrorMessage(hr, NULL);
MessageBox(hWnd, Error, L"Error creating EVR Sync", MB_OK | MB_ICONERROR);
@@ -4131,7 +4131,7 @@ STDMETHODIMP CSyncRenderer::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
HRESULT hr;
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
@@ -4150,8 +4150,8 @@ STDMETHODIMP CSyncRenderer::NonDelegatingQueryInterface(REFIID riid, void** ppv)
}
hr = m_pEVR ? m_pEVR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pEVR && FAILED(hr)) {
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (m_pEVR && FAILED(hr)) {
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
}
@@ -4185,11 +4185,11 @@ CGenlock::CGenlock(DOUBLE target, DOUBLE limit, INT lineD, INT colD, DOUBLE cloc
CGenlock::~CGenlock()
{
ResetTiming();
- if(syncOffsetFifo != NULL) {
+ if (syncOffsetFifo != NULL) {
delete syncOffsetFifo;
syncOffsetFifo = NULL;
}
- if(frameCycleFifo != NULL) {
+ if (frameCycleFifo != NULL) {
delete frameCycleFifo;
frameCycleFifo = NULL;
}
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.h b/src/filters/renderer/VideoRenderers/SyncRenderer.h
index d4ff8acd0..ee1e71e58 100644
--- a/src/filters/renderer/VideoRenderers/SyncRenderer.h
+++ b/src/filters/renderer/VideoRenderers/SyncRenderer.h
@@ -139,7 +139,7 @@ namespace GothSync
CStringA m_SourceTarget;
HRESULT Compile(CPixelShaderCompiler *pCompiler) {
HRESULT hr = pCompiler->CompileShader(m_SourceData, "main", m_SourceTarget, 0, &m_pPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp
index e629432bc..eeace4d7c 100644
--- a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp
@@ -42,11 +42,11 @@ CVMR7AllocatorPresenter::CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr)
: CDX7AllocatorPresenter(hWnd, hr)
, m_fUseInternalTimer(false)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
- if(FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter))) {
+ if (FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter))) {
hr = E_FAIL;
return;
}
@@ -66,13 +66,13 @@ STDMETHODIMP CVMR7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, v
HRESULT CVMR7AllocatorPresenter::CreateDevice()
{
HRESULT hr = __super::CreateDevice();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(m_pIVMRSurfAllocNotify) {
+ if (m_pIVMRSurfAllocNotify) {
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor))) {
return hr; //return false;
}
}
@@ -102,25 +102,25 @@ STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
do {
CComPtr<IBaseFilter> pBF;
- if(FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) {
+ if (FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) {
break;
}
CComQIPtr<IVMRFilterConfig> pConfig = pBF;
- if(!pConfig) {
+ if (!pConfig) {
break;
}
- if(FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) {
+ if (FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) {
break;
}
CComQIPtr<IVMRSurfaceAllocatorNotify> pSAN = pBF;
- if(!pSAN) {
+ if (!pSAN) {
break;
}
- if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
+ if (FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
|| FAILED(hr = AdviseNotify(pSAN))) {
break;
}
@@ -132,7 +132,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
*ppRenderer = (IUnknown*)pBF.Detach();
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -147,11 +147,11 @@ STDMETHODIMP_(void) CVMR7AllocatorPresenter::SetTime(REFERENCE_TIME rtNow)
STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface)
{
- if(!lpAllocInfo || !lpdwBuffer || !lplpSurface) {
+ if (!lpAllocInfo || !lpdwBuffer || !lplpSurface) {
return E_POINTER;
}
- if(!m_pIVMRSurfAllocNotify) {
+ if (!m_pIVMRSurfAllocNotify) {
return E_FAIL;
}
@@ -164,28 +164,28 @@ STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALL
// then that might stall for about 30 seconds because of some unknown buggy code
// behind <ddraw surface>->Release()
- if(lpAllocInfo->lpHdr->biBitCount < 16) {
+ if (lpAllocInfo->lpHdr->biBitCount < 16) {
return E_FAIL;
}
hr = m_pSA->AllocateSurface(dwUserID, lpAllocInfo, lpdwBuffer, lplpSurface);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
m_NativeVideoSize = CSize(abs(lpAllocInfo->lpHdr->biWidth), abs(lpAllocInfo->lpHdr->biHeight));
m_AspectRatio = m_NativeVideoSize;
int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
m_AspectRatio.SetSize(arx, ary);
}
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
// test if the colorspace is acceptable
- if(FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL))) {
+ if (FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL))) {
DeleteSurfaces();
return hr;
}
@@ -208,7 +208,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::PrepareSurface(DWORD_PTR dwUserID, IDirect
{
SetThreadName((DWORD)-1, "CVMR7AllocatorPresenter");
- if(!lpSurface) {
+ if (!lpSurface) {
return E_POINTER;
}
@@ -229,7 +229,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify* l
HRESULT hr;
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor))) {
return hr;
}
@@ -256,7 +256,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID)
STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo)
{
- if(!lpPresInfo || !lpPresInfo->lpSurf) {
+ if (!lpPresInfo || !lpPresInfo->lpSurf) {
return E_POINTER;
}
@@ -266,14 +266,14 @@ STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESEN
m_pVideoSurface->Blt(NULL, lpPresInfo->lpSurf, NULL, DDBLT_WAIT, NULL);
}
- if(lpPresInfo->rtEnd > lpPresInfo->rtStart) {
+ if (lpPresInfo->rtEnd > lpPresInfo->rtStart) {
REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart;
m_fps = 10000000.0 / rtTimePerFrame;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
- if(m_fUseInternalTimer && !g_bExternalSubtitleTime) {
+ if (m_fUseInternalTimer && !g_bExternalSubtitleTime) {
__super::SetTime(g_tSegmentStart + g_tSampleStart);
}
}
@@ -281,10 +281,10 @@ STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESEN
CSize VideoSize = m_NativeVideoSize;
int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
VideoSize.cx = VideoSize.cy*arx/ary;
}
- if(VideoSize != GetVideoSize()) {
+ if (VideoSize != GetVideoSize()) {
m_AspectRatio.SetSize(arx, ary);
AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
}
@@ -305,16 +305,16 @@ STDMETHODIMP CVMR7AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lp
CSize vs = m_NativeVideoSize, ar = m_AspectRatio;
// DVD Nav. bug workaround fix
vs.cx = vs.cy * ar.cx / ar.cy;
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = vs.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = vs.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = ar.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = ar.cy;
}
return S_OK;
@@ -346,7 +346,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT
STDMETHODIMP CVMR7AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
{
- if(lpAspectRatioMode) {
+ if (lpAspectRatioMode) {
*lpAspectRatioMode = AM_ARMODE_STRETCHED;
}
return S_OK;
@@ -384,7 +384,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::SetBorderColor(COLORREF Clr)
STDMETHODIMP CVMR7AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
{
- if(lpClr) {
+ if (lpClr) {
*lpClr = 0;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
index bbb99e9f2..0a5e1c7c4 100644
--- a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp
@@ -58,13 +58,13 @@ STDMETHODIMP CVMR9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, v
HRESULT CVMR9AllocatorPresenter::CreateDevice(CString &_Error)
{
HRESULT hr = __super::CreateDevice(_Error);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(m_pIVMRSurfAllocNotify) {
+ if (m_pIVMRSurfAllocNotify) {
HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(m_CurrentAdapter);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor))) {
_Error += L"m_pIVMRSurfAllocNotify->ChangeD3DDevice failed";
return hr; //return false;
}
@@ -105,30 +105,30 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
CComQIPtr<IMemInputPin> pMemInputPin = pPin;
m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
- if(CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
+ if (CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA);
}
CComQIPtr<IVMRFilterConfig9> pConfig = pBF;
- if(!pConfig) {
+ if (!pConfig) {
break;
}
CRenderersSettings& s = GetRenderersSettings();
- if(s.fVMR9MixerMode) {
- if(FAILED(hr = pConfig->SetNumberOfStreams(1))) {
+ if (s.fVMR9MixerMode) {
+ if (FAILED(hr = pConfig->SetNumberOfStreams(1))) {
break;
}
- if(CComQIPtr<IVMRMixerControl9> pMC = pBF) {
+ if (CComQIPtr<IVMRMixerControl9> pMC = pBF) {
DWORD dwPrefs;
pMC->GetMixingPrefs(&dwPrefs);
// See http://msdn.microsoft.com/en-us/library/dd390928(VS.85).aspx
dwPrefs |= MixerPref9_NonSquareMixing;
dwPrefs |= MixerPref9_NoDecimation;
- if(s.fVMR9MixerYUV && !IsVistaOrAbove()) {
+ if (s.fVMR9MixerYUV && !IsVistaOrAbove()) {
dwPrefs &= ~MixerPref9_RenderTargetMask;
dwPrefs |= MixerPref9_RenderTargetYUV;
}
@@ -136,16 +136,16 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
}
}
- if(FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
+ if (FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
break;
}
CComQIPtr<IVMRSurfaceAllocatorNotify9> pSAN = pBF;
- if(!pSAN) {
+ if (!pSAN) {
break;
}
- if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
+ if (FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
|| FAILED(hr = AdviseNotify(pSAN))) {
break;
}
@@ -153,7 +153,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
*ppRenderer = (IUnknown*)pBF.Detach();
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -171,17 +171,17 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
CAutoLock lock(this);
CAutoLock cRenderLock(&m_RenderLock);
- if(!lpAllocInfo || !lpNumBuffers) {
+ if (!lpAllocInfo || !lpNumBuffers) {
return E_POINTER;
}
- if(!m_pIVMRSurfAllocNotify) {
+ if (!m_pIVMRSurfAllocNotify) {
return E_FAIL;
}
// WTF: Is this some kind of forgotten debug code ?
- if((GetAsyncKeyState(VK_CONTROL)&0x80000000))
- if(lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') {
+ if ((GetAsyncKeyState(VK_CONTROL)&0x80000000))
+ if (lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') {
return E_FAIL;
}
@@ -203,12 +203,12 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
HRESULT hr;
- if(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget) {
+ if (lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget) {
lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
}
hr = m_pIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &m_pSurfaces[0]);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -219,7 +219,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
CSize VideoSize = GetVisibleVideoSize();
int arx = lpAllocInfo->szAspectRatio.cx;
int ary = lpAllocInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
arx = arx / ((float) m_NativeVideoSize.cx / VideoSize.cx);
ary = ary / ((float) m_NativeVideoSize.cy / VideoSize.cy);
m_AspectRatio.SetSize(arx, ary);
@@ -227,13 +227,13 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A
m_AspectRatio = VideoSize;
}
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
- if(!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface)) {
+ if (!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface)) {
// test if the colorspace is acceptable
- if(FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[m_nCurSurface], NULL, D3DTEXF_NONE))) {
+ if (FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[m_nCurSurface], NULL, D3DTEXF_NONE))) {
DeleteSurfaces();
return E_FAIL;
}
@@ -260,7 +260,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::TerminateDevice(DWORD_PTR dwUserID)
STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface)
{
- if(!lplpSurface) {
+ if (!lplpSurface) {
return E_POINTER;
}
@@ -271,7 +271,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa
SurfaceIndex = 0
m_pSurfaces.GetCount() = 0
- Scenario:
+ Scenario:
Thread 1:
Wait on m_RenderLock in this function
Thread 2:
@@ -279,15 +279,15 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa
(Happens by calling ex CDX9AllocatorPresenter::ResetDevice)
When thread 2 releases the lock thread 1 gets it and boom!
-
+
Possible solution: Adding object lock and moving m_RenderLock to try to fix this threading issue.
This problem occurs when moving the window from display a to display b.
-
+
NOTE: This is just a workaround.
CDX9AllocatorPresenter doesn't follow the rules which is why this happened.
And it is used by EVR custom (which it really shouldn't) so i can't easily fix it without breaking EVR custom.
*/
- if(SurfaceIndex >= m_pSurfaces.GetCount()) {
+ if (SurfaceIndex >= m_pSurfaces.GetCount()) {
return E_FAIL;
}
@@ -314,7 +314,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9*
HRESULT hr;
HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D));
- if(FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor))) {
return hr;
}
@@ -409,18 +409,18 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese
HRESULT hr;
- if(!lpPresInfo || !lpPresInfo->lpSurf) {
+ if (!lpPresInfo || !lpPresInfo->lpSurf) {
return E_POINTER;
}
CAutoLock cAutoLock(this);
CAutoLock cRenderLock(&m_RenderLock);
- if(lpPresInfo->rtEnd > lpPresInfo->rtStart) {
- if(m_pSubPicQueue) {
+ if (lpPresInfo->rtEnd > lpPresInfo->rtStart) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
- if(m_fUseInternalTimer && !g_bExternalSubtitleTime) {
+ if (m_fUseInternalTimer && !g_bExternalSubtitleTime) {
__super::SetTime(g_tSegmentStart + g_tSampleStart);
}
}
@@ -429,12 +429,12 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese
CSize VideoSize = GetVisibleVideoSize();
int arx = lpPresInfo->szAspectRatio.cx;
int ary = lpPresInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
arx = arx / ((float) m_NativeVideoSize.cx / VideoSize.cx);
ary = ary / ((float) m_NativeVideoSize.cy / VideoSize.cy);
VideoSize.cx = VideoSize.cy*arx/ary;
}
- if(VideoSize != GetVideoSize()) {
+ if (VideoSize != GetVideoSize()) {
m_AspectRatio.SetSize(arx, ary);
AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
}
@@ -443,9 +443,9 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese
CComPtr<IDirect3DTexture9> pTexture;
lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture);
- if(pTexture) {
+ if (pTexture) {
m_pVideoSurface[m_nCurSurface] = lpPresInfo->lpSurf;
- if(m_pVideoTexture[m_nCurSurface]) {
+ if (m_pVideoTexture[m_nCurSurface]) {
m_pVideoTexture[m_nCurSurface] = pTexture;
}
} else {
@@ -483,16 +483,16 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese
STDMETHODIMP CVMR9AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight)
{
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -522,7 +522,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT
STDMETHODIMP CVMR9AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
{
- if(lpAspectRatioMode) {
+ if (lpAspectRatioMode) {
*lpAspectRatioMode = AM_ARMODE_STRETCHED;
}
return S_OK;
@@ -560,7 +560,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::SetBorderColor(COLORREF Clr)
STDMETHODIMP CVMR9AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
{
- if(lpClr) {
+ if (lpClr) {
*lpClr = 0;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp
index 965289318..68b85bc75 100644
--- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp
@@ -33,8 +33,8 @@ using namespace DSObjects;
interface __declspec(uuid("D6EE8031-214E-4E9E-A3A7-458925F933AB"))
IMadVRExclusiveModeInfo :
public IUnknown {
- STDMETHOD_(BOOL, IsExclusiveModeActive)(void) = 0;
- STDMETHOD_(BOOL, IsMadVRSeekbarEnabled)(void) = 0;
+ STDMETHOD_(BOOL, IsExclusiveModeActive)(void) = 0;
+ STDMETHOD_(BOOL, IsMadVRSeekbarEnabled)(void) = 0;
};
@@ -46,7 +46,7 @@ CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CStri
: CSubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -56,7 +56,7 @@ CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CStri
CmadVRAllocatorPresenter::~CmadVRAllocatorPresenter()
{
- if(m_pSRCB) {
+ if (m_pSRCB) {
// nasty, but we have to let it know about our death somehow
((CSubRenderCallback*)(ISubRenderCallback2*)m_pSRCB)->SetDXRAP(NULL);
}
@@ -82,8 +82,8 @@ STDMETHODIMP CmadVRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid,
return GetInterface((IVMRWindowlessControl*)this, ppv);
*/
- if(riid != IID_IUnknown && m_pDXR) {
- if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
+ if (riid != IID_IUnknown && m_pDXR) {
+ if (SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
return S_OK;
}
}
@@ -102,7 +102,7 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -136,11 +136,11 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
return E_FAIL;
}
}
@@ -150,11 +150,11 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(m_SubPicProvider) {
+ if (m_SubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider);
}
@@ -167,7 +167,7 @@ HRESULT CmadVRAllocatorPresenter::Render(
{
__super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player
SetTime(rtStart);
- if(atpf > 0 && m_pSubPicQueue) {
+ if (atpf > 0 && m_pSubPicQueue) {
m_fps = (double)(10000000.0 / atpf);
m_pSubPicQueue->SetFPS(m_fps);
}
@@ -181,22 +181,22 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
CheckPointer(ppRenderer, E_POINTER);
- if(m_pDXR) {
+ if (m_pDXR) {
return E_UNEXPECTED;
}
m_pDXR.CoCreateInstance(CLSID_madVR, GetOwner());
- if(!m_pDXR) {
+ if (!m_pDXR) {
return E_FAIL;
}
CComQIPtr<ISubRender> pSR = m_pDXR;
- if(!pSR) {
+ if (!pSR) {
m_pDXR = NULL;
return E_FAIL;
}
m_pSRCB = DNew CSubRenderCallback(this);
- if(FAILED(pSR->SetCallback(m_pSRCB))) {
+ if (FAILED(pSR->SetCallback(m_pSRCB))) {
m_pDXR = NULL;
return E_FAIL;
}
@@ -214,12 +214,12 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
STDMETHODIMP_(void) CmadVRAllocatorPresenter::SetPosition(RECT w, RECT v)
{
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->SetDefaultSourcePosition();
pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
}
- if(CComQIPtr<IVideoWindow> pVW = m_pDXR) {
+ if (CComQIPtr<IVideoWindow> pVW = m_pDXR) {
pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
}
}
@@ -228,12 +228,12 @@ STDMETHODIMP_(SIZE) CmadVRAllocatorPresenter::GetVideoSize(bool fCorrectAR)
{
SIZE size = {0, 0};
- if(!fCorrectAR) {
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (!fCorrectAR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->GetVideoSize(&size.cx, &size.cy);
}
} else {
- if(CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
+ if (CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
}
}
@@ -249,7 +249,7 @@ STDMETHODIMP_(bool) CmadVRAllocatorPresenter::Paint(bool fAll)
STDMETHODIMP CmadVRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
{
HRESULT hr = E_NOTIMPL;
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
}
return hr;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h
index eb7fe682a..3d28452a3 100644
--- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h
+++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h
@@ -29,8 +29,8 @@
interface __declspec(uuid("ABA34FDA-DD22-4E00-9AB4-4ABF927D0B0C"))
IMadVRTextOsd :
public IUnknown {
- STDMETHOD(OsdDisplayMessage)(LPCWSTR text, DWORD milliseconds) = 0;
- STDMETHOD(OsdClearMessage)(void) = 0;
+ STDMETHOD(OsdDisplayMessage)(LPCWSTR text, DWORD milliseconds) = 0;
+ STDMETHOD(OsdClearMessage)(void) = 0;
};
namespace DSObjects
diff --git a/src/filters/source/BaseSource/BaseSource.cpp b/src/filters/source/BaseSource/BaseSource.cpp
index 1c26cb6ba..a2bdc6fb2 100644
--- a/src/filters/source/BaseSource/BaseSource.cpp
+++ b/src/filters/source/BaseSource/BaseSource.cpp
@@ -58,7 +58,7 @@ STDMETHODIMP CBaseStream::NonDelegatingQueryInterface(REFIID riid, void** 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
@@ -81,7 +81,7 @@ void CBaseStream::UpdateFromSeek()
HRESULT CBaseStream::SetRate(double dRate)
{
- if(dRate <= 0) {
+ if (dRate <= 0) {
return E_INVALIDARG;
}
@@ -118,7 +118,7 @@ HRESULT CBaseStream::ChangeStop()
{
{
CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop) {
+ if (m_rtPosition < m_rtStop) {
return S_OK;
}
}
@@ -146,12 +146,12 @@ 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;
}
@@ -160,7 +160,7 @@ HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
long len = pSample->GetSize();
hr = FillBuffer(pSample, nFrame, pOut, len);
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
@@ -178,7 +178,7 @@ HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
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 fea572b3c..16ef46866 100644
--- a/src/filters/source/BaseSource/BaseSource.h
+++ b/src/filters/source/BaseSource/BaseSource.h
@@ -35,7 +35,7 @@ protected:
public:
CBaseSource(TCHAR* name, LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
: CSource(name, lpunk, clsid) {
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -54,16 +54,16 @@ public:
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;
}
@@ -74,13 +74,13 @@ public:
STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) {
size_t nCount;
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
nCount = m_fn.GetLength()+1;
*ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
diff --git a/src/filters/source/D2VSource/D2VSource.cpp b/src/filters/source/D2VSource/D2VSource.cpp
index d120b744a..42229c984 100644
--- a/src/filters/source/D2VSource/D2VSource.cpp
+++ b/src/filters/source/D2VSource/D2VSource.cpp
@@ -80,7 +80,7 @@ CFilterApp theApp;
CD2VSource::CD2VSource(LPUNKNOWN lpunk, HRESULT* phr)
: CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -100,22 +100,22 @@ CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
CAutoLock cAutoLock(&m_cSharedState);
m_pDecoder.Attach(DNew CMPEG2Dec());
- if(!m_pDecoder) {
- if(phr) {
+ if (!m_pDecoder) {
+ if (phr) {
*phr = E_OUTOFMEMORY;
}
return;
}
- if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2)) {
- if(phr) {
+ 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) {
+ if (!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4)) {
+ if (phr) {
*phr = E_OUTOFMEMORY;
}
return;
@@ -124,7 +124,7 @@ CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
m_AvgTimePerFrame = 10000000000i64/m_pDecoder->VF_FrameRate;
m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_pDecoder->VF_FrameLimit;
- if(phr) {
+ if (phr) {
*phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
}
@@ -144,7 +144,7 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
HRESULT hr = NOERROR;
int w, h, bpp;
- if(!GetDim(w, h, bpp)) {
+ if (!GetDim(w, h, bpp)) {
return E_FAIL;
}
@@ -152,11 +152,11 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
pProperties->cbBuffer = w*h*bpp>>3;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -166,12 +166,12 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
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);
@@ -179,7 +179,7 @@ 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;
}
@@ -192,7 +192,7 @@ 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);
+ for (int y = 0, p = min(pitchIn, pitchOut);
y < h;
y++, pIn += pitchIn, pOut += pitchOut) {
memcpy(pOut, pIn, p);
@@ -207,10 +207,10 @@ HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -237,8 +237,8 @@ HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
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 {
return E_FAIL;
@@ -259,7 +259,7 @@ HRESULT CD2VStream::CheckMediaType(const CMediaType* pmt)
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;
@@ -273,11 +273,11 @@ 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;
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
index a1259e811..0b6fec8a4 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
@@ -36,8 +36,8 @@ enum {
unknown,
AC3,
EAC3,
-// TrueHD,
-// TrueHDAC3,
+ // TrueHD,
+ // TrueHDAC3,
MLP,
DTS,
DTSHD,
@@ -48,9 +48,9 @@ enum {
bool isDTSSync(const DWORD sync)
{
if (sync == 0x0180fe7f || //16 bits and big endian bitstream
- sync == 0x80017ffe || //16 bits and little endian bitstream
- sync == 0x00e8ff1f || //14 bits and big endian bitstream
- sync == 0xe8001fff) //14 bits and little endian bitstream
+ sync == 0x80017ffe || //16 bits and little endian bitstream
+ sync == 0x00e8ff1f || //14 bits and big endian bitstream
+ sync == 0xe8001fff) //14 bits and little endian bitstream
return true;
else
return false;
@@ -59,17 +59,17 @@ bool isDTSSync(const DWORD sync)
DWORD ParseWAVECDHeader(const BYTE wh[44])
{
if (*(DWORD*)wh != 0x46464952 //"RIFF"
- || *(DWORDLONG*)(wh+8) != 0x20746d6645564157 //"WAVEfmt "
- || *(DWORD*)(wh+36) != 0x61746164) { //"data"
+ || *(DWORDLONG*)(wh+8) != 0x20746d6645564157 //"WAVEfmt "
+ || *(DWORD*)(wh+36) != 0x61746164) { //"data"
return 0;
- }
+ }
PCMWAVEFORMAT pcmwf = *(PCMWAVEFORMAT*)(wh+20);
if (pcmwf.wf.wFormatTag != 1
- || pcmwf.wf.nChannels != 2
- || pcmwf.wf.nSamplesPerSec != 44100
- || pcmwf.wf.nAvgBytesPerSec != 176400
- || pcmwf.wf.nBlockAlign != 4
- || pcmwf.wBitsPerSample != 16) {
+ || pcmwf.wf.nChannels != 2
+ || pcmwf.wf.nSamplesPerSec != 44100
+ || pcmwf.wf.nAvgBytesPerSec != 176400
+ || pcmwf.wf.nBlockAlign != 4
+ || pcmwf.wBitsPerSample != 16) {
return 0;
}
return *(DWORD*)(wh+40); //return size of "data"
@@ -79,9 +79,9 @@ int ParseAC3IEC61937Header(const BYTE *buf)
{
WORD* wbuf = (WORD*)buf;
if (*(DWORD*)buf == IEC61937_SYNC_WORD
- && wbuf[2] == 0x0001
- && wbuf[3] > 0 && wbuf[3] < (6144-8)*8
- && wbuf[4] == 0x0B77 ) {
+ && wbuf[2] == 0x0001
+ && wbuf[3] > 0 && wbuf[3] < (6144-8)*8
+ && wbuf[4] == 0x0B77 ) {
return 6144;
}
return 0;
@@ -201,7 +201,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
bool waveheader = false;
do {
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex)) {
+ if (!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex)) {
hr = AmHresultFromWin32 (ex.m_lOsError);
break;
}
@@ -209,7 +209,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
DWORD id = 0;
DWORD id2 = 0;
if (m_file.Read(&id, sizeof(id)) != sizeof(id) ||
- m_file.Read(&id2, sizeof(id2)) != sizeof(id2))
+ m_file.Read(&id2, sizeof(id2)) != sizeof(id2))
break;
// WAVE-CD header
@@ -220,8 +220,8 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
BYTE buf[44];
m_file.SeekToBegin();
if (m_file.Read(&buf, 44) != 44
- || ParseWAVECDHeader(buf) == 0
- || m_file.Read(&id, sizeof(id)) != sizeof(id))
+ || ParseWAVECDHeader(buf) == 0
+ || m_file.Read(&id, sizeof(id)) != sizeof(id))
break;
waveheader = true;
}
@@ -230,7 +230,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
// search DTS and AC3 headers (skip garbage in the beginning)
if (!isDTSSync(id) && (WORD)id!=AC3_SYNC_WORD
- && id!=IEC61937_SYNC_WORD /*&& id2!=TRUEHD_SYNC_WORD*/) {
+ && id!=IEC61937_SYNC_WORD /*&& id2!=TRUEHD_SYNC_WORD*/) {
if (ext != _T(".dtswav") && ext != _T(".dts") && ext != _T(".wav") && ext != _T(".ac3") && ext != _T(".eac3")) //check only specific extensions
break;
m_file.Seek(m_dataOffset, CFile::begin);
@@ -260,7 +260,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
dts_state_t* m_dts_state;
m_dts_state = dts_init(0);
int fsize = 0, flags, targeted_bitrate;
- if((fsize = dts_syncinfo(m_dts_state, buf, &flags, &m_samplerate, &targeted_bitrate, &m_framelength)) < 96) { //minimal valid fsize = 96
+ if ((fsize = dts_syncinfo(m_dts_state, buf, &flags, &m_samplerate, &targeted_bitrate, &m_framelength)) < 96) { //minimal valid fsize = 96
break;
}
m_streamtype = DTS;
@@ -288,7 +288,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
zero_bytes = 2048 - fsize;
m_streamtype = DTSPaded;
}
- }
+ }
/*const int bitratetbl[32] = {
32000, 56000, 64000, 96000,
@@ -305,7 +305,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
// [22] 1411200 is actually 1234800 for 14-bit DTS-CD audio
};*/
const int channels[16] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
-
+
// calculate actual bitrate
m_framesize = fsize + HD_size + zero_bytes;
m_bitrate = int ((m_framesize) * 8i64 * m_samplerate / m_framelength);
@@ -325,11 +325,11 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
if (m_bitrate!=0)
m_AvgTimePerFrame = 10000000i64 * m_framesize * 8 / m_bitrate;
-
+
m_wFormatTag = WAVE_FORMAT_DTS;
m_subtype = MEDIASUBTYPE_DTS;
-
- // AC3 & E-AC3
+
+ // AC3 & E-AC3
} else if ((WORD)id == AC3_SYNC_WORD) {
BYTE buf[20];
if (m_file.Read(&buf, 8) != 8)
@@ -358,7 +358,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
}
}
*/
- // E-AC3 header
+ // E-AC3 header
} else if (bsid == 16) {
int frametype;
fsize = ParseEAC3Header(buf, &m_samplerate, &m_channels, &m_framelength, &frametype);
@@ -390,7 +390,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_wFormatTag = WAVE_FORMAT_UNKNOWN;
m_subtype = MEDIASUBTYPE_DOLBY_AC3;
- // SPDIF AC3
+ // SPDIF AC3
} else if (waveheader && id == IEC61937_SYNC_WORD) {
BYTE buf[16];
if (m_file.Read(&buf, 16) != 16)
@@ -398,7 +398,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_framesize = ParseAC3IEC61937Header(buf);
if (m_framesize == 0)
break;
-
+
m_wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
m_channels = 2;
m_samplerate = 44100;
@@ -410,42 +410,42 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
m_subtype = MEDIASUBTYPE_DOLBY_AC3_SPDIF;
m_streamtype = SPDIF_AC3;
- /*
- // TrueHD
- } else if (id2 == TRUEHD_SYNC_WORD) {
- BYTE buf[20];
- if (m_file.Read(&buf, 20) != 20)
- break;
- int fsize = 0;
- int fsize2 = 0;
- fsize = ParseTrueHDHeader(buf, &m_samplerate, &m_channels, &m_framelength);
- if (fsize == 0)
- break;
- m_streamtype = TrueHD;
- m_fixedframesize = false;
+ /*
+ // TrueHD
+ } else if (id2 == TRUEHD_SYNC_WORD) {
+ BYTE buf[20];
+ if (m_file.Read(&buf, 20) != 20)
+ break;
+ int fsize = 0;
+ int fsize2 = 0;
+ fsize = ParseTrueHDHeader(buf, &m_samplerate, &m_channels, &m_framelength);
+ if (fsize == 0)
+ break;
+ m_streamtype = TrueHD;
+ m_fixedframesize = false;
- if (m_samplerate!=0)
- m_AvgTimePerFrame = 10000000i64 * m_framelength / m_samplerate;
+ if (m_samplerate!=0)
+ m_AvgTimePerFrame = 10000000i64 * m_framelength / m_samplerate;
- // TrueHD+AC3
- if (m_file.Read(&buf, 8) == 8) {
- int samplerate2, channels2, framelength2, bitrate2;
- fsize2 = ParseAC3Header(buf, &samplerate2, &channels2, &framelength2, &bitrate2);
- if (fsize2 > 0) {
- m_streamtype = TrueHDAC3;
+ // TrueHD+AC3
+ if (m_file.Read(&buf, 8) == 8) {
+ int samplerate2, channels2, framelength2, bitrate2;
+ fsize2 = ParseAC3Header(buf, &samplerate2, &channels2, &framelength2, &bitrate2);
+ if (fsize2 > 0) {
+ m_streamtype = TrueHDAC3;
- if (samplerate2!=0)
- m_AvgTimePerFrame = 10000000i64 * framelength2 / samplerate2;
+ if (samplerate2!=0)
+ m_AvgTimePerFrame = 10000000i64 * framelength2 / samplerate2;
+ }
}
- }
- m_framesize = fsize + fsize2;
- m_bitrate = int ((m_framesize) * 8i64 * m_samplerate / m_framelength);
- //m_bitdepth = 24;
+ m_framesize = fsize + fsize2;
+ m_bitrate = int ((m_framesize) * 8i64 * m_samplerate / m_framelength);
+ //m_bitdepth = 24;
- m_wFormatTag = WAVE_FORMAT_UNKNOWN;
- m_subtype = MEDIASUBTYPE_DOLBY_TRUEHD;
- */
+ m_wFormatTag = WAVE_FORMAT_UNKNOWN;
+ m_subtype = MEDIASUBTYPE_DOLBY_TRUEHD;
+ */
} else {
break;
}
@@ -456,7 +456,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
hr = S_OK;
} while (false);
- if(phr) {
+ if (phr) {
*phr = hr;
}
}
@@ -476,11 +476,11 @@ HRESULT CDTSAC3Stream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERT
pProperties->cbBuffer = m_framesize;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -496,9 +496,9 @@ HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut,
const GUID* subtype = &m_mt.subtype;
UNUSED_ALWAYS(subtype);
- if(*majortype == MEDIATYPE_Audio) {
+ if (*majortype == MEDIATYPE_Audio) {
m_file.Seek(m_dataOffset + nFrame*m_framesize, CFile::begin);
- if((int)m_file.Read(pOut, m_framesize) < m_framesize) {
+ if ((int)m_file.Read(pOut, m_framesize) < m_framesize) {
return S_FALSE;
}
pOut += m_framesize;
@@ -530,8 +530,8 @@ bool CDTSAC3Stream::CheckAC3(const CMediaType* pmt)
return pmt->majortype == MEDIATYPE_Audio
&& pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
&& pmt->formattype == FORMAT_WaveFormatEx
- && (((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_UNKNOWN
- || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3);
+ && (((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_UNKNOWN
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3);
}
bool CDTSAC3Stream::CheckSPDIFAC3(const CMediaType* pmt)
@@ -560,7 +560,7 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = m_subtype;
pmt->formattype = FORMAT_WaveFormatEx;
-
+
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
wfe->wFormatTag = m_wFormatTag;
wfe->nChannels = m_channels;
@@ -573,8 +573,8 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
if (m_streamtype == SPDIF_AC3) {
wfe->nBlockAlign = 4;
pmt->SetSampleSize(m_framesize);
-// } else if (m_streamtype == TrueHD) {
-// pmt->SetSampleSize(0);
+ // } else if (m_streamtype == TrueHD) {
+ // pmt->SetSampleSize(0);
}
} else {
@@ -589,8 +589,8 @@ HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CDTSAC3Stream::CheckMediaType(const CMediaType* pmt)
{
return CheckDTS(pmt) || CheckDTS2(pmt)
- || CheckAC3(pmt) || CheckSPDIFAC3(pmt)
-// || CheckTrueHD(pmt)
+ || CheckAC3(pmt) || CheckSPDIFAC3(pmt)
+ // || CheckTrueHD(pmt)
? S_OK
: E_INVALIDARG;
}
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.h b/src/filters/source/DTSAC3Source/DTSAC3Source.h
index bf9a25dfe..48dec8f32 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.h
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.h
@@ -54,7 +54,7 @@ class CDTSAC3Stream : public CBaseStream
bool CheckDTS2(const CMediaType* pmt);
bool CheckAC3(const CMediaType* pmt);
bool CheckSPDIFAC3(const CMediaType* pmt);
-// bool CheckTrueHD(const CMediaType* pmt);
+ // bool CheckTrueHD(const CMediaType* pmt);
public:
CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
diff --git a/src/filters/source/FLACSource/FLACSource.cpp b/src/filters/source/FLACSource/FLACSource.cpp
index 8a0c6f4fd..939fb72d3 100644
--- a/src/filters/source/FLACSource/FLACSource.cpp
+++ b/src/filters/source/FLACSource/FLACSource.cpp
@@ -119,7 +119,7 @@ CFLACStream::CFLACStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
HRESULT hr = E_FAIL;
do {
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex)) {
+ if (!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex)) {
hr = AmHresultFromWin32 (ex.m_lOsError);
break;
}
@@ -153,7 +153,7 @@ CFLACStream::CFLACStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
hr = S_OK;
} while (false);
- if(phr) {
+ if (phr) {
*phr = hr;
}
}
@@ -173,11 +173,11 @@ HRESULT CFLACStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
pProperties->cbBuffer = m_nMaxFrameSize;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -222,7 +222,7 @@ HRESULT CFLACStream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition == 0) {
+ if (iPosition == 0) {
pmt->majortype = MEDIATYPE_Audio;
pmt->subtype = MEDIASUBTYPE_FLAC_FRAMED;
pmt->formattype = FORMAT_WaveFormatEx;
diff --git a/src/filters/source/FLICSource/FLICSource.cpp b/src/filters/source/FLICSource/FLICSource.cpp
index e85e278a2..c06cbfeb1 100644
--- a/src/filters/source/FLICSource/FLICSource.cpp
+++ b/src/filters/source/FLICSource/FLICSource.cpp
@@ -110,16 +110,16 @@ STDMETHODIMP CFLICSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
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;
}
@@ -130,12 +130,12 @@ STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
STDMETHODIMP CFLICSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -162,15 +162,15 @@ 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)
+ if (m_flic.Read(&m_hdr, sizeof(m_hdr)) != sizeof(m_hdr)
|| (m_hdr.type != 0xAF11 && m_hdr.type != 0xAF12)
|| m_hdr.depth != 8) {
- if(phr) *phr = E_FAIL;
+ if (phr) *phr = E_FAIL;
return;
}
@@ -185,7 +185,7 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
{
__int64 pos = m_flic.GetPosition();
FLIC_PREFIX fp;
- if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.type != 0xF100) {
+ if (m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.type != 0xF100) {
m_flic.Seek(pos, CFile::begin);
} else {
m_flic.Seek(pos + fp.size, CFile::begin);
@@ -196,37 +196,37 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
unsigned int nFrames = 0;
m_frames.SetCount(m_hdr.frames);
while (nFrames < m_hdr.frames && m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) == sizeof(ffe.hdr) && ffe.hdr.type == 0xF1FA) {
-
+
ffe.pos = m_flic.GetPosition();
ffe.fKeyframe = false;
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;
}
ffe.fKeyframe = ffe.fKeyframe
- || fc.type == FLIC_BRUN
- || fc.type == FLIC_BLACK
- || fc.type == FLIC_COPY
- || fc.type == DTA_BRUN
- || fc.type == DTA_COPY
- || fc.type == KEY_IMAGE;
+ || fc.type == FLIC_BRUN
+ || fc.type == FLIC_BLACK
+ || fc.type == FLIC_COPY
+ || fc.type == DTA_BRUN
+ || fc.type == DTA_COPY
+ || fc.type == KEY_IMAGE;
ULONGLONG pos = m_flic.GetPosition() + fc.size - sizeof(fc);
- if(pos < m_flic.GetLength()) {
+ if (pos < m_flic.GetLength()) {
m_flic.Seek(pos, CFile::begin);
} else break;
chunk++;
}
- if(chunk < ffe.hdr.chunks) {
+ if (chunk < ffe.hdr.chunks) {
break;
}
ULONGLONG pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
- if(pos < m_flic.GetLength()) {
+ if (pos < m_flic.GetLength()) {
m_flic.Seek(pos, CFile::begin);
} else break;
@@ -237,21 +237,21 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
m_frames.SetCount(nFrames); // if the file is incomplete, then truncate the index
m_frames[0].fKeyframe = true;
} else {
- if(phr) *phr = E_FAIL;
+ if (phr) *phr = E_FAIL;
return;
}
m_nLastFrameNum = -1;
memset(m_pPalette, 0, sizeof(m_pPalette));
m_nBufferSize = m_hdr.width*m_hdr.height*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*nFrames;
- if(phr) {
+ if (phr) {
*phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
}
@@ -271,7 +271,7 @@ STDMETHODIMP CFLICStream::NonDelegatingQueryInterface(REFIID riid, void** 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
@@ -294,7 +294,7 @@ void CFLICStream::UpdateFromSeek()
HRESULT CFLICStream::SetRate(double dRate)
{
- if(dRate <= 0) {
+ if (dRate <= 0) {
return E_INVALIDARG;
}
@@ -331,7 +331,7 @@ HRESULT CFLICStream::ChangeStop()
{
{
CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop) {
+ if (m_rtPosition < m_rtStop) {
return S_OK;
}
}
@@ -364,11 +364,11 @@ HRESULT CFLICStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
pProperties->cbBuffer = m_nBufferSize;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -383,18 +383,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);
@@ -402,11 +402,11 @@ 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;
@@ -422,17 +422,17 @@ 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);
+ 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) {
+ while (src < end) {
*dst++ = m_pPalette[*src++];
}
}
@@ -452,7 +452,7 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity) {
+ if (m_bDiscontinuity) {
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity = FALSE;
}
@@ -464,10 +464,10 @@ HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -499,7 +499,7 @@ HRESULT CFLICStream::CheckConnect(IPin* pPin)
HRESULT CFLICStream::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Video
+ if (pmt->majortype == MEDIATYPE_Video
&& pmt->subtype == MEDIASUBTYPE_RGB32
&& pmt->formattype == FORMAT_VideoInfo) {
return S_OK;
@@ -517,17 +517,17 @@ 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((int)m_frames.GetCount(), nFrame); i < j; i++) {
+ for (int i = m_nLastFrameNum+1, j = min((int)m_frames.GetCount(), nFrame); i < j; i++) {
FLIC_FRAME_ENTRY& ffe = m_frames[i];
- if(ffe.fKeyframe) {
+ if (ffe.fKeyframe) {
m_nLastFrameNum = i-1;
}
}
@@ -543,18 +543,18 @@ 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);
- if(next >= m_flic.GetLength()) {
+ if (next >= m_flic.GetLength()) {
break;
}
- switch(fc.type) {
+ switch (fc.type) {
case FLIC_64_COLOR:
fNewPalette = _colorchunk(true);
break;
@@ -590,7 +590,7 @@ void CFLICStream::ExtractFrame(int nFrame)
chunk++;
}
- if(chunk < ffe.hdr.chunks) {
+ if (chunk < ffe.hdr.chunks) {
ASSERT(0);
}
@@ -616,7 +616,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;
@@ -625,7 +625,7 @@ 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));
@@ -645,17 +645,17 @@ void CFLICStream::_brunchunk()
BYTE* tmp = m_pFrameBuffer;
int lines = m_hdr.height;
- while(lines--) {
+ while (lines--) {
BYTE packets;
m_flic.Read(&packets, sizeof(packets));
BYTE* ptr = tmp;
- while(ptr < tmp + m_hdr.width) {
+ while (ptr < tmp + m_hdr.width) {
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);
@@ -680,13 +680,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));
@@ -695,7 +695,7 @@ 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 {
@@ -717,12 +717,12 @@ 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.width;
lines++;
} else {
@@ -733,7 +733,7 @@ void CFLICStream::_deltachunk()
} else {
BYTE* ptr = tmp;
- while(packets--) {
+ while (packets--) {
BYTE skip;
m_flic.Read(&skip, sizeof(skip));
@@ -742,7 +742,7 @@ 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) {
m_flic.Read(ptr, count << 1);
@@ -754,7 +754,7 @@ void CFLICStream::_deltachunk()
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/ShoutcastSource/ShoutcastSource.cpp b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
index 77d1305a9..77baa25fc 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
@@ -58,7 +58,7 @@ typedef struct {
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;
}
@@ -111,7 +111,7 @@ class CShoutcastSourceApp : public CFilterApp
{
public:
BOOL InitInstance() {
- if(!__super::InitInstance()) {
+ if (!__super::InitInstance()) {
return FALSE;
}
/*
@@ -121,7 +121,7 @@ public:
return FALSE;
}
*/
- if(!AfxSocketInit(NULL)) {
+ if (!AfxSocketInit(NULL)) {
AfxMessageBox(_T("AfxSocketInit failed!"));
return FALSE;
}
@@ -166,13 +166,13 @@ STDMETHODIMP CShoutcastSource::NonDelegatingQueryInterface(REFIID riid, void** p
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;
}
@@ -183,12 +183,12 @@ STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE*
STDMETHODIMP CShoutcastSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) {
+ if (!ppszFileName) {
return E_POINTER;
}
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR));
- if(!(*ppszFileName)) {
+ if (!(*ppszFileName)) {
return E_OUTOFMEMORY;
}
@@ -208,11 +208,11 @@ ULONG CShoutcastSource::GetMiscFlags()
STDMETHODIMP CShoutcastSource::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
{
- if(m_iPins == 1) {
- if(pllTotal) {
+ if (m_iPins == 1) {
+ if (pllTotal) {
*pllTotal = 100;
}
- if(pllCurrent) {
+ if (pllCurrent) {
*pllCurrent = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetBufferFullness();
}
return S_OK;
@@ -232,7 +232,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;
}
@@ -251,7 +251,7 @@ CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent,
*phr = S_OK;
CString fn(wfn);
- if(fn.Find(_T("://")) < 0) {
+ if (fn.Find(_T("://")) < 0) {
fn = _T("http://") + fn;
}
@@ -267,25 +267,25 @@ CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent,
// 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;
}
@@ -306,10 +306,10 @@ void CShoutcastStream::EmptyBuffer()
LONGLONG CShoutcastStream::GetBufferFullness()
{
CAutoLock cAutoLock(&m_queue);
- if(!m_fBuffering) {
+ if (!m_fBuffering) {
return 100;
}
- if(m_queue.IsEmpty()) {
+ if (m_queue.IsEmpty()) {
return 0;
}
LONGLONG ret = 100i64*(m_queue.GetTail().rtStart - m_queue.GetHead().rtStart) / AVGBUFFERLENGTH;
@@ -333,11 +333,11 @@ HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROP
pProperties->cbBuffer = MAXFRAMESIZE;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -350,7 +350,7 @@ 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;
}
@@ -358,7 +358,7 @@ HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
// do we have to refill our buffer?
{
CAutoLock cAutoLock(&m_queue);
- if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH) {
+ if (!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH) {
break; // nope, that's great
}
}
@@ -366,15 +366,15 @@ HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
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) {
+ if (!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH) {
break; // this is enough
}
}
@@ -388,12 +388,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);
@@ -412,10 +412,10 @@ HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -437,7 +437,7 @@ HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CShoutcastStream::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Audio
+ if (pmt->majortype == MEDIATYPE_Audio
&& pmt->subtype == MEDIASUBTYPE_MP3
&& pmt->formattype == FORMAT_WaveFormatEx) {
return S_OK;
@@ -460,7 +460,7 @@ UINT CShoutcastStream::SocketThreadProc()
AfxSocketInit();
CAutoVectorPtr<BYTE> pData;
- if(!m_socket.Create() || !m_socket.Connect(m_url)
+ if (!m_socket.Create() || !m_socket.Connect(m_url)
|| !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE))) {
m_socket.Close();
return 1;
@@ -468,10 +468,10 @@ UINT CShoutcastStream::SocketThreadProc()
REFERENCE_TIME m_rtSampleTime = 0;
- while(!fExitThread) {
+ while (!fExitThread) {
int len = MAXFRAMESIZE;
len = m_socket.Receive(pData, len);
- if(len <= 0) {
+ if (len <= 0) {
break;
}
@@ -480,7 +480,7 @@ UINT CShoutcastStream::SocketThreadProc()
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()) {
+ if (f.title.IsEmpty()) {
f.title = m_socket.m_url;
}
@@ -499,7 +499,7 @@ HRESULT CShoutcastStream::OnThreadCreate()
fExitThread = true;
m_hSocketThread = AfxBeginThread(::SocketThreadProc, this)->m_hThread;
- while(fExitThread) {
+ while (fExitThread) {
Sleep(10);
}
@@ -527,25 +527,25 @@ 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) {
+ 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));
@@ -553,10 +553,10 @@ int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nF
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) {
+ if (j > i) {
m_title = str.Mid(i, j - i);
}
} else {
@@ -564,27 +564,27 @@ int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nF
}
i = str.Find(url);
- if(i >= 0) {
+ if (i >= 0) {
i += url.GetLength();
int j = str.Find('\'', i);
- if(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) {
+ while (p-- > p0) {
+ if ((BYTE)*p >= 0x20) {
continue;
}
@@ -592,14 +592,14 @@ int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nF
p += 1 + *p*16;
len = (p0 + len) - p;
TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
- if(len <= 0) {
+ if (len <= 0) {
TRACE(_T("nothing to return, reading a bit more in\n"));
- if(len < 0) {
+ if (len < 0) {
__super::Receive(lpBuf, -len, nFlags);
}
int len = __super::Receive(lpBuf, nBufLen, nFlags);
- if(len <= 0) {
+ if (len <= 0) {
return len;
}
}
@@ -619,7 +619,7 @@ int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nF
bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
{
- if(!__super::Connect(url.GetHostName(), url.GetPortNumber())) {
+ if (!__super::Connect(url.GetHostName(), url.GetPortNumber())) {
return false;
}
@@ -647,18 +647,18 @@ 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) {
+ if (str.Find("icy 200 ok") >= 0) {
fOK = true;
- } else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) {
+ } else if (1 == sscanf(str, "icy-br:%d", &m_bitrate)) {
m_bitrate *= 1000;
- } else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) {
+ } else if (1 == sscanf(str, "icy-metaint:%d", &metaint)) {
metaint = metaint;
}
str.Empty();
@@ -670,7 +670,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"
@@ -683,9 +683,9 @@ bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
} else {
fTryAgain = false;
}
- } while(fTryAgain);
+ } while (fTryAgain);
- if(!fOK || m_bitrate == 0) {
+ if (!fOK || m_bitrate == 0) {
Close();
return false;
}
@@ -702,10 +702,10 @@ 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) {
+ if (h.ExtractHeader(*this) && m_bitrate == h.bitrate) {
+ if (h.bitrate > 1) {
m_bitrate = h.bitrate;
}
m_freq = h.freq;
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.h b/src/filters/source/ShoutcastSource/ShoutcastSource.h
index 3e873955c..405293f1a 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.h
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.h
@@ -128,7 +128,7 @@ class CShoutcastStream : public CSourceStream
delete pData;
}
mp3frame& operator = (const mp3frame& f) {
- if(this != &f) {
+ if (this != &f) {
len = f.len;
pData = f.pData;
rtStart = f.rtStart;
diff --git a/src/filters/source/SubtitleSource/SubtitleSource.cpp b/src/filters/source/SubtitleSource/SubtitleSource.cpp
index e7911ec4e..8d18f154a 100644
--- a/src/filters/source/SubtitleSource/SubtitleSource.cpp
+++ b/src/filters/source/SubtitleSource/SubtitleSource.cpp
@@ -119,14 +119,14 @@ class CSubtitleSourceApp : public CFilterApp
{
public:
BOOL InitInstance() {
- if(!__super::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) {
+ if (_ATPF <= 0) {
_ATPF = 400000;
}
WriteProfileInt(_T("SubtitleSource"), _T("w"), _WIDTH);
@@ -168,16 +168,16 @@ STDMETHODIMP CSubtitleSource::NonDelegatingQueryInterface(REFIID riid, void** pp
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;
}
@@ -191,7 +191,7 @@ STDMETHODIMP CSubtitleSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE*
if (!ppszFileName) {
return E_POINTER;
}
-
+
*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR));
if (!*ppszFileName) {
return E_OUTOFMEMORY;
@@ -224,8 +224,8 @@ CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRE
CString fn(wfn);
- if(!m_rts.Open(fn, DEFAULT_CHARSET)) {
- if(phr) {
+ if (!m_rts.Open(fn, DEFAULT_CHARSET)) {
+ if (phr) {
*phr = E_FAIL;
}
return;
@@ -236,13 +236,13 @@ 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) {
+ if (phr) {
*phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
}
@@ -262,7 +262,7 @@ STDMETHODIMP CSubtitleStream::NonDelegatingQueryInterface(REFIID riid, void** pp
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
@@ -285,7 +285,7 @@ void CSubtitleStream::UpdateFromSeek()
HRESULT CSubtitleStream::SetRate(double dRate)
{
- if(dRate <= 0) {
+ if (dRate <= 0) {
return E_INVALIDARG;
}
@@ -355,18 +355,18 @@ HRESULT CSubtitleStream::OnThreadCreate()
{
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 {
m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
- if(m_nPosition < 0) {
+ if (m_nPosition < 0) {
m_nPosition = 0;
- } else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) {
+ } else if (m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) {
m_nPosition++;
}
}
@@ -383,7 +383,7 @@ HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPE
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 {
@@ -392,11 +392,11 @@ HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPE
}
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) {
return hr;
}
- if(Actual.cbBuffer < pProperties->cbBuffer) {
+ if (Actual.cbBuffer < pProperties->cbBuffer) {
return E_FAIL;
}
ASSERT(Actual.cBuffers == pProperties->cBuffers);
@@ -412,12 +412,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);
@@ -426,10 +426,10 @@ 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;
}
@@ -444,22 +444,22 @@ 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) {
+ if (!stss) {
return S_FALSE;
}
@@ -474,13 +474,13 @@ 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) {
+ 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);
}
}
@@ -491,20 +491,20 @@ 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()) {
+ 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),
@@ -513,7 +513,7 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
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 {
@@ -532,7 +532,7 @@ HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity) {
+ if (m_bDiscontinuity) {
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity = FALSE;
}
@@ -552,7 +552,7 @@ HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
CMediaType mt;
GetMediaType(&mt);
- if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype) {
+ if (mt.majortype == pmt->majortype && mt.subtype == pmt->subtype) {
return NOERROR;
}
@@ -634,7 +634,7 @@ 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;
}
@@ -642,7 +642,7 @@ HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
_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;
}
@@ -685,7 +685,7 @@ 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;
}
@@ -693,7 +693,7 @@ HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
_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;
}
diff --git a/src/filters/switcher/AudioSwitcher/Audio.cpp b/src/filters/switcher/AudioSwitcher/Audio.cpp
index 8f5a905ef..e6c872e28 100644
--- a/src/filters/switcher/AudioSwitcher/Audio.cpp
+++ b/src/filters/switcher/AudioSwitcher/Audio.cpp
@@ -32,7 +32,7 @@ static long audio_pointsample_8(void *dst, void *src, long accum, long samp_frac
do {
*d++ = s[accum>>19];
accum += samp_frac;
- } while(--cnt);
+ } while (--cnt);
return accum;
}
@@ -45,7 +45,7 @@ static long audio_pointsample_16(void *dst, void *src, long accum, long samp_fra
do {
*d++ = s[accum>>19];
accum += samp_frac;
- } while(--cnt);
+ } while (--cnt);
return accum;
}
@@ -58,7 +58,7 @@ static long audio_pointsample_32(void *dst, void *src, long accum, long samp_fra
do {
*d++ = s[accum>>19];
accum += samp_frac;
- } while(--cnt);
+ } while (--cnt);
return accum;
}
@@ -79,7 +79,7 @@ static long audio_downsample_mono8(void *dst, void *src, long *filter_bank, int
s_ptr = s + (accum>>19);
do {
sum += *fb_ptr++ * (int)*s_ptr++;
- } while(--w);
+ } while (--w);
if (sum < 0) {
*d++ = 0;
@@ -90,7 +90,7 @@ static long audio_downsample_mono8(void *dst, void *src, long *filter_bank, int
}
accum += samp_frac;
- } while(--cnt);
+ } while (--cnt);
return accum;
}
@@ -111,7 +111,7 @@ static long audio_downsample_mono16(void *dst, void *src, long *filter_bank, int
s_ptr = s + (accum>>19);
do {
sum += *fb_ptr++ * (int)*s_ptr++;
- } while(--w);
+ } while (--w);
if (sum < -0x20000000) {
*d++ = -0x8000;
@@ -122,7 +122,7 @@ static long audio_downsample_mono16(void *dst, void *src, long *filter_bank, int
}
accum += samp_frac;
- } while(--cnt);
+ } while (--cnt);
return accum;
}
@@ -144,7 +144,7 @@ static void make_downsample_filter(long *filter_bank, int filter_width, long sam
filt_max = (16384.0 * 524288.0) / samp_frac;
- for(i=0; i<128*filter_width; i++) {
+ for (i=0; i<128*filter_width; i++) {
int y = 0;
double d = i / filtwidth_frac;
@@ -153,22 +153,22 @@ static void make_downsample_filter(long *filter_bank, int filter_width, long sam
}
filter_bank[permute_index(128*filter_width + i, filter_width)]
- = filter_bank[permute_index(128*filter_width - i, filter_width)]
- = y;
+ = filter_bank[permute_index(128*filter_width - i, filter_width)]
+ = y;
}
// Normalize the filter to correct for integer roundoff errors
- for(i=0; i<256*filter_width; i+=filter_width) {
+ for (i=0; i<256*filter_width; i+=filter_width) {
v=0;
- for(j=0; j<filter_width; j++) {
+ for (j=0; j<filter_width; j++) {
v += filter_bank[i+j];
}
// _RPT2(0,"error[%02x] = %04x\n", i/filter_width, 0x4000 - v);
v = (0x4000 - v)/filter_width;
- for(j=0; j<filter_width; j++) {
+ for (j=0; j<filter_width; j++) {
filter_bank[i+j] += v;
}
}
@@ -182,10 +182,10 @@ AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate
this->bps = bps;
- if(bps == 1) {
+ if (bps == 1) {
ptsampleRout = audio_pointsample_8;
dnsampleRout = audio_downsample_mono8;
- } else if(bps >= 2) {
+ } else if (bps >= 2) {
ptsampleRout = audio_pointsample_16;
dnsampleRout = audio_downsample_mono16;
} else {
@@ -202,14 +202,14 @@ AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate
// If this is a high-quality downsample, allocate memory for the filter bank
- if(fHighQuality) {
- if(samp_frac>0x80000) {
+ if (fHighQuality) {
+ if (samp_frac>0x80000) {
// HQ downsample: allocate filter bank
filter_width = ((samp_frac + 0x7ffff)>>19)<<1 <<1;
filter_bank = DNew long[filter_width * 256];
- if(!filter_bank) {
+ if (!filter_bank) {
filter_width = 1;
return;
}
@@ -239,7 +239,7 @@ long AudioStreamResampler::Downsample(void* input, long samplesin, void* output,
//
// We need (n/2) points to the left and (n/2-1) points to the right.
- while(samplesin > 0 && samplesout > 0) {
+ while (samplesin > 0 && samplesout > 0) {
long srcSamples, dstSamples;
int nhold;
@@ -253,14 +253,14 @@ long AudioStreamResampler::Downsample(void* input, long samplesin, void* output,
// Don't exceed the buffer (BUFFER_SIZE - holdover).
- if(srcSamples > BUFFER_SIZE - holdover) {
+ if (srcSamples > BUFFER_SIZE - holdover) {
srcSamples = BUFFER_SIZE - holdover;
}
// Read into buffer.
srcSamples = min(srcSamples, samplesin);
- if(!srcSamples) {
+ if (!srcSamples) {
break;
}
@@ -274,12 +274,12 @@ long AudioStreamResampler::Downsample(void* input, long samplesin, void* output,
dstSamples = (((__int64)(srcSamples+holdover-filter_width)<<19) + 0x7ffff - accum) / samp_frac + 1;
- if(dstSamples > samplesout) {
+ if (dstSamples > samplesout) {
dstSamples = samplesout;
}
- if(dstSamples >= 1) {
- if(filter_bank) {
+ if (dstSamples >= 1) {
+ if (filter_bank) {
accum = dnsampleRout(output, cbuffer, filter_bank, filter_width, accum, samp_frac, dstSamples);
} else {
accum = ptsampleRout(output, cbuffer, accum, samp_frac, dstSamples);
diff --git a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
index 48c3c6338..699706379 100644
--- a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
+++ b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
@@ -94,8 +94,8 @@ CAudioSwitcherFilter::CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr)
{
memset(m_pSpeakerToChannelMap, 0, sizeof(m_pSpeakerToChannelMap));
- if(phr) {
- if(FAILED(*phr)) {
+ if (phr) {
+ if (FAILED(*phr)) {
return;
} else {
*phr = S_OK;
@@ -112,7 +112,7 @@ STDMETHODIMP CAudioSwitcherFilter::NonDelegatingQueryInterface(REFIID riid, void
HRESULT CAudioSwitcherFilter::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->formattype == FORMAT_WaveFormatEx
+ if (pmt->formattype == FORMAT_WaveFormatEx
&& ((WAVEFORMATEX*)pmt->pbFormat)->nChannels > 2
&& ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag != WAVE_FORMAT_EXTENSIBLE) {
return VFW_E_INVALIDMEDIATYPE; // stupid iviaudio tries to fool us
@@ -137,15 +137,15 @@ __forceinline void mix(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
{
U sum = 0;
- for(int i = 0, j = ch; i < j; i++) {
- if(mask & (1<<i)) {
+ for (int i = 0, j = ch; i < j; i++) {
+ if (mask & (1<<i)) {
sum += *(T*)&src[bps*i];
}
}
- if(sum < Umin) {
+ if (sum < Umin) {
sum = Umin;
- } else if(sum > Umax) {
+ } else if (sum > Umax) {
sum = Umax;
}
@@ -157,8 +157,8 @@ __forceinline void mix<int, INT64, (-1<<24), (+1<<24)-1>(DWORD mask, int ch, int
{
INT64 sum = 0;
- for(int i = 0, j = ch; i < j; i++) {
- if(mask & (1<<i)) {
+ for (int i = 0, j = ch; i < j; i++) {
+ if (mask & (1<<i)) {
int tmp;
memcpy((BYTE*)&tmp+1, &src[bps*i], 3);
sum += tmp >> 8;
@@ -176,22 +176,22 @@ __forceinline void mix4(DWORD mask, BYTE* src, BYTE* dst)
U sum = 0;
int bps = sizeof T;
- if(mask & (1<<0)) {
+ if (mask & (1<<0)) {
sum += *(T*)&src[bps*0];
}
- if(mask & (1<<1)) {
+ if (mask & (1<<1)) {
sum += *(T*)&src[bps*1];
}
- if(mask & (1<<2)) {
+ if (mask & (1<<2)) {
sum += *(T*)&src[bps*2];
}
- if(mask & (1<<3)) {
+ if (mask & (1<<3)) {
sum += *(T*)&src[bps*3];
}
- if(sum < Umin) {
+ if (sum < Umin) {
sum = Umin;
- } else if(sum > Umax) {
+ } else if (sum > Umax) {
sum = Umax;
}
@@ -201,15 +201,15 @@ __forceinline void mix4(DWORD mask, BYTE* src, BYTE* dst)
template<class T>
T clamp(double s, T smin, T smax)
{
- if(s < -1) {
+ if (s < -1) {
s = -1;
- } else if(s > 1) {
+ } else if (s > 1) {
s = 1;
}
T t = (T)(s * smax);
- if(t < smin) {
+ if (t < smin) {
t = smin;
- } else if(t > smax) {
+ } else if (t > smax) {
t = smax;
}
return t;
@@ -219,7 +219,7 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
CStreamSwitcherInputPin* pInPin = GetInputPin();
CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
- if(!pInPin || !pOutPin) {
+ if (!pInPin || !pOutPin) {
return __super::Transform(pIn, pOut);
}
@@ -233,7 +233,7 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
int lenout = (UINT64)len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
REFERENCE_TIME rtStart, rtStop;
- if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop))) {
+ if (SUCCEEDED(pIn->GetTime(&rtStart, &rtStop))) {
rtStart += m_rtAudioTimeShift;
rtStop += m_rtAudioTimeShift;
pOut->SetTime(&rtStart, &rtStop);
@@ -249,14 +249,14 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
m_rtNextStart += rtDur;
m_rtNextStop += rtDur;
- if(pIn->IsDiscontinuity() == S_OK) {
+ if (pIn->IsDiscontinuity() == S_OK) {
m_sample_max = 0.1f;
}
WORD tag = wfe->wFormatTag;
bool fPCM = tag == WAVE_FORMAT_PCM || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM;
bool fFloat = tag == WAVE_FORMAT_IEEE_FLOAT || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
- if(!fPCM && !fFloat) {
+ if (!fPCM && !fFloat) {
return __super::Transform(pIn, pOut);
}
@@ -264,26 +264,26 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
BYTE* pDataOut = NULL;
HRESULT hr;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
- if(FAILED(hr = pOut->GetPointer(&pDataOut))) {
+ if (FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
- if(!pDataIn || !pDataOut || len < 0 || lenout < 0) {
+ if (!pDataIn || !pDataOut || len < 0 || lenout < 0) {
return S_FALSE;
}
// len = 0 doesn't mean it's failed, return S_OK otherwise might screw the sound
- if(len == 0) {
+ if (len == 0) {
pOut->SetActualDataLength(0);
return S_OK;
}
- if(m_fCustomChannelMapping) {
+ if (m_fCustomChannelMapping) {
size_t channelsCount = m_chs[wfe->nChannels-1].GetCount();
- if(channelsCount > 0 && wfeout->nChannels <= channelsCount) {
- for(int i = 0; i < wfeout->nChannels; i++) {
+ if (channelsCount > 0 && wfeout->nChannels <= channelsCount) {
+ for (int i = 0; i < wfeout->nChannels; i++) {
DWORD mask = m_chs[wfe->nChannels-1][i].Channel;
BYTE* src = pDataIn;
@@ -292,34 +292,34 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
int srcstep = bps*wfe->nChannels;
int dststep = bps*wfeout->nChannels;
int channels = min(18, wfe->nChannels);
- if(fPCM && wfe->wBitsPerSample == 8) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ if (fPCM && wfe->wBitsPerSample == 8) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<unsigned char, INT64, 0, UCHAR_MAX>(mask, channels, bps, src, dst);
}
- } else if(fPCM && wfe->wBitsPerSample == 16) {
+ } else if (fPCM && wfe->wBitsPerSample == 16) {
if (wfe->nChannels != 4 || wfeout->nChannels != 4) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<short, INT64, SHRT_MIN, SHRT_MAX>(mask, channels, bps, src, dst);
}
} else { // most popular channels count
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix4<short, INT64, SHRT_MIN, SHRT_MAX>(mask, src, dst);
}
}
- } else if(fPCM && wfe->wBitsPerSample == 24) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ } else if (fPCM && wfe->wBitsPerSample == 24) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<int, INT64, (-1<<24), (+1<<24)-1>(mask, channels, bps, src, dst);
}
- } else if(fPCM && wfe->wBitsPerSample == 32) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ } else if (fPCM && wfe->wBitsPerSample == 32) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<int, __int64, INT_MIN, INT_MAX>(mask, channels, bps, src, dst);
}
- } else if(fFloat && wfe->wBitsPerSample == 32) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ } else if (fFloat && wfe->wBitsPerSample == 32) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<float, double, -1, 1>(mask, channels, bps, src, dst);
}
- } else if(fFloat && wfe->wBitsPerSample == 64) {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep) {
+ } else if (fFloat && wfe->wBitsPerSample == 64) {
+ for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
mix<double, double, -1, 1>(mask, channels, bps, src, dst);
}
}
@@ -327,32 +327,32 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
} else {
BYTE* pDataOut = NULL;
HRESULT hr;
- if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) {
+ if (FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) {
return hr;
}
memset(pDataOut, 0, pOut->GetSize());
}
} else {
HRESULT hr;
- if(S_OK != (hr = __super::Transform(pIn, pOut))) {
+ if (S_OK != (hr = __super::Transform(pIn, pOut))) {
return hr;
}
}
- if(m_fDownSampleTo441
+ if (m_fDownSampleTo441
&& wfe->nSamplesPerSec > 44100 && wfeout->nSamplesPerSec == 44100
&& wfe->wBitsPerSample <= 16 && fPCM) {
- if(BYTE* buff = DNew BYTE[len*bps]) {
- for(int ch = 0; ch < wfeout->nChannels; ch++) {
+ if (BYTE* buff = DNew BYTE[len*bps]) {
+ for (int ch = 0; ch < wfeout->nChannels; ch++) {
memset(buff, 0, len*bps);
- for(int i = 0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
memcpy(buff + i*bps, (char*)pDataOut + (ch + i*wfeout->nChannels)*bps, bps);
}
m_pResamplers[ch]->Downsample(buff, len, buff, lenout);
- for(int i = 0; i < lenout; i++) {
+ for (int i = 0; i < lenout; i++) {
memcpy((char*)pDataOut + (ch + i*wfeout->nChannels)*bps, buff + i*bps, bps);
}
}
@@ -361,73 +361,73 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
}
}
- if(m_fNormalize || m_boost_mul > 1) {
+ if (m_fNormalize || m_boost_mul > 1) {
int samples = lenout*wfeout->nChannels;
- if(double* buff = DNew double[samples]) {
- for(int i = 0; i < samples; i++) {
- if(fPCM && wfe->wBitsPerSample == 8) {
+ if (double* buff = DNew double[samples]) {
+ for (int i = 0; i < samples; i++) {
+ if (fPCM && wfe->wBitsPerSample == 8) {
buff[i] = (double)((BYTE*)pDataOut)[i] / UCHAR_MAX;
- } else if(fPCM && wfe->wBitsPerSample == 16) {
+ } else if (fPCM && wfe->wBitsPerSample == 16) {
buff[i] = (double)((short*)pDataOut)[i] / SHRT_MAX;
- } else if(fPCM && wfe->wBitsPerSample == 24) {
+ } else if (fPCM && wfe->wBitsPerSample == 24) {
int tmp;
memcpy(((BYTE*)&tmp)+1, &pDataOut[i*3], 3);
buff[i] = (float)(tmp >> 8) / ((1<<23)-1);
- } else if(fPCM && wfe->wBitsPerSample == 32) {
+ } else if (fPCM && wfe->wBitsPerSample == 32) {
buff[i] = (double)((int*)pDataOut)[i] / INT_MAX;
- } else if(fFloat && wfe->wBitsPerSample == 32) {
+ } else if (fFloat && wfe->wBitsPerSample == 32) {
buff[i] = (double)((float*)pDataOut)[i];
- } else if(fFloat && wfe->wBitsPerSample == 64) {
+ } else if (fFloat && wfe->wBitsPerSample == 64) {
buff[i] = ((double*)pDataOut)[i];
}
}
double sample_mul = 1;
- if(m_fNormalize) {
- for(int i = 0; i < samples; i++) {
+ if (m_fNormalize) {
+ for (int i = 0; i < samples; i++) {
double s = buff[i];
- if(s < 0) {
+ if (s < 0) {
s = -s;
}
- if(s > 1) {
+ if (s > 1) {
s = 1;
}
- if(m_sample_max < s) {
+ if (m_sample_max < s) {
m_sample_max = s;
}
}
sample_mul = 1.0f / m_sample_max;
- if(m_fNormalizeRecover) {
+ if (m_fNormalizeRecover) {
m_sample_max -= 1.0*rtDur/200000000; // -5%/sec
}
- if(m_sample_max < 0.1) {
+ if (m_sample_max < 0.1) {
m_sample_max = 0.1;
}
}
- if(m_boost_mul > 1) {
+ if (m_boost_mul > 1) {
sample_mul *= m_boost_mul;
}
- for(int i = 0; i < samples; i++) {
+ for (int i = 0; i < samples; i++) {
double s = buff[i] * sample_mul;
- if(fPCM && wfe->wBitsPerSample == 8) {
+ if (fPCM && wfe->wBitsPerSample == 8) {
((BYTE*)pDataOut)[i] = clamp<BYTE>(s, 0, UCHAR_MAX);
- } else if(fPCM && wfe->wBitsPerSample == 16) {
+ } else if (fPCM && wfe->wBitsPerSample == 16) {
((short*)pDataOut)[i] = clamp<short>(s, SHRT_MIN, SHRT_MAX);
- } else if(fPCM && wfe->wBitsPerSample == 24) {
+ } else if (fPCM && wfe->wBitsPerSample == 24) {
int tmp = clamp<int>(s, -1<<23, (1<<23)-1);
memcpy(&pDataOut[i*3], &tmp, 3);
- } else if(fPCM && wfe->wBitsPerSample == 32) {
+ } else if (fPCM && wfe->wBitsPerSample == 32) {
((int*)pDataOut)[i] = clamp<int>(s, INT_MIN, INT_MAX);
- } else if(fFloat && wfe->wBitsPerSample == 32) {
+ } else if (fFloat && wfe->wBitsPerSample == 32) {
((float*)pDataOut)[i] = clamp<float>(s, -1, +1);
- } else if(fFloat && wfe->wBitsPerSample == 64) {
+ } else if (fFloat && wfe->wBitsPerSample == 64) {
((double*)pDataOut)[i] = clamp<double>(s, -1, +1);
}
}
@@ -445,24 +445,24 @@ CMediaType CAudioSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& c
{
CStreamSwitcherInputPin* pInPin = GetInputPin();
CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
- if(!pInPin || !pOutPin || ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF) {
+ if (!pInPin || !pOutPin || ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF) {
return __super::CreateNewOutputMediaType(mt, cbBuffer);
}
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
- if(m_fCustomChannelMapping) {
+ if (m_fCustomChannelMapping) {
m_chs[wfe->nChannels-1].RemoveAll();
DWORD mask = DWORD((__int64(1)<<wfe->nChannels)-1);
- for(int i = 0; i < 18; i++) {
- if(m_pSpeakerToChannelMap[wfe->nChannels-1][i]&mask) {
+ for (int i = 0; i < 18; i++) {
+ if (m_pSpeakerToChannelMap[wfe->nChannels-1][i]&mask) {
ChMap cm = {1<<i, m_pSpeakerToChannelMap[wfe->nChannels-1][i]};
m_chs[wfe->nChannels-1].Add(cm);
}
}
- if(m_chs[wfe->nChannels-1].GetCount() > 0) {
+ if (m_chs[wfe->nChannels-1].GetCount() > 0) {
mt.ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)mt.pbFormat;
wfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
@@ -475,7 +475,7 @@ CMediaType CAudioSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& c
KSDATAFORMAT_SUBTYPE_PCM; // can't happen
wfex->dwChannelMask = 0;
- for(size_t i = 0; i < m_chs[wfe->nChannels-1].GetCount(); i++) {
+ for (size_t i = 0; i < m_chs[wfe->nChannels-1].GetCount(); i++) {
wfex->dwChannelMask |= m_chs[wfe->nChannels-1][i].Speaker;
}
@@ -487,8 +487,8 @@ CMediaType CAudioSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& c
WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mt.pbFormat;
- if(m_fDownSampleTo441) {
- if(wfeout->nSamplesPerSec > 44100 && wfeout->wBitsPerSample <= 16) {
+ if (m_fDownSampleTo441) {
+ if (wfeout->nSamplesPerSec > 44100 && wfeout->wBitsPerSample <= 16) {
wfeout->nSamplesPerSec = 44100;
wfeout->nAvgBytesPerSec = wfeout->nBlockAlign*wfeout->nSamplesPerSec;
}
@@ -511,7 +511,7 @@ void CAudioSwitcherFilter::OnNewOutputMediaType(const CMediaType& mtIn, const CM
const WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mtOut.pbFormat;
m_pResamplers.RemoveAll();
- for(int i = 0; i < wfeout->nChannels; i++) {
+ for (int i = 0; i < wfeout->nChannels; i++) {
CAutoPtr<AudioStreamResampler> pResampler;
pResampler.Attach(DNew AudioStreamResampler(wfeout->wBitsPerSample>>3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
m_pResamplers.Add(pResampler);
@@ -539,20 +539,20 @@ HRESULT CAudioSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE
STDMETHODIMP CAudioSwitcherFilter::GetInputSpeakerConfig(DWORD* pdwChannelMask)
{
- if(!pdwChannelMask) {
+ if (!pdwChannelMask) {
return E_POINTER;
}
*pdwChannelMask = 0;
CStreamSwitcherInputPin* pInPin = GetInputPin();
- if(!pInPin || !pInPin->IsConnected()) {
+ if (!pInPin || !pInPin->IsConnected()) {
return E_UNEXPECTED;
}
WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
- if(wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
+ if (wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
*pdwChannelMask = wfex->dwChannelMask;
} else {
@@ -564,7 +564,7 @@ STDMETHODIMP CAudioSwitcherFilter::GetInputSpeakerConfig(DWORD* pdwChannelMask)
STDMETHODIMP CAudioSwitcherFilter::GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
{
- if(pfCustomChannelMapping) {
+ if (pfCustomChannelMapping) {
*pfCustomChannelMapping = m_fCustomChannelMapping;
}
memcpy(pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
@@ -574,7 +574,7 @@ STDMETHODIMP CAudioSwitcherFilter::GetSpeakerConfig(bool* pfCustomChannelMapping
STDMETHODIMP CAudioSwitcherFilter::SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
{
- if(m_State == State_Stopped || m_fCustomChannelMapping != fCustomChannelMapping
+ if (m_State == State_Stopped || m_fCustomChannelMapping != fCustomChannelMapping
|| memcmp(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap))) {
PauseGraph;
@@ -606,7 +606,7 @@ STDMETHODIMP_(bool) CAudioSwitcherFilter::IsDownSamplingTo441Enabled()
STDMETHODIMP CAudioSwitcherFilter::EnableDownSamplingTo441(bool fEnable)
{
- if(m_fDownSampleTo441 != fEnable) {
+ if (m_fDownSampleTo441 != fEnable) {
PauseGraph;
m_fDownSampleTo441 = fEnable;
ResumeGraph;
@@ -636,7 +636,7 @@ STDMETHODIMP CAudioSwitcherFilter::GetNormalizeBoost(bool& fNormalize, bool& fNo
STDMETHODIMP CAudioSwitcherFilter::SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost_dB)
{
- if(m_fNormalize != fNormalize) {
+ if (m_fNormalize != fNormalize) {
m_sample_max = 0.1f;
}
m_fNormalize = fNormalize;
@@ -650,7 +650,7 @@ STDMETHODIMP CAudioSwitcherFilter::SetNormalizeBoost(bool fNormalize, bool fNorm
STDMETHODIMP CAudioSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
{
HRESULT hr = __super::Enable(lIndex, dwFlags);
- if(S_OK == hr) {
+ if (S_OK == hr) {
m_sample_max = 0.1f;
}
return hr;
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
index 6a7f764fd..c37026f45 100644
--- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
+++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
@@ -59,16 +59,16 @@ HRESULT GetPeer(CStreamSwitcherFilter* pFilter, T** ppT)
*ppT = NULL;
CBasePin* pPin = pFilter->GetInputPin();
- if(!pPin) {
+ if (!pPin) {
return E_NOTIMPL;
}
CComPtr<IPin> pConnected;
- if(FAILED(pPin->ConnectedTo(&pConnected))) {
+ if (FAILED(pPin->ConnectedTo(&pConnected))) {
return E_NOTIMPL;
}
- if(CComQIPtr<T> pT = pConnected) {
+ if (CComQIPtr<T> pT = pConnected) {
*ppT = pT.Detach();
return S_OK;
}
@@ -207,7 +207,7 @@ STDMETHODIMP CStreamSwitcherPassThru::GetRate(double* pdRate)
STDMETHODIMP CStreamSwitcherPassThru::SetRate(double dRate)
{
- if(0.0 == dRate) {
+ if (0.0 == dRate) {
return E_INVALIDARG;
}
CallPeerSeekingAll(SetRate(dRate));
@@ -257,7 +257,7 @@ STDMETHODIMP CStreamSwitcherPassThru::get_Rate(double* pdRate)
STDMETHODIMP CStreamSwitcherPassThru::put_Rate(double dRate)
{
- if(0.0 == dRate) {
+ if (0.0 == dRate) {
return E_INVALIDARG;
}
CallPeerAll(put_Rate(dRate));
@@ -310,7 +310,7 @@ STDMETHODIMP CStreamSwitcherAllocator::GetBuffer(
{
HRESULT hr = VFW_E_NOT_COMMITTED;
- if(!m_bCommitted) {
+ if (!m_bCommitted) {
return hr;
}
/*
@@ -318,37 +318,37 @@ STDMETHODIMP CStreamSwitcherAllocator::GetBuffer(
m_pPin->m_evBlock.Wait();
TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this);
*/
- if(m_fMediaTypeChanged) {
- if(!m_pPin || !m_pPin->m_pFilter) {
+ if (m_fMediaTypeChanged) {
+ if (!m_pPin || !m_pPin->m_pFilter) {
return hr;
}
CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pPin->m_pFilter))->GetOutputPin();
- if(!pOut || !pOut->CurrentAllocator()) {
+ if (!pOut || !pOut->CurrentAllocator()) {
return hr;
}
ALLOCATOR_PROPERTIES Properties, Actual;
- if(FAILED(pOut->CurrentAllocator()->GetProperties(&Actual))) {
+ if (FAILED(pOut->CurrentAllocator()->GetProperties(&Actual))) {
return hr;
}
- if(FAILED(GetProperties(&Properties))) {
+ if (FAILED(GetProperties(&Properties))) {
return hr;
}
- if(!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer) {
+ if (!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer) {
Properties.cbBuffer = Actual.cbBuffer;
- if(FAILED(Decommit())) {
+ if (FAILED(Decommit())) {
return hr;
}
- if(FAILED(SetProperties(&Properties, &Actual))) {
+ if (FAILED(SetProperties(&Properties, &Actual))) {
return hr;
}
- if(FAILED(Commit())) {
+ if (FAILED(Commit())) {
return hr;
}
ASSERT(Actual.cbBuffer >= Properties.cbBuffer);
- if(Actual.cbBuffer < Properties.cbBuffer) {
+ if (Actual.cbBuffer < Properties.cbBuffer) {
return hr;
}
}
@@ -356,7 +356,7 @@ STDMETHODIMP CStreamSwitcherAllocator::GetBuffer(
hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
- if(m_fMediaTypeChanged && SUCCEEDED(hr)) {
+ if (m_fMediaTypeChanged && SUCCEEDED(hr)) {
(*ppBuffer)->SetMediaType(&m_mt);
m_fMediaTypeChanged = false;
}
@@ -408,7 +408,7 @@ STDMETHODIMP CStreamSwitcherInputPin::DynamicQueryAccept(const AM_MEDIA_TYPE* pm
STDMETHODIMP CStreamSwitcherInputPin::NotifyEndOfStream(HANDLE hNotifyEvent)
{
- if(m_hNotifyEvent) {
+ if (m_hNotifyEvent) {
SetEvent(m_hNotifyEvent);
}
m_hNotifyEvent = hNotifyEvent;
@@ -443,10 +443,10 @@ HRESULT CStreamSwitcherInputPin::QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt)
CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
- if(pOut && pOut->IsConnected()) {
- if(CComPtr<IPinConnection> pPC = pOut->CurrentPinConnection()) {
+ if (pOut && pOut->IsConnected()) {
+ if (CComPtr<IPinConnection> pPC = pOut->CurrentPinConnection()) {
hr = pPC->DynamicQueryAccept(pmt);
- if(hr == S_OK) {
+ if (hr == S_OK) {
return S_OK;
}
}
@@ -459,7 +459,7 @@ HRESULT CStreamSwitcherInputPin::QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt)
void CStreamSwitcherInputPin::Block(bool fBlock)
{
- if(fBlock) {
+ if (fBlock) {
m_evBlock.Reset();
} else {
m_evBlock.Set();
@@ -468,7 +468,7 @@ void CStreamSwitcherInputPin::Block(bool fBlock)
HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample)
{
- if(!pInSample || !ppOutSample) {
+ if (!pInSample || !ppOutSample) {
return E_POINTER;
}
@@ -479,7 +479,7 @@ HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample,
DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0;
- if(!(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) {
+ if (!(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) {
dwFlags |= AM_GBF_NOTASYNCPOINT;
}
@@ -488,15 +488,15 @@ HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample,
, m_SampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID ? &m_SampleProps.tStop : NULL
, dwFlags);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(!pOutSample) {
+ if (!pOutSample) {
return E_FAIL;
}
- if(CComQIPtr<IMediaSample2> pOutSample2 = pOutSample) {
+ if (CComQIPtr<IMediaSample2> pOutSample2 = pOutSample) {
AM_SAMPLE2_PROPERTIES OutProps;
EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)));
OutProps.dwTypeSpecificFlags = m_SampleProps.dwTypeSpecificFlags;
@@ -509,25 +509,25 @@ HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample,
OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId);
hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), (PBYTE)&OutProps);
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
+ if (m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
m_bSampleSkipped = FALSE;
}
} else {
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) {
+ if (m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) {
pOutSample->SetTime(&m_SampleProps.tStart, &m_SampleProps.tStop);
}
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) {
+ if (m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) {
pOutSample->SetSyncPoint(TRUE);
}
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
+ if (m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
pOutSample->SetDiscontinuity(TRUE);
m_bSampleSkipped = FALSE;
}
LONGLONG MediaStart, MediaEnd;
- if(pInSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR) {
+ if (pInSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR) {
pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
}
}
@@ -556,7 +556,7 @@ HRESULT CStreamSwitcherInputPin::CheckConnect(IPin* pPin)
HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -575,13 +575,13 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
if (pPin) {
pBF = GetFilterFromPin(pPin);
}
- while(pPin && pBF) {
- if(IsSplitter(pBF)) {
+ while (pPin && pBF) {
+ if (IsSplitter(pBF)) {
pinName = GetPinName(pPin);
}
CLSID clsid = GetCLSID(pBF);
- if(clsid == CLSID_AviSplitter || clsid == CLSID_OggSplitter) {
+ if (clsid == CLSID_AviSplitter || clsid == CLSID_OggSplitter) {
m_fCanBlock = true;
}
@@ -589,29 +589,29 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
CountPins(pBF, nIn, nOut, nInC, nOutC);
fForkedSomewhere = fForkedSomewhere || nIn > 1 || nOut > 1;
- if(CComQIPtr<IFileSourceFilter> pFSF = pBF) {
+ if (CComQIPtr<IFileSourceFilter> pFSF = pBF) {
WCHAR* pszName = NULL;
AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pszName, &mt)) && pszName) {
+ if (SUCCEEDED(pFSF->GetCurFile(&pszName, &mt)) && pszName) {
fileName = pszName;
CoTaskMemFree(pszName);
fileName.Replace('\\', '/');
CStringW fn = fileName.Mid(fileName.ReverseFind('/')+1);
- if(!fn.IsEmpty()) {
+ if (!fn.IsEmpty()) {
fileName = fn;
}
// Haali & LAVFSplitter return only one "Audio" pin name, cause CMainFrame::OnInitMenuPopup lookup find the wrong popmenu,
// add space at the end to prevent this, internal filter never return "Audio" only.
- if(!pinName.IsEmpty()) {
+ if (!pinName.IsEmpty()) {
fileName = pinName + L" ";
}
WCHAR* pName = DNew WCHAR[fileName.GetLength()+1];
- if(pName) {
+ if (pName) {
wcscpy(pName, fileName);
- if(m_pName) {
+ if (m_pName) {
delete [] m_pName;
}
m_pName = pName;
@@ -629,7 +629,7 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
}
}
- if(!fForkedSomewhere) {
+ if (!fForkedSomewhere) {
m_fCanBlock = true;
}
@@ -657,7 +657,7 @@ HRESULT CStreamSwitcherInputPin::Inactive()
STDMETHODIMP CStreamSwitcherInputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
{
HRESULT hr = __super::QueryAccept(pmt);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -670,15 +670,15 @@ STDMETHODIMP CStreamSwitcherInputPin::ReceiveConnection(IPin* pConnector, const
// CAutoLock cAutoLock(&((CStreamSwitcherFilter*)m_pFilter)->m_csReceive);
HRESULT hr;
- if(S_OK != (hr = QueryAcceptDownstream(pmt))) {
+ if (S_OK != (hr = QueryAcceptDownstream(pmt))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(m_Connected && m_Connected != pConnector) {
+ if (m_Connected && m_Connected != pConnector) {
return VFW_E_ALREADY_CONNECTED;
}
- if(m_Connected) {
+ if (m_Connected) {
m_Connected->Release(), m_Connected = NULL;
}
@@ -689,7 +689,7 @@ STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
{
CheckPointer(ppAllocator, E_POINTER);
- if(m_pAllocator == NULL) {
+ if (m_pAllocator == NULL) {
(m_pAllocator = &m_Allocator)->AddRef();
}
@@ -701,7 +701,7 @@ STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
STDMETHODIMP CStreamSwitcherInputPin::NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly)
{
HRESULT hr = __super::NotifyAllocator(pAllocator, bReadOnly);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -719,11 +719,11 @@ STDMETHODIMP CStreamSwitcherInputPin::BeginFlush()
CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
- if(!IsConnected() || !pOut || !pOut->IsConnected()) {
+ if (!IsConnected() || !pOut || !pOut->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
- if(FAILED(hr = __super::BeginFlush())) {
+ if (FAILED(hr = __super::BeginFlush())) {
return hr;
}
@@ -739,11 +739,11 @@ STDMETHODIMP CStreamSwitcherInputPin::EndFlush()
CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
- if(!IsConnected() || !pOut || !pOut->IsConnected()) {
+ if (!IsConnected() || !pOut || !pOut->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
- if(FAILED(hr = __super::EndFlush())) {
+ if (FAILED(hr = __super::EndFlush())) {
return hr;
}
@@ -757,11 +757,11 @@ STDMETHODIMP CStreamSwitcherInputPin::EndOfStream()
CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
- if(!IsConnected() || !pOut || !pOut->IsConnected()) {
+ if (!IsConnected() || !pOut || !pOut->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
- if(m_hNotifyEvent) {
+ if (m_hNotifyEvent) {
SetEvent(m_hNotifyEvent), m_hNotifyEvent = NULL;
return S_OK;
}
@@ -774,7 +774,7 @@ STDMETHODIMP CStreamSwitcherInputPin::EndOfStream()
STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
{
AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
const CMediaType mt(*pmt);
DeleteMediaType(pmt), pmt = NULL;
SetMediaType(&mt);
@@ -786,14 +786,14 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
// strategy is useless because of this, ARRRRRRGHHHHHH.
#ifdef BLOCKSTREAM
- if(m_fCanBlock) {
+ if (m_fCanBlock) {
m_evBlock.Wait();
}
#endif
- if(!IsActive()) {
+ if (!IsActive()) {
#ifdef BLOCKSTREAM
- if(m_fCanBlock) {
+ if (m_fCanBlock) {
return S_FALSE;
}
#endif
@@ -809,11 +809,11 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
ASSERT(pOut->GetConnected());
HRESULT hr = __super::Receive(pSample);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
- if(m_SampleProps.dwStreamId != AM_STREAM_MEDIA) {
+ if (m_SampleProps.dwStreamId != AM_STREAM_MEDIA) {
return pOut->Deliver(pSample);
}
@@ -824,7 +824,7 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
hr = pOut->CurrentAllocator()->GetProperties(&actual);
REFERENCE_TIME rtStart = 0, rtStop = 0;
- if(S_OK == pSample->GetTime(&rtStart, &rtStop)) {
+ if (S_OK == pSample->GetTime(&rtStart, &rtStop)) {
//
}
@@ -835,7 +835,7 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
bool fTypeChanged = false;
- if(mtOut != pOut->CurrentMediaType() || cbBuffer > actual.cbBuffer) {
+ if (mtOut != pOut->CurrentMediaType() || cbBuffer > actual.cbBuffer) {
fTypeChanged = true;
m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED/*|AM_SAMPLE_DATADISCONTINUITY|AM_SAMPLE_TIMEDISCONTINUITY*/;
@@ -853,13 +853,13 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
}
*/
- if(props.cBuffers < 8 && mtOut.majortype == MEDIATYPE_Audio) {
+ if (props.cBuffers < 8 && mtOut.majortype == MEDIATYPE_Audio) {
props.cBuffers = 8;
}
props.cbBuffer = cbBuffer;
- if(actual.cbAlign != props.cbAlign
+ if (actual.cbAlign != props.cbAlign
|| actual.cbPrefix != props.cbPrefix
|| actual.cBuffers < props.cBuffers
|| actual.cbBuffer < props.cbBuffer) {
@@ -872,19 +872,19 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
}
CComPtr<IMediaSample> pOutSample;
- if(FAILED(InitializeOutputSample(pSample, &pOutSample))) {
+ if (FAILED(InitializeOutputSample(pSample, &pOutSample))) {
return E_FAIL;
}
pmt = NULL;
- if(SUCCEEDED(pOutSample->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pOutSample->GetMediaType(&pmt)) && pmt) {
const CMediaType mt(*pmt);
DeleteMediaType(pmt), pmt = NULL;
// TODO
ASSERT(0);
}
- if(fTypeChanged) {
+ if (fTypeChanged) {
pOut->SetMediaType(&mtOut);
(static_cast<CStreamSwitcherFilter*>(m_pFilter))->OnNewOutputMediaType(m_mt, mtOut);
pOutSample->SetMediaType(&mtOut);
@@ -896,7 +896,7 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
//
- if(S_OK == hr) {
+ if (S_OK == hr) {
hr = pOut->Deliver(pOutSample);
m_bSampleSkipped = FALSE;
/*
@@ -905,12 +905,12 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
ASSERT(0);
}
*/
- } else if(S_FALSE == hr) {
+ } else if (S_FALSE == hr) {
hr = S_OK;
pOutSample = NULL;
m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged) {
+ if (!m_bQualityChanged) {
m_pFilter->NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
m_bQualityChanged = TRUE;
}
@@ -921,7 +921,7 @@ STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- if(!IsConnected()) {
+ if (!IsConnected()) {
return S_OK;
}
@@ -930,7 +930,7 @@ STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENC
CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
- if(!pOut || !pOut->IsConnected()) {
+ if (!pOut || !pOut->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
@@ -953,16 +953,16 @@ STDMETHODIMP CStreamSwitcherOutputPin::NonDelegatingQueryInterface(REFIID riid,
ValidateReadWritePtr(ppv, sizeof(PVOID));
*ppv = NULL;
- if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking) {
- if(m_pStreamSwitcherPassThru == NULL) {
+ if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) {
+ if (m_pStreamSwitcherPassThru == NULL) {
HRESULT hr = S_OK;
m_pStreamSwitcherPassThru = (IUnknown*)(INonDelegatingUnknown*)
DNew CStreamSwitcherPassThru(GetOwner(), &hr, static_cast<CStreamSwitcherFilter*>(m_pFilter));
- if(!m_pStreamSwitcherPassThru) {
+ if (!m_pStreamSwitcherPassThru) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -984,9 +984,9 @@ HRESULT CStreamSwitcherOutputPin::QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt)
CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(pIn && pIn->IsConnected() && (pIn->IsUsingOwnAllocator() || pIn->CurrentMediaType() == *pmt)) {
- if(CComQIPtr<IPin> pPinTo = pIn->GetConnected()) {
- if(S_OK != (hr = pPinTo->QueryAccept(pmt))) {
+ if (pIn && pIn->IsConnected() && (pIn->IsUsingOwnAllocator() || pIn->CurrentMediaType() == *pmt)) {
+ if (CComQIPtr<IPin> pPinTo = pIn->GetConnected()) {
+ if (S_OK != (hr = pPinTo->QueryAccept(pmt))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
} else {
@@ -1002,27 +1002,27 @@ HRESULT CStreamSwitcherOutputPin::QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt)
HRESULT CStreamSwitcherOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) {
+ if (!pIn || !pIn->IsConnected()) {
return E_UNEXPECTED;
}
CComPtr<IMemAllocator> pAllocatorIn;
pIn->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
HRESULT hr;
- if(FAILED(hr = pAllocatorIn->GetProperties(pProperties))) {
+ if (FAILED(hr = pAllocatorIn->GetProperties(pProperties))) {
return hr;
}
- if(pProperties->cBuffers < 8 && pIn->CurrentMediaType().majortype == MEDIATYPE_Audio) {
+ if (pProperties->cBuffers < 8 && pIn->CurrentMediaType().majortype == MEDIATYPE_Audio) {
pProperties->cBuffers = 8;
}
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -1069,21 +1069,21 @@ HRESULT CStreamSwitcherOutputPin::CheckMediaType(const CMediaType* pmt)
HRESULT CStreamSwitcherOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) {
+ if (!pIn || !pIn->IsConnected()) {
return E_UNEXPECTED;
}
CComPtr<IEnumMediaTypes> pEM;
- if(FAILED(pIn->GetConnected()->EnumMediaTypes(&pEM))) {
+ if (FAILED(pIn->GetConnected()->EnumMediaTypes(&pEM))) {
return VFW_S_NO_MORE_ITEMS;
}
- if(iPosition > 0 && FAILED(pEM->Skip(iPosition))) {
+ if (iPosition > 0 && FAILED(pEM->Skip(iPosition))) {
return VFW_S_NO_MORE_ITEMS;
}
AM_MEDIA_TYPE* tmp = NULL;
- if(S_OK != pEM->Next(1, &tmp, NULL) || !tmp) {
+ if (S_OK != pEM->Next(1, &tmp, NULL) || !tmp) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -1103,7 +1103,7 @@ HRESULT CStreamSwitcherOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
STDMETHODIMP CStreamSwitcherOutputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
{
HRESULT hr = __super::QueryAccept(pmt);
- if(S_OK != hr) {
+ if (S_OK != hr) {
return hr;
}
@@ -1115,7 +1115,7 @@ STDMETHODIMP CStreamSwitcherOutputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
STDMETHODIMP CStreamSwitcherOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) {
+ if (!pIn || !pIn->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
return pIn->PassNotify(q);
@@ -1127,11 +1127,11 @@ STDMETHODIMP CStreamSwitcherOutputPin::Render(IPin* ppinOut, IGraphBuilder* pGra
{
CComPtr<IBaseFilter> pBF;
pBF.CoCreateInstance(CLSID_DSoundRender);
- if(!pBF || FAILED(pGraph->AddFilter(pBF, L"Default DirectSound Device"))) {
+ if (!pBF || FAILED(pGraph->AddFilter(pBF, L"Default DirectSound Device"))) {
return E_FAIL;
}
- if(FAILED(pGraph->ConnectDirect(ppinOut, GetFirstDisconnectedPin(pBF, PINDIR_INPUT), NULL))) {
+ if (FAILED(pGraph->ConnectDirect(ppinOut, GetFirstDisconnectedPin(pBF, PINDIR_INPUT), NULL))) {
pGraph->RemoveFilter(pBF);
return E_FAIL;
}
@@ -1151,7 +1151,7 @@ STDMETHODIMP CStreamSwitcherOutputPin::Backout(IPin* ppinOut, IGraphBuilder* pGr
CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
: CBaseFilter(NAME("CStreamSwitcherFilter"), lpunk, &m_csState, clsid)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -1163,13 +1163,13 @@ CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, cons
hr = S_OK;
pInput.Attach(DNew CStreamSwitcherInputPin(this, &hr, L"Channel 1"));
- if(!pInput || FAILED(hr)) {
+ if (!pInput || FAILED(hr)) {
break;
}
hr = S_OK;
pOutput.Attach(DNew CStreamSwitcherOutputPin(this, &hr));
- if(!pOutput || FAILED(hr)) {
+ if (!pOutput || FAILED(hr)) {
break;
}
@@ -1179,9 +1179,9 @@ CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, cons
m_pOutput = pOutput.Detach();
return;
- } while(false);
+ } while (false);
- if(phr) {
+ if (phr) {
*phr = E_FAIL;
}
}
@@ -1191,7 +1191,7 @@ CStreamSwitcherFilter::~CStreamSwitcherFilter()
CAutoLock cAutoLock(&m_csPins);
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
delete m_pInputs.GetNext(pos);
}
m_pInputs.RemoveAll();
@@ -1221,9 +1221,9 @@ CBasePin* CStreamSwitcherFilter::GetPin(int n)
{
CAutoLock cAutoLock(&m_csPins);
- if(n < 0 || n >= GetPinCount()) {
+ if (n < 0 || n >= GetPinCount()) {
return NULL;
- } else if(n == 0) {
+ } else if (n == 0) {
return m_pOutput;
} else {
return m_pInputs.GetAt(m_pInputs.FindIndex(n-1));
@@ -1237,8 +1237,8 @@ int CStreamSwitcherFilter::GetConnectedInputPinCount()
int nConnected = 0;
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
- if(m_pInputs.GetNext(pos)->IsConnected()) {
+ while (pos) {
+ if (m_pInputs.GetNext(pos)->IsConnected()) {
nConnected++;
}
}
@@ -1248,12 +1248,12 @@ int CStreamSwitcherFilter::GetConnectedInputPinCount()
CStreamSwitcherInputPin* CStreamSwitcherFilter::GetConnectedInputPin(int n)
{
- if(n >= 0) {
+ if (n >= 0) {
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected()) {
- if(n == 0) {
+ if (pPin->IsConnected()) {
+ if (n == 0) {
return(pPin);
}
n--;
@@ -1278,22 +1278,22 @@ CStreamSwitcherOutputPin* CStreamSwitcherFilter::GetOutputPin()
HRESULT CStreamSwitcherFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin)
{
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CAutoLock cAutoLock(&m_csPins);
int nConnected = GetConnectedInputPinCount();
- if(nConnected == 1) {
+ if (nConnected == 1) {
m_pInput = static_cast<CStreamSwitcherInputPin*>(pPin);
}
- if((size_t)nConnected == m_pInputs.GetCount()) {
+ if ((size_t)nConnected == m_pInputs.GetCount()) {
CStringW name;
name.Format(L"Channel %d", ++m_PinVersion);
HRESULT hr = S_OK;
CStreamSwitcherInputPin* pPin = DNew CStreamSwitcherInputPin(this, &hr, name);
- if(!pPin || FAILED(hr)) {
+ if (!pPin || FAILED(hr)) {
delete pPin;
return E_FAIL;
}
@@ -1313,7 +1313,7 @@ void CStreamSwitcherFilter::SelectInput(CStreamSwitcherInputPin* pInput)
// release blocked GetBuffer in our own allocator & block all Receive
POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) {
+ while (pos) {
CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
pPin->Block(false);
// a few Receive calls can arrive here, but since m_pInput == NULL neighter of them gets delivered
@@ -1321,12 +1321,12 @@ void CStreamSwitcherFilter::SelectInput(CStreamSwitcherInputPin* pInput)
}
// this will let waiting GetBuffer() calls go on inside our Receive()
- if(m_pOutput) {
+ if (m_pOutput) {
m_pOutput->DeliverBeginFlush();
m_pOutput->DeliverEndFlush();
}
- if(!pInput) {
+ if (!pInput) {
return;
}
@@ -1345,17 +1345,17 @@ HRESULT CStreamSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
BYTE* pDataOut = NULL;
HRESULT hr;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
- if(FAILED(hr = pOut->GetPointer(&pDataOut))) {
+ if (FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
long len = pIn->GetActualDataLength();
long size = pOut->GetSize();
- if(!pDataIn || !pDataOut /*|| len > size || len <= 0*/) {
+ if (!pDataIn || !pDataOut /*|| len > size || len <= 0*/) {
return S_FALSE; // FIXME
}
@@ -1394,7 +1394,7 @@ HRESULT CStreamSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENC
STDMETHODIMP CStreamSwitcherFilter::Count(DWORD* pcStreams)
{
- if(!pcStreams) {
+ if (!pcStreams) {
return E_POINTER;
}
@@ -1410,38 +1410,38 @@ STDMETHODIMP CStreamSwitcherFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWOR
CAutoLock cAutoLock(&m_csPins);
CBasePin* pPin = GetConnectedInputPin(lIndex);
- if(!pPin) {
+ if (!pPin) {
return E_INVALIDARG;
}
- if(ppmt) {
+ if (ppmt) {
*ppmt = CreateMediaType(&m_pOutput->CurrentMediaType());
}
- if(pdwFlags) {
+ if (pdwFlags) {
*pdwFlags = (m_pInput == pPin) ? AMSTREAMSELECTINFO_EXCLUSIVE : 0;
}
- if(plcid) {
+ if (plcid) {
*plcid = 0;
}
- if(pdwGroup) {
+ if (pdwGroup) {
*pdwGroup = 0;
}
- if(ppszName) {
+ if (ppszName) {
*ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name())+1)*sizeof(WCHAR));
- if(*ppszName) {
+ if (*ppszName) {
wcscpy(*ppszName, pPin->Name());
}
}
- if(ppObject) {
+ if (ppObject) {
*ppObject = NULL;
}
- if(ppUnk) {
+ if (ppUnk) {
*ppUnk = NULL;
}
@@ -1450,14 +1450,14 @@ STDMETHODIMP CStreamSwitcherFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWOR
STDMETHODIMP CStreamSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(dwFlags != AMSTREAMSELECTENABLE_ENABLE) {
+ if (dwFlags != AMSTREAMSELECTENABLE_ENABLE) {
return E_NOTIMPL;
}
PauseGraph;
CStreamSwitcherInputPin* pNewInput = GetConnectedInputPin(lIndex);
- if(!pNewInput) {
+ if (!pNewInput) {
return E_INVALIDARG;
}
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
index f905c59c1..bd79a7b91 100644
--- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
+++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
@@ -76,7 +76,7 @@ CFilterApp theApp;
CAVI2AC3Filter::CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr)
: CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -90,45 +90,45 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
HRESULT hr;
BYTE* pIn = NULL;
- if(FAILED(hr = pSample->GetPointer(&pIn))) {
+ if (FAILED(hr = pSample->GetPointer(&pIn))) {
return hr;
}
BYTE* pInOrg = pIn;
long len = pSample->GetActualDataLength();
- if(len <= 0) {
+ if (len <= 0) {
return S_FALSE;
}
BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) {
+ if (FAILED(hr = pOutSample->GetPointer(&pOut))) {
return hr;
}
BYTE* pOutOrg = pOut;
int size = pOutSample->GetSize();
- if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ if ((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
&& (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType()))) {
- if(*(DWORD*)pIn == 0xBA010000) {
+ if (*(DWORD*)pIn == 0xBA010000) {
pIn += 14;
}
- if(*(DWORD*)pIn == 0xBD010000) {
+ if (*(DWORD*)pIn == 0xBD010000) {
pIn += 8 + 1 + pIn[8] + 1 + 3;
}
len -= (pInOrg - pIn);
- if(size < len) {
+ 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
+ } 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;
@@ -137,15 +137,15 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
int pos = 0;
- while(pos < len) {
+ while (pos < len) {
int curlen = min(len - pos, 2013);
pos += 2013;
CComPtr<IMediaSample> pOutSample;
hr = InitializeOutputSample(pSample, &pOutSample);
- if(fDiscontinuity) {
- if(fHasTime) {
+ if (fDiscontinuity) {
+ if (fHasTime) {
rtStop = rtStart + (rtStop - rtStart) * curlen / len;
pOutSample->SetTime(&rtStart, &rtStop);
}
@@ -157,7 +157,7 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
}
BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) {
+ if (FAILED(hr = pOutSample->GetPointer(&pOut))) {
return hr;
}
BYTE* pOutOrg = pOut;
@@ -167,8 +167,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
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) {
+ if (*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK) {
+ if (size < curlen + 32 + 3) {
return E_FAIL;
}
@@ -184,8 +184,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
majortype = &MEDIATYPE_MPEG2_PES;
}
- if(*majortype == MEDIATYPE_MPEG2_PES) {
- if(size < curlen + 20 + 3) {
+ if (*majortype == MEDIATYPE_MPEG2_PES) {
+ if (size < curlen + 20 + 3) {
return E_FAIL;
}
@@ -205,22 +205,22 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
Private1Header[4] = (packetlen>>8)&0xff;
Private1Header[5] = packetlen&0xff;
- if(*subtype == MEDIASUBTYPE_DTS) {
+ if (*subtype == MEDIASUBTYPE_DTS) {
Private1Header[17] += 8;
}
- if(*subtype == MEDIASUBTYPE_DOLBY_AC3) {
- for(int i = 0; i < curlen; i++) {
- if(*(DWORD*)&pIn[i] == 0x770B) {
+ 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) {
+ } 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;
@@ -235,8 +235,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
majortype = &MEDIATYPE_Audio;
}
- if(*majortype == MEDIATYPE_Audio) {
- if(size < curlen) {
+ if (*majortype == MEDIATYPE_Audio) {
+ if (size < curlen) {
return E_FAIL;
}
memcpy(pOut, pIn, curlen);
@@ -254,8 +254,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
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) {
+ if (*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK) {
+ if (size < len + 32 + 3) {
return E_FAIL;
}
@@ -271,8 +271,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
majortype = &MEDIATYPE_MPEG2_PES;
}
- if(*majortype == MEDIATYPE_MPEG2_PES) {
- if(size < len + 20 + 3) {
+ if (*majortype == MEDIATYPE_MPEG2_PES) {
+ if (size < len + 20 + 3) {
return E_FAIL;
}
@@ -292,7 +292,7 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
Private1Header[4] = (packetlen>>8)&0xff;
Private1Header[5] = packetlen&0xff;
- if(*subtype == MEDIASUBTYPE_DTS) {
+ if (*subtype == MEDIASUBTYPE_DTS) {
Private1Header[17] += 8;
}
@@ -302,8 +302,8 @@ HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSampl
majortype = &MEDIATYPE_Audio;
}
- if(*majortype == MEDIATYPE_Audio) {
- if(size < len) {
+ if (*majortype == MEDIATYPE_Audio) {
+ if (size < len) {
return E_FAIL;
}
@@ -375,13 +375,13 @@ HRESULT CAVI2AC3Filter::CheckTransform(const CMediaType* mtIn, const CMediaType*
HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
CComPtr<IMemAllocator> pAllocatorIn;
m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
@@ -394,7 +394,7 @@ HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PR
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -405,7 +405,7 @@ HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PR
HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -413,11 +413,11 @@ HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
const GUID& subtype = m_pInput->CurrentMediaType().subtype;
UNUSED_ALWAYS(majortype);
- if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType())) {
- if(iPosition < 0) {
+ if (CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType())) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -433,24 +433,24 @@ HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
wfe->nChannels = 2;
wfe->nBlockAlign = 1;
- if(subtype == MEDIASUBTYPE_DOLBY_AC3) {
+ if (subtype == MEDIASUBTYPE_DOLBY_AC3) {
pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- } else if(subtype == MEDIASUBTYPE_DTS) {
+ } 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) {
+ } else if (CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType())) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 4) {
+ if (iPosition > 4) {
return VFW_S_NO_MORE_ITEMS;
}
- if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
+ if (subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3) {
pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
pMediaType->formattype = FORMAT_WaveFormatEx;
@@ -464,7 +464,7 @@ HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
wfe->wfx.nSamplesPerSec = 48000;
wfe->wfx.nChannels = 6;
wfe->bBigEndian = TRUE;
- } else if(subtype == MEDIASUBTYPE_WAVE_DTS) {
+ } else if (subtype == MEDIASUBTYPE_WAVE_DTS) {
pMediaType->subtype = MEDIASUBTYPE_DTS;
pMediaType->formattype = FORMAT_WaveFormatEx;
@@ -479,7 +479,7 @@ HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
return E_INVALIDARG;
}
- switch(iPosition) {
+ switch (iPosition) {
case 0:
pMediaType->majortype = MEDIATYPE_Audio;
break;
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
index efc3db23d..d3f08c13a 100644
--- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
+++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
@@ -37,23 +37,23 @@ CBaseVideoFilter::CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr,
: CTransformFilter(pName, lpunk, clsid)
, m_cBuffers(cBuffers)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
m_pInput = DNew CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video");
- if(!m_pInput) {
+ if (!m_pInput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
m_pOutput = DNew CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output");
- if(!m_pOutput) {
+ if (!m_pOutput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
delete m_pInput, m_pInput = NULL;
return;
}
@@ -84,7 +84,7 @@ int CBaseVideoFilter::GetPinCount()
CBasePin* CBaseVideoFilter::GetPin(int n)
{
- switch(n) {
+ switch (n) {
case 0:
return m_pInput;
case 1:
@@ -105,18 +105,18 @@ HRESULT CBaseVideoFilter::Receive(IMediaSample* pIn)
HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA) {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pIn);
}
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
m_pInput->SetMediaType(&mt);
DeleteMediaType(pmt);
}
- if(FAILED(hr = Transform(pIn))) {
+ if (FAILED(hr = Transform(pIn))) {
return hr;
}
@@ -129,16 +129,16 @@ HRESULT CBaseVideoFilter::GetDeliveryBuffer(int w, int h, IMediaSample** ppOut)
HRESULT hr;
- if(FAILED(hr = ReconnectOutput(w, h))) {
+ if (FAILED(hr = ReconnectOutput(w, h))) {
return hr;
}
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(ppOut, NULL, NULL, 0))) {
+ if (FAILED(hr = m_pOutput->GetDeliveryBuffer(ppOut, NULL, NULL, 0))) {
return hr;
}
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED((*ppOut)->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED((*ppOut)->GetMediaType(&pmt)) && pmt) {
CMediaType mt = *pmt;
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -149,7 +149,7 @@ HRESULT CBaseVideoFilter::GetDeliveryBuffer(int w, int h, IMediaSample** ppOut)
// FIXME: hell knows why but without this the overlay mixer starts very skippy
// (don't enable this for other renderers, the old for example will go crazy if you do)
- if(GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer) {
+ if (GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer) {
(*ppOut)->SetDiscontinuity(TRUE);
}
@@ -161,10 +161,10 @@ HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int re
CMediaType& mt = m_pOutput->CurrentMediaType();
bool m_update_aspect = false;
- if(f_need_set_aspect) {
+ if (f_need_set_aspect) {
int wout = 0, hout = 0, arxout = 0, aryout = 0;
ExtractDim(&mt, wout, hout, arxout, aryout);
- if(arxout != m_arx || aryout != m_ary) {
+ if (arxout != m_arx || aryout != m_ary) {
TRACE(_T("\nCBaseVideoFilter::ReconnectOutput; wout = %d, hout = %d, current = %dx%d, set = %dx%d\n"), wout, hout, arxout, aryout, m_arx, m_ary);
m_update_aspect = true;
}
@@ -174,7 +174,7 @@ HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int re
int h_org = m_h;
bool fForceReconnection = false;
- if(w != m_w || h != m_h) {
+ if (w != m_w || h != m_h) {
fForceReconnection = true;
m_w = w;
m_h = h;
@@ -182,15 +182,15 @@ HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int re
HRESULT hr = S_OK;
- if(m_update_aspect || fForceReconnection || m_w != m_wout || m_h != m_hout || m_arx != m_arxout || m_ary != m_aryout) {
- if(GetCLSID(m_pOutput->GetConnected()) == CLSID_VideoRenderer) {
+ if (m_update_aspect || fForceReconnection || m_w != m_wout || m_h != m_hout || m_arx != m_arxout || m_ary != m_aryout) {
+ if (GetCLSID(m_pOutput->GetConnected()) == CLSID_VideoRenderer) {
NotifyEvent(EC_ERRORABORT, 0, 0);
return E_FAIL;
}
BITMAPINFOHEADER* bmi = NULL;
- if(mt.formattype == FORMAT_VideoInfo) {
+ if (mt.formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.Format();
if (realWidth > 0 && realHeight > 0) {
SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
@@ -202,7 +202,7 @@ HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int re
bmi = &vih->bmiHeader;
bmi->biXPelsPerMeter = m_w * m_ary;
bmi->biYPelsPerMeter = m_h * m_arx;
- } else if(mt.formattype == FORMAT_VideoInfo2) {
+ } else if (mt.formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)mt.Format();
if (realWidth > 0 && realHeight > 0) {
SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
@@ -226,12 +226,12 @@ HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int re
ASSERT(SUCCEEDED(hr)); // should better not fail, after all "mt" is the current media type, just with a different resolution
HRESULT hr1 = 0;
CComPtr<IMediaSample> pOut;
- if(SUCCEEDED(hr1 = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt))) {
+ if (SUCCEEDED(hr1 = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt))) {
if (bSendSample) {
HRESULT hr2 = 0;
if (SUCCEEDED(hr2 = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))) {
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt) {
CMediaType mt = *pmt;
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -275,19 +275,19 @@ HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int
int pitchOut = 0;
- if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
+ if (bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
- if(bihOut.biHeight > 0) {
+ if (bihOut.biHeight > 0) {
pOut += pitchOut*(h-1);
pitchOut = -pitchOut;
- if(h < 0) {
+ if (h < 0) {
h = -h;
}
}
}
- if(h < 0) {
+ if (h < 0) {
h = -h;
ppIn[0] += pitchIn*(h-1);
ppIn[1] += (pitchIn>>1)*((h>>1)-1);
@@ -295,12 +295,12 @@ HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int
pitchIn = -pitchIn;
}
- if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12) {
+ if (subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12) {
BYTE* pIn = ppIn[0];
BYTE* pInU = ppIn[1];
BYTE* pInV = ppIn[2];
- if(subtype == MEDIASUBTYPE_YV12) {
+ if (subtype == MEDIASUBTYPE_YV12) {
BYTE* tmp = pInU;
pInU = pInV;
pInV = tmp;
@@ -309,7 +309,7 @@ HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int
BYTE* pOutU = pOut + bihOut.biWidth*h;
BYTE* pOutV = pOut + bihOut.biWidth*h*5/4;
- if(bihOut.biCompression == '21VY') {
+ if (bihOut.biCompression == '21VY') {
BYTE* tmp = pOutU;
pOutU = pOutV;
pOutV = tmp;
@@ -317,43 +317,43 @@ HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int
ASSERT(w <= abs(pitchIn));
- if(bihOut.biCompression == '2YUY') {
+ if (bihOut.biCompression == '2YUY') {
if (!fInterlaced) {
BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn);
} else {
BitBltFromI420ToYUY2Interlaced(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn);
}
- } else if(bihOut.biCompression == '024I' || bihOut.biCompression == 'VUYI' || bihOut.biCompression == '21VY') {
+ } else if (bihOut.biCompression == '024I' || bihOut.biCompression == 'VUYI' || bihOut.biCompression == '21VY') {
BitBltFromI420ToI420(w, h, pOut, pOutU, pOutV, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
- } else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
- if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn)) {
- for(int y = 0; y < h; y++, pOut += pitchOut) {
+ } else if (bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
+ if (!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn)) {
+ for (int y = 0; y < h; y++, pOut += pitchOut) {
memset(pOut, 0, pitchOut);
}
}
}
- } else if(subtype == MEDIASUBTYPE_YUY2) {
- if(bihOut.biCompression == '2YUY') {
+ } else if (subtype == MEDIASUBTYPE_YUY2) {
+ if (bihOut.biCompression == '2YUY') {
BitBltFromYUY2ToYUY2(w, h, pOut, bihOut.biWidth*2, ppIn[0], pitchIn);
- } else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
- if(!BitBltFromYUY2ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn)) {
- for(int y = 0; y < h; y++, pOut += pitchOut) {
+ } else if (bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
+ if (!BitBltFromYUY2ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn)) {
+ for (int y = 0; y < h; y++, pOut += pitchOut) {
memset(pOut, 0, pitchOut);
}
}
}
- } else if(subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565) {
+ } else if (subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565) {
int sbpp =
subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 ? 32 :
subtype == MEDIASUBTYPE_RGB24 ? 24 :
subtype == MEDIASUBTYPE_RGB565 ? 16 : 0;
- if(bihOut.biCompression == '2YUY') {
+ if (bihOut.biCompression == '2YUY') {
// TODO
// BitBltFromRGBToYUY2();
- } else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
- if(!BitBltFromRGBToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn, sbpp)) {
- for(int y = 0; y < h; y++, pOut += pitchOut) {
+ } else if (bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS) {
+ if (!BitBltFromRGBToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn, sbpp)) {
+ for (int y = 0; y < h; y++, pOut += pitchOut) {
memset(pOut, 0, pitchOut);
}
}
@@ -388,15 +388,15 @@ HRESULT CBaseVideoFilter::CheckInputType(const CMediaType* mtIn)
HRESULT CBaseVideoFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(FAILED(CheckInputType(mtIn)) || mtOut->majortype != MEDIATYPE_Video) {
+ if (FAILED(CheckInputType(mtIn)) || mtOut->majortype != MEDIATYPE_Video) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- if(mtIn->majortype == MEDIATYPE_Video
+ if (mtIn->majortype == MEDIATYPE_Video
&& (mtIn->subtype == MEDIASUBTYPE_YV12
|| mtIn->subtype == MEDIASUBTYPE_I420
|| mtIn->subtype == MEDIASUBTYPE_IYUV)) {
- if(mtOut->subtype != MEDIASUBTYPE_YV12
+ if (mtOut->subtype != MEDIASUBTYPE_YV12
&& mtOut->subtype != MEDIASUBTYPE_I420
&& mtOut->subtype != MEDIASUBTYPE_IYUV
&& mtOut->subtype != MEDIASUBTYPE_YUY2
@@ -406,21 +406,21 @@ HRESULT CBaseVideoFilter::CheckTransform(const CMediaType* mtIn, const CMediaTyp
&& mtOut->subtype != MEDIASUBTYPE_RGB565) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- } else if(mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_YUY2)) {
- if(mtOut->subtype != MEDIASUBTYPE_YUY2
+ } else if (mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YUY2)) {
+ if (mtOut->subtype != MEDIASUBTYPE_YUY2
&& mtOut->subtype != MEDIASUBTYPE_ARGB32
&& mtOut->subtype != MEDIASUBTYPE_RGB32
&& mtOut->subtype != MEDIASUBTYPE_RGB24
&& mtOut->subtype != MEDIASUBTYPE_RGB565) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- } else if(mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_ARGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB24
- || mtIn->subtype == MEDIASUBTYPE_RGB565)) {
- if(mtOut->subtype != MEDIASUBTYPE_ARGB32
+ } else if (mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_ARGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB24
+ || mtIn->subtype == MEDIASUBTYPE_RGB565)) {
+ if (mtOut->subtype != MEDIASUBTYPE_ARGB32
&& mtOut->subtype != MEDIASUBTYPE_RGB32
&& mtOut->subtype != MEDIASUBTYPE_RGB24
&& mtOut->subtype != MEDIASUBTYPE_RGB565) {
@@ -443,7 +443,7 @@ HRESULT CBaseVideoFilter::CheckOutputType(const CMediaType& mtOut)
HRESULT CBaseVideoFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -460,7 +460,7 @@ HRESULT CBaseVideoFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -497,7 +497,7 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
VIDEO_OUTPUT_FORMATS* fmts;
int nFormatCount;
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -508,20 +508,20 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
bool fFoundDVDNavigator = false;
CComPtr<IBaseFilter> pBF = this;
CComPtr<IPin> pPin = m_pInput;
- for(; !fFoundDVDNavigator && (pBF = GetUpStreamFilter(pBF, pPin)); pPin = GetFirstPin(pBF)) {
+ for (; !fFoundDVDNavigator && (pBF = GetUpStreamFilter(pBF, pPin)); pPin = GetFirstPin(pBF)) {
fFoundDVDNavigator = !!(GetCLSID(pBF) == CLSID_DVDNavigator);
}
- if(fFoundDVDNavigator || m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2) {
+ if (fFoundDVDNavigator || m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2) {
iPosition = iPosition*2;
}
//
GetOutputFormats (nFormatCount, &fmts);
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition >= 2*nFormatCount) {
+ if (iPosition >= 2*nFormatCount) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -544,7 +544,7 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
bihOut.biCompression = fmts[iPosition/2].biCompression;
bihOut.biSizeImage = w*h*bihOut.biBitCount>>3;
- if(iPosition&1) {
+ if (iPosition&1) {
pmt->formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
memset(vih, 0, sizeof(VIDEOINFOHEADER));
@@ -558,7 +558,7 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
vih->bmiHeader = bihOut;
vih->dwPictAspectRatioX = arx;
vih->dwPictAspectRatioY = ary;
- if(IsVideoInterlaced()) {
+ if (IsVideoInterlaced()) {
vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced | AMINTERLACE_DisplayModeBobOrWeave;
}
}
@@ -599,7 +599,7 @@ HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
{
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
m_w = m_h = m_arx = m_ary = 0;
ExtractDim(pmt, m_w, m_h, m_arx, m_ary);
m_win = m_w;
@@ -612,18 +612,18 @@ HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
GetOutputSize(m_w, m_h, m_arx, m_ary, RealWidth, RealHeight, vsfilter);
DWORD a = m_arx, b = m_ary;
- while(a) {
+ while (a) {
int tmp = a;
a = b % tmp;
b = tmp;
}
- if(b) {
+ if (b) {
m_arx /= b, m_ary /= b;
}
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
int wout = 0, hout = 0, arxout = 0, aryout = 0;
ExtractDim(pmt, wout, hout, arxout, aryout);
- if(m_w == wout && m_h == hout && m_arx == arxout && m_ary == aryout) {
+ if (m_w == wout && m_h == hout && m_arx == arxout && m_ary == aryout) {
m_wout = wout;
m_hout = hout;
m_arxout = arxout;
@@ -641,7 +641,7 @@ HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
CBaseVideoInputAllocator::CBaseVideoInputAllocator(HRESULT* phr)
: CMemAllocator(NAME("CBaseVideoInputAllocator"), NULL, phr)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
}
@@ -653,13 +653,13 @@ void CBaseVideoInputAllocator::SetMediaType(const CMediaType& mt)
STDMETHODIMP CBaseVideoInputAllocator::GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags)
{
- if(!m_bCommitted) {
+ if (!m_bCommitted) {
return VFW_E_NOT_COMMITTED;
}
HRESULT hr = __super::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
- if(SUCCEEDED(hr) && m_mt.majortype != GUID_NULL) {
+ if (SUCCEEDED(hr) && m_mt.majortype != GUID_NULL) {
(*ppBuffer)->SetMediaType(&m_mt);
m_mt.majortype = GUID_NULL;
}
@@ -686,7 +686,7 @@ STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator)
{
CheckPointer(ppAllocator, E_POINTER);
- if(m_pAllocator == NULL) {
+ if (m_pAllocator == NULL) {
HRESULT hr = S_OK;
m_pAllocator = DNew CBaseVideoInputAllocator(&hr);
m_pAllocator->AddRef();
@@ -701,34 +701,34 @@ STDMETHODIMP CBaseVideoInputPin::ReceiveConnection(IPin* pConnector, const AM_ME
{
CAutoLock cObjectLock(m_pLock);
- if(m_Connected) {
+ if (m_Connected) {
CMediaType mt(*pmt);
- if(FAILED(CheckMediaType(&mt))) {
+ if (FAILED(CheckMediaType(&mt))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
ALLOCATOR_PROPERTIES props, actual;
CComPtr<IMemAllocator> pMemAllocator;
- if(FAILED(GetAllocator(&pMemAllocator))
+ if (FAILED(GetAllocator(&pMemAllocator))
|| FAILED(pMemAllocator->Decommit())
|| FAILED(pMemAllocator->GetProperties(&props))) {
return E_FAIL;
}
BITMAPINFOHEADER bih;
- if(ExtractBIH(pmt, &bih) && bih.biSizeImage) {
+ if (ExtractBIH(pmt, &bih) && bih.biSizeImage) {
props.cbBuffer = bih.biSizeImage;
}
- if(FAILED(pMemAllocator->SetProperties(&props, &actual))
+ if (FAILED(pMemAllocator->SetProperties(&props, &actual))
|| FAILED(pMemAllocator->Commit())
|| props.cbBuffer != actual.cbBuffer) {
return E_FAIL;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->SetMediaType(mt);
}
@@ -751,9 +751,9 @@ CBaseVideoOutputPin::CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* p
HRESULT CBaseVideoOutputPin::CheckMediaType(const CMediaType* mtOut)
{
- if(IsConnected()) {
+ if (IsConnected()) {
HRESULT hr = (static_cast<CBaseVideoFilter*>(m_pFilter))->CheckOutputType(*mtOut);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
diff --git a/src/filters/transform/BufferFilter/BufferFilter.cpp b/src/filters/transform/BufferFilter/BufferFilter.cpp
index 51f021b8a..9c624f96c 100644
--- a/src/filters/transform/BufferFilter/BufferFilter.cpp
+++ b/src/filters/transform/BufferFilter/BufferFilter.cpp
@@ -76,24 +76,24 @@ CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr)
do {
m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In");
- if(!m_pInput) {
+ if (!m_pInput) {
hr = E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
break;
}
m_pOutput = DNew CBufferFilterOutputPin(this, &hr);
- if(!m_pOutput) {
+ if (!m_pOutput) {
hr = E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
delete m_pInput, m_pInput = NULL;
break;
}
- } while(false);
+ } while (false);
- if(phr) {
+ if (phr) {
*phr = hr;
}
}
@@ -113,11 +113,11 @@ STDMETHODIMP CBufferFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
STDMETHODIMP CBufferFilter::SetBuffers(int nBuffers)
{
- if(!m_pOutput) {
+ if (!m_pOutput) {
return E_FAIL;
}
- if(m_pOutput->IsConnected()) { // TODO: allow "on-the-fly" changes
+ if (m_pOutput->IsConnected()) { // TODO: allow "on-the-fly" changes
return VFW_E_ALREADY_CONNECTED;
}
@@ -149,7 +149,7 @@ HRESULT CBufferFilter::Receive(IMediaSample* pSample)
{
/* Check for other streams and pass them on */
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA) {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pSample);
}
@@ -162,7 +162,7 @@ HRESULT CBufferFilter::Receive(IMediaSample* pSample)
// Set up the output sample
hr = InitializeOutputSample(pSample, &pOutSample);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -176,13 +176,13 @@ HRESULT CBufferFilter::Receive(IMediaSample* pSample)
// Stop the clock and log it (if PERF is defined)
MSR_STOP(m_idTransform);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
DbgLog((LOG_TRACE,1,TEXT("Error from transform")));
} else {
// the Transform() function can return S_FALSE to indicate that the
// sample should not be delivered; we only deliver the sample if it's
// really S_OK (same as NOERROR, of course.)
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
hr = m_pOutput->Deliver(pOutSample);
m_bSampleSkipped = FALSE; // last thing no longer dropped
} else {
@@ -190,14 +190,14 @@ HRESULT CBufferFilter::Receive(IMediaSample* pSample)
// We should return NOERROR from Receive() in this cause because returning S_FALSE
// from Receive() means that this is the end of the stream and no more data should
// be sent.
- if(S_FALSE == hr) {
+ if (S_FALSE == hr) {
// Release the sample before calling notify to avoid
// deadlocks if the sample holds a lock on the system
// such as DirectDraw buffers do
pOutSample->Release();
m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged) {
+ if (!m_bQualityChanged) {
NotifyEvent(EC_QUALITY_CHANGE,0,0);
m_bQualityChanged = TRUE;
}
@@ -224,7 +224,7 @@ HRESULT CBufferFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
long len = pIn->GetActualDataLength();
long size = pOut->GetSize();
- if(!pDataIn || !pDataOut || len > size || len <= 0) {
+ if (!pDataIn || !pDataOut || len > size || len <= 0) {
return S_FALSE;
}
@@ -247,13 +247,13 @@ HRESULT CBufferFilter::CheckTransform(const CMediaType* mtIn, const CMediaType*
HRESULT CBufferFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
CComPtr<IMemAllocator> pAllocatorIn;
m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) {
+ if (!pAllocatorIn) {
return E_UNEXPECTED;
}
@@ -263,7 +263,7 @@ HRESULT CBufferFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PRO
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -274,15 +274,15 @@ HRESULT CBufferFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PRO
HRESULT CBufferFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
// TODO: offer all input types from upstream and allow reconnection at least in stopped state
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -294,8 +294,8 @@ HRESULT CBufferFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
HRESULT CBufferFilter::StopStreaming()
{
CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
- if(m_pInput && pPin && pPin->m_pOutputQueue) {
- while(!m_pInput->IsFlushing() && pPin->m_pOutputQueue->GetQueueCount() > 0) {
+ if (m_pInput && pPin && pPin->m_pOutputQueue) {
+ while (!m_pInput->IsFlushing() && pPin->m_pOutputQueue->GetQueueCount() > 0) {
Sleep(50);
}
}
@@ -316,15 +316,15 @@ HRESULT CBufferFilterOutputPin::Active()
{
CAutoLock lock_it(m_pLock);
- if(m_Connected && !m_pOutputQueue) {
+ if (m_Connected && !m_pOutputQueue) {
HRESULT hr = NOERROR;
m_pOutputQueue.Attach(DNew CBufferFilterOutputQueue(m_Connected, &hr));
- if(!m_pOutputQueue) {
+ if (!m_pOutputQueue) {
hr = E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pOutputQueue.Free();
return hr;
}
@@ -342,7 +342,7 @@ HRESULT CBufferFilterOutputPin::Inactive()
HRESULT CBufferFilterOutputPin::Deliver(IMediaSample* pMediaSample)
{
- if(!m_pOutputQueue) {
+ if (!m_pOutputQueue) {
return NOERROR;
}
pMediaSample->AddRef();
diff --git a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
index 511d32613..6f5ddb799 100644
--- a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
+++ b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
@@ -80,19 +80,19 @@ public:
// IKsPropertySet
STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength) {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
return pKsPS->Set(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength);
}
return E_NOTIMPL;
}
STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned) {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
return pKsPS->Get(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength, pBytesReturned);
}
return E_NOTIMPL;
}
STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport) {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected()) {
return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
}
return E_NOTIMPL;
@@ -102,23 +102,23 @@ public:
CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr)
: CTransformFilter(NAME("CDeCSSFilter"), lpunk, __uuidof(this))
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In");
- if(!m_pInput) {
+ if (!m_pInput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out");
- if(!m_pOutput) {
+ if (!m_pOutput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
delete m_pInput, m_pInput = NULL;
return;
}
@@ -131,7 +131,7 @@ CDeCSSFilter::~CDeCSSFilter()
HRESULT CDeCSSFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
CMediaType mt = *pmt;
m_pInput->SetMediaType(&mt);
mt.majortype = m_pOutput->CurrentMediaType().majortype;
@@ -149,36 +149,36 @@ HRESULT CDeCSSFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
long len = pIn->GetActualDataLength();
long size = pOut->GetSize();
- if(len == 0 || pDataIn == NULL) { // format changes do not carry any data
+ if (len == 0 || pDataIn == NULL) { // format changes do not carry any data
pOut->SetActualDataLength(0);
return S_OK;
}
- if(m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES) {
- if(*(DWORD*)pDataIn == 0xBA010000) {
+ if (m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES) {
+ if (*(DWORD*)pDataIn == 0xBA010000) {
len -= 14;
pDataIn += 14;
- if(int stuffing = (pDataIn[-1]&7)) {
+ if (int stuffing = (pDataIn[-1]&7)) {
len -= stuffing;
pDataIn += stuffing;
}
}
- if(len <= 0) {
+ if (len <= 0) {
return S_FALSE;
}
- if(*(DWORD*)pDataIn == 0xBB010000) {
+ if (*(DWORD*)pDataIn == 0xBB010000) {
len -= 4;
pDataIn += 4;
int hdrlen = ((pDataIn[0]<<8)|pDataIn[1]) + 2;
len -= hdrlen;
pDataIn += hdrlen;
}
- if(len <= 0) {
+ if (len <= 0) {
return S_FALSE;
}
}
- if(!pDataIn || !pDataOut || len > size || len < 0) {
+ if (!pDataIn || !pDataOut || len > size || len < 0) {
return S_FALSE;
}
@@ -205,7 +205,7 @@ HRESULT CDeCSSFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* m
HRESULT CDeCSSFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -216,7 +216,7 @@ HRESULT CDeCSSFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROP
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -227,22 +227,22 @@ HRESULT CDeCSSFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROP
HRESULT CDeCSSFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 1) {
+ if (iPosition > 1) {
return VFW_S_NO_MORE_ITEMS;
}
CopyMediaType(pmt, &m_pInput->CurrentMediaType());
- if(iPosition == 0) {
+ if (iPosition == 0) {
pmt->majortype = MEDIATYPE_MPEG2_PACK;
}
- if(iPosition == 1) {
+ if (iPosition == 1) {
pmt->majortype = MEDIATYPE_MPEG2_PES;
}
diff --git a/src/filters/transform/MPCVideoDec/CpuId.cpp b/src/filters/transform/MPCVideoDec/CpuId.cpp
index 52668fc03..c6d86f8f9 100644
--- a/src/filters/transform/MPCVideoDec/CpuId.cpp
+++ b/src/filters/transform/MPCVideoDec/CpuId.cpp
@@ -41,11 +41,11 @@
CCpuId::CCpuId(void)
{
-unsigned nHighestFeature;
-unsigned nHighestFeatureEx;
-int nBuff[4];
-char szMan[13];
-//char szFeatures[256];
+ unsigned nHighestFeature;
+ unsigned nHighestFeatureEx;
+ int nBuff[4];
+ char szMan[13];
+ //char szFeatures[256];
// Get CPU manufacturer and highest CPUID
__cpuid(nBuff, 0);
@@ -54,9 +54,9 @@ char szMan[13];
*(int*)&szMan[4] = nBuff[3];
*(int*)&szMan[8] = nBuff[2];
szMan[12] = 0;
- if(strcmp(szMan, "AuthenticAMD") == 0)
+ if (strcmp(szMan, "AuthenticAMD") == 0)
m_nType = PROCESSOR_AMD;
- else if(strcmp(szMan, "GenuineIntel") == 0)
+ else if (strcmp(szMan, "GenuineIntel") == 0)
m_nType = PROCESSOR_INTEL;
else
m_nType = PROCESSOR_UNKNOWN;
@@ -92,19 +92,19 @@ char szMan[13];
// Get CPU features
m_nCPUFeatures = 0;
//szFeatures[0] = 0;
- if(nHighestFeature >= 1)
+ if (nHighestFeature >= 1)
{
__cpuid(nBuff, 1);
- if(nBuff[3] & 1<<23) m_nCPUFeatures|=MPC_MM_MMX;
- if(nBuff[3] & 1<<25) m_nCPUFeatures|=MPC_MM_SSE;
- if(nBuff[3] & 1<<26) m_nCPUFeatures|=MPC_MM_SSE2;
- if(nBuff[2] & 1<<0) m_nCPUFeatures|=MPC_MM_SSE3;
+ if (nBuff[3] & 1<<23) m_nCPUFeatures|=MPC_MM_MMX;
+ if (nBuff[3] & 1<<25) m_nCPUFeatures|=MPC_MM_SSE;
+ if (nBuff[3] & 1<<26) m_nCPUFeatures|=MPC_MM_SSE2;
+ if (nBuff[2] & 1<<0) m_nCPUFeatures|=MPC_MM_SSE3;
// Intel specific:
- if(m_nType == PROCESSOR_INTEL)
+ if (m_nType == PROCESSOR_INTEL)
{
- if(nBuff[2] & 1<<9) m_nCPUFeatures|=MPC_MM_SSSE3;
- // if(nBuff[2] & 1<<7) strcat(szFeatures, "EST ");
+ if (nBuff[2] & 1<<9) m_nCPUFeatures|=MPC_MM_SSSE3;
+ //if (nBuff[2] & 1<<7) strcat(szFeatures, "EST ");
}
//if(nBuff[3] & 1<<28)
@@ -112,16 +112,16 @@ char szMan[13];
}
// AMD specific:
- if(m_nType == PROCESSOR_AMD)
+ if (m_nType == PROCESSOR_AMD)
{
// Get extended features
__cpuid(nBuff, 0x80000000);
- if(nHighestFeatureEx >= 0x80000001)
+ if (nHighestFeatureEx >= 0x80000001)
{
__cpuid(nBuff, 0x80000001);
- if(nBuff[3] & 1<<31) m_nCPUFeatures|=MPC_MM_3DNOW;
- // if(nBuff[3] & 1<<30) strcat(szFeatures, "Ex3DNow! ");
- if(nBuff[3] & 1<<22) m_nCPUFeatures|=MPC_MM_MMXEXT;
+ if (nBuff[3] & 1<<31) m_nCPUFeatures|=MPC_MM_3DNOW;
+ //if (nBuff[3] & 1<<30) strcat(szFeatures, "Ex3DNow! ");
+ if (nBuff[3] & 1<<22) m_nCPUFeatures|=MPC_MM_MMXEXT;
}
// Get level 1 cache size
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
index 50d29e964..30626d1d3 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
@@ -563,14 +563,14 @@ int CDXVADecoder::FindOldestFrame()
void CDXVADecoder::SetTypeSpecificFlags(PICTURE_STORE* pPicture, IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS) {
+ if (CComQIPtr<IMediaSample2> pMS2 = pMS) {
AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
+ if (SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
props.dwTypeSpecificFlags &= ~0x7f;
- if(pPicture->n1FieldType == PICT_FRAME) {
+ if (pPicture->n1FieldType == PICT_FRAME) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
- } else if(pPicture->n1FieldType == PICT_TOP_FIELD) {
+ } else if (pPicture->n1FieldType == PICT_TOP_FIELD) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
}
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
index 6035ab60b..b280363c7 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
@@ -59,7 +59,7 @@ void CDXVADecoderH264::Init()
memset (&m_pSliceShort, 0, sizeof (DXVA_Slice_H264_Short)*MAX_SLICES);
m_DXVAPicParams.MbsConsecutiveFlag = 1;
- if(m_pFilter->GetPCIVendor() == PCIV_Intel) {
+ if (m_pFilter->GetPCIVendor() == PCIV_Intel) {
m_DXVAPicParams.Reserved16Bits = 0x534c;
} else {
m_DXVAPicParams.Reserved16Bits = 0;
@@ -101,7 +101,7 @@ void CDXVADecoderH264::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSi
#if 0
// Test to place Nal on multiple of 128 bytes (seems to be not necessary)
- if(!m_bUseLongSlice) {
+ if (!m_bUseLongSlice) {
while (Nalu.ReadNext()) {
switch (Nalu.GetType()) {
case NALU_TYPE_SLICE:
@@ -137,19 +137,19 @@ void CDXVADecoderH264::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSi
case NALU_TYPE_SLICE:
case NALU_TYPE_IDR:
// Skip the NALU if the data length is below 0
- if(Nalu.GetDataLength() < 0) {
+ if (Nalu.GetDataLength() < 0) {
break;
}
// For AVC1, put startcode 0x000001
- pDXVABuffer[0]=pDXVABuffer[1]=0;pDXVABuffer[2]=1;
- if(Nalu.GetDataLength() < 0)
+ pDXVABuffer[0]=pDXVABuffer[1]=0; pDXVABuffer[2]=1;
+ if (Nalu.GetDataLength() < 0)
break;
// Copy NALU
__try {
memcpy (pDXVABuffer+3, Nalu.GetDataBuffer(), Nalu.GetDataLength());
- }__except(EXCEPTION_EXECUTE_HANDLER) { break; }
+ } __except (EXCEPTION_EXECUTE_HANDLER) { break; }
// Update slice control buffer
nDxvaNalLength = Nalu.GetDataLength()+3;
@@ -200,7 +200,7 @@ HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
if (m_nWaitingPics >= m_nPicEntryNumber) {
Flush();
m_bFlushed = false;
- return S_FALSE;
+ return S_FALSE;
}
if (FFH264DecodeBuffer (m_pFilter->GetAVCtx(), pDataIn, nSize, &nFramePOC, &nOutPOC, &rtOutStart) == -1) {
@@ -212,7 +212,7 @@ HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
switch (Nalu.GetType()) {
case NALU_TYPE_SLICE:
case NALU_TYPE_IDR:
- if(m_bUseLongSlice) {
+ if (m_bUseLongSlice) {
m_pSliceLong[nSlices].BSNALunitDataLocation = nNalOffset;
m_pSliceLong[nSlices].SliceBytesInBuffer = Nalu.GetDataLength()+3; //.GetRoundedDataLength();
m_pSliceLong[nSlices].slice_id = nSlices;
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
index 55c993771..acca5ccc1 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
@@ -144,7 +144,7 @@ HRESULT CDXVADecoderVC1::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME
CHECK_HR (EndFrame(nSurfaceIndex));
// ***************
- if(nFrameSize) { // Decoding Second Field
+ if (nFrameSize) { // Decoding Second Field
FFVC1UpdatePictureParam (&m_PictureParams, m_pFilter->GetAVCtx(), NULL, NULL, pDataIn, nSize, NULL, TRUE);
CHECK_HR (BeginFrame(nSurfaceIndex, pSampleToDeliver));
@@ -223,8 +223,8 @@ void CDXVADecoderVC1::SetExtraData (BYTE* pDataIn, UINT nSize)
// iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
m_PictureParams.bBidirectionalAveragingMode = (1 << 7) |
- (GetConfigIntraResidUnsigned() <<6) | // i9IRU
- (GetConfigResidDiffAccelerator() <<5); // iOHIT
+ (GetConfigIntraResidUnsigned() <<6) | // i9IRU
+ (GetConfigResidDiffAccelerator() <<5); // iOHIT
}
BYTE* CDXVADecoderVC1::FindNextStartCode(BYTE* pBuffer, UINT nSize, UINT& nPacketSize)
@@ -262,7 +262,7 @@ void CDXVADecoderVC1::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSiz
{
int nDummy;
- if(m_PictureParams.bSecondField) {
+ if (m_PictureParams.bSecondField) {
memcpy (pDXVABuffer, (BYTE*)pBuffer, nSize);
} else {
if ( (*((DWORD*)pBuffer) & 0x00FFFFFF) != 0x00010000) {
diff --git a/src/filters/transform/MPCVideoDec/FfmpegContext.c b/src/filters/transform/MPCVideoDec/FfmpegContext.c
index d10f25a09..d6bb45b49 100644
--- a/src/filters/transform/MPCVideoDec/FfmpegContext.c
+++ b/src/filters/transform/MPCVideoDec/FfmpegContext.c
@@ -40,7 +40,7 @@
#include "mpeg12.h"
#if defined(REGISTER_FILTER) && _WIN64
- void *__imp_toupper = toupper;
+void *__imp_toupper = toupper;
#endif
int av_h264_decode_frame(struct AVCodecContext* avctx, int* nOutPOC, int64_t* rtStartTime, uint8_t *buf, int buf_size);
@@ -163,7 +163,7 @@ int FFH264CheckCompatibility(int nWidth, int nHeight, struct AVCodecContext* pAV
if (cur_sps != NULL) {
int max_ref_frames = 0;
- if(cur_sps->bit_depth_luma > 8) {
+ if (cur_sps->bit_depth_luma > 8) {
return DXVA_HIGH_BIT;
}
@@ -178,7 +178,7 @@ int FFH264CheckCompatibility(int nWidth, int nHeight, struct AVCodecContext* pAV
no_level51_support = 0;
// max ref frames is 16 for HD and 11 otherwise
- if(nWidth >= 1280) {
+ if (nWidth >= 1280) {
max_ref_frames = 16;
} else {
max_ref_frames = 11;
@@ -196,7 +196,7 @@ int FFH264CheckCompatibility(int nWidth, int nHeight, struct AVCodecContext* pAV
no_level51_support = 0;
} else if (nPCIVendor == PCIV_ATI) {
// HD4xxx, HD5xxx, and HD6xxx AMD/ATI cards support level 5.1 since drivers v8.14.1.6105 (Catalyst 10.4)
- if(nPCIDevice > 0x6700) {
+ if (nPCIDevice > 0x6700) {
if (DriverVersionCheck(VideoDriverVersion, 8, 14, 1, 6105)) {
no_level51_support = 0;
max_ref_frames = 16;
@@ -315,7 +315,7 @@ HRESULT FFH264BuildPicParams (DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_
pDXVAPicParams->bit_depth_luma_minus8 = cur_sps->bit_depth_luma - 8; // bit_depth_luma_minus8
pDXVAPicParams->bit_depth_chroma_minus8 = cur_sps->bit_depth_chroma - 8; // bit_depth_chroma_minus8
-
+
// pDXVAPicParams->StatusReportFeedbackNumber = SET IN DecodeFrame;
// pDXVAPicParams->CurrFieldOrderCnt = SET IN UpdateRefFramesList;
// pDXVAPicParams->FieldOrderCntList = SET IN UpdateRefFramesList;
@@ -327,9 +327,9 @@ HRESULT FFH264BuildPicParams (DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_
pDXVAPicParams->log2_max_frame_num_minus4 = cur_sps->log2_max_frame_num - 4; // log2_max_frame_num_minus4;
pDXVAPicParams->pic_order_cnt_type = cur_sps->poc_type; // pic_order_cnt_type;
- if(cur_sps->poc_type == 0)
+ if (cur_sps->poc_type == 0)
pDXVAPicParams->log2_max_pic_order_cnt_lsb_minus4 = cur_sps->log2_max_poc_lsb - 4; // log2_max_pic_order_cnt_lsb_minus4;
- else if(cur_sps->poc_type == 1)
+ else if (cur_sps->poc_type == 1)
pDXVAPicParams->delta_pic_order_always_zero_flag = cur_sps->delta_pic_order_always_zero_flag;
pDXVAPicParams->direct_8x8_inference_flag = cur_sps->direct_8x8_inference_flag;
pDXVAPicParams->entropy_coding_mode_flag = cur_pps->cabac; // entropy_coding_mode_flag;
@@ -383,7 +383,7 @@ void FFH264UpdateRefFramesList (DXVA_PicParams_H264* pDXVAPicParams, struct AVCo
Picture* pic;
UCHAR AssociatedFlag;
- for(i=0; i<16; i++) {
+ for (i=0; i<16; i++) {
if (i < h->short_ref_count) {
// Short list reference frames
pic = h->short_ref[h->short_ref_count - i - 1];
@@ -455,7 +455,7 @@ void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slic
HRESULT hr = E_FAIL;
unsigned int i;
- for(i=0; i<32; i++) {
+ for (i=0; i<32; i++) {
pSlice->RefPicList[0][i].AssociatedFlag = 1;
pSlice->RefPicList[0][i].bPicEntry = 255;
pSlice->RefPicList[0][i].Index7Bits = 127;
@@ -464,13 +464,13 @@ void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slic
pSlice->RefPicList[1][i].Index7Bits = 127;
}
- if(h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI) {
- if(h->ref_count[0] > 0) {
- for(i=0; i < h->ref_count[0]; i++) {
+ if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI) {
+ if (h->ref_count[0] > 0) {
+ for (i=0; i < h->ref_count[0]; i++) {
pSlice->RefPicList[0][i].Index7Bits = FFH264FindRefFrameIndex (h->ref_list[0][i].frame_num, pDXVAPicParams);
pSlice->RefPicList[0][i].AssociatedFlag = 0;
- if((h->s.picture_structure != PICT_FRAME)) {
- if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
+ if ((h->s.picture_structure != PICT_FRAME)) {
+ if ((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)) {
pSlice->RefPicList[0][i].AssociatedFlag = 1;
@@ -482,13 +482,13 @@ void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slic
pSlice->num_ref_idx_l0_active_minus1 = 0;
}
- if(h->slice_type == AV_PICTURE_TYPE_B || h->slice_type == AV_PICTURE_TYPE_S || h->slice_type == AV_PICTURE_TYPE_BI) {
- if(h->ref_count[1] > 0) {
- for(i=0; i < h->ref_count[1]; i++) {
+ if (h->slice_type == AV_PICTURE_TYPE_B || h->slice_type == AV_PICTURE_TYPE_S || h->slice_type == AV_PICTURE_TYPE_BI) {
+ if (h->ref_count[1] > 0) {
+ for (i=0; i < h->ref_count[1]; i++) {
pSlice->RefPicList[1][i].Index7Bits = FFH264FindRefFrameIndex (h->ref_list[1][i].frame_num, pDXVAPicParams);
pSlice->RefPicList[1][i].AssociatedFlag = 0;
- if((h->s.picture_structure != PICT_FRAME)) {
- if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
+ if ((h->s.picture_structure != PICT_FRAME)) {
+ if ((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)) {
pSlice->RefPicList[1][i].AssociatedFlag = 1;
@@ -501,15 +501,15 @@ void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slic
}
- if(h->slice_type == AV_PICTURE_TYPE_I || h->slice_type == AV_PICTURE_TYPE_SI) {
- for(i = 0; i<16; i++) {
+ if (h->slice_type == AV_PICTURE_TYPE_I || h->slice_type == AV_PICTURE_TYPE_SI) {
+ for (i = 0; i<16; i++) {
pSlice->RefPicList[0][i].bPicEntry = 0xff;
}
}
- if(h->slice_type == AV_PICTURE_TYPE_P || h->slice_type == AV_PICTURE_TYPE_I ||
+ if (h->slice_type == AV_PICTURE_TYPE_P || h->slice_type == AV_PICTURE_TYPE_I ||
h->slice_type ==AV_PICTURE_TYPE_SP || h->slice_type == AV_PICTURE_TYPE_SI) {
- for(i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
pSlice->RefPicList[1][i].bPicEntry = 0xff;
}
}
@@ -532,16 +532,16 @@ HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCo
// WARNING : vc1->interlace is not reliable (always set for progressive video on HD-DVD material)
if (vc1->fcm == 0) {
- if(nFieldType) {
+ if (nFieldType) {
*nFieldType = PICT_FRAME;
}
} else { // fcm : 2 or 3 frame or field interlaced
- if(nFieldType) {
+ if (nFieldType) {
*nFieldType = (vc1->tff ? PICT_TOP_FIELD : PICT_BOTTOM_FIELD);
}
}
- if(b_SecondField) {
+ if (b_SecondField) {
vc1->second_field = 1;
vc1->s.picture_structure = PICT_TOP_FIELD + vc1->tff;
vc1->s.pict_type = (vc1->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
@@ -549,7 +549,7 @@ HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCo
vc1->s.pict_type = (vc1->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;
}
- if(nFrameSize) {
+ if (nFrameSize) {
*nFrameSize = out_nFrameSize;
}
@@ -560,8 +560,8 @@ HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCo
// Init Init Init Todo
// iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
pPicParams->bBidirectionalAveragingMode = (pPicParams->bBidirectionalAveragingMode & 0xE0) | // init in SetExtraData
- ((vc1->lumshift!=0 || vc1->lumscale!=32) ? 0x10 : 0)| // iINSO
- ((vc1->profile == PROFILE_ADVANCED) <<3 ); // iWMVA
+ ((vc1->lumshift!=0 || vc1->lumscale!=32) ? 0x10 : 0)| // iINSO
+ ((vc1->profile == PROFILE_ADVANCED) <<3 ); // iWMVA
// Section 3.2.20.3
pPicParams->bPicSpatialResid8 = (vc1->panscanflag << 7) | (vc1->refdist_flag << 6) |
@@ -598,22 +598,22 @@ HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCo
}
// Section 3.2.16
- if(nSliceType) {
+ if (nSliceType) {
*nSliceType = vc1->s.pict_type;
}
// TODO : not finish...
pPicParams->bMVprecisionAndChromaRelation = ((vc1->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) | // 0 for non-bilinear luma motion, 1 for bilinear
- (1 << 2) | // 0 for WMV8, 1 for WMV9 motion
- (0 << 1) | // 1 for WMV8 quarter sample luma motion
- (0); // 0 for quarter sample chroma motion, 1 for half sample chroma
+ (1 << 2) | // 0 for WMV8, 1 for WMV9 motion
+ (0 << 1) | // 1 for WMV8 quarter sample luma motion
+ (0); // 0 for quarter sample chroma motion, 1 for half sample chroma
// Cf §7.1.1.25 in VC1 specification, §3.2.14.3 in DXVA spec
pPicParams->bRcontrol = vc1->rnd;
- pPicParams->bPicDeblocked = ((vc1->profile == PROFILE_ADVANCED && vc1->overlap == 1 &&
- pPicParams->bPicBackwardPrediction == 0) << 6) |
- ((vc1->profile != PROFILE_ADVANCED && vc1->rangeredfrm) << 5) |
+ pPicParams->bPicDeblocked = ((vc1->profile == PROFILE_ADVANCED && vc1->overlap == 1 &&
+ pPicParams->bPicBackwardPrediction == 0) << 6) |
+ ((vc1->profile != PROFILE_ADVANCED && vc1->rangeredfrm) << 5) |
(vc1->s.loop_filter << 1);
return S_OK;
@@ -701,13 +701,13 @@ HRESULT FFMpeg2DecodeFrame (DXVA_PictureParameters* pPicParams, DXVA_QmatrixData
// pPicParams->bReservedBits; // ??
pPicParams->wBitstreamFcodes = (s->mpeg_f_code[0][0]<<12) | (s->mpeg_f_code[0][1]<<8) |
- (s->mpeg_f_code[1][0]<<4) | (s->mpeg_f_code[1][1]);
+ (s->mpeg_f_code[1][0]<<4) | (s->mpeg_f_code[1][1]);
pPicParams->wBitstreamPCEelements = (s->intra_dc_precision<<14) | (s->picture_structure<<12) |
- (s->top_field_first<<11) | (s->frame_pred_frame_dct<<10)|
- (s->concealment_motion_vectors<<9) | (s->q_scale_type<<8)|
- (s->intra_vlc_format<<7) | (s->alternate_scan<<6)|
- (s->repeat_first_field<<5) | (s->chroma_420_type<<4)|
- (s->progressive_frame<<3);
+ (s->top_field_first<<11) | (s->frame_pred_frame_dct<<10)|
+ (s->concealment_motion_vectors<<9) | (s->q_scale_type<<8)|
+ (s->intra_vlc_format<<7) | (s->alternate_scan<<6)|
+ (s->repeat_first_field<<5) | (s->chroma_420_type<<4)|
+ (s->progressive_frame<<3);
// TODO : could be interesting to parameter concealment method?
// pPicParams->bBitstreamConcealmentNeed;
@@ -746,10 +746,10 @@ int FFIsSkipped(struct AVCodecContext* pAVCtx)
int FFGetThreadType(enum CodecID nCodecId, int nThreadCount)
{
- if(!nThreadCount) {
+ if (!nThreadCount) {
return 0;
}
- switch(nCodecId)
+ switch (nCodecId)
{
case CODEC_ID_H264 :
return FF_THREAD_FRAME|FF_THREAD_SLICE;
diff --git a/src/filters/transform/MPCVideoDec/H264RandomAccess.cpp b/src/filters/transform/MPCVideoDec/H264RandomAccess.cpp
index 228452c4c..be4751524 100644
--- a/src/filters/transform/MPCVideoDec/H264RandomAccess.cpp
+++ b/src/filters/transform/MPCVideoDec/H264RandomAccess.cpp
@@ -24,7 +24,7 @@
CH264RandomAccess::CH264RandomAccess()
{
- flush(0);
+ flush(0);
}
CH264RandomAccess::~CH264RandomAccess()
@@ -33,59 +33,59 @@ CH264RandomAccess::~CH264RandomAccess()
void CH264RandomAccess::flush(int threadCount)
{
- m_RecoveryMode = 1;
- m_RecoveryFrameCount = 0;
- m_ThreadDelay = threadCount;
+ m_RecoveryMode = 1;
+ m_RecoveryFrameCount = 0;
+ m_ThreadDelay = threadCount;
}
BOOL CH264RandomAccess::searchRecoveryPoint(AVCodecContext* pAVCtx, BYTE *buf, int buf_size)
{
- if (m_RecoveryMode == 1) {
+ if (m_RecoveryMode == 1) {
int recoveryPoint = avcodec_h264_search_recovery_point(pAVCtx, buf, buf_size, &m_RecoveryFrameCount);
- switch (recoveryPoint) {
- case 3: // IDRS
- m_RecoveryMode = 0;
- return TRUE;
- case 2: // SEI recovery
- m_RecoveryMode = 2;
- return TRUE;
- case 1: // I Frame
- m_RecoveryMode = 2;
- m_RecoveryFrameCount = 0;
- return TRUE;
- default:
- return FALSE;
- }
- } else {
- return TRUE;
- }
+ switch (recoveryPoint) {
+ case 3: // IDRS
+ m_RecoveryMode = 0;
+ return TRUE;
+ case 2: // SEI recovery
+ m_RecoveryMode = 2;
+ return TRUE;
+ case 1: // I Frame
+ m_RecoveryMode = 2;
+ m_RecoveryFrameCount = 0;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ } else {
+ return TRUE;
+ }
}
void CH264RandomAccess::judgeFrameUsability(AVFrame *pFrame, int *got_picture_ptr)
{
- if ((m_ThreadDelay > 1 && --m_ThreadDelay > 0) || m_RecoveryMode == 0 || pFrame->h264_max_frame_num == 0) {
- return;
- }
+ if ((m_ThreadDelay > 1 && --m_ThreadDelay > 0) || m_RecoveryMode == 0 || pFrame->h264_max_frame_num == 0) {
+ return;
+ }
- if (m_RecoveryMode == 1 || m_RecoveryMode == 2) {
- m_RecoveryFrameCount = (m_RecoveryFrameCount + pFrame->h264_frame_num_decoded) % pFrame->h264_max_frame_num;
- m_RecoveryMode = 3;
- }
+ if (m_RecoveryMode == 1 || m_RecoveryMode == 2) {
+ m_RecoveryFrameCount = (m_RecoveryFrameCount + pFrame->h264_frame_num_decoded) % pFrame->h264_max_frame_num;
+ m_RecoveryMode = 3;
+ }
- if (m_RecoveryMode == 3) {
- if (m_RecoveryFrameCount <= pFrame->h264_frame_num_decoded) {
- m_RecoveryPOC = pFrame->h264_poc_decoded;
- m_RecoveryMode = 4;
- }
- }
+ if (m_RecoveryMode == 3) {
+ if (m_RecoveryFrameCount <= pFrame->h264_frame_num_decoded) {
+ m_RecoveryPOC = pFrame->h264_poc_decoded;
+ m_RecoveryMode = 4;
+ }
+ }
- if (m_RecoveryMode == 4) {
- if (pFrame->h264_poc_outputed >= m_RecoveryPOC) {
- m_RecoveryMode = 0;
- }
- }
+ if (m_RecoveryMode == 4) {
+ if (pFrame->h264_poc_outputed >= m_RecoveryPOC) {
+ m_RecoveryMode = 0;
+ }
+ }
- if (m_RecoveryMode != 0) {
- *got_picture_ptr = 0;
- }
+ if (m_RecoveryMode != 0) {
+ *got_picture_ptr = 0;
+ }
}
diff --git a/src/filters/transform/MPCVideoDec/H264RandomAccess.h b/src/filters/transform/MPCVideoDec/H264RandomAccess.h
index 933881be9..86c6f9d17 100644
--- a/src/filters/transform/MPCVideoDec/H264RandomAccess.h
+++ b/src/filters/transform/MPCVideoDec/H264RandomAccess.h
@@ -25,16 +25,16 @@ struct AVFrame;
class CH264RandomAccess
{
public:
- CH264RandomAccess();
- ~CH264RandomAccess();
+ CH264RandomAccess();
+ ~CH264RandomAccess();
- void flush(int threadCount);
- BOOL searchRecoveryPoint(AVCodecContext* pAVCtx, BYTE *buf, int buf_size);
- void judgeFrameUsability(AVFrame *pFrame, int *got_picture_ptr);
+ void flush(int threadCount);
+ BOOL searchRecoveryPoint(AVCodecContext* pAVCtx, BYTE *buf, int buf_size);
+ void judgeFrameUsability(AVFrame *pFrame, int *got_picture_ptr);
private:
- int m_RecoveryMode; // 0: OK; 1: Searching; 2: Found; 3:
- int m_RecoveryFrameCount;
- int m_RecoveryPOC;
- int m_ThreadDelay;
+ int m_RecoveryMode; // 0: OK; 1: Searching; 2: Found; 3:
+ int m_RecoveryFrameCount;
+ int m_RecoveryPOC;
+ int m_ThreadDelay;
};
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
index 094b4bbea..8e94299e3 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
@@ -195,20 +195,20 @@ FFMPEG_CODECS ffCodecs[] = {
// AMV Video
{ &MEDIASUBTYPE_AMVV, CODEC_ID_AMV, NULL },
- // MJPEG
- { &MEDIASUBTYPE_MJPG, CODEC_ID_MJPEG, NULL },
- { &MEDIASUBTYPE_QTJpeg, CODEC_ID_MJPEG, NULL },
- { &MEDIASUBTYPE_MJPA, CODEC_ID_MJPEG, NULL },
- { &MEDIASUBTYPE_MJPB, CODEC_ID_MJPEGB, NULL },
+ // MJPEG
+ { &MEDIASUBTYPE_MJPG, CODEC_ID_MJPEG, NULL },
+ { &MEDIASUBTYPE_QTJpeg, CODEC_ID_MJPEG, NULL },
+ { &MEDIASUBTYPE_MJPA, CODEC_ID_MJPEG, NULL },
+ { &MEDIASUBTYPE_MJPB, CODEC_ID_MJPEGB, NULL },
// TSCC
- { &MEDIASUBTYPE_TSCC, CODEC_ID_TSCC, NULL },
+ { &MEDIASUBTYPE_TSCC, CODEC_ID_TSCC, NULL },
// Indeo 3/4/5
- { &MEDIASUBTYPE_IV31, CODEC_ID_INDEO3, NULL },
- { &MEDIASUBTYPE_IV32, CODEC_ID_INDEO3, NULL },
- { &MEDIASUBTYPE_IV41, CODEC_ID_INDEO4, NULL },
- { &MEDIASUBTYPE_IV50, CODEC_ID_INDEO5, NULL },
+ { &MEDIASUBTYPE_IV31, CODEC_ID_INDEO3, NULL },
+ { &MEDIASUBTYPE_IV32, CODEC_ID_INDEO3, NULL },
+ { &MEDIASUBTYPE_IV41, CODEC_ID_INDEO4, NULL },
+ { &MEDIASUBTYPE_IV50, CODEC_ID_INDEO5, NULL },
#endif /* HAS_FFMPEG_VIDEO_DECODERS */
// H264/AVC
@@ -523,15 +523,15 @@ CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
{
HWND hWnd = NULL;
- if(IsVistaOrAbove()) {
+ if (IsVistaOrAbove()) {
for (int i=0; i<countof(ffCodecs); i++) {
- if(ffCodecs[i].nFFCodec == CODEC_ID_H264) {
+ if (ffCodecs[i].nFFCodec == CODEC_ID_H264) {
ffCodecs[i].DXVAModes = &DXVA_H264_VISTA;
}
}
}
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
@@ -539,7 +539,7 @@ CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
delete m_pOutput;
}
m_pOutput = DNew CVideoDecOutputPin(NAME("CVideoDecOutputPin"), this, phr, L"Output");
- if(!m_pOutput) {
+ if (!m_pOutput) {
*phr = E_OUTOFMEMORY;
}
@@ -595,55 +595,55 @@ CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"), KEY_READ)) {
DWORD dw;
- #if HAS_FFMPEG_VIDEO_DECODERS
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ThreadNumber"), dw)) {
+#if HAS_FFMPEG_VIDEO_DECODERS
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ThreadNumber"), dw)) {
m_nThreadNumber = dw;
}
- #if INTERNAL_DECODER_H264
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DiscardMode"), dw)) {
+#if INTERNAL_DECODER_H264
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DiscardMode"), dw)) {
m_nDiscardMode = dw;
}
- #endif
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ErrorRecognition"), dw)) {
+#endif
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ErrorRecognition"), dw)) {
m_nErrorRecognition = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("IDCTAlgo"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("IDCTAlgo"), dw)) {
m_nIDCTAlgo = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ActiveCodecs"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ActiveCodecs"), dw)) {
m_nActiveCodecs = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ARMode"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ARMode"), dw)) {
m_nARMode = dw;
}
- #endif
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DXVACheckCompatibility"), dw)) {
+#endif
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DXVACheckCompatibility"), dw)) {
m_nDXVACheckCompatibility = dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DisableDXVA_SD"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DisableDXVA_SD"), dw)) {
m_nDXVA_SD = dw;
}
}
#else
- #if HAS_FFMPEG_VIDEO_DECODERS
+#if HAS_FFMPEG_VIDEO_DECODERS
m_nThreadNumber = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("ThreadNumber"), m_nThreadNumber);
- #if INTERNAL_DECODER_H264
+#if INTERNAL_DECODER_H264
m_nDiscardMode = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("DiscardMode"), m_nDiscardMode);
- #endif
+#endif
m_nErrorRecognition = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("ErrorRecognition"), m_nErrorRecognition);
m_nIDCTAlgo = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("IDCTAlgo"), m_nIDCTAlgo);
m_nARMode = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("ARMode"), m_nARMode);
- #endif
+#endif
m_nDXVACheckCompatibility = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("DXVACheckCompatibility"), m_nDXVACheckCompatibility);
m_nDXVA_SD = AfxGetApp()->GetProfileInt(_T("Filters\\MPC Video Decoder"), _T("DisableDXVA_SD"), m_nDXVA_SD);
#endif
- if(m_nErrorRecognition != AV_EF_CAREFUL && m_nErrorRecognition != AV_EF_COMPLIANT && m_nErrorRecognition != AV_EF_AGGRESSIVE) {
+ if (m_nErrorRecognition != AV_EF_CAREFUL && m_nErrorRecognition != AV_EF_COMPLIANT && m_nErrorRecognition != AV_EF_AGGRESSIVE) {
m_nErrorRecognition = AV_EF_CAREFUL;
}
- if(m_nDXVACheckCompatibility > 3) {
+ if (m_nDXVACheckCompatibility > 3) {
m_nDXVACheckCompatibility = 1; // skip level check by default
}
@@ -810,9 +810,9 @@ int CMPCVideoDecFilter::FindCodec(const CMediaType* mtIn)
break;
case CODEC_ID_MPEG4 :
if ((*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DX50) || // DivX
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_dx50) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DIVX) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_divx) ) {
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_dx50) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DIVX) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_divx) ) {
bCodecActivated = (m_nActiveCodecs & MPCVD_DIVX) != 0;
} else {
bCodecActivated = (m_nActiveCodecs & MPCVD_XVID) != 0; // Xvid/MPEG-4
@@ -1009,16 +1009,16 @@ HRESULT CMPCVideoDecFilter::CheckInputType(const CMediaType* mtIn)
bool CMPCVideoDecFilter::IsMultiThreadSupported(enum CodecID nCodec)
{
return
- (
- nCodec==CODEC_ID_H264 ||
- nCodec==CODEC_ID_MPEG1VIDEO ||
- nCodec==CODEC_ID_FFV1 ||
- nCodec==CODEC_ID_DVVIDEO ||
- nCodec==CODEC_ID_VP8 ||
- nCodec==CODEC_ID_THEORA ||
- nCodec==CODEC_ID_RV30 ||
- nCodec==CODEC_ID_RV40
- );
+ (
+ nCodec==CODEC_ID_H264 ||
+ nCodec==CODEC_ID_MPEG1VIDEO ||
+ nCodec==CODEC_ID_FFV1 ||
+ nCodec==CODEC_ID_DVVIDEO ||
+ nCodec==CODEC_ID_VP8 ||
+ nCodec==CODEC_ID_THEORA ||
+ nCodec==CODEC_ID_RV30 ||
+ nCodec==CODEC_ID_RV40
+ );
}
CString CMPCVideoDecFilter::GetFileExtension()
@@ -1056,7 +1056,7 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaTyp
if (nNewCodec != m_nCodecNb) {
CLSID ClsidSourceFilter = GetCLSID(m_pInput->GetConnected());
- if((ClsidSourceFilter == __uuidof(COggSourceFilter)) || (ClsidSourceFilter == __uuidof(COggSplitterFilter))) {
+ if ((ClsidSourceFilter == __uuidof(COggSourceFilter)) || (ClsidSourceFilter == __uuidof(COggSplitterFilter))) {
m_bTheoraMTSupport = false;
}
@@ -1082,25 +1082,25 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaTyp
m_h264RandomAccess.flush(m_pAVCtx->thread_count);
- if(pmt->formattype == FORMAT_VideoInfo) {
+ if (pmt->formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
m_pAVCtx->width = vih->bmiHeader.biWidth;
m_pAVCtx->height = abs(vih->bmiHeader.biHeight);
m_pAVCtx->codec_tag = vih->bmiHeader.biCompression;
m_pAVCtx->bits_per_coded_sample = vih->bmiHeader.biBitCount;
- } else if(pmt->formattype == FORMAT_VideoInfo2) {
+ } else if (pmt->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pmt->pbFormat;
m_pAVCtx->width = vih2->bmiHeader.biWidth;
m_pAVCtx->height = abs(vih2->bmiHeader.biHeight);
m_pAVCtx->codec_tag = vih2->bmiHeader.biCompression;
m_pAVCtx->bits_per_coded_sample = vih2->bmiHeader.biBitCount;
- } else if(pmt->formattype == FORMAT_MPEGVideo) {
+ } else if (pmt->formattype == FORMAT_MPEGVideo) {
MPEG1VIDEOINFO* mpgv = (MPEG1VIDEOINFO*)pmt->pbFormat;
m_pAVCtx->width = mpgv->hdr.bmiHeader.biWidth;
m_pAVCtx->height = abs(mpgv->hdr.bmiHeader.biHeight);
m_pAVCtx->codec_tag = mpgv->hdr.bmiHeader.biCompression;
m_pAVCtx->bits_per_coded_sample = mpgv->hdr.bmiHeader.biBitCount;
- } else if(pmt->formattype == FORMAT_MPEG2Video) {
+ } else if (pmt->formattype == FORMAT_MPEG2Video) {
MPEG2VIDEOINFO* mpg2v = (MPEG2VIDEOINFO*)pmt->pbFormat;
m_pAVCtx->width = mpg2v->hdr.bmiHeader.biWidth;
m_pAVCtx->height = abs(mpg2v->hdr.bmiHeader.biHeight);
@@ -1119,11 +1119,11 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaTyp
m_nWidth = m_pAVCtx->width;
m_nHeight = m_pAVCtx->height;
- if(m_pAVCtx->codec_tag == MAKEFOURCC('m','p','g','2')) {
+ if (m_pAVCtx->codec_tag == MAKEFOURCC('m','p','g','2')) {
m_pAVCtx->codec_tag = MAKEFOURCC('M','P','E','G');
}
- if(m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30 || m_nCodecId == CODEC_ID_RV40) {
+ if (m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30 || m_nCodecId == CODEC_ID_RV40) {
m_bReorderBFrame = false;
}
@@ -1154,7 +1154,7 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaTyp
do {
m_bDXVACompatible = false;
- if(!DXVACheckFramesize(PictWidth(), PictHeight(), m_nPCIVendor)) { // check frame size
+ if (!DXVACheckFramesize(PictWidth(), PictHeight(), m_nPCIVendor)) { // check frame size
break;
}
@@ -1163,11 +1163,11 @@ HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaTyp
break;
}
int nCompat = FFH264CheckCompatibility (PictWidthRounded(), PictHeightRounded(), m_pAVCtx, (BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size, m_nPCIVendor, m_nPCIDevice, m_VideoDriverVersion);
- if(nCompat) {
+ if (nCompat) {
if ( nCompat == DXVA_HIGH_BIT ||
- m_nDXVACheckCompatibility == 0 || // full check
- m_nDXVACheckCompatibility == 1 && nCompat != DXVA_UNSUPPORTED_LEVEL || // skip level check
- m_nDXVACheckCompatibility == 2 && nCompat != DXVA_TOO_MANY_REF_FRAMES) { // skip reference frame check
+ m_nDXVACheckCompatibility == 0 || // full check
+ m_nDXVACheckCompatibility == 1 && nCompat != DXVA_UNSUPPORTED_LEVEL || // skip level check
+ m_nDXVACheckCompatibility == 2 && nCompat != DXVA_TOO_MANY_REF_FRAMES) { // skip reference frame check
break;
}
}
@@ -1312,8 +1312,8 @@ void CMPCVideoDecFilter::AllocExtradata(AVCodecContext* pAVCtx, const CMediaType
if (size) {
CLSID ClsidSourceFilter = GetCLSID(m_pInput->GetConnected());
- if(((ClsidSourceFilter == __uuidof(CRealMediaSourceFilter)) || (ClsidSourceFilter == __uuidof(CRealMediaSplitterFilter))) &&
- (m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30) && (size > 26)) {
+ if (((ClsidSourceFilter == __uuidof(CRealMediaSourceFilter)) || (ClsidSourceFilter == __uuidof(CRealMediaSplitterFilter))) &&
+ (m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30) && (size > 26)) {
size -= 26;
data += 26;
}
@@ -1359,7 +1359,7 @@ HRESULT CMPCVideoDecFilter::CompleteConnect(PIN_DIRECTION direction, IPin* pRece
}
CLSID ClsidSourceFilter = GetCLSID(m_pInput->GetConnected());
- if((ClsidSourceFilter == __uuidof(CMpegSourceFilter)) || (ClsidSourceFilter == __uuidof(CMpegSplitterFilter))) {
+ if ((ClsidSourceFilter == __uuidof(CMpegSourceFilter)) || (ClsidSourceFilter == __uuidof(CMpegSplitterFilter))) {
m_bReorderBFrame = false;
}
}
@@ -1378,13 +1378,13 @@ HRESULT CMPCVideoDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATO
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
pProperties->cBuffers = GetPicEntryNumber();
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -1435,15 +1435,15 @@ HRESULT CMPCVideoDecFilter::BreakConnect(PIN_DIRECTION dir)
void CMPCVideoDecFilter::SetTypeSpecificFlags(IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS) {
+ if (CComQIPtr<IMediaSample2> pMS2 = pMS) {
AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
+ if (SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
props.dwTypeSpecificFlags &= ~0x7f;
- if(!m_pFrame->interlaced_frame) {
+ if (!m_pFrame->interlaced_frame) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
} else {
- if(m_pFrame->top_field_first) {
+ if (m_pFrame->top_field_first) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
}
}
@@ -1510,19 +1510,19 @@ void CMPCVideoDecFilter::InitSwscale()
m_nOutCsp = GetCspFromMediaType(m_pOutput->CurrentMediaType().subtype);
m_pSwsContext = sws_getCachedContext(
- NULL,
- m_pAVCtx->width,
- m_pAVCtx->height,
- m_pAVCtx->pix_fmt,
- m_pAVCtx->width,
- m_pAVCtx->height,
- csp_ffdshow2lavc(m_nOutCsp),
- sws_Flags|SWS_PRINT_INFO,
- NULL,
- NULL,
- NULL,
- &params,
- (m_nThreadNumber ? m_nThreadNumber : m_pCpuId->GetProcessorNumber()));
+ NULL,
+ m_pAVCtx->width,
+ m_pAVCtx->height,
+ m_pAVCtx->pix_fmt,
+ m_pAVCtx->width,
+ m_pAVCtx->height,
+ csp_ffdshow2lavc(m_nOutCsp),
+ sws_Flags|SWS_PRINT_INFO,
+ NULL,
+ NULL,
+ NULL,
+ &params,
+ (m_nThreadNumber ? m_nThreadNumber : m_pCpuId->GetProcessorNumber()));
m_nSwOutBpp = bihOut.biBitCount;
m_pOutSize.cx = bihOut.biWidth;
@@ -1555,7 +1555,7 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int
av_init_packet(&avpkt);
if (!bFlush && m_nCodecId == CODEC_ID_H264) {
- if(!m_h264RandomAccess.searchRecoveryPoint(m_pAVCtx, pDataIn, nSize)) {
+ if (!m_h264RandomAccess.searchRecoveryPoint(m_pAVCtx, pDataIn, nSize)) {
return S_OK;
}
}
@@ -1618,7 +1618,7 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int
continue;
}
- if(pIn->IsPreroll() == S_OK || rtStart < 0) {
+ if (pIn->IsPreroll() == S_OK || rtStart < 0) {
return S_OK;
}
@@ -1626,15 +1626,15 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int
BYTE* pDataOut = NULL;
UpdateAspectRatio();
- if(FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut))) {
+ if (FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
if (m_nCodecId == CODEC_ID_THEORA ||
- m_nCodecId == CODEC_ID_VP8 && m_rtAvrTimePerFrame == 10000) { // need more tests
- rtStart = m_pFrame->pkt_pts;
- rtStop = m_pFrame->pkt_dts;
- } else if((m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30 || m_nCodecId == CODEC_ID_RV40) && m_pFrame->pict_type == AV_PICTURE_TYPE_B) {
+ m_nCodecId == CODEC_ID_VP8 && m_rtAvrTimePerFrame == 10000) { // need more tests
+ rtStart = m_pFrame->pkt_pts;
+ rtStop = m_pFrame->pkt_dts;
+ } else if ((m_nCodecId == CODEC_ID_RV10 || m_nCodecId == CODEC_ID_RV20 || m_nCodecId == CODEC_ID_RV30 || m_nCodecId == CODEC_ID_RV40) && m_pFrame->pict_type == AV_PICTURE_TYPE_B) {
rtStart = m_rtPrevStop;
rtStop = rtStart + m_rtAvrTimePerFrame;
} else {
@@ -1679,7 +1679,7 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int
}
}
int nTempCsp = m_nOutCsp;
- if(outcspInfo->id==FF_CSP_420P) {
+ if (outcspInfo->id==FF_CSP_420P) {
csp_yuv_adj_to_plane(nTempCsp,outcspInfo,odd2even(m_pOutSize.cy),(unsigned char**)dst,(stride_t*)dstStride);
} else {
csp_yuv_adj_to_plane(nTempCsp,outcspInfo,m_pAVCtx->height,(unsigned char**)dst,(stride_t*)dstStride);
@@ -1823,7 +1823,7 @@ HRESULT CMPCVideoDecFilter::Transform(IMediaSample* pIn)
REFERENCE_TIME rtStart = _I64_MIN;
REFERENCE_TIME rtStop = _I64_MIN;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
@@ -1851,14 +1851,14 @@ HRESULT CMPCVideoDecFilter::Transform(IMediaSample* pIn)
// rtStart = rtStop = m_rtLastStart + m_nCountEstimated*m_rtAvrTimePerFrame;
//}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
rtStart = rtStop = _I64_MIN;
}
if (rtStop <= rtStart && rtStop != _I64_MIN) {
rtStop = rtStart + m_rtAvrTimePerFrame / m_dRate;
}
- if(m_nDXVAMode == MODE_SOFTWARE) {
+ if (m_nDXVAMode == MODE_SOFTWARE) {
UpdateFrameTime(rtStart, rtStop);
}
@@ -1932,13 +1932,13 @@ HRESULT CMPCVideoDecFilter::Transform(IMediaSample* pIn)
void CMPCVideoDecFilter::UpdateAspectRatio()
{
- if(((m_nARMode) && (m_pAVCtx)) && ((m_pAVCtx->sample_aspect_ratio.num>0) && (m_pAVCtx->sample_aspect_ratio.den>0))) {
+ if (((m_nARMode) && (m_pAVCtx)) && ((m_pAVCtx->sample_aspect_ratio.num>0) && (m_pAVCtx->sample_aspect_ratio.den>0))) {
CSize SAR(m_pAVCtx->sample_aspect_ratio.num, m_pAVCtx->sample_aspect_ratio.den);
- if(m_sar != SAR) {
+ if (m_sar != SAR) {
m_sar = SAR;
CSize aspect(m_nWidth * SAR.cx, m_nHeight * SAR.cy);
int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
aspect.cx /= lnko, aspect.cy /= lnko;
}
SetAspect(aspect);
@@ -2329,15 +2329,15 @@ STDMETHODIMP CMPCVideoDecFilter::CreatePage(const GUID& guid, IPropertyPage** pp
{
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMPCVideoDecSettingsWnd)) {
+ if (guid == __uuidof(CMPCVideoDecSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecSettingsWnd>(NULL, &hr))->AddRef();
- } else if(guid == __uuidof(CMPCVideoDecCodecWnd)) {
+ } else if (guid == __uuidof(CMPCVideoDecCodecWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecCodecWnd>(NULL, &hr))->AddRef();
}
@@ -2349,7 +2349,7 @@ STDMETHODIMP CMPCVideoDecFilter::Apply()
{
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"))) {
key.SetDWORDValue(_T("ThreadNumber"), m_nThreadNumber);
key.SetDWORDValue(_T("DiscardMode"), m_nDiscardMode);
key.SetDWORDValue(_T("ErrorRecognition"), m_nErrorRecognition);
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
index c25465876..3b7690224 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
@@ -108,8 +108,8 @@ protected:
int m_nPosB;
int m_nWidth; // Frame width give to input pin
int m_nHeight; // Frame height give to input pin
-
- bool m_bTheoraMTSupport;
+
+ bool m_bTheoraMTSupport;
// Buffer management for truncated stream (store stream chunks & reference time sent by splitter)
BYTE* m_pFFBuffer;
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
index a2713a6a4..b72be5d82 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
@@ -83,11 +83,11 @@ bool CMPCVideoDecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnk
m_pMDF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMDF = pUnks.GetNext(pos))) {
;
}
- if(!m_pMDF) {
+ if (!m_pMDF) {
return false;
}
@@ -113,7 +113,7 @@ bool CMPCVideoDecSettingsWnd::OnActivate()
m_cbThreadNumber.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230, nPosY-4, 290, nPosY+90), this, IDC_PP_THREAD_NUMBER);
m_cbThreadNumber.AddString(_T("Auto"));
CString ThreadNumberStr;
- for(int i=0; i<16; i++) {
+ for (int i=0; i<16; i++) {
ThreadNumberStr.Format(_T("%d"), i+1);
m_cbThreadNumber.AddString(ThreadNumberStr);
}
@@ -192,7 +192,7 @@ bool CMPCVideoDecSettingsWnd::OnActivate()
m_edtDXVAMode.ShowWindow (SW_HIDE);
}
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -228,7 +228,7 @@ bool CMPCVideoDecSettingsWnd::OnApply()
{
OnDeactivate();
- if(m_pMDF && m_cbDXVACompatibilityCheck.m_hWnd) {
+ if (m_pMDF && m_cbDXVACompatibilityCheck.m_hWnd) {
#if HAS_FFMPEG_VIDEO_DECODERS
#if INTERNAL_DECODER_H264
m_pMDF->SetThreadNumber (m_cbThreadNumber.GetCurSel());
@@ -268,11 +268,11 @@ bool CMPCVideoDecCodecWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknow
m_pMDF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMDF = pUnks.GetNext(pos))) {
;
}
- if(!m_pMDF) {
+ if (!m_pMDF) {
return false;
}
@@ -341,7 +341,7 @@ bool CMPCVideoDecCodecWnd::OnActivate()
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_RV) != 0);
#endif
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -356,7 +356,7 @@ bool CMPCVideoDecCodecWnd::OnApply()
{
OnDeactivate();
- if(m_pMDF) {
+ if (m_pMDF) {
int nActiveCodecs = 0;
int nPos = 0;
diff --git a/src/filters/transform/MPCVideoDec/stdafx.cpp b/src/filters/transform/MPCVideoDec/stdafx.cpp
index a321c46cd..61e5632a5 100644
--- a/src/filters/transform/MPCVideoDec/stdafx.cpp
+++ b/src/filters/transform/MPCVideoDec/stdafx.cpp
@@ -31,9 +31,9 @@ void LOG(LPCTSTR fmt, ...)
{
va_list args;
va_start(args, fmt);
- if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1]) {
+ if (TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1]) {
_vstprintf(buff, fmt, args);
- if(FILE* f = _tfopen(LOG_FILE, _T("at"))) {
+ if (FILE* f = _tfopen(LOG_FILE, _T("at"))) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
diff --git a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
index c81d3c1bc..03bf72bcd 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
+++ b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
@@ -166,10 +166,10 @@ const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] = {
#ifdef REGISTER_FILTER
#ifdef _WIN64
- #ifdef _DEBUG
- extern "C" int mingw_app_type = 1; /* 0:console, 1:windows. */
- #endif
- void *__imp_toupper = toupper;
+#ifdef _DEBUG
+extern "C" int mingw_app_type = 1; /* 0:console, 1:windows. */
+#endif
+void *__imp_toupper = toupper;
#endif
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] = {
@@ -324,23 +324,23 @@ CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
, m_boost(1)
, m_bResync(false)
{
- if(phr) {
+ if (phr) {
*phr = S_OK;
}
m_pInput = DNew CMpaDecInputPin(this, phr, L"In");
- if(!m_pInput) {
+ if (!m_pInput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out");
- if(!m_pOutput) {
+ if (!m_pOutput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
delete m_pInput, m_pInput = NULL;
return;
}
@@ -365,27 +365,27 @@ CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"), KEY_READ)) {
DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("SampleFormat"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("SampleFormat"), dw)) {
m_iSampleFormat = (MPCSampleFormat)dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Normalize"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Normalize"), dw)) {
m_fNormalize = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Boost"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Boost"), dw)) {
m_boost = *(float*)&dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3SpeakerConfig"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3SpeakerConfig"), dw)) {
m_iSpeakerConfig[ac3] = (int)dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsSpeakerConfig"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsSpeakerConfig"), dw)) {
m_iSpeakerConfig[dts] = (int)dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3DynamicRangeControl"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3DynamicRangeControl"), dw)) {
m_fDynamicRangeControl[ac3] = !!dw;
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsDynamicRangeControl"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsDynamicRangeControl"), dw)) {
m_fDynamicRangeControl[dts] = !!dw;
}
}
@@ -484,12 +484,12 @@ HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA) {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pIn);
}
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
m_pInput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -499,7 +499,7 @@ HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
}
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
@@ -510,29 +510,29 @@ HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
hr = pIn->GetTime(&rtStart, &rtStop);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
TRACE(_T("CMpaDecFilter::Receive(): rtStart = %10I64d, rtStop = %10I64d\n"), rtStart, rtStop);
} else {
TRACE(_T("CMpaDecFilter::Receive(): frame without timestamp\n"));
}
- if(pIn->IsDiscontinuity() == S_OK) {
+ if (pIn->IsDiscontinuity() == S_OK) {
m_fDiscontinuity = true;
m_buff.RemoveAll();
m_rtStart = rtStart;
m_sample_max = 0.1f;
m_bResync = true;
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE(_T("CMpaDecFilter::Receive() : Discontinuity without timestamp\n"));
return S_OK;
}
}
- if(SUCCEEDED(hr) && ((_abs64((m_rtStart - rtStart)) > MAX_JITTER) || m_bResync)) {
- m_buff.RemoveAll();
+ if (SUCCEEDED(hr) && ((_abs64((m_rtStart - rtStart)) > MAX_JITTER) || m_bResync)) {
+ m_buff.RemoveAll();
m_rtStart = rtStart;
m_bResync = false;
- }
+ }
int bufflen = m_buff.GetCount();
m_buff.SetCount(bufflen + len, 4096);
@@ -543,81 +543,81 @@ HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
#if defined(REGISTER_FILTER) | HAS_FFMPEG_AUDIO_DECODERS
enum CodecID nCodecId = FindCodec(subtype);
- if(nCodecId != CODEC_ID_NONE) {
+ if (nCodecId != CODEC_ID_NONE) {
return ProcessFFmpeg(nCodecId);
}
#endif
- if(0) {} // needed if decoders are disabled below
+ if (0) {} // needed if decoders are disabled below
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_LPCM
- else if(subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
+ else if (subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
hr = ProcessLPCM();
- } else if(subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
+ } else if (subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
hr = ProcessHdmvLPCM(!!pIn->IsSyncPoint());
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_AC3
- else if(subtype == MEDIASUBTYPE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
- subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
+ else if (subtype == MEDIASUBTYPE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
+ subtype == MEDIASUBTYPE_DOLBY_TRUEHD) {
hr = ProcessAC3();
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_DTS
- else if(subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS) {
+ else if (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS) {
hr = ProcessDTS();
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_PS2AUDIO
- else if(subtype == MEDIASUBTYPE_PS2_PCM) {
+ else if (subtype == MEDIASUBTYPE_PS2_PCM) {
hr = ProcessPS2PCM();
- } else if(subtype == MEDIASUBTYPE_PS2_ADPCM) {
+ } else if (subtype == MEDIASUBTYPE_PS2_ADPCM) {
hr = ProcessPS2ADPCM();
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_FLAC
- else if(subtype == MEDIASUBTYPE_FLAC_FRAMED) {
+ else if (subtype == MEDIASUBTYPE_FLAC_FRAMED) {
hr = ProcessFlac();
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_PCM
- else if(subtype == MEDIASUBTYPE_PCM_NONE ||
- subtype == MEDIASUBTYPE_PCM_RAW) {
- if(m_buff.GetCount() < 480) {
+ else if (subtype == MEDIASUBTYPE_PCM_NONE ||
+ subtype == MEDIASUBTYPE_PCM_RAW) {
+ if (m_buff.GetCount() < 480) {
return S_OK;
}
hr = ProcessPCMraw();
- } else if(subtype == MEDIASUBTYPE_PCM_TWOS) {
- if(m_buff.GetCount() < 960) {
+ } else if (subtype == MEDIASUBTYPE_PCM_TWOS) {
+ if (m_buff.GetCount() < 960) {
return S_OK;
}
hr = ProcessPCMintBE();
- } else if(subtype == MEDIASUBTYPE_PCM_SOWT) {
- if(m_buff.GetCount() < 960) {
+ } else if (subtype == MEDIASUBTYPE_PCM_SOWT) {
+ if (m_buff.GetCount() < 960) {
return S_OK;
}
hr = ProcessPCMintLE();
- } else if(subtype == MEDIASUBTYPE_PCM_IN24 ||
- subtype == MEDIASUBTYPE_PCM_IN32) {
- if(m_buff.GetCount() < 1920) {
+ } else if (subtype == MEDIASUBTYPE_PCM_IN24 ||
+ subtype == MEDIASUBTYPE_PCM_IN32) {
+ if (m_buff.GetCount() < 1920) {
return S_OK;
}
hr = ProcessPCMintBE();
- } else if(subtype == MEDIASUBTYPE_PCM_IN24_le ||
- subtype == MEDIASUBTYPE_PCM_IN32_le) {
- if(m_buff.GetCount() < 1920) {
+ } else if (subtype == MEDIASUBTYPE_PCM_IN24_le ||
+ subtype == MEDIASUBTYPE_PCM_IN32_le) {
+ if (m_buff.GetCount() < 1920) {
return S_OK;
}
hr = ProcessPCMintLE();
- } else if(subtype == MEDIASUBTYPE_PCM_FL32 ||
- subtype == MEDIASUBTYPE_PCM_FL64) {
- if(m_buff.GetCount() < 3840) {
+ } else if (subtype == MEDIASUBTYPE_PCM_FL32 ||
+ subtype == MEDIASUBTYPE_PCM_FL64) {
+ if (m_buff.GetCount() < 3840) {
return S_OK;
}
hr = ProcessPCMfloatBE();
- } else if(subtype == MEDIASUBTYPE_PCM_FL32_le ||
- subtype == MEDIASUBTYPE_PCM_FL64_le) {
- if(m_buff.GetCount() < 3840) {
+ } else if (subtype == MEDIASUBTYPE_PCM_FL32_le ||
+ subtype == MEDIASUBTYPE_PCM_FL64_le) {
+ if (m_buff.GetCount() < 3840) {
return S_OK;
}
hr = ProcessPCMfloatLE();
@@ -655,25 +655,25 @@ HRESULT CMpaDecFilter::ProcessLPCM()
long nSamples = len/(BytesPerDoubleChannelSample);
int16 Temp[2][8];
for (int i=0; i<nSamples; i++) {
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint16 All = *((uint16 *)pDataIn);
pDataIn += 2;
int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
Temp[0][j] = Part1;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint16 All = *((uint16 *)pDataIn);
pDataIn += 2;
int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
Temp[1][j] = Part1;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[0][nRemap]) / float(SHRT_MAX);
++pDataOut;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[1][nRemap]) / float(SHRT_MAX);
++pDataOut;
@@ -687,13 +687,13 @@ HRESULT CMpaDecFilter::ProcessLPCM()
int32 Temp[2][8];
for (int i=0; i<nSamples; i++) {
// Start by upper 16 bits
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint16 *)pDataIn);
pDataIn += 2;
uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
Temp[0][j] = Part1;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint16 *)pDataIn);
pDataIn += 2;
uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
@@ -701,24 +701,24 @@ HRESULT CMpaDecFilter::ProcessLPCM()
}
// Continue with lower bits
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint8 *)pDataIn);
pDataIn += 1;
Temp[0][j] = int32(Temp[0][j] | (All << 8)) >> 8;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint8 *)pDataIn);
pDataIn += 1;
Temp[1][j] = int32(Temp[1][j] | (All << 8)) >> 8;
}
// Convert into float
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[0][nRemap]) / float(1<<23);
++pDataOut;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[1][nRemap]) / float(1<<23);
++pDataOut;
@@ -731,13 +731,13 @@ HRESULT CMpaDecFilter::ProcessLPCM()
int32 Temp[2][8];
for (int i=0; i<nSamples; i++) {
// Start by upper 16 bits
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint16 *)pDataIn);
pDataIn += 2;
uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
Temp[0][j] = Part1;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint16 *)pDataIn);
pDataIn += 2;
uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
@@ -745,7 +745,7 @@ HRESULT CMpaDecFilter::ProcessLPCM()
}
// Continue with lower bits
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
uint32 All = *((uint8 *)pDataIn);
pDataIn += 1;
Temp[0][j] = int32(Temp[0][j] | ((All&0xf0) << 8)) >> 8;
@@ -753,12 +753,12 @@ HRESULT CMpaDecFilter::ProcessLPCM()
}
// Convert into float
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[0][nRemap]) / float(1<<23);
++pDataOut;
}
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
int nRemap = remap->ch[j];
*pDataOut = float(Temp[1][nRemap]) / float(1<<23);
++pDataOut;
@@ -799,7 +799,7 @@ HRESULT CMpaDecFilter::ProcessHdmvLPCM(bool bAlignOldBuffer) // Blu ray LPCM
switch (wfein->wBitsPerSample) {
case 16 :
for (int i=0; i<nFrames; i++) {
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
BYTE nRemap = remap->ch[j];
*pDataOut = (float)(short)(pDataIn[nRemap*2]<<8 | pDataIn[nRemap*2+1]) / 32768;
pDataOut++;
@@ -810,7 +810,7 @@ HRESULT CMpaDecFilter::ProcessHdmvLPCM(bool bAlignOldBuffer) // Blu ray LPCM
case 24 :
case 20 :
for (int i=0; i<nFrames; i++) {
- for(int j = 0; j < nChannels; j++) {
+ for (int j = 0; j < nChannels; j++) {
BYTE nRemap = remap->ch[j];
*pDataOut = (float)(long)(pDataIn[nRemap*3]<<24 | pDataIn[nRemap*3+1]<<16 | pDataIn[nRemap*3+2]<<8) / 0x80000000;
pDataOut++;
@@ -831,17 +831,17 @@ HRESULT CMpaDecFilter::ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoug
{
int flags, sample_rate, bit_rate;
- if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0) {
+ if ((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0) {
// TRACE(_T("ac3: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d\n"), size, flags, sample_rate, bit_rate);
fEnoughData = size <= buffsize;
- if(fEnoughData) {
+ if (fEnoughData) {
int iSpeakerConfig = GetSpeakerConfig(ac3);
- if(iSpeakerConfig < 0) {
+ if (iSpeakerConfig < 0) {
HRESULT hr;
- if(S_OK != (hr = DeliverBitstream(p, size, sample_rate, 1536, 0x0001))) {
+ if (S_OK != (hr = DeliverBitstream(p, size, sample_rate, 1536, 0x0001))) {
return hr;
}
} else {
@@ -851,8 +851,8 @@ HRESULT CMpaDecFilter::ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoug
sample_t level = 1, gain = 1, bias = 0;
level *= gain;
- if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0) {
- if(GetDynamicRangeControl(ac3)) {
+ if (a52_frame(m_a52_state, p, &flags, &level, bias) == 0) {
+ if (GetDynamicRangeControl(ac3)) {
a52_dynrng(m_a52_state, NULL, NULL);
}
@@ -865,20 +865,20 @@ HRESULT CMpaDecFilter::ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoug
int i = 0;
- for(; i < 6 && a52_block(m_a52_state) == 0; i++) {
+ for (; i < 6 && a52_block(m_a52_state) == 0; i++) {
sample_t* samples = a52_samples(m_a52_state);
- for(int j = 0; j < 256; j++, samples++) {
- for(int ch = 0; ch < scmap.nChannels; ch++) {
+ for (int j = 0; j < 256; j++, samples++) {
+ for (int ch = 0; ch < scmap.nChannels; ch++) {
ASSERT(scmap.ch[ch] != -1);
*p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
}
}
}
- if(i == 6) {
+ if (i == 6) {
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
+ if (S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
return hr;
}
}
@@ -898,20 +898,20 @@ HRESULT CMpaDecFilter::ProcessAC3()
BYTE* base = p;
BYTE* end = p + m_buff.GetCount();
- while(end - p >= 7) {
+ while (end - p >= 7) {
int size = 0, flags, sample_rate, bit_rate;
- if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0) {
+ if ((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0) {
// TRACE(_T("ac3: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d\n"), size, flags, sample_rate, bit_rate);
bool fEnoughData = p + size <= end;
- if(fEnoughData) {
+ if (fEnoughData) {
int iSpeakerConfig = GetSpeakerConfig(ac3);
- if(iSpeakerConfig < 0) {
+ if (iSpeakerConfig < 0) {
HRESULT hr;
- if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001))) {
+ if (S_OK != (hr = Deliver(p, size, bit_rate, 0x0001))) {
return hr;
}
} else {
@@ -921,8 +921,8 @@ HRESULT CMpaDecFilter::ProcessAC3()
sample_t level = 1, gain = 1, bias = 0;
level *= gain;
- if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0) {
- if(GetDynamicRangeControl(ac3)) {
+ if (a52_frame(m_a52_state, p, &flags, &level, bias) == 0) {
+ if (GetDynamicRangeControl(ac3)) {
a52_dynrng(m_a52_state, NULL, NULL);
}
@@ -935,20 +935,20 @@ HRESULT CMpaDecFilter::ProcessAC3()
int i = 0;
- for(; i < 6 && a52_block(m_a52_state) == 0; i++) {
+ for (; i < 6 && a52_block(m_a52_state) == 0; i++) {
sample_t* samples = a52_samples(m_a52_state);
- for(int j = 0; j < 256; j++, samples++) {
- for(int ch = 0; ch < scmap.nChannels; ch++) {
+ for (int j = 0; j < 256; j++, samples++) {
+ for (int ch = 0; ch < scmap.nChannels; ch++) {
ASSERT(scmap.ch[ch] != -1);
*p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
}
}
}
- if(i == 6) {
+ if (i == 6) {
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
+ if (S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
return hr;
}
}
@@ -962,7 +962,7 @@ HRESULT CMpaDecFilter::ProcessAC3()
end = base + (end - p);
p = base;
- if(!fEnoughData) {
+ if (!fEnoughData) {
break;
}
} else {
@@ -984,7 +984,7 @@ HRESULT CMpaDecFilter::ProcessAC3()
BYTE* base = p;
BYTE* end = p + m_buff.GetCount();
- while(p < end && end - p >= AC3_HEADER_SIZE) {
+ while (p < end && end - p >= AC3_HEADER_SIZE) {
int size = 0;
bool fEnoughData = true;
@@ -1045,7 +1045,7 @@ HRESULT CMpaDecFilter::ProcessAC3()
memmove(base, p, end - p);
end = base + (end - p);
p = base;
- if(!fEnoughData) {
+ if (!fEnoughData) {
break;
}
}
@@ -1072,7 +1072,7 @@ HRESULT CMpaDecFilter::ProcessFFmpeg(enum CodecID nCodecId)
m_bResync = true;
return S_OK;
}
-
+
if (size <= 0) {
return hr;
}
@@ -1093,21 +1093,21 @@ HRESULT CMpaDecFilter::ProcessDTS()
BYTE* base = p;
BYTE* end = p + m_buff.GetCount();
- while(end - p >= 14) {
+ while (end - p >= 14) {
int size = 0, flags, sample_rate, bit_rate, frame_length;
- if((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0) {
+ if ((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0) {
// TRACE(_T("dts: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d, frame_length=%d\n"), size, flags, sample_rate, bit_rate, frame_length);
bit_rate = int (size * 8i64 * sample_rate / frame_length); // calculate actual bitrate
bool fEnoughData = p + size <= end;
- if(fEnoughData) {
+ if (fEnoughData) {
int iSpeakerConfig = GetSpeakerConfig(dts);
- if(iSpeakerConfig < 0) {
+ if (iSpeakerConfig < 0) {
HRESULT hr;
- if(S_OK != (hr = DeliverBitstream(p, size, sample_rate, frame_length, 0x000b))) {
+ if (S_OK != (hr = DeliverBitstream(p, size, sample_rate, frame_length, 0x000b))) {
return hr;
}
} else {
@@ -1117,8 +1117,8 @@ HRESULT CMpaDecFilter::ProcessDTS()
sample_t level = 1, gain = 1, bias = 0;
level *= gain;
- if(dts_frame(m_dts_state, p, &flags, &level, bias) == 0) {
- if(GetDynamicRangeControl(dts)) {
+ if (dts_frame(m_dts_state, p, &flags, &level, bias) == 0) {
+ if (GetDynamicRangeControl(dts)) {
dts_dynrng(m_dts_state, NULL, NULL);
}
@@ -1133,20 +1133,20 @@ HRESULT CMpaDecFilter::ProcessDTS()
int i = 0;
- for(; i < blocks && dts_block(m_dts_state) == 0; i++) {
+ for (; i < blocks && dts_block(m_dts_state) == 0; i++) {
sample_t* samples = dts_samples(m_dts_state);
- for(int j = 0; j < 256; j++, samples++) {
- for(int ch = 0; ch < scmap.nChannels; ch++) {
+ for (int j = 0; j < 256; j++, samples++) {
+ for (int ch = 0; ch < scmap.nChannels; ch++) {
ASSERT(scmap.ch[ch] != -1);
*p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
}
}
}
- if(i == blocks) {
+ if (i == blocks) {
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
+ if (S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask))) {
return hr;
}
}
@@ -1160,7 +1160,7 @@ HRESULT CMpaDecFilter::ProcessDTS()
end = base + (end - p);
p = base;
- if(!fEnoughData) {
+ if (!fEnoughData) {
break;
}
} else {
@@ -1184,17 +1184,17 @@ HRESULT CMpaDecFilter::ProcessPCMraw() //'raw '
pBuff.SetCount(nSamples);
float* f = pBuff.GetData();
- switch(wfe->wBitsPerSample) {
+ switch (wfe->wBitsPerSample) {
case 8: { //unsigned 8-bit
BYTE* b = m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(CHAR)(b[i] - 128) / 128;
}
}
break;
case 16: { //signed big-endian 16 bit
USHORT* d = (USHORT*)m_buff.GetData();//signed take as an unsigned to shift operations.
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(SHORT)(d[i] << 8 | d[i] >> 8) / 32768;
}
}
@@ -1202,7 +1202,7 @@ HRESULT CMpaDecFilter::ProcessPCMraw() //'raw '
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1219,24 +1219,24 @@ HRESULT CMpaDecFilter::ProcessPCMintBE() //'twos', big-endian 'in24' and 'in32'
pBuff.SetCount(nSamples);
float* f = pBuff.GetData();
- switch(wfe->wBitsPerSample) {
+ switch (wfe->wBitsPerSample) {
case 8: { //signed 8-bit
CHAR* b = (CHAR*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)b[i] / 128;
}
}
break;
case 16: { //signed big-endian 16-bit
USHORT* d = (USHORT*)m_buff.GetData();//signed take as an unsigned to shift operations.
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(SHORT)(d[i] << 8 | d[i] >> 8) / 32768;
}
}
break;
case 24: { //signed big-endian 24-bit
BYTE* b = (BYTE*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(signed int)((unsigned int)b[3*i] << 24 |
(unsigned int)b[3*i+1] << 16 |
(unsigned int)b[3*i+2] << 8) / 2147483648;
@@ -1245,7 +1245,7 @@ HRESULT CMpaDecFilter::ProcessPCMintBE() //'twos', big-endian 'in24' and 'in32'
break;
case 32: { //signed big-endian 32-bit
UINT* q = (UINT*)m_buff.GetData();//signed take as an unsigned to shift operations.
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(INT)(q[i] >> 24 |
(q[i] & 0x00ff0000) >> 8 |
(q[i] & 0x0000ff00) << 8 |
@@ -1256,7 +1256,7 @@ HRESULT CMpaDecFilter::ProcessPCMintBE() //'twos', big-endian 'in24' and 'in32'
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1273,24 +1273,24 @@ HRESULT CMpaDecFilter::ProcessPCMintLE() //'sowt', little-endian 'in24' and 'in3
pBuff.SetCount(nSamples);
float* f = pBuff.GetData();
- switch(wfe->wBitsPerSample) {
+ switch (wfe->wBitsPerSample) {
case 8: { //signed 8-bit
CHAR* b = (CHAR*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)b[i] / 128;
}
}
break;
case 16: { //signed little-endian 16-bit
SHORT* d = (SHORT*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)d[i] / 32768;
}
}
break;
case 24: { //signed little-endian 32-bit
BYTE* b = (BYTE*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)(signed int)((unsigned int)b[3*i] << 8 |
(unsigned int)b[3*i+1] << 16 |
(unsigned int)b[3*i+2] << 24) / 2147483648;
@@ -1299,7 +1299,7 @@ HRESULT CMpaDecFilter::ProcessPCMintLE() //'sowt', little-endian 'in24' and 'in3
break;
case 32: { //signed little-endian 32-bit
INT* q = (INT*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)q[i] / 2147483648;
}
}
@@ -1307,7 +1307,7 @@ HRESULT CMpaDecFilter::ProcessPCMintLE() //'sowt', little-endian 'in24' and 'in3
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1324,11 +1324,11 @@ HRESULT CMpaDecFilter::ProcessPCMfloatBE() //big-endian 'fl32' and 'fl64'
pBuff.SetCount(nSamples);
float* f = pBuff.GetData();
- switch(wfe->wBitsPerSample) {
+ switch (wfe->wBitsPerSample) {
case 32: {
unsigned int* q = (unsigned int*)m_buff.GetData();
unsigned int* vf = (unsigned int*)f;
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
vf[i] = q[i] >> 24 |
(q[i] & 0x00ff0000) >> 8 |
(q[i] & 0x0000ff00) << 8 |
@@ -1339,7 +1339,7 @@ HRESULT CMpaDecFilter::ProcessPCMfloatBE() //big-endian 'fl32' and 'fl64'
case 64: {
unsigned __int64* q = (unsigned __int64*)m_buff.GetData();
unsigned __int64 x;
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
x = q[i] >>56 |
(q[i] & 0x00FF000000000000) >> 40 |
(q[i] & 0x0000FF0000000000) >> 24 |
@@ -1355,7 +1355,7 @@ HRESULT CMpaDecFilter::ProcessPCMfloatBE() //big-endian 'fl32' and 'fl64'
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1372,17 +1372,17 @@ HRESULT CMpaDecFilter::ProcessPCMfloatLE() //little-endian 'fl32' and 'fl64'
pBuff.SetCount(nSamples);
float* f = pBuff.GetData();
- switch(wfe->wBitsPerSample) {
+ switch (wfe->wBitsPerSample) {
case 32: {
float* q = (float*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = q[i];
}
}
break;
case 64: {
double* q = (double*)m_buff.GetData();
- for(int i = 0; i < nSamples; i++) {
+ for (int i = 0; i < nSamples; i++) {
f[i] = (float)q[i];
}
}
@@ -1390,7 +1390,7 @@ HRESULT CMpaDecFilter::ProcessPCMfloatLE() //little-endian 'fl32' and 'fl64'
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1415,30 +1415,30 @@ HRESULT CMpaDecFilter::ProcessPS2PCM()
pBuff.SetCount(samples*channels);
float* f = pBuff.GetData();
- while(end - p >= size) {
+ while (end - p >= size) {
DWORD* dw = (DWORD*)p;
- if(dw[0] == 'dhSS') {
+ if (dw[0] == 'dhSS') {
p += dw[1] + 8;
- } else if(dw[0] == 'dbSS') {
+ } else if (dw[0] == 'dbSS') {
p += 8;
m_ps2_state.sync = true;
} else {
- if(m_ps2_state.sync) {
+ if (m_ps2_state.sync) {
short* s = (short*)p;
- for(int i = 0; i < samples; i++)
- for(int j = 0; j < channels; j++) {
+ for (int i = 0; i < samples; i++)
+ for (int j = 0; j < channels; j++) {
f[i*channels+j] = (float)s[j*samples+i] / 32768;
}
} else {
- for(int i = 0, j = samples*channels; i < j; i++) {
+ for (int i = 0, j = samples*channels; i < j; i++) {
f[i] = 0;
}
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1462,7 +1462,7 @@ static void decodeps2adpcm(ps2_state_t& s, int channel, BYTE* pin, double* pout)
int unk = pin[1]; // ?
UNUSED_ALWAYS(unk);
- if(tbl_index >= 10) {
+ if (tbl_index >= 10) {
ASSERT(0);
return;
}
@@ -1477,7 +1477,7 @@ static void decodeps2adpcm(ps2_state_t& s, int channel, BYTE* pin, double* pout)
double& a = s.a[channel];
double& b = s.b[channel];
- for(int i = 0; i < 28; i++) {
+ for (int i = 0; i < 28; i++) {
short input = (short)(((pin[2+i/2] >> ((i&1) << 2)) & 0xf) << 12) >> shift;
double output = a * tbl[1] + b * tbl[0] + input;
@@ -1503,37 +1503,37 @@ HRESULT CMpaDecFilter::ProcessPS2ADPCM()
pBuff.SetCount(samples*channels);
float* f = pBuff.GetData();
- while(end - p >= size) {
+ while (end - p >= size) {
DWORD* dw = (DWORD*)p;
- if(dw[0] == 'dhSS') {
+ if (dw[0] == 'dhSS') {
p += dw[1] + 8;
- } else if(dw[0] == 'dbSS') {
+ } else if (dw[0] == 'dbSS') {
p += 8;
m_ps2_state.sync = true;
} else {
- if(m_ps2_state.sync) {
+ if (m_ps2_state.sync) {
double* tmp = DNew double[samples*channels];
- for(int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
- for(DWORD i = 0; i < wfe->dwInterleave; i += 16, k += 28) {
+ for (int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
+ for (DWORD i = 0; i < wfe->dwInterleave; i += 16, k += 28) {
decodeps2adpcm(m_ps2_state, channel, p + i + j, tmp + k);
}
- for(int i = 0, k = 0; i < samples; i++)
- for(int j = 0; j < channels; j++, k++) {
+ for (int i = 0, k = 0; i < samples; i++)
+ for (int j = 0; j < channels; j++, k++) {
f[k] = (float)tmp[j*samples+i];
}
delete [] tmp;
} else {
- for(int i = 0, j = samples*channels; i < j; i++) {
+ for (int i = 0, j = samples*channels; i < j; i++) {
f[i] = 0;
}
}
HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
+ if (S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels))) {
return hr;
}
@@ -1567,13 +1567,13 @@ HRESULT CMpaDecFilter::GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData)
HRESULT hr;
*pData = NULL;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(pSample, NULL, NULL, 0))
+ if (FAILED(hr = m_pOutput->GetDeliveryBuffer(pSample, NULL, NULL, 0))
|| FAILED(hr = (*pSample)->GetPointer(pData))) {
return hr;
}
AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED((*pSample)->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED((*pSample)->GetMediaType(&pmt)) && pmt) {
CMediaType mt = *pmt;
m_pOutput->SetMediaType(&mt);
DeleteMediaType(pmt);
@@ -1594,13 +1594,13 @@ HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WO
int nSamples = pBuff.GetCount()/wfe->nChannels;
- if(FAILED(hr = ReconnectOutput(nSamples, mt))) {
+ if (FAILED(hr = ReconnectOutput(nSamples, mt))) {
return hr;
}
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut))) {
+ if (FAILED(GetDeliveryBuffer(&pOut, &pDataOut))) {
return E_FAIL;
}
@@ -1608,11 +1608,11 @@ HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WO
REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
m_rtStart += rtDur;
//TRACE(_T("CMpaDecFilter: %I64d - %I64d\n"), rtStart/10000, rtStop/10000);
- if(rtStart < 0 /*200000*/ /* < 0, FIXME: 0 makes strange noises */) {
+ if (rtStart < 0 /*200000*/ /* < 0, FIXME: 0 makes strange noises */) {
return S_OK;
}
- if(hr == S_OK) {
+ if (hr == S_OK) {
m_pOutput->SetMediaType(&mt);
pOut->SetMediaType(&mt);
}
@@ -1636,13 +1636,13 @@ HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WO
// TODO: move this into the audio switcher
float sample_mul = 1;
- if(m_fNormalize) {
- for(int i = 0, len = pBuff.GetCount(); i < len; i++) {
+ if (m_fNormalize) {
+ for (int i = 0, len = pBuff.GetCount(); i < len; i++) {
float f = *pDataIn++;
- if(f < 0) {
+ if (f < 0) {
f = -f;
}
- if(m_sample_max < f) {
+ if (m_sample_max < f) {
m_sample_max = f;
}
}
@@ -1653,28 +1653,28 @@ HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WO
bool fBoost = m_boost > 1;
double boost = 1+log10(m_boost);
- for(int i = 0, len = pBuff.GetCount(); i < len; i++) {
+ for (int i = 0, len = pBuff.GetCount(); i < len; i++) {
float f = *pDataIn++;
// TODO: move this into the audio switcher
- if(m_fNormalize) {
+ if (m_fNormalize) {
f *= sample_mul;
}
- if(fBoost) {
+ if (fBoost) {
f *= boost;
}
- if(f < -1) {
+ if (f < -1) {
f = -1;
- } else if(f > 1) {
+ } else if (f > 1) {
f = 1;
}
#define round(x) ((x) > 0 ? (x) + 0.5 : (x) - 0.5)
- switch(sf) {
+ switch (sf) {
default:
case SF_PCM16:
*(short*)pDataOut = (short)round(f * SHRT_MAX);
@@ -1707,15 +1707,15 @@ HRESULT CMpaDecFilter::DeliverBitstream(BYTE* pBuff, int size, int sample_rate,
bool isDTSWAV = false;
int length = 0;
-
+
if (type == 0x0b) { // DTS
if (size == 4096 && sample_rate == 44100 && samples == 1024) { // DTSWAV
length = size;
isDTSWAV = true;
}
- else while(length < size+16) {
- length += 2048;
- }
+ else while (length < size+16) {
+ length += 2048;
+ }
} else { //if (type == 0x01) { // AC3
length = samples*4;
}
@@ -1727,13 +1727,13 @@ HRESULT CMpaDecFilter::DeliverBitstream(BYTE* pBuff, int size, int sample_rate,
mt = CreateMediaTypeSPDIF();
}
- if(FAILED(hr = ReconnectOutput(length, mt))) {
+ if (FAILED(hr = ReconnectOutput(length, mt))) {
return hr;
}
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut))) {
+ if (FAILED(GetDeliveryBuffer(&pOut, &pDataOut))) {
return E_FAIL;
}
@@ -1748,17 +1748,17 @@ HRESULT CMpaDecFilter::DeliverBitstream(BYTE* pBuff, int size, int sample_rate,
pDataOutW[3] = size*8;
_swab((char*)pBuff, (char*)&pDataOutW[4], size+1); //if the size is odd, the function "_swab" lose the last byte. need add one.
}
-
+
REFERENCE_TIME rtDur;
rtDur = 10000000i64 * samples / sample_rate;
REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
m_rtStart += rtDur;
- if(rtStart < 0) {
+ if (rtStart < 0) {
return S_OK;
}
- if(hr == S_OK) {
+ if (hr == S_OK) {
m_pOutput->SetMediaType(&mt);
pOut->SetMediaType(&mt);
}
@@ -1781,29 +1781,29 @@ HRESULT CMpaDecFilter::ReconnectOutput(int nSamples, CMediaType& mt)
HRESULT hr;
CComQIPtr<IMemInputPin> pPin = m_pOutput->GetConnected();
- if(!pPin) {
+ if (!pPin) {
return E_NOINTERFACE;
}
CComPtr<IMemAllocator> pAllocator;
- if(FAILED(hr = pPin->GetAllocator(&pAllocator)) || !pAllocator) {
+ if (FAILED(hr = pPin->GetAllocator(&pAllocator)) || !pAllocator) {
return hr;
}
ALLOCATOR_PROPERTIES props, actual;
- if(FAILED(hr = pAllocator->GetProperties(&props))) {
+ if (FAILED(hr = pAllocator->GetProperties(&props))) {
return hr;
}
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
long cbBuffer = nSamples * wfe->nBlockAlign;
- if(mt != m_pOutput->CurrentMediaType() || cbBuffer > props.cbBuffer) {
- if(cbBuffer > props.cbBuffer) {
+ if (mt != m_pOutput->CurrentMediaType() || cbBuffer > props.cbBuffer) {
+ if (cbBuffer > props.cbBuffer) {
props.cBuffers = 4;
props.cbBuffer = cbBuffer*3/2;
- if(FAILED(hr = m_pOutput->DeliverBeginFlush())
+ if (FAILED(hr = m_pOutput->DeliverBeginFlush())
|| FAILED(hr = m_pOutput->DeliverEndFlush())
|| FAILED(hr = pAllocator->Decommit())
|| FAILED(hr = pAllocator->SetProperties(&props, &actual))
@@ -1811,7 +1811,7 @@ HRESULT CMpaDecFilter::ReconnectOutput(int nSamples, CMediaType& mt)
return hr;
}
- if(props.cBuffers > actual.cBuffers || props.cbBuffer > actual.cbBuffer) {
+ if (props.cBuffers > actual.cBuffers || props.cbBuffer > actual.cbBuffer) {
NotifyEvent(EC_ERRORABORT, hr, 0);
return E_FAIL;
}
@@ -1837,7 +1837,7 @@ CMediaType CMpaDecFilter::CreateMediaType(MPCSampleFormat sf, DWORD nSamplesPerS
wfe->wFormatTag = (WORD)mt.subtype.Data1;
wfe->nChannels = nChannels;
wfe->nSamplesPerSec = nSamplesPerSec;
- switch(sf) {
+ switch (sf) {
default:
case SF_PCM16:
wfe->wBitsPerSample = 16;
@@ -1855,11 +1855,11 @@ CMediaType CMpaDecFilter::CreateMediaType(MPCSampleFormat sf, DWORD nSamplesPerS
mt.SetSampleSize (wfe->wBitsPerSample*wfe->nChannels/8);
// FIXME: 24/32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
- if(dwChannelMask == 0 && (sf == SF_PCM24 || sf == SF_PCM32)) {
+ if (dwChannelMask == 0 && (sf == SF_PCM24 || sf == SF_PCM32)) {
dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
}
- if(dwChannelMask) {
+ if (dwChannelMask) {
wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
wfex.dwChannelMask = dwChannelMask;
@@ -1882,41 +1882,41 @@ CMediaType CMpaDecFilter::CreateMediaTypeSPDIF(DWORD nSamplesPerSec)
HRESULT CMpaDecFilter::CheckInputType(const CMediaType* mtIn)
{
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_LPCM
- if(mtIn->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
+ if (mtIn->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
- if(wfe->nChannels < 1 || wfe->nChannels > 8 || (wfe->wBitsPerSample != 16 && wfe->wBitsPerSample != 20 && wfe->wBitsPerSample != 24)) {
+ if (wfe->nChannels < 1 || wfe->nChannels > 8 || (wfe->wBitsPerSample != 16 && wfe->wBitsPerSample != 20 && wfe->wBitsPerSample != 24)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
- } else if(mtIn->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
+ } else if (mtIn->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
UNUSED_ALWAYS(wfe);
return S_OK;
}
#else
- if(0) {}
+ if (0) {}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_PS2AUD
- else if(mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM) {
+ else if (mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM) {
WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)mtIn->Format();
UNUSED_ALWAYS(wfe);
- if(wfe->dwInterleave & 0xf) { // has to be a multiple of the block size (16 bytes)
+ if (wfe->dwInterleave & 0xf) { // has to be a multiple of the block size (16 bytes)
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_FLAC
- else if(mtIn->subtype == MEDIASUBTYPE_FLAC_FRAMED) {
+ else if (mtIn->subtype == MEDIASUBTYPE_FLAC_FRAMED) {
return S_OK;
}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_NELLYMOSER
- else if(mtIn->subtype == MEDIASUBTYPE_NELLYMOSER) {
+ else if (mtIn->subtype == MEDIASUBTYPE_NELLYMOSER) {
return S_OK;
}
#endif
- for(int i = 0; i < countof(sudPinTypesIn); i++) {
- if(*sudPinTypesIn[i].clsMajorType == mtIn->majortype
+ for (int i = 0; i < countof(sudPinTypesIn); i++) {
+ if (*sudPinTypesIn[i].clsMajorType == mtIn->majortype
&& *sudPinTypesIn[i].clsMinorType == mtIn->subtype) {
return S_OK;
}
@@ -1936,7 +1936,7 @@ HRESULT CMpaDecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType*
HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
@@ -1952,7 +1952,7 @@ HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PRO
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -1963,14 +1963,14 @@ HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PRO
HRESULT CMpaDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(m_pInput->IsConnected() == FALSE) {
+ if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -1982,18 +1982,18 @@ HRESULT CMpaDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
}
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_AC3 | INTERNAL_DECODER_DTS
- if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
- subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
+ if (GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
+ subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
|| GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS)) {
*pmt = CreateMediaTypeSPDIF();
}
#else
- if(0) {}
+ if (0) {}
#endif
#if defined(REGISTER_FILTER) | INTERNAL_DECODER_VORBIS
- else if(subtype == MEDIASUBTYPE_Vorbis2) {
+ else if (subtype == MEDIASUBTYPE_Vorbis2) {
VORBISFORMAT2 *vf2 = (VORBISFORMAT2 *)mt.Format();
scmap_t* scmap = &m_scmap_default[vf2->Channels-1];
*pmt = CreateMediaType(GetSampleFormat(), vf2->SamplesPerSec, vf2->Channels, scmap->dwChannelMask);
@@ -2009,7 +2009,7 @@ HRESULT CMpaDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
HRESULT CMpaDecFilter::StartStreaming()
{
HRESULT hr = __super::StartStreaming();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -2071,7 +2071,7 @@ STDMETHODIMP_(MPCSampleFormat) CMpaDecFilter::GetSampleFormat()
STDMETHODIMP CMpaDecFilter::SetNormalize(bool fNormalize)
{
CAutoLock cAutoLock(&m_csProps);
- if(m_fNormalize != fNormalize) {
+ if (m_fNormalize != fNormalize) {
m_sample_max = 0.1f;
}
m_fNormalize = fNormalize;
@@ -2087,7 +2087,7 @@ STDMETHODIMP_(bool) CMpaDecFilter::GetNormalize()
STDMETHODIMP CMpaDecFilter::SetSpeakerConfig(enctype et, int sc)
{
CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) {
+ if (et >= 0 && et < etlast) {
m_iSpeakerConfig[et] = sc;
}
return S_OK;
@@ -2096,7 +2096,7 @@ STDMETHODIMP CMpaDecFilter::SetSpeakerConfig(enctype et, int sc)
STDMETHODIMP_(int) CMpaDecFilter::GetSpeakerConfig(enctype et)
{
CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) {
+ if (et >= 0 && et < etlast) {
return m_iSpeakerConfig[et];
}
return -1;
@@ -2105,7 +2105,7 @@ STDMETHODIMP_(int) CMpaDecFilter::GetSpeakerConfig(enctype et)
STDMETHODIMP CMpaDecFilter::SetDynamicRangeControl(enctype et, bool fDRC)
{
CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) {
+ if (et >= 0 && et < etlast) {
m_fDynamicRangeControl[et] = fDRC;
} else {
return E_INVALIDARG;
@@ -2116,7 +2116,7 @@ STDMETHODIMP CMpaDecFilter::SetDynamicRangeControl(enctype et, bool fDRC)
STDMETHODIMP_(bool) CMpaDecFilter::GetDynamicRangeControl(enctype et)
{
CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) {
+ if (et >= 0 && et < etlast) {
return m_fDynamicRangeControl[et];
}
return false;
@@ -2146,7 +2146,7 @@ STDMETHODIMP CMpaDecFilter::SaveSettings()
CAutoLock cAutoLock(&m_csProps);
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"))) {
key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
key.SetDWORDValue(_T("Normalize"), m_fNormalize);
key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
@@ -2185,13 +2185,13 @@ STDMETHODIMP CMpaDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
{
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMpaDecSettingsWnd)) {
+ if (guid == __uuidof(CMpaDecSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
}
@@ -2236,8 +2236,8 @@ void CMpaDecFilter::FlacDeliverBuffer (unsigned blocksize, const __int32 * cons
switch (wfein->wBitsPerSample) {
case 16 :
- for(unsigned i = 0; i < blocksize; i++) {
- for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++) {
+ for (unsigned i = 0; i < blocksize; i++) {
+ for (int nChannel = 0; nChannel < wfein->nChannels; nChannel++) {
FLAC__int16 nVal = (FLAC__int16)buffer[nChannel][i];
*pDataOut = (float)nVal / SHRT_MAX;
pDataOut++;
@@ -2246,8 +2246,8 @@ void CMpaDecFilter::FlacDeliverBuffer (unsigned blocksize, const __int32 * cons
break;
case 20 :
case 24 :
- for(unsigned i = 0; i < blocksize; i++) {
- for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++) {
+ for (unsigned i = 0; i < blocksize; i++) {
+ for (int nChannel = 0; nChannel < wfein->nChannels; nChannel++) {
FLAC__int32 nVal = (FLAC__int32)buffer[nChannel][i];
*pDataOut = (float)nVal / INT24_MAX;
pDataOut++;
@@ -2369,7 +2369,7 @@ HRESULT CMpaDecFilter::DeliverFFmpeg(enum CodecID nCodecId, BYTE* p, int buffsiz
if (used_bytes < 0) {
TRACE(_T("CMpaDecFilter::DeliverFFmpeg() - audio parsing failed (ret: %d)\n"), -used_bytes);
return E_FAIL;
- } else if(used_bytes == 0 && pOut_size == 0) {
+ } else if (used_bytes == 0 && pOut_size == 0) {
TRACE(_T("CMpaDecFilter::DeliverFFmpeg() - could not process buffer while parsing\n"));
break;
}
@@ -2393,7 +2393,7 @@ HRESULT CMpaDecFilter::DeliverFFmpeg(enum CodecID nCodecId, BYTE* p, int buffsiz
} else {
continue;
}
- } else {
+ } else {
avpkt.data = (uint8_t *)m_pFFBuffer;
avpkt.size = buffsize;
@@ -2437,7 +2437,7 @@ HRESULT CMpaDecFilter::DeliverFFmpeg(enum CodecID nCodecId, BYTE* p, int buffsiz
pDataOut = pBuff.GetData();
for (size_t i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++) {
- for(int ch=0; ch<m_pAVCtx->channels; ch++) {
+ for (int ch=0; ch<m_pAVCtx->channels; ch++) {
*pDataOut = (float)((int16_t*)m_pFrame->data[0]) [scmap->ch[ch]+i*m_pAVCtx->channels] / SHRT_MAX;
pDataOut++;
}
@@ -2449,7 +2449,7 @@ HRESULT CMpaDecFilter::DeliverFFmpeg(enum CodecID nCodecId, BYTE* p, int buffsiz
pDataOut = pBuff.GetData();
for (size_t i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++) {
- for(int ch=0; ch<m_pAVCtx->channels; ch++) {
+ for (int ch=0; ch<m_pAVCtx->channels; ch++) {
*pDataOut = (float)((int32_t*)m_pFrame->data[0]) [scmap->ch[ch]+i*m_pAVCtx->channels] / INT_MAX;
pDataOut++;
}
@@ -2465,9 +2465,9 @@ HRESULT CMpaDecFilter::DeliverFFmpeg(enum CodecID nCodecId, BYTE* p, int buffsiz
break;
}
- if(pBuff.GetCount() > 0) {
+ if (pBuff.GetCount() > 0) {
hr = Deliver(pBuff, m_pAVCtx->sample_rate, scmap->nChannels, scmap->dwChannelMask);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -2499,7 +2499,7 @@ bool CMpaDecFilter::InitFFmpeg(enum CodecID nCodecId)
default :
m_pAVCodec = avcodec_find_decoder(nCodecId);
}
-
+
if (m_pAVCodec) {
DWORD nSamples, nBytesPerSec;
WORD nChannels, nBitsPerSample, nBlockAlign;
@@ -2518,15 +2518,15 @@ bool CMpaDecFilter::InitFFmpeg(enum CodecID nCodecId)
m_pAVCtx->bit_rate = nBytesPerSec << 3;
m_pAVCtx->bits_per_coded_sample = nBitsPerSample;
m_pAVCtx->block_align = nBlockAlign;
-
+
m_pAVCtx->err_recognition = AV_EF_CAREFUL;
- m_pAVCtx->codec_id = nCodecId;
+ m_pAVCtx->codec_id = nCodecId;
if (m_pAVCodec->capabilities & CODEC_CAP_TRUNCATED) {
m_pAVCtx->flags |= CODEC_FLAG_TRUNCATED;
}
-
+
// have issue when use parser on TrueHD ... try to fix later
- if(nCodecId != CODEC_ID_TRUEHD && nCodecId != CODEC_ID_AAC && nCodecId != CODEC_ID_AAC_LATM) {
+ if (nCodecId != CODEC_ID_TRUEHD && nCodecId != CODEC_ID_AAC && nCodecId != CODEC_ID_AAC_LATM) {
m_pParser = av_parser_init(nCodecId);
}
@@ -2535,7 +2535,7 @@ bool CMpaDecFilter::InitFFmpeg(enum CodecID nCodecId)
DWORD formatlen = m_pInput->CurrentMediaType().cbFormat;
unsigned extralen = 0;
getExtraData((BYTE *)format, &format_type, formatlen, NULL, &extralen);
-
+
m_pAVCtx->extradata_size = extralen;
m_pAVCtx->extradata = (const unsigned char*)calloc(1, m_pAVCtx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
getExtraData((BYTE *)format, &format_type, formatlen, (BYTE *)m_pAVCtx->extradata, NULL);
diff --git a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
index 6d1b25f53..9cc33b002 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
+++ b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
@@ -48,11 +48,11 @@ bool CMpaDecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>
m_pMDF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pMDF = pUnks.GetNext(pos))) {
;
}
- if(!m_pMDF) {
+ if (!m_pMDF) {
return false;
}
@@ -106,8 +106,8 @@ bool CMpaDecSettingsWnd::OnActivate()
m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32);
m_outputformat_combo.SetCurSel(0);
- for(int i = 0; i < m_outputformat_combo.GetCount(); i++)
- if((int)m_outputformat_combo.GetItemData(i) == m_outputformat) {
+ for (int i = 0; i < m_outputformat_combo.GetCount(); i++)
+ if ((int)m_outputformat_combo.GetItemData(i) == m_outputformat) {
m_outputformat_combo.SetCurSel(i);
}
@@ -132,8 +132,8 @@ bool CMpaDecSettingsWnd::OnActivate()
m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_1)), A52_CHANNEL1);
m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_2)), A52_CHANNEL2);
- for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++)
- if((int)m_ac3spkcfg_combo.GetItemData(i) == sel) {
+ for (int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++)
+ if ((int)m_ac3spkcfg_combo.GetItemData(i) == sel) {
m_ac3spkcfg_combo.SetCurSel(i);
}
@@ -143,7 +143,7 @@ bool CMpaDecSettingsWnd::OnActivate()
m_ac3lfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4);
m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE));
- for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h) {
+ for (int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h) {
static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
m_ac3spkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1+i);
}
@@ -173,8 +173,8 @@ bool CMpaDecSettingsWnd::OnActivate()
m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), DTS_2F2R);
m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), DTS_3F2R);
- for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++)
- if((int)m_dtsspkcfg_combo.GetItemData(i) == sel) {
+ for (int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++)
+ if ((int)m_dtsspkcfg_combo.GetItemData(i) == sel) {
m_dtsspkcfg_combo.SetCurSel(i);
}
@@ -184,7 +184,7 @@ bool CMpaDecSettingsWnd::OnActivate()
m_dtslfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5);
m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE));
- for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h) {
+ for (int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h) {
static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
m_dtsspkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3+i);
}
@@ -196,7 +196,7 @@ bool CMpaDecSettingsWnd::OnActivate()
m_dtsspkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|WS_DISABLED|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(205, m_fontheight)), this, IDC_PP_CHECK2);
m_dtsspkcfg_check.SetCheck(m_dtsdrc);
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -207,18 +207,18 @@ void CMpaDecSettingsWnd::OnDeactivate()
{
m_outputformat = m_outputformat_combo.GetItemData(m_outputformat_combo.GetCurSel());
m_ac3spkcfg = m_ac3spkcfg_combo.GetItemData(m_ac3spkcfg_combo.GetCurSel());
- if(!!m_ac3lfe_check.GetCheck()) {
+ if (!!m_ac3lfe_check.GetCheck()) {
m_ac3spkcfg |= A52_LFE;
}
- if(IsDlgButtonChecked(IDC_PP_RADIO2)) {
+ if (IsDlgButtonChecked(IDC_PP_RADIO2)) {
m_ac3spkcfg = -m_ac3spkcfg;
}
m_ac3drc = !!m_ac3spkcfg_check.GetCheck();
m_dtsspkcfg = m_dtsspkcfg_combo.GetItemData(m_dtsspkcfg_combo.GetCurSel());
- if(!!m_dtslfe_check.GetCheck()) {
+ if (!!m_dtslfe_check.GetCheck()) {
m_dtsspkcfg |= DTS_LFE;
}
- if(IsDlgButtonChecked(IDC_PP_RADIO4)) {
+ if (IsDlgButtonChecked(IDC_PP_RADIO4)) {
m_dtsspkcfg = -m_dtsspkcfg;
}
m_dtsdrc = !!m_dtsspkcfg_check.GetCheck();
@@ -228,7 +228,7 @@ bool CMpaDecSettingsWnd::OnApply()
{
OnDeactivate();
- if(m_pMDF) {
+ if (m_pMDF) {
m_pMDF->SetSampleFormat((MPCSampleFormat)m_outputformat);
m_pMDF->SetSpeakerConfig(IMpaDecFilter::ac3, m_ac3spkcfg);
m_pMDF->SetDynamicRangeControl(IMpaDecFilter::ac3, m_ac3drc);
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
index e9388d1e1..8bae2404f 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
@@ -93,21 +93,21 @@ STDAPI DllUnregisterServer()
#include <detours/detours.h>
BOOL (__stdcall * Real_IsDebuggerPresent)(void)
-= IsDebuggerPresent;
+ = IsDebuggerPresent;
LONG (__stdcall * Real_ChangeDisplaySettingsExA)(LPCSTR a0,
LPDEVMODEA a1,
HWND a2,
DWORD a3,
LPVOID a4)
-= ChangeDisplaySettingsExA;
+ = ChangeDisplaySettingsExA;
LONG (__stdcall * Real_ChangeDisplaySettingsExW)(LPCWSTR a0,
LPDEVMODEW a1,
HWND a2,
DWORD a3,
LPVOID a4)
-= ChangeDisplaySettingsExW;
+ = ChangeDisplaySettingsExW;
BOOL WINAPI Mine_IsDebuggerPresent()
@@ -118,17 +118,17 @@ BOOL WINAPI Mine_IsDebuggerPresent()
LONG WINAPI Mine_ChangeDisplaySettingsEx(LONG ret, DWORD dwFlags, LPVOID lParam)
{
- if(dwFlags&CDS_VIDEOPARAMETERS) {
+ if (dwFlags&CDS_VIDEOPARAMETERS) {
VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
- if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
+ if (vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
&& (vp->dwFlags&VP_FLAGS_COPYPROTECT)) {
- if(vp->dwCommand == VP_COMMAND_GET) {
- if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA) && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA) {
+ if (vp->dwCommand == VP_COMMAND_GET) {
+ if ((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA) && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA) {
TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
}
- } else if(vp->dwCommand == VP_COMMAND_SET) {
+ } else if (vp->dwCommand == VP_COMMAND_SET) {
TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
return 0;
}
@@ -156,7 +156,7 @@ public:
BOOL InitInstance() {
long lError;
- if(!__super::InitInstance()) {
+ if (!__super::InitInstance()) {
return FALSE;
}
@@ -191,15 +191,15 @@ CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
delete m_pInput;
// delete m_pOutput;
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video");
- if(!m_pInput) {
+ if (!m_pInput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
@@ -208,18 +208,18 @@ CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
// if(FAILED(*phr)) return;
m_pSubpicInput = DNew CSubpicInputPin(this, phr);
- if(!m_pSubpicInput) {
+ if (!m_pSubpicInput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr);
- if(!m_pClosedCaptionOutput) {
+ if (!m_pClosedCaptionOutput) {
*phr = E_OUTOFMEMORY;
}
- if(FAILED(*phr)) {
+ if (FAILED(*phr)) {
return;
}
@@ -235,38 +235,38 @@ CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"), KEY_READ)) {
+ if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"), KEY_READ)) {
DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DeinterlaceMethod"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("DeinterlaceMethod"), dw)) {
SetDeinterlaceMethod((ditype)dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Brightness"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Brightness"), dw)) {
SetBrightness(*(float*)&dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Contrast"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Contrast"), dw)) {
SetContrast(*(float*)&dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Hue"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Hue"), dw)) {
SetHue(*(float*)&dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Saturation"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Saturation"), dw)) {
SetSaturation(*(float*)&dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSubtitles"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSubtitles"), dw)) {
EnableForcedSubtitles(!!dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("PlanarYUV"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("PlanarYUV"), dw)) {
EnablePlanarYUV(!!dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Interlaced"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("Interlaced"), dw)) {
EnableInterlaced(!!dw);
}
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ReadARFromStream"), dw)) {
+ if (ERROR_SUCCESS == key.QueryDWORDValue(_T("ReadARFromStream"), dw)) {
EnableReadARFromStream(!!dw);
}
}
#else
- DWORD dw;
+ DWORD dw;
dw = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Video Decoder"), _T("DeinterlaceMethod"), m_ditype);
SetDeinterlaceMethod((ditype)dw);
dw = AfxGetApp()->GetProfileInt(_T("Filters\\MPEG Video Decoder"), _T("Brightness"), *(DWORD*)&m_bright);
@@ -304,7 +304,7 @@ STDMETHODIMP CMpeg2DecFilter::Apply()
{
#ifdef REGISTER_FILTER
CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"))) {
+ if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"))) {
key.SetDWORDValue(_T("DeinterlaceMethod"), m_ditype);
key.SetDWORDValue(_T("Brightness"), *(DWORD*)&m_bright);
key.SetDWORDValue(_T("Contrast"), *(DWORD*)&m_cont);
@@ -352,7 +352,7 @@ int CMpeg2DecFilter::GetPinCount()
CBasePin* CMpeg2DecFilter::GetPin(int n)
{
- switch(n) {
+ switch (n) {
case 0:
return m_pInput;
case 1:
@@ -398,7 +398,7 @@ void CMpeg2DecFilter::InputTypeChanged()
TRACE(_T("ResetMpeg2Decoder()\n"));
- for(int i = 0; i < countof(m_dec->m_pictures); i++) {
+ for (int i = 0; i < countof(m_dec->m_pictures); i++) {
m_dec->m_pictures[i].rtStart = m_dec->m_pictures[i].rtStop = _I64_MIN+1;
m_dec->m_pictures[i].fDelivered = false;
m_dec->m_pictures[i].flags &= ~PIC_MASK_CODING_TYPE;
@@ -409,10 +409,10 @@ void CMpeg2DecFilter::InputTypeChanged()
BYTE* pSequenceHeader = NULL;
DWORD cbSequenceHeader = 0;
- if(mt.formattype == FORMAT_MPEGVideo) {
+ if (mt.formattype == FORMAT_MPEGVideo) {
pSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->bSequenceHeader;
cbSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->cbSequenceHeader;
- } else if(mt.formattype == FORMAT_MPEG2_VIDEO) {
+ } else if (mt.formattype == FORMAT_MPEG2_VIDEO) {
pSequenceHeader = (BYTE*)((MPEG2VIDEOINFO*)mt.Format())->dwSequenceHeader;
cbSequenceHeader = ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader;
}
@@ -437,13 +437,13 @@ void CMpeg2DecFilter::SetDeinterlaceMethod()
DWORD oldflags = m_fb.flags;
DWORD newflags = m_dec->m_info.m_display_picture->flags;
- if(!(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ if (!(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
&& !(oldflags & PIC_FLAG_REPEAT_FIRST_FIELD)
&& (newflags & PIC_FLAG_PROGRESSIVE_FRAME)) {
- if(!m_fFilm && (newflags & PIC_FLAG_REPEAT_FIRST_FIELD)) {
+ if (!m_fFilm && (newflags & PIC_FLAG_REPEAT_FIRST_FIELD)) {
TRACE(_T("m_fFilm = true\n"));
m_fFilm = true;
- } else if(m_fFilm && !(newflags & PIC_FLAG_REPEAT_FIRST_FIELD)) {
+ } else if (m_fFilm && !(newflags & PIC_FLAG_REPEAT_FIRST_FIELD)) {
TRACE(_T("m_fFilm = false\n"));
m_fFilm = false;
}
@@ -451,17 +451,17 @@ void CMpeg2DecFilter::SetDeinterlaceMethod()
const CMediaType& mt = m_pOutput->CurrentMediaType();
- if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) {
+ if (mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) {
m_fb.di = DIWeave;
} else {
m_fb.di = GetDeinterlaceMethod();
- if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift && m_fb.di != DIELA) {
- if(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) {
+ if (m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift && m_fb.di != DIELA) {
+ if (seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) {
m_fb.di = DIWeave; // hurray!
- } else if(m_fFilm) {
+ } else if (m_fFilm) {
m_fb.di = DIWeave; // we are lucky
- } else if(!(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME)) {
+ } else if (!(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME)) {
m_fb.di = DIBlend; // ok, clear thing
} else
// big trouble here, the progressive_frame bit is not reliable :'(
@@ -479,33 +479,33 @@ void CMpeg2DecFilter::SetDeinterlaceMethod()
void CMpeg2DecFilter::SetTypeSpecificFlags(IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS) {
+ if (CComQIPtr<IMediaSample2> pMS2 = pMS) {
AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
+ if (SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))) {
props.dwTypeSpecificFlags &= ~0x7f;
const CMediaType& mt = m_pOutput->CurrentMediaType();
- if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) {
+ if (mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) {
// props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
- if(m_dec->m_info.m_sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) {
+ if (m_dec->m_info.m_sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
}
- if(m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST) {
+ if (m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
}
- if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD) {
+ if (m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
}
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
+ if ((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
}
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P) {
+ if ((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
}
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B) {
+ if ((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B) {
props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
}
}
@@ -520,7 +520,7 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
HRESULT hr;
BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pIn->GetPointer(&pDataIn))) {
return hr;
}
@@ -528,24 +528,24 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
(static_cast<CDeCSSInputPin*>(m_pInput))->StripPacket(pDataIn, len);
- if(pIn->IsDiscontinuity() == S_OK) {
+ if (pIn->IsDiscontinuity() == S_OK) {
InputTypeChanged();
}
REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
hr = pIn->GetTime(&rtStart, &rtStop);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
rtStart = rtStop = _I64_MIN;
}
- while(len >= 0) {
+ while (len >= 0) {
mpeg2_state_t state = m_dec->mpeg2_parse();
#ifndef _WIN64
__asm emms; // this one is missing somewhere in the precompiled mmx obj files
#endif
- switch(state) {
+ switch (state) {
case STATE_BUFFER:
- if(len > 0) {
+ if (len > 0) {
m_dec->mpeg2_buffer(pDataIn, pDataIn + len);
len = 0;
} else {
@@ -574,7 +574,7 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
mpeg2_picture_t* picture = m_dec->m_info.m_display_picture;
mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
- if(picture && !(picture->flags&PIC_FLAG_SKIP) && fbuf) {
+ if (picture && !(picture->flags&PIC_FLAG_SKIP) && fbuf) {
ASSERT(!picture->fDelivered);
picture->fDelivered = true;
@@ -585,7 +585,7 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
int h = m_dec->m_info.m_sequence->picture_height;
int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
- if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch) {
+ if (m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch) {
m_fb.Alloc(w, h, pitch);
m_fInitializedBuffer = false;
}
@@ -593,7 +593,7 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
// start - end
m_fb.rtStart = picture->rtStart;
- if(m_fb.rtStart == _I64_MIN) {
+ if (m_fb.rtStart == _I64_MIN) {
m_fb.rtStart = m_fb.rtStop;
}
m_fb.rtStop = m_fb.rtStart + m_AvgTimePerFrame * picture->nb_fields / (m_dec->m_info.m_display_picture_2nd ? 1 : 2);
@@ -609,13 +609,13 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
UpdateAspectRatio();
hr = DeliverFast();
- if(hr != S_OK) {
+ if (hr != S_OK) {
hr = DeliverNormal();
}
- if(hr != S_OK) {
+ if (hr != S_OK) {
return hr;
}
- if(hr == S_OK && !m_fWaitForKeyFrame) {
+ if (hr == S_OK && !m_fWaitForKeyFrame) {
m_fInitializedBuffer = true;
}
}
@@ -642,7 +642,7 @@ void CMpeg2DecFilter::UpdateAspectRatio()
CSize dar(m_dec->m_info.m_sequence->picture_width * m_par.cx,
m_dec->m_info.m_sequence->picture_height * m_par.cy);
int lnko = LNKO(dar.cx, dar.cy);
- if(lnko > 1) {
+ if (lnko > 1) {
dar.cx /= lnko, dar.cy /= lnko;
}
SetAspect(dar);
@@ -656,7 +656,7 @@ HRESULT CMpeg2DecFilter::DeliverFast()
CAutoLock cAutoLock(&m_csReceive);
mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
- if(!fbuf) {
+ if (!fbuf) {
return S_FALSE;
}
@@ -664,7 +664,7 @@ HRESULT CMpeg2DecFilter::DeliverFast()
CAutoLock cAutoLock2(&m_csProps);
- if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator
+ if (GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator
|| m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)
|| fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON
|| fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON) {
@@ -672,28 +672,28 @@ HRESULT CMpeg2DecFilter::DeliverFast()
}
}
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
+ if ((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
m_fWaitForKeyFrame = false;
}
- if(m_fb.rtStart < 0 || m_fWaitForKeyFrame) {
+ if (m_fb.rtStart < 0 || m_fWaitForKeyFrame) {
return S_OK;
}
const CMediaType& mt = m_pOutput->CurrentMediaType();
- if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12) {
+ if (mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12) {
return S_FALSE;
}
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ if (FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
- if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12) {
+ if (mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12) {
return S_FALSE;
}
@@ -709,15 +709,15 @@ HRESULT CMpeg2DecFilter::DeliverFast()
BYTE* u = y + dstpitch*h;
BYTE* v = y + dstpitch*h*5/4;
- if(bihOut.biCompression == '21VY') {
+ if (bihOut.biCompression == '21VY') {
BYTE* tmp = u;
u = v;
v = tmp;
}
- if(m_fb.di == DIWeave) {
+ if (m_fb.di == DIWeave) {
BitBltFromI420ToI420(w, h, y, u, v, dstpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], srcpitch);
- } else if(m_fb.di == DIBlend) {
+ } else if (m_fb.di == DIBlend) {
DeinterlaceBlend(y, fbuf->buf[0], w, h, dstpitch, srcpitch);
DeinterlaceBlend(u, fbuf->buf[1], w/2, h/2, dstpitch/2, srcpitch/2);
DeinterlaceBlend(v, fbuf->buf[2], w/2, h/2, dstpitch/2, srcpitch/2);
@@ -725,16 +725,16 @@ HRESULT CMpeg2DecFilter::DeliverFast()
return S_FALSE;
}
- if(h == 1088) {
+ if (h == 1088) {
memset(y + dstpitch*(h-8), 0xff, dstpitch*8);
memset(u + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
memset(v + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
}
- if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput)) {
+ if (CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput)) {
CAutoLock cAutoLock(&pPin->m_csRateLock);
- if(m_rate.Rate != pPin->m_ratechange.Rate) {
+ if (m_rate.Rate != pPin->m_ratechange.Rate) {
m_rate.Rate = pPin->m_ratechange.Rate;
m_rate.StartTime = m_fb.rtStart;
}
@@ -765,7 +765,7 @@ HRESULT CMpeg2DecFilter::DeliverNormal()
CAutoLock cAutoLock(&m_csReceive);
mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
- if(!fbuf) {
+ if (!fbuf) {
return S_FALSE;
}
@@ -781,26 +781,26 @@ HRESULT CMpeg2DecFilter::DeliverNormal()
// deinterlace
- if(m_fb.di == DIWeave) {
+ if (m_fb.di == DIWeave) {
BitBltFromI420ToI420(w, h, m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], dpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], spitch);
- } else if(m_fb.di == DIBlend) {
+ } else if (m_fb.di == DIBlend) {
DeinterlaceBlend(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch);
DeinterlaceBlend(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2);
DeinterlaceBlend(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2);
- } else if(m_fb.di == DIBob) {
+ } else if (m_fb.di == DIBob) {
DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, tff);
DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, tff);
m_fb.rtStart = rtStart;
m_fb.rtStop = (rtStart + rtStop) / 2;
- } else if(m_fb.di == DIFieldShift) {
+ } else if (m_fb.di == DIFieldShift) {
int soffset = tff ? 0 : spitch;
int doffset = tff ? 0 : dpitch;
BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
- } else if(m_fb.di == DIELA) {
+ } else if (m_fb.di == DIELA) {
DeinterlaceELA(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
DeinterlaceELA(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, tff);
DeinterlaceELA(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, tff);
@@ -814,12 +814,12 @@ HRESULT CMpeg2DecFilter::DeliverNormal()
if (m_fb.di == DIWeave || m_fInitializedBuffer) {
hr = Deliver(false);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(m_fb.di == DIBob) {
+ if (m_fb.di == DIBob) {
DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, !tff);
DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, !tff);
@@ -834,13 +834,13 @@ HRESULT CMpeg2DecFilter::DeliverNormal()
// deliver
hr = Deliver(false);
- } else if(m_fb.di == DIFieldShift) {
+ } else if (m_fb.di == DIFieldShift) {
int soffset = !tff ? 0 : spitch;
int doffset = !tff ? 0 : dpitch;
BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
- } else if(m_fb.di == DIELA) {
+ } else if (m_fb.di == DIELA) {
DeinterlaceELA(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
DeinterlaceELA(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, !tff);
DeinterlaceELA(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, !tff);
@@ -857,11 +857,11 @@ HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
{
CAutoLock cAutoLock(&m_csReceive);
- if((m_fb.flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
+ if ((m_fb.flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
m_fWaitForKeyFrame = false;
}
- if(m_fb.rtStart < 0 || m_fWaitForKeyFrame) {
+ if (m_fb.rtStart < 0 || m_fWaitForKeyFrame) {
return S_OK;
}
@@ -869,12 +869,12 @@ HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ if (FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
- if(m_fb.h == 1088) {
+ if (m_fb.h == 1088) {
memset(m_fb.buf[0] + m_fb.w*(m_fb.h-8), 0xff, m_fb.pitch*8);
memset(m_fb.buf[1] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
memset(m_fb.buf[2] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
@@ -882,7 +882,7 @@ HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
BYTE** buf = &m_fb.buf[0];
- if(m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)) {
+ if (m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)) {
BitBltFromI420ToI420(m_fb.w, m_fb.h,
m_fb.buf[3], m_fb.buf[4], m_fb.buf[5], m_fb.pitch,
m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], m_fb.pitch);
@@ -896,10 +896,10 @@ HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
//
- if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput)) {
+ if (CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput)) {
CAutoLock cAutoLock(&pPin->m_csRateLock);
- if(m_rate.Rate != pPin->m_ratechange.Rate) {
+ if (m_rate.Rate != pPin->m_ratechange.Rate) {
m_rate.Rate = pPin->m_ratechange.Rate;
m_rate.StartTime = m_fb.rtStart;
}
@@ -927,18 +927,18 @@ HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
HRESULT CMpeg2DecFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
- if(dir == PINDIR_OUTPUT) {
- if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator) {
+ if (dir == PINDIR_OUTPUT) {
+ if (GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator) {
// one of these needed for dynamic format changes
CLSID clsid = GetCLSID(pPin);
DWORD ver = 0;
- if(CComQIPtr<IFilterVersion> pFV = GetFilterFromPin(pPin)) {
+ if (CComQIPtr<IFilterVersion> pFV = GetFilterFromPin(pPin)) {
ver = pFV->GetFilterVersion();
}
- if(clsid != CLSID_OverlayMixer
+ if (clsid != CLSID_OverlayMixer
/*&& clsid != CLSID_OverlayMixer2*/
&& clsid != CLSID_VideoMixingRenderer
&& clsid != CLSID_VideoMixingRenderer9
@@ -961,20 +961,20 @@ int NextMpegStartCode(CGolombBuffer& gb, BYTE& code, __int64 len)
gb.BitByteAlign();
DWORD dw = (DWORD)-1;
do {
- if(len-- == 0) {
+ if (len-- == 0) {
return false;
}
dw = (dw << 8) | (BYTE)gb.BitRead(8);
- } while((dw&0xffffff00) != 0x00000100);
+ } while ((dw&0xffffff00) != 0x00000100);
code = (BYTE)(dw&0xff);
return true;
}
HRESULT CMpeg2DecFilter::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->formattype == FORMAT_MPEG2_VIDEO && mtIn->pbFormat) {
+ if (mtIn->formattype == FORMAT_MPEG2_VIDEO && mtIn->pbFormat) {
MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mtIn->pbFormat;
- if(vih->cbSequenceHeader > 0 && (vih->dwSequenceHeader[0] & 0x00ffffff) != 0x00010000) {
+ if (vih->cbSequenceHeader > 0 && (vih->dwSequenceHeader[0] & 0x00ffffff) != 0x00010000) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
BYTE* pSequenceHeader = (BYTE*)vih->dwSequenceHeader;
@@ -982,20 +982,20 @@ HRESULT CMpeg2DecFilter::CheckInputType(const CMediaType* mtIn)
BYTE id = 0;
CGolombBuffer gb(pSequenceHeader, cbSequenceHeader);
- while(gb.GetPos() < gb.GetSize() && id != 0xb5) {
- if(!NextMpegStartCode(gb, id, cbSequenceHeader)) {
+ while (gb.GetPos() < gb.GetSize() && id != 0xb5) {
+ if (!NextMpegStartCode(gb, id, cbSequenceHeader)) {
break;
}
}
- if(id == 0xb5) {
+ if (id == 0xb5) {
gb.BitRead(4); // startcodeid
gb.BitRead(1); // profile_levelescape
gb.BitRead(3); // profile
gb.BitRead(4); // level
gb.BitRead(1); // interlaced
BYTE chroma = gb.BitRead(2);
- if(chroma >= 2) {// current support only 4:2:0 profile
- return VFW_E_TYPE_NOT_ACCEPTED;
+ if (chroma >= 2) { // current support only 4:2:0 profile
+ return VFW_E_TYPE_NOT_ACCEPTED;
}
}
}
@@ -1028,12 +1028,12 @@ DWORD g_clock;
HRESULT CMpeg2DecFilter::StartStreaming()
{
HRESULT hr = __super::StartStreaming();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
m_dec.Attach(DNew CMpeg2Dec());
- if(!m_dec) {
+ if (!m_dec) {
return E_OUTOFMEMORY;
}
@@ -1058,9 +1058,9 @@ HRESULT CMpeg2DecFilter::StopStreaming()
HRESULT CMpeg2DecFilter::AlterQuality(Quality q)
{
- if(q.Late > 100*10000i64) {
+ if (q.Late > 100*10000i64) {
m_fDropFrames = true;
- } else if(q.Late <= 0) {
+ } else if (q.Late <= 0) {
m_fDropFrames = false;
}
@@ -1085,13 +1085,13 @@ STDMETHODIMP CMpeg2DecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPag
{
CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) {
+ if (*ppPage != NULL) {
return E_INVALIDARG;
}
HRESULT hr;
- if(guid == __uuidof(CMpeg2DecSettingsWnd)) {
+ if (guid == __uuidof(CMpeg2DecSettingsWnd)) {
(*ppPage = DNew CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
}
@@ -1118,7 +1118,7 @@ void CMpeg2DecFilter::CalcBrCont(BYTE* YTbl, float bright, float cont)
int Cont = (int)(cont * 512);
int Bright = (int)bright;
- for(int i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
int y = ((Cont * (i - 16)) >> 9) + Bright + 16;
YTbl[i] = min(max(y, 0), 255);
// YTbl[i] = min(max(y, 16), 235);
@@ -1132,8 +1132,8 @@ void CMpeg2DecFilter::CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat)
int Sin = (int)(sin(Hue) * 4096);
int Cos = (int)(cos(Hue) * 4096);
- for(int y = 0; y < 256; y++) {
- for(int x = 0; x < 256; x++) {
+ for (int y = 0; y < 256; y++) {
+ for (int x = 0; x < 256; x++) {
int u = x - 128;
int v = y - 128;
int ux = (u * Cos + v * Sin) >> 12;
@@ -1152,10 +1152,10 @@ void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int
{
CAutoLock cAutoLock(&m_csProps);
- if(fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON) {
+ if (fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON) {
int size = pitch*h;
- if((g_cpuid.m_flags&CCpuID::sse2) && ((DWORD_PTR)srcy & 15) == 0) {
+ if ((g_cpuid.m_flags&CCpuID::sse2) && ((DWORD_PTR)srcy & 15) == 0) {
short Cont = (short)(min(max(m_cont, 0) * 512, (1<<16)-1));
short Bright = (short)(m_bright + 16);
@@ -1165,7 +1165,7 @@ void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int
__m128i _16 = _mm_set1_epi16(16);
__m128i _512 = _mm_set1_epi16(512);
- for(int i = 0, j = size>>4; i < j; i++) {
+ for (int i = 0, j = size>>4; i < j; i++) {
__m128i r = _mm_load_si128((__m128i*)&srcy[i*16]);
__m128i rl = _mm_unpacklo_epi8(r, zero);
@@ -1201,7 +1201,7 @@ void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int
size &= 15;
}
- for(; size > 0; size--) {
+ for (; size > 0; size--) {
*srcy++ = m_YTbl[*srcy];
}
}
@@ -1210,8 +1210,8 @@ void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int
w /= 2;
h /= 2;
- if(fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON) {
- for(int size = pitch*h; size > 0; size--) {
+ if (fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON) {
+ for (int size = pitch*h; size > 0; size--) {
WORD uv = (*srcv<<8)|*srcu;
*srcu++ = m_UTbl[uv];
*srcv++ = m_VTbl[uv];
@@ -1339,15 +1339,15 @@ CMpeg2DecInputPin::CMpeg2DecInputPin(CTransformFilter* pFilter, HRESULT* phr, LP
STDMETHODIMP CMpeg2DecInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
+ if (PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
}
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id) {
+ if (PropSet == AM_KSPROPSETID_TSRateChange)
+ switch (Id) {
case AM_RATE_SimpleRateChange: {
AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
- if(!m_CorrectTS) {
+ if (!m_CorrectTS) {
return E_PROP_ID_UNSUPPORTED;
}
CAutoLock cAutoLock(&m_csRateLock);
@@ -1357,7 +1357,7 @@ STDMETHODIMP CMpeg2DecInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceD
break;
case AM_RATE_UseRateVersion: {
WORD* p = (WORD*)pPropertyData;
- if(*p > 0x0101) {
+ if (*p > 0x0101) {
return E_PROP_ID_UNSUPPORTED;
}
}
@@ -1388,12 +1388,12 @@ STDMETHODIMP CMpeg2DecInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceD
STDMETHODIMP CMpeg2DecInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
+ if (PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
return __super::Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
}
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id) {
+ if (PropSet == AM_KSPROPSETID_TSRateChange)
+ switch (Id) {
case AM_RATE_SimpleRateChange: {
AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
UNUSED_ALWAYS(p);
@@ -1455,12 +1455,12 @@ STDMETHODIMP CMpeg2DecInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceD
STDMETHODIMP CMpeg2DecInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
+ if (PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/) {
return __super::QuerySupported(PropSet, Id, pTypeSupport);
}
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id) {
+ if (PropSet == AM_KSPROPSETID_TSRateChange)
+ switch (Id) {
case AM_RATE_SimpleRateChange:
*pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
break;
@@ -1523,15 +1523,15 @@ HRESULT CMpeg2DecOutputPin::Active()
// TODO
- if(m_Connected && !m_pOutputQueue) {
+ if (m_Connected && !m_pOutputQueue) {
HRESULT hr = NOERROR;
m_pOutputQueue.Attach(DNew COutputQueue(m_Connected, &hr));
- if(!m_pOutputQueue) {
+ if (!m_pOutputQueue) {
hr = E_OUTOFMEMORY;
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pOutputQueue.Free();
return hr;
}
@@ -1549,7 +1549,7 @@ HRESULT CMpeg2DecOutputPin::Inactive()
HRESULT CMpeg2DecOutputPin::Deliver(IMediaSample* pMediaSample)
{
- if(!m_pOutputQueue) {
+ if (!m_pOutputQueue) {
return NOERROR;
}
pMediaSample->AddRef();
@@ -1623,16 +1623,16 @@ HRESULT CSubpicInputPin::SetMediaType(const CMediaType* mtIn)
bool CSubpicInputPin::HasAnythingToRender(REFERENCE_TIME rt)
{
- if(!IsConnected()) {
+ if (!IsConnected()) {
return false;
}
CAutoLock cAutoLock(&m_csReceive);
POSITION pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= rt && rt < sp->m_rtStop && (/*sp->m_psphli ||*/ sp->m_fForced || m_spon)) {
+ if (sp->m_rtStart <= rt && rt < sp->m_rtStop && (/*sp->m_psphli ||*/ sp->m_fForced || m_spon)) {
return true;
}
}
@@ -1648,18 +1648,18 @@ void CSubpicInputPin::RenderSubpics(REFERENCE_TIME rt, BYTE** yuv, int w, int h)
// remove no longer needed things first
pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
POSITION cur = pos;
spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStop <= rt) {
+ if (sp->m_rtStop <= rt) {
m_sps.RemoveAt(cur);
}
}
pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= rt && rt < sp->m_rtStop
+ if (sp->m_rtStart <= rt && rt < sp->m_rtStop
&& (m_spon || sp->m_fForced && ((static_cast<CMpeg2DecFilter*>(m_pFilter))->IsForcedSubtitlesEnabled() || sp->m_psphli))) {
sp->Render(rt, yuv, w, h, m_sppal, m_fsppal);
}
@@ -1671,14 +1671,14 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
HRESULT hr;
AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
+ if (SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt) {
CMediaType mt(*pmt);
SetMediaType(&mt);
DeleteMediaType(pmt);
}
BYTE* pDataIn = NULL;
- if(FAILED(hr = pSample->GetPointer(&pDataIn))) {
+ if (FAILED(hr = pSample->GetPointer(&pDataIn))) {
return hr;
}
@@ -1686,16 +1686,16 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
StripPacket(pDataIn, len);
- if(len <= 0) {
+ if (len <= 0) {
return S_FALSE;
}
- if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) {
+ if (m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) {
pDataIn += 4;
len -= 4;
}
- if(len <= 0) {
+ if (len <= 0) {
return S_FALSE;
}
@@ -1706,17 +1706,17 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
bool fRefresh = false;
- if(FAILED(hr)) {
- if(!m_sps.IsEmpty()) {
+ if (FAILED(hr)) {
+ if (!m_sps.IsEmpty()) {
spu* sp = m_sps.GetTail();
sp->SetCount(sp->GetCount() + len);
memcpy(sp->GetData() + sp->GetCount() - len, pDataIn, len);
}
} else {
POSITION pos = m_sps.GetTailPosition();
- while(pos) {
+ while (pos) {
spu* sp = m_sps.GetPrev(pos);
- if(sp->m_rtStop == _I64_MAX) {
+ if (sp->m_rtStop == _I64_MAX) {
sp->m_rtStop = rtStart;
break;
}
@@ -1724,11 +1724,11 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
CAutoPtr<spu> p;
- if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) {
+ if (m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) {
p.Attach(DNew dvdspu());
- } else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) {
+ } else if (m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) {
p.Attach(DNew cvdspu());
- } else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) {
+ } else if (m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) {
p.Attach(DNew svcdspu());
} else {
return E_FAIL;
@@ -1740,7 +1740,7 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
p->SetCount(len);
memcpy(p->GetData(), pDataIn, len);
- if(m_sphli && p->m_rtStart == PTS2RT(m_sphli->StartPTM)) {
+ if (m_sphli && p->m_rtStart == PTS2RT(m_sphli->StartPTM)) {
p->m_psphli = m_sphli;
fRefresh = true;
}
@@ -1748,11 +1748,11 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
m_sps.AddTail(p);
}
- if(!m_sps.IsEmpty()) {
+ if (!m_sps.IsEmpty()) {
m_sps.GetTail()->Parse();
}
- if(fRefresh) {
+ if (fRefresh) {
// ((CMpeg2DecFilter*)m_pFilter)->Deliver(true);
}
@@ -1770,13 +1770,13 @@ STDMETHODIMP CSubpicInputPin::EndFlush()
STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(PropSet != AM_KSPROPSETID_DvdSubPic) {
+ if (PropSet != AM_KSPROPSETID_DvdSubPic) {
return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
}
bool fRefresh = false;
- switch(Id) {
+ switch (Id) {
case AM_PROPERTY_DVDSUBPIC_PALETTE: {
CAutoLock cAutoLock(&m_csReceive);
@@ -1794,11 +1794,11 @@ STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceDat
m_sphli.Free();
- if(pSPHLI->HLISS) {
+ if (pSPHLI->HLISS) {
POSITION pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= PTS2RT(pSPHLI->StartPTM) && PTS2RT(pSPHLI->StartPTM) < sp->m_rtStop) {
+ if (sp->m_rtStart <= PTS2RT(pSPHLI->StartPTM) && PTS2RT(pSPHLI->StartPTM) < sp->m_rtStop) {
fRefresh = true;
sp->m_psphli.Free();
sp->m_psphli.Attach(DNew AM_PROPERTY_SPHLI);
@@ -1806,20 +1806,20 @@ STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceDat
}
}
- if(!fRefresh) { // save it for later, a subpic might be late for this hli
+ if (!fRefresh) { // save it for later, a subpic might be late for this hli
m_sphli.Attach(DNew AM_PROPERTY_SPHLI);
memcpy((AM_PROPERTY_SPHLI*)m_sphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
}
} else {
POSITION pos = m_sps.GetHeadPosition();
- while(pos) {
+ while (pos) {
spu* sp = m_sps.GetNext(pos);
fRefresh |= !!sp->m_psphli;
sp->m_psphli.Free();
}
}
- if(pSPHLI->HLISS)
+ if (pSPHLI->HLISS)
DbgLog((LOG_TRACE, 0, _T("hli: %I64d - %I64d, (%d,%d) - (%d,%d)"),
PTS2RT(pSPHLI->StartPTM)/10000, PTS2RT(pSPHLI->EndPTM)/10000,
pSPHLI->StartX, pSPHLI->StartY, pSPHLI->StopX, pSPHLI->StopY));
@@ -1836,7 +1836,7 @@ STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceDat
return E_PROP_ID_UNSUPPORTED;
}
- if(fRefresh) {
+ if (fRefresh) {
(static_cast<CMpeg2DecFilter*>(m_pFilter))->Deliver(true);
}
@@ -1845,11 +1845,11 @@ STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceDat
STDMETHODIMP CSubpicInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(PropSet != AM_KSPROPSETID_DvdSubPic) {
+ if (PropSet != AM_KSPROPSETID_DvdSubPic) {
return __super::QuerySupported(PropSet, Id, pTypeSupport);
}
- switch(Id) {
+ switch (Id) {
case AM_PROPERTY_DVDSUBPIC_PALETTE:
*pTypeSupport = KSPROPERTY_SUPPORT_SET;
break;
@@ -1879,7 +1879,7 @@ static __inline BYTE GetNibble(BYTE* p, DWORD* offset, int& nField, int& fAligne
static __inline BYTE GetHalfNibble(BYTE* p, DWORD* offset, int& nField, int& n)
{
BYTE ret = (p[offset[nField]] >> (n << 1)) & 0x03;
- if(!n) {
+ if (!n) {
offset[nField]++;
}
n = (n-1+4)&3;
@@ -1888,7 +1888,7 @@ static __inline BYTE GetHalfNibble(BYTE* p, DWORD* offset, int& nField, int& n)
static __inline void DrawPixel(BYTE** yuv, CPoint pt, int pitch, AM_DVD_YUV& c)
{
- if(c.Reserved == 0) {
+ if (c.Reserved == 0) {
return;
}
@@ -1896,7 +1896,7 @@ static __inline void DrawPixel(BYTE** yuv, CPoint pt, int pitch, AM_DVD_YUV& c)
// *p = (*p*(15-contrast) + sppal[color].Y*contrast)>>4;
*p -= (*p - c.Y) * c.Reserved >> 4;
- if(pt.y&1) {
+ if (pt.y&1) {
return; // since U/V is half res there is no need to overwrite the same line again
}
@@ -1921,32 +1921,32 @@ static __inline void DrawPixel(BYTE** yuv, CPoint pt, int pitch, AM_DVD_YUV& c)
static __inline void DrawPixels(BYTE** yuv, int pitch, CPoint pt, int len, AM_DVD_YUV& c, CRect& rc)
{
- if(pt.y < rc.top || pt.y >= rc.bottom) {
+ if (pt.y < rc.top || pt.y >= rc.bottom) {
return;
}
- if(pt.x < rc.left) {
+ if (pt.x < rc.left) {
len -= rc.left - pt.x;
pt.x = rc.left;
}
- if(pt.x + len > rc.right) {
+ if (pt.x + len > rc.right) {
len = rc.right - pt.x;
}
- if(len <= 0 || pt.x >= rc.right) {
+ if (len <= 0 || pt.x >= rc.right) {
return;
}
- if(c.Reserved == 0) {
- if(rc.IsRectEmpty()) {
+ if (c.Reserved == 0) {
+ if (rc.IsRectEmpty()) {
return;
}
- if(pt.y < rc.top || pt.y >= rc.bottom
+ if (pt.y < rc.top || pt.y >= rc.bottom
|| pt.x+len < rc.left || pt.x >= rc.right) {
return;
}
}
- while(len-- > 0) {
+ while (len-- > 0) {
DrawPixel(yuv, pt, pitch, c);
pt.x++;
}
@@ -1963,7 +1963,7 @@ bool CSubpicInputPin::dvdspu::Parse()
WORD packetsize = (p[0]<<8)|p[1];
WORD datasize = (p[2]<<8)|p[3];
- if(packetsize > GetCount() || datasize > packetsize) {
+ if (packetsize > GetCount() || datasize > packetsize) {
return false;
}
@@ -1977,16 +1977,16 @@ bool CSubpicInputPin::dvdspu::Parse()
int pts = GetWORD;
next = GetWORD;
- if(next > packetsize || next < datasize) {
+ if (next > packetsize || next < datasize) {
return false;
}
REFERENCE_TIME rt = m_rtStart + 1024*PTS2RT(pts);
- for(bool fBreak = false; !fBreak; ) {
+ for (bool fBreak = false; !fBreak; ) {
int len = 0;
- switch(p[i]) {
+ switch (p[i]) {
case 0x00:
len = 0;
break;
@@ -2016,12 +2016,12 @@ bool CSubpicInputPin::dvdspu::Parse()
break;
}
- if(i+len >= packetsize) {
+ if (i+len >= packetsize) {
TRACE(_T("Warning: Wrong subpicture parameter block ending\n"));
break;
}
- switch(p[i++]) {
+ switch (p[i++]) {
case 0x00: // forced start displaying
m_fForced = true;
break;
@@ -2070,7 +2070,7 @@ bool CSubpicInputPin::dvdspu::Parse()
offset_t o = {rt, m_sphli};
m_offsets.AddTail(o); // is it always going to be sorted?
- } while(i <= next && i < packetsize);
+ } while (i <= next && i < packetsize);
return true;
}
@@ -2087,14 +2087,14 @@ void CSubpicInputPin::dvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h
CRect rcclip(0, 0, w, h);
rcclip &= rc;
- if(m_psphli) {
+ if (m_psphli) {
rcclip &= CRect(m_psphli->StartX, m_psphli->StartY, m_psphli->StopX, m_psphli->StopY);
sphli = *m_psphli;
- } else if(m_offsets.GetCount() > 1) {
+ } else if (m_offsets.GetCount() > 1) {
POSITION pos = m_offsets.GetTailPosition();
- while(pos) {
+ while (pos) {
const offset_t& o = m_offsets.GetPrev(pos);
- if(rt >= o.rt) {
+ if (rt >= o.rt) {
sphli = o.sphli;
break;
}
@@ -2116,22 +2116,22 @@ void CSubpicInputPin::dvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h
DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
+ while ((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
DWORD code;
- if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4
+ if ((code = GetNibble(p, offset, nField, fAligned)) >= 0x4
|| (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x10
|| (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x40
|| (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x100) {
DrawPixels(yuv, w, pt, code >> 2, pal[code&3], rcclip);
- if((pt.x += code >> 2) < rc.right) {
+ if ((pt.x += code >> 2) < rc.right) {
continue;
}
}
DrawPixels(yuv, w, pt, rc.right - pt.x, pal[code&3], rcclip);
- if(!fAligned) {
+ if (!fAligned) {
GetNibble(p, offset, nField, fAligned); // align to byte
}
@@ -2150,14 +2150,14 @@ bool CSubpicInputPin::cvdspu::Parse()
WORD packetsize = (p[0]<<8)|p[1];
WORD datasize = (p[2]<<8)|p[3];
- if(packetsize > GetCount() || datasize > packetsize) {
+ if (packetsize > GetCount() || datasize > packetsize) {
return false;
}
p = GetData() + datasize;
- for(int i = datasize, j = packetsize-4; i <= j; i+=4, p+=4) {
- switch(p[0]) {
+ for (int i = datasize, j = packetsize-4; i <= j; i+=4, p+=4) {
+ switch (p[0]) {
case 0x0c:
break;
case 0x04:
@@ -2234,10 +2234,10 @@ void CSubpicInputPin::cvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h
DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
+ while ((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
BYTE code;
- if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4) {
+ if ((code = GetNibble(p, offset, nField, fAligned)) >= 0x4) {
DrawPixels(yuv, w, pt, code >> 2, m_sppal[0][code&3], rcclip);
pt.x += code >> 2;
continue;
@@ -2246,7 +2246,7 @@ void CSubpicInputPin::cvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h
code = GetNibble(p, offset, nField, fAligned);
DrawPixels(yuv, w, pt, rc.right - pt.x, m_sppal[0][code&3], rcclip);
- if(!fAligned) {
+ if (!fAligned) {
GetNibble(p, offset, nField, fAligned); // align to byte
}
@@ -2263,14 +2263,14 @@ bool CSubpicInputPin::svcdspu::Parse()
BYTE* p = GetData();
BYTE* p0 = p;
- if(GetCount() < 2) {
+ if (GetCount() < 2) {
return false;
}
WORD packetsize = (p[0]<<8)|p[1];
p += 2;
- if(packetsize > GetCount()) {
+ if (packetsize > GetCount()) {
return false;
}
@@ -2278,7 +2278,7 @@ bool CSubpicInputPin::svcdspu::Parse()
*p++; // unknown
- if(duration) {
+ if (duration) {
m_rtStop = m_rtStart + 10000i64*((p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3])/90;
p += 4;
}
@@ -2292,14 +2292,14 @@ bool CSubpicInputPin::svcdspu::Parse()
m_sphli.StopY += (p[0]<<8)|p[1];
p += 2;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
m_sppal[i].Y = *p++;
m_sppal[i].U = *p++;
m_sppal[i].V = *p++;
m_sppal[i].Reserved = *p++ >> 4;
}
- if(*p++&0xc0) {
+ if (*p++&0xc0) {
p += 4; // duration of the shift operation should be here, but it is untested
}
@@ -2333,16 +2333,16 @@ void CSubpicInputPin::svcdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int
DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
+ while ((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1])) {
BYTE code = GetHalfNibble(p, offset, nField, n);
BYTE repeat = 1 + (code == 0 ? GetHalfNibble(p, offset, nField, n) : 0);
DrawPixels(yuv, w, pt, repeat, m_sppal[code&3], rcclip);
- if((pt.x += repeat) < rc.right) {
+ if ((pt.x += repeat) < rc.right) {
continue;
}
- while(n != 3) {
+ while (n != 3) {
GetHalfNibble(p, offset, nField, n); // align to byte
}
@@ -2370,10 +2370,10 @@ HRESULT CClosedCaptionOutputPin::CheckMediaType(const CMediaType* mtOut)
HRESULT CClosedCaptionOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(iPosition < 0) {
+ if (iPosition < 0) {
return E_INVALIDARG;
}
- if(iPosition > 0) {
+ if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
@@ -2394,7 +2394,7 @@ HRESULT CClosedCaptionOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALL
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
+ if (FAILED(hr = pAllocator->SetProperties(pProperties, &Actual))) {
return hr;
}
@@ -2407,7 +2407,7 @@ HRESULT CClosedCaptionOutputPin::Deliver(const void* ptr, int len)
{
HRESULT hr = S_FALSE;
- if(len > 4 && ptr && *(DWORD*)ptr == 0xf8014343 && IsConnected()) {
+ if (len > 4 && ptr && *(DWORD*)ptr == 0xf8014343 && IsConnected()) {
CComPtr<IMediaSample> pSample;
GetDeliveryBuffer(&pSample, NULL, NULL, 0);
BYTE* pData = NULL;
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
index 4831659bd..4fcb46154 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
@@ -86,7 +86,7 @@ class __declspec(uuid("39F498AF-1A09-4275-B193-673B0BA3D478"))
p += (size/4 + 31) & ~31;
}
void Free() {
- if(buf_base) {
+ if (buf_base) {
_aligned_free(buf_base);
}
buf_base = NULL;
@@ -113,7 +113,7 @@ public:
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-
+
HRESULT DeliverFast();
HRESULT DeliverNormal();
HRESULT Deliver(bool fRepeatLast);
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
index 9d06b13a9..d04376728 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
@@ -51,11 +51,11 @@ bool CMpeg2DecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknow
m_pM2DF.Release();
POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pM2DF = pUnks.GetNext(pos))) {
+ while (pos && !(m_pM2DF = pUnks.GetNext(pos))) {
;
}
- if(!m_pM2DF) {
+ if (!m_pM2DF) {
return false;
}
@@ -110,8 +110,8 @@ bool CMpeg2DecSettingsWnd::OnActivate()
m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("ELA")), (DWORD)DIELA);
m_ditype_combo.SetCurSel(0);
- for(int i = 0; i < m_ditype_combo.GetCount(); i++)
- if((int)m_ditype_combo.GetItemData(i) == m_ditype) {
+ for (int i = 0; i < m_ditype_combo.GetCount(); i++)
+ if ((int)m_ditype_combo.GetItemData(i) == m_ditype) {
m_ditype_combo.SetCurSel(i);
}
@@ -119,7 +119,7 @@ bool CMpeg2DecSettingsWnd::OnActivate()
p.y += m_fontheight + 20;
- for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_procamp_slider); i++, p.y += h) {
+ for (int i = 0, h = max(20, m_fontheight)+1; i < countof(m_procamp_slider); i++, p.y += h) {
static const TCHAR* labels[] = {m_strBrightness, m_strContrast, m_strHue, m_strSaturation};
m_procamp_static[i].Create(labels[i], dwStyle, CRect(p, CSize(70, h)), this);
m_procamp_slider[i].Create(dwStyle, CRect(p + CPoint(80, 0), CSize(201, h)), this, IDC_PP_SLIDER1+i);
@@ -153,7 +153,7 @@ bool CMpeg2DecSettingsWnd::OnActivate()
ResStr(IDS_MPEG2DECSETTINGSWND_8),
dwStyle, CRect(p, CSize(320, m_fontheight * 4)), this);
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
+ for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
pWnd->SetFont(&m_font, FALSE);
}
@@ -177,7 +177,7 @@ bool CMpeg2DecSettingsWnd::OnApply()
{
OnDeactivate();
- if(m_pM2DF) {
+ if (m_pM2DF) {
m_pM2DF->SetDeinterlaceMethod(m_ditype);
m_pM2DF->SetBrightness(m_procamp[0]);
m_pM2DF->SetContrast(m_procamp[1]);
diff --git a/src/filters/transform/VSFilter/AvgLines.cpp b/src/filters/transform/VSFilter/AvgLines.cpp
index 2a0b89311..a8bc535aa 100644
--- a/src/filters/transform/VSFilter/AvgLines.cpp
+++ b/src/filters/transform/VSFilter/AvgLines.cpp
@@ -20,18 +20,18 @@
void AvgLines8(BYTE* dst, DWORD h, DWORD pitch)
{
- if(h <= 1) {
+ if (h <= 1) {
return;
}
BYTE* s = dst;
BYTE* d = dst + (h-2)*pitch;
- for(; s < d; s += pitch*2) {
+ for (; s < d; s += pitch*2) {
BYTE* tmp = s;
#ifndef _WIN64
- if((g_cpuid.m_flags & CCpuID::sse2) && !((DWORD)tmp&0xf) && !((DWORD)pitch&0xf)) {
+ if ((g_cpuid.m_flags & CCpuID::sse2) && !((DWORD)tmp&0xf) && !((DWORD)pitch&0xf)) {
__asm {
mov esi, tmp
mov ebx, pitch
@@ -51,10 +51,10 @@ void AvgLines8(BYTE* dst, DWORD h, DWORD pitch)
mov tmp, esi
}
- for(ptrdiff_t i = pitch&7; i--; tmp++) {
+ for (ptrdiff_t i = pitch&7; i--; tmp++) {
tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
}
- } else if(g_cpuid.m_flags & CCpuID::mmx) {
+ } else if (g_cpuid.m_flags & CCpuID::mmx) {
__asm {
mov esi, tmp
mov ebx, pitch
@@ -94,19 +94,19 @@ void AvgLines8(BYTE* dst, DWORD h, DWORD pitch)
mov tmp, esi
}
- for(ptrdiff_t i = pitch&7; i--; tmp++) {
+ for (ptrdiff_t i = pitch&7; i--; tmp++) {
tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
}
} else
#endif
{
- for(ptrdiff_t i = pitch; i--; tmp++) {
+ for (ptrdiff_t i = pitch; i--; tmp++) {
tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
}
}
}
- if(!(h&1) && h >= 2) {
+ if (!(h&1) && h >= 2) {
dst += (h-2)*pitch;
memcpy(dst + pitch, dst, pitch);
}
@@ -118,7 +118,7 @@ void AvgLines8(BYTE* dst, DWORD h, DWORD pitch)
void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
{
- if(h <= 1) {
+ if (h <= 1) {
return;
}
@@ -128,7 +128,7 @@ void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
BYTE* s = dst;
BYTE* d = dst + (h-2)*pitch;
- for(; s < d; s += pitch*2) {
+ for (; s < d; s += pitch*2) {
BYTE* tmp = s;
#ifndef _WIN64
@@ -185,7 +185,7 @@ void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
}
#endif
- for(ptrdiff_t i = (pitch&7)>>1; i--; tmp++) {
+ for (ptrdiff_t i = (pitch&7)>>1; i--; tmp++) {
tmp[pitch] =
((((*tmp&0x7c00) + (tmp[pitch<<1]&0x7c00)) >> 1)&0x7c00)|
((((*tmp&0x03e0) + (tmp[pitch<<1]&0x03e0)) >> 1)&0x03e0)|
@@ -193,7 +193,7 @@ void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
}
}
- if(!(h&1) && h >= 2) {
+ if (!(h&1) && h >= 2) {
dst += (h-2)*pitch;
memcpy(dst + pitch, dst, pitch);
}
@@ -205,7 +205,7 @@ void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
{
- if(h <= 1) {
+ if (h <= 1) {
return;
}
@@ -215,7 +215,7 @@ void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
BYTE* s = dst;
BYTE* d = dst + (h-2)*pitch;
- for(; s < d; s += pitch*2) {
+ for (; s < d; s += pitch*2) {
WORD* tmp = (WORD*)s;
#ifndef _WIN64
@@ -271,7 +271,7 @@ void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
mov tmp, esi
}
#else
- for(ptrdiff_t wd=(pitch>>3); wd--; tmp++) {
+ for (ptrdiff_t wd=(pitch>>3); wd--; tmp++) {
tmp[0] =
((((*tmp&0xf800) + (tmp[pitch<<1]&0xf800)) >> 1)&0xf800)|
((((*tmp&0x07e0) + (tmp[pitch<<1]&0x07e0)) >> 1)&0x07e0)|
@@ -279,7 +279,7 @@ void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
}
#endif
- for(ptrdiff_t i = (pitch&7)>>1; i--; tmp++) {
+ for (ptrdiff_t i = (pitch&7)>>1; i--; tmp++) {
tmp[pitch] =
((((*tmp&0xf800) + (tmp[pitch<<1]&0xf800)) >> 1)&0xf800)|
((((*tmp&0x07e0) + (tmp[pitch<<1]&0x07e0)) >> 1)&0x07e0)|
@@ -287,7 +287,7 @@ void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
}
}
- if(!(h&1) && h >= 2) {
+ if (!(h&1) && h >= 2) {
dst += (h-2)*pitch;
memcpy(dst + pitch, dst, pitch);
}
diff --git a/src/filters/transform/VSFilter/Copy.cpp b/src/filters/transform/VSFilter/Copy.cpp
index 575b2103d..cf6b66f8a 100644
--- a/src/filters/transform/VSFilter/Copy.cpp
+++ b/src/filters/transform/VSFilter/Copy.cpp
@@ -33,60 +33,60 @@ extern void ColorConvInit();
void BltLineRGB32(DWORD* d, BYTE* sub, int w, const GUID& subtype)
{
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
+ if (subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
BYTE* db = (BYTE*)d;
BYTE* dbtend = db + w;
- for(; db < dbtend; sub+=4, db++) {
- if(sub[3] < 0xff) {
+ for (; db < dbtend; sub+=4, db++) {
+ if (sub[3] < 0xff) {
int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
*db = y; // w/o colors
}
}
- } else if(subtype == MEDIASUBTYPE_YUY2) {
+ } else if (subtype == MEDIASUBTYPE_YUY2) {
WORD* ds = (WORD*)d;
WORD* dstend = ds + w;
- for(; ds < dstend; sub+=4, ds++) {
- if(sub[3] < 0xff) {
+ for (; ds < dstend; sub+=4, ds++) {
+ if (sub[3] < 0xff) {
int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
*ds = 0x8000|y; // w/o colors
}
}
- } else if(subtype == MEDIASUBTYPE_RGB555) {
+ } else if (subtype == MEDIASUBTYPE_RGB555) {
WORD* ds = (WORD*)d;
WORD* dstend = ds + w;
- for(; ds < dstend; sub+=4, ds++) {
- if(sub[3] < 0xff) {
+ for (; ds < dstend; sub+=4, ds++) {
+ if (sub[3] < 0xff) {
*ds = ((*((DWORD*)sub)>>9)&0x7c00)|((*((DWORD*)sub)>>6)&0x03e0)|((*((DWORD*)sub)>>3)&0x001f);
}
}
- } else if(subtype == MEDIASUBTYPE_RGB565) {
+ } else if (subtype == MEDIASUBTYPE_RGB565) {
WORD* ds = (WORD*)d;
WORD* dstend = ds + w;
- for(; ds < dstend; sub+=4, ds++) {
- if(sub[3] < 0xff) {
+ for (; ds < dstend; sub+=4, ds++) {
+ if (sub[3] < 0xff) {
*ds = ((*((DWORD*)sub)>>8)&0xf800)|((*((DWORD*)sub)>>5)&0x07e0)|((*((DWORD*)sub)>>3)&0x001f);
}
}
- } else if(subtype == MEDIASUBTYPE_RGB24) {
+ } else if (subtype == MEDIASUBTYPE_RGB24) {
BYTE* dt = (BYTE*)d;
BYTE* dstend = dt + w*3;
- for(; dt < dstend; sub+=4, dt+=3) {
- if(sub[3] < 0xff) {
+ for (; dt < dstend; sub+=4, dt+=3) {
+ if (sub[3] < 0xff) {
dt[0] = sub[0];
dt[1] = sub[1];
dt[2] = sub[2];
}
}
- } else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32) {
+ } else if (subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32) {
DWORD* dstend = d + w;
- for(; d < dstend; sub+=4, d++) {
- if(sub[3] < 0xff) {
+ for (; d < dstend; sub+=4, d++) {
+ if (sub[3] < 0xff) {
*d = *((DWORD*)sub)&0xffffff;
}
}
@@ -99,7 +99,7 @@ HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, in
int wSub = sub.cx, hSub = sub.cy, pitchSub = wSub*bpp>>3;
bool fScale2x = wIn*2 <= wSub;
- if(fScale2x) {
+ if (fScale2x) {
wIn <<= 1, hIn <<= 1;
}
@@ -118,27 +118,27 @@ HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, in
j += (hSub - hIn) >> 1;
- for(; i < j; i++, pSub += pitchSub) {
+ for (; i < j; i++, pSub += pitchSub) {
memsetd(pSub, black, dpLeft+dpMid+dpRight);
}
j += hIn;
- if(hIn > hSub) {
+ if (hIn > hSub) {
pIn += pitchIn * ((hIn - hSub) >> (fScale2x?2:1));
}
- if(fScale2x) {
+ if (fScale2x) {
Scale2x(subtype,
pSub + dpLeft, pitchSub, pIn, pitchIn,
in.cx, (min(j, hSub) - i) >> 1);
- for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub) {
+ for (ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub) {
memsetd(pSub, black, dpLeft);
memsetd(pSub + dpLeft+dpMid, black, dpRight);
}
} else {
- for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub) {
+ for (ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub) {
memsetd(pSub, black, dpLeft);
memcpy(pSub + dpLeft, pIn, dpMid);
memsetd(pSub + dpLeft+dpMid, black, dpRight);
@@ -147,7 +147,7 @@ HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, in
j = hSub;
- for(; i < j; i++, pSub += pitchSub) {
+ for (; i < j; i++, pSub += pitchSub) {
memsetd(pSub, black, dpLeft+dpMid+dpRight);
}
}
@@ -157,7 +157,7 @@ HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, in
void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
{
- if(!m_hdc || !m_hbm) {
+ if (!m_hdc || !m_hbm) {
return;
}
@@ -170,7 +170,7 @@ void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
CString msg, tmp;
- if(m_fOSD) {
+ if (m_fOSD) {
tmp.Format(_T("in: %dx%d %s\nout: %dx%d %s\n"),
m_w, m_h,
Subtype2String(m_pInput->CurrentMediaType().subtype),
@@ -187,14 +187,14 @@ void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
int nSubPics = -1;
REFERENCE_TIME rtNow = -1, rtStart = -1, rtStop = -1;
m_pSubPicQueue->GetStats(nSubPics, rtNow, rtStart, rtStop);
tmp.Format(_T("queue stats: %I64d - %I64d [ms]\n"), rtStart/10000, rtStop/10000);
msg += tmp;
- for(ptrdiff_t i = 0; i < nSubPics; i++) {
+ for (ptrdiff_t i = 0; i < nSubPics; i++) {
m_pSubPicQueue->GetStats(i, rtStart, rtStop);
tmp.Format(_T("%d: %I64d - %I64d [ms]\n"), i, rtStart/10000, rtStop/10000);
msg += tmp;
@@ -203,7 +203,7 @@ void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
}
}
- if(msg.IsEmpty()) {
+ if (msg.IsEmpty()) {
return;
}
@@ -229,14 +229,14 @@ void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
int pitchIn = bm.bmWidthBytes;
int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
+ if (subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
pitchOut = bihOut.biWidth;
}
pitchIn = (pitchIn+3)&~3;
pitchOut = (pitchOut+3)&~3;
- if(bihOut.biHeight > 0 && bihOut.biCompression <= 3) { // flip if the dst bitmap is flipped rgb (m_hbm is a top-down bitmap, not like the subpictures)
+ if (bihOut.biHeight > 0 && bihOut.biCompression <= 3) { // flip if the dst bitmap is flipped rgb (m_hbm is a top-down bitmap, not like the subpictures)
pOut += pitchOut * (abs(bihOut.biHeight)-1);
pitchOut = -pitchOut;
}
@@ -244,7 +244,7 @@ void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
pIn += pitchIn * r.top;
pOut += pitchOut * r.top;
- for(ptrdiff_t w = min(r.right, m_w), h = r.Height(); h--; pIn += pitchIn, pOut += pitchOut) {
+ for (ptrdiff_t w = min(r.right, m_w), h = r.Height(); h--; pIn += pitchIn, pOut += pitchOut) {
BltLineRGB32((DWORD*)pOut, pIn, w, subtype);
memsetd(pIn, 0xff000000, r.right*4);
}
diff --git a/src/filters/transform/VSFilter/DirectVobSub.cpp b/src/filters/transform/VSFilter/DirectVobSub.cpp
index a9685ef4a..8168b6d83 100644
--- a/src/filters/transform/VSFilter/DirectVobSub.cpp
+++ b/src/filters/transform/VSFilter/DirectVobSub.cpp
@@ -54,8 +54,8 @@ CDirectVobSub::CDirectVobSub()
m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), 0));
pData = NULL;
- if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData) {
- if(nSize != sizeof(m_MediaFPS)) {
+ if (theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData) {
+ if (nSize != sizeof(m_MediaFPS)) {
m_MediaFPS = 25.0;
} else {
memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
@@ -77,7 +77,7 @@ STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
{
CAutoLock cAutoLock(&m_propsLock);
- if(!fn) {
+ if (!fn) {
return E_POINTER;
}
@@ -94,12 +94,12 @@ STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
{
CAutoLock cAutoLock(&m_propsLock);
- if(!fn) {
+ if (!fn) {
return E_POINTER;
}
CString tmp = fn;
- if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) {
+ if (!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) {
return S_FALSE;
}
@@ -139,12 +139,12 @@ STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_iSelectedLanguage == iSelected) {
+ if (m_iSelectedLanguage == iSelected) {
return S_FALSE;
}
int nCount;
- if(FAILED(get_LanguageCount(&nCount))
+ if (FAILED(get_LanguageCount(&nCount))
|| iSelected < 0
|| iSelected >= nCount) {
return E_FAIL;
@@ -166,7 +166,7 @@ STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fHideSubtitles == fHideSubtitles) {
+ if (m_fHideSubtitles == fHideSubtitles) {
return S_FALSE;
}
@@ -188,7 +188,7 @@ STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
{
CAutoLock cAutoLock(&m_propsLock);
- if((m_uSubPictToBuffer > 0) == fDoPreBuffering) {
+ if ((m_uSubPictToBuffer > 0) == fDoPreBuffering) {
return S_FALSE;
}
@@ -208,7 +208,7 @@ STDMETHODIMP CDirectVobSub::put_SubPictToBuffer(unsigned int uSubPictToBuffer)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_uSubPictToBuffer == uSubPictToBuffer) {
+ if (m_uSubPictToBuffer == uSubPictToBuffer) {
return S_FALSE;
}
@@ -228,7 +228,7 @@ STDMETHODIMP CDirectVobSub::put_AnimWhenBuffering(bool fAnimWhenBuffering)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fAnimWhenBuffering == fAnimWhenBuffering) {
+ if (m_fAnimWhenBuffering == fAnimWhenBuffering) {
return S_FALSE;
}
@@ -241,13 +241,13 @@ STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc,
{
CAutoLock cAutoLock(&m_propsLock);
- if(fOverridePlacement) {
+ if (fOverridePlacement) {
*fOverridePlacement = m_fOverridePlacement;
}
- if(xperc) {
+ if (xperc) {
*xperc = m_PlacementXperc;
}
- if(yperc) {
+ if (yperc) {
*yperc = m_PlacementYperc;
}
@@ -258,7 +258,7 @@ STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, in
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) {
+ if (m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) {
return S_FALSE;
}
@@ -273,13 +273,13 @@ STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowFor
{
CAutoLock cAutoLock(&m_propsLock);
- if(fBuffer) {
+ if (fBuffer) {
*fBuffer = m_fBufferVobSub;
}
- if(fOnlyShowForcedSubs) {
+ if (fOnlyShowForcedSubs) {
*fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
}
- if(fPolygonize) {
+ if (fPolygonize) {
*fPolygonize = m_fPolygonize;
}
@@ -290,7 +290,7 @@ STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForce
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) {
+ if (m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) {
return S_FALSE;
}
@@ -305,10 +305,10 @@ STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* colo
{
CAutoLock cAutoLock(&m_propsLock);
- if(lf) {
- if(lflen == sizeof(LOGFONTA)) {
+ if (lf) {
+ if (lflen == sizeof(LOGFONTA)) {
strncpy_s(((LOGFONTA*)lf)->lfFaceName, LF_FACESIZE, CStringA(m_defStyle.fontName), _TRUNCATE);
- } else if(lflen == sizeof(LOGFONTW)) {
+ } else if (lflen == sizeof(LOGFONTW)) {
wcsncpy_s(((LOGFONTW*)lf)->lfFaceName, LF_FACESIZE, CStringW(m_defStyle.fontName), _TRUNCATE);
} else {
return E_INVALIDARG;
@@ -322,16 +322,16 @@ STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* colo
((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
}
- if(color) {
+ if (color) {
*color = m_defStyle.colors[0];
}
- if(fShadow) {
+ if (fShadow) {
*fShadow = (m_defStyle.shadowDepthX!=0) || (m_defStyle.shadowDepthY!=0);
}
- if(fOutline) {
+ if (fOutline) {
*fOutline = (m_defStyle.outlineWidthX+m_defStyle.outlineWidthY)>0;
}
- if(fAdvancedRenderer) {
+ if (fAdvancedRenderer) {
*fAdvancedRenderer = m_fAdvancedRenderer;
}
@@ -342,10 +342,10 @@ STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color
{
CAutoLock cAutoLock(&m_propsLock);
- if(lf) {
- if(lflen == sizeof(LOGFONTA)) {
+ if (lf) {
+ if (lflen == sizeof(LOGFONTA)) {
m_defStyle.fontName = ((LOGFONTA*)lf)->lfFaceName;
- } else if(lflen == sizeof(LOGFONTW)) {
+ } else if (lflen == sizeof(LOGFONTW)) {
m_defStyle.fontName = ((LOGFONTW*)lf)->lfFaceName;
} else {
return E_INVALIDARG;
@@ -358,7 +358,7 @@ STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color
m_defStyle.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
m_defStyle.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
- if(m_defStyle.fontSize < 0) {
+ if (m_defStyle.fontSize < 0) {
HDC hdc = ::GetDC(0);
m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
::ReleaseDC(0, hdc);
@@ -378,10 +378,10 @@ STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
{
CAutoLock cAutoLock(&m_propsLock);
- if(fPicture) {
+ if (fPicture) {
*fPicture = m_fFlipPicture;
}
- if(fSubtitles) {
+ if (fSubtitles) {
*fSubtitles = m_fFlipSubtitles;
}
@@ -392,7 +392,7 @@ STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) {
+ if (m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) {
return S_FALSE;
}
@@ -413,7 +413,7 @@ STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fOSD == fOSD) {
+ if (m_fOSD == fOSD) {
return S_FALSE;
}
@@ -433,7 +433,7 @@ STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fSaveFullPath == fSaveFullPath) {
+ if (m_fSaveFullPath == fSaveFullPath) {
return S_FALSE;
}
@@ -446,13 +446,13 @@ STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* s
{
CAutoLock cAutoLock(&m_propsLock);
- if(delay) {
+ if (delay) {
*delay = m_SubtitleDelay;
}
- if(speedmul) {
+ if (speedmul) {
*speedmul = m_SubtitleSpeedMul;
}
- if(speeddiv) {
+ if (speeddiv) {
*speeddiv = m_SubtitleSpeedDiv;
}
@@ -463,13 +463,13 @@ STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int spee
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) {
+ if (m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) {
return S_FALSE;
}
m_SubtitleDelay = delay;
m_SubtitleSpeedMul = speedmul;
- if(speeddiv > 0) {
+ if (speeddiv > 0) {
m_SubtitleSpeedDiv = speeddiv;
}
@@ -480,10 +480,10 @@ STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
{
CAutoLock cAutoLock(&m_propsLock);
- if(fEnabled) {
+ if (fEnabled) {
*fEnabled = m_fMediaFPSEnabled;
}
- if(fps) {
+ if (fps) {
*fps = m_MediaFPS;
}
@@ -494,12 +494,12 @@ STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
{
CAutoLock cAutoLock(&m_propsLock);
- if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) {
+ if (m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) {
return S_FALSE;
}
m_fMediaFPSEnabled = fEnabled;
- if(fps > 0) {
+ if (fps > 0) {
m_MediaFPS = fps;
}
@@ -510,7 +510,7 @@ STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
{
CAutoLock cAutoLock(&m_propsLock);
- if(!rect) {
+ if (!rect) {
return E_POINTER;
}
@@ -523,11 +523,11 @@ STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
{
CAutoLock cAutoLock(&m_propsLock);
- if(!rect) {
+ if (!rect) {
return E_POINTER;
}
- if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) {
+ if (!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) {
return S_FALSE;
}
@@ -581,7 +581,7 @@ STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
{
CAutoLock cAutoLock(&m_propsLock);
- if(!fLocked) {
+ if (!fLocked) {
return E_POINTER;
}
@@ -597,14 +597,14 @@ STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
{
CAutoLock cAutoLock(&m_propsLock);
- if(fLock) {
+ if (fLock) {
m_nReloaderDisableCount++;
} else {
m_nReloaderDisableCount--;
}
ASSERT(m_nReloaderDisableCount >= 0);
- if(m_nReloaderDisableCount < 0) {
+ if (m_nReloaderDisableCount < 0) {
m_nReloaderDisableCount = 0;
}
@@ -617,7 +617,7 @@ STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
CAutoLock cAutoLock(&m_propsLock);
- if(fDisabled) {
+ if (fDisabled) {
*fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
}
@@ -632,7 +632,7 @@ STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
bool b;
get_SubtitleReloader(&b);
- if(b == fDisable) {
+ if (b == fDisable) {
return S_FALSE;
}
@@ -647,19 +647,19 @@ STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, in
CAutoLock cAutoLock(&m_propsLock);
- if(horizontal) {
+ if (horizontal) {
*horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
}
- if(vertical) {
+ if (vertical) {
*vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 0);
}
- if(resx2) {
+ if (resx2) {
*resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
}
- if(resx2minw) {
+ if (resx2minw) {
*resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
}
- if(resx2minh) {
+ if (resx2minh) {
*resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
}
@@ -674,7 +674,7 @@ STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int
int i[5];
get_ExtendPicture(i, i+1, i+2, i+3, i+4);
- if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) {
+ if (i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) {
return S_FALSE;
}
@@ -693,16 +693,16 @@ STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bo
CAutoLock cAutoLock(&m_propsLock);
- if(level) {
+ if (level) {
*level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
}
- if(fExternalLoad) {
+ if (fExternalLoad) {
*fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
}
- if(fWebLoad) {
+ if (fWebLoad) {
*fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
}
- if(fEmbeddedLoad) {
+ if (fEmbeddedLoad) {
*fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
}
@@ -718,7 +718,7 @@ STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool
int i;
bool b[3];
get_LoadSettings(&i, b, b+1, b+2);
- if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) {
+ if (i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) {
return S_FALSE;
}
@@ -766,7 +766,7 @@ STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
CAutoLock cAutoLock(&m_propsLock);
- if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle))) {
+ if (!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle))) {
return S_FALSE;
}
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
index f6573aaec..162224810 100644
--- a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
+++ b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
@@ -100,25 +100,25 @@ CDirectVobSubFilter::CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUI
CDirectVobSubFilter::~CDirectVobSubFilter()
{
CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->Invalidate();
}
m_pSubPicQueue = NULL;
- if(m_hfont) {
+ if (m_hfont) {
DeleteObject(m_hfont);
m_hfont = 0;
}
- if(m_hbm) {
+ if (m_hbm) {
DeleteObject(m_hbm);
m_hbm = 0;
}
- if(m_hdc) {
+ if (m_hdc) {
DeleteObject(m_hdc);
m_hdc = 0;
}
- for(size_t i = 0; i < m_pTextInput.GetCount(); i++) {
+ for (size_t i = 0; i < m_pTextInput.GetCount(); i++) {
delete m_pTextInput[i];
}
@@ -149,15 +149,15 @@ void CDirectVobSubFilter::GetOutputSize(int& w, int& h, int& arx, int& ary, int&
h = s.cy;
vsfilter = 1; // enable workaround, see BaseVideoFilter.cpp
- if(w != os.cx) {
- while(arx < 100) {
+ if (w != os.cx) {
+ while (arx < 100) {
arx *= 10, ary *= 10;
}
arx = arx * w / os.cx;
}
- if(h != os.cy) {
- while(ary < 100) {
+ if (h != os.cy) {
+ while (ary < 100) {
arx *= 10, ary *= 10;
}
ary = ary * h / os.cy;
@@ -170,15 +170,15 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
REFERENCE_TIME rtStart, rtStop;
- if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop))) {
+ if (SUCCEEDED(pIn->GetTime(&rtStart, &rtStop))) {
double dRate = m_pInput->CurrentRate();
m_tPrev = m_pInput->CurrentStartTime() + dRate*rtStart;
REFERENCE_TIME rtAvgTimePerFrame = rtStop - rtStart;
- if(CComQIPtr<ISubClock2> pSC2 = m_pSubClock) {
+ if (CComQIPtr<ISubClock2> pSC2 = m_pSubClock) {
REFERENCE_TIME rt;
- if(S_OK == pSC2->GetAvgTimePerFrame(&rt)) {
+ if (S_OK == pSC2->GetAvgTimePerFrame(&rt)) {
rtAvgTimePerFrame = rt;
}
}
@@ -191,7 +191,7 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
{
CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetTime(CalcCurrentTime());
m_pSubPicQueue->SetFPS(m_fps);
}
@@ -200,7 +200,7 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
//
BYTE* pDataIn = NULL;
- if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn) {
+ if (FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn) {
return S_FALSE;
}
@@ -216,11 +216,11 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
CSize sub(m_w, m_h);
CSize in(bihIn.biWidth, bihIn.biHeight);
- if(FAILED(Copy((BYTE*)m_pTempPicBuff, pDataIn, sub, in, bpp, mt.subtype, black))) {
+ if (FAILED(Copy((BYTE*)m_pTempPicBuff, pDataIn, sub, in, bpp, mt.subtype, black))) {
return E_FAIL;
}
- if(fYV12) {
+ if (fYV12) {
BYTE* pSubV = (BYTE*)m_pTempPicBuff + (sub.cx*bpp>>3)*sub.cy;
BYTE* pInV = pDataIn + (in.cx*bpp>>3)*in.cy;
sub.cx >>= 1;
@@ -229,10 +229,10 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
in.cy >>= 1;
BYTE* pSubU = pSubV + (sub.cx*bpp>>3)*sub.cy;
BYTE* pInU = pInV + (in.cx*bpp>>3)*in.cy;
- if(FAILED(Copy(pSubV, pInV, sub, in, bpp, mt.subtype, 0x80808080))) {
+ if (FAILED(Copy(pSubV, pInV, sub, in, bpp, mt.subtype, 0x80808080))) {
return E_FAIL;
}
- if(FAILED(Copy(pSubU, pInU, sub, in, bpp, mt.subtype, 0x80808080))) {
+ if (FAILED(Copy(pSubU, pInU, sub, in, bpp, mt.subtype, 0x80808080))) {
return E_FAIL;
}
}
@@ -243,7 +243,7 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
+ if (FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
|| FAILED(hr = pOut->GetPointer(&pDataOut))) {
return hr;
}
@@ -264,15 +264,15 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3;
bool fFlip = fInputFlipped != fOutputFlipped;
- if(m_fFlipPicture) {
+ if (m_fFlipPicture) {
fFlip = !fFlip;
}
- if(m_fMSMpeg4Fix) {
+ if (m_fMSMpeg4Fix) {
fFlip = !fFlip;
}
bool fFlipSub = fOutputFlipped;
- if(m_fFlipSubtitles) {
+ if (m_fFlipSubtitles) {
fFlipSub = !fFlipSub;
}
@@ -281,13 +281,13 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
{
CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
CComPtr<ISubPic> pSubPic;
- if(SUCCEEDED(m_pSubPicQueue->LookupSubPic(CalcCurrentTime(), pSubPic)) && pSubPic) {
+ if (SUCCEEDED(m_pSubPicQueue->LookupSubPic(CalcCurrentTime(), pSubPic)) && pSubPic) {
CRect r;
pSubPic->GetDirtyRect(r);
- if(fFlip ^ fFlipSub) {
+ if (fFlip ^ fFlipSub) {
spd.h = -spd.h;
}
@@ -307,13 +307,13 @@ HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
CBasePin* CDirectVobSubFilter::GetPin(int n)
{
- if(n < __super::GetPinCount()) {
+ if (n < __super::GetPinCount()) {
return __super::GetPin(n);
}
n -= __super::GetPinCount();
- if(n >= 0 && (size_t)n < m_pTextInput.GetCount()) {
+ if (n >= 0 && (size_t)n < m_pTextInput.GetCount()) {
return m_pTextInput[n];
}
@@ -329,17 +329,17 @@ int CDirectVobSubFilter::GetPinCount()
HRESULT CDirectVobSubFilter::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
{
- if(pGraph) {
+ if (pGraph) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0)) {
+ if (!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0)) {
unsigned __int64 ver = GetFileVersion(_T("divx_c32.ax"));
- if(((ver >> 48)&0xffff) == 4 && ((ver >> 32)&0xffff) == 2) {
+ if (((ver >> 48)&0xffff) == 4 && ((ver >> 32)&0xffff) == 2) {
DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
//DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
- if(dwVersion < 0x80000000 && dwWindowsMajorVersion >= 5) {
+ if (dwVersion < 0x80000000 && dwWindowsMajorVersion >= 5) {
AfxMessageBox(IDS_DIVX_WARNING);
theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 1);
}
@@ -347,15 +347,15 @@ HRESULT CDirectVobSubFilter::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName
}
/*removeme*/
- if(!g_RegOK) {
+ if (!g_RegOK) {
DllRegisterServer();
g_RegOK = true;
}
} else {
- if(m_hSystrayThread) {
+ if (m_hSystrayThread) {
SendMessage(m_tbid.hSystrayWnd, WM_CLOSE, 0, 0);
- if(WaitForSingleObject(m_hSystrayThread, 10000) != WAIT_OBJECT_0) {
+ if (WaitForSingleObject(m_hSystrayThread, 10000) != WAIT_OBJECT_0) {
DbgLog((LOG_TRACE, 0, _T("CALL THE AMBULANCE!!!")));
TerminateThread(m_hSystrayThread, (DWORD)-1);
}
@@ -372,13 +372,13 @@ STDMETHODIMP CDirectVobSubFilter::QueryFilterInfo(FILTER_INFO* pInfo)
CheckPointer(pInfo, E_POINTER);
ValidateReadWritePtr(pInfo, sizeof(FILTER_INFO));
- if(!get_Forced()) {
+ if (!get_Forced()) {
return __super::QueryFilterInfo(pInfo);
}
wcscpy(pInfo->achName, L"DirectVobSub (forced auto-loading version)");
pInfo->pGraph = m_pGraph;
- if(m_pGraph) {
+ if (m_pGraph) {
m_pGraph->AddRef();
}
@@ -390,11 +390,11 @@ STDMETHODIMP CDirectVobSubFilter::QueryFilterInfo(FILTER_INFO* pInfo)
HRESULT CDirectVobSubFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
{
HRESULT hr = __super::SetMediaType(dir, pmt);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CAutoLock cAutoLock(&m_csReceive);
REFERENCE_TIME atpf =
@@ -409,7 +409,7 @@ HRESULT CDirectVobSubFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* p
}
InitSubPicQueue();
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
}
@@ -418,8 +418,8 @@ HRESULT CDirectVobSubFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* p
HRESULT CDirectVobSubFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
- if(dir == PINDIR_INPUT) {
- } else if(dir == PINDIR_OUTPUT) {
+ if (dir == PINDIR_INPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
}
return __super::CheckConnect(dir, pPin);
@@ -427,19 +427,19 @@ HRESULT CDirectVobSubFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
HRESULT CDirectVobSubFilter::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
{
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CComPtr<IBaseFilter> pFilter;
// needed when we have a decoder with a version number of 3.x
- if(SUCCEEDED(m_pGraph->FindFilterByName(L"DivX MPEG-4 DVD Video Decompressor ", &pFilter))
+ if (SUCCEEDED(m_pGraph->FindFilterByName(L"DivX MPEG-4 DVD Video Decompressor ", &pFilter))
&& (GetFileVersion(_T("divx_c32.ax")) >> 48) <= 4
|| SUCCEEDED(m_pGraph->FindFilterByName(L"Microcrap MPEG-4 Video Decompressor", &pFilter))
|| SUCCEEDED(m_pGraph->FindFilterByName(L"Microsoft MPEG-4 Video Decompressor", &pFilter))
&& (GetFileVersion(_T("mpg4ds32.ax")) >> 48) <= 3) {
m_fMSMpeg4Fix = true;
}
- } else if(dir == PINDIR_OUTPUT) {
- if(!m_hSystrayThread) {
+ } else if (dir == PINDIR_OUTPUT) {
+ if (!m_hSystrayThread) {
m_tbid.graph = m_pGraph;
m_tbid.dvs = static_cast<IDirectVobSub*>(this);
@@ -456,12 +456,12 @@ HRESULT CDirectVobSubFilter::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePi
HRESULT CDirectVobSubFilter::BreakConnect(PIN_DIRECTION dir)
{
- if(dir == PINDIR_INPUT) {
- if(m_pOutput->IsConnected()) {
+ if (dir == PINDIR_INPUT) {
+ if (m_pOutput->IsConnected()) {
m_pOutput->GetConnected()->Disconnect();
m_pOutput->Disconnect();
}
- } else if(dir == PINDIR_OUTPUT) {
+ } else if (dir == PINDIR_OUTPUT) {
// not really needed, but may free up a little memory
CAutoLock cAutoLock(&m_csQueueLock);
m_pSubPicQueue = NULL;
@@ -522,19 +522,19 @@ void CDirectVobSubFilter::InitSubPicQueue()
ExtractBIH(&m_pInput->CurrentMediaType(), &bihIn);
m_spd.type = -1;
- if(subtype == MEDIASUBTYPE_YV12) {
+ if (subtype == MEDIASUBTYPE_YV12) {
m_spd.type = MSP_YV12;
- } else if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
+ } else if (subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
m_spd.type = MSP_IYUV;
- } else if(subtype == MEDIASUBTYPE_YUY2) {
+ } else if (subtype == MEDIASUBTYPE_YUY2) {
m_spd.type = MSP_YUY2;
- } else if(subtype == MEDIASUBTYPE_RGB32) {
+ } else if (subtype == MEDIASUBTYPE_RGB32) {
m_spd.type = MSP_RGB32;
- } else if(subtype == MEDIASUBTYPE_RGB24) {
+ } else if (subtype == MEDIASUBTYPE_RGB24) {
m_spd.type = MSP_RGB24;
- } else if(subtype == MEDIASUBTYPE_RGB565) {
+ } else if (subtype == MEDIASUBTYPE_RGB565) {
m_spd.type = MSP_RGB16;
- } else if(subtype == MEDIASUBTYPE_RGB555) {
+ } else if (subtype == MEDIASUBTYPE_RGB555) {
m_spd.type = MSP_RGB15;
}
m_spd.w = m_w;
@@ -546,7 +546,7 @@ void CDirectVobSubFilter::InitSubPicQueue()
CComPtr<ISubPicAllocator> pSubPicAllocator = new CMemSubPicAllocator(m_spd.type, CSize(m_w, m_h));
CSize video(bihIn.biWidth, bihIn.biHeight), window = video;
- if(AdjustFrameSize(window)) {
+ if (AdjustFrameSize(window)) {
video += video;
}
ASSERT(window == CSize(m_w, m_h));
@@ -560,17 +560,17 @@ void CDirectVobSubFilter::InitSubPicQueue()
? (ISubPicQueue*)new CSubPicQueue(m_uSubPictToBuffer, !m_fAnimWhenBuffering, pSubPicAllocator, &hr)
: (ISubPicQueue*)new CSubPicQueueNoThread(pSubPicAllocator, &hr);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
m_pSubPicQueue = NULL;
}
UpdateSubtitle(false);
- if(m_hbm) {
+ if (m_hbm) {
DeleteObject(m_hbm);
m_hbm = NULL;
}
- if(m_hdc) {
+ if (m_hdc) {
DeleteDC(m_hdc);
m_hdc = NULL;
}
@@ -594,40 +594,40 @@ bool CDirectVobSubFilter::AdjustFrameSize(CSize& s)
bool fRet = (resx2 == 1) || (resx2 == 2 && s.cx*s.cy <= resx2minw*resx2minh);
- if(fRet) {
+ if (fRet) {
s.cx <<= 1;
s.cy <<= 1;
}
int h;
- switch(vertical&0x7f) {
+ switch (vertical&0x7f) {
case 1:
h = s.cx * 9 / 16;
- if(s.cy < h || !!(vertical&0x80)) {
+ if (s.cy < h || !!(vertical&0x80)) {
s.cy = (h + 3) & ~3;
}
break;
case 2:
h = s.cx * 3 / 4;
- if(s.cy < h || !!(vertical&0x80)) {
+ if (s.cy < h || !!(vertical&0x80)) {
s.cy = (h + 3) & ~3;
}
break;
case 3:
h = 480;
- if(s.cy < h || !!(vertical&0x80)) {
+ if (s.cy < h || !!(vertical&0x80)) {
s.cy = (h + 3) & ~3;
}
break;
case 4:
h = 576;
- if(s.cy < h || !!(vertical&0x80)) {
+ if (s.cy < h || !!(vertical&0x80)) {
s.cy = (h + 3) & ~3;
}
break;
}
- if(horizontal == 1) {
+ if (horizontal == 1) {
s.cx = (s.cx + 31) & ~31;
s.cy = (s.cy + 1) & ~1;
}
@@ -637,14 +637,14 @@ bool CDirectVobSubFilter::AdjustFrameSize(CSize& s)
STDMETHODIMP CDirectVobSubFilter::Count(DWORD* pcStreams)
{
- if(!pcStreams) {
+ if (!pcStreams) {
return E_POINTER;
}
*pcStreams = 0;
int nLangs = 0;
- if(SUCCEEDED(get_LanguageCount(&nLangs))) {
+ if (SUCCEEDED(get_LanguageCount(&nLangs))) {
(*pcStreams) += nLangs;
}
@@ -664,25 +664,25 @@ int CDirectVobSubFilter::FindPreferedLanguage(bool fHideToo)
int nLangs;
get_LanguageCount(&nLangs);
- if(nLangs <= 0) {
+ if (nLangs <= 0) {
return(0);
}
- for(ptrdiff_t i = 0; i < MAXPREFLANGS; i++) {
+ for (ptrdiff_t i = 0; i < MAXPREFLANGS; i++) {
CString tmp;
tmp.Format(IDS_RL_LANG, i);
CString lang = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
- if(!lang.IsEmpty()) {
- for(ptrdiff_t ret = 0; ret < nLangs; ret++) {
+ if (!lang.IsEmpty()) {
+ for (ptrdiff_t ret = 0; ret < nLangs; ret++) {
CString l;
WCHAR* pName = NULL;
get_LanguageName(ret, &pName);
l = pName;
CoTaskMemFree(pName);
- if(!l.CompareNoCase(lang)) {
+ if (!l.CompareNoCase(lang)) {
return(ret);
}
}
@@ -699,28 +699,28 @@ void CDirectVobSubFilter::UpdatePreferedLanguages(CString l)
CString langs[MAXPREFLANGS+1];
int i = 0, j = 0, k = -1;
- for(; i < MAXPREFLANGS; i++) {
+ for (; i < MAXPREFLANGS; i++) {
CString tmp;
tmp.Format(IDS_RL_LANG, i);
langs[j] = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
- if(!langs[j].IsEmpty()) {
- if(!langs[j].CompareNoCase(l)) {
+ if (!langs[j].IsEmpty()) {
+ if (!langs[j].CompareNoCase(l)) {
k = j;
}
j++;
}
}
- if(k == -1) {
+ if (k == -1) {
langs[k = j] = l;
j++;
}
// move the selected to the top of the list
- while(k > 0) {
+ while (k > 0) {
CString tmp = langs[k];
langs[k] = langs[k-1];
langs[k-1] = tmp;
@@ -732,20 +732,20 @@ void CDirectVobSubFilter::UpdatePreferedLanguages(CString l)
CString hidesubs;
hidesubs.LoadString(IDS_M_HIDESUBTITLES);
- for(k = 1; k < j; k++) {
- if(!langs[k].CompareNoCase(hidesubs)) {
+ for (k = 1; k < j; k++) {
+ if (!langs[k].CompareNoCase(hidesubs)) {
break;
}
}
- while(k < j-1) {
+ while (k < j-1) {
CString tmp = langs[k];
langs[k] = langs[k+1];
langs[k+1] = tmp;
k++;
}
- for(i = 0; i < j; i++) {
+ for (i = 0; i < j; i++) {
CString tmp;
tmp.Format(IDS_RL_LANG, i);
@@ -755,35 +755,35 @@ void CDirectVobSubFilter::UpdatePreferedLanguages(CString l)
STDMETHODIMP CDirectVobSubFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
+ if (!(dwFlags & AMSTREAMSELECTENABLE_ENABLE)) {
return E_NOTIMPL;
}
int nLangs = 0;
get_LanguageCount(&nLangs);
- if(!(lIndex >= 0 && lIndex < nLangs+2+2)) {
+ if (!(lIndex >= 0 && lIndex < nLangs+2+2)) {
return E_INVALIDARG;
}
int i = lIndex-1;
- if(i == -1 && !m_fLoading) { // we need this because when loading something stupid media player pushes the first stream it founds, which is "enable" in our case
+ if (i == -1 && !m_fLoading) { // we need this because when loading something stupid media player pushes the first stream it founds, which is "enable" in our case
put_HideSubtitles(false);
- } else if(i >= 0 && i < nLangs) {
+ } else if (i >= 0 && i < nLangs) {
put_HideSubtitles(false);
put_SelectedLanguage(i);
WCHAR* pName = NULL;
- if(SUCCEEDED(get_LanguageName(i, &pName))) {
+ if (SUCCEEDED(get_LanguageName(i, &pName))) {
UpdatePreferedLanguages(CString(pName));
- if(pName) {
+ if (pName) {
CoTaskMemFree(pName);
}
}
- } else if(i == nLangs && !m_fLoading) {
+ } else if (i == nLangs && !m_fLoading) {
put_HideSubtitles(true);
- } else if((i == nLangs+1 || i == nLangs+2) && !m_fLoading) {
+ } else if ((i == nLangs+1 || i == nLangs+2) && !m_fLoading) {
put_Flip(i == nLangs+2, m_fFlipSubtitles);
}
@@ -797,20 +797,20 @@ STDMETHODIMP CDirectVobSubFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
int nLangs = 0;
get_LanguageCount(&nLangs);
- if(!(lIndex >= 0 && lIndex < nLangs+2+2)) {
+ if (!(lIndex >= 0 && lIndex < nLangs+2+2)) {
return E_INVALIDARG;
}
int i = lIndex-1;
- if(ppmt) {
+ if (ppmt) {
*ppmt = CreateMediaType(&m_pInput->CurrentMediaType());
}
- if(pdwFlags) {
+ if (pdwFlags) {
*pdwFlags = 0;
- if(i == -1 && !m_fHideSubtitles
+ if (i == -1 && !m_fHideSubtitles
|| i >= 0 && i < nLangs && i == m_iSelectedLanguage
|| i == nLangs && m_fHideSubtitles
|| i == nLangs+1 && !m_fFlipPicture
@@ -819,50 +819,50 @@ STDMETHODIMP CDirectVobSubFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
}
}
- if(plcid) {
+ if (plcid) {
*plcid = 0;
}
- if(pdwGroup) {
+ if (pdwGroup) {
*pdwGroup = 0x648E51;
}
- if(ppszName) {
+ if (ppszName) {
*ppszName = NULL;
CStringW str;
- if(i == -1) {
+ if (i == -1) {
str = ResStr(IDS_M_SHOWSUBTITLES);
- } else if(i >= 0 && i < nLangs) {
+ } else if (i >= 0 && i < nLangs) {
get_LanguageName(i, ppszName);
- } else if(i == nLangs) {
+ } else if (i == nLangs) {
str = ResStr(IDS_M_HIDESUBTITLES);
- } else if(i == nLangs+1) {
+ } else if (i == nLangs+1) {
str = ResStr(IDS_M_ORIGINALPICTURE);
- if(pdwGroup) {
+ if (pdwGroup) {
(*pdwGroup)++;
}
- } else if(i == nLangs+2) {
+ } else if (i == nLangs+2) {
str = ResStr(IDS_M_FLIPPEDPICTURE);
- if(pdwGroup) {
+ if (pdwGroup) {
(*pdwGroup)++;
}
}
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
- if(*ppszName == NULL) {
+ if (*ppszName == NULL) {
return S_FALSE;
}
wcscpy(*ppszName, str);
}
}
- if(ppObject) {
+ if (ppObject) {
*ppObject = NULL;
}
- if(ppUnk) {
+ if (ppUnk) {
*ppUnk = NULL;
}
@@ -871,7 +871,7 @@ STDMETHODIMP CDirectVobSubFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
STDMETHODIMP CDirectVobSubFilter::GetClassID(CLSID* pClsid)
{
- if(pClsid == NULL) {
+ if (pClsid == NULL) {
return E_POINTER;
}
*pClsid = m_clsid;
@@ -885,7 +885,7 @@ STDMETHODIMP CDirectVobSubFilter::GetPages(CAUUID* pPages)
pPages->cElems = 7;
pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID)*pPages->cElems);
- if(pPages->pElems == NULL) {
+ if (pPages->pElems == NULL) {
return E_OUTOFMEMORY;
}
@@ -907,7 +907,7 @@ STDMETHODIMP CDirectVobSubFilter::put_FileName(WCHAR* fn)
{
HRESULT hr = CDirectVobSub::put_FileName(fn);
- if(hr == S_OK && !Open()) {
+ if (hr == S_OK && !Open()) {
m_FileName.Empty();
hr = E_FAIL;
}
@@ -919,12 +919,12 @@ STDMETHODIMP CDirectVobSubFilter::get_LanguageCount(int* nLangs)
{
HRESULT hr = CDirectVobSub::get_LanguageCount(nLangs);
- if(hr == NOERROR && nLangs) {
+ if (hr == NOERROR && nLangs) {
CAutoLock cAutolock(&m_csQueueLock);
*nLangs = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) {
+ while (pos) {
(*nLangs) += m_pSubStreams.GetNext(pos)->GetStreamCount();
}
}
@@ -936,11 +936,11 @@ STDMETHODIMP CDirectVobSubFilter::get_LanguageName(int iLanguage, WCHAR** ppName
{
HRESULT hr = CDirectVobSub::get_LanguageName(iLanguage, ppName);
- if(!ppName) {
+ if (!ppName) {
return E_POINTER;
}
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
CAutoLock cAutolock(&m_csQueueLock);
hr = E_INVALIDARG;
@@ -948,10 +948,10 @@ STDMETHODIMP CDirectVobSubFilter::get_LanguageName(int iLanguage, WCHAR** ppName
int i = iLanguage;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(i >= 0 && pos) {
+ while (i >= 0 && pos) {
CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount()) {
+ if (i < pSubStream->GetStreamCount()) {
pSubStream->GetStreamInfo(i, ppName, NULL);
hr = NOERROR;
break;
@@ -968,7 +968,7 @@ STDMETHODIMP CDirectVobSubFilter::put_SelectedLanguage(int iSelected)
{
HRESULT hr = CDirectVobSub::put_SelectedLanguage(iSelected);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
UpdateSubtitle(false);
}
@@ -979,7 +979,7 @@ STDMETHODIMP CDirectVobSubFilter::put_HideSubtitles(bool fHideSubtitles)
{
HRESULT hr = CDirectVobSub::put_HideSubtitles(fHideSubtitles);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
UpdateSubtitle(false);
}
@@ -991,7 +991,7 @@ STDMETHODIMP CDirectVobSubFilter::put_PreBuffering(bool fDoPreBuffering)
{
HRESULT hr = CDirectVobSub::put_PreBuffering(fDoPreBuffering);
- if(hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
+ if (hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
InitSubPicQueue();
}
@@ -1002,7 +1002,7 @@ STDMETHODIMP CDirectVobSubFilter::put_SubPictToBuffer(unsigned int uSubPictToBuf
{
HRESULT hr = CDirectVobSub::put_SubPictToBuffer(uSubPictToBuffer);
- if(hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
+ if (hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
InitSubPicQueue();
}
@@ -1013,7 +1013,7 @@ STDMETHODIMP CDirectVobSubFilter::put_AnimWhenBuffering(bool fAnimWhenBuffering)
{
HRESULT hr = CDirectVobSub::put_AnimWhenBuffering(fAnimWhenBuffering);
- if(hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
+ if (hr == NOERROR && m_pInput && m_pInput->IsConnected()) {
InitSubPicQueue();
}
@@ -1024,7 +1024,7 @@ STDMETHODIMP CDirectVobSubFilter::put_Placement(bool fOverridePlacement, int xpe
{
HRESULT hr = CDirectVobSub::put_Placement(fOverridePlacement, xperc, yperc);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
UpdateSubtitle(true);
}
@@ -1035,7 +1035,7 @@ STDMETHODIMP CDirectVobSubFilter::put_VobSubSettings(bool fBuffer, bool fOnlySho
{
HRESULT hr = CDirectVobSub::put_VobSubSettings(fBuffer, fOnlyShowForcedSubs, fReserved);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
// UpdateSubtitle(false);
InvalidateSubtitle();
}
@@ -1047,7 +1047,7 @@ STDMETHODIMP CDirectVobSubFilter::put_TextSettings(void* lf, int lflen, COLORREF
{
HRESULT hr = CDirectVobSub::put_TextSettings(lf, lflen, color, fShadow, fOutline, fAdvancedRenderer);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
// UpdateSubtitle(true);
InvalidateSubtitle();
}
@@ -1059,7 +1059,7 @@ STDMETHODIMP CDirectVobSubFilter::put_SubtitleTiming(int delay, int speedmul, in
{
HRESULT hr = CDirectVobSub::put_SubtitleTiming(delay, speedmul, speeddiv);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
InvalidateSubtitle();
}
@@ -1072,9 +1072,9 @@ STDMETHODIMP CDirectVobSubFilter::get_MediaFPS(bool* fEnabled, double* fps)
CComQIPtr<IMediaSeeking> pMS = m_pGraph;
double rate;
- if(pMS && SUCCEEDED(pMS->GetRate(&rate))) {
+ if (pMS && SUCCEEDED(pMS->GetRate(&rate))) {
m_MediaFPS = rate * m_fps;
- if(fps) {
+ if (fps) {
*fps = m_MediaFPS;
}
}
@@ -1087,13 +1087,13 @@ STDMETHODIMP CDirectVobSubFilter::put_MediaFPS(bool fEnabled, double fps)
HRESULT hr = CDirectVobSub::put_MediaFPS(fEnabled, fps);
CComQIPtr<IMediaSeeking> pMS = m_pGraph;
- if(pMS) {
- if(hr == NOERROR) {
+ if (pMS) {
+ if (hr == NOERROR) {
hr = pMS->SetRate(m_fMediaFPSEnabled ? m_MediaFPS / m_fps : 1.0);
}
double dRate;
- if(SUCCEEDED(pMS->GetRate(&dRate))) {
+ if (SUCCEEDED(pMS->GetRate(&dRate))) {
m_MediaFPS = dRate * m_fps;
}
}
@@ -1117,7 +1117,7 @@ STDMETHODIMP CDirectVobSubFilter::put_TextSettings(STSStyle* pDefStyle)
{
HRESULT hr = CDirectVobSub::put_TextSettings(pDefStyle);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
UpdateSubtitle(true);
}
@@ -1128,7 +1128,7 @@ STDMETHODIMP CDirectVobSubFilter::put_AspectRatioSettings(CSimpleTextSubtitle::E
{
HRESULT hr = CDirectVobSub::put_AspectRatioSettings(ePARCompensationType);
- if(hr == NOERROR) {
+ if (hr == NOERROR) {
UpdateSubtitle(true);
}
@@ -1140,7 +1140,7 @@ STDMETHODIMP CDirectVobSubFilter::put_AspectRatioSettings(CSimpleTextSubtitle::E
STDMETHODIMP CDirectVobSubFilter::HasConfigDialog(int iSelected)
{
int nLangs;
- if(FAILED(get_LanguageCount(&nLangs))) {
+ if (FAILED(get_LanguageCount(&nLangs))) {
return E_FAIL;
}
return E_FAIL;
@@ -1164,17 +1164,17 @@ CDirectVobSubFilter2::CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const G
HRESULT CDirectVobSubFilter2::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
CPinInfo pi;
- if(FAILED(pPin->QueryPinInfo(&pi))) {
+ if (FAILED(pPin->QueryPinInfo(&pi))) {
return E_FAIL;
}
- if(CComQIPtr<IDirectVobSub>(pi.pFilter)) {
+ if (CComQIPtr<IDirectVobSub>(pi.pFilter)) {
return E_FAIL;
}
- if(dir == PINDIR_INPUT) {
+ if (dir == PINDIR_INPUT) {
CFilterInfo fi;
- if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
+ if (SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
&& !_wcsnicmp(fi.achName, L"Overlay Mixer", 13)) {
return(E_FAIL);
}
@@ -1186,9 +1186,9 @@ HRESULT CDirectVobSubFilter2::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
{
- if(pGraph) {
+ if (pGraph) {
BeginEnumFilters(pGraph, pEF, pBF) {
- if(pBF != (IBaseFilter*)this && CComQIPtr<IDirectVobSub>(pBF)) {
+ if (pBF != (IBaseFilter*)this && CComQIPtr<IDirectVobSub>(pBF)) {
return E_FAIL;
}
}
@@ -1204,26 +1204,26 @@ HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pNam
// This whole workaround is needed because the video stream will always be connected
// to the pre-added filters first, no matter how high merit we have.
- if(!get_Forced()) {
+ if (!get_Forced()) {
BeginEnumFilters(pGraph, pEF, pBF) {
- if(CComQIPtr<IDirectVobSub>(pBF)) {
+ if (CComQIPtr<IDirectVobSub>(pBF)) {
continue;
}
CComPtr<IPin> pInPin = GetFirstPin(pBF, PINDIR_INPUT);
CComPtr<IPin> pOutPin = GetFirstPin(pBF, PINDIR_OUTPUT);
- if(!pInPin) {
+ if (!pInPin) {
continue;
}
CComPtr<IPin> pPin;
- if(pInPin && SUCCEEDED(pInPin->ConnectedTo(&pPin))
+ if (pInPin && SUCCEEDED(pInPin->ConnectedTo(&pPin))
|| pOutPin && SUCCEEDED(pOutPin->ConnectedTo(&pPin))) {
continue;
}
- if(pOutPin && GetFilterName(pBF) == _T("Overlay Mixer")) {
+ if (pOutPin && GetFilterName(pBF) == _T("Overlay Mixer")) {
continue;
}
@@ -1245,7 +1245,7 @@ HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pNam
memcpy(&vih->bmiHeader, &bih, sizeof(bih));
vih->AvgTimePerFrame = 400000;
- if(SUCCEEDED(pInPin->QueryAccept(&cmt))) {
+ if (SUCCEEDED(pInPin->QueryAccept(&cmt))) {
fVideoInputPin = true;
break;
}
@@ -1257,15 +1257,15 @@ HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pNam
vih2->dwPictAspectRatioX = 384;
vih2->dwPictAspectRatioY = 288;
- if(SUCCEEDED(pInPin->QueryAccept(&cmt))) {
+ if (SUCCEEDED(pInPin->QueryAccept(&cmt))) {
fVideoInputPin = true;
break;
}
- } while(false);
+ } while (false);
- if(fVideoInputPin) {
+ if (fVideoInputPin) {
CComPtr<IBaseFilter> pDVS;
- if(ShouldWeAutoload(pGraph) && SUCCEEDED(pDVS.CoCreateInstance(__uuidof(CDirectVobSubFilter2)))) {
+ if (ShouldWeAutoload(pGraph) && SUCCEEDED(pDVS.CoCreateInstance(__uuidof(CDirectVobSubFilter2)))) {
CComQIPtr<IDirectVobSub2>(pDVS)->put_Forced(true);
CComQIPtr<IGraphConfig>(pGraph)->AddFilterToCache(pDVS);
}
@@ -1285,11 +1285,11 @@ HRESULT CDirectVobSubFilter2::CheckInputType(const CMediaType* mtIn)
{
HRESULT hr = __super::CheckInputType(mtIn);
- if(FAILED(hr) || m_pInput->IsConnected()) {
+ if (FAILED(hr) || m_pInput->IsConnected()) {
return hr;
}
- if(!ShouldWeAutoload(m_pGraph)) {
+ if (!ShouldWeAutoload(m_pGraph)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -1309,8 +1309,8 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
_T("GoogleDesktopCrawl."), // Google Desktop
};
- for(ptrdiff_t i = 0; i < countof(blacklistedapps); i++) {
- if(theApp.m_AppName.Find(blacklistedapps[i]) >= 0) {
+ for (ptrdiff_t i = 0; i < countof(blacklistedapps); i++) {
+ if (theApp.m_AppName.Find(blacklistedapps[i]) >= 0) {
return false;
}
}
@@ -1319,21 +1319,21 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
get_LoadSettings(&level, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
- if(level < 0 || level >= 2) {
+ if (level < 0 || level >= 2) {
return false;
}
bool fRet = false;
- if(level == 1) {
+ if (level == 1) {
fRet = m_fExternalLoad = m_fWebLoad = m_fEmbeddedLoad = true;
}
// find text stream on known splitters
- if(!fRet && m_fEmbeddedLoad) {
+ if (!fRet && m_fEmbeddedLoad) {
CComPtr<IBaseFilter> pBF;
- if((pBF = FindFilter(CLSID_OggSplitter, pGraph)) || (pBF = FindFilter(CLSID_AviSplitter, pGraph))
+ if ((pBF = FindFilter(CLSID_OggSplitter, pGraph)) || (pBF = FindFilter(CLSID_AviSplitter, pGraph))
|| (pBF = FindFilter(L"{34293064-02F2-41D5-9D75-CC5967ACA1AB}", pGraph)) // matroska demux
|| (pBF = FindFilter(L"{0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4}", pGraph)) // matroska source
|| (pBF = FindFilter(L"{149D2E01-C32E-4939-80F6-C07B81015A7A}", pGraph)) // matroska splitter
@@ -1351,13 +1351,13 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
|| (pBF = FindFilter(L"{61F47056-E400-43d3-AF1E-AB7DFFD4C4AD}", pGraph))) { // mp4 splitter
BeginEnumPins(pBF, pEP, pPin) {
BeginEnumMediaTypes(pPin, pEM, pmt) {
- if(pmt->majortype == MEDIATYPE_Text || pmt->majortype == MEDIATYPE_Subtitle) {
+ if (pmt->majortype == MEDIATYPE_Text || pmt->majortype == MEDIATYPE_Subtitle) {
fRet = true;
break;
}
}
EndEnumMediaTypes(pmt)
- if(fRet) {
+ if (fRet) {
break;
}
}
@@ -1370,9 +1370,9 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
CStringW fn;
BeginEnumFilters(pGraph, pEF, pBF) {
- if(CComQIPtr<IFileSourceFilter> pFSF = pBF) {
+ if (CComQIPtr<IFileSourceFilter> pFSF = pBF) {
LPOLESTR fnw = NULL;
- if(!pFSF || FAILED(pFSF->GetCurFile(&fnw, NULL)) || !fnw) {
+ if (!pFSF || FAILED(pFSF->GetCurFile(&fnw, NULL)) || !fnw) {
continue;
}
fn = CString(fnw);
@@ -1382,12 +1382,12 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
}
EndEnumFilters
- if((m_fExternalLoad || m_fWebLoad) && (m_fWebLoad || !(wcsstr(fn, L"http://") || wcsstr(fn, L"mms://")))) {
+ if ((m_fExternalLoad || m_fWebLoad) && (m_fWebLoad || !(wcsstr(fn, L"http://") || wcsstr(fn, L"mms://")))) {
bool fTemp = m_fHideSubtitles;
fRet = !fn.IsEmpty() && SUCCEEDED(put_FileName((LPWSTR)(LPCWSTR)fn))
|| SUCCEEDED(put_FileName(L"c:\\tmp.srt"))
|| fRet;
- if(fTemp) {
+ if (fTemp) {
m_fHideSubtitles = true;
}
}
@@ -1397,12 +1397,12 @@ bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
void CDirectVobSubFilter2::GetRidOfInternalScriptRenderer()
{
- while(CComPtr<IBaseFilter> pBF = FindFilter(L"{48025243-2D39-11CE-875D-00608CB78066}", m_pGraph)) {
+ while (CComPtr<IBaseFilter> pBF = FindFilter(L"{48025243-2D39-11CE-875D-00608CB78066}", m_pGraph)) {
BeginEnumPins(pBF, pEP, pPin) {
PIN_DIRECTION dir;
CComPtr<IPin> pPinTo;
- if(SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
+ if (SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
&& SUCCEEDED(pPin->ConnectedTo(&pPinTo))) {
m_pGraph->Disconnect(pPinTo);
m_pGraph->Disconnect(pPin);
@@ -1411,7 +1411,7 @@ void CDirectVobSubFilter2::GetRidOfInternalScriptRenderer()
}
EndEnumPins
- if(FAILED(m_pGraph->RemoveFilter(pBF))) {
+ if (FAILED(m_pGraph->RemoveFilter(pBF))) {
break;
}
}
@@ -1431,11 +1431,11 @@ bool CDirectVobSubFilter::Open()
CAtlArray<CString> paths;
- for(ptrdiff_t i = 0; i < 10; i++) {
+ for (ptrdiff_t i = 0; i < 10; i++) {
CString tmp;
tmp.Format(IDS_RP_PATH, i);
CString path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp);
- if(!path.IsEmpty()) {
+ if (!path.IsEmpty()) {
paths.Add(path);
}
}
@@ -1443,49 +1443,49 @@ bool CDirectVobSubFilter::Open()
CAtlArray<SubFile> ret;
GetSubFileNames(m_FileName, paths, ret);
- for(size_t i = 0; i < ret.GetCount(); i++) {
- if(m_frd.files.Find(ret[i].fn)) {
+ for (size_t i = 0; i < ret.GetCount(); i++) {
+ if (m_frd.files.Find(ret[i].fn)) {
continue;
}
CComPtr<ISubStream> pSubStream;
- if(!pSubStream) {
+ if (!pSubStream) {
CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
- if(pVSF && pVSF->Open(ret[i].fn) && pVSF->GetStreamCount() > 0) {
+ if (pVSF && pVSF->Open(ret[i].fn) && pVSF->GetStreamCount() > 0) {
pSubStream = pVSF.Detach();
m_frd.files.AddTail(ret[i].fn.Left(ret[i].fn.GetLength()-4) + _T(".sub"));
}
}
- if(!pSubStream) {
+ if (!pSubStream) {
CAutoPtr<ssf::CRenderer> pSSF(new ssf::CRenderer(&m_csSubLock));
- if(pSSF && pSSF->Open(ret[i].fn) && pSSF->GetStreamCount() > 0) {
+ if (pSSF && pSSF->Open(ret[i].fn) && pSSF->GetStreamCount() > 0) {
pSubStream = pSSF.Detach();
}
}
- if(!pSubStream) {
+ if (!pSubStream) {
CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
- if(pRTS && pRTS->Open(ret[i].fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0) {
+ if (pRTS && pRTS->Open(ret[i].fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0) {
pSubStream = pRTS.Detach();
m_frd.files.AddTail(ret[i].fn + _T(".style"));
}
}
- if(pSubStream) {
+ if (pSubStream) {
m_pSubStreams.AddTail(pSubStream);
m_frd.files.AddTail(ret[i].fn);
}
}
- for(size_t i = 0; i < m_pTextInput.GetCount(); i++) {
- if(m_pTextInput[i]->IsConnected()) {
+ for (size_t i = 0; i < m_pTextInput.GetCount(); i++) {
+ if (m_pTextInput[i]->IsConnected()) {
m_pSubStreams.AddTail(m_pTextInput[i]->GetSubStream());
}
}
- if(S_FALSE == put_SelectedLanguage(FindPreferedLanguage())) {
+ if (S_FALSE == put_SelectedLanguage(FindPreferedLanguage())) {
UpdateSubtitle(false); // make sure pSubPicProvider of our queue gets updated even if the stream number hasn't changed
}
@@ -1498,7 +1498,7 @@ void CDirectVobSubFilter::UpdateSubtitle(bool fApplyDefStyle)
{
CAutoLock cAutolock(&m_csQueueLock);
- if(!m_pSubPicQueue) {
+ if (!m_pSubPicQueue) {
return;
}
@@ -1506,13 +1506,13 @@ void CDirectVobSubFilter::UpdateSubtitle(bool fApplyDefStyle)
CComPtr<ISubStream> pSubStream;
- if(!m_fHideSubtitles) {
+ if (!m_fHideSubtitles) {
int i = m_iSelectedLanguage;
- for(POSITION pos = m_pSubStreams.GetHeadPosition(); i >= 0 && pos; pSubStream = NULL) {
+ for (POSITION pos = m_pSubStreams.GetHeadPosition(); i >= 0 && pos; pSubStream = NULL) {
pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount()) {
+ if (i < pSubStream->GetStreamCount()) {
CAutoLock cAutoLock(&m_csSubLock);
pSubStream->SetStream(i);
break;
@@ -1529,33 +1529,33 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyl
{
CAutoLock cAutolock(&m_csQueueLock);
- if(pSubStream) {
+ if (pSubStream) {
CAutoLock cAutolock(&m_csSubLock);
CLSID clsid;
pSubStream->GetClassID(&clsid);
- if(clsid == __uuidof(CVobSubFile)) {
+ if (clsid == __uuidof(CVobSubFile)) {
CVobSubSettings* pVSS = (CVobSubFile*)(ISubStream*)pSubStream;
- if(fApplyDefStyle) {
+ if (fApplyDefStyle) {
pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
}
- } else if(clsid == __uuidof(CVobSubStream)) {
+ } else if (clsid == __uuidof(CVobSubStream)) {
CVobSubSettings* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
- if(fApplyDefStyle) {
+ if (fApplyDefStyle) {
pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
}
- } else if(clsid == __uuidof(CRenderedTextSubtitle)) {
+ } else if (clsid == __uuidof(CRenderedTextSubtitle)) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
- if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle) {
+ if (fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle) {
STSStyle s = m_defStyle;
- if(m_fOverridePlacement) {
+ if (m_fOverridePlacement) {
s.scrAlignment = 2;
int w = pRTS->m_dstScreenSize.cx;
int h = pRTS->m_dstScreenSize.cy;
@@ -1581,14 +1581,14 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyl
}
}
- if(!fApplyDefStyle) {
+ if (!fApplyDefStyle) {
int i = 0;
POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos) {
+ while (pos) {
CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
- if(pSubStream == pSubStream2) {
+ if (pSubStream == pSubStream2) {
m_iSelectedLanguage = i + pSubStream2->GetStream();
break;
}
@@ -1599,7 +1599,7 @@ void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyl
m_nSubtitleId = (DWORD_PTR)pSubStream;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
}
}
@@ -1608,8 +1608,8 @@ void CDirectVobSubFilter::InvalidateSubtitle(REFERENCE_TIME rtInvalidate, DWORD_
{
CAutoLock cAutolock(&m_csQueueLock);
- if(m_pSubPicQueue) {
- if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId) {
+ if (m_pSubPicQueue) {
+ if (nSubtitleId == -1 || nSubtitleId == m_nSubtitleId) {
m_pSubPicQueue->Invalidate(rtInvalidate);
}
}
@@ -1622,17 +1622,17 @@ void CDirectVobSubFilter::AddSubStream(ISubStream* pSubStream)
CAutoLock cAutoLock(&m_csQueueLock);
POSITION pos = m_pSubStreams.Find(pSubStream);
- if(!pos) {
+ if (!pos) {
m_pSubStreams.AddTail(pSubStream);
}
int len = m_pTextInput.GetCount();
- for(size_t i = 0; i < m_pTextInput.GetCount(); i++)
- if(m_pTextInput[i]->IsConnected()) {
+ for (size_t i = 0; i < m_pTextInput.GetCount(); i++)
+ if (m_pTextInput[i]->IsConnected()) {
len--;
}
- if(len == 0) {
+ if (len == 0) {
HRESULT hr = S_OK;
m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
}
@@ -1643,26 +1643,26 @@ void CDirectVobSubFilter::RemoveSubStream(ISubStream* pSubStream)
CAutoLock cAutoLock(&m_csQueueLock);
POSITION pos = m_pSubStreams.Find(pSubStream);
- if(pos) {
+ if (pos) {
m_pSubStreams.RemoveAt(pos);
}
}
void CDirectVobSubFilter::Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId)
{
- if(nSubtitleId != -1 && nSubtitleId != m_nSubtitleId) {
+ if (nSubtitleId != -1 && nSubtitleId != m_nSubtitleId) {
return;
}
CComQIPtr<IMediaEventSink> pMES = m_pGraph;
- if(!pMES) {
+ if (!pMES) {
return;
}
CComBSTR bstr1("Text"), bstr2(" ");
str.Trim();
- if(!str.IsEmpty()) {
+ if (!str.IsEmpty()) {
bstr2 = CStringA(str);
}
@@ -1675,7 +1675,7 @@ void CDirectVobSubFilter::SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handl
{
CAutoLock cAutolock(&m_csSubLock);
- for(size_t i = 2; i < handles.GetCount(); i++) {
+ for (size_t i = 2; i < handles.GetCount(); i++) {
FindCloseChangeNotification(handles[i]);
}
@@ -1688,11 +1688,11 @@ void CDirectVobSubFilter::SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handl
m_frd.mtime.SetCount(m_frd.files.GetCount());
POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos; i++) {
+ for (ptrdiff_t i = 0; pos; i++) {
CString fn = m_frd.files.GetNext(pos);
CFileStatus status;
- if(CFileGetStatus(fn, status)) {
+ if (CFileGetStatus(fn, status)) {
m_frd.mtime[i] = status.m_mtime;
}
@@ -1701,17 +1701,17 @@ void CDirectVobSubFilter::SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handl
bool fFound = false;
- for(ptrdiff_t j = 0; !fFound && j < paths.GetCount(); j++) {
- if(paths[j] == fn) {
+ for (ptrdiff_t j = 0; !fFound && j < paths.GetCount(); j++) {
+ if (paths[j] == fn) {
fFound = true;
}
}
- if(!fFound) {
+ if (!fFound) {
paths.Add(fn);
HANDLE h = FindFirstChangeNotification(fn, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
- if(h != INVALID_HANDLE_VALUE) {
+ if (h != INVALID_HANDLE_VALUE) {
handles.Add(h);
}
}
@@ -1727,35 +1727,35 @@ DWORD CDirectVobSubFilter::ThreadProc()
SetupFRD(paths, handles);
- while(1) {
+ while (1) {
DWORD idx = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, INFINITE);
- if(idx == (WAIT_OBJECT_0 + 0)) { // m_frd.hEndThreadEvent
+ if (idx == (WAIT_OBJECT_0 + 0)) { // m_frd.hEndThreadEvent
break;
}
- if(idx == (WAIT_OBJECT_0 + 1)) { // m_frd.hRefreshEvent
+ if (idx == (WAIT_OBJECT_0 + 1)) { // m_frd.hRefreshEvent
SetupFRD(paths, handles);
- } else if(idx >= (WAIT_OBJECT_0 + 2) && idx < (WAIT_OBJECT_0 + handles.GetCount())) {
+ } else if (idx >= (WAIT_OBJECT_0 + 2) && idx < (WAIT_OBJECT_0 + handles.GetCount())) {
bool fLocked = true;
IsSubtitleReloaderLocked(&fLocked);
- if(fLocked) {
+ if (fLocked) {
continue;
}
- if(FindNextChangeNotification(handles[idx - WAIT_OBJECT_0]) == FALSE) {
+ if (FindNextChangeNotification(handles[idx - WAIT_OBJECT_0]) == FALSE) {
break;
}
int j = 0;
POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos && j == 0; i++) {
+ for (ptrdiff_t i = 0; pos && j == 0; i++) {
CString fn = m_frd.files.GetNext(pos);
CFileStatus status;
- if(CFileGetStatus(fn, status) && m_frd.mtime[i] != status.m_mtime) {
- for(j = 0; j < 10; j++) {
- if(FILE* f = _tfopen(fn, _T("rb+"))) {
+ if (CFileGetStatus(fn, status) && m_frd.mtime[i] != status.m_mtime) {
+ for (j = 0; j < 10; j++) {
+ if (FILE* f = _tfopen(fn, _T("rb+"))) {
fclose(f);
j = 0;
break;
@@ -1767,15 +1767,15 @@ DWORD CDirectVobSubFilter::ThreadProc()
}
}
- if(j > 0) {
+ if (j > 0) {
SetupFRD(paths, handles);
} else {
Sleep(500);
POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos; i++) {
+ for (ptrdiff_t i = 0; pos; i++) {
CFileStatus status;
- if(CFileGetStatus(m_frd.files.GetNext(pos), status)
+ if (CFileGetStatus(m_frd.files.GetNext(pos), status)
&& m_frd.mtime[i] != status.m_mtime) {
Open();
SetupFRD(paths, handles);
@@ -1788,7 +1788,7 @@ DWORD CDirectVobSubFilter::ThreadProc()
}
}
- for(size_t i = 2; i < handles.GetCount(); i++) {
+ for (size_t i = 2; i < handles.GetCount(); i++) {
FindCloseChangeNotification(handles[i]);
}
diff --git a/src/filters/transform/VSFilter/DirectVobSubPropPage.cpp b/src/filters/transform/VSFilter/DirectVobSubPropPage.cpp
index a273d6a00..00cec53fd 100644
--- a/src/filters/transform/VSFilter/DirectVobSubPropPage.cpp
+++ b/src/filters/transform/VSFilter/DirectVobSubPropPage.cpp
@@ -48,7 +48,7 @@ BOOL WINAPI MyGetDialogSize(int iResourceID, DLGPROC pDlgProc, LPARAM lParam, SI
pDlgProc,
lParam);
- if(hwnd == NULL) {
+ if (hwnd == NULL) {
return FALSE;
}
@@ -67,7 +67,7 @@ STDMETHODIMP CDVSBasePPage::GetPageInfo(LPPROPPAGEINFO pPageInfo)
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CString str;
- if(!str.LoadString(m_TitleId)) {
+ if (!str.LoadString(m_TitleId)) {
return E_FAIL;
}
@@ -84,7 +84,7 @@ STDMETHODIMP CDVSBasePPage::GetPageInfo(LPPROPPAGEINFO pPageInfo)
LPOLESTR pszTitle;
HRESULT hr = AMGetWideString(wszTitle, &pszTitle);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
NOTE("No caption memory");
return hr;
}
@@ -114,12 +114,12 @@ STDMETHODIMP CDVSBasePPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal
return E_UNEXPECTED;
}
*/
- if(m_hwnd) {
+ if (m_hwnd) {
return E_UNEXPECTED;
}
m_hwnd = CreateDialogParam(AfxGetResourceHandle(), MAKEINTRESOURCE(m_DialogId), hwndParent, DialogProc, (LPARAM)this);
- if(m_hwnd == NULL) {
+ if (m_hwnd == NULL) {
return E_OUTOFMEMORY;
}
@@ -140,21 +140,21 @@ CDVSBasePPage::CDVSBasePPage(TCHAR* pName, LPUNKNOWN lpunk, int DialogId, int Ti
INT_PTR CDVSBasePPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- if(m_bIsInitialized) {
+ if (m_bIsInitialized) {
m_bDirty = TRUE;
- if(m_pPageSite) {
+ if (m_pPageSite) {
m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
}
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case BN_CLICKED:
case CBN_SELCHANGE:
case EN_CHANGE: {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(!m_fDisableInstantUpdate
+ if (!m_fDisableInstantUpdate
&& !(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_INSTANTUPDATE)
&& LOWORD(wParam) != IDC_EDIT1 && LOWORD(wParam) != IDC_ANIMWHENBUFFERING
&& !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1)) {
@@ -178,7 +178,7 @@ INT_PTR CDVSBasePPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
HRESULT CDVSBasePPage::OnConnect(IUnknown* pUnknown)
{
- if(!(m_pDirectVobSub = pUnknown)) {
+ if (!(m_pDirectVobSub = pUnknown)) {
return E_NOINTERFACE;
}
@@ -195,7 +195,7 @@ HRESULT CDVSBasePPage::OnConnect(IUnknown* pUnknown)
HRESULT CDVSBasePPage::OnDisconnect()
{
- if(m_pDirectVobSub == NULL) {
+ if (m_pDirectVobSub == NULL) {
return E_UNEXPECTED;
}
@@ -244,7 +244,7 @@ HRESULT CDVSBasePPage::OnApplyChanges()
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(m_bIsInitialized) {
+ if (m_bIsInitialized) {
OnDeactivate();
UpdateObjectData(true);
m_pDirectVobSub->UpdateRegistry(); // *
@@ -261,11 +261,11 @@ void CDVSBasePPage::AttachControls()
AFX_MANAGE_STATE(AfxGetStaticModuleState());
POSITION pos = m_controls.GetStartPosition();
- while(pos) {
+ while (pos) {
UINT id;
CWnd* pControl;
m_controls.GetNextAssoc(pos, id, pControl);
- if(pControl) {
+ if (pControl) {
BOOL fRet = pControl->Attach(GetDlgItem(m_Dlg, id));
ASSERT(fRet);
}
@@ -276,18 +276,18 @@ void CDVSBasePPage::AttachControls()
void CDVSBasePPage::DetachControls()
{
- if(!m_fAttached) {
+ if (!m_fAttached) {
return;
}
AFX_MANAGE_STATE(AfxGetStaticModuleState());
POSITION pos = m_controls.GetStartPosition();
- while(pos) {
+ while (pos) {
UINT id;
CWnd* pControl;
m_controls.GetNextAssoc(pos, id, pControl);
- if(pControl) {
+ if (pControl) {
pControl->Detach();
}
}
@@ -324,8 +324,8 @@ CDVSMainPPage::~CDVSMainPPage()
void CDVSMainPPage::FreeLangs()
{
- if(m_nLangs > 0 && m_ppLangs) {
- for(ptrdiff_t i = 0; i < m_nLangs; i++) {
+ if (m_nLangs > 0 && m_ppLangs) {
+ for (ptrdiff_t i = 0; i < m_nLangs; i++) {
CoTaskMemFree(m_ppLangs[i]);
}
CoTaskMemFree(m_ppLangs);
@@ -342,11 +342,11 @@ void CDVSMainPPage::AllocLangs(int nLangs)
bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case BN_CLICKED: {
- if(LOWORD(wParam) == IDC_OPEN) {
+ if (LOWORD(wParam) == IDC_OPEN) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CFileDialog fd(TRUE, NULL, NULL,
@@ -355,20 +355,20 @@ bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
_T("All files (*.*)|*.*||"),
CDialog::FromHandle(m_Dlg), 0);
- if(fd.DoModal() == IDOK) {
+ if (fd.DoModal() == IDOK) {
m_fnedit.SetWindowText(fd.GetPathName());
}
return true;
- } else if(LOWORD(wParam) == IDC_FONT) {
+ } else if (LOWORD(wParam) == IDC_FONT) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd));
- if(dlg.DoModal() == IDOK) {
+ if (dlg.DoModal() == IDOK) {
m_defStyle = dlg.m_stss;
CString str = m_defStyle.fontName;
- if(str.GetLength() > 18) {
+ if (str.GetLength() > 18) {
str = str.Left(16).TrimRight() + _T("...");
}
m_font.SetWindowText(str);
@@ -388,12 +388,12 @@ bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSMainPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
- if(m_pDirectVobSub->put_FileName(m_fn) == S_OK) {
+ if (fSave) {
+ if (m_pDirectVobSub->put_FileName(m_fn) == S_OK) {
int nLangs;
m_pDirectVobSub->get_LanguageCount(&nLangs);
AllocLangs(nLangs);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) {
+ for (ptrdiff_t i = 0; i < m_nLangs; i++) {
m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
}
m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
@@ -409,7 +409,7 @@ void CDVSMainPPage::UpdateObjectData(bool fSave)
int nLangs;
m_pDirectVobSub->get_LanguageCount(&nLangs);
AllocLangs(nLangs);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) {
+ for (ptrdiff_t i = 0; i < m_nLangs; i++) {
m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
}
m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
@@ -422,7 +422,7 @@ void CDVSMainPPage::UpdateObjectData(bool fSave)
void CDVSMainPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
CString fn;
m_fnedit.GetWindowText(fn);
#ifdef UNICODE
@@ -453,7 +453,7 @@ void CDVSMainPPage::UpdateControlData(bool fSave)
m_forcedsubs.SetCheck(m_fOnlyShowForcedVobSubs);
m_langs.ResetContent();
m_langs.EnableWindow(m_nLangs > 0);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) {
+ for (ptrdiff_t i = 0; i < m_nLangs; i++) {
m_langs.AddString(CString(m_ppLangs[i]));
}
m_langs.SetCurSel(m_iSelectedLanguage);
@@ -503,17 +503,17 @@ CDVSGeneralPPage::CDVSGeneralPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSGeneralPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case CBN_SELCHANGE: {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(LOWORD(wParam) == IDC_RESX2COMBO) {
+ if (LOWORD(wParam) == IDC_RESX2COMBO) {
m_resx2w.EnableWindow(m_resx2.GetCurSel() == 2);
m_resx2h.EnableWindow(m_resx2.GetCurSel() == 2);
return true;
- } else if(LOWORD(wParam) == IDC_LOADCOMBO) {
+ } else if (LOWORD(wParam) == IDC_LOADCOMBO) {
m_extload.EnableWindow(m_load.GetCurSel() == 1);
m_webload.EnableWindow(m_load.GetCurSel() == 1);
m_embload.EnableWindow(m_load.GetCurSel() == 1);
@@ -531,7 +531,7 @@ bool CDVSGeneralPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSGeneralPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_pDirectVobSub->put_ExtendPicture(m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh);
m_pDirectVobSub->put_LoadSettings(m_LoadLevel, m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad);
} else {
@@ -542,17 +542,17 @@ void CDVSGeneralPPage::UpdateObjectData(bool fSave)
void CDVSGeneralPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
- if(m_verext.GetCurSel() >= 0) {
+ if (fSave) {
+ if (m_verext.GetCurSel() >= 0) {
m_VerExt = m_verext.GetItemData(m_verext.GetCurSel());
}
m_HorExt = !!m_mod32fix.GetCheck();
- if(m_resx2.GetCurSel() >= 0) {
+ if (m_resx2.GetCurSel() >= 0) {
m_ResX2 = m_resx2.GetItemData(m_resx2.GetCurSel());
}
m_ResX2minw = m_resx2w.GetPos();
m_ResX2minh = m_resx2h.GetPos();
- if(m_load.GetCurSel() >= 0) {
+ if (m_load.GetCurSel() >= 0) {
m_LoadLevel = m_load.GetItemData(m_load.GetCurSel());
}
m_fExternalLoad = !!m_extload.GetCheck();
@@ -625,11 +625,11 @@ CDVSMiscPPage::CDVSMiscPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSMiscPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case BN_CLICKED: {
- if(LOWORD(wParam) == IDC_INSTANTUPDATE) {
+ if (LOWORD(wParam) == IDC_INSTANTUPDATE) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), !!m_instupd.GetCheck());
return true;
@@ -646,7 +646,7 @@ bool CDVSMiscPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSMiscPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_pDirectVobSub->put_Flip(m_fFlipPicture, m_fFlipSubtitles);
m_pDirectVobSub->put_HideSubtitles(m_fHideSubtitles);
m_pDirectVobSub->put_OSD(m_fOSD);
@@ -667,7 +667,7 @@ void CDVSMiscPPage::UpdateObjectData(bool fSave)
void CDVSMiscPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_fFlipPicture = !!m_flippic.GetCheck();
m_fFlipSubtitles = !!m_flipsub.GetCheck();
m_fHideSubtitles = !!m_hidesub.GetCheck();
@@ -704,11 +704,11 @@ CDVSTimingPPage::CDVSTimingPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSTimingPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case BN_CLICKED: {
- if(LOWORD(wParam) == IDC_MODFPS) {
+ if (LOWORD(wParam) == IDC_MODFPS) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
m_fps.EnableWindow(!!m_modfps.GetCheck());
return true;
@@ -725,7 +725,7 @@ bool CDVSTimingPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSTimingPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_pDirectVobSub->put_SubtitleTiming(m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv);
m_pDirectVobSub->put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
} else {
@@ -736,12 +736,12 @@ void CDVSTimingPPage::UpdateObjectData(bool fSave)
void CDVSTimingPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_fMediaFPSEnabled = !!m_modfps.GetCheck();
CString fpsstr;
m_fps.GetWindowText(fpsstr);
float fps;
- if(_stscanf(fpsstr, _T("%f"), &fps) == 1) {
+ if (_stscanf(fpsstr, _T("%f"), &fps) == 1) {
m_MediaFPS = fps;
}
#if _MFC_VER >= 0x0700
@@ -784,7 +784,7 @@ CDVSAboutPPage::CDVSAboutPPage(LPUNKNOWN lpunk, HRESULT* phr) :
bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_INITDIALOG: {
#ifdef _VSMOD
SetDlgItemTextA( m_Dlg, IDC_VERSION, "DirectVobSub 2.40."MAKE_STR(MPC_VERSION_PATCH)"."MAKE_STR(MPC_VERSION_REV)" "MAKE_STR(VERSION_ARCH)", MOD\nCopyright 2001-2011 MPC-HC & VSFilterMod Teams" );
@@ -794,13 +794,13 @@ bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case BN_CLICKED: {
- if(LOWORD(wParam) == IDC_HOMEPAGEBTN) {
+ if (LOWORD(wParam) == IDC_HOMEPAGEBTN) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL);
return true;
- } else if(LOWORD(wParam) == IDC_BUGREPORTBTN) {
+ } else if (LOWORD(wParam) == IDC_BUGREPORTBTN) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL);
return true;
@@ -828,11 +828,11 @@ CDVSZoomPPage::CDVSZoomPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSZoomPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case EN_CHANGE: {
- if(LOWORD(wParam) == IDC_EDIT1 || LOWORD(wParam) == IDC_EDIT2
+ if (LOWORD(wParam) == IDC_EDIT1 || LOWORD(wParam) == IDC_EDIT2
|| LOWORD(wParam) == IDC_EDIT7 || LOWORD(wParam) == IDC_EDIT8) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
UpdateControlData(true);
@@ -852,7 +852,7 @@ bool CDVSZoomPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSZoomPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_rect.left = 1.0f * (short)m_posx.GetPos() / 100;
m_rect.top = 1.0f * (short)m_posy.GetPos() / 100;
m_rect.right = m_rect.left + 1.0f * (short)m_scalex.GetPos() / 100;
@@ -871,7 +871,7 @@ void CDVSZoomPPage::UpdateControlData(bool fSave)
void CDVSZoomPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_pDirectVobSub->put_ZoomRect(&m_rect);
} else {
m_pDirectVobSub->get_ZoomRect(&m_rect);
@@ -894,14 +894,14 @@ CDVSColorPPage::CDVSColorPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case LBN_DBLCLK:
- if((HWND)lParam == m_dynchglist.m_hWnd) {
+ if ((HWND)lParam == m_dynchglist.m_hWnd) {
int old = -1;
m_pDirectVobSub->get_ColorFormat(&old);
- if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel()))) {
+ if (FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel()))) {
m_dynchglist.SetCurSel(old);
}
@@ -910,11 +910,11 @@ bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case BN_CLICKED: {
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_COLORCHANGE: {
int old = -1;
m_pDirectVobSub->get_ColorFormat(&old);
- if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel()))) {
+ if (FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel()))) {
m_dynchglist.SetCurSel(old);
}
@@ -922,7 +922,7 @@ bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
case IDC_COLORUP: {
int sel = m_preflist.GetCurSel();
- if(sel > 0) {
+ if (sel > 0) {
CString str;
m_preflist.GetText(sel, str);
int iPos = (int)m_preflist.GetItemData(sel);
@@ -937,7 +937,7 @@ bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
case IDC_COLORDOWN: {
int sel = m_preflist.GetCurSel();
- if(sel >= 0 && sel < m_preflist.GetCount()-1) {
+ if (sel >= 0 && sel < m_preflist.GetCount()-1) {
CString str;
m_preflist.GetText(sel, str);
int iPos = (int)m_preflist.GetItemData(sel);
@@ -963,18 +963,18 @@ bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSColorPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
} else {
}
}
void CDVSColorPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
- if((UINT)m_preflist.GetCount() == VIHSIZE) {
+ if (fSave) {
+ if ((UINT)m_preflist.GetCount() == VIHSIZE) {
BYTE* pData = new BYTE[VIHSIZE];
- for(ptrdiff_t i = 0; i < m_preflist.GetCount(); i++) {
+ for (ptrdiff_t i = 0; i < m_preflist.GetCount(); i++) {
pData[i] = (BYTE)m_preflist.GetItemData(i);
}
@@ -993,21 +993,21 @@ void CDVSColorPPage::UpdateControlData(bool fSave)
BYTE* pData = NULL;
UINT nSize;
- if(!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
+ if (!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
|| !pData || nSize != VIHSIZE) {
- if(pData) {
+ if (pData) {
delete [] pData, pData = NULL;
}
nSize = VIHSIZE;
pData = new BYTE[VIHSIZE];
- for(size_t i = 0; i < VIHSIZE; i++) {
+ for (size_t i = 0; i < VIHSIZE; i++) {
pData[i] = i;
}
}
- if(pData) {
- for(ptrdiff_t i = 0; i < (int)nSize; i++) {
+ if (pData) {
+ for (ptrdiff_t i = 0; i < (int)nSize; i++) {
m_dynchglist.AddString(VIH2String(pData[i]));
m_dynchglist.SetItemData(i, pData[i]);
m_preflist.AddString(VIH2String(pData[i]));
@@ -1041,14 +1041,14 @@ CDVSPathsPPage::CDVSPathsPPage(LPUNKNOWN pUnk, HRESULT* phr) :
bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg) {
+ switch (uMsg) {
case WM_COMMAND: {
- switch(HIWORD(wParam)) {
+ switch (HIWORD(wParam)) {
case LBN_SELCHANGE:
- if((HWND)lParam == m_pathlist.m_hWnd) {
+ if ((HWND)lParam == m_pathlist.m_hWnd) {
int i = m_pathlist.GetCurSel();
m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
- if(i >= 0) {
+ if (i >= 0) {
CString path;
m_pathlist.GetText(i, path);
m_path.SetWindowText(path);
@@ -1058,14 +1058,14 @@ bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case LBN_SELCANCEL:
- if((HWND)lParam == m_pathlist.m_hWnd) {
+ if ((HWND)lParam == m_pathlist.m_hWnd) {
m_remove.EnableWindow(FALSE);
return true;
}
break;
case BN_CLICKED: {
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BROWSE: {
TCHAR pathbuff[MAX_PATH];
@@ -1080,7 +1080,7 @@ bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
bi.iImage = 0;
LPITEMIDLIST iil = SHBrowseForFolder(&bi);
- if(iil) {
+ if (iil) {
SHGetPathFromIDList(iil, pathbuff);
m_path.SetWindowText(pathbuff);
}
@@ -1091,10 +1091,10 @@ bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_REMOVE: {
int i = m_pathlist.GetCurSel();
- if(i >= 0) {
+ if (i >= 0) {
m_pathlist.DeleteString(i);
i = min(i, m_pathlist.GetCount()-1);
- if(i >= 0 && m_pathlist.GetCount() > 0) {
+ if (i >= 0 && m_pathlist.GetCount() > 0) {
m_pathlist.SetCurSel(i);
m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
}
@@ -1107,7 +1107,7 @@ bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_ADD: {
CString path;
m_path.GetWindowText(path);
- if(!path.IsEmpty() && m_pathlist.FindString(-1, path) < 0) {
+ if (!path.IsEmpty() && m_pathlist.FindString(-1, path) < 0) {
m_pathlist.AddString(path);
}
@@ -1127,18 +1127,18 @@ bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CDVSPathsPPage::UpdateObjectData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
CString chk(_T("123456789")), path, tmp;
int i = 0;
do {
tmp.Format(ResStr(IDS_RP_PATH), i++);
path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
- if(path != chk) {
+ if (path != chk) {
theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, _T(""));
}
- } while(path != chk);
+ } while (path != chk);
- for(i = 0; i < m_paths.GetSize(); i++) {
+ for (i = 0; i < m_paths.GetSize(); i++) {
tmp.Format(ResStr(IDS_RP_PATH), i);
theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, m_paths[i]);
}
@@ -1146,27 +1146,27 @@ void CDVSPathsPPage::UpdateObjectData(bool fSave)
CString chk(_T("123456789")), path, tmp;
int i = 0;
do {
- if(!path.IsEmpty()) {
+ if (!path.IsEmpty()) {
m_paths.Add(path);
}
tmp.Format(ResStr(IDS_RP_PATH), i++);
path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
- } while(path != chk);
+ } while (path != chk);
}
}
void CDVSPathsPPage::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
m_paths.RemoveAll();
- for(ptrdiff_t i = 0; i < m_pathlist.GetCount(); i++) {
+ for (ptrdiff_t i = 0; i < m_pathlist.GetCount(); i++) {
CString path;
m_pathlist.GetText(i, path);
m_paths.Add(path);
}
} else {
m_pathlist.ResetContent();
- for(ptrdiff_t i = 0; i < m_paths.GetSize(); i++) {
+ for (ptrdiff_t i = 0; i < m_paths.GetSize(); i++) {
m_pathlist.AddString(m_paths[i]);
}
diff --git a/src/filters/transform/VSFilter/Scale2x.cpp b/src/filters/transform/VSFilter/Scale2x.cpp
index ab869ab0b..f2f725d04 100644
--- a/src/filters/transform/VSFilter/Scale2x.cpp
+++ b/src/filters/transform/VSFilter/Scale2x.cpp
@@ -37,11 +37,11 @@ void Scale2x_YV( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
BYTE* stmp = s1 + spitch;
BYTE* dtmp = d1 + dpitch;
- for(BYTE* s3 = s1 + (w-1); s1 < s3; s1 += 1, d1 += 2) {
+ for (BYTE* s3 = s1 + (w-1); s1 < s3; s1 += 1, d1 += 2) {
d1[0] = s1[0];
d1[1] = (s1[0]+s1[1])>>1;
}
@@ -68,7 +68,7 @@ void Scale2x_YUY2_SSE2( BYTE* s1, BYTE* d1, int w )
__m128i mm4 = _mm_cvtsi64_si128(__0x00ff00ff00ff00ff);
__m128i mm5 = _mm_cvtsi64_si128(__0x00000000ffffffff);
__m128i mm6 = _mm_cvtsi64_si128(__0xffffffff00000000);
- for(BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8) {
+ for (BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8) {
__m128i mm0 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm0, [esi]
__m128i mm2 = _mm_move_epi64(mm0); //movq mm2, mm0
mm0 = _mm_and_si128(mm0, mm4); //pand mm0, mm4 // mm0 = 00y400y300y200y1
@@ -181,7 +181,7 @@ void Scale2x_YUY2_MMX( BYTE* s1, BYTE* d1, int w )
void Scale2x_YUY2_c( BYTE* s1, BYTE* d1, int w )
{
- for(BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8) {
+ for (BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8) {
d1[0] = s1[0];
d1[1] = s1[1];
d1[2] = (s1[0]+s1[2])>>1;
@@ -224,7 +224,7 @@ void Scale2x_YUY2( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) {
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) {
// row0, 4 pixels: y1|u1|y2|v1|y3|u2|y4|v2
// ->
// row0, 8 pixels: y1|u1|(y1+y2)/2|v1|y2|(u1+u2)/2|(y2+y3)/2|(v1+v2)/2
@@ -248,11 +248,11 @@ void Scale2x_RGB555( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
BYTE* stmp = s1 + spitch;
BYTE* dtmp = d1 + dpitch;
- for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4) {
+ for (BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4) {
*((WORD*)d1) = *((WORD*)s1);
*((WORD*)d1+1) =
((((*((WORD*)s1)&0x7c00) + (*((WORD*)s1+1)&0x7c00)) >> 1)&0x7c00)|
@@ -279,11 +279,11 @@ void Scale2x_RGB565( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
BYTE* stmp = s1 + spitch;
BYTE* dtmp = d1 + dpitch;
- for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4) {
+ for (BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4) {
*((WORD*)d1) = *((WORD*)s1);
*((WORD*)d1+1) =
((((*((WORD*)s1)&0xf800) + (*((WORD*)s1+1)&0xf800)) >> 1)&0xf800)|
@@ -310,11 +310,11 @@ void Scale2x_RGB24( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) { // TODO: replace this mess with mmx code
BYTE* stmp = s1 + spitch;
BYTE* dtmp = d1 + dpitch;
- for(BYTE* s3 = s1 + (w-1)*3; s1 < s3; s1 += 3, d1 += 6) {
+ for (BYTE* s3 = s1 + (w-1)*3; s1 < s3; s1 += 3, d1 += 6) {
d1[0] = s1[0];
d1[1] = s1[1];
d1[2] = s1[2];
@@ -341,7 +341,7 @@ void Scale2x_RGB24( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
void Scale2x_XRGB32_SSE2( BYTE* s1, BYTE* d1, int w )
{
__m128i mm_zero = _mm_setzero_si128();//pxor mm0, mm0
- for(BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 4, d1 += 8) {
+ for (BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 4, d1 += 8) {
__m128i mm1 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm1, [esi]
__m128i mm2 = _mm_move_epi64(mm1); //movq mm2, mm1
@@ -408,7 +408,7 @@ void Scale2x_XRGB32_MMX( BYTE* s1, BYTE* d1, int w )
void Scale2x_XRGB32_c( BYTE* s1, BYTE* d1, int w )
{
- for(BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 3, d1 += 6) {
+ for (BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 3, d1 += 6) {
d1[0] = s1[0];
d1[1] = s1[1];
d1[2] = s1[2];
@@ -441,7 +441,7 @@ void Scale2x_XRGB32( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
BYTE* s2;
BYTE* d1;
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) {
+ for (s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) {
scale_func(s1, d1, w);
s1 += spitch;
@@ -458,17 +458,17 @@ void Scale2x_XRGB32( int w, int h, BYTE* d, int dpitch, BYTE* s, int spitch )
/* ResX2 */
void Scale2x(const GUID& subtype, BYTE* d, int dpitch, BYTE* s, int spitch, int w, int h)
{
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
+ if (subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) {
Scale2x_YV(w, h, d, dpitch, s, spitch);
- } else if(subtype == MEDIASUBTYPE_YUY2) {
+ } else if (subtype == MEDIASUBTYPE_YUY2) {
Scale2x_YUY2(w, h, d, dpitch, s, spitch);
- } else if(subtype == MEDIASUBTYPE_RGB555) {
+ } else if (subtype == MEDIASUBTYPE_RGB555) {
Scale2x_RGB555(w, h, d, dpitch, s, spitch);
- } else if(subtype == MEDIASUBTYPE_RGB565) {
+ } else if (subtype == MEDIASUBTYPE_RGB565) {
Scale2x_RGB565(w, h, d, dpitch, s, spitch);
- } else if(subtype == MEDIASUBTYPE_RGB24) {
+ } else if (subtype == MEDIASUBTYPE_RGB24) {
Scale2x_RGB24(w, h, d, dpitch, s, spitch);
- } else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32) {
+ } else if (subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32) {
Scale2x_XRGB32(w, h, d, dpitch, s, spitch);
}
}
diff --git a/src/filters/transform/VSFilter/StyleEditorDialog.cpp b/src/filters/transform/VSFilter/StyleEditorDialog.cpp
index 0cd270f06..76986dee8 100644
--- a/src/filters/transform/VSFilter/StyleEditorDialog.cpp
+++ b/src/filters/transform/VSFilter/StyleEditorDialog.cpp
@@ -106,10 +106,10 @@ void CStyleEditorDialog::DoDataExchange(CDataExchange* pDX)
void CStyleEditorDialog::UpdateControlData(bool fSave)
{
- if(fSave) {
+ if (fSave) {
UpdateData();
- if(m_iCharset >= 0) {
+ if (m_iCharset >= 0) {
m_stss.charSet = m_charset.GetItemData(m_iCharset);
}
m_stss.fontSpacing = m_spacing;
@@ -124,25 +124,25 @@ void CStyleEditorDialog::UpdateControlData(bool fSave)
m_stss.scrAlignment = m_screenalignment+1;
m_stss.marginRect = m_margin;
- for(ptrdiff_t i = 0; i < 4; i++) {
+ for (ptrdiff_t i = 0; i < 4; i++) {
m_stss.alpha[i] = 255-m_alpha[i];
}
} else {
m_font.SetWindowText(m_stss.fontName);
m_iCharset = -1;
- for(ptrdiff_t i = 0; i < CharSetLen; i++) {
+ for (ptrdiff_t i = 0; i < CharSetLen; i++) {
CString str;
str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
m_charset.AddString(str);
m_charset.SetItemData(i, CharSetList[i]);
- if(m_stss.charSet == CharSetList[i]) {
+ if (m_stss.charSet == CharSetList[i]) {
m_iCharset = i;
}
}
// TODO: allow floats in these edit boxes
m_spacing = m_stss.fontSpacing;
m_spacingspin.SetRange32(-10000, 10000);
- while(m_stss.fontAngleZ < 0) {
+ while (m_stss.fontAngleZ < 0) {
m_stss.fontAngleZ += 360;
}
m_angle = fmod(m_stss.fontAngleZ, 360);
@@ -165,7 +165,7 @@ void CStyleEditorDialog::UpdateControlData(bool fSave)
m_margintopspin.SetRange32(-10000, 10000);
m_marginbottomspin.SetRange32(-10000, 10000);
- for(ptrdiff_t i = 0; i < 4; i++) {
+ for (ptrdiff_t i = 0; i < 4; i++) {
m_color[i].SetColorPtr(&m_stss.colors[i]);
m_alpha[i] = 255-m_stss.alpha[i];
m_alphasliders[i].SetRange(0, 255);
@@ -181,7 +181,7 @@ void CStyleEditorDialog::AskColor(int i)
{
CColorDialog dlg(m_stss.colors[i]);
dlg.m_cc.Flags |= CC_FULLOPEN;
- if(dlg.DoModal() == IDOK) {
+ if (dlg.DoModal() == IDOK) {
m_stss.colors[i] = dlg.m_cc.rgbResult;
m_color[i].Invalidate();
}
@@ -225,15 +225,15 @@ void CStyleEditorDialog::OnBnClickedButton1()
lf <<= m_stss;
CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCALABLEONLY|CF_EFFECTS);
- if(dlg.DoModal() == IDOK) {
+ if (dlg.DoModal() == IDOK) {
CString str(lf.lfFaceName);
- if(str.GetLength() > 16) {
+ if (str.GetLength() > 16) {
str = str.Left(14) + _T("...");
}
m_font.SetWindowText(str);
- for(ptrdiff_t i = 0, j = m_charset.GetCount(); i < j; i++) {
- if(m_charset.GetItemData(i) == lf.lfCharSet) {
+ for (ptrdiff_t i = 0, j = m_charset.GetCount(); i < j; i++) {
+ if (m_charset.GetItemData(i) == lf.lfCharSet) {
m_charset.SetCurSel(i);
break;
}
@@ -268,20 +268,20 @@ void CStyleEditorDialog::OnBnClickedCheck1()
UpdateData();
int avg = 0;
- for(ptrdiff_t i = 0; i < 4; i++) {
+ for (ptrdiff_t i = 0; i < 4; i++) {
avg += m_alphasliders[i].GetPos();
}
avg /= 4;
- for(ptrdiff_t i = 0; i < 4; i++) {
+ for (ptrdiff_t i = 0; i < 4; i++) {
m_alphasliders[i].SetPos(avg);
}
}
void CStyleEditorDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(m_linkalphasliders && pScrollBar) {
+ if (m_linkalphasliders && pScrollBar) {
int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
- for(ptrdiff_t i = 0; i < 4; i++) {
+ for (ptrdiff_t i = 0; i < 4; i++) {
m_alphasliders[i].SetPos(pos);
}
}
diff --git a/src/filters/transform/VSFilter/Systray.cpp b/src/filters/transform/VSFilter/Systray.cpp
index 174729d53..4e23411b3 100644
--- a/src/filters/transform/VSFilter/Systray.cpp
+++ b/src/filters/transform/VSFilter/Systray.cpp
@@ -43,8 +43,8 @@ LRESULT CALLBACK HookProc(UINT code, WPARAM wParam, LPARAM lParam)
{
MSG* msg = (MSG*)lParam;
- if(msg->message == WM_KEYDOWN) {
- switch(msg->wParam) {
+ if (msg->message == WM_KEYDOWN) {
+ switch (msg->wParam) {
case VK_F13:
PostMessage(HWND_BROADCAST, WM_DVSPREVSUB, 0, 0);
break;
@@ -75,13 +75,13 @@ class CSystrayWindow : public CWnd
void StepSub(int dir) {
int iSelected, nLangs;
- if(FAILED(m_tbid->dvs->get_LanguageCount(&nLangs))) {
+ if (FAILED(m_tbid->dvs->get_LanguageCount(&nLangs))) {
return;
}
- if(FAILED(m_tbid->dvs->get_SelectedLanguage(&iSelected))) {
+ if (FAILED(m_tbid->dvs->get_SelectedLanguage(&iSelected))) {
return;
}
- if(nLangs > 0) {
+ if (nLangs > 0) {
m_tbid->dvs->put_SelectedLanguage((iSelected+dir+nLangs)%nLangs);
}
}
@@ -92,7 +92,7 @@ class CSystrayWindow : public CWnd
void ToggleSub() {
bool fShow;
- if(FAILED(m_tbid->dvs->get_HideSubtitles(&fShow))) {
+ if (FAILED(m_tbid->dvs->get_HideSubtitles(&fShow))) {
return;
}
m_tbid->dvs->put_HideSubtitles(!fShow);
@@ -134,11 +134,11 @@ END_MESSAGE_MAP()
int CSystrayWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CWnd::OnCreate(lpCreateStruct) == -1) {
+ if (CWnd::OnCreate(lpCreateStruct) == -1) {
return -1;
}
- if(g_hHook == INVALID_HANDLE_VALUE) {
+ if (g_hHook == INVALID_HANDLE_VALUE) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// g_hHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, AfxGetInstanceHandle(), 0);
}
@@ -164,7 +164,7 @@ void CSystrayWindow::OnDestroy()
tnid.uID = IDI_ICON1;
Shell_NotifyIcon(NIM_DELETE, &tnid);
- if(g_hHook != INVALID_HANDLE_VALUE) {
+ if (g_hHook != INVALID_HANDLE_VALUE) {
UnhookWindowsHookEx(g_hHook);
g_hHook = (HHOOK)INVALID_HANDLE_VALUE;
}
@@ -174,9 +174,9 @@ void CSystrayWindow::OnDestroy()
void CSystrayWindow::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == 1) {
+ if (nIDEvent == 1) {
UINT fScreenSaver = 0;
- if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fScreenSaver, 0)) {
+ if (SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fScreenSaver, 0)) {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fScreenSaver, 0, SPIF_SENDWININICHANGE);
}
@@ -219,7 +219,7 @@ LRESULT CSystrayWindow::OnTaskBarRestart(WPARAM, LPARAM)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(m_tbid->fShowIcon) {
+ if (m_tbid->fShowIcon) {
NOTIFYICONDATA tnid;
ZeroMemory(&tnid, sizeof(NOTIFYICONDATA));
tnid.cbSize = sizeof(NOTIFYICONDATA);
@@ -233,7 +233,7 @@ LRESULT CSystrayWindow::OnTaskBarRestart(WPARAM, LPARAM)
BOOL res = Shell_NotifyIcon(NIM_ADD, &tnid);
- if(tnid.hIcon) {
+ if (tnid.hIcon) {
DestroyIcon(tnid.hIcon);
}
@@ -245,13 +245,13 @@ LRESULT CSystrayWindow::OnTaskBarRestart(WPARAM, LPARAM)
LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
{
- if((UINT)wParam != IDI_ICON1) {
+ if ((UINT)wParam != IDI_ICON1) {
return -1;
}
HWND hWnd = m_hWnd;
- switch((UINT)lParam) {
+ switch ((UINT)lParam) {
case WM_LBUTTONDBLCLK: {
// IMPORTANT: we must not hold the graph at the same time as showing the property page
// or else when closing the app the graph doesn't get released and dvobsub's JoinFilterGraph
@@ -260,13 +260,13 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
CComPtr<IBaseFilter> pBF2;
BeginEnumFilters(m_tbid->graph, pEF, pBF) {
- if(!CComQIPtr<IDirectVobSub>(pBF)) {
+ if (!CComQIPtr<IDirectVobSub>(pBF)) {
continue;
}
- if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph) {
+ if (CComQIPtr<IVideoWindow> pVW = m_tbid->graph) {
HWND hwnd;
- if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ if (SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
|| SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd))) {
hWnd = hwnd;
}
@@ -278,7 +278,7 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
}
EndEnumFilters
- if(pBF2) {
+ if (pBF2) {
ShowPPage(pBF2, hWnd);
}
}
@@ -293,11 +293,11 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
BeginEnumFilters(m_tbid->graph, pEF, pBF) {
CString name = GetFilterName(pBF);
- if(name.IsEmpty()) {
+ if (name.IsEmpty()) {
continue;
}
- if(CComQIPtr<IAMStreamSelect> pSS = pBF) {
+ if (CComQIPtr<IAMStreamSelect> pSS = pBF) {
pStreams.Add(pSS);
names.Add(name);
}
@@ -307,7 +307,7 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
CMenu popup;
popup.CreatePopupMenu();
- for(size_t j = 0; j < pStreams.GetCount(); j++) {
+ for (size_t j = 0; j < pStreams.GetCount(); j++) {
bool fMMSwitcher = !names[j].Compare(_T("Morgan Stream Switcher"));
DWORD cStreams = 0;
@@ -315,12 +315,12 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
DWORD flags, group, prevgroup = (DWORD)-1;
- for(UINT i = 0; i < cStreams; i++) {
+ for (UINT i = 0; i < cStreams; i++) {
WCHAR* pName = NULL;
- if(S_OK == pStreams[j]->Info(i, 0, &flags, 0, &group, &pName, 0, 0)) {
- if(prevgroup != group && i > 1) {
- if(fMMSwitcher) {
+ if (S_OK == pStreams[j]->Info(i, 0, &flags, 0, &group, &pName, 0, 0)) {
+ if (prevgroup != group && i > 1) {
+ if (fMMSwitcher) {
cStreams = i;
break;
}
@@ -328,14 +328,14 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
}
prevgroup = group;
- if(pName) {
+ if (pName) {
popup.AppendMenu(MF_ENABLED|MF_STRING|(flags?MF_CHECKED:MF_UNCHECKED), (1<<15)|(j<<8)|(i), CString(pName));
CoTaskMemFree(pName);
}
}
}
- if(cStreams > 0) {
+ if (cStreams > 0) {
popup.AppendMenu(MF_SEPARATOR);
}
}
@@ -344,8 +344,8 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
TCHAR* str;
str = CallPPage(m_tbid->graph, i, (HWND)INVALID_HANDLE_VALUE);
- while(str) {
- if(_tcsncmp(str, _T("DivX MPEG"), 9) || m_tbid->fRunOnce) { // divx3's ppage will crash if the graph hasn't been run at least once yet
+ while (str) {
+ if (_tcsncmp(str, _T("DivX MPEG"), 9) || m_tbid->fRunOnce) { // divx3's ppage will crash if the graph hasn't been run at least once yet
popup.AppendMenu(MF_ENABLED|MF_STRING|MF_UNCHECKED, (1<<14)|(i), str);
}
@@ -359,12 +359,12 @@ LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
UINT id = popup.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, CWnd::FromHandle(hWnd), 0);
PostMessage(WM_NULL);
- if(id & (1<<15)) {
+ if (id & (1<<15)) {
pStreams[(id>>8)&0x3f]->Enable(id&0xff, AMSTREAMSELECTENABLE_ENABLE);
- } else if(id & (1<<14)) {
- if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph) {
+ } else if (id & (1<<14)) {
+ if (CComQIPtr<IVideoWindow> pVW = m_tbid->graph) {
HWND hwnd;
- if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ if (SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
|| SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd))) {
hWnd = hwnd;
}
@@ -389,14 +389,14 @@ DWORD CALLBACK SystrayThreadProc(void* pParam)
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CSystrayWindow wnd((SystrayIconData*)pParam);
- if(!wnd.CreateEx(0, AfxRegisterWndClass(0), _T("DVSWND"), WS_OVERLAPPED, CRect(0, 0, 0, 0), NULL, 0, NULL)) {
+ if (!wnd.CreateEx(0, AfxRegisterWndClass(0), _T("DVSWND"), WS_OVERLAPPED, CRect(0, 0, 0, 0), NULL, 0, NULL)) {
return (DWORD)-1;
}
((SystrayIconData*)pParam)->hSystrayWnd = wnd.m_hWnd;
MSG msg;
- while(GetMessage(&msg, NULL/*wnd.m_hWnd*/, 0, 0)) {
+ while (GetMessage(&msg, NULL/*wnd.m_hWnd*/, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -420,11 +420,11 @@ static TCHAR* CallPPage(IFilterGraph* pGraph, int idx, HWND hWnd)
BeginEnumFilters(pGraph, pEF, pBF) {
CComQIPtr<ISpecifyPropertyPages> pSPS = pBF;
- if(!pSPS) {
+ if (!pSPS) {
continue;
}
- if(i == idx) {
+ if (i == idx) {
pFilter = pBF;
pSPS->GetPages(&caGUID);
wstr = _wcsdup(CStringW(GetFilterName(pBF))); // double char-wchar conversion happens in the non-unicode build, but anyway... :)
@@ -437,21 +437,21 @@ static TCHAR* CallPPage(IFilterGraph* pGraph, int idx, HWND hWnd)
TCHAR* ret = NULL;
- if(pFilter) {
- if(hWnd != INVALID_HANDLE_VALUE) {
+ if (pFilter) {
+ if (hWnd != INVALID_HANDLE_VALUE) {
ShowPPage(pFilter, hWnd);
} else {
ret = new TCHAR[wcslen(wstr)+1];
- if(ret) {
+ if (ret) {
_tcscpy(ret, CString(wstr));
}
}
}
- if(caGUID.pElems) {
+ if (caGUID.pElems) {
CoTaskMemFree(caGUID.pElems);
}
- if(wstr) {
+ if (wstr) {
free(wstr);
}
diff --git a/src/filters/transform/VSFilter/VSFilter.cpp b/src/filters/transform/VSFilter/VSFilter.cpp
index a26e84bfd..29765c482 100644
--- a/src/filters/transform/VSFilter/VSFilter.cpp
+++ b/src/filters/transform/VSFilter/VSFilter.cpp
@@ -44,7 +44,7 @@ extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL CVSFilterApp::InitInstance()
{
- if(!CWinApp::InitInstance()) {
+ if (!CWinApp::InitInstance()) {
return FALSE;
}
@@ -137,15 +137,15 @@ STDAPI DllRegisterServer()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1) {
+ if (theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1) {
theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);
}
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1) {
+ if (theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1) {
theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);
}
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1) {
+ if (theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1) {
theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);
}
@@ -161,14 +161,14 @@ STDAPI DllUnregisterServer()
void CALLBACK DirectVobSub(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
- if(FAILED(::CoInitialize(0))) {
+ if (FAILED(::CoInitialize(0))) {
return;
}
CComPtr<IBaseFilter> pFilter;
CComQIPtr<ISpecifyPropertyPages> pSpecify;
- if(SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter)) {
+ if (SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter)) {
ShowPPage(pFilter, hwnd);
}
diff --git a/src/filters/transform/VSFilter/plugins.cpp b/src/filters/transform/VSFilter/plugins.cpp
index defdaf0f3..abef007fe 100644
--- a/src/filters/transform/VSFilter/plugins.cpp
+++ b/src/filters/transform/VSFilter/plugins.cpp
@@ -69,36 +69,36 @@ namespace Plugin
}
bool Render(SubPicDesc& dst, REFERENCE_TIME rt, float fps) {
- if(!m_pSubPicProvider) {
+ if (!m_pSubPicProvider) {
return false;
}
CSize size(dst.w, dst.h);
- if(!m_pSubPicQueue) {
+ if (!m_pSubPicQueue) {
CComPtr<ISubPicAllocator> pAllocator = new CMemSubPicAllocator(dst.type, size);
HRESULT hr;
- if(!(m_pSubPicQueue = new CSubPicQueueNoThread(pAllocator, &hr)) || FAILED(hr)) {
+ if (!(m_pSubPicQueue = new CSubPicQueueNoThread(pAllocator, &hr)) || FAILED(hr)) {
m_pSubPicQueue = NULL;
return false;
}
}
- if(m_SubPicProviderId != (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider) {
+ if (m_SubPicProviderId != (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(m_pSubPicProvider);
m_SubPicProviderId = (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider;
}
CComPtr<ISubPic> pSubPic;
- if(!m_pSubPicQueue->LookupSubPic(rt, pSubPic)) {
+ if (!m_pSubPicQueue->LookupSubPic(rt, pSubPic)) {
return false;
}
CRect r;
pSubPic->GetDirtyRect(r);
- if(dst.type == MSP_RGB32 || dst.type == MSP_RGB24 || dst.type == MSP_RGB16 || dst.type == MSP_RGB15) {
+ if (dst.type == MSP_RGB32 || dst.type == MSP_RGB24 || dst.type == MSP_RGB16 || dst.type == MSP_RGB15) {
dst.h = -dst.h;
}
@@ -118,35 +118,35 @@ namespace Plugin
fs.m_mtime = 0;
CFileGetStatus(fn, fs);
- while(1) {
+ while (1) {
DWORD i = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, 1000);
- if(WAIT_OBJECT_0 == i) {
+ if (WAIT_OBJECT_0 == i) {
Reply(S_OK);
break;
- } else if(WAIT_OBJECT_0 + 1 >= i && i <= WAIT_OBJECT_0 + handles.GetCount()) {
- if(FindNextChangeNotification(handles[i - WAIT_OBJECT_0])) {
+ } else if (WAIT_OBJECT_0 + 1 >= i && i <= WAIT_OBJECT_0 + handles.GetCount()) {
+ if (FindNextChangeNotification(handles[i - WAIT_OBJECT_0])) {
CFileStatus fs2;
fs2.m_mtime = 0;
CFileGetStatus(fn, fs2);
- if(fs.m_mtime < fs2.m_mtime) {
+ if (fs.m_mtime < fs2.m_mtime) {
fs.m_mtime = fs2.m_mtime;
- if(CComQIPtr<ISubStream> pSubStream = m_pSubPicProvider) {
+ if (CComQIPtr<ISubStream> pSubStream = m_pSubPicProvider) {
CAutoLock cAutoLock(&m_csSubLock);
pSubStream->Reload();
}
}
}
- } else if(WAIT_TIMEOUT == i) {
+ } else if (WAIT_TIMEOUT == i) {
CString fn2 = GetFileName();
- if(fn != fn2) {
+ if (fn != fn2) {
CPath p(fn2);
p.RemoveFileSpec();
HANDLE h = FindFirstChangeNotification(p, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
- if(h != INVALID_HANDLE_VALUE) {
+ if (h != INVALID_HANDLE_VALUE) {
fn = fn2;
handles.SetCount(1);
handles.Add(h);
@@ -159,7 +159,7 @@ namespace Plugin
m_hThread = 0;
- for(size_t i = 1; i < handles.GetCount(); i++) {
+ for (size_t i = 1; i < handles.GetCount(); i++) {
FindCloseChangeNotification(handles[i]);
}
@@ -171,7 +171,7 @@ namespace Plugin
{
public:
CVobSubFilter(CString fn = _T("")) {
- if(!fn.IsEmpty()) {
+ if (!fn.IsEmpty()) {
Open(fn);
}
}
@@ -180,9 +180,9 @@ namespace Plugin
SetFileName(_T(""));
m_pSubPicProvider = NULL;
- if(CVobSubFile* vsf = new CVobSubFile(&m_csSubLock)) {
+ if (CVobSubFile* vsf = new CVobSubFile(&m_csSubLock)) {
m_pSubPicProvider = (ISubPicProvider*)vsf;
- if(vsf->Open(CString(fn))) {
+ if (vsf->Open(CString(fn))) {
SetFileName(fn);
} else {
m_pSubPicProvider = NULL;
@@ -201,7 +201,7 @@ namespace Plugin
CTextSubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET, float fps = -1)
: m_CharSet(CharSet) {
m_fps = fps;
- if(!fn.IsEmpty()) {
+ if (!fn.IsEmpty()) {
Open(fn, CharSet);
}
}
@@ -214,10 +214,10 @@ namespace Plugin
SetFileName(_T(""));
m_pSubPicProvider = NULL;
- if(!m_pSubPicProvider) {
- if(ssf::CRenderer* ssf = new ssf::CRenderer(&m_csSubLock)) {
+ if (!m_pSubPicProvider) {
+ if (ssf::CRenderer* ssf = new ssf::CRenderer(&m_csSubLock)) {
m_pSubPicProvider = (ISubPicProvider*)ssf;
- if(ssf->Open(CString(fn))) {
+ if (ssf->Open(CString(fn))) {
SetFileName(fn);
} else {
m_pSubPicProvider = NULL;
@@ -225,10 +225,10 @@ namespace Plugin
}
}
- if(!m_pSubPicProvider) {
- if(CRenderedTextSubtitle* rts = new CRenderedTextSubtitle(&m_csSubLock)) {
+ if (!m_pSubPicProvider) {
+ if (CRenderedTextSubtitle* rts = new CRenderedTextSubtitle(&m_csSubLock)) {
m_pSubPicProvider = (ISubPicProvider*)rts;
- if(rts->Open(CString(fn), CharSet)) {
+ if (rts->Open(CString(fn), CharSet)) {
SetFileName(fn);
} else {
m_pSubPicProvider = NULL;
@@ -296,7 +296,7 @@ namespace Plugin
CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
_T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle(hwnd), 0);
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return 1;
}
@@ -335,7 +335,7 @@ namespace Plugin
fd.m_pOFN->lpfnHook = (LPOFNHOOKPROC)OpenHookProc;
fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return 1;
}
@@ -343,7 +343,7 @@ namespace Plugin
}
void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str) {
- if(!GetFileName().IsEmpty()) {
+ if (!GetFileName().IsEmpty()) {
sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
} else {
sprintf(str, " (empty)");
@@ -373,7 +373,7 @@ namespace Plugin
void baseDeinitProc(FilterActivation* fa, const FilterFunctions* ff)
{
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f, f = NULL;
}
}
@@ -399,7 +399,7 @@ namespace Plugin
void baseStringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
{
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
f->StringProc(fa, ff, str);
}
}
@@ -414,7 +414,7 @@ namespace Plugin
{
FilterActivation* fa = (FilterActivation*)lpVoid;
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f;
}
f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
@@ -425,7 +425,7 @@ namespace Plugin
{
FilterActivation* fa = (FilterActivation*)lpVoid;
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f;
}
f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
@@ -498,11 +498,11 @@ namespace Plugin
extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
{
fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(FilterDefinition));
- if(!fd_vobsub) {
+ if (!fd_vobsub) {
return 1;
}
fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(FilterDefinition));
- if(!fd_textsub) {
+ if (!fd_textsub) {
return 1;
}
@@ -573,7 +573,7 @@ namespace Plugin
CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
_T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle((HWND)hwnd), 0);
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return 1;
}
@@ -618,7 +618,7 @@ namespace Plugin
CFileDialog fd(TRUE, NULL, GetFileName(), OFN_ENABLESIZING|OFN_HIDEREADONLY,
formats, CWnd::FromHandle((HWND)hwnd), sizeof(OPENFILENAME));
#endif
- if(fd.DoModal() != IDOK) {
+ if (fd.DoModal() != IDOK) {
return 1;
}
@@ -626,7 +626,7 @@ namespace Plugin
}
void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str) {
- if(!GetFileName().IsEmpty()) {
+ if (!GetFileName().IsEmpty()) {
sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
} else {
sprintf(str, " (empty)");
@@ -654,7 +654,7 @@ namespace Plugin
void baseDeinitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
{
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f, f = NULL;
}
}
@@ -680,7 +680,7 @@ namespace Plugin
void baseStringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
{
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
f->StringProc(fa, ff, str);
}
}
@@ -695,7 +695,7 @@ namespace Plugin
{
VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f;
}
f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
@@ -706,7 +706,7 @@ namespace Plugin
{
VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) {
+ if (f) {
delete f;
}
f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
@@ -778,7 +778,7 @@ namespace Plugin
extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
{
- if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(VDXFilterDefinition)))
+ if (!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(VDXFilterDefinition)))
|| !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(VDXFilterDefinition)))) {
return 1;
}
@@ -840,7 +840,7 @@ namespace Plugin
CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
: CVobSubFilter(CString(fn))
, CAvisynthFilter(c, env) {
- if(!m_pSubPicProvider) {
+ if (!m_pSubPicProvider) {
env->ThrowError("VobSub: Can't open \"%s\"", fn);
}
}
@@ -857,7 +857,7 @@ namespace Plugin
CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1)
: CTextSubFilter(CString(fn), CharSet, fps)
, CAvisynthFilter(c, env) {
- if(!m_pSubPicProvider)
+ if (!m_pSubPicProvider)
#ifdef _VSMOD
env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
#else
@@ -980,7 +980,7 @@ namespace Plugin
CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
: CVobSubFilter(CString(fn))
, CAvisynthFilter(c, env) {
- if(!m_pSubPicProvider) {
+ if (!m_pSubPicProvider) {
env->ThrowError("VobSub: Can't open \"%s\"", fn);
}
}
@@ -997,7 +997,7 @@ namespace Plugin
CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1, VFRTranslator *vfr = 0) //vfr patch
: CTextSubFilter(CString(fn), CharSet, fps)
, CAvisynthFilter(c, env, vfr) {
- if(!m_pSubPicProvider)
+ if (!m_pSubPicProvider)
#ifdef _VSMOD
env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
#else
@@ -1103,11 +1103,11 @@ namespace Plugin
UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uiMsg) {
+ switch (uiMsg) {
case WM_NOTIFY: {
OPENFILENAME* ofn = ((OFNOTIFY *)lParam)->lpOFN;
- if(((NMHDR *)lParam)->code == CDN_FILEOK) {
+ if (((NMHDR *)lParam)->code == CDN_FILEOK) {
ofn->lCustData = (LPARAM)CharSetList[SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_GETCURSEL, 0, 0)];
}
@@ -1121,11 +1121,11 @@ UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lPar
SetWindowLongPtr(hDlg, GWL_USERDATA, lParam);
#endif
- for(ptrdiff_t i = 0; i < CharSetLen; i++) {
+ for (ptrdiff_t i = 0; i < CharSetLen; i++) {
CString s;
s.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_ADDSTRING, 0, (LONG)(LPCTSTR)s);
- if(CharSetList[i] == (int)((OPENFILENAME*)lParam)->lCustData) {
+ if (CharSetList[i] == (int)((OPENFILENAME*)lParam)->lCustData) {
SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_SETCURSEL, i, 0);
}
}