diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2009-04-18 21:39:19 +0400 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2009-04-18 21:39:19 +0400 |
commit | 530c6354edabdd19d45d883fee88793664170adf (patch) | |
tree | d1fcf2a4b371465f0c20201a52f33db6367688e7 /src | |
parent | f39d30c0b2eba6db09f1d3f66be6fd1eb2d7f5a5 (diff) |
Changed : merge with Beliyaal branch
Added : support for madVR (new Video Renderer)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1048 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
335 files changed, 6830 insertions, 1579 deletions
diff --git a/src/apps/ShuttlePN31/Common/Interface.c b/src/apps/ShuttlePN31/Common/Interface.c index 3b9fd91fb..9dce52c6a 100644 --- a/src/apps/ShuttlePN31/Common/Interface.c +++ b/src/apps/ShuttlePN31/Common/Interface.c @@ -1,4 +1,5 @@ #include <stdio.h> /* for NULL */
+#include <memory.h>
#include "Interface.h"
PN31_KEYCODE g_PN31Keyboard[] = {
diff --git a/src/apps/ShuttlePN31/Common/ShuttlePN31Client.cpp b/src/apps/ShuttlePN31/Common/ShuttlePN31Client.cpp index 8be7f1dd3..5480a09da 100644 --- a/src/apps/ShuttlePN31/Common/ShuttlePN31Client.cpp +++ b/src/apps/ShuttlePN31/Common/ShuttlePN31Client.cpp @@ -45,7 +45,7 @@ CMultiSz::CMultiSz(const CMultiSz& other) BYTE* CMultiSz::Realloc (BYTE* pBuff, DWORD nNewSize)
{
- BYTE* pNewBuff = new BYTE [nNewSize];
+ BYTE* pNewBuff = DNew BYTE [nNewSize];
memset (pNewBuff, 0, nNewSize);
if (pBuff) memcpy (pNewBuff, pBuff, min (m_MultiSzLen, nNewSize));
return pNewBuff;
@@ -412,7 +412,7 @@ CMultiSz CShuttlePN31Client::GetLowerFilters(HDEVINFO hDev, SP_DEVINFO_DATA* pDe if (BufferSize != 0)
{
// we allocate the proper buffer
- Buffer = new BYTE [BufferSize];
+ Buffer = DNew BYTE [BufferSize];
// we get the content of the buffer
diff --git a/src/apps/ShuttlePN31/Common/StdAfx.h b/src/apps/ShuttlePN31/Common/StdAfx.h index f6066e791..8c887cbb8 100644 --- a/src/apps/ShuttlePN31/Common/StdAfx.h +++ b/src/apps/ShuttlePN31/Common/StdAfx.h @@ -9,6 +9,7 @@ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
+#include "../../../DSUtil/SharedInclude.h"
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
diff --git a/src/apps/mplayerc/AllocatorCommon.h b/src/apps/mplayerc/AllocatorCommon.h index f7e6a2336..051bfa9b2 100644 --- a/src/apps/mplayerc/AllocatorCommon.h +++ b/src/apps/mplayerc/AllocatorCommon.h @@ -24,9 +24,9 @@ #pragma once
#define VMRBITMAP_UPDATE 0x80000000
-#define MAX_PICTURE_SLOTS (20+2) // Last 2 for pixels shader!
+#define MAX_PICTURE_SLOTS (60+2) // Last 2 for pixels shader!
-#define NB_JITTER 125
+#define NB_JITTER 126
namespace DSObjects
@@ -35,12 +35,39 @@ namespace DSObjects class CDX9AllocatorPresenter
: public ISubPicAllocatorPresenterImpl
{
+ public:
+ CCritSec m_VMR9AlphaBitmapLock;
+ void UpdateAlphaBitmap();
protected:
CSize m_ScreenSize;
UINT m_RefreshRate;
- bool m_fVMRSyncFix;
+// bool m_fVMRSyncFix;
+ bool m_bAlternativeVSync;
+ bool m_bHighColorResolution;
+ bool m_bCompositionEnabled;
+ bool m_bIsEVR;
+ int m_OrderedPaint;
+ int m_VSyncMode;
+ bool m_bDesktopCompositionDisabled;
+ bool m_bIsFullscreen;
+
+ CMPlayerCApp::Settings::CRendererSettingsEVR m_LastRendererSettings;
+
+ HRESULT (__stdcall * m_pDwmIsCompositionEnabled)(__out BOOL* pfEnabled);
+ HRESULT (__stdcall * m_pDwmEnableComposition)(UINT uCompositionAction);
+
+ HMODULE m_hDWMAPI;
+
+ HRESULT (__stdcall * m_pDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex**);
+ HMODULE m_hD3D9;
+
+ CCritSec m_RenderLock;
+ CComPtr<IDirectDraw> m_pDirectDraw;
+ CComPtr<IDirect3D9Ex> m_pD3DEx;
CComPtr<IDirect3D9> m_pD3D;
+ CComPtr<IDirect3DDevice9Ex> m_pD3DDevEx;
+ CString m_D3DDevExError;
CComPtr<IDirect3DDevice9> m_pD3DDev;
CComPtr<IDirect3DTexture9> m_pVideoTexture[MAX_PICTURE_SLOTS];
CComPtr<IDirect3DSurface9> m_pVideoSurface[MAX_PICTURE_SLOTS];
@@ -48,23 +75,62 @@ namespace DSObjects CComPtr<IDirect3DSurface9> m_pOSDSurface;
CComPtr<ID3DXLine> m_pLine;
CComPtr<ID3DXFont> m_pFont;
- CInterfaceList<IDirect3DPixelShader9> m_pPixelShaders;
+ CComPtr<ID3DXSprite> m_pSprite;
+ class CExternalPixelShader
+ {
+ public:
+ CComPtr<IDirect3DPixelShader9> m_pPixelShader;
+ CStringA m_SourceData;
+ CStringA m_SourceTarget;
+ HRESULT Compile(CPixelShaderCompiler *pCompiler)
+ {
+ HRESULT hr = pCompiler->CompileShader(m_SourceData, "main", m_SourceTarget, 0, &m_pPixelShader);
+ if(FAILED(hr))
+ return hr;
+
+ return S_OK;
+ }
+ };
+ CAtlList<CExternalPixelShader> m_pPixelShaders;
+ CAtlList<CExternalPixelShader> m_pPixelShadersScreenSpace;
CComPtr<IDirect3DPixelShader9> m_pResizerPixelShader[3]; // bl, bc1, bc2
- CComPtr<IDirect3DTexture9> m_pResizerBicubic1stPass;
+ CComPtr<IDirect3DTexture9> m_pScreenSizeTemporaryTexture[2];
+ D3DFORMAT m_SurfaceType;
+ D3DFORMAT m_BackbufferType;
+ D3DFORMAT m_DisplayType;
D3DTEXTUREFILTERTYPE m_filter;
D3DCAPS9 m_caps;
CAutoPtr<CPixelShaderCompiler> m_pPSC;
- virtual HRESULT CreateDevice();
+ bool SettingsNeedResetDevice();
+
+ virtual HRESULT CreateDevice(CString &_Error);
+// virtual HRESULT AllocSurfaces(D3DFORMAT Format = D3DFMT_A2B10G10R10);
virtual HRESULT AllocSurfaces(D3DFORMAT Format = D3DFMT_A8R8G8B8);
virtual void DeleteSurfaces();
+ // Thread stuff
+ HANDLE m_hEvtQuit; // Stop rendering thread event
+ HANDLE m_hVSyncThread;
+ static DWORD WINAPI VSyncThreadStatic(LPVOID lpParam);
+ void VSyncThread();
+ void StartWorkerThreads();
+ void StopWorkerThreads();
+
UINT GetAdapter(IDirect3D9 *pD3D);
float m_bicubicA;
- HRESULT InitResizers(float bicubicA);
+ HRESULT InitResizers(float bicubicA, bool bNeedScreenSizeTexture);
+ bool GetVBlank(int &_ScanLine, int &_bInVBlank, bool _bMeasureTime);
+ bool WaitForVBlankRange(int &_RasterStart, int _RasterEnd, bool _bWaitIfInside, bool _bNeedAccurate, bool _bMeasure);
+ bool WaitForVBlank(bool &_Waited);
+ int GetVBlackPos();
+ void CalculateJitter(LONGLONG PerformanceCounter);
+ virtual void OnVBlankFinished(bool fAll, LONGLONG PerformanceCounter){}
+
+ HRESULT DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_Rect);
HRESULT TextureCopy(CComPtr<IDirect3DTexture9> pTexture);
HRESULT TextureResize(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter);
HRESULT TextureResizeBilinear(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4]);
@@ -101,30 +167,128 @@ namespace DSObjects LPD3DXFONT* ppFont);
+ void DrawText(const RECT &rc, const CString &strText, int _Priority);
void DrawStats();
HRESULT AlphaBlt(RECT* pSrc, RECT* pDst, CComPtr<IDirect3DTexture9> pTexture);
- virtual void OnResetDevice() {};
+ virtual void OnResetDevice() {};
+ virtual bool ResetDevice();
+
+ double GetFrameTime();
+ double GetFrameRate();
+
int m_nTearingPos;
VMR9AlphaBitmap m_VMR9AlphaBitmap;
+ CAutoVectorPtr<BYTE> m_VMR9AlphaBitmapData;
+ CRect m_VMR9AlphaBitmapRect;
+ int m_VMR9AlphaBitmapWidthBytes;
+
D3DXLoadSurfaceFromMemoryPtr m_pD3DXLoadSurfaceFromMemory;
D3DXCreateLinePtr m_pD3DXCreateLine;
D3DXCreateFontPtr m_pD3DXCreateFont;
+ HRESULT (__stdcall *m_pD3DXCreateSprite)(LPDIRECT3DDEVICE9 pDevice, LPD3DXSPRITE * ppSprite);
+
+
int m_nNbDXSurface; // Total number of DX Surfaces
+ int m_nVMR9Surfaces; // Total number of DX Surfaces
+ int m_iVMR9Surface;
int m_nCurSurface; // Surface currently displayed
long m_nUsedBuffer;
+ bool m_bNeedPendingResetDevice;
+ bool m_bPendingResetDevice;
double m_fAvrFps; // Estimate the real FPS
+ double m_fJitterStdDev; // Estimate the Jitter std dev
+ double m_fJitterMean;
+ double m_fSyncOffsetStdDev;
+ double m_fSyncOffsetAvr;
+ double m_DetectedRefreshRate;
+ double GetRefreshRate()
+ {
+ if (m_DetectedRefreshRate)
+ return m_DetectedRefreshRate;
+ else
+ return m_RefreshRate;
+ }
+
+ CCritSec m_RefreshRateLock;
+ double m_DetectedRefreshTime;
+ double m_DetectedRefreshTimePrim;
+ double m_DetectedScanlineTime;
+ double m_DetectedScanlineTimePrim;
+ double m_DetectedScanlinesPerFrame;
+ double m_ldDetectedRefreshRateList[100];
+ double m_ldDetectedScanlineRateList[100];
+ int m_DetectedRefreshRatePos;
+ bool m_bSyncStatsAvailable;
LONGLONG m_pllJitter [NB_JITTER]; // Jitter buffer for stats
+ LONGLONG m_pllSyncOffset [NB_JITTER]; // Jitter buffer for stats
LONGLONG m_llLastPerf;
+ LONGLONG m_JitterStdDev;
+ LONGLONG m_MaxJitter;
+ LONGLONG m_MinJitter;
+ LONGLONG m_MaxSyncOffset;
+ LONGLONG m_MinSyncOffset;
int m_nNextJitter;
+ int m_nNextSyncOffset;
REFERENCE_TIME m_rtTimePerFrame;
+ double m_DetectedFrameRate;
+ double m_DetectedFrameTime;
+ double m_DetectedFrameTimeStdDev;
+ bool m_DetectedLock;
+ LONGLONG m_DetectedFrameTimeHistory[60];
+ double m_DetectedFrameTimeHistoryHisotry[500];
+ int m_DetectedFrameTimePos;
+ int m_bInterlaced;
+
+ double m_TextScale;
+
+ int m_VBlankEndWait;
+ int m_VBlankStartWait;
+ LONGLONG m_VBlankWaitTime;
+ int m_VBlankMin;
+ int m_VBlankMinCalc;
+ int m_VBlankMax;
+ int m_VBlankEndPresent;
+ LONGLONG m_VBlankStartMeasureTime;
+ int m_VBlankStartMeasure;
+
+ LONGLONG m_PresentWaitTime;
+ LONGLONG m_PresentWaitTimeMin;
+ LONGLONG m_PresentWaitTimeMax;
+
+ LONGLONG m_PaintTime;
+ LONGLONG m_PaintTimeMin;
+ LONGLONG m_PaintTimeMax;
+
+ LONGLONG m_WaitForGPUTime;
+
+ LONGLONG m_RasterStatusWaitTime;
+ LONGLONG m_RasterStatusWaitTimeMin;
+ LONGLONG m_RasterStatusWaitTimeMax;
+ LONGLONG m_RasterStatusWaitTimeMaxCalc;
+
+ double m_ClockDiffCalc;
+ double m_ClockDiffPrim;
+ double m_ClockDiff;
+
+ double m_TimeChangeHisotry[100];
+ double m_ClockChangeHisotry[100];
+ int m_ClockTimeChangeHistoryPos;
+ double m_ModeratedTimeSpeed;
+ double m_ModeratedTimeSpeedPrim;
+ double m_ModeratedTimeSpeedDiff;
+
+ bool m_bCorrectedFrameTime;
+ int m_FrameTimeCorrection;
+ LONGLONG m_LastFrameDuration;
+ LONGLONG m_LastSampleTime;
CString m_strStatsMsg[10];
public:
- CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr, bool bIsEVR, CString &_Error);
~CDX9AllocatorPresenter();
// ISubPicAllocatorPresenter
@@ -132,6 +296,7 @@ namespace DSObjects STDMETHODIMP_(bool) Paint(bool fAll);
STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size);
STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget);
+ STDMETHODIMP SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace);
};
class CVMR9AllocatorPresenter
@@ -144,14 +309,14 @@ namespace DSObjects CComPtr<IVMRSurfaceAllocatorNotify9> m_pIVMRSurfAllocNotify;
CInterfaceArray<IDirect3DSurface9> m_pSurfaces;
- HRESULT CreateDevice();
+ HRESULT CreateDevice(CString &_Error);
void DeleteSurfaces();
bool m_fUseInternalTimer;
REFERENCE_TIME m_rtPrevStart;
public:
- CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
@@ -202,7 +367,7 @@ namespace DSObjects void DeleteSurfaces();
public:
- CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
@@ -227,7 +392,7 @@ namespace DSObjects void DeleteSurfaces();
public:
- CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
@@ -293,7 +458,7 @@ namespace DSObjects CSize m_ScreenSize;
public:
- CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
virtual ~CDXRAllocatorPresenter();
DECLARE_IUNKNOWN
diff --git a/src/apps/mplayerc/ChildView.cpp b/src/apps/mplayerc/ChildView.cpp index 334da524c..d392f397e 100644 --- a/src/apps/mplayerc/ChildView.cpp +++ b/src/apps/mplayerc/ChildView.cpp @@ -27,12 +27,6 @@ #include "MainFrm.h"
#include "libpng.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////////
// CChildView
diff --git a/src/apps/mplayerc/ComPropertySheet.cpp b/src/apps/mplayerc/ComPropertySheet.cpp index 05a9d0059..dbe729cba 100644 --- a/src/apps/mplayerc/ComPropertySheet.cpp +++ b/src/apps/mplayerc/ComPropertySheet.cpp @@ -71,14 +71,14 @@ IMPLEMENT_DYNAMIC(CComPropertySheet, CPropertySheet) CComPropertySheet::CComPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
: CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
- m_pSite = new CComPropertyPageSite(this);
+ m_pSite = DNew CComPropertyPageSite(this);
m_size.SetSize(0, 0);
}
CComPropertySheet::CComPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
: CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
- m_pSite = new CComPropertyPageSite(this);
+ m_pSite = DNew CComPropertyPageSite(this);
m_size.SetSize(0, 0);
}
@@ -150,7 +150,7 @@ bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk) hr = pPage->GetPageInfo(&ppi);
m_size.cx = max(m_size.cx, ppi.size.cx);
m_size.cy = max(m_size.cy, ppi.size.cy);
- CAutoPtr<CComPropertyPage> p(new CComPropertyPage(pPage));
+ CAutoPtr<CComPropertyPage> p(DNew CComPropertyPage(pPage));
__super::AddPage(p);
m_pages.AddTail(p);
diff --git a/src/apps/mplayerc/ConvertDlg.cpp b/src/apps/mplayerc/ConvertDlg.cpp index af6420a6d..c26693f20 100644 --- a/src/apps/mplayerc/ConvertDlg.cpp +++ b/src/apps/mplayerc/ConvertDlg.cpp @@ -94,7 +94,7 @@ void CConvertDlg::AddFile(CString fn) UpdateData(FALSE);
}
- CTreeItemFile* t = new CTreeItemFile(fn, pBF, m_tree, NULL);
+ CTreeItemFile* t = DNew CTreeItemFile(fn, pBF, m_tree, NULL);
AddFilter(*t, pBF);
@@ -195,11 +195,11 @@ void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) if(pBF == m_pMux)
{
- t = new CTreeItemPin(pPin, m_tree, hTIParent);
+ t = DNew CTreeItemPin(pPin, m_tree, hTIParent);
}
else
{
- t = new CTreeItemFilter(pBF, m_tree, hTIParent);
+ t = DNew CTreeItemFilter(pBF, m_tree, hTIParent);
AddFilter(*t, pBF);
}
}
@@ -233,7 +233,7 @@ void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) }
}
- CTreeItem* t2 = new CTreeItemResourceFolder(m_tree, hTIParent);
+ CTreeItem* t2 = DNew CTreeItemResourceFolder(m_tree, hTIParent);
if(CComQIPtr<IDSMResourceBag> pRB = pBFParent)
{
for(DWORD i = 0, cnt = pRB->ResGetCount(); i < cnt; i++)
@@ -246,7 +246,7 @@ void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) if(len > 0)
{
- m_pTIs.AddTail(new CTreeItemResource(CDSMResource(name, desc, mime, pData, len), m_tree, *t2));
+ m_pTIs.AddTail(DNew CTreeItemResource(CDSMResource(name, desc, mime, pData, len), m_tree, *t2));
}
CoTaskMemFree(pData);
@@ -254,7 +254,7 @@ void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) }
m_tree.Expand(*t2, TVE_EXPAND);
- CTreeItem* t3 = new CTreeItemChapterFolder(m_tree, hTIParent);
+ CTreeItem* t3 = DNew CTreeItemChapterFolder(m_tree, hTIParent);
if(CComQIPtr<IDSMChapterBag> pCB = pBFParent)
{
for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++)
@@ -264,7 +264,7 @@ void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent) if(FAILED(pCB->ChapGet(i, &rt, &name)))
continue;
- m_pTIs.AddTail(new CTreeItemChapter(CDSMChapter(rt, name), m_tree, *t3));
+ m_pTIs.AddTail(DNew CTreeItemChapter(CDSMChapter(rt, name), m_tree, *t3));
}
}
m_tree.Expand(*t3, TVE_EXPAND);
@@ -537,7 +537,7 @@ void CConvertDlg::ShowResourceFolderPopup(HTREEITEM hTI, CPoint p) && ERROR_SUCCESS == key.QueryStringValue(_T("Content Type"), mime, &len))
res.mime = mime;
- CTreeItemResource* t = new CTreeItemResource(res, m_tree, hTI);
+ CTreeItemResource* t = DNew CTreeItemResource(res, m_tree, hTI);
m_pTIs.AddTail(t);
if(EditResource(t))
@@ -698,7 +698,7 @@ void CConvertDlg::ShowChapterFolderPopup(HTREEITEM hTI, CPoint p) case 1:
{
CDSMChapter chap;
- CTreeItemChapter* t = new CTreeItemChapter(CDSMChapter(0, L""), m_tree, hTI);
+ CTreeItemChapter* t = DNew CTreeItemChapter(CDSMChapter(0, L""), m_tree, hTI);
m_pTIs.AddTail(t);
if(!EditChapter(t))
DeleteItem(*t);
@@ -803,9 +803,9 @@ BOOL CConvertDlg::OnInitDialog() m_nIDEventStatus = SetTimer(1, 1000, NULL);
HRESULT hr;
- m_pMux = new CDSMMuxerFilter(NULL, &hr, false, false);
+ m_pMux = DNew CDSMMuxerFilter(NULL, &hr, false, false);
- m_pGB = new CFGManagerMuxer(_T("CFGManagerMuxer"), NULL);
+ m_pGB = DNew CFGManagerMuxer(_T("CFGManagerMuxer"), NULL);
m_pGB->AddToROT();
if(FAILED(m_pGB->AddFilter(m_pMux, L"Mux"))
diff --git a/src/apps/mplayerc/DX7AllocatorPresenter.cpp b/src/apps/mplayerc/DX7AllocatorPresenter.cpp index 9524b44d7..050910564 100644 --- a/src/apps/mplayerc/DX7AllocatorPresenter.cpp +++ b/src/apps/mplayerc/DX7AllocatorPresenter.cpp @@ -193,9 +193,9 @@ HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA *ppAP = NULL;
HRESULT hr;
- if(clsid == CLSID_VMR7AllocatorPresenter && !(*ppAP = new CVMR7AllocatorPresenter(hWnd, hr))
- || clsid == CLSID_RM7AllocatorPresenter && !(*ppAP = new CRM7AllocatorPresenter(hWnd, hr))
- || clsid == CLSID_QT7AllocatorPresenter && !(*ppAP = new CQT7AllocatorPresenter(hWnd, hr)))
+ if(clsid == CLSID_VMR7AllocatorPresenter && !(*ppAP = DNew CVMR7AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_RM7AllocatorPresenter && !(*ppAP = DNew CRM7AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_QT7AllocatorPresenter && !(*ppAP = DNew CQT7AllocatorPresenter(hWnd, hr)))
return E_OUTOFMEMORY;
if(*ppAP == NULL)
@@ -289,7 +289,7 @@ static HRESULT TextureBlt(CComPtr<IDirect3DDevice7> pD3DDev, CComPtr<IDirectDraw //
CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr)
- : ISubPicAllocatorPresenterImpl(hWnd, hr)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr, NULL)
, m_ScreenSize(0, 0)
{
if(FAILED(hr)) return;
@@ -373,6 +373,10 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() case 3: size.SetSize(640, 480); break;
case 4: size.SetSize(512, 384); break;
case 5: size.SetSize(384, 288); break;
+ case 6: size.SetSize(2560, 1600); break;
+ case 7: size.SetSize(1920, 1080); break;
+ case 8: size.SetSize(1320, 900); break;
+ case 9: size.SetSize(1280, 720); break;
}
if(m_pAllocator)
@@ -381,15 +385,15 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() }
else
{
- m_pAllocator = new CDX7SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX7SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
if(!m_pAllocator || FAILED(hr))
return E_FAIL;
}
hr = S_OK;
m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
- ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
- : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ ? (ISubPicQueue*)DNew CSubPicQueue(AfxGetAppSettings().nSPCSize, AfxGetAppSettings().fSPCDisableAnim, m_pAllocator, &hr)
+ : (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
if(!m_pSubPicQueue || FAILED(hr))
return E_FAIL;
diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.cpp b/src/apps/mplayerc/DX9AllocatorPresenter.cpp index 2eb20a495..f9d21acad 100644 --- a/src/apps/mplayerc/DX9AllocatorPresenter.cpp +++ b/src/apps/mplayerc/DX9AllocatorPresenter.cpp @@ -55,6 +55,20 @@ CCritSec g_ffdshowReceive;
bool queueu_ffdshow_support = false;
+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))
+ {
+ errmsg = (LPCTSTR)lpMsgBuf;
+ LocalFree(lpMsgBuf);
+ }
+ CString Temp;
+ Temp.Format(L"0x%08x ", _Error);
+ return Temp + errmsg;
+}
bool IsVMR9InGraph(IFilterGraph* pFG)
{
@@ -75,10 +89,11 @@ HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA *ppAP = NULL;
HRESULT hr = E_FAIL;
- if(clsid == CLSID_VMR9AllocatorPresenter && !(*ppAP = new CVMR9AllocatorPresenter(hWnd, hr))
- || clsid == CLSID_RM9AllocatorPresenter && !(*ppAP = new CRM9AllocatorPresenter(hWnd, hr))
- || clsid == CLSID_QT9AllocatorPresenter && !(*ppAP = new CQT9AllocatorPresenter(hWnd, hr))
- || clsid == CLSID_DXRAllocatorPresenter && !(*ppAP = new CDXRAllocatorPresenter(hWnd, hr)))
+ CString Error;
+ if(clsid == CLSID_VMR9AllocatorPresenter && !(*ppAP = DNew CVMR9AllocatorPresenter(hWnd, hr, Error))
+ || clsid == CLSID_RM9AllocatorPresenter && !(*ppAP = DNew CRM9AllocatorPresenter(hWnd, hr, Error))
+ || clsid == CLSID_QT9AllocatorPresenter && !(*ppAP = DNew CQT9AllocatorPresenter(hWnd, hr, Error))
+ || clsid == CLSID_DXRAllocatorPresenter && !(*ppAP = DNew CDXRAllocatorPresenter(hWnd, hr, Error)))
return E_OUTOFMEMORY;
if(*ppAP == NULL)
@@ -88,18 +103,103 @@ HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA if(FAILED(hr))
{
+ Error += L"\n";
+ Error += GetWindowsErrorMessage(hr, NULL);
+
+ MessageBox(hWnd, Error, L"Error creating DX9 allocation presenter", MB_OK|MB_ICONERROR);
(*ppAP)->Release();
*ppAP = NULL;
}
+ else if (!Error.IsEmpty())
+ {
+ MessageBox(hWnd, Error, L"Warning creating DX9 allocation presenter", MB_OK|MB_ICONWARNING);
+ }
return hr;
}
+const wchar_t *GetD3DFormatStr(D3DFORMAT Format)
+{
+ switch (Format)
+ {
+ case D3DFMT_R8G8B8 : return L"R8G8B8";
+ case D3DFMT_A8R8G8B8 : return L"A8R8G8B8";
+ case D3DFMT_X8R8G8B8 : return L"X8R8G8B8";
+ case D3DFMT_R5G6B5 : return L"R5G6B5";
+ case D3DFMT_X1R5G5B5 : return L"X1R5G5B5";
+ case D3DFMT_A1R5G5B5 : return L"A1R5G5B5";
+ case D3DFMT_A4R4G4B4 : return L"A4R4G4B4";
+ case D3DFMT_R3G3B2 : return L"R3G3B2";
+ case D3DFMT_A8 : return L"A8";
+ case D3DFMT_A8R3G3B2 : return L"A8R3G3B2";
+ case D3DFMT_X4R4G4B4 : return L"X4R4G4B4";
+ case D3DFMT_A2B10G10R10: return L"A2B10G10R10";
+ case D3DFMT_A8B8G8R8 : return L"A8B8G8R8";
+ case D3DFMT_X8B8G8R8 : return L"X8B8G8R8";
+ case D3DFMT_G16R16 : return L"G16R16";
+ case D3DFMT_A2R10G10B10: return L"A2R10G10B10";
+ case D3DFMT_A16B16G16R16 : return L"A16B16G16R16";
+ case D3DFMT_A8P8 : return L"A8P8";
+ case D3DFMT_P8 : return L"P8";
+ case D3DFMT_L8 : return L"L8";
+ case D3DFMT_A8L8 : return L"A8L8";
+ case D3DFMT_A4L4 : return L"A4L4";
+ case D3DFMT_V8U8 : return L"V8U8";
+ case D3DFMT_L6V5U5 : return L"L6V5U5";
+ case D3DFMT_X8L8V8U8 : return L"X8L8V8U8";
+ case D3DFMT_Q8W8V8U8 : return L"Q8W8V8U8";
+ case D3DFMT_V16U16 : return L"V16U16";
+ case D3DFMT_A2W10V10U10: return L"A2W10V10U10";
+ case D3DFMT_UYVY : return L"UYVY";
+ case D3DFMT_R8G8_B8G8: return L"R8G8_B8G8";
+ case D3DFMT_YUY2 : return L"YUY2";
+ case D3DFMT_G8R8_G8B8: return L"G8R8_G8B8";
+ case D3DFMT_DXT1 : return L"DXT1";
+ case D3DFMT_DXT2 : return L"DXT2";
+ case D3DFMT_DXT3 : return L"DXT3";
+ case D3DFMT_DXT4 : return L"DXT4";
+ case D3DFMT_DXT5 : return L"DXT5";
+ case D3DFMT_D16_LOCKABLE : return L"D16_LOCKABLE";
+ case D3DFMT_D32: return L"D32";
+ case D3DFMT_D15S1: return L"D15S1";
+ case D3DFMT_D24S8: return L"D24S8";
+ case D3DFMT_D24X8: return L"D24X8";
+ case D3DFMT_D24X4S4: return L"D24X4S4";
+ case D3DFMT_D16: return L"D16";
+ case D3DFMT_D32F_LOCKABLE: return L"D32F_LOCKABLE";
+ case D3DFMT_D24FS8 : return L"D24FS8";
+ case D3DFMT_D32_LOCKABLE : return L"D32_LOCKABLE";
+ case D3DFMT_S8_LOCKABLE: return L"S8_LOCKABLE";
+ case D3DFMT_L16: return L"L16";
+ case D3DFMT_VERTEXDATA : return L"VERTEXDATA";
+ case D3DFMT_INDEX16: return L"INDEX16";
+ case D3DFMT_INDEX32: return L"INDEX32";
+ case D3DFMT_Q16W16V16U16 : return L"Q16W16V16U16";
+ case D3DFMT_MULTI2_ARGB8 : return L"MULTI2_ARGB8";
+ case D3DFMT_R16F : return L"R16F";
+ case D3DFMT_G16R16F: return L"G16R16F";
+ case D3DFMT_A16B16G16R16F: return L"A16B16G16R16F";
+ case D3DFMT_R32F : return L"R32F";
+ case D3DFMT_G32R32F: return L"G32R32F";
+ case D3DFMT_A32B32G32R32F: return L"A32B32G32R32F";
+ case D3DFMT_CxV8U8 : return L"CxV8U8";
+ case D3DFMT_A1 : return L"A1";
+ case D3DFMT_BINARYBUFFER : return L"BINARYBUFFER";
+ }
+ return L"Unknown";
+}
+
//
#pragma pack(push, 1)
template<int texcoords>
struct MYD3DVERTEX {float x, y, z, rhw; struct {float u, v;} t[texcoords];};
+template<>
+struct MYD3DVERTEX<0>
+{
+ float x, y, z, rhw;
+ DWORD Diffuse;
+};
#pragma pack(pop)
template<int texcoords>
@@ -172,17 +272,12 @@ static HRESULT TextureBlt(CComPtr<IDirect3DDevice9> pD3DDev, MYD3DVERTEX<texcoor //
- if(FAILED(hr = pD3DDev->BeginScene()))
- break;
-
hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
// hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
MYD3DVERTEX<texcoords> tmp = v[2]; v[2] = v[3]; v[3] = tmp;
hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- hr = pD3DDev->EndScene();
-
//
for(int i = 0; i < texcoords; i++)
@@ -197,65 +292,522 @@ static HRESULT TextureBlt(CComPtr<IDirect3DDevice9> pD3DDev, MYD3DVERTEX<texcoor return E_FAIL;
}
+static HRESULT DrawRect(CComPtr<IDirect3DDevice9> pD3DDev, MYD3DVERTEX<0> v[4])
+{
+ if(!pD3DDev)
+ return E_POINTER;
+
+ do
+ {
+ HRESULT hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+ hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
+ hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
+ //D3DRS_COLORVERTEX
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+
+
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX0 | D3DFVF_DIFFUSE);
+ // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
+
+ MYD3DVERTEX<0> tmp = v[2]; v[2] = v[3]; v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
// CDX9AllocatorPresenter
-CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr)
- : ISubPicAllocatorPresenterImpl(hWnd, hr)
+CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr, bool bIsEVR, CString &_Error)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
, m_RefreshRate(0)
, m_bicubicA(0)
, m_nTearingPos(0)
, m_nNbDXSurface(1)
+ , m_nVMR9Surfaces(0)
+ , m_iVMR9Surface(0)
, m_nCurSurface(0)
, m_rtTimePerFrame(0)
+ , m_bInterlaced(0)
, m_nUsedBuffer(0)
+ , m_bNeedPendingResetDevice(0)
+ , m_bPendingResetDevice(0)
+ , m_OrderedPaint(0)
+ , m_bCorrectedFrameTime(0)
+ , m_FrameTimeCorrection(0)
+ , m_LastSampleTime(0)
+ , m_LastFrameDuration(0)
+ , m_bAlternativeVSync(0)
+ , m_bIsEVR(bIsEVR)
+ , m_VSyncMode(0)
+ , m_TextScale(1.0)
+
{
+
+ m_pDirectDraw = NULL;
+ m_hVSyncThread = INVALID_HANDLE_VALUE;
+ m_hEvtQuit = INVALID_HANDLE_VALUE;
+
+ m_bIsFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
+
HINSTANCE hDll;
- if(FAILED(hr)) return;
- m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
- if(!m_pD3D) m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
- if(!m_pD3D) {hr = E_FAIL; return;}
+ if(FAILED(hr))
+ {
+ _Error += L"ISubPicAllocatorPresenterImpl failed\n";
+ return;
+ }
m_pD3DXLoadSurfaceFromMemory = NULL;
m_pD3DXCreateLine = NULL;
m_pD3DXCreateFont = NULL;
+ m_pD3DXCreateSprite = NULL;
hDll = AfxGetMyApp()->GetD3X9Dll();
if(hDll)
{
- m_pD3DXLoadSurfaceFromMemory = (D3DXLoadSurfaceFromMemoryPtr)GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
- m_pD3DXCreateLine = (D3DXCreateLinePtr) GetProcAddress(hDll, "D3DXCreateLine");
- m_pD3DXCreateFont = (D3DXCreateFontPtr) GetProcAddress(hDll, "D3DXCreateFontW");
+ (FARPROC&)m_pD3DXLoadSurfaceFromMemory = GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
+ (FARPROC&)m_pD3DXCreateLine = GetProcAddress(hDll, "D3DXCreateLine");
+ (FARPROC&)m_pD3DXCreateFont = GetProcAddress(hDll, "D3DXCreateFontW");
+ (FARPROC&)m_pD3DXCreateSprite = GetProcAddress(hDll, "D3DXCreateSprite");
+ }
+ else
+ {
+ _Error += L"No D3DX9 dll found. To enable stats, shaders and complex resizers, please make sure to install the latest DirectX SDK Redistributable.\n";
+ }
+
+ m_pDwmIsCompositionEnabled = NULL;
+ m_pDwmEnableComposition = NULL;
+ m_hDWMAPI = LoadLibrary(L"dwmapi.dll");
+ if (m_hDWMAPI)
+ {
+ (FARPROC &)m_pDwmIsCompositionEnabled = GetProcAddress(m_hDWMAPI, "DwmIsCompositionEnabled");
+ (FARPROC &)m_pDwmEnableComposition = GetProcAddress(m_hDWMAPI, "DwmEnableComposition");
+ }
+
+ m_hD3D9 = LoadLibrary(L"d3d9.dll");
+ if (m_hD3D9)
+ {
+ (FARPROC &)m_pDirect3DCreate9Ex = GetProcAddress(m_hD3D9, "Direct3DCreate9Ex");
}
+ else
+ m_pDirect3DCreate9Ex = NULL;
+ if (m_pDirect3DCreate9Ex)
+ {
+ m_pDirect3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
+ if(!m_pD3DEx)
+ {
+ m_pDirect3DCreate9Ex(D3D9b_SDK_VERSION, &m_pD3DEx);
+ }
+ }
+ if(!m_pD3DEx)
+ {
+ m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
+ if(!m_pD3D)
+ {
+ m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
+ }
+ if(!m_pD3D) {hr = E_FAIL; return;}
+ }
+ else
+ m_pD3D = m_pD3DEx;
+
+
+ m_DetectedFrameRate = 0.0;
+ m_DetectedFrameTime = 0.0;
+ m_DetectedFrameTimeStdDev = 0.0;
+ m_DetectedLock = false;
+ ZeroMemory(m_DetectedFrameTimeHistory, sizeof(m_DetectedFrameTimeHistory));
+ ZeroMemory(m_DetectedFrameTimeHistoryHisotry, sizeof(m_DetectedFrameTimeHistoryHisotry));
+ m_DetectedFrameTimePos = 0;
ZeroMemory(&m_VMR9AlphaBitmap, sizeof(m_VMR9AlphaBitmap));
- hr = CreateDevice();
+
+ ZeroMemory(m_ldDetectedRefreshRateList, sizeof(m_ldDetectedRefreshRateList));
+ ZeroMemory(m_ldDetectedScanlineRateList, sizeof(m_ldDetectedScanlineRateList));
+ m_DetectedRefreshRatePos = 0;
+ m_DetectedRefreshTimePrim = 0;
+ m_DetectedScanlineTime = 0;
+ m_DetectedScanlineTimePrim = 0;
+ m_DetectedRefreshRate = 0;
+ AppSettings& s = AfxGetAppSettings();
+
+ if (s.m_RenderSettings.iVMRDisableDesktopComposition)
+ {
+ m_bDesktopCompositionDisabled = true;
+ if (m_pDwmEnableComposition)
+ m_pDwmEnableComposition(0);
+ }
+ else
+ {
+ m_bDesktopCompositionDisabled = false;
+ }
+
+ hr = CreateDevice(_Error);
memset (m_pllJitter, 0, sizeof(m_pllJitter));
+ memset (m_pllSyncOffset, 0, sizeof(m_pllSyncOffset));
m_nNextJitter = 0;
+ m_nNextSyncOffset = 0;
m_llLastPerf = 0;
m_fAvrFps = 0.0;
+ m_fJitterStdDev = 0.0;
+ m_fSyncOffsetStdDev = 0.0;
+ m_fSyncOffsetAvr = 0.0;
+ m_bSyncStatsAvailable = false;
}
CDX9AllocatorPresenter::~CDX9AllocatorPresenter()
{
+ if (m_bDesktopCompositionDisabled)
+ {
+ m_bDesktopCompositionDisabled = false;
+ if (m_pDwmEnableComposition)
+ m_pDwmEnableComposition(1);
+ }
+
+ StopWorkerThreads();
m_pFont = NULL;
m_pLine = NULL;
m_pD3DDev = NULL;
+ m_pD3DDevEx = NULL;
m_pPSC.Free();
m_pD3D.Detach();
+ m_pD3DEx.Detach();
+ if (m_hDWMAPI)
+ {
+ FreeLibrary(m_hDWMAPI);
+ m_hDWMAPI = NULL;
+ }
+ if (m_hD3D9)
+ {
+ FreeLibrary(m_hD3D9);
+ m_hD3D9 = NULL;
+ }
}
-HRESULT CDX9AllocatorPresenter::CreateDevice()
+void ModerateFloat(double& Value, double Target, double& ValuePrim, double ChangeSpeed);
+
+
+void CDX9AllocatorPresenter::VSyncThread()
{
+ HANDLE hAvrt;
+ HANDLE hEvts[] = { m_hEvtQuit};
+ bool bQuit = false;
+ TIMECAPS tc;
+ DWORD dwResolution;
+ DWORD dwUser = 0;
+ DWORD dwTaskIndex = 0;
+
+ // Tell Vista Multimedia Class Scheduler we are a playback thretad (increase priority)
+// if (pfAvSetMmThreadCharacteristicsW)
+// hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
+// if (pfAvSetMmThreadPriority)
+// pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH /*AVRT_PRIORITY_CRITICAL*/);
+ Sleep(2000);
+
+ timeGetDevCaps(&tc, sizeof(TIMECAPS));
+ dwResolution = min(max(tc.wPeriodMin, 0), tc.wPeriodMax);
+ dwUser = timeBeginPeriod(dwResolution);
+ CMPlayerCApp *pApp = (CMPlayerCApp*)AfxGetApp();
+ AppSettings& s = AfxGetAppSettings();
+
+ while (!bQuit)
+ {
+
+ DWORD dwObject = WaitForMultipleObjects (countof(hEvts), hEvts, FALSE, 1);
+ switch (dwObject)
+ {
+ case WAIT_OBJECT_0 :
+ bQuit = true;
+ break;
+ case WAIT_TIMEOUT :
+ {
+ // Do our stuff
+ if (m_pD3DDev && s.m_RenderSettings.iVMR9VSync)
+ {
+
+ int VSyncPos = GetVBlackPos();
+ int WaitRange = max(m_ScreenSize.cy / 40, 5);
+ int MinRange = max(min(int(0.003 * double(m_ScreenSize.cy) * double(m_RefreshRate) + 0.5), m_ScreenSize.cy/3), 5); // 1.8 ms or max 33 % of Time
+
+ VSyncPos += MinRange + WaitRange;
+
+ VSyncPos = VSyncPos % m_ScreenSize.cy;
+ if (VSyncPos < 0)
+ VSyncPos += m_ScreenSize.cy;
+
+ int ScanLine = 0;
+ int bInVBlank = 0;
+ int StartScanLine = ScanLine;
+ int LastPos = ScanLine;
+ ScanLine = (VSyncPos + 1) % m_ScreenSize.cy;
+ if (ScanLine < 0)
+ ScanLine += m_ScreenSize.cy;
+ int FirstScanLine = ScanLine;
+ int ScanLineMiddle = ScanLine + m_ScreenSize.cy/2;
+ ScanLineMiddle = ScanLineMiddle % m_ScreenSize.cy;
+ if (ScanLineMiddle < 0)
+ ScanLineMiddle += m_ScreenSize.cy;
+
+ int ScanlineStart = ScanLine;
+ WaitForVBlankRange(ScanlineStart, 5, true, true, false);
+ LONGLONG TimeStart = pApp->GetPerfCounter();
+
+ WaitForVBlankRange(ScanLineMiddle, 5, true, true, false);
+ LONGLONG TimeMiddle = pApp->GetPerfCounter();
+
+ int ScanlineEnd = ScanLine;
+ WaitForVBlankRange(ScanlineEnd, 5, true, true, false);
+ LONGLONG TimeEnd = pApp->GetPerfCounter();
+
+ double nSeconds = double(TimeEnd - TimeStart) / 10000000.0;
+ LONGLONG DiffMiddle = TimeMiddle - TimeStart;
+ LONGLONG DiffEnd = TimeEnd - TimeMiddle;
+ double DiffDiff;
+ if (DiffEnd > DiffMiddle)
+ DiffDiff = double(DiffEnd) / double(DiffMiddle);
+ else
+ DiffDiff = double(DiffMiddle) / double(DiffEnd);
+ if (nSeconds > 0.003 && DiffDiff < 1.3)
+ {
+ double ScanLineSeconds;
+ double nScanLines;
+ if (ScanLineMiddle > ScanlineEnd)
+ {
+ ScanLineSeconds = double(TimeMiddle - TimeStart) / 10000000.0;
+ nScanLines = ScanLineMiddle - ScanlineStart;
+ }
+ else
+ {
+ ScanLineSeconds = double(TimeEnd - TimeMiddle) / 10000000.0;
+ nScanLines = ScanlineEnd - ScanLineMiddle;
+ }
+
+ double ScanLineTime = ScanLineSeconds / nScanLines;
+
+ int iPos = m_DetectedRefreshRatePos % 100;
+ m_ldDetectedScanlineRateList[iPos] = ScanLineTime;
+ if (m_DetectedScanlineTime && ScanlineStart != ScanlineEnd)
+ {
+ int Diff = ScanlineEnd - ScanlineStart;
+ nSeconds -= double(Diff) * m_DetectedScanlineTime;
+ }
+ m_ldDetectedRefreshRateList[iPos] = nSeconds;
+ double Average = 0;
+ double AverageScanline = 0;
+ int nPos = min(iPos + 1, 100);
+ for (int i = 0; i < nPos; ++i)
+ {
+ Average += m_ldDetectedRefreshRateList[i];
+ AverageScanline += m_ldDetectedScanlineRateList[i];
+ }
+
+ Average /= double(nPos);
+ AverageScanline /= double(nPos);
+
+ double ThisValue = Average;
+
+ {
+ CAutoLock Lock(&m_RefreshRateLock);
+ ++m_DetectedRefreshRatePos;
+ if (m_DetectedRefreshTime == 0 || m_DetectedRefreshTime / ThisValue > 1.01 || m_DetectedRefreshTime / ThisValue < 0.99)
+ {
+ m_DetectedRefreshTime = ThisValue;
+ m_DetectedRefreshTimePrim = 0;
+ }
+ ModerateFloat(m_DetectedRefreshTime, ThisValue, m_DetectedRefreshTimePrim, 1.5);
+ m_DetectedRefreshRate = 1.0/m_DetectedRefreshTime;
+
+ if (m_DetectedScanlineTime == 0 || m_DetectedScanlineTime / AverageScanline > 1.01 || m_DetectedScanlineTime / AverageScanline < 0.99)
+ {
+ m_DetectedScanlineTime = AverageScanline;
+ m_DetectedScanlineTimePrim = 0;
+ }
+ ModerateFloat(m_DetectedScanlineTime, AverageScanline, m_DetectedScanlineTimePrim, 1.5);
+ m_DetectedScanlinesPerFrame = m_DetectedRefreshTime / m_DetectedScanlineTime;
+ }
+ //TRACE("Refresh: %f\n", RefreshRate);
+ }
+ }
+ else
+ {
+ m_DetectedRefreshRate = 0.0;
+ m_DetectedScanlinesPerFrame = 0.0;
+ }
+ }
+ break;
+ }
+ }
+
+ timeEndPeriod (dwResolution);
+// if (pfAvRevertMmThreadCharacteristics) pfAvRevertMmThreadCharacteristics (hAvrt);
+}
+
+
+DWORD WINAPI CDX9AllocatorPresenter::VSyncThreadStatic(LPVOID lpParam)
+{
+ CDX9AllocatorPresenter* pThis = (CDX9AllocatorPresenter*) lpParam;
+ pThis->VSyncThread();
+ return 0;
+}
+
+void CDX9AllocatorPresenter::StartWorkerThreads()
+{
+ DWORD dwThreadId;
+
+ m_hEvtQuit = CreateEvent (NULL, TRUE, FALSE, NULL);
+ if (m_bIsEVR)
+ {
+ m_hVSyncThread = ::CreateThread(NULL, 0, VSyncThreadStatic, (LPVOID)this, 0, &dwThreadId);
+ SetThreadPriority(m_hVSyncThread, THREAD_PRIORITY_HIGHEST);
+ }
+}
+
+void CDX9AllocatorPresenter::StopWorkerThreads()
+{
+ SetEvent (m_hEvtQuit);
+ if ((m_hVSyncThread != INVALID_HANDLE_VALUE) && (WaitForSingleObject (m_hVSyncThread, 10000) == WAIT_TIMEOUT))
+ {
+ ASSERT (FALSE);
+ TerminateThread (m_hVSyncThread, 0xDEAD);
+ }
+
+ if (m_hVSyncThread != INVALID_HANDLE_VALUE) CloseHandle (m_hVSyncThread);
+ if (m_hEvtQuit != INVALID_HANDLE_VALUE) CloseHandle (m_hEvtQuit);
+ m_hVSyncThread = INVALID_HANDLE_VALUE;
+ m_hEvtQuit = INVALID_HANDLE_VALUE;
+
+}
+
+bool CDX9AllocatorPresenter::SettingsNeedResetDevice()
+{
+ AppSettings& s = AfxGetAppSettings();
+ CMPlayerCApp::Settings::CRendererSettingsEVR & New = AfxGetAppSettings().m_RenderSettings;
+ CMPlayerCApp::Settings::CRendererSettingsEVR & Current = m_LastRendererSettings;
+
+ bool bRet = false;
+
+ bRet = bRet || New.fVMR9AlterativeVSync != Current.fVMR9AlterativeVSync;
+ bRet = bRet || New.iVMR9VSyncAccurate != Current.iVMR9VSyncAccurate;
+
+ if (m_bIsFullscreen)
+ {
+ bRet = bRet || New.iVMR9FullscreenGUISupport != Current.iVMR9FullscreenGUISupport;
+ }
+ else
+ {
+ if (Current.iVMRDisableDesktopComposition)
+ {
+ if (!m_bDesktopCompositionDisabled)
+ {
+ m_bDesktopCompositionDisabled = true;
+ if (m_pDwmEnableComposition)
+ m_pDwmEnableComposition(0);
+ }
+ }
+ else
+ {
+ if (m_bDesktopCompositionDisabled)
+ {
+ m_bDesktopCompositionDisabled = false;
+ if (m_pDwmEnableComposition)
+ m_pDwmEnableComposition(1);
+ }
+ }
+ }
+
+ if (m_bIsEVR)
+ {
+ bRet = bRet || New.iEVRHighColorResolution != Current.iEVRHighColorResolution;
+ }
+
+ m_LastRendererSettings = s.m_RenderSettings;
+
+ return bRet;
+}
+
+HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error)
+{
+ StopWorkerThreads();
+ AppSettings& s = AfxGetAppSettings();
+ m_VBlankEndWait = 0;
+ m_VBlankMin = 300000;
+ m_VBlankMinCalc = 300000;
+ m_VBlankMax = 0;
+ m_VBlankStartWait = 0;
+ m_VBlankWaitTime = 0;
+ m_PresentWaitTime = 0;
+ m_PresentWaitTimeMin = 3000000000;
+ m_PresentWaitTimeMax = 0;
+
+ m_LastRendererSettings = s.m_RenderSettings;
+
+ m_VBlankEndPresent = -100000;
+ m_VBlankStartMeasureTime = 0;
+ m_VBlankStartMeasure = 0;
+
+ m_PaintTime = 0;
+ m_PaintTimeMin = 3000000000;
+ m_PaintTimeMax = 0;
+
+ m_RasterStatusWaitTime = 0;
+ m_RasterStatusWaitTimeMin = 3000000000;
+ m_RasterStatusWaitTimeMax = 0;
+ m_RasterStatusWaitTimeMaxCalc = 0;
+
+ m_ClockDiff = 0.0;
+ m_ClockDiffPrim = 0.0;
+ m_ClockDiffCalc = 0.0;
+
+ m_ModeratedTimeSpeed = 1.0;
+ m_ModeratedTimeSpeedDiff = 0.0;
+ m_ModeratedTimeSpeedPrim = 0;
+ ZeroMemory(m_TimeChangeHisotry, sizeof(m_TimeChangeHisotry));
+ ZeroMemory(m_ClockChangeHisotry, sizeof(m_ClockChangeHisotry));
+ m_ClockTimeChangeHistoryPos = 0;
+
m_pPSC.Free();
m_pD3DDev = NULL;
+ m_pD3DDevEx = NULL;
+ m_pDirectDraw = NULL;
+
+ m_pResizerPixelShader[0] = 0;
+ m_pResizerPixelShader[1] = 0;
+ m_pResizerPixelShader[2] = 0;
+
+ POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
+ while(pos)
+ {
+ CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
+ Shader.m_pPixelShader = NULL;
+ }
+ pos = m_pPixelShaders.GetHeadPosition();
+ while(pos)
+ {
+ CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
+ Shader.m_pPixelShader = NULL;
+ }
+
D3DDISPLAYMODE d3ddm;
HRESULT hr;
ZeroMemory(&d3ddm, sizeof(d3ddm));
if(FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm)))
+ {
+ _Error += L"GetAdapterDisplayMode failed\n";
return E_UNEXPECTED;
+ }
/* // TODO : add nVidia PerfHUD !!!
@@ -292,29 +844,102 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, */
+//#define ENABLE_DDRAWSYNC
+#ifdef ENABLE_DDRAWSYNC
+ hr = DirectDrawCreate(NULL, &m_pDirectDraw, NULL) ;
+ if (hr == S_OK)
+ {
+ hr = m_pDirectDraw->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL) ;
+ }
+#endif
+
m_RefreshRate = d3ddm.RefreshRate;
m_ScreenSize.SetSize(d3ddm.Width, d3ddm.Height);
D3DPRESENT_PARAMETERS pp;
ZeroMemory(&pp, sizeof(pp));
-
- if (AfxGetAppSettings().IsD3DFullscreen())
+ BOOL bCompositionEnabled = false;
+ if (m_pDwmIsCompositionEnabled)
+ m_pDwmIsCompositionEnabled(&bCompositionEnabled);
+
+ m_bCompositionEnabled = bCompositionEnabled != 0;
+
+ m_bAlternativeVSync = s.m_RenderSettings.fVMR9AlterativeVSync;
+ m_bHighColorResolution = s.m_RenderSettings.iEVRHighColorResolution && m_bIsEVR;
+
+ if (m_bIsFullscreen)
{
pp.Windowed = false;
pp.BackBufferWidth = d3ddm.Width;
pp.BackBufferHeight = d3ddm.Height;
pp.hDeviceWindow = m_hWnd;
- pp.BackBufferCount = 1;
- pp.SwapEffect = D3DSWAPEFFECT_FLIP; // Ne pas mettre D3DSWAPEFFECT_COPY car cela entraine une desynchro audio sur les MKV !
+ if(m_bAlternativeVSync)
+ {
+ pp.BackBufferCount = 3;
+ pp.SwapEffect = D3DSWAPEFFECT_DISCARD; // Ne pas mettre D3DSWAPEFFECT_COPY car cela entraine une desynchro audio sur les MKV ! // Copy needed for sync now? FLIP only stutters.
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
+ }
+ else
+ {
+ pp.BackBufferCount = 3;
+ pp.SwapEffect = D3DSWAPEFFECT_DISCARD; // Ne pas mettre D3DSWAPEFFECT_COPY car cela entraine une desynchro audio sur les MKV ! // Copy needed for sync now? FLIP only stutters.
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+ }
pp.Flags = D3DPRESENTFLAG_VIDEO;
- pp.BackBufferFormat = d3ddm.Format;
- pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+ if (s.m_RenderSettings.iVMR9FullscreenGUISupport && !m_bHighColorResolution)
+ pp.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
+ if (m_bHighColorResolution)
+ pp.BackBufferFormat = D3DFMT_A2R10G10B10;
+ else
+ pp.BackBufferFormat = d3ddm.Format;
+
+ m_D3DDevExError = L"No m_pD3DEx";
+ if (m_pD3DEx)
+ {
+ D3DDISPLAYMODEEX DisplayMode;
+ ZeroMemory(&DisplayMode, sizeof(DisplayMode));
+ DisplayMode.Size = sizeof(DisplayMode);
+ m_pD3DEx->GetAdapterDisplayModeEx(GetAdapter(m_pD3DEx), &DisplayMode, NULL);
- hr = m_pD3D->CreateDevice(
- GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
- D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
- &pp, &m_pD3DDev);
+ DisplayMode.Format = pp.BackBufferFormat;
+ pp.FullScreen_RefreshRateInHz = DisplayMode.RefreshRate;
+
+ hr = m_pD3DEx->CreateDeviceEx(
+ GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, &DisplayMode, &m_pD3DDevEx);
+
+ m_D3DDevExError = GetWindowsErrorMessage(hr, m_hD3D9);
+ if (m_pD3DDevEx)
+ {
+ m_pD3DDev = m_pD3DDevEx;
+ m_BackbufferType = pp.BackBufferFormat;
+ m_DisplayType = DisplayMode.Format;
+ }
+ }
+
+ if (!m_pD3DDev)
+ {
+ hr = m_pD3D->CreateDevice(
+ GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, &m_pD3DDev);
+ if (m_pD3DDev)
+ {
+ m_BackbufferType = pp.BackBufferFormat;
+ m_DisplayType = d3ddm.Format;
+ }
+ }
+ if (m_pD3DDev && s.m_RenderSettings.iVMR9FullscreenGUISupport && !m_bHighColorResolution)
+ {
+ m_pD3DDev->SetDialogBoxMode(true);
+ //if (m_pD3DDev->SetDialogBoxMode(true) != S_OK)
+ // ExitProcess(0);
+
+ }
+
+ TRACE("CreateDevice: %d\n", (LONG)hr);
ASSERT (SUCCEEDED (hr));
}
else
@@ -323,28 +948,60 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, pp.hDeviceWindow = m_hWnd;
pp.SwapEffect = D3DSWAPEFFECT_COPY;
pp.Flags = D3DPRESENTFLAG_VIDEO;
+ pp.BackBufferCount = 1;
pp.BackBufferWidth = d3ddm.Width;
pp.BackBufferHeight = d3ddm.Height;
- pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+ m_BackbufferType = d3ddm.Format;
+ m_DisplayType = d3ddm.Format;
+ if (m_bHighColorResolution)
+ {
+ m_BackbufferType = D3DFMT_A2R10G10B10;
+ pp.BackBufferFormat = D3DFMT_A2R10G10B10;
+ }
+ if (bCompositionEnabled || m_bAlternativeVSync)
+ {
+ // Desktop composition takes care of the VSYNC
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
+ }
+ else
+ {
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+ }
- if(m_fVMRSyncFix = AfxGetMyApp()->m_s.fVMRSyncFix)
- pp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
+// if(m_fVMRSyncFix = AfxGetMyApp()->m_s.fVMRSyncFix)
+// pp.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
- hr = m_pD3D->CreateDevice(
+ if (m_pD3DEx)
+ {
+ hr = m_pD3DEx->CreateDeviceEx(
+ GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, NULL, &m_pD3DDevEx);
+ if (m_pD3DDevEx)
+ m_pD3DDev = m_pD3DDevEx;
+ }
+ else
+ {
+ hr = m_pD3D->CreateDevice(
GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
&pp, &m_pD3DDev);
+ }
}
-/*
- HRESULT hr = m_pD3D->CreateDevice(
- m_pD3D->GetAdapterCount()-1, D3DDEVTYPE_REF, m_hWnd,
- D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
- &pp, &m_pD3DDev);
-*/
+
+ if (m_pD3DDevEx)
+ {
+ m_pD3DDevEx->SetGPUThreadPriority(7);
+ }
+
if(FAILED(hr))
+ {
+ _Error += L"CreateDevice failed\n";
+
return hr;
+ }
- m_pPSC.Attach(new CPixelShaderCompiler(m_pD3DDev, true));
+ m_pPSC.Attach(DNew CPixelShaderCompiler(m_pD3DDev, true));
//
@@ -375,6 +1032,10 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, case 3: size.SetSize(640, 480); break;
case 4: size.SetSize(512, 384); break;
case 5: size.SetSize(384, 288); break;
+ case 6: size.SetSize(2560, 1600); break;
+ case 7: size.SetSize(1920, 1080); break;
+ case 8: size.SetSize(1320, 900); break;
+ case 9: size.SetSize(1280, 720); break;
}
if(m_pAllocator)
@@ -383,45 +1044,71 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, }
else
{
- m_pAllocator = new CDX9SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
if(!m_pAllocator)
+ {
+ _Error += L"CDX9SubPicAllocator failed\n";
+
return E_FAIL;
+ }
}
hr = S_OK;
m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
- ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
- : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ ? (ISubPicQueue*)DNew CSubPicQueue(AfxGetAppSettings().nSPCSize, AfxGetAppSettings().fSPCDisableAnim, m_pAllocator, &hr)
+ : (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
if(!m_pSubPicQueue || FAILED(hr))
+ {
+ _Error += L"m_pSubPicQueue failed\n";
+
return E_FAIL;
+ }
if(pSubPicProvider) m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
m_pFont = NULL;
if (m_pD3DXCreateFont)
+ {
+ int MinSize = 1600;
+ int CurrentSize = min(m_ScreenSize.cx, MinSize);
+ double Scale = double(CurrentSize) / double(MinSize);
+ m_TextScale = Scale;
m_pD3DXCreateFont( m_pD3DDev, // D3D device
- -20, // Height
- 0, // Width
- FW_BOLD, // Weight
- 1, // MipLevels, 0 = autogen mipmaps
+ -24.0*Scale, // Height
+ -11.0*Scale, // Width
+ CurrentSize < 800 ? FW_NORMAL : FW_BOLD, // Weight
+ 0, // MipLevels, 0 = autogen mipmaps
FALSE, // Italic
DEFAULT_CHARSET, // CharSet
OUT_DEFAULT_PRECIS, // OutputPrecision
- DEFAULT_QUALITY, // Quality
- DEFAULT_PITCH | FF_DONTCARE, // PitchAndFamily
- L"Courrier", // pFaceName
+ ANTIALIASED_QUALITY, // Quality
+ FIXED_PITCH | FF_DONTCARE, // PitchAndFamily
+ L"Lucida Console", // pFaceName
&m_pFont); // ppFont
+ }
+
+
+ m_pSprite = NULL;
+
+ if (m_pD3DXCreateSprite)
+ {
+ m_pD3DXCreateSprite( m_pD3DDev, // D3D device
+ &m_pSprite);
+ }
m_pLine = NULL;
if (m_pD3DXCreateLine)
m_pD3DXCreateLine (m_pD3DDev, &m_pLine);
+ StartWorkerThreads();
+
return S_OK;
}
HRESULT CDX9AllocatorPresenter::AllocSurfaces(D3DFORMAT Format)
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
AppSettings& s = AfxGetAppSettings();
@@ -431,7 +1118,10 @@ HRESULT CDX9AllocatorPresenter::AllocSurfaces(D3DFORMAT Format) m_pVideoSurface[i] = NULL;
}
- m_pResizerBicubic1stPass = NULL;
+ m_pScreenSizeTemporaryTexture[0] = NULL;
+ m_pScreenSizeTemporaryTexture[1] = NULL;
+
+ m_SurfaceType = Format;
HRESULT hr;
@@ -476,6 +1166,7 @@ HRESULT CDX9AllocatorPresenter::AllocSurfaces(D3DFORMAT Format) void CDX9AllocatorPresenter::DeleteSurfaces()
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
for(int i = 0; i < m_nNbDXSurface+2; i++)
{
@@ -535,16 +1226,49 @@ static bool ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d) return(true);
}
-HRESULT CDX9AllocatorPresenter::InitResizers(float bicubicA)
+HRESULT CDX9AllocatorPresenter::InitResizers(float bicubicA, bool bNeedScreenSizeTexture)
{
HRESULT hr;
- if(m_pResizerPixelShader[0] && m_bicubicA == 0 && bicubicA == 0
- || m_pResizerPixelShader[1] && m_pResizerPixelShader[2] && m_bicubicA == bicubicA && m_pResizerBicubic1stPass)
+ do
+ {
+ if (bicubicA)
+ {
+ if (!m_pResizerPixelShader[0])
+ break;
+ if (!m_pResizerPixelShader[1])
+ break;
+ if (!m_pResizerPixelShader[2])
+ break;
+ if (m_bicubicA != bicubicA)
+ break;
+ if (!m_pScreenSizeTemporaryTexture[0])
+ break;
+ if (bNeedScreenSizeTexture)
+ {
+ if (!m_pScreenSizeTemporaryTexture[1])
+ break;
+ }
+ }
+ else
+ {
+ if (!m_pResizerPixelShader[0])
+ break;
+ if (bNeedScreenSizeTexture)
+ {
+ if (!m_pScreenSizeTemporaryTexture[0])
+ break;
+ if (!m_pScreenSizeTemporaryTexture[1])
+ break;
+ }
+ }
return S_OK;
+ }
+ while (0);
m_bicubicA = bicubicA;
- m_pResizerBicubic1stPass = NULL;
+ m_pScreenSizeTemporaryTexture[0] = NULL;
+ m_pScreenSizeTemporaryTexture[1] = NULL;
for(int i = 0; i < countof(m_pResizerPixelShader); i++)
m_pResizerPixelShader[i] = NULL;
@@ -573,14 +1297,24 @@ HRESULT CDX9AllocatorPresenter::InitResizers(float bicubicA) if(FAILED(hr)) return hr;
}
- if(m_bicubicA)
+ 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(max(2048, m_ScreenSize.cx), (int)m_caps.MaxTextureWidth), m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, &m_pResizerBicubic1stPass, NULL)))
+ 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_pResizerBicubic1stPass = NULL; // will do 1 pass then
+ m_pScreenSizeTemporaryTexture[1] = NULL; // will do 1 pass then
}
}
@@ -617,6 +1351,26 @@ HRESULT CDX9AllocatorPresenter::TextureCopy(CComPtr<IDirect3DTexture9> pTexture) return TextureBlt(m_pD3DDev, v, D3DTEXF_LINEAR);
}
+HRESULT CDX9AllocatorPresenter::DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_Rect)
+{
+ DWORD Color = D3DCOLOR_ARGB(_Alpha, GetRValue(_Color), GetGValue(_Color), GetBValue(_Color));
+ MYD3DVERTEX<0> v[] =
+ {
+ {float(_Rect.left), float(_Rect.top), 0.5f, 2.0f, Color},
+ {float(_Rect.right), float(_Rect.top), 0.5f, 2.0f, Color},
+ {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++)
+ {
+ v[i].x -= 0.5;
+ v[i].y -= 0.5;
+ }
+
+ return ::DrawRect(m_pD3DDev, v);
+}
+
HRESULT CDX9AllocatorPresenter::TextureResize(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter)
{
HRESULT hr;
@@ -750,7 +1504,7 @@ HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(CComPtr<IDirect3DTextu CRect dst1(0, 0, (int)(dst[3].x - dst[0].x), (int)h);
- if(!m_pResizerBicubic1stPass || FAILED(m_pResizerBicubic1stPass->GetLevelDesc(0, &desc)))
+ if(!m_pScreenSizeTemporaryTexture[0] || FAILED(m_pScreenSizeTemporaryTexture[0]->GetLevelDesc(0, &desc)))
return TextureResizeBicubic1pass(pTexture, dst);
float dy = 0.98f/desc.Height;
@@ -758,7 +1512,7 @@ HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(CComPtr<IDirect3DTextu float dw = (float)dst1.Width() / desc.Width;
float dh = (float)dst1.Height() / desc.Height;
- ASSERT(dst1.Height() == desc.Height);
+// ASSERT(dst1.Height() == desc.Height);
if(dst1.Width() > (int)desc.Width || dst1.Height() > (int)desc.Height)
// if(dst1.Width() != desc.Width || dst1.Height() != desc.Height)
@@ -795,15 +1549,15 @@ HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(CComPtr<IDirect3DTextu hr = m_pD3DDev->GetRenderTarget(0, &pRTOld);
CComPtr<IDirect3DSurface9> pRT;
- hr = m_pResizerBicubic1stPass->GetSurfaceLevel(0, &pRT);
+ hr = m_pScreenSizeTemporaryTexture[0]->GetSurfaceLevel(0, &pRT);
hr = m_pD3DDev->SetRenderTarget(0, pRT);
hr = TextureBlt(m_pD3DDev, vx, D3DTEXF_POINT);
- hr = m_pD3DDev->SetTexture(0, m_pResizerBicubic1stPass);
- hr = m_pD3DDev->SetTexture(1, m_pResizerBicubic1stPass);
- hr = m_pD3DDev->SetTexture(2, m_pResizerBicubic1stPass);
- hr = m_pD3DDev->SetTexture(3, m_pResizerBicubic1stPass);
+ hr = m_pD3DDev->SetTexture(0, m_pScreenSizeTemporaryTexture[0]);
+ hr = m_pD3DDev->SetTexture(1, m_pScreenSizeTemporaryTexture[0]);
+ hr = m_pD3DDev->SetTexture(2, m_pScreenSizeTemporaryTexture[0]);
+ hr = m_pD3DDev->SetTexture(3, m_pScreenSizeTemporaryTexture[0]);
hr = m_pD3DDev->SetRenderTarget(0, pRTOld);
@@ -893,14 +1647,9 @@ HRESULT CDX9AllocatorPresenter::AlphaBlt(RECT* pSrc, RECT* pDst, CComPtr<IDirect hr = m_pD3DDev->SetPixelShader(NULL);
- if(FAILED(hr = m_pD3DDev->BeginScene()))
- break;
-
hr = m_pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
hr = m_pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pVertices, sizeof(pVertices[0]));
- hr = m_pD3DDev->EndScene();
-
//
m_pD3DDev->SetTexture(0, NULL);
@@ -916,17 +1665,357 @@ HRESULT CDX9AllocatorPresenter::AlphaBlt(RECT* pSrc, RECT* pDst, CComPtr<IDirect return E_FAIL;
}
+void CDX9AllocatorPresenter::CalculateJitter(LONGLONG PerfCounter)
+{
+ // Calculate the jitter!
+ LONGLONG llPerf = PerfCounter;
+ if ((m_rtTimePerFrame != 0) && (labs ((long)(llPerf - m_llLastPerf)) < m_rtTimePerFrame*3) )
+ {
+ m_nNextJitter = (m_nNextJitter+1) % NB_JITTER;
+ m_pllJitter[m_nNextJitter] = llPerf - m_llLastPerf;
+
+ m_MaxJitter = MINLONG64;
+ m_MinJitter = MAXLONG64;
+
+ // Calculate the real FPS
+ LONGLONG llJitterSum = 0;
+ LONGLONG llJitterSumAvg = 0;
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ LONGLONG Jitter = m_pllJitter[i];
+ llJitterSum += Jitter;
+ llJitterSumAvg += Jitter;
+ }
+ double FrameTimeMean = double(llJitterSumAvg)/NB_JITTER;
+ m_fJitterMean = FrameTimeMean;
+ double DeviationSum = 0;
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ LONGLONG DevInt = m_pllJitter[i] - FrameTimeMean;
+ double Deviation = DevInt;
+ DeviationSum += Deviation*Deviation;
+ m_MaxJitter = max(m_MaxJitter, DevInt);
+ m_MinJitter = min(m_MinJitter, DevInt);
+ }
+ double StdDev = sqrt(DeviationSum/NB_JITTER);
+
+ m_fJitterStdDev = StdDev;
+
+ m_fAvrFps = 10000000.0/(double(llJitterSum)/NB_JITTER);
+ }
+
+ m_llLastPerf = llPerf;
+}
+
+bool CDX9AllocatorPresenter::GetVBlank(int &_ScanLine, int &_bInVBlank, bool _bMeasureTime)
+{
+ LONGLONG llPerf;
+ if (_bMeasureTime)
+ llPerf = AfxGetMyApp()->GetPerfCounter();
+
+ int ScanLine = 0;
+ _ScanLine = 0;
+ _bInVBlank = 0;
+ if (m_pDirectDraw)
+ {
+ DWORD ScanLineGet = 0;
+ m_pDirectDraw->GetScanLine(&ScanLineGet);
+ BOOL InVBlank;
+ if (m_pDirectDraw->GetVerticalBlankStatus (&InVBlank) != S_OK)
+ return false;
+ ScanLine = ScanLineGet;
+ _bInVBlank = InVBlank;
+ if (InVBlank)
+ ScanLine = 0;
+ }
+ else
+ {
+ D3DRASTER_STATUS RasterStatus;
+ if (m_pD3DDev->GetRasterStatus(0, &RasterStatus) != S_OK)
+ return false;;
+ ScanLine = RasterStatus.ScanLine;
+ _bInVBlank = RasterStatus.InVBlank;
+ }
+ if (_bMeasureTime)
+ {
+ m_VBlankMax = max(m_VBlankMax, ScanLine);
+ if (ScanLine != 0 && !_bInVBlank)
+ m_VBlankMinCalc = min(m_VBlankMinCalc, ScanLine);
+ m_VBlankMin = m_VBlankMax - m_ScreenSize.cy;
+ }
+ if (_bInVBlank)
+ _ScanLine = 0;
+ else if (m_VBlankMin != 300000)
+ _ScanLine = ScanLine - m_VBlankMin;
+ else
+ _ScanLine = ScanLine;
+
+ if (_bMeasureTime)
+ {
+ LONGLONG Time = AfxGetMyApp()->GetPerfCounter() - llPerf;
+ m_RasterStatusWaitTimeMaxCalc = max(m_RasterStatusWaitTimeMaxCalc, Time);
+ }
+
+ return true;
+}
+
+bool CDX9AllocatorPresenter::WaitForVBlankRange(int &_RasterStart, int _RasterSize, bool _bWaitIfInside, bool _bNeedAccurate, bool _bMeasure)
+{
+ if (_bMeasure)
+ m_RasterStatusWaitTimeMaxCalc = 0;
+ bool bWaited = false;
+ int ScanLine = 0;
+ int InVBlank = 0;
+ LONGLONG llPerf;
+ if (_bMeasure)
+ llPerf = AfxGetMyApp()->GetPerfCounter();
+ GetVBlank(ScanLine, InVBlank, _bMeasure);
+ if (_bMeasure)
+ m_VBlankStartWait = ScanLine;
+
+ static bool bOneWait = true;
+ if (bOneWait && _bMeasure)
+ {
+ bOneWait = false;
+ // If we are already in the wanted interval we need to wait until we aren't, this improves sync when for example you are playing 23.976 Hz material on a 24 Hz refresh rate
+ int nInVBlank = 0;
+ while (1)
+ {
+ if (!GetVBlank(ScanLine, InVBlank, _bMeasure))
+ break;
+
+ if (InVBlank && nInVBlank == 0)
+ {
+ nInVBlank = 1;
+ }
+ else if (!InVBlank && nInVBlank == 1)
+ {
+ nInVBlank = 2;
+ }
+ else if (InVBlank && nInVBlank == 2)
+ {
+ nInVBlank = 3;
+ }
+ else if (!InVBlank && nInVBlank == 3)
+ {
+ break;
+ }
+ }
+ }
+ if (_bWaitIfInside)
+ {
+ int ScanLineDiff = long(ScanLine) - _RasterStart;
+ if (ScanLineDiff > m_ScreenSize.cy / 2)
+ ScanLineDiff -= m_ScreenSize.cy;
+ else if (ScanLineDiff < -m_ScreenSize.cy / 2)
+ ScanLineDiff += m_ScreenSize.cy;
+
+ if (ScanLineDiff >= 0 && ScanLineDiff <= _RasterSize)
+ {
+ bWaited = true;
+ // If we are already in the wanted interval we need to wait until we aren't, this improves sync when for example you are playing 23.976 Hz material on a 24 Hz refresh rate
+ int LastLineDiff = ScanLineDiff;
+ while (1)
+ {
+ if (!GetVBlank(ScanLine, InVBlank, _bMeasure))
+ break;
+ int ScanLineDiff = long(ScanLine) - _RasterStart;
+ if (ScanLineDiff > m_ScreenSize.cy / 2)
+ ScanLineDiff -= m_ScreenSize.cy;
+ else if (ScanLineDiff < -m_ScreenSize.cy / 2)
+ ScanLineDiff += m_ScreenSize.cy;
+ if (!(ScanLineDiff >= 0 && ScanLineDiff <= _RasterSize) || (LastLineDiff < 0 && ScanLineDiff > 0))
+ break;
+ LastLineDiff = ScanLineDiff;
+ Sleep(1); // Just sleep
+ }
+ }
+ }
+ int MinRange = max(min(int(0.0015 * double(m_ScreenSize.cy) * double(m_RefreshRate) + 0.5), m_ScreenSize.cy/3), 5); // 1.5 ms or max 33 % of Time
+ int NoSleepStart = _RasterStart - MinRange;
+ int NoSleepRange = MinRange;
+ if (NoSleepStart < 0)
+ NoSleepStart += m_ScreenSize.cy;
+
+ int ScanLineDiff = ScanLine - _RasterStart;
+ if (ScanLineDiff > m_ScreenSize.cy / 2)
+ ScanLineDiff -= m_ScreenSize.cy;
+ else if (ScanLineDiff < -m_ScreenSize.cy / 2)
+ ScanLineDiff += m_ScreenSize.cy;
+ int LastLineDiff = ScanLineDiff;
+ int LastLineDiffSleep = long(ScanLine) - NoSleepStart;
+ while (1)
+ {
+ if (!GetVBlank(ScanLine, InVBlank, _bMeasure))
+ break;
+ int ScanLineDiff = long(ScanLine) - _RasterStart;
+ if (ScanLineDiff > m_ScreenSize.cy / 2)
+ ScanLineDiff -= m_ScreenSize.cy;
+ else if (ScanLineDiff < -m_ScreenSize.cy / 2)
+ ScanLineDiff += m_ScreenSize.cy;
+ if ((ScanLineDiff >= 0 && ScanLineDiff <= _RasterSize) || (LastLineDiff < 0 && ScanLineDiff > 0))
+ break;
+
+ LastLineDiff = ScanLineDiff;
+
+ bWaited = true;
+
+ int ScanLineDiffSleep = long(ScanLine) - NoSleepStart;
+ if (ScanLineDiffSleep > m_ScreenSize.cy / 2)
+ ScanLineDiffSleep -= m_ScreenSize.cy;
+ else if (ScanLineDiffSleep < -m_ScreenSize.cy / 2)
+ ScanLineDiffSleep += m_ScreenSize.cy;
+
+ if (!((ScanLineDiffSleep >= 0 && ScanLineDiffSleep <= NoSleepRange) || (LastLineDiffSleep < 0 && ScanLineDiffSleep > 0)) || !_bNeedAccurate)
+ {
+ //TRACE("%d\n", RasterStatus.ScanLine);
+ Sleep(1); // Don't sleep for the last 1.5 ms scan lines, so we get maximum precision
+ }
+ LastLineDiffSleep = ScanLineDiffSleep;
+ }
+ _RasterStart = ScanLine;
+ if (_bMeasure)
+ {
+ m_VBlankEndWait = ScanLine;
+ m_VBlankWaitTime = AfxGetMyApp()->GetPerfCounter() - llPerf;
+
+ m_RasterStatusWaitTime = m_RasterStatusWaitTimeMaxCalc;
+ m_RasterStatusWaitTimeMin = min(m_RasterStatusWaitTimeMin, m_RasterStatusWaitTime);
+ m_RasterStatusWaitTimeMax = max(m_RasterStatusWaitTimeMax, m_RasterStatusWaitTime);
+ }
+
+ return bWaited;
+}
+
+int CDX9AllocatorPresenter::GetVBlackPos()
+{
+ AppSettings& s = AfxGetAppSettings();
+ BOOL bCompositionEnabled = m_bCompositionEnabled;
+
+ int WaitRange = max(m_ScreenSize.cy / 40, 5);
+ if (!bCompositionEnabled)
+ {
+ if (m_bAlternativeVSync)
+ {
+ return s.m_RenderSettings.iVMR9VSyncOffset;
+ }
+ else
+ {
+ int MinRange = max(min(int(0.005 * double(m_ScreenSize.cy) * GetRefreshRate() + 0.5), m_ScreenSize.cy/3), 5); // 5 ms or max 33 % of Time
+ int WaitFor = m_ScreenSize.cy - (MinRange + WaitRange);
+ return WaitFor;
+ }
+ }
+ else
+ {
+ int WaitFor = m_ScreenSize.cy / 2;
+ return WaitFor;
+ }
+}
+
+
+bool CDX9AllocatorPresenter::WaitForVBlank(bool &_Waited)
+{
+ AppSettings& s = AfxGetAppSettings();
+ if (!s.m_RenderSettings.iVMR9VSync)
+ {
+ _Waited = true;
+ m_VBlankWaitTime = 0;
+ m_VBlankEndWait = 0;
+ m_VBlankStartWait = 0;
+ return true;
+ }
+// _Waited = true;
+// return false;
+
+ BOOL bCompositionEnabled = m_bCompositionEnabled;
+ int WaitFor = GetVBlackPos();
+
+ if (!bCompositionEnabled)
+ {
+ if (m_bAlternativeVSync)
+ {
+ _Waited = WaitForVBlankRange(WaitFor, 0, false, true, true);
+ return false;
+ }
+ else
+ {
+ _Waited = WaitForVBlankRange(WaitFor, 0, false, s.m_RenderSettings.iVMR9VSyncAccurate, true);
+ return true;
+ }
+ }
+ else
+ {
+ // Instead we wait for VBlack after the present, this seems to fix the stuttering problem. It's also possible to fix by removing the Sleep above, but that isn't an option.
+ WaitForVBlankRange(WaitFor, 0, false, s.m_RenderSettings.iVMR9VSyncAccurate, true);
+
+ return false;
+ }
+}
+
+void CDX9AllocatorPresenter::UpdateAlphaBitmap()
+{
+ m_VMR9AlphaBitmapData.Free();
+
+ if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0)
+ {
+ HBITMAP hBitmap = (HBITMAP)GetCurrentObject (m_VMR9AlphaBitmap.hdc, OBJ_BITMAP);
+ if (!hBitmap)
+ return;
+ DIBSECTION info = {0};
+ if (!::GetObject(hBitmap, sizeof( DIBSECTION ), &info ))
+ return;
+
+ m_VMR9AlphaBitmapRect = CRect(0, 0, info.dsBm.bmWidth, info.dsBm.bmHeight);
+ m_VMR9AlphaBitmapWidthBytes = info.dsBm.bmWidthBytes;
+
+ if (m_VMR9AlphaBitmapData.Allocate(info.dsBm.bmWidthBytes * info.dsBm.bmHeight))
+ {
+ memcpy((BYTE *)m_VMR9AlphaBitmapData, info.dsBm.bmBits, info.dsBm.bmWidthBytes * info.dsBm.bmHeight);
+ }
+ }
+}
STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
{
+// if (!fAll)
+// return false;
AppSettings& s = AfxGetAppSettings();
- CAutoLock cAutoLock(this);
+// TRACE("Thread: %d\n", (LONG)((CRITICAL_SECTION &)m_RenderLock).OwningThread);
+
+#if 0
+ if (TryEnterCriticalSection (&(CRITICAL_SECTION &)(*((CCritSec *)this))))
+ {
+ LeaveCriticalSection((&(CRITICAL_SECTION &)(*((CCritSec *)this))));
+ }
+ else
+ {
+ __asm {
+ int 3
+ };
+ }
+#endif
+
+ CMPlayerCApp * pApp = AfxGetMyApp();
+
+ LONGLONG StartPaint = pApp->GetPerfCounter();
+ CAutoLock cRenderLock(&m_RenderLock);
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)
+ --m_OrderedPaint;
+ else
+ {
+ TRACE("UNORDERED PAINT!!!!!!\n");
+ }
+
+
return(false);
+ }
HRESULT hr;
@@ -936,12 +2025,14 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) CRect rSrcPri(CPoint(0, 0), m_WindowRect.Size());
CRect rDstPri(m_WindowRect);
+ m_pD3DDev->BeginScene();
+
CComPtr<IDirect3DSurface9> pBackBuffer;
m_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
m_pD3DDev->SetRenderTarget(0, pBackBuffer);
- if(fAll)
+// if(fAll)
{
// clear the backbuffer
@@ -984,7 +2075,10 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) pVideoTexture = m_pVideoTexture[dst];
hr = m_pD3DDev->SetRenderTarget(0, m_pVideoSurface[dst]);
- hr = m_pD3DDev->SetPixelShader(m_pPixelShaders.GetNext(pos));
+ CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
+ if (!Shader.m_pPixelShader)
+ Shader.Compile(m_pPSC);
+ hr = m_pD3DDev->SetPixelShader(Shader.m_pPixelShader);
TextureCopy(m_pVideoTexture[src]);
//if(++src > 2) src = 1;
@@ -1010,8 +2104,27 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) case 4: A = -0.751f; break; // FIXME : 0.75 crash recent D3D, or eat CPU
case 5: A = -1.00f; break;
}
+ bool bScreenSpacePixelShaders = !m_pPixelShadersScreenSpace.IsEmpty();
- hr = InitResizers(A);
+ hr = InitResizers(A, bScreenSpacePixelShaders);
+
+ if (!m_pScreenSizeTemporaryTexture[0] || !m_pScreenSizeTemporaryTexture[1])
+ bScreenSpacePixelShaders = false;
+
+ if (bScreenSpacePixelShaders)
+ {
+ CComPtr<IDirect3DSurface9> pRT;
+ hr = m_pScreenSizeTemporaryTexture[1]->GetSurfaceLevel(0, &pRT);
+ if (hr != S_OK)
+ bScreenSpacePixelShaders = false;
+ if (bScreenSpacePixelShaders)
+ {
+ hr = m_pD3DDev->SetRenderTarget(0, pRT);
+ if (hr != S_OK)
+ bScreenSpacePixelShaders = false;
+ hr = m_pD3DDev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0);
+ }
+ }
if(iDX9Resizer == 0 || iDX9Resizer == 1 || rSrcVid.Size() == rDstVid.Size() || FAILED(hr))
{
@@ -1026,6 +2139,62 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) hr = TextureResizeBicubic2pass(pVideoTexture, dst);
}
+ if (bScreenSpacePixelShaders)
+ {
+ static __int64 counter = 555;
+ static long start = clock() + 333;
+
+ long stop = clock() + 333;
+ long diff = stop - start;
+
+ if(diff >= 10*60*CLOCKS_PER_SEC) start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
+
+ D3DSURFACE_DESC desc;
+ m_pScreenSizeTemporaryTexture[0]->GetLevelDesc(0, &desc);
+
+#if 1
+ float fConstData[][4] =
+ {
+ {(float)desc.Width, (float)desc.Height, (float)(counter++), (float)diff / CLOCKS_PER_SEC},
+ {1.0f / desc.Width, 1.0f / desc.Height, 0, 0},
+ };
+#else
+ float fConstData[][4] =
+ {
+ {(float)m_ScreenSize.cx, (float)m_ScreenSize.cy, (float)(counter++), (float)diff / CLOCKS_PER_SEC},
+ {1.0f / m_ScreenSize.cx, 1.0f / m_ScreenSize.cy, 0, 0},
+ };
+#endif
+
+ hr = m_pD3DDev->SetPixelShaderConstantF(0, (float*)fConstData, countof(fConstData));
+
+ int src = 1, dst = 0;
+
+ POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
+ while(pos)
+ {
+ if (m_pPixelShadersScreenSpace.GetTailPosition() == pos)
+ {
+ m_pD3DDev->SetRenderTarget(0, pBackBuffer);
+ }
+ else
+ {
+ CComPtr<IDirect3DSurface9> pRT;
+ hr = m_pScreenSizeTemporaryTexture[dst]->GetSurfaceLevel(0, &pRT);
+ m_pD3DDev->SetRenderTarget(0, pRT);
+ }
+
+ CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
+ if (!Shader.m_pPixelShader)
+ Shader.Compile(m_pPSC);
+ hr = m_pD3DDev->SetPixelShader(Shader.m_pPixelShader);
+ TextureCopy(m_pScreenSizeTemporaryTexture[src]);
+
+ swap(src, dst);
+ }
+
+ hr = m_pD3DDev->SetPixelShader(NULL);
+ }
}
else
{
@@ -1040,7 +2209,17 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) // Support ffdshow queueing
// m_pD3DDev->StretchRect may fail if ffdshow is using queue output samples.
// Here we don't want to show the black buffer.
- if(FAILED(hr)) return false;
+ if(FAILED(hr))
+ {
+ if (m_OrderedPaint)
+ --m_OrderedPaint;
+ else
+ {
+ TRACE("UNORDERED PAINT!!!!!!\n");
+ }
+
+ return false;
+ }
}
}
}
@@ -1050,13 +2229,15 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) AlphaBltSubPic(rSrcPri.Size());
}
+
// Casimir666 : affichage de l'OSD
if (m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_UPDATE)
{
+ CAutoLock BitMapLock(&m_VMR9AlphaBitmapLock);
CRect rcSrc (m_VMR9AlphaBitmap.rSrc);
m_pOSDTexture = NULL;
m_pOSDSurface = NULL;
- if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0)
+ if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0 && (BYTE *)m_VMR9AlphaBitmapData)
{
if( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
@@ -1065,20 +2246,14 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) {
if (SUCCEEDED (hr = m_pOSDTexture->GetSurfaceLevel(0, &m_pOSDSurface)))
{
- HBITMAP hBitmap = (HBITMAP)GetCurrentObject (m_VMR9AlphaBitmap.hdc, OBJ_BITMAP);
- DIBSECTION info = {0};
-
- ::GetObject(hBitmap, sizeof( DIBSECTION ), &info );
- CRect rcBitmap (0, 0, info.dsBm.bmWidth, info.dsBm.bmHeight);
-
hr = m_pD3DXLoadSurfaceFromMemory (m_pOSDSurface,
NULL,
NULL,
- info.dsBm.bmBits,
+ (BYTE *)m_VMR9AlphaBitmapData,
D3DFMT_A8R8G8B8,
- info.dsBm.bmWidthBytes,
+ m_VMR9AlphaBitmapWidthBytes,
NULL,
- &rcBitmap,
+ &m_VMR9AlphaBitmapRect,
D3DX_FILTER_NONE,
m_VMR9AlphaBitmap.clrSrcKey);
}
@@ -1093,37 +2268,167 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) }
- if (AfxGetMyApp()->m_fDisplayStats) DrawStats();
+ if (pApp->m_fDisplayStats)
+ DrawStats();
if (m_pOSDTexture) AlphaBlt(rSrcPri, rDstPri, m_pOSDTexture);
- if(m_fVMRSyncFix)
+ m_pD3DDev->EndScene();
+
+ BOOL bCompositionEnabled = m_bCompositionEnabled;
+
+ bool bDoVSyncInPresent = (!bCompositionEnabled && !m_bAlternativeVSync) || !s.m_RenderSettings.iVMR9VSync;
+
+ LONGLONG PresentWaitTime = 0;
+/* if(fAll && m_fVMRSyncFix && bDoVSyncInPresent)
{
+ LONGLONG llPerf = pApp->GetPerfCounter();
D3DLOCKED_RECT lr;
if(SUCCEEDED(pBackBuffer->LockRect(&lr, NULL, 0)))
pBackBuffer->UnlockRect();
- }
+ PresentWaitTime = pApp->GetPerfCounter() - llPerf;
+ }*/
- if ((AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode()) )
- hr = m_pD3DDev->Present(NULL, NULL, NULL, NULL);
- else
- hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL);
+ CComPtr<IDirect3DQuery9> pEventQuery;
- // Calculate the jitter!
- LONGLONG llPerf = AfxGetMyApp()->GetPerfCounter();
- if ((m_rtTimePerFrame != 0) && (labs ((long)(llPerf - m_llLastPerf)) < m_rtTimePerFrame*3) )
+ m_pD3DDev->CreateQuery(D3DQUERYTYPE_EVENT, &pEventQuery);
+ if (pEventQuery)
+ pEventQuery->Issue(D3DISSUE_END);
+
+ if (s.m_RenderSettings.iVMRFlushGPUBeforeVSync && pEventQuery)
{
- m_nNextJitter = (m_nNextJitter+1) % NB_JITTER;
- m_pllJitter[m_nNextJitter] = llPerf - m_llLastPerf - m_rtTimePerFrame;
+ LONGLONG llPerf = pApp->GetPerfCounter();
+ BOOL Data;
+ //Sleep(5);
+ while(S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH ))
+ {
+ if (!s.m_RenderSettings.iVMRFlushGPUWait)
+ break;
+ Sleep(1);
+ }
+ if (s.m_RenderSettings.iVMRFlushGPUWait)
+ m_WaitForGPUTime = pApp->GetPerfCounter() - llPerf;
+ else
+ m_WaitForGPUTime = 0;
+ }
+ else
+ m_WaitForGPUTime = 0;
+ if (fAll)
+ {
+ m_PaintTime = (AfxGetMyApp()->GetPerfCounter() - StartPaint);
+ m_PaintTimeMin = min(m_PaintTimeMin, m_PaintTime);
+ m_PaintTimeMax = max(m_PaintTimeMax, m_PaintTime);
+
+ }
- // Calculate the real FPS
- LONGLONG llJitterSum = 0;
- for (int i=0; i<NB_JITTER; i++)
- llJitterSum += m_pllJitter[i];
- m_fAvrFps = 10000000.0/(llJitterSum/125 + m_rtTimePerFrame);
+ bool bWaited = false;
+ if (fAll)
+ {
+ // Only sync to refresh when redrawing all
+ bool bTest = WaitForVBlank(bWaited);
+ ASSERT(bTest == bDoVSyncInPresent);
+ if (!bDoVSyncInPresent)
+ {
+ LONGLONG Time = pApp->GetPerfCounter();
+ OnVBlankFinished(fAll, Time);
+ if (!m_bIsEVR || m_OrderedPaint)
+ CalculateJitter(Time);
+ }
}
- m_llLastPerf = llPerf;
+ // Create a device pointer m_pd3dDevice
+
+ // Create a query object
+
+
+ {
+ CComPtr<IDirect3DQuery9> pEventQuery;
+ m_pD3DDev->CreateQuery(D3DQUERYTYPE_EVENT, &pEventQuery);
+
+ LONGLONG llPerf = pApp->GetPerfCounter();
+ if (m_pD3DDevEx)
+ {
+ if (m_bIsFullscreen)
+ hr = m_pD3DDevEx->PresentEx(NULL, NULL, NULL, NULL, NULL);
+ else
+ hr = m_pD3DDevEx->PresentEx(rSrcPri, rDstPri, NULL, NULL, NULL);
+ }
+ else
+ {
+ if (m_bIsFullscreen)
+ hr = m_pD3DDev->Present(NULL, NULL, NULL, NULL);
+ else
+ hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL);
+ }
+ // Issue an End event
+ if (pEventQuery)
+ pEventQuery->Issue(D3DISSUE_END);
+
+ BOOL Data;
+
+ if (s.m_RenderSettings.iVMRFlushGPUAfterPresent && pEventQuery)
+ {
+ LONGLONG FlushStartTime = pApp->GetPerfCounter();
+ while (S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH ))
+ {
+ if (!s.m_RenderSettings.iVMRFlushGPUWait)
+ break;
+ if (pApp->GetPerfCounter() - FlushStartTime > 10000)
+ break; // timeout after 10 ms
+ }
+ }
+
+ int ScanLine;
+ int bInVBlank;
+ GetVBlank(ScanLine, bInVBlank, false);
+
+ if (fAll && (!m_bIsEVR || m_OrderedPaint))
+ {
+ m_VBlankEndPresent = ScanLine;
+ }
+
+ while (ScanLine == 0 || bInVBlank)
+ {
+ GetVBlank(ScanLine, bInVBlank, false);
+
+ }
+ m_VBlankStartMeasureTime = pApp->GetPerfCounter();
+ m_VBlankStartMeasure = ScanLine;
+
+ if (fAll && bDoVSyncInPresent)
+ {
+ m_PresentWaitTime = (pApp->GetPerfCounter() - llPerf) + PresentWaitTime;
+ m_PresentWaitTimeMin = min(m_PresentWaitTimeMin, m_PresentWaitTime);
+ m_PresentWaitTimeMax = max(m_PresentWaitTimeMax, m_PresentWaitTime);
+ }
+ else
+ {
+ m_PresentWaitTime = 0;
+ m_PresentWaitTimeMin = min(m_PresentWaitTimeMin, m_PresentWaitTime);
+ m_PresentWaitTimeMax = max(m_PresentWaitTimeMax, m_PresentWaitTime);
+ }
+ }
+
+ if (bDoVSyncInPresent)
+ {
+ LONGLONG Time = pApp->GetPerfCounter();
+ if (!m_bIsEVR || m_OrderedPaint)
+ CalculateJitter(Time);
+ OnVBlankFinished(fAll, Time);
+ }
+
+/* if (!bWaited)
+ {
+ bWaited = true;
+ WaitForVBlank(bWaited);
+ TRACE("Double VBlank\n");
+ ASSERT(bWaited);
+ if (!bDoVSyncInPresent)
+ {
+ CalculateJitter();
+ OnVBlankFinished(fAll);
+ }
+ }*/
bool fResetDevice = false;
if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
@@ -1131,102 +2436,420 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) fResetDevice = true;
}
+ if (SettingsNeedResetDevice())
+ fResetDevice = true;
+
+ bCompositionEnabled = false;
+ if (m_pDwmIsCompositionEnabled)
+ m_pDwmIsCompositionEnabled(&bCompositionEnabled);
+ if ((bCompositionEnabled != 0) != m_bCompositionEnabled)
+ {
+ if (m_bIsFullscreen)
+ {
+ m_bCompositionEnabled = (bCompositionEnabled != 0);
+ }
+ else
+ fResetDevice = true;
+ }
+
+
D3DDEVICE_CREATION_PARAMETERS Parameters;
- if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))
- && m_pD3D->GetAdapterMonitor(Parameters.AdapterOrdinal) != m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D)))
+ if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters)) && m_pD3D->GetAdapterMonitor(Parameters.AdapterOrdinal) != m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D)))
{
fResetDevice = true;
}
if(fResetDevice)
{
- DeleteSurfaces();
- if(FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces()))
- return false;
- OnResetDevice();
+ if (m_bNeedPendingResetDevice)
+ {
+ m_bPendingResetDevice = true;
+ }
+ else
+ {
+ ResetDevice();
+ }
}
+ if (m_OrderedPaint)
+ --m_OrderedPaint;
+ else
+ {
+ TRACE("UNORDERED PAINT!!!!!!\n");
+ }
return(true);
}
+double CDX9AllocatorPresenter::GetFrameTime()
+{
+ if (m_DetectedLock)
+ return m_DetectedFrameTime;
+
+ return m_rtTimePerFrame / 10000000.0;
+}
+
+double CDX9AllocatorPresenter::GetFrameRate()
+{
+ if (m_DetectedLock)
+ return m_DetectedFrameRate;
+
+ return 10000000.0 / m_rtTimePerFrame;
+}
+
+bool CDX9AllocatorPresenter::ResetDevice()
+{
+ StopWorkerThreads();
+ DeleteSurfaces();
+ HRESULT hr;
+ CString Error;
+ // TODO: Report error messages here
+ if(FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces()))
+ {
+ return false;
+ }
+ OnResetDevice();
+ return true;
+}
+
+void CDX9AllocatorPresenter::DrawText(const RECT &rc, const CString &strText, int _Priority)
+{
+ if (_Priority < 1)
+ return;
+ int Quality = 1;
+ D3DXCOLOR Color1( 1.0f, 0.2f, 0.2f, 1.0f );
+ D3DXCOLOR Color0( 0.0f, 0.0f, 0.0f, 1.0f );
+ RECT Rect1 = rc;
+ RECT Rect2 = rc;
+ if (Quality == 1)
+ OffsetRect (&Rect2 , 2, 2);
+ else
+ OffsetRect (&Rect2 , -1, -1);
+ if (Quality > 0)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , 1, 0);
+ if (Quality > 3)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , 1, 0);
+ if (Quality > 2)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , 0, 1);
+ if (Quality > 3)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , 0, 1);
+ if (Quality > 1)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , -1, 0);
+ if (Quality > 3)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , -1, 0);
+ if (Quality > 2)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ OffsetRect (&Rect2 , 0, -1);
+ if (Quality > 3)
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect2, DT_NOCLIP, Color0);
+ m_pFont->DrawText( m_pSprite, strText, -1, &Rect1, DT_NOCLIP, Color1);
+}
+
void CDX9AllocatorPresenter::DrawStats()
{
- if (m_pLine && m_pFont)
+ AppSettings& s = AfxGetAppSettings();
+ CMPlayerCApp * pApp = AfxGetMyApp();
+ int bDetailedStats = 2;
+ switch (pApp->m_fDisplayStats)
{
- D3DXVECTOR2 Points[NB_JITTER];
- int nIndex;
+ case 1: bDetailedStats = 2; break;
+ case 2: bDetailedStats = 1; break;
+ case 3: bDetailedStats = 0; break;
+ }
+
+ LONGLONG llMaxJitter = m_MaxJitter;
+ LONGLONG llMinJitter = m_MinJitter;
+ LONGLONG llMaxSyncOffset = m_MaxSyncOffset;
+ LONGLONG llMinSyncOffset = m_MinSyncOffset;
+ if (m_pFont && m_pSprite)
+ {
+ m_pSprite->Begin(D3DXSPRITE_ALPHABLEND);
RECT rc = {700, 40, 0, 0 };
- LONGLONG llMaxJitter = MINLONG64;
- LONGLONG llMinJitter = MAXLONG64;
+ rc.left = 40;
+ CString strText;
+ int TextHeight = 25.0*m_TextScale + 0.5;
+// strText.Format(L"Frame rate : %7.03f (%7.3f ms = %.03f, %s) (%7.3f ms = %.03f%s) Clock: %7.3f ms %+1.4f %% %+1.9f %+1.9f", m_fAvrFps, double(m_rtTimePerFrame) / 10000.0, 10000000.0 / (double)(m_rtTimePerFrame), m_bInterlaced ? L"I" : L"P", GetFrameTime() * 1000.0, GetFrameRate(), m_DetectedLock ? L" L" : L"", m_ClockDiff/10000.0, m_ModeratedTimeSpeed*100.0 - 100.0, m_ModeratedTimeSpeedDiff, m_ClockDiffCalc/10000.0);
+ if (bDetailedStats > 1)
+ {
+ if (m_bIsEVR)
+ strText.Format(L"Frame rate : %7.03f (%7.3f ms = %.03f, %s) (%7.3f ms = %.03f%s, %2.03f StdDev) Clock: %1.4f %%", m_fAvrFps, double(m_rtTimePerFrame) / 10000.0, 10000000.0 / (double)(m_rtTimePerFrame), m_bInterlaced ? L"I" : L"P", GetFrameTime() * 1000.0, GetFrameRate(), m_DetectedLock ? L" L" : L"", m_DetectedFrameTimeStdDev / 10000.0, m_ModeratedTimeSpeed*100.0);
+ else
+ strText.Format(L"Frame rate : %7.03f (%7.3f ms = %.03f, %s)", m_fAvrFps, double(m_rtTimePerFrame) / 10000.0, 10000000.0 / (double)(m_rtTimePerFrame), m_bInterlaced ? L"I" : L"P");
+ }
+// strText.Format(L"Frame rate : %7.03f (%7.3f ms = %.03f, %s) (%7.3f ms = %.03f%s, %2.03f StdDev)", m_fAvrFps, double(m_rtTimePerFrame) / 10000.0, 10000000.0 / (double)(m_rtTimePerFrame), m_bInterlaced ? L"I" : L"P", GetFrameTime() * 1000.0, GetFrameRate(), m_DetectedLock ? L" L" : L"", m_DetectedFrameTimeStdDev / 10000.0);
+ else
+ strText.Format(L"Frame rate : %7.03f (%.03f%s)", m_fAvrFps, GetFrameRate(), m_DetectedLock ? L" L" : L"");
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
- // === Jitter Graduation
- m_pLine->SetWidth(1.0); // Width
- for (int i=10; i<500; i+= 20)
+ if (bDetailedStats > 1)
{
- Points[0].x = (FLOAT)0;
- Points[0].y = (FLOAT)i;
- Points[1].x = (FLOAT)((i-10)%80 ? 50 : 625);
- Points[1].y = (FLOAT)i;
- if (i == 250) Points[1].x += 50;
- m_pLine->SetWidth(i == 250 ? 2.0F : 1.0F); // Width
- m_pLine->Begin();
- m_pLine->Draw (Points, 2, D3DCOLOR_XRGB(0,0,255));
- m_pLine->End();
+ strText.Format(L"Settings : ");
+
+ if (m_bIsEVR)
+ strText += "EVR ";
+ else
+ strText += "VMR9 ";
+
+ if (s.fD3DFullscreen)
+ strText += "FS ";
+ if (s.m_RenderSettings.iVMR9FullscreenGUISupport)
+ strText += "FSGui ";
+
+ if (s.m_RenderSettings.iVMRDisableDesktopComposition)
+ strText += "DisDC ";
+
+ if (s.m_RenderSettings.iVMRFlushGPUBeforeVSync)
+ strText += "GPUFlushBV ";
+ if (s.m_RenderSettings.iVMRFlushGPUAfterPresent)
+ strText += "GPUFlushAP ";
+
+ if (s.m_RenderSettings.iVMRFlushGPUWait)
+ strText += "GPUFlushWt ";
+
+ if (s.m_RenderSettings.iVMR9VSync)
+ strText += "VS ";
+ if (s.m_RenderSettings.fVMR9AlterativeVSync)
+ strText += "AltVS ";
+ if (s.m_RenderSettings.iVMR9VSyncAccurate)
+ strText += "AccVS ";
+ if (s.m_RenderSettings.iVMR9VSyncOffset)
+ strText.AppendFormat(L"VSOfst(%d)", s.m_RenderSettings.iVMR9VSyncOffset);
+
+ if (m_bIsEVR)
+ {
+ if (s.m_RenderSettings.iEVRHighColorResolution)
+ strText += "10bit ";
+ if (s.m_RenderSettings.iEVREnableFrameTimeCorrection)
+ strText += "FTC ";
+ if (s.m_RenderSettings.iEVROutputRange == 0)
+ strText += "0-255 ";
+ else if (s.m_RenderSettings.iEVROutputRange == 1)
+ strText += "16-235 ";
+ }
+
+
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+
}
- // === Jitter curve
- if (m_rtTimePerFrame)
+ if (bDetailedStats > 1)
{
- for (int i=0; i<NB_JITTER; i++)
+ strText.Format(L"Formats : Surface %s Backbuffer %s Display %s Device %s D3DExError: %s", GetD3DFormatStr(m_SurfaceType), GetD3DFormatStr(m_BackbufferType), GetD3DFormatStr(m_DisplayType), m_pD3DDevEx ? L"D3DDevEx" : L"D3DDev", m_D3DDevExError.GetString());
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+
+ if (m_bIsEVR)
{
- nIndex = (m_nNextJitter+i) % NB_JITTER;
- Points[i].x = (FLOAT)(i*5+5);
- Points[i].y = (FLOAT)(m_pllJitter[nIndex]/5000 + 250);
- llMaxJitter = max(llMaxJitter, m_pllJitter[nIndex]);
- llMinJitter = min(llMinJitter, m_pllJitter[nIndex]);
- }
- m_pLine->Begin();
- m_pLine->Draw (Points, NB_JITTER, D3DCOLOR_XRGB(255,0,0));
- m_pLine->End();
+ strText.Format(L"Refresh rate : %.05f Hz SL: %4d (%3d Hz) Last Duration: %10.6f Corrected Frame Time: %s", m_DetectedRefreshRate, int(m_DetectedScanlinesPerFrame + 0.5), m_RefreshRate, double(m_LastFrameDuration)/10000.0, m_bCorrectedFrameTime?L"Yes":L"No");
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
}
- // === Text
- CString strText;
+ if (m_bSyncStatsAvailable)
+ {
+ if (bDetailedStats > 1)
+ strText.Format(L"Sync offset : Min = %+8.3f ms, Max = %+8.3f ms, StdDev = %7.3f ms, Avr = %7.3f ms, Mode = %d", (double(llMinSyncOffset)/10000.0), (double(llMaxSyncOffset)/10000.0), m_fSyncOffsetStdDev/10000.0, m_fSyncOffsetAvr/10000.0, m_VSyncMode);
+ else
+ strText.Format(L"Sync offset : Mode = %d", m_VSyncMode);
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
+
+ if (bDetailedStats > 1)
+ {
+ strText.Format(L"Jitter : Min = %+8.3f ms, Max = %+8.3f ms, StdDev = %7.3f ms", (double(llMinJitter)/10000.0), (double(llMaxJitter)/10000.0), m_fJitterStdDev/10000.0);
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
+
+ if (m_pAllocator && bDetailedStats > 1)
+ {
+ CDX9SubPicAllocator *pAlloc = (CDX9SubPicAllocator *)m_pAllocator.p;
+ int nFree = 0;
+ int nAlloc = 0;
+ int nSubPic = 0;
+ REFERENCE_TIME QueueNow = 0;
+ REFERENCE_TIME QueueStart = 0;
+ REFERENCE_TIME QueueEnd = 0;
+ if (m_pSubPicQueue)
+ {
+ m_pSubPicQueue->GetStats(nSubPic, QueueNow, QueueStart, QueueEnd);
+ if (QueueStart)
+ QueueStart -= QueueNow;
+ if (QueueEnd)
+ QueueEnd -= QueueNow;
+ }
+ pAlloc->GetStats(nFree, nAlloc);
+ strText.Format(L"Subtitles : Free %d Allocated %d Buffered %d QueueStart %7.3f QueueEnd %7.3f", nFree, nAlloc, nSubPic, (double(QueueStart)/10000000.0), (double(QueueEnd)/10000000.0));
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
+
+ if (bDetailedStats > 1)
+ {
+ if (m_VBlankEndPresent == -100000)
+ strText.Format(L"VBlank Wait : Start %4d End %4d Wait %7.3f ms Offset %4d Max %4d", m_VBlankStartWait, m_VBlankEndWait, (double(m_VBlankWaitTime)/10000.0), m_VBlankMin, m_VBlankMax - m_VBlankMin);
+ else
+ strText.Format(L"VBlank Wait : Start %4d End %4d Wait %7.3f ms Offset %4d Max %4d EndPresent %4d", m_VBlankStartWait, m_VBlankEndWait, (double(m_VBlankWaitTime)/10000.0), m_VBlankMin, m_VBlankMax - m_VBlankMin, m_VBlankEndPresent);
+ }
+ else
+ {
+ if (m_VBlankEndPresent == -100000)
+ strText.Format(L"VBlank Wait : Start %4d End %4d", m_VBlankStartWait, m_VBlankEndWait);
+ else
+ strText.Format(L"VBlank Wait : Start %4d End %4d EP %4d", m_VBlankStartWait, m_VBlankEndWait, m_VBlankEndPresent);
+ }
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+
+ BOOL bCompositionEnabled = m_bCompositionEnabled;
- strText.Format(L"Frame rate : %.03f (%I64d µs)", m_fAvrFps, m_rtTimePerFrame / 10);
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ bool bDoVSyncInPresent = (!bCompositionEnabled && !m_bAlternativeVSync) || !s.m_RenderSettings.iVMR9VSync;
- OffsetRect (&rc, 0, 30);
- strText.Format(L"Refresh rate : %d Hz", m_RefreshRate);
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ if (bDetailedStats > 1 && bDoVSyncInPresent)
+ {
+ strText.Format(L"Present Wait : Wait %7.3f ms Min %7.3f ms Max %7.3f ms", (double(m_PresentWaitTime)/10000.0), (double(m_PresentWaitTimeMin)/10000.0), (double(m_PresentWaitTimeMax)/10000.0));
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
- OffsetRect (&rc, 0, 30);
- strText.Format(L"Buffer used : %d, free : %d", m_nUsedBuffer, m_nNbDXSurface - m_nUsedBuffer);
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ if (bDetailedStats > 1)
+ {
+ if (m_WaitForGPUTime)
+ strText.Format(L"Paint Time : Draw %7.3f ms Min %7.3f ms Max %7.3f ms GPU %7.3f ms", (double(m_PaintTime-m_WaitForGPUTime)/10000.0), (double(m_PaintTimeMin)/10000.0), (double(m_PaintTimeMax)/10000.0), (double(m_WaitForGPUTime)/10000.0));
+ else
+ strText.Format(L"Paint Time : Draw %7.3f ms Min %7.3f ms Max %7.3f ms", (double(m_PaintTime-m_WaitForGPUTime)/10000.0), (double(m_PaintTimeMin)/10000.0), (double(m_PaintTimeMax)/10000.0));
+ }
+ else
+ {
+ if (m_WaitForGPUTime)
+ strText.Format(L"Paint Time : Draw %7.3f ms GPU %7.3f ms", (double(m_PaintTime - m_WaitForGPUTime)/10000.0), (double(m_WaitForGPUTime)/10000.0));
+ else
+ strText.Format(L"Paint Time : Draw %7.3f ms", (double(m_PaintTime - m_WaitForGPUTime)/10000.0));
+ }
+ DrawText(rc, strText, 2);
+ OffsetRect (&rc, 0, TextHeight);
+
+ if (bDetailedStats > 1)
+ {
+ strText.Format(L"Raster Status: Wait %7.3f ms Min %7.3f ms Max %7.3f ms", (double(m_RasterStatusWaitTime)/10000.0), (double(m_RasterStatusWaitTimeMin)/10000.0), (double(m_RasterStatusWaitTimeMax)/10000.0));
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
- OffsetRect (&rc, 0, 30);
- strText.Format(L"Jitter : Min = %+6dµS, Max = %+6dµS", (long)(llMinJitter/10), (long)(llMaxJitter/10));
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ if (bDetailedStats > 1)
+ {
+ if (m_bIsEVR)
+ strText.Format(L"Buffering : Buffered %3d Free %3d Current Surface %3d", m_nUsedBuffer, m_nNbDXSurface - m_nUsedBuffer, m_nCurSurface, m_nVMR9Surfaces, m_iVMR9Surface);
+ else
+ strText.Format(L"Buffering : VMR9Surfaces %3d VMR9Surface %3d", m_nVMR9Surfaces, m_iVMR9Surface);
+ }
+ else
+ strText.Format(L"Buffered : %3d", m_nUsedBuffer);
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
- OffsetRect (&rc, 0, 30);
- strText.Format(L"Video size : %d x %d (AR = %d x %d)", m_NativeVideoSize.cx, m_NativeVideoSize.cy, m_AspectRatio.cx, m_AspectRatio.cy);
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ if (bDetailedStats > 1)
+ {
+ strText.Format(L"Video size : %d x %d (AR = %d x %d)", m_NativeVideoSize.cx, m_NativeVideoSize.cy, m_AspectRatio.cx, m_AspectRatio.cy);
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
- OffsetRect (&rc, 0, 30);
- strText.Format(L"DirectX SDK : %d", AfxGetMyApp()->GetDXSdkRelease());
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ strText.Format(L"%-13s: %s", GetDXVAVersion(), GetDXVADecoderDescription());
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
- OffsetRect (&rc, 0, 30);
- strText.Format(L"%s : %s", GetDXVAVersion(), GetDXVADecoderDescription());
- m_pFont->DrawText( NULL, strText, -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ strText.Format(L"DirectX SDK : %d", AfxGetMyApp()->GetDXSdkRelease());
+ DrawText(rc, strText, 1);
+ OffsetRect (&rc, 0, TextHeight);
- for (int i=0; i<6; i++)
+ for (int i=0; i<6; i++)
+ {
+ if (m_strStatsMsg[i][0])
+ {
+ DrawText(rc, m_strStatsMsg[i], 1);
+ OffsetRect (&rc, 0, TextHeight);
+ }
+ }
+ }
+ m_pSprite->End();
+ }
+
+ if (m_pLine && bDetailedStats)
+ {
+ D3DXVECTOR2 Points[NB_JITTER];
+ int nIndex;
+
+ int StartX = 0;
+ int StartY = 0;
+ int ScaleX = 1;
+ int ScaleY = 1;
+ int DrawWidth = 625 * ScaleX + 50;
+ int DrawHeight = 500 * ScaleY;
+ int Alpha = 80;
+ StartX = m_WindowRect.Width() - (DrawWidth + 20);
+ StartY = m_WindowRect.Height() - (DrawHeight + 20);
+
+ DrawRect(RGB(0,0,0), Alpha, CRect(StartX, StartY, StartX + DrawWidth, StartY + DrawHeight));
+ // === Jitter Graduation
+// m_pLine->SetWidth(2.2); // Width
+// m_pLine->SetAntialias(1);
+ m_pLine->SetWidth(2.5); // Width
+ m_pLine->SetAntialias(1);
+// m_pLine->SetGLLines(1);
+ m_pLine->Begin();
+
+ for (int i=10; i<500*ScaleY; i+= 20*ScaleY)
{
- OffsetRect (&rc, 0, 30);
- m_pFont->DrawText( NULL, m_strStatsMsg[i], -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ));
+ Points[0].x = (FLOAT)StartX;
+ Points[0].y = (FLOAT)(StartY + i);
+ Points[1].x = (FLOAT)(StartX + ((i-10)%80 ? 50 : 625 * ScaleX));
+ Points[1].y = (FLOAT)(StartY + i);
+ if (i == 250) Points[1].x += 50;
+ m_pLine->Draw (Points, 2, D3DCOLOR_XRGB(100,100,255));
}
+
+ // === Jitter curve
+ if (m_rtTimePerFrame)
+ {
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ nIndex = (m_nNextJitter+1+i) % NB_JITTER;
+ if (nIndex < 0)
+ nIndex += NB_JITTER;
+ double Jitter = m_pllJitter[nIndex] - m_fJitterMean;
+ Points[i].x = (FLOAT)(StartX + (i*5*ScaleX+5));
+ Points[i].y = (FLOAT)(StartY + ((Jitter*ScaleY)/5000.0 + 250.0* ScaleY));
+ }
+ m_pLine->Draw (Points, NB_JITTER, D3DCOLOR_XRGB(255,100,100));
+
+ if (m_bSyncStatsAvailable)
+ {
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ nIndex = (m_nNextSyncOffset+1+i) % NB_JITTER;
+ if (nIndex < 0)
+ nIndex += NB_JITTER;
+ Points[i].x = (FLOAT)(StartX + (i*5*ScaleX+5));
+ Points[i].y = (FLOAT)(StartY + ((m_pllSyncOffset[nIndex]*ScaleY)/5000 + 250*ScaleY));
+ }
+ m_pLine->Draw (Points, NB_JITTER, D3DCOLOR_XRGB(100,200,100));
+ }
+ }
+ m_pLine->End();
}
+
+ // === Text
+
}
STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
@@ -1276,11 +2899,22 @@ STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget)
{
- CAutoLock cAutoLock(this);
+ return SetPixelShader2(pSrcData, pTarget, false);
+}
+
+STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace)
+{
+ CAutoLock cRenderLock(&m_RenderLock);
+
+ CAtlList<CExternalPixelShader> *pPixelShaders;
+ if (bScreenSpace)
+ pPixelShaders = &m_pPixelShadersScreenSpace;
+ else
+ pPixelShaders = &m_pPixelShaders;
if(!pSrcData && !pTarget)
{
- m_pPixelShaders.RemoveAll();
+ pPixelShaders->RemoveAll();
m_pD3DDev->SetPixelShader(NULL);
return S_OK;
}
@@ -1288,14 +2922,19 @@ STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTar if(!pSrcData || !pTarget)
return E_INVALIDARG;
+ CExternalPixelShader Shader;
+ Shader.m_SourceData = pSrcData;
+ Shader.m_SourceTarget = pTarget;
+
CComPtr<IDirect3DPixelShader9> pPixelShader;
- HRESULT hr = m_pPSC->CompileShader(pSrcData, "main", pTarget, 0, &pPixelShader);
- if(FAILED(hr)) return hr;
+ HRESULT hr = Shader.Compile(m_pPSC);
+ if(FAILED(hr))
+ return hr;
- m_pPixelShaders.AddTail(pPixelShader);
+ pPixelShaders->AddTail(Shader);
- Paint(true);
+ Paint(false);
return S_OK;
}
@@ -1306,8 +2945,8 @@ STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTar #define MY_USER_ID 0x6ABE51
-CVMR9AllocatorPresenter::CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr)
- : CDX9AllocatorPresenter(hWnd, hr)
+CVMR9AllocatorPresenter::CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
+ : CDX9AllocatorPresenter(hWnd, hr, false, _Error)
, m_fUseInternalTimer(false)
, m_rtPrevStart(-1)
{
@@ -1324,16 +2963,20 @@ STDMETHODIMP CVMR9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, v __super::NonDelegatingQueryInterface(riid, ppv);
}
-HRESULT CVMR9AllocatorPresenter::CreateDevice()
+HRESULT CVMR9AllocatorPresenter::CreateDevice(CString &_Error)
{
- HRESULT hr = __super::CreateDevice();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::CreateDevice(_Error);
+ if(FAILED(hr))
+ return hr;
if(m_pIVMRSurfAllocNotify)
{
HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D));
if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor)))
+ {
+ _Error += L"m_pIVMRSurfAllocNotify->ChangeD3DDevice failed";
return(false);
+ }
}
return hr;
@@ -1342,6 +2985,7 @@ HRESULT CVMR9AllocatorPresenter::CreateDevice() void CVMR9AllocatorPresenter::DeleteSurfaces()
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
m_pSurfaces.RemoveAll();
@@ -1360,13 +3004,20 @@ class COuterVMR9 {
CComPtr<IUnknown> m_pVMR;
VMR9AlphaBitmap* m_pVMR9AlphaBitmap;
+ CDX9AllocatorPresenter *m_pAllocatorPresenter;
public:
- COuterVMR9(const TCHAR* pName, LPUNKNOWN pUnk, VMR9AlphaBitmap* pVMR9AlphaBitmap) : CUnknown(pName, pUnk)
+ COuterVMR9(const TCHAR* pName, LPUNKNOWN pUnk, VMR9AlphaBitmap* pVMR9AlphaBitmap, CDX9AllocatorPresenter *_pAllocatorPresenter) : CUnknown(pName, pUnk)
{
m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9, GetOwner());
m_pVMR9AlphaBitmap = pVMR9AlphaBitmap;
+ m_pAllocatorPresenter = _pAllocatorPresenter;
+ }
+
+ ~COuterVMR9()
+ {
+ m_pVMR = NULL;
}
DECLARE_IUNKNOWN;
@@ -1610,6 +3261,7 @@ public: STDMETHODIMP GetAlphaBitmapParameters(VMR9AlphaBitmap* pBmpParms)
{
CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
memcpy (pBmpParms, m_pVMR9AlphaBitmap, sizeof(VMR9AlphaBitmap));
return S_OK;
}
@@ -1617,16 +3269,20 @@ public: STDMETHODIMP SetAlphaBitmap(const VMR9AlphaBitmap* pBmpParms)
{
CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ m_pAllocatorPresenter->UpdateAlphaBitmap();
return S_OK;
}
STDMETHODIMP UpdateAlphaBitmapParameters(const VMR9AlphaBitmap* pBmpParms)
{
CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ m_pAllocatorPresenter->UpdateAlphaBitmap();
return S_OK;
}
};
@@ -1641,14 +3297,14 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) do
{
- CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
+ CMacrovisionKicker* pMK = DNew CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
- pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), pUnk, &m_VMR9AlphaBitmap));
+
+ COuterVMR9 *pOuter = DNew COuterVMR9(NAME("COuterVMR9"), pUnk, &m_VMR9AlphaBitmap, this);
+
+
+ pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)pOuter);
CComQIPtr<IBaseFilter> pBF = pUnk;
-/*
- CComQIPtr<IBaseFilter> pBF = (IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), NULL);
- if(!pBF) pBF.CoCreateInstance(CLSID_VideoMixingRenderer9);
-*/
CComPtr<IPin> pPin = GetFirstPin(pBF);
CComQIPtr<IMemInputPin> pMemInputPin = pPin;
@@ -1711,6 +3367,7 @@ STDMETHODIMP_(void) CVMR9AllocatorPresenter::SetTime(REFERENCE_TIME rtNow) STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers)
{
+
if(!lpAllocInfo || !lpNumBuffers)
return E_POINTER;
@@ -1723,6 +3380,15 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A DeleteSurfaces();
+ int nOriginal = *lpNumBuffers;
+
+ if (*lpNumBuffers == 1)
+ {
+ *lpNumBuffers = 4;
+ m_nVMR9Surfaces = 4;
+ }
+ else
+ m_nVMR9Surfaces = 0;
m_pSurfaces.SetCount(*lpNumBuffers);
int w = lpAllocInfo->dwWidth;
@@ -1736,6 +3402,8 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A hr = m_pIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &m_pSurfaces[0]);
if(FAILED(hr)) return hr;
+ m_pSurfaces.SetCount(*lpNumBuffers);
+
m_NativeVideoSize = m_AspectRatio = CSize(w, h);
int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy;
if(arx > 0 && ary > 0) m_AspectRatio.SetSize(arx, ary);
@@ -1755,6 +3423,11 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A hr = m_pD3DDev->ColorFill(m_pVideoSurface[m_nCurSurface], NULL, 0);
+ if (m_nVMR9Surfaces && m_nVMR9Surfaces != *lpNumBuffers)
+ m_nVMR9Surfaces = *lpNumBuffers;
+ *lpNumBuffers = min(nOriginal, *lpNumBuffers);
+ m_iVMR9Surface = 0;
+
return hr;
}
@@ -1772,9 +3445,19 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa if(SurfaceIndex >= m_pSurfaces.GetCount())
return E_FAIL;
- CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
- (*lplpSurface = m_pSurfaces[SurfaceIndex])->AddRef();
+ if (m_nVMR9Surfaces)
+ {
+ ++m_iVMR9Surface;
+ m_iVMR9Surface = m_iVMR9Surface % m_nVMR9Surfaces;
+ (*lplpSurface = m_pSurfaces[m_iVMR9Surface + SurfaceIndex])->AddRef();
+ }
+ else
+ {
+ m_iVMR9Surface = SurfaceIndex;
+ (*lplpSurface = m_pSurfaces[SurfaceIndex])->AddRef();
+ }
return S_OK;
}
@@ -1782,7 +3465,8 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9* lpIVMRSurfAllocNotify)
{
CAutoLock cAutoLock(this);
-
+ CAutoLock cRenderLock(&m_RenderLock);
+
m_pIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;
HRESULT hr;
@@ -1798,6 +3482,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9* STDMETHODIMP CVMR9AllocatorPresenter::StartPresenting(DWORD_PTR dwUserID)
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
ASSERT(m_pD3DDev);
@@ -1836,6 +3521,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese return E_POINTER;
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
CComPtr<IDirect3DTexture9> pTexture;
lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture);
@@ -1843,7 +3529,8 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese if(pTexture)
{
m_pVideoSurface[m_nCurSurface] = lpPresInfo->lpSurf;
- if(m_pVideoTexture[m_nCurSurface]) m_pVideoTexture[m_nCurSurface] = pTexture;
+ if(m_pVideoTexture[m_nCurSurface])
+ m_pVideoTexture[m_nCurSurface] = pTexture;
}
else
{
@@ -1939,8 +3626,8 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetBorderColor(COLORREF* lpClr) // CRM9AllocatorPresenter
//
-CRM9AllocatorPresenter::CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr)
- : CDX9AllocatorPresenter(hWnd, hr)
+CRM9AllocatorPresenter::CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
+ : CDX9AllocatorPresenter(hWnd, hr, false, _Error)
{
}
@@ -1956,6 +3643,7 @@ STDMETHODIMP CRM9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, vo HRESULT CRM9AllocatorPresenter::AllocSurfaces()
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
m_pVideoSurfaceOff = NULL;
m_pVideoSurfaceYUY2 = NULL;
@@ -1985,6 +3673,7 @@ HRESULT CRM9AllocatorPresenter::AllocSurfaces() void CRM9AllocatorPresenter::DeleteSurfaces()
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
m_pVideoSurfaceOff = NULL;
m_pVideoSurfaceYUY2 = NULL;
__super::DeleteSurfaces();
@@ -2127,6 +3816,7 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* STDMETHODIMP CRM9AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo)
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
if(FAILED(AllocSurfaces())) return E_FAIL;
@@ -2158,8 +3848,8 @@ STDMETHODIMP CRM9AllocatorPresenter::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE // CQT9AllocatorPresenter
//
-CQT9AllocatorPresenter::CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr)
- : CDX9AllocatorPresenter(hWnd, hr)
+CQT9AllocatorPresenter::CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
+ : CDX9AllocatorPresenter(hWnd, hr, false, _Error)
{
}
@@ -2198,6 +3888,7 @@ void CQT9AllocatorPresenter::DeleteSurfaces() STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm)
{
CAutoLock cAutoLock(this);
+ CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
if(FAILED(AllocSurfaces())) return E_FAIL;
@@ -2266,11 +3957,15 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) // CDXRAllocatorPresenter
//
-CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr)
- : ISubPicAllocatorPresenterImpl(hWnd, hr)
+CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) return;
+ if(FAILED(hr))
+ {
+ _Error += L"ISubPicAllocatorPresenterImpl failed\n";
+ return;
+ }
hr = S_OK;
}
@@ -2326,6 +4021,10 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) case 3: size.SetSize(640, 480); break;
case 4: size.SetSize(512, 384); break;
case 5: size.SetSize(384, 288); break;
+ case 6: size.SetSize(2560, 1600); break;
+ case 7: size.SetSize(1920, 1080); break;
+ case 8: size.SetSize(1320, 900); break;
+ case 9: size.SetSize(1280, 720); break;
}
if(m_pAllocator)
@@ -2334,7 +4033,7 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) }
else
{
- m_pAllocator = new CDX9SubPicAllocator(pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
if(!m_pAllocator)
return E_FAIL;
}
@@ -2342,8 +4041,8 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) HRESULT hr = S_OK;
m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
- ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
- : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ ? (ISubPicQueue*)DNew CSubPicQueue(AfxGetAppSettings().nSPCSize, AfxGetAppSettings().fSPCDisableAnim, m_pAllocator, &hr)
+ : (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
if(!m_pSubPicQueue || FAILED(hr))
return E_FAIL;
@@ -2376,7 +4075,7 @@ STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) CComQIPtr<ISubRender> pSR = m_pDXR;
if(!pSR) {m_pDXR = NULL; return E_FAIL;}
- m_pSRCB = new CSubRenderCallback(this);
+ m_pSRCB = DNew CSubRenderCallback(this);
if(FAILED(pSR->SetCallback(m_pSRCB))) {m_pDXR = NULL; return E_FAIL;}
(*ppRenderer = this)->AddRef();
diff --git a/src/apps/mplayerc/EVRAllocatorPresenter.cpp b/src/apps/mplayerc/EVRAllocatorPresenter.cpp index 06733070d..f3d93c042 100644 --- a/src/apps/mplayerc/EVRAllocatorPresenter.cpp +++ b/src/apps/mplayerc/EVRAllocatorPresenter.cpp @@ -53,8 +53,10 @@ #if (0) // Set to 1 to activate EVR traces
#define TRACE_EVR TRACE
+ #define TRACE_EVR2 TRACE
#else
#define TRACE_EVR
+ #define TRACE_EVR2 TRACE
#endif
typedef enum
@@ -109,22 +111,144 @@ MFVideoArea MakeArea(float x, float y, DWORD width, DWORD height) /// === Outer EVR
+class CEVRAllocatorPresenter;
+
class COuterEVR
: public CUnknown
, public IVMRffdshow9
, public IVMRMixerBitmap9
+ , public IBaseFilter
{
CComPtr<IUnknown> m_pEVR;
VMR9AlphaBitmap* m_pVMR9AlphaBitmap;
+ CEVRAllocatorPresenter *m_pAllocatorPresenter;
public:
- COuterEVR(const TCHAR* pName, LPUNKNOWN pUnk, HRESULT& hr, VMR9AlphaBitmap* pVMR9AlphaBitmap) : CUnknown(pName, pUnk)
+ // IBaseFilter
+ virtual HRESULT STDMETHODCALLTYPE EnumPins(__out IEnumPins **ppEnum)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->EnumPins(ppEnum);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, __out IPin **ppPin)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->FindPin(Id, ppPin);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE QueryFilterInfo(__out FILTER_INFO *pInfo)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->QueryFilterInfo(pInfo);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE JoinFilterGraph(__in_opt IFilterGraph *pGraph, __in_opt LPCWSTR pName)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->JoinFilterGraph(pGraph, pName);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE QueryVendorInfo(__out LPWSTR *pVendorInfo)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->QueryVendorInfo(pVendorInfo);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Stop( void)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->Stop();
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Pause( void)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->Pause();
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Run( REFERENCE_TIME tStart)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->Run(tStart);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE GetState( DWORD dwMilliSecsTimeout, __out FILTER_STATE *State);
+
+ virtual HRESULT STDMETHODCALLTYPE SetSyncSource(__in_opt IReferenceClock *pClock)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->SetSyncSource(pClock);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE GetSyncSource(__deref_out_opt IReferenceClock **pClock)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->GetSyncSource(pClock);
+ return E_NOTIMPL;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(__RPC__out CLSID *pClassID)
+ {
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->GetClassID(pClassID);
+ return E_NOTIMPL;
+ }
+
+ COuterEVR(const TCHAR* pName, LPUNKNOWN pUnk, HRESULT& hr, VMR9AlphaBitmap* pVMR9AlphaBitmap, CEVRAllocatorPresenter *pAllocatorPresenter) : CUnknown(pName, pUnk)
{
hr = m_pEVR.CoCreateInstance(CLSID_EnhancedVideoRenderer, GetOwner());
m_pVMR9AlphaBitmap = pVMR9AlphaBitmap;
+ m_pAllocatorPresenter = pAllocatorPresenter;
+
+
}
+ ~COuterEVR();
+
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
@@ -133,6 +257,24 @@ public: if(riid == __uuidof(IVMRMixerBitmap9))
return GetInterface((IVMRMixerBitmap9*)this, ppv);
+ if (riid == __uuidof(IBaseFilter))
+ {
+ return GetInterface((IBaseFilter*)this, ppv);
+ }
+
+ if (riid == __uuidof(IMediaFilter))
+ {
+ return GetInterface((IMediaFilter*)this, ppv);
+ }
+ if (riid == __uuidof(IPersist))
+ {
+ return GetInterface((IPersist*)this, ppv);
+ }
+ if (riid == __uuidof(IBaseFilter))
+ {
+ return GetInterface((IBaseFilter*)this, ppv);
+ }
+
hr = m_pEVR ? m_pEVR->QueryInterface(riid, ppv) : E_NOINTERFACE;
if(m_pEVR && FAILED(hr))
{
@@ -151,28 +293,11 @@ public: }
// IVMRMixerBitmap9
- STDMETHODIMP GetAlphaBitmapParameters(VMR9AlphaBitmap* pBmpParms)
- {
- CheckPointer(pBmpParms, E_POINTER);
- memcpy (pBmpParms, m_pVMR9AlphaBitmap, sizeof(VMR9AlphaBitmap));
- return S_OK;
- }
+ STDMETHODIMP GetAlphaBitmapParameters(VMR9AlphaBitmap* pBmpParms);
- STDMETHODIMP SetAlphaBitmap(const VMR9AlphaBitmap* pBmpParms)
- {
- CheckPointer(pBmpParms, E_POINTER);
- memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
- m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
- return S_OK;
- }
+ STDMETHODIMP SetAlphaBitmap(const VMR9AlphaBitmap* pBmpParms);
- STDMETHODIMP UpdateAlphaBitmapParameters(const VMR9AlphaBitmap* pBmpParms)
- {
- CheckPointer(pBmpParms, E_POINTER);
- memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
- m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
- return S_OK;
- }
+ STDMETHODIMP UpdateAlphaBitmapParameters(const VMR9AlphaBitmap* pBmpParms);
};
@@ -198,7 +323,7 @@ class CEVRAllocatorPresenter : */
{
public:
- CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr);
+ CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
~CEVRAllocatorPresenter(void);
DECLARE_IUNKNOWN;
@@ -217,6 +342,9 @@ public: STDMETHODIMP STDMETHODCALLTYPE OnClockRestart(/* [in] */ MFTIME hnsSystemTime);
STDMETHODIMP STDMETHODCALLTYPE OnClockSetRate(/* [in] */ MFTIME hnsSystemTime, /* [in] */ float flRate);
+ // IBaseFilter delegate
+ bool GetState( DWORD dwMilliSecsTimeout, FILTER_STATE *State, HRESULT &_ReturnValue);
+
// IQualProp (EVR statistics window)
STDMETHODIMP get_FramesDroppedInRenderer (int *pcFrames);
STDMETHODIMP get_FramesDrawn (int *pcFramesDrawn);
@@ -289,16 +417,26 @@ public: protected :
void OnResetDevice();
+ virtual void OnVBlankFinished(bool fAll, LONGLONG PerformanceCounter);
+
+ double m_ModeratedTime;
+ LONGLONG m_ModeratedTimeLast;
+ LONGLONG m_ModeratedClockLast;
+ LONGLONG m_ModeratedTimer;
+ MFCLOCK_STATE m_LastClockState;
+ LONGLONG GetClockTime(LONGLONG PerformanceCounter);
+
private :
typedef enum
{
- Started,
- Stopped,
- Paused,
- Shutdown
+ Started = State_Running,
+ Stopped = State_Stopped,
+ Paused = State_Paused,
+ Shutdown = State_Running + 1
} RENDER_STATE;
+ COuterEVR *m_pOuterEVR;
CComPtr<IMFClock> m_pClock;
CComPtr<IDirect3DDeviceManager9> m_pD3DManager;
CComPtr<IMFTransform> m_pMixer;
@@ -310,30 +448,54 @@ private : HANDLE m_hEvtQuit; // Stop rendering thread event
- HANDLE m_hEvtPresent; // Render next frame (cued order)
- HANDLE m_hEvtFrameTimer; // Render next frame (timer based)
+ bool m_bEvtQuit;
HANDLE m_hEvtFlush; // Discard all buffers
- HANDLE m_hSemPicture; // Indicate present of buffered frames
+ bool m_bEvtFlush;
bool m_fUseInternalTimer;
+ int32 m_LastSetOutputRange;
+ bool m_bPendingRenegotiate;
+ bool m_bPendingMediaFinished;
HANDLE m_hThread;
+ HANDLE m_hGetMixerThread;
RENDER_STATE m_nRenderState;
+ CCritSec m_SampleQueueLock;
+ CCritSec m_ImageProcessingLock;
+
CInterfaceList<IMFSample, &IID_IMFSample> m_FreeSamples;
CInterfaceList<IMFSample, &IID_IMFSample> m_ScheduledSamples;
+ IMFSample * m_pCurrentDisplaydSample;
bool m_bWaitingSample;
+ bool m_bLastSampleOffsetValid;
+ LONGLONG m_LastScheduledSampleTime;
+ double m_LastScheduledSampleTimeFP;
+ LONGLONG m_LastScheduledUncorrectedSampleTime;
+ LONGLONG m_MaxSampleDuration;
+ LONGLONG m_LastSampleOffset;
+ LONGLONG m_VSyncOffsetHistory[5];
+ LONGLONG m_LastPredictedSync;
+ int m_VSyncOffsetHistoryPos;
UINT m_nResetToken;
- UINT m_nStepCount;
+ int m_nStepCount;
+
+ bool m_bSignaledStarvation;
+ LONGLONG m_StarvationClock;
// Stats variable for IQualProp
UINT m_pcFrames;
+ UINT m_nDroppedUpdate;
UINT m_pcFramesDrawn; // Retrieves the number of frames drawn since streaming started
UINT m_piAvg;
UINT m_piDev;
- HRESULT GetImageFromMixer();
+
+ void GetMixerThread();
+ static DWORD WINAPI GetMixerThreadStatic(LPVOID lpParam);
+
+ bool GetImageFromMixer();
void RenderThread();
static DWORD WINAPI PresentThread(LPVOID lpParam);
void ResetStats();
@@ -345,10 +507,11 @@ private : void RemoveAllSamples();
HRESULT GetFreeSample(IMFSample** ppSample);
- HRESULT GetScheduledSample(IMFSample** ppSample);
+ HRESULT GetScheduledSample(IMFSample** ppSample, int &_Count);
void MoveToFreeList(IMFSample* pSample, bool bTail);
- void MoveToScheduledList(IMFSample* pSample);
+ void MoveToScheduledList(IMFSample* pSample, bool _bSorted);
void FlushSamples();
+ void FlushSamplesInternal();
// === Media type negociation functions
HRESULT RenegotiateMediaType();
@@ -361,6 +524,12 @@ private : PTR_MFCreateDXSurfaceBuffer pfMFCreateDXSurfaceBuffer;
PTR_MFCreateVideoSampleFromSurface pfMFCreateVideoSampleFromSurface;
PTR_MFCreateVideoMediaType pfMFCreateVideoMediaType;
+
+#if 0
+ HRESULT (__stdcall *pMFCreateMediaType)(__deref_out IMFMediaType** ppMFType);
+ HRESULT (__stdcall *pMFInitMediaTypeFromAMMediaType)(__in IMFMediaType *pMFType, __in const AM_MEDIA_TYPE *pAMType);
+ HRESULT (__stdcall *pMFInitAMMediaTypeFromMFMediaType)(__in IMFMediaType *pMFType, __in GUID guidFormatBlockType, __inout AM_MEDIA_TYPE *pAMType);
+#endif
PTR_AvSetMmThreadCharacteristicsW pfAvSetMmThreadCharacteristicsW;
PTR_AvSetMmThreadPriority pfAvSetMmThreadPriority;
@@ -368,43 +537,111 @@ private : };
+HRESULT STDMETHODCALLTYPE COuterEVR::GetState( DWORD dwMilliSecsTimeout, __out FILTER_STATE *State)
+{
+ HRESULT ReturnValue;
+ if (m_pAllocatorPresenter->GetState(dwMilliSecsTimeout, State, ReturnValue))
+ return ReturnValue;
+ CComPtr<IBaseFilter> pEVRBase;
+ if (m_pEVR)
+ m_pEVR->QueryInterface(&pEVRBase);
+ if (pEVRBase)
+ return pEVRBase->GetState(dwMilliSecsTimeout, State);
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP COuterEVR::GetAlphaBitmapParameters(VMR9AlphaBitmap* pBmpParms)
+{
+ CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
+ memcpy (pBmpParms, m_pVMR9AlphaBitmap, sizeof(VMR9AlphaBitmap));
+ return S_OK;
+}
+
+STDMETHODIMP COuterEVR::SetAlphaBitmap(const VMR9AlphaBitmap* pBmpParms)
+{
+ CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
+ memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
+ m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ m_pAllocatorPresenter->UpdateAlphaBitmap();
+ return S_OK;
+}
+
+STDMETHODIMP COuterEVR::UpdateAlphaBitmapParameters(const VMR9AlphaBitmap* pBmpParms)
+{
+ CheckPointer(pBmpParms, E_POINTER);
+ CAutoLock BitMapLock(&m_pAllocatorPresenter->m_VMR9AlphaBitmapLock);
+ memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
+ m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ m_pAllocatorPresenter->UpdateAlphaBitmap();
+ return S_OK;
+}
+
+COuterEVR::~COuterEVR()
+{
+}
+
+
+CString GetWindowsErrorMessage(HRESULT _Error, HMODULE _Module);
+
HRESULT CreateEVR(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP)
{
HRESULT hr = E_FAIL;
if (clsid == CLSID_EVRAllocatorPresenter)
{
- *ppAP = new CEVRAllocatorPresenter(hWnd, hr);
+ CString Error;
+ *ppAP = DNew CEVRAllocatorPresenter(hWnd, hr, Error);
(*ppAP)->AddRef();
if(FAILED(hr))
{
+ Error += L"\n";
+ Error += GetWindowsErrorMessage(hr, NULL);
+ MessageBox(hWnd, Error, L"Error creating EVR Custom renderer", MB_OK | MB_ICONERROR);
(*ppAP)->Release();
*ppAP = NULL;
}
+ else if (!Error.IsEmpty())
+ {
+ MessageBox(hWnd, Error, L"Warning creating EVR Custom renderer", MB_OK|MB_ICONWARNING);
+ }
}
return hr;
}
-CEVRAllocatorPresenter::CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr)
- : CDX9AllocatorPresenter(hWnd, hr)
+CEVRAllocatorPresenter::CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
+ : CDX9AllocatorPresenter(hWnd, hr, true, _Error)
{
HMODULE hLib;
AppSettings& s = AfxGetAppSettings();
- if (FAILED (hr)) return;
-
- // Load EVR specifics DLLs
- hLib = LoadLibrary (L"dxva2.dll");
- pfDXVA2CreateDirect3DDeviceManager9 = hLib ? (PTR_DXVA2CreateDirect3DDeviceManager9) GetProcAddress (hLib, "DXVA2CreateDirect3DDeviceManager9") : NULL;
m_nResetToken = 0;
m_hThread = INVALID_HANDLE_VALUE;
- m_hSemPicture = INVALID_HANDLE_VALUE;
- m_hEvtPresent = INVALID_HANDLE_VALUE;
- m_hEvtFrameTimer = INVALID_HANDLE_VALUE;
+ m_hGetMixerThread= INVALID_HANDLE_VALUE;
m_hEvtFlush = INVALID_HANDLE_VALUE;
m_hEvtQuit = INVALID_HANDLE_VALUE;
+ m_bEvtQuit = 0;
+ m_bEvtFlush = 0;
+ m_ModeratedTime = 0;
+ m_ModeratedTimeLast = -1;
+ m_ModeratedClockLast = -1;
+
+
+ m_bNeedPendingResetDevice = true;
+
+ if (FAILED (hr))
+ {
+ _Error += L"DX9AllocatorPresenter failed\n";
+
+ return;
+ }
+
+ // Load EVR specifics DLLs
+ hLib = LoadLibrary (L"dxva2.dll");
+ pfDXVA2CreateDirect3DDeviceManager9 = hLib ? (PTR_DXVA2CreateDirect3DDeviceManager9) GetProcAddress (hLib, "DXVA2CreateDirect3DDeviceManager9") : NULL;
// Load EVR functions
hLib = LoadLibrary (L"evr.dll");
@@ -414,10 +651,32 @@ CEVRAllocatorPresenter::CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr) if (!pfDXVA2CreateDirect3DDeviceManager9 || !pfMFCreateDXSurfaceBuffer || !pfMFCreateVideoSampleFromSurface || !pfMFCreateVideoMediaType)
{
+ if (!pfDXVA2CreateDirect3DDeviceManager9)
+ _Error += L"Could not find DXVA2CreateDirect3DDeviceManager9 (dxva2.dll)\n";
+ if (!pfMFCreateDXSurfaceBuffer)
+ _Error += L"Could not find MFCreateDXSurfaceBuffer (evr.dll)\n";
+ if (!pfMFCreateVideoSampleFromSurface)
+ _Error += L"Could not find MFCreateVideoSampleFromSurface (evr.dll)\n";
+ if (!pfMFCreateVideoMediaType)
+ _Error += L"Could not find MFCreateVideoMediaType (evr.dll)\n";
hr = E_FAIL;
return;
}
+ // Load mfplat fuctions
+#if 0
+ hLib = LoadLibrary (L"mfplat.dll");
+ (FARPROC &)pMFCreateMediaType = GetProcAddress(hLib, "MFCreateMediaType");
+ (FARPROC &)pMFInitMediaTypeFromAMMediaType = GetProcAddress(hLib, "MFInitMediaTypeFromAMMediaType");
+ (FARPROC &)pMFInitAMMediaTypeFromMFMediaType = GetProcAddress(hLib, "MFInitAMMediaTypeFromMFMediaType");
+
+ if (!pMFCreateMediaType || !pMFInitMediaTypeFromAMMediaType || !pMFInitAMMediaTypeFromMFMediaType)
+ {
+ hr = E_FAIL;
+ return;
+ }
+#endif
+
// Load Vista specifics DLLs
hLib = LoadLibrary (L"AVRT.dll");
pfAvSetMmThreadCharacteristicsW = hLib ? (PTR_AvSetMmThreadCharacteristicsW) GetProcAddress (hLib, "AvSetMmThreadCharacteristicsW") : NULL;
@@ -426,7 +685,16 @@ CEVRAllocatorPresenter::CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr) // Init DXVA manager
hr = pfDXVA2CreateDirect3DDeviceManager9(&m_nResetToken, &m_pD3DManager);
- if (SUCCEEDED (hr)) hr = m_pD3DManager->ResetDevice(m_pD3DDev, m_nResetToken);
+ if (SUCCEEDED (hr))
+ {
+ hr = m_pD3DManager->ResetDevice(m_pD3DDev, m_nResetToken);
+ if (!SUCCEEDED (hr))
+ {
+ _Error += L"m_pD3DManager->ResetDevice failed\n";
+ }
+ }
+ else
+ _Error += L"DXVA2CreateDirect3DDeviceManager9 failed\n";
CComPtr<IDirectXVideoDecoderService> pDecoderService;
HANDLE hDevice;
@@ -449,11 +717,25 @@ CEVRAllocatorPresenter::CEVRAllocatorPresenter(HWND hWnd, HRESULT& hr) ResetStats();
m_nRenderState = Shutdown;
m_fUseInternalTimer = false;
+ m_LastSetOutputRange = -1;
+ m_bPendingRenegotiate = false;
+ m_bPendingMediaFinished = false;
m_bWaitingSample = false;
+ m_pCurrentDisplaydSample = NULL;
m_nStepCount = 0;
m_dwVideoAspectRatioMode = MFVideoARMode_PreservePicture;
m_dwVideoRenderPrefs = (MFVideoRenderPrefs)0;
m_BorderColor = RGB (0,0,0);
+ m_bSignaledStarvation = false;
+ m_StarvationClock = 0;
+ m_pOuterEVR = NULL;
+ m_LastScheduledSampleTime = -1;
+ m_LastScheduledUncorrectedSampleTime = -1;
+ m_MaxSampleDuration = 0;
+ m_LastSampleOffset = 0;
+ ZeroMemory(m_VSyncOffsetHistory, sizeof(m_VSyncOffsetHistory));
+ m_VSyncOffsetHistoryPos = 0;
+ m_bLastSampleOffsetValid = false;
}
CEVRAllocatorPresenter::~CEVRAllocatorPresenter(void)
@@ -461,6 +743,7 @@ CEVRAllocatorPresenter::~CEVRAllocatorPresenter(void) StopWorkerThreads(); // If not already done...
m_pMediaType = NULL;
m_pClock = NULL;
+
m_pD3DManager = NULL;
}
@@ -468,6 +751,7 @@ CEVRAllocatorPresenter::~CEVRAllocatorPresenter(void) void CEVRAllocatorPresenter::ResetStats()
{
m_pcFrames = 0;
+ m_nDroppedUpdate = 0;
m_pcFramesDrawn = 0;
m_piAvg = 0;
m_piDev = 0;
@@ -494,12 +778,12 @@ void CEVRAllocatorPresenter::StartWorkerThreads() if (m_nRenderState == Shutdown)
{
m_hEvtQuit = CreateEvent (NULL, TRUE, FALSE, NULL);
- m_hEvtPresent = CreateEvent (NULL, FALSE, FALSE, NULL);
- m_hEvtFrameTimer= CreateEvent (NULL, FALSE, FALSE, NULL);
m_hEvtFlush = CreateEvent (NULL, TRUE, FALSE, NULL);
- m_hSemPicture = CreateSemaphore(NULL, 0, m_nNbDXSurface, NULL);
m_hThread = ::CreateThread(NULL, 0, PresentThread, (LPVOID)this, 0, &dwThreadId);
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL);
+ m_hGetMixerThread = ::CreateThread(NULL, 0, GetMixerThreadStatic, (LPVOID)this, 0, &dwThreadId);
+ SetThreadPriority(m_hGetMixerThread, THREAD_PRIORITY_HIGHEST);
m_nRenderState = Stopped;
TRACE_EVR ("Worker threads started...\n");
@@ -511,35 +795,54 @@ void CEVRAllocatorPresenter::StopWorkerThreads() if (m_nRenderState != Shutdown)
{
SetEvent (m_hEvtFlush);
+ m_bEvtFlush = true;
SetEvent (m_hEvtQuit);
+ m_bEvtQuit = true;
if ((m_hThread != INVALID_HANDLE_VALUE) && (WaitForSingleObject (m_hThread, 10000) == WAIT_TIMEOUT))
{
ASSERT (FALSE);
TerminateThread (m_hThread, 0xDEAD);
}
+ if ((m_hGetMixerThread != INVALID_HANDLE_VALUE) && (WaitForSingleObject (m_hGetMixerThread, 10000) == WAIT_TIMEOUT))
+ {
+ ASSERT (FALSE);
+ TerminateThread (m_hGetMixerThread, 0xDEAD);
+ }
if (m_hThread != INVALID_HANDLE_VALUE) CloseHandle (m_hThread);
- if (m_hSemPicture != INVALID_HANDLE_VALUE) CloseHandle (m_hSemPicture);
- if (m_hEvtPresent != INVALID_HANDLE_VALUE) CloseHandle (m_hEvtPresent);
- if (m_hEvtFrameTimer != INVALID_HANDLE_VALUE) CloseHandle (m_hEvtFrameTimer);
+ if (m_hGetMixerThread != INVALID_HANDLE_VALUE) CloseHandle (m_hGetMixerThread);
if (m_hEvtFlush != INVALID_HANDLE_VALUE) CloseHandle (m_hEvtFlush);
if (m_hEvtQuit != INVALID_HANDLE_VALUE) CloseHandle (m_hEvtQuit);
+ m_bEvtFlush = false;
+ m_bEvtQuit = false;
+
+
TRACE_EVR ("Worker threads stopped...\n");
}
m_nRenderState = Shutdown;
}
+
STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
+ CheckPointer(ppRenderer, E_POINTER);
+
+ *ppRenderer = NULL;
+
HRESULT hr = E_FAIL;
do
{
- CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
+ CMacrovisionKicker* pMK = DNew CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
- pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)new COuterEVR(NAME("COuterEVR"), pUnk, hr, &m_VMR9AlphaBitmap));
- CComQIPtr<IBaseFilter> pBF = pUnk;
+
+ COuterEVR *pOuterEVR = DNew COuterEVR(NAME("COuterEVR"), pUnk, hr, &m_VMR9AlphaBitmap, this);
+ m_pOuterEVR = pOuterEVR;
+
+ pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)pOuterEVR);
+ CComQIPtr<IBaseFilter> pBF = pUnk;
+
if (FAILED (hr)) break;
// Set EVR custom presenter
@@ -548,14 +851,19 @@ STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF;
hr = pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoRenderer, (void**)&pMFVR);
+
if(SUCCEEDED(hr)) hr = QueryInterface (__uuidof(IMFVideoPresenter), (void**)&pVP);
if(SUCCEEDED(hr)) hr = pMFVR->InitializeRenderer (NULL, pVP);
+#if 1
CComPtr<IPin> pPin = GetFirstPin(pBF);
CComQIPtr<IMemInputPin> pMemInputPin = pPin;
// No NewSegment : no chocolate :o)
m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
+#else
+ m_fUseInternalTimer = false;
+#endif
if(FAILED(hr))
*ppRenderer = NULL;
@@ -611,8 +919,9 @@ STDMETHODIMP CEVRAllocatorPresenter::OnClockStart(MFTIME hnsSystemTime, LONGLON {
m_nRenderState = Started;
- SetEvent(m_hEvtPresent);
TRACE_EVR ("OnClockStart hnsSystemTime = %I64d, llClockStartOffset = %I64d\n", hnsSystemTime, llClockStartOffset);
+ m_ModeratedTimeLast = -1;
+ m_ModeratedClockLast = -1;
return S_OK;
}
@@ -622,22 +931,27 @@ STDMETHODIMP CEVRAllocatorPresenter::OnClockStop(MFTIME hnsSystemTime) TRACE_EVR ("OnClockStop hnsSystemTime = %I64d\n", hnsSystemTime);
m_nRenderState = Stopped;
+ m_ModeratedClockLast = -1;
+ m_ModeratedTimeLast = -1;
return S_OK;
}
STDMETHODIMP CEVRAllocatorPresenter::OnClockPause(MFTIME hnsSystemTime)
{
TRACE_EVR ("OnClockPause hnsSystemTime = %I64d\n", hnsSystemTime);
- m_nRenderState = Paused;
-
+ if (!m_bSignaledStarvation)
+ m_nRenderState = Paused;
+ m_ModeratedTimeLast = -1;
+ m_ModeratedClockLast = -1;
return S_OK;
}
STDMETHODIMP CEVRAllocatorPresenter::OnClockRestart(MFTIME hnsSystemTime)
{
m_nRenderState = Started;
- SetEvent(m_hEvtPresent);
+ m_ModeratedTimeLast = -1;
+ m_ModeratedClockLast = -1;
TRACE_EVR ("OnClockRestart hnsSystemTime = %I64d\n", hnsSystemTime);
return S_OK;
@@ -650,6 +964,25 @@ STDMETHODIMP CEVRAllocatorPresenter::OnClockSetRate(MFTIME hnsSystemTime, float return E_NOTIMPL;
}
+// IBaseFilter delegate
+bool CEVRAllocatorPresenter::GetState( DWORD dwMilliSecsTimeout, FILTER_STATE *State, HRESULT &_ReturnValue)
+{
+ CAutoLock lock(&m_SampleQueueLock);
+
+ if (m_bSignaledStarvation)
+ {
+ int nSamples = max(m_nNbDXSurface / 2, 1);
+ if (m_ScheduledSamples.GetCount() < nSamples || m_LastSampleOffset < -m_rtTimePerFrame*2)
+ {
+ *State = (FILTER_STATE)Paused;
+ _ReturnValue = VFW_S_STATE_INTERMEDIATE;
+ return true;
+ }
+ m_bSignaledStarvation = false;
+ }
+ return false;
+}
+
// IQualProp
STDMETHODIMP CEVRAllocatorPresenter::get_FramesDroppedInRenderer(int *pcFrames)
{
@@ -668,17 +1001,17 @@ STDMETHODIMP CEVRAllocatorPresenter::get_AvgFrameRate(int *piAvgFrameRate) }
STDMETHODIMP CEVRAllocatorPresenter::get_Jitter(int *iJitter)
{
- *iJitter = (int)(m_pllJitter[m_nNextJitter]/5000);
+ *iJitter = (int)((m_fJitterStdDev/10000.0) + 0.5);
return S_OK;
}
STDMETHODIMP CEVRAllocatorPresenter::get_AvgSyncOffset(int *piAvg)
{
- *piAvg = m_piAvg;
+ *piAvg = (int)((m_fSyncOffsetAvr/10000.0) + 0.5);
return S_OK;
}
STDMETHODIMP CEVRAllocatorPresenter::get_DevSyncOffset(int *piDev)
{
- *piDev = m_piDev;
+ *piDev = (int)((m_fSyncOffsetStdDev/10000.0) + 0.5);
return S_OK;
}
@@ -803,7 +1136,6 @@ STDMETHODIMP CEVRAllocatorPresenter::ProcessMessage(MFVP_MESSAGE_TYPE eMessage, case MFVP_MESSAGE_BEGINSTREAMING : // The EVR switched from stopped to paused. The presenter should allocate resources
ResetStats();
TRACE_EVR ("MFVP_MESSAGE_BEGINSTREAMING\n");
- SetEvent(m_hEvtPresent);
break;
case MFVP_MESSAGE_CANCELSTEP : // Cancels a frame step
@@ -813,7 +1145,7 @@ STDMETHODIMP CEVRAllocatorPresenter::ProcessMessage(MFVP_MESSAGE_TYPE eMessage, case MFVP_MESSAGE_ENDOFSTREAM : // All input streams have ended.
TRACE_EVR ("MFVP_MESSAGE_ENDOFSTREAM\n");
- m_pSink->Notify (EC_COMPLETE, 0, 0);
+ m_bPendingMediaFinished = true;
break;
case MFVP_MESSAGE_ENDSTREAMING : // The EVR switched from running or paused to stopped. The presenter should free resources
@@ -822,9 +1154,9 @@ STDMETHODIMP CEVRAllocatorPresenter::ProcessMessage(MFVP_MESSAGE_TYPE eMessage, case MFVP_MESSAGE_FLUSH : // The presenter should discard any pending samples
SetEvent(m_hEvtFlush);
+ m_bEvtFlush = true;
TRACE_EVR ("MFVP_MESSAGE_FLUSH\n");
while (WaitForSingleObject(m_hEvtFlush, 1) == WAIT_OBJECT_0);
- SetEvent(m_hEvtPresent);
break;
case MFVP_MESSAGE_INVALIDATEMEDIATYPE : // The mixer's output format has changed. The EVR will initiate format negotiation, as described previously
@@ -834,11 +1166,13 @@ STDMETHODIMP CEVRAllocatorPresenter::ProcessMessage(MFVP_MESSAGE_TYPE eMessage, 3) The presenter sets the media type on the mixer's output stream.
4) The EVR sets the media type on the substreams.
*/
- RenegotiateMediaType();
+ m_bPendingRenegotiate = true;
+ while (*((volatile bool *)&m_bPendingRenegotiate))
+ Sleep(1);
break;
case MFVP_MESSAGE_PROCESSINPUTNOTIFY : // One input stream on the mixer has received a new sample
- GetImageFromMixer();
+// GetImageFromMixer();
break;
case MFVP_MESSAGE_STEP : // Requests a frame step.
@@ -865,15 +1199,18 @@ HRESULT CEVRAllocatorPresenter::IsMediaTypeSupported(IMFMediaType* pMixerType) CheckHR (pMixerType->GetUINT32 (MF_MT_INTERLACE_MODE, &nInterlaceMode));
- if ( (pAMMedia->majortype != MEDIATYPE_Video) ||
+/* if ( (pAMMedia->majortype != MEDIATYPE_Video) ||
(nInterlaceMode != MFVideoInterlace_Progressive) ||
( (pAMMedia->subtype != MEDIASUBTYPE_RGB32) && (pAMMedia->subtype != MEDIASUBTYPE_RGB24) &&
(pAMMedia->subtype != MEDIASUBTYPE_YUY2) && (pAMMedia->subtype != MEDIASUBTYPE_NV12) ) )
- hr = MF_E_INVALIDMEDIATYPE;
+ hr = MF_E_INVALIDMEDIATYPE;*/
+ if ( (pAMMedia->majortype != MEDIATYPE_Video))
+ hr = MF_E_INVALIDMEDIATYPE;
pMixerType->FreeRepresentation (FORMAT_VideoInfo2, (void*)pAMMedia);
return hr;
}
+
HRESULT CEVRAllocatorPresenter::CreateProposedOutputType(IMFMediaType* pMixerType, IMFMediaType** pType)
{
HRESULT hr;
@@ -882,11 +1219,37 @@ HRESULT CEVRAllocatorPresenter::CreateProposedOutputType(IMFMediaType* pMixerTyp MFVIDEOFORMAT* VideoFormat;
CheckHR (pMixerType->GetRepresentation (FORMAT_MFVideoFormat, (void**)&pAMMedia));
+
VideoFormat = (MFVIDEOFORMAT*)pAMMedia->pbFormat;
hr = pfMFCreateVideoMediaType (VideoFormat, &m_pMediaType);
- if (VideoFormat->videoInfo.FramesPerSecond.Numerator != 0)
- m_rtTimePerFrame = (20000000I64*VideoFormat->videoInfo.FramesPerSecond.Denominator)/VideoFormat->videoInfo.FramesPerSecond.Numerator;
+ if (0)
+ {
+ // This code doesn't work, use same method as VMR9 instead
+ if (VideoFormat->videoInfo.FramesPerSecond.Numerator != 0)
+ {
+ switch (VideoFormat->videoInfo.InterlaceMode)
+ {
+ case MFVideoInterlace_Progressive:
+ case MFVideoInterlace_MixedInterlaceOrProgressive:
+ default:
+ {
+ m_rtTimePerFrame = (10000000I64*VideoFormat->videoInfo.FramesPerSecond.Denominator)/VideoFormat->videoInfo.FramesPerSecond.Numerator;
+ m_bInterlaced = false;
+ }
+ break;
+ case MFVideoInterlace_FieldSingleUpper:
+ case MFVideoInterlace_FieldSingleLower:
+ case MFVideoInterlace_FieldInterleavedUpperFirst:
+ case MFVideoInterlace_FieldInterleavedLowerFirst:
+ {
+ m_rtTimePerFrame = (20000000I64*VideoFormat->videoInfo.FramesPerSecond.Denominator)/VideoFormat->videoInfo.FramesPerSecond.Numerator;
+ m_bInterlaced = true;
+ }
+ break;
+ }
+ }
+ }
m_AspectRatio.cx = VideoFormat->videoInfo.PixelAspectRatio.Numerator;
m_AspectRatio.cy = VideoFormat->videoInfo.PixelAspectRatio.Denominator;
@@ -899,12 +1262,58 @@ HRESULT CEVRAllocatorPresenter::CreateProposedOutputType(IMFMediaType* pMixerTyp m_pMediaType->SetUINT32 (MF_MT_PAN_SCAN_ENABLED, 0);
+ AppSettings& s = AfxGetAppSettings();
+
+#if 1
+ if (s.m_RenderSettings.iEVROutputRange == 1)
+ m_pMediaType->SetUINT32 (MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_16_235);
+ else
+ m_pMediaType->SetUINT32 (MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_0_255);
+
+// m_pMediaType->SetUINT32 (MF_MT_TRANSFER_FUNCTION, MFVideoTransFunc_10);
+
+#else
+
+ m_pMediaType->SetUINT32 (MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_0_255);
+ if (s.iEVROutputRange == 1)
+ m_pMediaType->SetUINT32 (MF_MT_YUV_MATRIX, MFVideoTransferMatrix_BT601);
+ else
+ m_pMediaType->SetUINT32 (MF_MT_YUV_MATRIX, MFVideoTransferMatrix_BT709);
+#endif
+
+
+ m_LastSetOutputRange = s.m_RenderSettings.iEVROutputRange;
+
i64Size.HighPart = m_AspectRatio.cx;
i64Size.LowPart = m_AspectRatio.cy;
m_pMediaType->SetUINT64 (MF_MT_PIXEL_ASPECT_RATIO, i64Size.QuadPart);
MFVideoArea Area = MakeArea (0, 0, VideoFormat->videoInfo.dwWidth, VideoFormat->videoInfo.dwHeight);
m_pMediaType->SetBlob(MF_MT_GEOMETRIC_APERTURE, (UINT8*)&Area, sizeof(MFVideoArea));
+
+ }
+
+ m_AspectRatio.cx *= VideoFormat->videoInfo.dwWidth;
+ m_AspectRatio.cy *= VideoFormat->videoInfo.dwHeight;
+
+ bool bDoneSomething = true;
+
+ while (bDoneSomething)
+ {
+ bDoneSomething = false;
+ INT MinNum = min(m_AspectRatio.cx, m_AspectRatio.cy);
+ INT i;
+ for (i = 2; i < MinNum+1; ++i)
+ {
+ if (m_AspectRatio.cx%i == 0 && m_AspectRatio.cy%i ==0)
+ break;
+ }
+ if (i != MinNum + 1)
+ {
+ m_AspectRatio.cx = m_AspectRatio.cx / i;
+ m_AspectRatio.cy = m_AspectRatio.cy / i;
+ bDoneSomething = true;
+ }
}
pMixerType->FreeRepresentation (FORMAT_MFVideoFormat, (void*)pAMMedia);
@@ -935,10 +1344,68 @@ HRESULT CEVRAllocatorPresenter::SetMediaType(IMFMediaType* pType) return hr;
}
+LONGLONG GetMediaTypeMerit(IMFMediaType *pMediaType)
+{
+ AM_MEDIA_TYPE* pAMMedia = NULL;
+ MFVIDEOFORMAT* VideoFormat;
+
+ HRESULT hr;
+ CheckHR (pMediaType->GetRepresentation (FORMAT_MFVideoFormat, (void**)&pAMMedia));
+ VideoFormat = (MFVIDEOFORMAT*)pAMMedia->pbFormat;
+
+ LONGLONG Merit = 0;
+ switch (VideoFormat->surfaceInfo.Format)
+ {
+ case FCC('NV12'): Merit = 90000000; break;
+ case FCC('YV12'): Merit = 80000000; break;
+ case FCC('YUY2'): Merit = 70000000; break;
+ case FCC('UYVY'): Merit = 60000000; break;
+
+ case D3DFMT_X8R8G8B8: // Never opt for RGB
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_R8G8B8:
+ case D3DFMT_R5G6B5:
+ Merit = 0;
+ break;
+ default: Merit = 1000; break;
+ }
+
+ pMediaType->FreeRepresentation (FORMAT_MFVideoFormat, (void*)pAMMedia);
+
+ return Merit;
+}
+
+
+
+typedef struct
+{
+ const int Format;
+ const LPCTSTR Description;
+} D3DFORMAT_TYPE;
+
+extern const D3DFORMAT_TYPE D3DFormatType[];
+
+LPCTSTR FindD3DFormat(const D3DFORMAT Format);
+
+LPCTSTR GetMediaTypeFormatDesc(IMFMediaType *pMediaType)
+{
+ AM_MEDIA_TYPE* pAMMedia = NULL;
+ MFVIDEOFORMAT* VideoFormat;
+
+ HRESULT hr;
+ hr = pMediaType->GetRepresentation (FORMAT_MFVideoFormat, (void**)&pAMMedia);
+ VideoFormat = (MFVIDEOFORMAT*)pAMMedia->pbFormat;
+
+ LPCTSTR Type = FindD3DFormat((D3DFORMAT)VideoFormat->surfaceInfo.Format);
+
+ pMediaType->FreeRepresentation (FORMAT_MFVideoFormat, (void*)pAMMedia);
+
+ return Type;
+}
+
HRESULT CEVRAllocatorPresenter::RenegotiateMediaType()
{
HRESULT hr = S_OK;
- BOOL fFoundMediaType = FALSE;
CComPtr<IMFMediaType> pMixerType;
CComPtr<IMFMediaType> pType;
@@ -948,9 +1415,11 @@ HRESULT CEVRAllocatorPresenter::RenegotiateMediaType() return MF_E_INVALIDREQUEST;
}
+ CInterfaceArray<IMFMediaType> ValidMixerTypes;
+
// Loop through all of the mixer's proposed output types.
DWORD iTypeIndex = 0;
- while (!fFoundMediaType && (hr != MF_E_NO_MORE_TYPES))
+ while ((hr != MF_E_NO_MORE_TYPES))
{
pMixerType = NULL;
pType = NULL;
@@ -965,27 +1434,56 @@ HRESULT CEVRAllocatorPresenter::RenegotiateMediaType() // Step 2. Check if we support this media type.
if (SUCCEEDED(hr))
- {
hr = IsMediaTypeSupported(pMixerType);
- }
- // Step 3. Adjust the mixer's type to match our requirements.
if (SUCCEEDED(hr))
- {
- hr = CreateProposedOutputType(pMixerType, &pType);
- }
-
+ hr = CreateProposedOutputType(pMixerType, &pType);
+
// Step 4. Check if the mixer will accept this media type.
if (SUCCEEDED(hr))
- {
hr = m_pMixer->SetOutputType(0, pType, MFT_SET_TYPE_TEST_ONLY);
- }
- // Step 5. Try to set the media type on ourselves.
if (SUCCEEDED(hr))
- {
- hr = SetMediaType(pType);
- }
+ {
+ LONGLONG Merit = GetMediaTypeMerit(pType);
+
+ int nTypes = ValidMixerTypes.GetCount();
+ int iInsertPos = 0;
+ for (int i = 0; i < nTypes; ++i)
+ {
+ LONGLONG ThisMerit = GetMediaTypeMerit(ValidMixerTypes[i]);
+ if (Merit > ThisMerit)
+ {
+ iInsertPos = i;
+ break;
+ }
+ else
+ iInsertPos = i+1;
+ }
+
+ ValidMixerTypes.InsertAt(iInsertPos, pType);
+ }
+ }
+
+
+ int nValidTypes = ValidMixerTypes.GetCount();
+ for (int i = 0; i < nValidTypes; ++i)
+ {
+ // Step 3. Adjust the mixer's type to match our requirements.
+ pType = ValidMixerTypes[i];
+ TRACE("Valid mixer output type: %ws\n", GetMediaTypeFormatDesc(pType));
+ }
+
+ for (int i = 0; i < nValidTypes; ++i)
+ {
+ // Step 3. Adjust the mixer's type to match our requirements.
+ pType = ValidMixerTypes[i];
+
+
+ TRACE("Trying mixer output type: %ws\n", GetMediaTypeFormatDesc(pType));
+
+ // Step 5. Try to set the media type on ourselves.
+ hr = SetMediaType(pType);
// Step 6. Set output media type on mixer.
if (SUCCEEDED(hr))
@@ -997,13 +1495,10 @@ HRESULT CEVRAllocatorPresenter::RenegotiateMediaType() {
SetMediaType(NULL);
}
+ else
+ break;
}
-
- if (SUCCEEDED(hr))
- {
- fFoundMediaType = TRUE;
- }
- }
+ }
pMixerType = NULL;
pType = NULL;
@@ -1011,18 +1506,19 @@ HRESULT CEVRAllocatorPresenter::RenegotiateMediaType() }
-HRESULT CEVRAllocatorPresenter::GetImageFromMixer()
+bool CEVRAllocatorPresenter::GetImageFromMixer()
{
MFT_OUTPUT_DATA_BUFFER Buffer;
HRESULT hr = S_OK;
DWORD dwStatus;
REFERENCE_TIME nsSampleTime;
- MFTIME nsCurrentTime;
LONGLONG llClockBefore = 0;
LONGLONG llClockAfter = 0;
LONGLONG llMixerLatency;
UINT dwSurface;
+ bool bDoneSomething = false;
+
while (SUCCEEDED(hr))
{
CComPtr<IMFSample> pSample;
@@ -1037,9 +1533,9 @@ HRESULT CEVRAllocatorPresenter::GetImageFromMixer() Buffer.pSample = pSample;
pSample->GetUINT32 (GUID_SURFACE_INDEX, &dwSurface);
- if (m_pClock) m_pClock->GetCorrelatedTime(0, &llClockBefore, &nsCurrentTime);
+ llClockBefore = AfxGetMyApp()->GetPerfCounter();
hr = m_pMixer->ProcessOutput (0 , 1, &Buffer, &dwStatus);
- if (m_pClock) m_pClock->GetCorrelatedTime(0, &llClockAfter, &nsCurrentTime);
+ llClockAfter = AfxGetMyApp()->GetPerfCounter();
if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT)
{
@@ -1049,21 +1545,21 @@ HRESULT CEVRAllocatorPresenter::GetImageFromMixer() if (m_pSink)
{
- CAutoLock autolock(this);
+ //CAutoLock autolock(this); We shouldn't need to lock here, m_pSink is thread safe
llMixerLatency = llClockAfter - llClockBefore;
m_pSink->Notify (EC_PROCESSING_LATENCY, (LONG_PTR)&llMixerLatency, 0);
}
pSample->GetSampleTime (&nsSampleTime);
+ REFERENCE_TIME nsDuration;
+ pSample->GetSampleDuration (&nsDuration);
// Update internal subtitle clock
if(m_fUseInternalTimer && m_pSubPicQueue)
{
- MFTIME nsDuration;
- float m_fps;
- pSample->GetSampleDuration(&nsDuration);
m_fps = (float)(10000000.0 / nsDuration);
- m_pSubPicQueue->SetFPS(m_fps);
+// m_fps = 10000000.0 / (double)(m_rtTimePerFrame);
+ m_pSubPicQueue->SetFPS(23.976);
}
if (AfxGetMyApp()->m_fTearingTest)
@@ -1082,14 +1578,16 @@ HRESULT CEVRAllocatorPresenter::GetImageFromMixer() m_nTearingPos = (m_nTearingPos + 7) % m_NativeVideoSize.cx;
}
- TRACE_EVR ("Get from Mixer : %d (%I64d)\n", dwSurface, nsSampleTime);
+ LONGLONG TimePerFrame = m_rtTimePerFrame;
+ TRACE_EVR ("Get from Mixer : %d (%I64d) (%I64d)\n", dwSurface, nsSampleTime, nsSampleTime/TimePerFrame);
- MoveToScheduledList (pSample);
- ReleaseSemaphore (m_hSemPicture, 1, NULL);
- InterlockedIncrement (&m_nUsedBuffer);
+ MoveToScheduledList (pSample, false);
+ bDoneSomething = true;
+ if (m_rtTimePerFrame == 0)
+ break;
}
- return hr;
+ return bDoneSomething;
}
@@ -1128,6 +1626,7 @@ STDMETHODIMP CEVRAllocatorPresenter::InitServicePointers(/* [in] */ __in IMFTop hr = pLookup->LookupService (MF_SERVICE_LOOKUP_GLOBAL, 0, MR_VIDEO_RENDER_SERVICE,
__uuidof (IMFClock ), (void**)&m_pClock, &dwObjects);
+
StartWorkerThreads();
return S_OK;
}
@@ -1392,7 +1891,11 @@ STDMETHODIMP CEVRAllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpH STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(AM_MEDIA_TYPE* pMediaType)
{
HRESULT hr;
+ CAutoLock lock(this);
+ CAutoLock lock2(&m_ImageProcessingLock);
+ CAutoLock cRenderLock(&m_RenderLock);
+ RemoveAllSamples();
DeleteSurfaces();
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*) pMediaType->pbFormat;
@@ -1400,10 +1903,12 @@ STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(AM_MEDIA_TYPE* pMediaType) int h = abs(vih2->bmiHeader.biHeight);
m_NativeVideoSize = CSize(w, h);
- hr = AllocSurfaces(D3DFMT_X8R8G8B8);
+ if (m_bHighColorResolution)
+ hr = AllocSurfaces(D3DFMT_A2R10G10B10);
+ else
+ hr = AllocSurfaces(D3DFMT_X8R8G8B8);
+
- CAutoLock lock(this);
- RemoveAllSamples();
for(int i = 0; i < m_nNbDXSurface; i++)
{
CComPtr<IMFSample> pMFSample;
@@ -1422,6 +1927,13 @@ STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(AM_MEDIA_TYPE* pMediaType) }
+DWORD WINAPI CEVRAllocatorPresenter::GetMixerThreadStatic(LPVOID lpParam)
+{
+ CEVRAllocatorPresenter* pThis = (CEVRAllocatorPresenter*) lpParam;
+ pThis->GetMixerThread();
+ return 0;
+}
+
DWORD WINAPI CEVRAllocatorPresenter::PresentThread(LPVOID lpParam)
{
@@ -1436,29 +1948,353 @@ void CEVRAllocatorPresenter::CheckWaitingSampleFromMixer() if (m_bWaitingSample)
{
m_bWaitingSample = false;
- GetImageFromMixer();
+ //GetImageFromMixer(); // Do this in processing thread instead
+ }
+}
+
+
+bool ExtractInterlaced(const AM_MEDIA_TYPE* pmt)
+{
+ if (pmt->formattype==FORMAT_VideoInfo)
+ return false;
+ else if (pmt->formattype==FORMAT_VideoInfo2)
+ return (((VIDEOINFOHEADER2*)pmt->pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced) != 0;
+ else if (pmt->formattype==FORMAT_MPEGVideo)
+ return false;
+ else if (pmt->formattype==FORMAT_MPEG2Video)
+ return (((MPEG2VIDEOINFO*)pmt->pbFormat)->hdr.dwInterlaceFlags & AMINTERLACE_IsInterlaced) != 0;
+ else
+ return false;
+}
+
+
+void CEVRAllocatorPresenter::GetMixerThread()
+{
+ HANDLE hAvrt;
+ HANDLE hEvts[] = { m_hEvtQuit};
+ bool bQuit = false;
+ TIMECAPS tc;
+ DWORD dwResolution;
+ DWORD dwUser = 0;
+ DWORD dwTaskIndex = 0;
+
+ // Tell Vista Multimedia Class Scheduler we are a playback thretad (increase priority)
+// if (pfAvSetMmThreadCharacteristicsW)
+// hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
+// if (pfAvSetMmThreadPriority)
+// pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH /*AVRT_PRIORITY_CRITICAL*/);
+
+ timeGetDevCaps(&tc, sizeof(TIMECAPS));
+ dwResolution = min(max(tc.wPeriodMin, 0), tc.wPeriodMax);
+ dwUser = timeBeginPeriod(dwResolution);
+
+ while (!bQuit)
+ {
+ DWORD dwObject = WaitForMultipleObjects (countof(hEvts), hEvts, FALSE, 1);
+ switch (dwObject)
+ {
+ case WAIT_OBJECT_0 :
+ bQuit = true;
+ break;
+ case WAIT_TIMEOUT :
+ {
+ bool bDoneSomething = false;
+ {
+ CAutoLock AutoLock(&m_ImageProcessingLock);
+ bDoneSomething = GetImageFromMixer();
+ }
+ if (m_rtTimePerFrame == 0 && bDoneSomething)
+ {
+ //CAutoLock lock(this);
+ //CAutoLock lock2(&m_ImageProcessingLock);
+ //CAutoLock cRenderLock(&m_RenderLock);
+
+ // Use the code from VMR9 to get the movie fps, as this method is reliable.
+ CComPtr<IPin> pPin;
+ CMediaType mt;
+ if (
+ SUCCEEDED (m_pOuterEVR->FindPin(L"EVR Input0", &pPin)) &&
+ SUCCEEDED (pPin->ConnectionMediaType(&mt)) )
+ {
+ ExtractAvgTimePerFrame (&mt, m_rtTimePerFrame);
+
+ m_bInterlaced = ExtractInterlaced(&mt);
+
+ }
+ // If framerate not set by Video Decoder choose 23.97...
+ if (m_rtTimePerFrame == 0)
+ m_rtTimePerFrame = 417166;
+ }
+
+ }
+ break;
+ }
}
+
+ timeEndPeriod (dwResolution);
+// if (pfAvRevertMmThreadCharacteristics) pfAvRevertMmThreadCharacteristics (hAvrt);
}
+void ModerateFloat(double& Value, double Target, double& ValuePrim, double ChangeSpeed)
+{
+ double xbiss = (-(ChangeSpeed)*(ValuePrim) - (Value-Target)*(ChangeSpeed*ChangeSpeed)*0.25f);
+ ValuePrim += xbiss;
+ Value += ValuePrim;
+}
+
+LONGLONG CEVRAllocatorPresenter::GetClockTime(LONGLONG PerformanceCounter)
+{
+ LONGLONG llClockTime;
+ MFTIME nsCurrentTime;
+ m_pClock->GetCorrelatedTime(0, &llClockTime, &nsCurrentTime);
+ DWORD Characteristics = 0;
+ m_pClock->GetClockCharacteristics(&Characteristics);
+ MFCLOCK_STATE State;
+ m_pClock->GetState(0, &State);
+
+ if (!(Characteristics & MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ))
+ {
+ MFCLOCK_PROPERTIES Props;
+ if (m_pClock->GetProperties(&Props) == S_OK)
+ llClockTime = (llClockTime * 10000000) / Props.qwClockFrequency; // Make 10 MHz
+
+ }
+ LONGLONG llPerf = PerformanceCounter;
+// return llClockTime + (llPerf - nsCurrentTime);
+ double Target = llClockTime + (llPerf - nsCurrentTime) * m_ModeratedTimeSpeed;
+
+ bool bReset = false;
+ if (m_ModeratedTimeLast < 0 || State != m_LastClockState || m_ModeratedClockLast < 0)
+ {
+ bReset = true;
+ m_ModeratedTimeLast = llPerf;
+ m_ModeratedClockLast = llClockTime;
+ }
+
+ m_LastClockState = State;
+
+ double TimeChange = llPerf - m_ModeratedTimeLast;
+ double ClockChange = llClockTime - m_ModeratedClockLast;
+
+ m_ModeratedTimeLast = llPerf;
+ m_ModeratedClockLast = llClockTime;
+
+#if 1
+
+ if (bReset)
+ {
+ m_ModeratedTimeSpeed = 1.0;
+ m_ModeratedTimeSpeedPrim = 0.0;
+ ZeroMemory(m_TimeChangeHisotry, sizeof(m_TimeChangeHisotry));
+ ZeroMemory(m_ClockChangeHisotry, sizeof(m_ClockChangeHisotry));
+ m_ClockTimeChangeHistoryPos = 0;
+ }
+ if (TimeChange)
+ {
+ int Pos = m_ClockTimeChangeHistoryPos % 100;
+ int nHistory = min(m_ClockTimeChangeHistoryPos, 100);
+ ++m_ClockTimeChangeHistoryPos;
+ if (nHistory > 50)
+ {
+ int iLastPos = (Pos - (nHistory)) % 100;
+ if (iLastPos < 0)
+ iLastPos += 100;
+
+ double TimeChange = llPerf - m_TimeChangeHisotry[iLastPos];
+ double ClockChange = llClockTime - m_ClockChangeHisotry[iLastPos];
+
+ double ClockSpeedTarget = ClockChange / TimeChange;
+ double ChangeSpeed = 0.1;
+ if (ClockSpeedTarget > m_ModeratedTimeSpeed)
+ {
+ if (ClockSpeedTarget / m_ModeratedTimeSpeed > 0.1)
+ ChangeSpeed = 0.1;
+ else
+ ChangeSpeed = 0.01;
+ }
+ else
+ {
+ if (m_ModeratedTimeSpeed / ClockSpeedTarget > 0.1)
+ ChangeSpeed = 0.1;
+ else
+ ChangeSpeed = 0.01;
+ }
+ ModerateFloat(m_ModeratedTimeSpeed, ClockSpeedTarget, m_ModeratedTimeSpeedPrim, ChangeSpeed);
+// m_ModeratedTimeSpeed = TimeChange / ClockChange;
+ }
+ m_TimeChangeHisotry[Pos] = llPerf;
+ m_ClockChangeHisotry[Pos] = llClockTime;
+ }
+
+ return Target;
+#else
+ double EstimateTime = m_ModeratedTime + TimeChange * m_ModeratedTimeSpeed + m_ClockDiffCalc;
+ double Diff = Target - EstimateTime;
+
+ // > 5 ms just set it
+ if ((fabs(Diff) > 50000.0 || bReset))
+ {
+
+// TRACE("Reset clock at diff: %f ms\n", (m_ModeratedTime - Target) /10000.0);
+ if (State == MFCLOCK_STATE_RUNNING)
+ {
+ if (bReset)
+ {
+ m_ModeratedTimeSpeed = 1.0;
+ m_ModeratedTimeSpeedPrim = 0.0;
+ m_ClockDiffCalc = 0;
+ m_ClockDiffPrim = 0;
+ m_ModeratedTime = Target;
+ m_ModeratedTimer = llPerf;
+ }
+ else
+ {
+ EstimateTime = m_ModeratedTime + TimeChange * m_ModeratedTimeSpeed;
+ Diff = Target - EstimateTime;
+ m_ClockDiffCalc = Diff;
+ m_ClockDiffPrim = 0;
+ }
+ }
+ else
+ {
+ m_ModeratedTimeSpeed = 0.0;
+ m_ModeratedTimeSpeedPrim = 0.0;
+ m_ClockDiffCalc = 0;
+ m_ClockDiffPrim = 0;
+ m_ModeratedTime = Target;
+ m_ModeratedTimer = llPerf;
+ }
+ }
+
+ {
+ LONGLONG ModerateTime = 10000;
+ double ChangeSpeed = 1.00;
+/* if (m_ModeratedTimeSpeedPrim != 0.0)
+ {
+ if (m_ModeratedTimeSpeedPrim < 0.1)
+ ChangeSpeed = 0.1;
+ }*/
+
+ int nModerate = 0;
+ double Change = 0;
+ while (m_ModeratedTimer < llPerf - ModerateTime)
+ {
+ m_ModeratedTimer += ModerateTime;
+ m_ModeratedTime += double(ModerateTime) * m_ModeratedTimeSpeed;
+
+ double TimerDiff = llPerf - m_ModeratedTimer;
+
+ double Diff = (double)(m_ModeratedTime - (Target - TimerDiff));
+
+ double TimeSpeedTarget;
+ double AbsDiff = fabs(Diff);
+ TimeSpeedTarget = 1.0 - (Diff / 1000000.0);
+// TimeSpeedTarget = m_ModeratedTimeSpeed - (Diff / 100000000000.0);
+ //if (AbsDiff > 20000.0)
+// TimeSpeedTarget = 1.0 - (Diff / 1000000.0);
+ /*else if (AbsDiff > 5000.0)
+ TimeSpeedTarget = 1.0 - (Diff / 100000000.0);
+ else
+ TimeSpeedTarget = 1.0 - (Diff / 500000000.0);*/
+ double StartMod = m_ModeratedTimeSpeed;
+ ModerateFloat(m_ModeratedTimeSpeed, TimeSpeedTarget, m_ModeratedTimeSpeedPrim, ChangeSpeed);
+ m_ModeratedTimeSpeed = TimeSpeedTarget;
+ ++nModerate;
+ Change += m_ModeratedTimeSpeed - StartMod;
+ }
+ if (nModerate)
+ m_ModeratedTimeSpeedDiff = Change / nModerate;
+
+ double Ret = m_ModeratedTime + double(llPerf - m_ModeratedTimer) * m_ModeratedTimeSpeed;
+ double Diff = Target - Ret;
+ ModerateFloat(m_ClockDiffCalc, Diff, m_ClockDiffPrim, ChangeSpeed*0.1);
+
+ Ret += m_ClockDiffCalc;
+ Diff = Target - Ret;
+ m_ClockDiff = Diff;
+ return LONGLONG(Ret + 0.5);
+ }
+
+ return Target;
+ return LONGLONG(m_ModeratedTime + 0.5);
+#endif
+}
+
+void CEVRAllocatorPresenter::OnVBlankFinished(bool fAll, LONGLONG PerformanceCounter)
+{
+ if (!m_pCurrentDisplaydSample || !m_OrderedPaint || !fAll)
+ return;
+
+ LONGLONG llClockTime;
+ LONGLONG nsSampleTime;
+ LONGLONG SampleDuration = 0;
+ if (!m_bSignaledStarvation)
+ {
+ llClockTime = GetClockTime(PerformanceCounter);
+ m_StarvationClock = llClockTime;
+ }
+ else
+ {
+ llClockTime = m_StarvationClock;
+ }
+ m_pCurrentDisplaydSample->GetSampleDuration(&SampleDuration);
+
+ m_pCurrentDisplaydSample->GetSampleTime(&nsSampleTime);
+ LONGLONG TimePerFrame = m_rtTimePerFrame;
+ if (!TimePerFrame)
+ return;
+ if (SampleDuration > 1)
+ TimePerFrame = SampleDuration;
+
+ {
+ m_nNextSyncOffset = (m_nNextSyncOffset+1) % NB_JITTER;
+ LONGLONG SyncOffset = nsSampleTime - llClockTime;
+
+ m_pllSyncOffset[m_nNextSyncOffset] = SyncOffset;
+// TRACE("SyncOffset(%d, %d): %8I64d %8I64d %8I64d \n", m_nCurSurface, m_VSyncMode, m_LastPredictedSync, -SyncOffset, m_LastPredictedSync - (-SyncOffset));
+
+ m_MaxSyncOffset = MINLONG64;
+ m_MinSyncOffset = MAXLONG64;
+
+ LONGLONG AvrageSum = 0;
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ LONGLONG Offset = m_pllSyncOffset[i];
+ AvrageSum += Offset;
+ m_MaxSyncOffset = max(m_MaxSyncOffset, Offset);
+ m_MinSyncOffset = min(m_MinSyncOffset, Offset);
+ }
+ double MeanOffset = double(AvrageSum)/NB_JITTER;
+ double DeviationSum = 0;
+ for (int i=0; i<NB_JITTER; i++)
+ {
+ double Deviation = double(m_pllSyncOffset[i]) - MeanOffset;
+ DeviationSum += Deviation*Deviation;
+ }
+ double StdDev = sqrt(DeviationSum/NB_JITTER);
+
+ m_fSyncOffsetAvr = MeanOffset;
+ m_bSyncStatsAvailable = true;
+ m_fSyncOffsetStdDev = StdDev;
+
+
+ }
+}
void CEVRAllocatorPresenter::RenderThread()
{
HANDLE hAvrt;
DWORD dwTaskIndex = 0;
- HANDLE hEvts[] = { m_hEvtQuit, m_hEvtFlush, m_hEvtPresent, m_hEvtFrameTimer};
- HANDLE hEvtsBuff[] = { m_hEvtQuit, m_hEvtFlush, m_hSemPicture };
+ HANDLE hEvts[] = { m_hEvtQuit, m_hEvtFlush};
bool bQuit = false;
TIMECAPS tc;
DWORD dwResolution;
MFTIME nsSampleTime;
- MFTIME nsCurrentTime;
LONGLONG llClockTime;
- long lDelay;
DWORD dwUser = 0;
DWORD dwObject;
- UINT nNbPlayingFrame = 0;
-
+
// Tell Vista Multimedia Class Scheduler we are a playback thretad (increase priority)
if (pfAvSetMmThreadCharacteristicsW) hAvrt = pfAvSetMmThreadCharacteristicsW (L"Playback", &dwTaskIndex);
if (pfAvSetMmThreadPriority) pfAvSetMmThreadPriority (hAvrt, AVRT_PRIORITY_HIGH /*AVRT_PRIORITY_CRITICAL*/);
@@ -1466,11 +2302,26 @@ void CEVRAllocatorPresenter::RenderThread() timeGetDevCaps(&tc, sizeof(TIMECAPS));
dwResolution = min(max(tc.wPeriodMin, 0), tc.wPeriodMax);
dwUser = timeBeginPeriod(dwResolution);
+ AppSettings& s = AfxGetAppSettings();
-
+ int NextSleepTime = 1;
while (!bQuit)
{
- dwObject = WaitForMultipleObjects (countof(hEvts), hEvts, FALSE, INFINITE);
+ LONGLONG llPerf = AfxGetMyApp()->GetPerfCounter();
+ if (!s.m_RenderSettings.iVMR9VSyncAccurate && NextSleepTime == 0)
+ NextSleepTime = 1;
+ dwObject = WaitForMultipleObjects (countof(hEvts), hEvts, FALSE, max(NextSleepTime < 0 ? 1 : NextSleepTime, 0));
+/* dwObject = WAIT_TIMEOUT;
+ if (m_bEvtFlush)
+ dwObject = WAIT_OBJECT_0 + 1;
+ else if (m_bEvtQuit)
+ dwObject = WAIT_OBJECT_0;*/
+// if (NextSleepTime)
+// TRACE("Sleep: %7.3f\n", double(AfxGetMyApp()->GetPerfCounter()-llPerf) / 10000.0);
+ if (NextSleepTime > 1)
+ NextSleepTime = 0;
+ else if (NextSleepTime == 0)
+ NextSleepTime = -1;
switch (dwObject)
{
case WAIT_OBJECT_0 :
@@ -1478,72 +2329,332 @@ void CEVRAllocatorPresenter::RenderThread() break;
case WAIT_OBJECT_0 + 1 :
// Flush pending samples!
- if (dwUser != -1) timeKillEvent (dwUser);
- dwUser = -1;
-
FlushSamples();
+ m_bEvtFlush = false;
ResetEvent(m_hEvtFlush);
TRACE_EVR ("Flush done!\n");
break;
- case WAIT_OBJECT_0 + 2 :
- case WAIT_OBJECT_0 + 3 :
+ case WAIT_TIMEOUT :
+
+ if (m_LastSetOutputRange != -1 && m_LastSetOutputRange != s.m_RenderSettings.iEVROutputRange || m_bPendingRenegotiate)
+ {
+ FlushSamples();
+ RenegotiateMediaType();
+ m_bPendingRenegotiate = false;
+ }
+ if (m_bPendingResetDevice)
+ {
+ m_bPendingResetDevice = false;
+ CAutoLock lock(this);
+ CAutoLock lock2(&m_ImageProcessingLock);
+ CAutoLock cRenderLock(&m_RenderLock);
+
+
+ RemoveAllSamples();
+
+ CDX9AllocatorPresenter::ResetDevice();
+
+ for(int i = 0; i < m_nNbDXSurface; i++)
+ {
+ CComPtr<IMFSample> pMFSample;
+ HRESULT hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
+
+ if (SUCCEEDED (hr))
+ {
+ pMFSample->SetUINT32 (GUID_SURFACE_INDEX, i);
+ m_FreeSamples.AddTail (pMFSample);
+ }
+ ASSERT (SUCCEEDED (hr));
+ }
+
+ }
// Discard timer events if playback stop
- if ((dwObject == WAIT_OBJECT_0 + 3) && (m_nRenderState != Started)) continue;
+// if ((dwObject == WAIT_OBJECT_0 + 3) && (m_nRenderState != Started)) continue;
// TRACE_EVR ("RenderThread ==>> Waiting buffer\n");
- if (WaitForMultipleObjects (countof(hEvtsBuff), hEvtsBuff, FALSE, INFINITE) == WAIT_OBJECT_0+2)
+// if (WaitForMultipleObjects (countof(hEvtsBuff), hEvtsBuff, FALSE, INFINITE) == WAIT_OBJECT_0+2)
{
CComPtr<IMFSample> pMFSample;
- if (SUCCEEDED (GetScheduledSample(&pMFSample)))
- {
- pMFSample->GetUINT32 (GUID_SURFACE_INDEX, (UINT32*)&m_nCurSurface);
- pMFSample->GetSampleTime (&nsSampleTime);
+ LONGLONG llPerf = AfxGetMyApp()->GetPerfCounter();
+ int nSamplesLeft = 0;
+ if (SUCCEEDED (GetScheduledSample(&pMFSample, nSamplesLeft)))
+ {
+// pMFSample->GetUINT32 (GUID_SURFACE_INDEX, (UINT32*)&m_nCurSurface);
+ m_pCurrentDisplaydSample = pMFSample;
- TRACE_EVR ("RenderThread ==>> Presenting surface %d (%I64d)\n", m_nCurSurface, nsSampleTime);
+ bool bValidSampleTime = true;
+ if (pMFSample->GetSampleTime (&nsSampleTime) != S_OK || nsSampleTime == 0)
+ bValidSampleTime = false;
+ // We assume that all samples have the same duration
+ LONGLONG SampleDuration = 0;
+ pMFSample->GetSampleDuration(&SampleDuration);
- __super::SetTime (g_tSegmentStart + nsSampleTime);
- Paint(true);
+// TRACE_EVR ("RenderThread ==>> Presenting surface %d (%I64d)\n", m_nCurSurface, nsSampleTime);
- m_pcFramesDrawn++;
- InterlockedDecrement (&m_nUsedBuffer);
- CompleteFrameStep (false);
+ bool bStepForward = false;
- if ((m_nRenderState == Started) && (m_nStepCount == 0))
+ if (m_nStepCount < 0)
+ {
+ // Drop frame
+ TRACE_EVR ("Dropped frame\n");
+ m_pcFrames++;
+ bStepForward = true;
+ m_nStepCount = 0;
+ }
+ else if (m_nStepCount > 0)
+ {
+ pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
+ ++m_OrderedPaint;
+ __super::SetTime (g_tSegmentStart + nsSampleTime);
+ Paint(true);
+ m_nDroppedUpdate = 0;
+ CompleteFrameStep (false);
+ bStepForward = true;
+ }
+ else if ((m_nRenderState == Started))
{
// Calculate wake up timer
- m_pClock->GetCorrelatedTime(0, &llClockTime, &nsCurrentTime);
-
- //if (m_rtTimePerFrame == 0) CalculateFrameRate(/*nsSampleTime*/);
- // Wakup 1/2 refresh rate before next VSync!
- lDelay = (UINT)((nsSampleTime + m_rtTimePerFrame - llClockTime) / 10000) - (500/m_RefreshRate);
-
- if (lDelay > 0)
+ LONGLONG CurrentCounter = AfxGetMyApp()->GetPerfCounter();
+ if (!m_bSignaledStarvation)
+ {
+ llClockTime = GetClockTime(CurrentCounter);
+ m_StarvationClock = llClockTime;
+ }
+ else
{
- // TRACE_EVR ("RenderThread ==>> Set timer %d %I64d Cons=%d \n", lDelay, nsSampleTime, m_nCurSurface);
- dwUser = timeSetEvent (lDelay, dwResolution, (LPTIMECALLBACK)m_hEvtFrameTimer, NULL, TIME_CALLBACK_EVENT_SET);
+ llClockTime = m_StarvationClock;
+ }
- // Update statistics
- nNbPlayingFrame++;
+ if (!bValidSampleTime)
+ {
+ // Just play as fast as possible
+ bStepForward = true;
+ pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
+ ++m_OrderedPaint;
+ __super::SetTime (g_tSegmentStart + nsSampleTime);
+ Paint(true);
}
else
{
- dwUser = -1;
- if (m_nRenderState == Started) m_pcFrames++;
- // TRACE_EVR ("RenderThread ==>> immediate display %I64d (delay=%d) Cons=%d\n", nsSampleTime/417188, lDelay, m_nCurSurface);
- SetEvent (m_hEvtPresent);
+ LONGLONG TimePerFrame = GetFrameTime() * 10000000.0;
+ LONGLONG DrawTime = (m_PaintTime) * 0.9 - 20000.0; // 2 ms offset
+ //if (!s.iVMR9VSync)
+ DrawTime = 0;
+
+ LONGLONG SyncOffset = 0;
+ LONGLONG VSyncTime = 0;
+ LONGLONG RefreshTime = 0;
+ LONGLONG TimeToNextVSync = -1;
+ bool bVSyncCorrection = false;
+ double DetectedRefreshTime;
+ double DetectedScanlinesPerFrame;
+ double DetectedScanlineTime;
+ int DetectedRefreshRatePos;
+ {
+ CAutoLock Lock(&m_RefreshRateLock);
+ DetectedRefreshTime = m_DetectedRefreshTime;
+ DetectedRefreshRatePos = m_DetectedRefreshRatePos;
+ DetectedScanlinesPerFrame = m_DetectedScanlinesPerFrame;
+ DetectedScanlineTime = m_DetectedScanlineTime;
+ }
+
+ if (s.m_RenderSettings.iVMR9VSync && DetectedRefreshTime && DetectedRefreshRatePos > 20)
+ {
+ bVSyncCorrection = true;
+ double TargetVSyncPos = GetVBlackPos();
+ double RefreshLines = DetectedScanlinesPerFrame;
+ double RefreshTime = DetectedRefreshTime;
+ double ScanlinesPerSecond = 1.0/DetectedScanlineTime;
+ double CurrentVSyncPos = fmod(double(m_VBlankStartMeasure) + ScanlinesPerSecond * ((CurrentCounter - m_VBlankStartMeasureTime) / 10000000.0), RefreshLines);
+ double LinesUntilVSync = 0;
+ //TargetVSyncPos -= ScanlinesPerSecond * (DrawTime/10000000.0);
+ //TargetVSyncPos -= 10;
+ TargetVSyncPos = fmod(TargetVSyncPos, RefreshLines);
+ if (TargetVSyncPos < 0)
+ TargetVSyncPos += RefreshLines;
+ if (TargetVSyncPos > CurrentVSyncPos)
+ LinesUntilVSync = TargetVSyncPos - CurrentVSyncPos;
+ else
+ LinesUntilVSync = (RefreshLines - CurrentVSyncPos) + TargetVSyncPos;
+ double TimeUntilVSync = LinesUntilVSync * DetectedScanlineTime;
+ TimeToNextVSync = TimeUntilVSync * 10000000.0;
+ VSyncTime = DetectedRefreshTime * 10000000.0;
+ RefreshTime = VSyncTime;
+
+ LONGLONG ClockTimeAtNextVSync = llClockTime + (TimeUntilVSync * 10000000.0) * m_ModeratedTimeSpeed;
+
+ SyncOffset = (nsSampleTime - ClockTimeAtNextVSync);
+
+// if (SyncOffset < 0)
+// TRACE("SyncOffset(%d): %I64d %I64d %I64d\n", m_nCurSurface, SyncOffset, TimePerFrame, VSyncTime);
+ }
+ else
+ SyncOffset = (nsSampleTime - llClockTime);
+
+ //LONGLONG SyncOffset = nsSampleTime - llClockTime;
+ TRACE_EVR ("SyncOffset: %I64d SampleFrame: %I64d ClockFrame: %I64d\n", SyncOffset, nsSampleTime/TimePerFrame, llClockTime /TimePerFrame);
+ if (SampleDuration > 1 && !m_DetectedLock)
+ TimePerFrame = SampleDuration;
+
+ LONGLONG MinMargin;
+ if (m_FrameTimeCorrection && 0)
+ MinMargin = 15000.0;
+ else
+ MinMargin = 15000.0 + min(m_DetectedFrameTimeStdDev, 20000.0);
+ LONGLONG TimePerFrameMargin = min(double(TimePerFrame)*0.11, max(double(TimePerFrame)*0.02, MinMargin));
+ LONGLONG TimePerFrameMargin0 = TimePerFrameMargin/2;
+ LONGLONG TimePerFrameMargin1 = 0;
+
+ if (m_DetectedLock && TimePerFrame < VSyncTime)
+ VSyncTime = TimePerFrame;
+
+ if (m_VSyncMode == 1)
+ TimePerFrameMargin1 = -TimePerFrameMargin;
+ else if (m_VSyncMode == 2)
+ TimePerFrameMargin1 = TimePerFrameMargin;
+
+ m_LastSampleOffset = SyncOffset;
+ m_bLastSampleOffsetValid = true;
+
+ LONGLONG VSyncOffset0 = 0;
+ bool bDoVSyncCorrection = false;
+ if ((SyncOffset < -(TimePerFrame + TimePerFrameMargin0 - TimePerFrameMargin1)) && nSamplesLeft > 0) // Only drop if we have something else to display at once
+ {
+ // Drop frame
+ TRACE_EVR ("Dropped frame\n");
+ m_pcFrames++;
+ bStepForward = true;
+ ++m_nDroppedUpdate;
+ NextSleepTime = 0;
+// VSyncOffset0 = (-SyncOffset) - VSyncTime;
+ //VSyncOffset0 = (-SyncOffset) - VSyncTime + TimePerFrameMargin1;
+ //m_LastPredictedSync = VSyncOffset0;
+ bDoVSyncCorrection = false;
+ }
+ else if (SyncOffset < TimePerFrameMargin1)
+ {
+
+ if (bVSyncCorrection)
+ {
+// VSyncOffset0 = -SyncOffset;
+ VSyncOffset0 = -SyncOffset;
+ bDoVSyncCorrection = true;
+ }
+
+ // Paint and prepare for next frame
+ TRACE_EVR ("Normalframe\n");
+ m_nDroppedUpdate = 0;
+ bStepForward = true;
+ pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
+ m_LastFrameDuration = nsSampleTime - m_LastSampleTime;
+ m_LastSampleTime = nsSampleTime;
+ m_LastPredictedSync = VSyncOffset0;
+
+ ++m_OrderedPaint;
+ __super::SetTime (g_tSegmentStart + nsSampleTime);
+ Paint(true);
+ //m_pSink->Notify(EC_SCRUB_TIME, LODWORD(nsSampleTime), HIDWORD(nsSampleTime));
+
+ NextSleepTime = 0;
+ m_pcFramesDrawn++;
+ }
+ else
+ {
+ if (TimeToNextVSync >= 0 && SyncOffset > 0)
+ {
+ NextSleepTime = ((TimeToNextVSync)/10000) - 2;
+ }
+ else
+ NextSleepTime = ((SyncOffset)/10000) - 2;
+
+ if (NextSleepTime > TimePerFrame)
+ NextSleepTime = 1;
+
+ if (NextSleepTime < 0)
+ NextSleepTime = 0;
+ NextSleepTime = 1;
+ //TRACE_EVR ("Delay\n");
+ }
+
+ if (bDoVSyncCorrection)
+ {
+ //LONGLONG VSyncOffset0 = (((SyncOffset) % VSyncTime) + VSyncTime) % VSyncTime;
+ LONGLONG Margin = TimePerFrameMargin;
+
+ LONGLONG VSyncOffsetMin = 30000000000000;
+ LONGLONG VSyncOffsetMax = -30000000000000;
+ for (int i = 0; i < 5; ++i)
+ {
+ VSyncOffsetMin = min(m_VSyncOffsetHistory[i], VSyncOffsetMin);
+ VSyncOffsetMax = max(m_VSyncOffsetHistory[i], VSyncOffsetMax);
+ }
+
+ m_VSyncOffsetHistory[m_VSyncOffsetHistoryPos] = VSyncOffset0;
+ m_VSyncOffsetHistoryPos = (m_VSyncOffsetHistoryPos + 1) % 5;
+
+// LONGLONG VSyncTime2 = VSyncTime2 + (VSyncOffsetMax - VSyncOffsetMin);
+ //VSyncOffsetMin; = (((VSyncOffsetMin) % VSyncTime) + VSyncTime) % VSyncTime;
+ //VSyncOffsetMax = (((VSyncOffsetMax) % VSyncTime) + VSyncTime) % VSyncTime;
+
+// TRACE("SyncOffset(%d, %d): %8I64d %8I64d %8I64d %8I64d\n", m_nCurSurface, m_VSyncMode,VSyncOffset0, VSyncOffsetMin, VSyncOffsetMax, VSyncOffsetMax - VSyncOffsetMin);
+
+ if (m_VSyncMode == 0)
+ {
+ // 23.976 in 60 Hz
+ if (VSyncOffset0 < Margin && VSyncOffsetMax > (VSyncTime - Margin))
+ {
+ m_VSyncMode = 2;
+ }
+ else if (VSyncOffset0 > (VSyncTime - Margin) && VSyncOffsetMin < Margin)
+ {
+ m_VSyncMode = 1;
+ }
+ }
+ else if (m_VSyncMode == 2)
+ {
+ if (VSyncOffsetMin > (Margin))
+ {
+ m_VSyncMode = 0;
+ }
+ }
+ else if (m_VSyncMode == 1)
+ {
+ if (VSyncOffsetMax < (VSyncTime - Margin))
+ {
+ m_VSyncMode = 0;
+ }
+ }
+ }
+
}
}
- MoveToFreeList(pMFSample, true);
- CheckWaitingSampleFromMixer();
+ m_pCurrentDisplaydSample = NULL;
+ if (bStepForward)
+ {
+ MoveToFreeList(pMFSample, true);
+ CheckWaitingSampleFromMixer();
+ m_MaxSampleDuration = max(SampleDuration, m_MaxSampleDuration);
+ }
+ else
+ MoveToScheduledList(pMFSample, true);
}
+ else if (m_bLastSampleOffsetValid && m_LastSampleOffset < -10000000) // Only starve if we are 1 seconds behind
+ {
+ if (m_nRenderState == Started)
+ {
+ m_pSink->Notify(EC_STARVATION, 0, 0);
+ m_bSignaledStarvation = true;
+ }
+ }
+ //GetImageFromMixer();
}
- else
- {
- TRACE_EVR ("RenderThread ==>> Flush before rendering frame!\n");
- }
+// else
+// {
+// TRACE_EVR ("RenderThread ==>> Flush before rendering frame!\n");
+// }
break;
}
@@ -1569,18 +2680,27 @@ void CEVRAllocatorPresenter::OnResetDevice() void CEVRAllocatorPresenter::RemoveAllSamples()
{
+ CAutoLock AutoLock(&m_ImageProcessingLock);
+
FlushSamples();
m_ScheduledSamples.RemoveAll();
m_FreeSamples.RemoveAll();
+ m_LastScheduledSampleTime = -1;
+ m_LastScheduledUncorrectedSampleTime = -1;
+ ASSERT(m_nUsedBuffer == 0);
+ m_nUsedBuffer = 0;
}
HRESULT CEVRAllocatorPresenter::GetFreeSample(IMFSample** ppSample)
{
- CAutoLock lock(this);
+ CAutoLock lock(&m_SampleQueueLock);
HRESULT hr = S_OK;
if (m_FreeSamples.GetCount() > 1) // <= Cannot use first free buffer (can be currently displayed)
+ {
+ InterlockedIncrement (&m_nUsedBuffer);
*ppSample = m_FreeSamples.RemoveHead().Detach();
+ }
else
hr = MF_E_SAMPLEALLOCATOR_EMPTY;
@@ -1588,13 +2708,17 @@ HRESULT CEVRAllocatorPresenter::GetFreeSample(IMFSample** ppSample) }
-HRESULT CEVRAllocatorPresenter::GetScheduledSample(IMFSample** ppSample)
+HRESULT CEVRAllocatorPresenter::GetScheduledSample(IMFSample** ppSample, int &_Count)
{
- CAutoLock lock(this);
+ CAutoLock lock(&m_SampleQueueLock);
HRESULT hr = S_OK;
- if (m_ScheduledSamples.GetCount() > 0)
+ _Count = m_ScheduledSamples.GetCount();
+ if (_Count > 0)
+ {
*ppSample = m_ScheduledSamples.RemoveHead().Detach();
+ --_Count;
+ }
else
hr = MF_E_SAMPLEALLOCATOR_EMPTY;
@@ -1604,7 +2728,13 @@ HRESULT CEVRAllocatorPresenter::GetScheduledSample(IMFSample** ppSample) void CEVRAllocatorPresenter::MoveToFreeList(IMFSample* pSample, bool bTail)
{
- CAutoLock lock(this);
+ CAutoLock lock(&m_SampleQueueLock);
+ InterlockedDecrement (&m_nUsedBuffer);
+ if (m_bPendingMediaFinished && m_nUsedBuffer == 0)
+ {
+ m_bPendingMediaFinished = false;
+ m_pSink->Notify (EC_COMPLETE, 0, 0);
+ }
if (bTail)
m_FreeSamples.AddTail (pSample);
else
@@ -1612,25 +2742,281 @@ void CEVRAllocatorPresenter::MoveToFreeList(IMFSample* pSample, bool bTail) }
-void CEVRAllocatorPresenter::MoveToScheduledList(IMFSample* pSample)
+void CEVRAllocatorPresenter::MoveToScheduledList(IMFSample* pSample, bool _bSorted)
{
- CAutoLock lock(this);
- m_ScheduledSamples.AddTail (pSample);
+
+ if (_bSorted)
+ {
+ CAutoLock lock(&m_SampleQueueLock);
+ // Insert sorted
+/* POSITION Iterator = m_ScheduledSamples.GetHeadPosition();
+
+ LONGLONG NewSampleTime;
+ pSample->GetSampleTime(&NewSampleTime);
+
+ while (Iterator != NULL)
+ {
+ POSITION CurrentPos = Iterator;
+ IMFSample *pIter = m_ScheduledSamples.GetNext(Iterator);
+ LONGLONG SampleTime;
+ pIter->GetSampleTime(&SampleTime);
+ if (NewSampleTime < SampleTime)
+ {
+ m_ScheduledSamples.InsertBefore(CurrentPos, pSample);
+ return;
+ }
+ }*/
+
+ m_ScheduledSamples.AddHead(pSample);
+ }
+ else
+ {
+
+ CAutoLock lock(&m_SampleQueueLock);
+
+ AppSettings& s = AfxGetAppSettings();
+ double ForceFPS = 0.0;
+// double ForceFPS = 59.94;
+// double ForceFPS = 23.976;
+ if (ForceFPS != 0.0)
+ m_rtTimePerFrame = 10000000.0 / ForceFPS;
+ LONGLONG Duration = m_rtTimePerFrame;
+ LONGLONG PrevTime = m_LastScheduledUncorrectedSampleTime;
+ LONGLONG Time;
+ LONGLONG SetDuration;
+ pSample->GetSampleDuration(&SetDuration);
+ pSample->GetSampleTime(&Time);
+ m_LastScheduledUncorrectedSampleTime = Time;
+
+ m_bCorrectedFrameTime = false;
+ double LastFP = m_LastScheduledSampleTimeFP;
+
+ LONGLONG Diff2 = PrevTime - m_LastScheduledSampleTimeFP*10000000.0;
+ LONGLONG Diff = Time - PrevTime;
+ if (PrevTime == -1)
+ Diff = 0;
+ if (Diff < 0)
+ Diff = -Diff;
+ if (Diff2 < 0)
+ Diff2 = -Diff2;
+ if (Diff < m_rtTimePerFrame*8 && m_rtTimePerFrame && Diff2 < m_rtTimePerFrame*8) // Detect seeking
+ {
+ int iPos = (m_DetectedFrameTimePos++) % 60;
+ LONGLONG Diff = Time - PrevTime;
+ if (PrevTime == -1)
+ Diff = 0;
+ m_DetectedFrameTimeHistory[iPos] = Diff;
+
+ if (m_DetectedFrameTimePos >= 10)
+ {
+ int nFrames = min(m_DetectedFrameTimePos, 60);
+ LONGLONG DectedSum = 0;
+ for (int i = 0; i < nFrames; ++i)
+ {
+ DectedSum += m_DetectedFrameTimeHistory[i];
+ }
+
+ double Average = double(DectedSum) / double(nFrames);
+ double DeviationSum = 0.0;
+ for (int i = 0; i < nFrames; ++i)
+ {
+ double Deviation = m_DetectedFrameTimeHistory[i] - Average;
+ DeviationSum += Deviation*Deviation;
+ }
+
+ double StdDev = sqrt(DeviationSum/double(nFrames));
+
+ m_DetectedFrameTimeStdDev = StdDev;
+
+ double DetectedRate = 1.0/ (double(DectedSum) / (nFrames * 10000000.0) );
+
+ double AllowedError = 0.0003;
+
+ static double AllowedValues[] = {60.0, 59.94, 50.0, 48.0, 47.952, 30.0, 29.97, 25.0, 24.0, 23.976};
+
+ int nAllowed = sizeof(AllowedValues) / sizeof(AllowedValues[0]);
+ for (int i = 0; i < nAllowed; ++i)
+ {
+ if (fabs(1.0 - DetectedRate / AllowedValues[i]) < AllowedError)
+ {
+ DetectedRate = AllowedValues[i];
+ break;
+ }
+ }
+
+ m_DetectedFrameTimeHistoryHisotry[m_DetectedFrameTimePos % 500] = DetectedRate;
+
+ class CAutoInt
+ {
+ public:
+
+ int m_Int;
+
+ CAutoInt()
+ {
+ m_Int = 0;
+ }
+ CAutoInt(int _Other)
+ {
+ m_Int = _Other;
+ }
+
+ operator int ()
+ {
+ return m_Int;
+ }
+
+ CAutoInt &operator ++ ()
+ {
+ ++m_Int;
+ return *this;
+ }
+ };
+
+
+ CMap<double, double, CAutoInt, CAutoInt> Map;
+
+ for (int i = 0; i < 500; ++i)
+ {
+ ++Map[m_DetectedFrameTimeHistoryHisotry[i]];
+ }
+
+ POSITION Pos = Map.GetStartPosition();
+ double BestVal = 0.0;
+ int BestNum = 5;
+ while (Pos)
+ {
+ double Key;
+ CAutoInt Value;
+ Map.GetNextAssoc(Pos, Key, Value);
+ if (Value.m_Int > BestNum && Key != 0.0)
+ {
+ BestNum = Value.m_Int;
+ BestVal = Key;
+ }
+ }
+
+ m_DetectedLock = false;
+ for (int i = 0; i < nAllowed; ++i)
+ {
+ if (BestVal == AllowedValues[i])
+ {
+ m_DetectedLock = true;
+ break;
+ }
+ }
+ if (BestVal != 0.0)
+ {
+ m_DetectedFrameRate = BestVal;
+ m_DetectedFrameTime = 1.0 / BestVal;
+ }
+ }
+
+ LONGLONG PredictedNext = PrevTime + m_rtTimePerFrame;
+ LONGLONG PredictedDiff = PredictedNext - Time;
+ if (PredictedDiff < 0)
+ PredictedDiff = -PredictedDiff;
+
+ if (m_DetectedFrameTime != 0.0
+ //&& PredictedDiff > 15000
+ && m_DetectedLock && s.m_RenderSettings.iEVREnableFrameTimeCorrection)
+ {
+ double CurrentTime = Time / 10000000.0;
+ double LastTime = m_LastScheduledSampleTimeFP;
+ double PredictedTime = LastTime + m_DetectedFrameTime;
+ if (fabs(PredictedTime - CurrentTime) > 0.0015) // 1.5 ms wrong, lets correct
+ {
+ CurrentTime = PredictedTime;
+ Time = CurrentTime * 10000000.0;
+ pSample->SetSampleTime(Time);
+ pSample->SetSampleDuration(m_DetectedFrameTime * 10000000.0);
+ m_bCorrectedFrameTime = true;
+ m_FrameTimeCorrection = 30;
+ }
+ m_LastScheduledSampleTimeFP = CurrentTime;;
+ }
+ else
+ m_LastScheduledSampleTimeFP = Time / 10000000.0;
+ }
+ else
+ {
+ m_LastScheduledSampleTimeFP = Time / 10000000.0;
+ if (Diff > m_rtTimePerFrame*8)
+ {
+ // Seek
+ m_bSignaledStarvation = false;
+ m_DetectedFrameTimePos = 0;
+ m_DetectedLock = false;
+ }
+ }
+
+// TRACE("Time: %f %f %f\n", Time / 10000000.0, SetDuration / 10000000.0, m_DetectedFrameRate);
+ if (!m_bCorrectedFrameTime && m_FrameTimeCorrection)
+ --m_FrameTimeCorrection;
+
+#if 0
+ if (Time <= m_LastScheduledUncorrectedSampleTime && m_LastScheduledSampleTime >= 0)
+ PrevTime = m_LastScheduledSampleTime;
+
+ m_bCorrectedFrameTime = false;
+ if (PrevTime != -1 && (Time >= PrevTime - ((Duration*20)/9) || Time == 0) || ForceFPS != 0.0)
+ {
+ if (Time - PrevTime > ((Duration*20)/9) && Time - PrevTime < Duration * 8 || Time == 0 || ((Time - PrevTime) < (Duration / 11)) || ForceFPS != 0.0)
+ {
+ // Error!!!!
+ Time = PrevTime + Duration;
+ pSample->SetSampleTime(Time);
+ pSample->SetSampleDuration(Duration);
+ m_bCorrectedFrameTime = true;
+ TRACE("Corrected invalid sample time\n");
+ }
+ }
+ if (Time+Duration*10 < m_LastScheduledSampleTime)
+ {
+ // Flush when repeating movie
+ FlushSamplesInternal();
+ }
+#endif
+
+#if 0
+ static LONGLONG LastDuration = 0;
+ LONGLONG SetDuration = m_rtTimePerFrame;
+ pSample->GetSampleDuration(&SetDuration);
+ if (SetDuration != LastDuration)
+ {
+ TRACE("Old duration: %I64d New duration: %I64d\n", LastDuration, SetDuration);
+ }
+ LastDuration = SetDuration;
+#endif
+ m_LastScheduledSampleTime = Time;
+
+ m_ScheduledSamples.AddTail(pSample);
+
+ }
}
+
void CEVRAllocatorPresenter::FlushSamples()
{
CAutoLock lock(this);
+ CAutoLock lock2(&m_SampleQueueLock);
+
+ FlushSamplesInternal();
+ m_LastScheduledSampleTime = -1;
+}
- m_nUsedBuffer = 0;
+void CEVRAllocatorPresenter::FlushSamplesInternal()
+{
while (m_ScheduledSamples.GetCount() > 0)
{
CComPtr<IMFSample> pMFSample;
pMFSample = m_ScheduledSamples.RemoveHead();
MoveToFreeList (pMFSample, true);
-
- WaitForSingleObject (m_hSemPicture, 0);
}
+
+ m_LastSampleOffset = 0;
+ m_bLastSampleOffsetValid = false;
+ m_bSignaledStarvation = false;
}
\ No newline at end of file diff --git a/src/apps/mplayerc/FGFilter.h b/src/apps/mplayerc/FGFilter.h index 69e4d5f98..075ee9736 100644 --- a/src/apps/mplayerc/FGFilter.h +++ b/src/apps/mplayerc/FGFilter.h @@ -88,7 +88,7 @@ public: CheckPointer(ppBF, E_POINTER);
HRESULT hr = S_OK;
- CComPtr<IBaseFilter> pBF = new T(NULL, &hr);
+ CComPtr<IBaseFilter> pBF = DNew T(NULL, &hr);
if(FAILED(hr)) return hr;
*ppBF = pBF.Detach();
diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp index 4d2cf4b9f..03a54d2a1 100644 --- a/src/apps/mplayerc/FGManager.cpp +++ b/src/apps/mplayerc/FGManager.cpp @@ -187,7 +187,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl if(ext == _T(".dvr-ms")) // doh, this is stupid
{
- fl.Insert(new CFGFilterRegistry(CLSID_StreamBufferSource, MERIT64_PREFERRED), 0);
+ fl.Insert(DNew CFGFilterRegistry(CLSID_StreamBufferSource, MERIT64_PREFERRED), 0);
}
TCHAR buff[256], buff2[256];
@@ -263,15 +263,15 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl {
len = countof(buff);
if(ERROR_SUCCESS == exts.QueryStringValue(CString(ext), buff, &len))
- fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 4);
+ fl.Insert(DNew CFGFilterRegistry(GUIDFromCString(buff)), 4);
}
len = countof(buff);
if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len))
- fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 5);
+ fl.Insert(DNew CFGFilterRegistry(GUIDFromCString(buff)), 5);
}
- fl.Insert(new CFGFilterRegistry(CLSID_URLReader), 6);
+ fl.Insert(DNew CFGFilterRegistry(CLSID_URLReader), 6);
}
else
{
@@ -315,7 +315,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl {
if(CheckBytes(hFile, CString(buff)))
{
- CFGFilter* pFGF = new CFGFilterRegistry(clsid);
+ CFGFilter* pFGF = DNew CFGFilterRegistry(clsid);
pFGF->AddType(majortype, subtype);
fl.Insert(pFGF, 9);
break;
@@ -352,7 +352,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl if(ERROR_SUCCESS == key.QueryStringValue(_T("Subtype"), buff, &len))
subtype = GUIDFromCString(buff);
- CFGFilter* pFGF = new CFGFilterRegistry(clsid);
+ CFGFilter* pFGF = DNew CFGFilterRegistry(clsid);
pFGF->AddType(majortype, subtype);
fl.Insert(pFGF, 7);
}
@@ -364,7 +364,7 @@ HRESULT CFGManager::EnumSourceFilters(LPCWSTR lpcwstrFileName, CFGFilterList& fl CloseHandle(hFile);
}
- CFGFilter* pFGF = new CFGFilterRegistry(CLSID_AsyncReader);
+ CFGFilter* pFGF = DNew CFGFilterRegistry(CLSID_AsyncReader);
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_NULL);
fl.Insert(pFGF, 9);
@@ -418,7 +418,7 @@ HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LP || pmt->subtype == GUIDFromCString(_T("{D51BD5AE-7548-11CF-A520-0080C77EF58A}")))
{
RemoveFilter(pBF);
- pFGF = new CFGFilterRegistry(CLSID_NetShowSource);
+ pFGF = DNew CFGFilterRegistry(CLSID_NetShowSource);
hr = AddSourceFilter(pFGF, lpcwstrFileName, lpcwstrFilterName, ppBF);
delete pFGF;
return hr;
@@ -663,7 +663,7 @@ STDMETHODIMP CFGManager::Connect(IPin* pPinOut, IPin* pPinIn) {
for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
{
- CFGFilterRegistry* pFGF = new CFGFilterRegistry(pMoniker);
+ CFGFilterRegistry* pFGF = DNew CFGFilterRegistry(pMoniker);
fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true));
}
}
@@ -765,7 +765,7 @@ STDMETHODIMP CFGManager::Connect(IPin* pPinOut, IPin* pPinIn) if(fDeadEnd)
{
- CAutoPtr<CStreamDeadEnd> psde(new CStreamDeadEnd());
+ CAutoPtr<CStreamDeadEnd> psde(DNew CStreamDeadEnd());
psde->AddTailList(&m_streampath);
int skip = 0;
BeginEnumMediaTypes(pPinOut, pEM, pmt)
@@ -1222,7 +1222,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_SHOUTCAST
if(src & SRC_SHOUTCAST)
{
- pFGF = new CFGFilterInternal<CShoutcastSource>();
+ pFGF = DNew CFGFilterInternal<CShoutcastSource>();
pFGF->m_protocols.AddTail(_T("http"));
m_source.AddTail(pFGF);
}
@@ -1231,7 +1231,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_UDP
// if(src & SRC_UDP)
{
- pFGF = new CFGFilterInternal<CUDPReader>();
+ pFGF = DNew CFGFilterInternal<CUDPReader>();
pFGF->m_protocols.AddTail(_T("udp"));
m_source.AddTail(pFGF);
}
@@ -1240,7 +1240,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_AVI
if(src & SRC_AVI)
{
- pFGF = new CFGFilterInternal<CAviSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CAviSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920"));
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958"));
m_source.AddTail(pFGF);
@@ -1250,7 +1250,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MP4
if(src & SRC_MP4)
{
- pFGF = new CFGFilterInternal<CMP4SourceFilter>();
+ pFGF = DNew CFGFilterInternal<CMP4SourceFilter>();
pFGF->m_chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
pFGF->m_chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
pFGF->m_chkbytes.AddTail(_T("4,4,,6d646174")); // mdat
@@ -1265,7 +1265,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_FLV
if(src & SRC_FLV)
{
- pFGF = new CFGFilterInternal<CFLVSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CFLVSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,464C5601")); // FLV (v1)
m_source.AddTail(pFGF);
}
@@ -1274,7 +1274,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MATROSKA
if(src & SRC_MATROSKA)
{
- pFGF = new CFGFilterInternal<CMatroskaSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CMatroskaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,1A45DFA3"));
m_source.AddTail(pFGF);
}
@@ -1283,7 +1283,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_REALMEDIA
if(src & SRC_REALMEDIA)
{
- pFGF = new CFGFilterInternal<CRealMediaSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CRealMediaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,2E524D46"));
m_source.AddTail(pFGF);
}
@@ -1292,7 +1292,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_DSM
if(src & SRC_DSM)
{
- pFGF = new CFGFilterInternal<CDSMSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CDSMSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,44534D53"));
m_source.AddTail(pFGF);
}
@@ -1301,7 +1301,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_FLIC
if(src & SRC_FLIC)
{
- pFGF = new CFGFilterInternal<CFLICSource>();
+ pFGF = DNew CFGFilterInternal<CFLICSource>();
pFGF->m_chkbytes.AddTail(_T("4,2,,11AF"));
pFGF->m_chkbytes.AddTail(_T("4,2,,12AF"));
pFGF->m_extensions.AddTail(_T(".fli"));
@@ -1313,7 +1313,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_FLAC
if(src & SRC_FLAC)
{
- pFGF = new CFGFilterInternal<CFlacSource>();
+ pFGF = DNew CFGFilterInternal<CFlacSource>();
pFGF->m_chkbytes.AddTail(_T("0,4,,664C6143"));
pFGF->m_extensions.AddTail(_T(".flac"));
m_source.AddTail(pFGF);
@@ -1323,7 +1323,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_CDDA
if(src & SRC_CDDA)
{
- pFGF = new CFGFilterInternal<CCDDAReader>();
+ pFGF = DNew CFGFilterInternal<CCDDAReader>();
pFGF->m_extensions.AddTail(_T(".cda"));
m_source.AddTail(pFGF);
}
@@ -1332,7 +1332,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_CDXA
if(src & SRC_CDXA)
{
- pFGF = new CFGFilterInternal<CCDXAReader>();
+ pFGF = DNew CFGFilterInternal<CCDXAReader>();
pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,43445841"));
m_source.AddTail(pFGF);
}
@@ -1341,7 +1341,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_VTS
if(src & SRC_VTS)
{
- pFGF = new CFGFilterInternal<CVTSReader>();
+ pFGF = DNew CFGFilterInternal<CVTSReader>();
pFGF->m_chkbytes.AddTail(_T("0,12,,445644564944454F2D565453"));
m_source.AddTail(pFGF);
}
@@ -1354,7 +1354,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) {
if(src & SRC_D2V)
{
- pFGF = new CFGFilterInternal<CD2VSource>();
+ pFGF = DNew CFGFilterInternal<CD2VSource>();
pFGF->m_chkbytes.AddTail(_T("0,18,,4456443241564950726F6A65637446696C65"));
pFGF->m_extensions.AddTail(_T(".d2v"));
m_source.AddTail(pFGF);
@@ -1368,7 +1368,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) {
if(src & SRC_RADGT)
{
- pFGF = new CFGFilterInternal<CRadGtSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CRadGtSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,3,,534D4B"));
pFGF->m_chkbytes.AddTail(_T("0,3,,42494B"));
pFGF->m_extensions.AddTail(_T(".smk"));
@@ -1381,7 +1381,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_ROQ
if(src & SRC_ROQ)
{
- pFGF = new CFGFilterInternal<CRoQSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CRoQSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,8,,8410FFFFFFFF1E00"));
m_source.AddTail(pFGF);
}
@@ -1390,7 +1390,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_OGG
if(src & SRC_OGG)
{
- pFGF = new CFGFilterInternal<COggSourceFilter>();
+ pFGF = DNew CFGFilterInternal<COggSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,4,,4F676753"));
m_source.AddTail(pFGF);
}
@@ -1401,7 +1401,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) {
if(src & SRC_NUT)
{
- pFGF = new CFGFilterInternal<CNutSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CNutSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,8,,F9526A624E55544D"));
m_source.AddTail(pFGF);
}
@@ -1413,7 +1413,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) {
if(src & SRC_DIRAC)
{
- pFGF = new CFGFilterInternal<CDiracSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CDiracSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,8,,4B572D4449524143"));
m_source.AddTail(pFGF);
}
@@ -1423,7 +1423,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MPEG
if(src & SRC_MPEG)
{
- pFGF = new CFGFilterInternal<CMpegSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CMpegSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"));
pFGF->m_chkbytes.AddTail(_T("0,5,FFFFFFFFC0,000001BA40"));
pFGF->m_chkbytes.AddTail(_T("0,1,,47,188,1,,47,376,1,,47"));
@@ -1437,7 +1437,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_DTSAC3
if(src & SRC_DTSAC3)
{
- pFGF = new CFGFilterInternal<CDTSAC3Source>();
+ pFGF = DNew CFGFilterInternal<CDTSAC3Source>();
pFGF->m_chkbytes.AddTail(_T("0,4,,7FFE8001"));
pFGF->m_chkbytes.AddTail(_T("0,2,,0B77"));
pFGF->m_chkbytes.AddTail(_T("0,2,,770B"));
@@ -1450,7 +1450,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MPEGAUDIO
if(src & SRC_MPA)
{
- pFGF = new CFGFilterInternal<CMpaSourceFilter>();
+ pFGF = DNew CFGFilterInternal<CMpaSourceFilter>();
pFGF->m_chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
pFGF->m_chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
m_source.AddTail(pFGF);
@@ -1459,7 +1459,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) if(AfxGetAppSettings().fUseWMASFReader)
{
- pFGF = new CFGFilterRegistry(CLSID_WMAsfReader);
+ pFGF = DNew CFGFilterRegistry(CLSID_WMAsfReader);
pFGF->m_chkbytes.AddTail(_T("0,4,,3026B275"));
pFGF->m_chkbytes.AddTail(_T("0,4,,D129E2D6"));
m_source.AddTail(pFGF);
@@ -1467,7 +1467,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_AVI2AC3
// hmmm, shouldn't there be an option in the GUI to enable/disable this filter?
- pFGF = new CFGFilterInternal<CAVI2AC3Filter>(L"AVI<->AC3/DTS", MERIT64(0x00680000)+1);
+ pFGF = DNew CFGFilterInternal<CAVI2AC3Filter>(L"AVI<->AC3/DTS", MERIT64(0x00680000)+1);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DTS);
m_transform.AddTail(pFGF);
@@ -1475,9 +1475,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MATROSKA
if(src & SRC_MATROSKA) {
- pFGF = new CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CMatroskaSplitterFilter>(L"Matroska Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Matroska);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1486,9 +1486,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_REALMEDIA
if(src & SRC_REALMEDIA) {
- pFGF = new CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CRealMediaSplitterFilter>(L"RealMedia Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RealMedia);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1497,9 +1497,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_AVI
if(src & SRC_AVI) {
- pFGF = new CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CAviSplitterFilter>(L"Avi Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Avi);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1510,9 +1510,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) __if_exists(CRadGtSplitterFilter)
{
if(src & SRC_RADGT) {
- pFGF = new CFGFilterInternal<CRadGtSplitterFilter>(L"RadGt Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CRadGtSplitterFilter>(L"RadGt Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CRadGtSplitterFilter>(L"RadGt Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CRadGtSplitterFilter>(L"RadGt Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Bink);
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Smacker);
@@ -1523,9 +1523,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_ROQ
if(src & SRC_ROQ) {
- pFGF = new CFGFilterInternal<CRoQSplitterFilter>(L"RoQ Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CRoQSplitterFilter>(L"RoQ Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CRoQSplitterFilter>(L"RoQ Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CRoQSplitterFilter>(L"RoQ Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RoQ);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1534,9 +1534,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_OGG
if(src & SRC_OGG) {
- pFGF = new CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<COggSplitterFilter>(L"Ogg Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Ogg);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1547,9 +1547,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) __if_exists(CNutSplitterFilter)
{
if(src & SRC_NUT) {
- pFGF = new CFGFilterInternal<CNutSplitterFilter>(L"Nut Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CNutSplitterFilter>(L"Nut Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CNutSplitterFilter>(L"Nut Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CNutSplitterFilter>(L"Nut Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Nut);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1559,9 +1559,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MPEG
if(src & SRC_MPEG) {
- pFGF = new CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CMpegSplitterFilter>(L"Mpeg Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1System);
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_PROGRAM);
@@ -1575,9 +1575,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) __if_exists(CDiracSplitterFilter)
{
if(src & SRC_DIRAC) {
- pFGF = new CFGFilterInternal<CDiracSplitterFilter>(L"Dirac Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CDiracSplitterFilter>(L"Dirac Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CDiracSplitterFilter>(L"Dirac Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CDiracSplitterFilter>(L"Dirac Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Dirac);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1587,9 +1587,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MPEGAUDIO
if(src & SRC_MPA) {
- pFGF = new CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CMpaSplitterFilter>(L"Mpa Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1Audio);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1598,9 +1598,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_DSM
if(src & SRC_DSM) {
- pFGF = new CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CDSMSplitterFilter>(L"DSM Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_DirectShowMedia);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1609,9 +1609,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_MP4
if(src & SRC_MP4) {
- pFGF = new CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CMP4SplitterFilter>(L"MP4 Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MP4);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1620,9 +1620,9 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_SOURCEFILTER_FLV
if(src & SRC_FLV) {
- pFGF = new CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter", MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter", MERIT64_ABOVE_DSHOW);
} else {
- pFGF = new CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter (low merit)", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CFLVSplitterFilter>(L"FLV Splitter (low merit)", MERIT64_DO_USE);
}
pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_FLV);
pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
@@ -1633,7 +1633,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // Transform filters
#if INTERNAL_DECODER_MPEG1
- pFGF = new CFGFilterInternal<CMpeg2DecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpeg2DecFilter>(
(tra & TRA_MPEG1) ? ResStr(IDS_FGMANAGER_0) : L"MPEG-1 Video Decoder (low merit)",
(tra & TRA_MPEG1) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG1Packet);
@@ -1642,7 +1642,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_MPEG2
- pFGF = new CFGFilterInternal<CMpeg2DecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpeg2DecFilter>(
(tra & TRA_MPEG2) ? ResStr(IDS_FGMANAGER_1) : L"MPEG-2 Video Decoder (low merit)",
(tra & TRA_MPEG2) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
@@ -1653,7 +1653,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_MPEGAUDIO
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_MPA) ? ResStr(IDS_FGMANAGER_2) : L"MPEG-1 Audio Decoder (low merit)",
(tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MP3);
@@ -1662,7 +1662,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1Packet);
m_transform.AddTail(pFGF);
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_MPA) ? ResStr(IDS_FGMANAGER_3) : L"MPEG-2 Audio Decoder (low merit)",
(tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_AUDIO);
@@ -1673,7 +1673,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_LPCM
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_LPCM) ? ResStr(IDS_FGMANAGER_4) : L"LPCM Audio Decoder (low merit)",
(tra & TRA_LPCM) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DVD_LPCM_AUDIO);
@@ -1685,7 +1685,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_AC3
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_AC3) ? ResStr(IDS_FGMANAGER_5) : L"AC3 Audio Decoder (low merit)",
(tra & TRA_AC3) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DOLBY_AC3);
@@ -1697,7 +1697,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_DTS
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_DTS) ? ResStr(IDS_AG_DTS_DECODER) : L"DTS Decoder (low merit)",
(tra & TRA_DTS) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DTS);
@@ -1709,7 +1709,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_AAC
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_AAC) ? ResStr(IDS_AG_AAC_DECODER) : L"AAC Decoder (low merit)",
(tra & TRA_AAC) ? MERIT64_ABOVE_DSHOW+1 : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_AAC);
@@ -1728,7 +1728,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_PS2AUDIO
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_PS2AUD) ? ResStr(IDS_FGMANAGER_8) : L"PS2 Audio Decoder (low merit)",
(tra & TRA_PS2AUD) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_PS2_PCM);
@@ -1739,7 +1739,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_REALVIDEO
- pFGF = new CFGFilterInternal<CRealVideoDecoder>(
+ pFGF = DNew CFGFilterInternal<CRealVideoDecoder>(
(tra & TRA_RV) ? ResStr(IDS_FGMANAGER_9) : L"RealVideo Decoder (low merit)",
(tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV10);
@@ -1750,7 +1750,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_REALAUDIO
- pFGF = new CFGFilterInternal<CRealAudioDecoder>(
+ pFGF = DNew CFGFilterInternal<CRealAudioDecoder>(
(tra & TRA_RA) ? ResStr(IDS_FGMANAGER_10) : L"RealAudio Decoder (low merit)",
(tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_14_4);
@@ -1764,7 +1764,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_VORBIS
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_VORBIS) ? ResStr(IDS_FGMANAGER_11) : L"Vorbis Audio Decoder (low merit)",
(tra & TRA_VORBIS) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_Vorbis2);
@@ -1772,7 +1772,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_FLAC
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_FLAC) ? L"Flac Audio Decoder" : L"Flac Audio Decoder (low merit)", // TODO : put in resource !
(tra & TRA_FLAC) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_FLAC_FRAMED);
@@ -1780,7 +1780,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_NELLYMOSER
- pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ pFGF = DNew CFGFilterInternal<CMpaDecFilter>(
(tra & TRA_NELLY) ? L"Nellymoser Audio Decoder" : L"Nellymoser Audio Decoder (low merit)", // TODO : put in resource !
(tra & TRA_NELLY) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NELLYMOSER);
@@ -1788,13 +1788,13 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
#if INTERNAL_DECODER_ROQ
- pFGF = new CFGFilterInternal<CRoQVideoDecoder>(
+ pFGF = DNew CFGFilterInternal<CRoQVideoDecoder>(
(tra & TRA_RV) ? ResStr(IDS_FGMANAGER_12) : L"RoQ Video Decoder (low merit)",
(tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RoQV);
m_transform.AddTail(pFGF);
- pFGF = new CFGFilterInternal<CRoQAudioDecoder>(
+ pFGF = DNew CFGFilterInternal<CRoQAudioDecoder>(
(tra & TRA_RA) ? ResStr(IDS_FGMANAGER_13) : L"RoQ Audio Decoder (low merit)",
(tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_RoQA);
@@ -1804,7 +1804,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #if INTERNAL_DECODER_DIRAC
__if_exists(CDiracVideoDecoder)
{
- pFGF = new CFGFilterInternal<CDiracVideoDecoder>(
+ pFGF = DNew CFGFilterInternal<CDiracVideoDecoder>(
(tra & TRA_DIRAC) ? ResStr(IDS_FGMANAGER_14) : L"Dirac Video Decoder (low merit)",
(tra & TRA_DIRAC) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DiracVideo);
@@ -1812,7 +1812,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
- pFGF = new CFGFilterInternal<CNullTextRenderer>(L"NullTextRenderer", MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CNullTextRenderer>(L"NullTextRenderer", MERIT64_DO_USE);
pFGF->AddType(MEDIATYPE_Text, MEDIASUBTYPE_NULL);
pFGF->AddType(MEDIATYPE_ScriptCommand, MEDIASUBTYPE_NULL);
pFGF->AddType(MEDIATYPE_Subtitle, MEDIASUBTYPE_NULL);
@@ -1824,7 +1824,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // High merit MPC Video Decoder
#if INCLUDE_MPC_VIDEO_DECODER | INCLUDE_MPC_DXVA_VIDEO_DECODER
- pFGF = new CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder"), MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder"), MERIT64_ABOVE_DSHOW);
#if INTERNAL_DECODER_FLV
if (ffmpeg_filters & FFM_FLV4)
{
@@ -2004,7 +2004,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) m_transform.AddTail(pFGF);
// Low merit MPC Video Decoder
- pFGF = new CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder (low merit)"), MERIT64_DO_USE);
+ pFGF = DNew CFGFilterInternal<CMPCVideoDecFilter>(_T("MPC Video Decoder (low merit)"), MERIT64_DO_USE);
#if INTERNAL_DECODER_FLV
if (!(ffmpeg_filters & FFM_FLV4))
{
@@ -2187,7 +2187,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // Low merit MPC Audio Decoder
/*
// TODO : not finished!
- pFGF = new CFGFilterInternal<CMPCAudioDecFilter>(_T("MPC Audio Decoder (low merit)"), MERIT64_ABOVE_DSHOW);
+ pFGF = DNew CFGFilterInternal<CMPCAudioDecFilter>(_T("MPC Audio Decoder (low merit)"), MERIT64_ABOVE_DSHOW);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_IMA_AMV);
m_transform.AddTail(pFGF);
*/
@@ -2205,19 +2205,19 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // "Subtitle Mixer" makes an access violation around the
// 11-12th media type when enumerating them on its output.
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{00A95963-3BE5-48C0-AD9F-3356D67EA09D}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{00A95963-3BE5-48C0-AD9F-3356D67EA09D}")), MERIT64_DO_NOT_USE));
// ISCR suxx
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}")), MERIT64_DO_NOT_USE));
// Samsung's "mpeg-4 demultiplexor" can even open matroska files, amazing...
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{99EC0C72-4D1B-411B-AB1F-D561EE049D94}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{99EC0C72-4D1B-411B-AB1F-D561EE049D94}")), MERIT64_DO_NOT_USE));
// LG Video Renderer (lgvid.ax) just crashes when trying to connect it
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{9F711C60-0668-11D0-94D4-0000C02BA972}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{9F711C60-0668-11D0-94D4-0000C02BA972}")), MERIT64_DO_NOT_USE));
// palm demuxer crashes (even crashes graphedit when dropping an .ac3 onto it)
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{BE2CF8A7-08CE-4A2C-9A25-FD726A999196}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{BE2CF8A7-08CE-4A2C-9A25-FD726A999196}")), MERIT64_DO_NOT_USE));
// DCDSPFilter (early versions crash mpc)
{
@@ -2233,20 +2233,20 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)
&& GetFileVersion(buff) < 0x0001000000030000ui64)
{
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE));
}
}
/*
// NVIDIA Transport Demux crashed for someone, I could not reproduce it
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{735823C1-ACC4-11D3-85AC-006008376FB8}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{735823C1-ACC4-11D3-85AC-006008376FB8}")), MERIT64_DO_NOT_USE));
*/
// mainconcept color space converter
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{272D77A0-A852-4851-ADA4-9091FEAD4C86}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{272D77A0-A852-4851-ADA4-9091FEAD4C86}")), MERIT64_DO_NOT_USE));
// Block VSFilter when internal subtitle renderer will get used
if(s.fAutoloadSubtitles) {
if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS || s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_DXR) {
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{9852A670-F845-491B-9BE6-EBD841B8A613}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{9852A670-F845-491B-9BE6-EBD841B8A613}")), MERIT64_DO_NOT_USE));
}
}
@@ -2273,11 +2273,11 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) if(fo->type == FilterOverride::REGISTERED)
{
- pFGF = new CFGFilterRegistry(fo->dispname, merit);
+ pFGF = DNew CFGFilterRegistry(fo->dispname, merit);
}
else if(fo->type == FilterOverride::EXTERNAL)
{
- pFGF = new CFGFilterFile(fo->clsid, fo->path, CStringW(fo->name), merit);
+ pFGF = DNew CFGFilterFile(fo->clsid, fo->path, CStringW(fo->name), merit);
}
if(pFGF)
@@ -2382,62 +2382,64 @@ CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) if(s.fEnableAudioSwitcher)
{
- pFGF = new CFGFilterInternal<CAudioSwitcherFilter>(L"Audio Switcher", m_armerit + 0x100);
+ pFGF = DNew CFGFilterInternal<CAudioSwitcherFilter>(L"Audio Switcher", m_armerit + 0x100);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
// morgan stream switcher
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
}
// Renderers
if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
- m_transform.AddTail(new CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7WINDOWED)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9WINDOWED)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_EVR)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EnhancedVideoRenderer, L"Enhanced Video Renderer", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_EVRAllocatorPresenter, L"Enhanced Video Renderer (custom presenter)", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_DXR)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_MADVR)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_madVR, L"Madshi Video Renderer", m_vrmerit));
else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_COMP)
{
- pFGF = new CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
+ pFGF = DNew CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}
else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_UNCOMP)
{
- pFGF = new CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
+ pFGF = DNew CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}
if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP)
{
- pFGF = new CFGFilterInternal<CNullAudioRenderer>(AUDRNDT_NULL_COMP, MERIT64_ABOVE_DSHOW+2);
+ pFGF = DNew CFGFilterInternal<CNullAudioRenderer>(AUDRNDT_NULL_COMP, MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}
else if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP)
{
- pFGF = new CFGFilterInternal<CNullUAudioRenderer>(AUDRNDT_NULL_UNCOMP, MERIT64_ABOVE_DSHOW+2);
+ pFGF = DNew CFGFilterInternal<CNullUAudioRenderer>(AUDRNDT_NULL_UNCOMP, MERIT64_ABOVE_DSHOW+2);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}
else if(!s.AudioRendererDisplayName.IsEmpty())
{
- pFGF = new CFGFilterRegistry(s.AudioRendererDisplayName, m_armerit);
+ pFGF = DNew CFGFilterRegistry(s.AudioRendererDisplayName, m_armerit);
pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
}
@@ -2469,10 +2471,10 @@ CFGManagerDVD::CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) // have to avoid the old video renderer
if(!s.fXpOrBetter && s.iDSVideoRendererType != VIDRNDT_DS_OVERLAYMIXER || s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
- m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit-1));
+ m_transform.AddTail(DNew CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit-1));
// elecard's decoder isn't suited for dvd playback (atm)
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}")), MERIT64_DO_NOT_USE));
}
#include "..\..\decss\VobFile.h"
@@ -2558,12 +2560,12 @@ CFGManagerCapture::CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) {
AppSettings& s = AfxGetAppSettings();
- CFGFilter* pFGF = new CFGFilterInternal<CDeinterlacerFilter>(L"Deinterlacer", m_vrmerit + 0x100);
+ CFGFilter* pFGF = DNew CFGFilterInternal<CDeinterlacerFilter>(L"Deinterlacer", m_vrmerit + 0x100);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
m_transform.AddTail(pFGF);
// morgan stream switcher
- m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
+ m_transform.AddTail(DNew CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
}
//
@@ -2573,8 +2575,8 @@ CFGManagerCapture::CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd) CFGManagerMuxer::CFGManagerMuxer(LPCTSTR pName, LPUNKNOWN pUnk)
: CFGManagerCustom(pName, pUnk)
{
- m_source.AddTail(new CFGFilterInternal<CSubtitleSourceASS>());
- m_source.AddTail(new CFGFilterInternal<CSSFSourceFilter>());
+ m_source.AddTail(DNew CFGFilterInternal<CSubtitleSourceASS>());
+ m_source.AddTail(DNew CFGFilterInternal<CSSFSourceFilter>());
}
//
diff --git a/src/apps/mplayerc/FakeFilterMapper2.cpp b/src/apps/mplayerc/FakeFilterMapper2.cpp index 4e19d5762..fffb175e2 100644 --- a/src/apps/mplayerc/FakeFilterMapper2.cpp +++ b/src/apps/mplayerc/FakeFilterMapper2.cpp @@ -264,7 +264,7 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, {
if(rclsid == CLSID_FilterMapper2)
{
- CFilterMapper2* pFM2 = new CFilterMapper2(true, false, pUnkOuter);
+ CFilterMapper2* pFM2 = DNew CFilterMapper2(true, false, pUnkOuter);
CComPtr<IUnknown> pUnk = (IUnknown*)pFM2;
return pUnk->QueryInterface(riid, ppv);
}
@@ -275,7 +275,7 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault
|| rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
{
- CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
+ CMacrovisionKicker* pMK = DNew CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
CComPtr<IUnknown> pInner;
HRESULT hr;
@@ -570,7 +570,7 @@ STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, {
if(!m_path.IsEmpty())
{
- if(FilterOverride* f = new FilterOverride)
+ if(FilterOverride* f = DNew FilterOverride)
{
f->fDisabled = false;
f->type = FilterOverride::EXTERNAL;
diff --git a/src/apps/mplayerc/FileVersionInfo.cpp b/src/apps/mplayerc/FileVersionInfo.cpp index 43aa7be18..8a4646187 100644 --- a/src/apps/mplayerc/FileVersionInfo.cpp +++ b/src/apps/mplayerc/FileVersionInfo.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "FileVersionInfo.h"
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
//-------------------------------------------------------------------
// CFileVersionInfo
//-------------------------------------------------------------------
@@ -84,7 +78,7 @@ BOOL CFileVersionInfo::Create(LPCTSTR lpszFileName) if (!dwFileVersionInfoSize)
return FALSE;
- LPVOID lpData = (LPVOID)new BYTE[dwFileVersionInfoSize];
+ LPVOID lpData = (LPVOID)DNew BYTE[dwFileVersionInfoSize];
if (!lpData)
return FALSE;
diff --git a/src/apps/mplayerc/FullscreenWnd.cpp b/src/apps/mplayerc/FullscreenWnd.cpp index f6ccc2d2b..55a4076c4 100644 --- a/src/apps/mplayerc/FullscreenWnd.cpp +++ b/src/apps/mplayerc/FullscreenWnd.cpp @@ -49,6 +49,16 @@ BEGIN_MESSAGE_MAP(CFullscreenWnd, CWnd) END_MESSAGE_MAP()
+LRESULT CFullscreenWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_COMMAND :
+ m_pMainFrame->PostMessage(message, wParam, lParam);
+ break;
+ }
+ return CWnd::WindowProc(message, wParam, lParam);
+}
BOOL CFullscreenWnd::PreTranslateMessage(MSG* pMsg)
{
diff --git a/src/apps/mplayerc/FullscreenWnd.h b/src/apps/mplayerc/FullscreenWnd.h index e5f8bfd3f..f7e7e0b28 100644 --- a/src/apps/mplayerc/FullscreenWnd.h +++ b/src/apps/mplayerc/FullscreenWnd.h @@ -41,6 +41,8 @@ protected: virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
CMainFrame* m_pMainFrame;
HCURSOR m_hCursor;
diff --git a/src/apps/mplayerc/IPinHook.cpp b/src/apps/mplayerc/IPinHook.cpp index c2b156a68..354db7100 100644 --- a/src/apps/mplayerc/IPinHook.cpp +++ b/src/apps/mplayerc/IPinHook.cpp @@ -280,7 +280,7 @@ static void LOG_TOFILE(LPCTSTR FileName, LPCTSTR fmt, ...) va_list args;
va_start(args, fmt);
int nCount = _vsctprintf(fmt, args) + 1;
- if(TCHAR* buff = new TCHAR[nCount])
+ if(TCHAR* buff = DNew TCHAR[nCount])
{
FILE* f;
_vstprintf_s(buff, nCount, fmt, args);
@@ -1366,7 +1366,7 @@ static HRESULT STDMETHODCALLTYPE CreateVideoDecoderMine( #ifdef _DEBUG
if ((Guid == DXVA2_ModeH264_E) || (Guid == DXVA2_ModeVC1_D) || (Guid == DXVA_Intel_H264_ClearVideo))
{
- *ppDecode = new CFakeDirectXVideoDecoder (NULL, *ppDecode);
+ *ppDecode = DNew CFakeDirectXVideoDecoder (NULL, *ppDecode);
(*ppDecode)->AddRef();
}
diff --git a/src/apps/mplayerc/Ifo.cpp b/src/apps/mplayerc/Ifo.cpp index 88c76c803..f0868960f 100644 --- a/src/apps/mplayerc/Ifo.cpp +++ b/src/apps/mplayerc/Ifo.cpp @@ -194,7 +194,7 @@ bool CIfo::OpenFile (LPCTSTR strFile) if (hFile != INVALID_HANDLE_VALUE)
{
DWORD dwSize = GetFileSize (hFile, NULL);
- m_pBuffer = new BYTE [dwSize];
+ m_pBuffer = DNew BYTE [dwSize];
ReadFile (hFile, m_pBuffer, dwSize, &m_dwSize, NULL);
CloseHandle (hFile);
diff --git a/src/apps/mplayerc/LineNumberEdit.cpp b/src/apps/mplayerc/LineNumberEdit.cpp index 563bd4a15..9566e2cdd 100644 --- a/src/apps/mplayerc/LineNumberEdit.cpp +++ b/src/apps/mplayerc/LineNumberEdit.cpp @@ -89,12 +89,6 @@ #include "stdafx.h"
#include "LineNumberEdit.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
// Registered message to allow selection of complete
// lines by clicking the line number
UINT urm_SELECTLINE = ::RegisterWindowMessage( _T("_LINE_NUMBER_EDIT_SELECTLINE_") );
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index 9458a1bc3..750c692b1 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -140,13 +140,6 @@ bool m_PlayListBarVisible = false; bool m_Change_Monitor = false;
-/*
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-*/
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
@@ -319,8 +312,52 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND(ID_VIEW_TEARING_TEST, OnViewTearingTest)
ON_UPDATE_COMMAND_UI(ID_VIEW_DISPLAYSTATS, OnUpdateViewDisplayStats)
ON_COMMAND(ID_VIEW_DISPLAYSTATS, OnViewDisplayStats)
+ ON_COMMAND(ID_VIEW_DISPLAYSTATS_SC, OnViewDisplayStatsSC)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_FULLSCREENGUISUPPORT, OnUpdateViewFullscreenGUISupport)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_HIGHCOLORRESOLUTION, OnUpdateViewHighColorResolution)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_ENABLEFRAMETIMECORRECTION, OnUpdateViewEnableFrameTimeCorrection)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VSYNC, OnUpdateViewVSync)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VSYNCOFFSET, OnUpdateViewVSyncOffset)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VSYNCACCURATE, OnUpdateViewVSyncAccurate)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_EVROUTPUTRANGE_0_255, OnUpdateViewEVROutputRange)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_EVROUTPUTRANGE_16_235, OnUpdateViewEVROutputRange)
+
+ ON_UPDATE_COMMAND_UI(ID_VIEW_FLUSHGPU_BEFOREVSYNC, OnUpdateViewFlushGPU)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_FLUSHGPU_AFTERPRESENT, OnUpdateViewFlushGPU)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_FLUSHGPU_WAIT, OnUpdateViewFlushGPU)
+
+ ON_UPDATE_COMMAND_UI(ID_VIEW_D3DFULLSCREEN, OnUpdateViewD3DFullscreen)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_DISABLEDESKTOPCOMPOSITION, OnUpdateViewDisableDesktopComposition)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_ALTERNATIVEVSYNC, OnUpdateViewAlternativeVSync)
+
+
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VSYNCOFFSET_INCREASE, OnUpdateViewVSyncOffsetIncrease)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VSYNCOFFSET_DECREASE, OnUpdateViewVSyncOffsetDecrease)
+ ON_COMMAND(ID_VIEW_FULLSCREENGUISUPPORT, OnViewFullscreenGUISupport)
+ ON_COMMAND(ID_VIEW_HIGHCOLORRESOLUTION, OnViewHighColorResolution)
+ ON_COMMAND(ID_VIEW_ENABLEFRAMETIMECORRECTION, OnViewEnableFrameTimeCorrection)
+ ON_COMMAND(ID_VIEW_VSYNC, OnViewVSync)
+ ON_COMMAND(ID_VIEW_VSYNCACCURATE, OnViewVSyncAccurate)
+
+ ON_COMMAND(ID_VIEW_EVROUTPUTRANGE_0_255, OnViewEVROutputRange_0_255)
+ ON_COMMAND(ID_VIEW_EVROUTPUTRANGE_16_235, OnViewEVROutputRange_16_235)
+
+ ON_COMMAND(ID_VIEW_FLUSHGPU_BEFOREVSYNC, OnViewFlushGPUBeforeVSync)
+ ON_COMMAND(ID_VIEW_FLUSHGPU_AFTERPRESENT, OnViewFlushGPUAfterVSync)
+ ON_COMMAND(ID_VIEW_FLUSHGPU_WAIT, OnViewFlushGPUWait)
+
+ ON_COMMAND(ID_VIEW_D3DFULLSCREEN, OnViewD3DFullScreen)
+ ON_COMMAND(ID_VIEW_DISABLEDESKTOPCOMPOSITION, OnViewDisableDesktopComposition)
+ ON_COMMAND(ID_VIEW_ALTERNATIVEVSYNC, OnViewAlternativeVSync)
+ ON_COMMAND(ID_VIEW_RESET_DEFAULT, OnViewResetDefault)
+ ON_COMMAND(ID_VIEW_RESET_OPTIMAL, OnViewResetOptimal)
+
+ ON_COMMAND(ID_VIEW_VSYNCOFFSET_INCREASE, OnViewVSyncOffsetIncrease)
+ ON_COMMAND(ID_VIEW_VSYNCOFFSET_DECREASE, OnViewVSyncOffsetDecrease)
ON_UPDATE_COMMAND_UI(ID_SHADER_TOGGLE, OnUpdateShaderToggle)
ON_COMMAND(ID_SHADER_TOGGLE, OnShaderToggle)
+ ON_UPDATE_COMMAND_UI(ID_SHADER_TOGGLESCREENSPACE, OnUpdateShaderToggleScreenSpace)
+ ON_COMMAND(ID_SHADER_TOGGLESCREENSPACE, OnShaderToggleScreenSpace)
ON_UPDATE_COMMAND_UI(ID_VIEW_REMAINING_TIME, OnUpdateViewRemainingTime)
ON_COMMAND(ID_VIEW_REMAINING_TIME, OnViewRemainingTime)
ON_COMMAND(ID_D3DFULLSCREEN_TOGGLE, OnD3DFullscreenToggle)
@@ -442,7 +479,9 @@ CMainFrame::CMainFrame() : m_lSubtitleShift(0),
m_bToggleShader(false),
m_nStepForwardCount(0),
- m_rtStepForwardStart(0)
+ m_rtStepForwardStart(0),
+ m_bToggleShaderScreenSpace(false),
+ m_bInOptions(false)
{
m_Lcd.SetVolumeRange(1, 100);
}
@@ -483,7 +522,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) return -1; // fail to create
}
- m_pFullscreenWnd = new CFullscreenWnd(this);
+ m_pFullscreenWnd = DNew CFullscreenWnd(this);
m_bars.AddTail(&m_wndSeekBar);
m_bars.AddTail(&m_wndToolBar);
@@ -551,16 +590,30 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) StartWebServer(s.nWebServerPort);
// Casimir666 : rechargement des Shaders
- CString strList = AfxGetAppSettings().strShaderList;
- CString strRes;
- int curPos= 0;
-
- strRes = strList.Tokenize (_T("|"), curPos);
- while (strRes != _T(""))
{
- m_shaderlabels.AddTail (strRes);
- strRes = strList.Tokenize(_T("|"),curPos);
- };
+ CString strList = AfxGetAppSettings().strShaderList;
+ CString strRes;
+ int curPos= 0;
+
+ strRes = strList.Tokenize (_T("|"), curPos);
+ while (strRes != _T(""))
+ {
+ m_shaderlabels.AddTail (strRes);
+ strRes = strList.Tokenize(_T("|"),curPos);
+ }
+ }
+ {
+ CString strList = AfxGetAppSettings().strShaderListScreenSpace;
+ CString strRes;
+ int curPos= 0;
+
+ strRes = strList.Tokenize (_T("|"), curPos);
+ while (strRes != _T(""))
+ {
+ m_shaderlabelsScreenSpace.AddTail (strRes);
+ strRes = strList.Tokenize(_T("|"),curPos);
+ }
+ }
m_strTitle.Format (L"%s - v%s", ResStr(IDR_MAINFRAME), AfxGetMyApp()->m_strVersion);
SetWindowText(m_strTitle);
@@ -599,16 +652,30 @@ void CMainFrame::OnDestroy() void CMainFrame::OnClose()
{
// Casimir666 : sauvegarde de la liste des shaders
- POSITION pos;
- CString strList = "";
-
- pos = m_shaderlabels.GetHeadPosition();
- while(pos)
{
- strList += m_shaderlabels.GetAt (pos) + "|";
- m_dockingbars.GetNext(pos);
+ POSITION pos;
+ CString strList = "";
+
+ pos = m_shaderlabels.GetHeadPosition();
+ while(pos)
+ {
+ strList += m_shaderlabels.GetAt (pos) + "|";
+ m_dockingbars.GetNext(pos);
+ }
+ AfxGetAppSettings().strShaderList = strList;
+ }
+ {
+ POSITION pos;
+ CString strList = "";
+
+ pos = m_shaderlabelsScreenSpace.GetHeadPosition();
+ while(pos)
+ {
+ strList += m_shaderlabelsScreenSpace.GetAt (pos) + "|";
+ m_dockingbars.GetNext(pos);
+ }
+ AfxGetAppSettings().strShaderListScreenSpace = strList;
}
- AfxGetAppSettings().strShaderList = strList;
m_wndPlaylistBar.SavePlaylist();
@@ -810,7 +877,7 @@ LRESULT CMainFrame::OnNotifyIcon(WPARAM wParam, LPARAM lParam) POINT p;
GetCursorPos(&p);
SetForegroundWindow();
- m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, this);
+ m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, GetModalParent());
PostMessage(WM_NULL);
break;
}
@@ -1447,7 +1514,8 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent) m_wndSubresyncBar.SetTime(pos);
- if(m_pCAP && GetMediaState() == State_Paused) m_pCAP->Paint(true);
+ if(m_pCAP && GetMediaState() == State_Paused)
+ m_pCAP->Paint(false);
}
else if(nIDEvent == TIMER_FULLSCREENCONTROLBARHIDER)
{
@@ -1477,7 +1545,8 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent) if (m_pFullscreenWnd->IsWindow())
{
TRACE ("==> HIDE!\n");
- m_pFullscreenWnd->ShowCursor(false);
+ if (!m_bInOptions)
+ m_pFullscreenWnd->ShowCursor(false);
KillTimer(TIMER_FULLSCREENMOUSEHIDER);
}
else
@@ -2189,7 +2258,9 @@ BOOL CMainFrame::OnButton(UINT id, UINT nFlags, CPoint point) CRect r;
if (m_pFullscreenWnd->IsWindow())
+ {
m_pFullscreenWnd->GetClientRect(r);
+ }
else
{
m_wndView.GetClientRect(r);
@@ -2726,6 +2797,7 @@ BOOL CMainFrame::OnMenu(CMenu* pMenu) KillTimer(TIMER_FULLSCREENMOUSEHIDER);
m_fHideCursor = false;
+ CWnd *pModalParent = GetModalParent();
CPoint point;
GetCursorPos(&point);
@@ -2736,7 +2808,7 @@ BOOL CMainFrame::OnMenu(CMenu* pMenu) void CMainFrame::OnMenuPlayerShort()
{
- if(IsCaptionMenuHidden())
+ if(IsCaptionMenuHidden() || m_pFullscreenWnd->IsWindow())
{
OnMenu(m_popupmain.GetSubMenu(0));
}
@@ -3358,10 +3430,9 @@ void CMainFrame::OnFileOpenQuick() CString filter;
CAtlArray<CString> mask;
AfxGetAppSettings().Formats.GetFilter(filter, mask);
-
COpenFileDlg fd(mask, true, NULL, NULL,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY,
- filter, this);
+ filter, GetModalParent());
if(fd.DoModal() != IDOK) return;
CAtlList<CString> fns;
@@ -3525,7 +3596,7 @@ BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS) SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
fSetForegroundWindow = true;
- CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
if(p) {p->path = s.slFiles.GetHead(); p->subs.AddTailList(&s.slSubs);}
OpenMedia(p);
}
@@ -3625,7 +3696,7 @@ void CMainFrame::OnFileOpendvd() ShowWindow(SW_SHOW);
- CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
if(p)
{
AppSettings& s = AfxGetAppSettings();
@@ -3668,7 +3739,7 @@ void CMainFrame::OnFileOpendvd() }
else
{
- CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
p->path = path;
p->path.Replace('/', '\\');
if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
@@ -3693,7 +3764,7 @@ void CMainFrame::OnFileOpendevice() m_wndPlaylistBar.Empty();
- CAutoPtr<OpenDeviceData> p(new OpenDeviceData());
+ CAutoPtr<OpenDeviceData> p(DNew OpenDeviceData());
if(p) {p->DisplayName[0] = capdlg.m_vidstr; p->DisplayName[1] = capdlg.m_audstr;}
OpenMedia(p);
}
@@ -3791,7 +3862,7 @@ void CMainFrame::OnFileSaveAs() CFileDialog fd(FALSE, 0, out,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
- ResStr(IDS_MAINFRM_48), this, 0);
+ ResStr(IDS_MAINFRM_48), GetModalParent(), 0);
if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) return;
CPath p(fd.GetPathName());
@@ -3865,7 +3936,7 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent) hr = m_pCAP->GetDIB(NULL, (DWORD*)&size);
if(FAILED(hr)) {errmsg.Format(ResStr(IDS_MAINFRM_49), hr); break;}
- if(!(*ppData = new BYTE[size])) return false;
+ if(!(*ppData = DNew BYTE[size])) return false;
hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size);
// if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;}
@@ -3895,7 +3966,7 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent) if(FAILED(hr) || dwSize == 0) {errmsg.Format(ResStr(IDS_MAINFRM_51), hr); break;}
size = (long)dwSize+sizeof(BITMAPINFOHEADER);
- if(!(*ppData = new BYTE[size])) return false;
+ if(!(*ppData = DNew BYTE[size])) return false;
memcpy_s (*ppData, size, &bih, sizeof(BITMAPINFOHEADER));
memcpy_s (*ppData+sizeof(BITMAPINFOHEADER), size-sizeof(BITMAPINFOHEADER), pDib, dwSize);
CoTaskMemFree (pDib);
@@ -3905,7 +3976,7 @@ bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent) hr = pBV->GetCurrentImage(&size, NULL);
if(FAILED(hr) || size == 0) {errmsg.Format(ResStr(IDS_MAINFRM_51), hr); break;}
- if(!(*ppData = new BYTE[size])) return false;
+ if(!(*ppData = DNew BYTE[size])) return false;
hr = pBV->GetCurrentImage(&size, (long*)*ppData);
if(FAILED(hr)) {errmsg.Format(ResStr(IDS_MAINFRM_51), hr); break;}
@@ -3957,7 +4028,7 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) if(bi->bmiHeader.biBitCount <= 8)
{
if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]);
+ else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
}
fwrite(&bfh, 1, sizeof(bfh), f);
@@ -3990,7 +4061,7 @@ void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size) if(bi->bmiHeader.biBitCount <= 8)
{
if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]);
+ else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
}
pbmfh = (LPBITMAPFILEHEADER)&bfh;
pbits = &pData[pbmfh->bfOffBits-sizeof(bfh)];
@@ -4183,7 +4254,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) CRenderedTextSubtitle rts(&csSubLock);
rts.CreateDefaultStyle(0);
rts.m_dstScreenSize.SetSize(width, height);
- STSStyle* style = new STSStyle();
+ STSStyle* style = DNew STSStyle();
style->marginRect.SetRectEmpty();
rts.AddStyle(_T("thumbs"), style);
@@ -4266,7 +4337,7 @@ void CMainFrame::SaveThumbnails(LPCTSTR fn) CRenderedTextSubtitle rts(&csSubLock);
rts.CreateDefaultStyle(0);
rts.m_dstScreenSize.SetSize(width, height);
- STSStyle* style = new STSStyle();
+ STSStyle* style = DNew STSStyle();
style->marginRect.SetRect(margin*2, margin*2, margin*2, height-infoheight-margin);
rts.AddStyle(_T("thumbs"), style);
@@ -4380,7 +4451,7 @@ void CMainFrame::OnFileSaveImage() CFileDialog fd(FALSE, 0, (LPCTSTR)psrc,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
- _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), this, 0);
+ _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), GetModalParent(), 0);
if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
@@ -4457,7 +4528,7 @@ void CMainFrame::OnFileSaveThumbnails() CSaveThumbnailsDialog fd(
s.ThumbRows, s.ThumbCols, s.ThumbWidth,
0, (LPCTSTR)psrc,
- _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), this);
+ _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png||"), GetModalParent());
if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
@@ -4517,7 +4588,7 @@ void CMainFrame::OnFileLoadsubtitle() CFileDialog fd(TRUE, NULL, NULL,
OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY,
- szFilter, this, 0);
+ szFilter, GetModalParent(), 0);
if(fd.DoModal() != IDOK) return;
@@ -4551,7 +4622,7 @@ void CMainFrame::OnFileSavesubtitle() CFileDialog fd(FALSE, NULL, NULL,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
- _T("VobSub (*.idx, *.sub)|*.idx;*.sub||"), this, 0);
+ _T("VobSub (*.idx, *.sub)|*.idx;*.sub||"), GetModalParent(), 0);
if(fd.DoModal() == IDOK)
{
@@ -4574,7 +4645,7 @@ void CMainFrame::OnFileSavesubtitle() filter += _T("Advanced Sub Station Alpha (*.ass)|*.ass|");
filter += _T("|");
- CSaveTextFileDialog fd(pRTS->m_encoding, NULL, NULL, filter, this);
+ CSaveTextFileDialog fd(pRTS->m_encoding, NULL, NULL, filter, GetModalParent());
if(fd.DoModal() == IDOK)
{
@@ -4683,7 +4754,7 @@ void CMainFrame::OnFileISDBDownload() else if(param == "" && value == "end") break;
}
- CSubtitleDlDlg dlg(movies, this);
+ CSubtitleDlDlg dlg(movies, GetModalParent());
if(IDOK == dlg.DoModal())
{
if(dlg.m_fReplaceSubs)
@@ -4702,7 +4773,7 @@ void CMainFrame::OnFileISDBDownload() if(OpenUrl(is, CString(url+args), str))
{
- CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&m_csSubLock));
if(pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(s.name)) && pRTS->GetStreamCount() > 0)
{
CComPtr<ISubStream> pSubStream = pRTS.Detach();
@@ -4730,7 +4801,7 @@ void CMainFrame::OnUpdateFileISDBDownload(CCmdUI *pCmdUI) void CMainFrame::OnFileProperties()
{
- CPPageFileInfoSheet m_fileinfo(m_wndPlaylistBar.GetCur(), this);
+ CPPageFileInfoSheet m_fileinfo(m_wndPlaylistBar.GetCur(), this, GetModalParent());
m_fileinfo.DoModal();
}
@@ -4769,6 +4840,313 @@ void CMainFrame::OnViewDisplayStats() AfxGetMyApp()->m_fDisplayStats = ! AfxGetMyApp()->m_fDisplayStats;
}
+void CMainFrame::OnViewDisplayStatsSC()
+{
+ ++AfxGetMyApp()->m_fDisplayStats;
+ if (AfxGetMyApp()->m_fDisplayStats > 3)
+ AfxGetMyApp()->m_fDisplayStats = 0;
+}
+
+void CMainFrame::OnUpdateViewVSync(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck (!supported || (s.m_RenderSettings.iVMR9VSync));
+}
+
+void CMainFrame::OnUpdateViewVSyncOffset(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) && s.m_RenderSettings.fVMR9AlterativeVSync;
+
+ pCmdUI->Enable (false);
+ CString Temp;
+ Temp.Format(L"%d", s.m_RenderSettings.iVMR9VSyncOffset);
+ pCmdUI->SetText(Temp);
+}
+
+void CMainFrame::OnUpdateViewVSyncAccurate(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMR9VSyncAccurate);
+}
+
+void CMainFrame::OnUpdateViewEVROutputRange(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+
+ if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_0_255)
+ pCmdUI->SetCheck(s.m_RenderSettings.iEVROutputRange == 0);
+ else if (pCmdUI->m_nID == ID_VIEW_EVROUTPUTRANGE_16_235)
+ pCmdUI->SetCheck(s.m_RenderSettings.iEVROutputRange == 1);
+}
+
+
+void CMainFrame::OnUpdateViewFlushGPU(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+
+ if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_BEFOREVSYNC)
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMRFlushGPUBeforeVSync != 0);
+ else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_AFTERPRESENT)
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMRFlushGPUAfterPresent != 0);
+ else if (pCmdUI->m_nID == ID_VIEW_FLUSHGPU_WAIT)
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMRFlushGPUWait != 0);
+
+}
+
+void CMainFrame::OnUpdateViewD3DFullscreen(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.fD3DFullscreen);
+}
+
+void CMainFrame::OnUpdateViewDisableDesktopComposition(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMRDisableDesktopComposition);
+}
+
+void CMainFrame::OnUpdateViewAlternativeVSync(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.fVMR9AlterativeVSync);
+}
+
+
+void CMainFrame::OnUpdateViewFullscreenGUISupport(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.iVMR9FullscreenGUISupport);
+}
+
+void CMainFrame::OnUpdateViewHighColorResolution(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.iEVRHighColorResolution);
+}
+
+void CMainFrame::OnUpdateViewEnableFrameTimeCorrection(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D);
+
+ pCmdUI->Enable (supported);
+ pCmdUI->SetCheck(s.m_RenderSettings.iEVREnableFrameTimeCorrection);
+}
+
+void CMainFrame::OnUpdateViewVSyncOffsetIncrease(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) && s.m_RenderSettings.fVMR9AlterativeVSync;
+
+ pCmdUI->Enable (supported);
+}
+
+void CMainFrame::OnUpdateViewVSyncOffsetDecrease(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+ bool supported = ((s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM || s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) && s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) && s.m_RenderSettings.fVMR9AlterativeVSync;
+
+ pCmdUI->Enable (supported);
+}
+
+void CMainFrame::OnViewVSync()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMR9VSync = !s.m_RenderSettings.iVMR9VSync;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"VSync: %s", s.m_RenderSettings.iVMR9VSync? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewVSyncAccurate()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMR9VSyncAccurate = !s.m_RenderSettings.iVMR9VSyncAccurate;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Accurate VSync: %s", s.m_RenderSettings.iVMR9VSyncAccurate? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewEVROutputRange_0_255()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iEVROutputRange = 0;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Output Range: 0 - 255");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewEVROutputRange_16_235()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iEVROutputRange = 1;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Output Range: 16 - 235");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewFlushGPUBeforeVSync()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMRFlushGPUBeforeVSync = !s.m_RenderSettings.iVMRFlushGPUBeforeVSync;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Flush GPU before VSync: %s", s.m_RenderSettings.iVMRFlushGPUBeforeVSync? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewFlushGPUAfterVSync()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMRFlushGPUAfterPresent = !s.m_RenderSettings.iVMRFlushGPUAfterPresent;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Flush GPU after Present: %s", s.m_RenderSettings.iVMRFlushGPUAfterPresent? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewFlushGPUWait()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMRFlushGPUWait = !s.m_RenderSettings.iVMRFlushGPUWait;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Wait for GPU Flush: %s", s.m_RenderSettings.iVMRFlushGPUWait? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewD3DFullScreen()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.fD3DFullscreen = !s.fD3DFullscreen;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"D3D Fullscreen (Requires restart): %s", s.fD3DFullscreen? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewDisableDesktopComposition()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMRDisableDesktopComposition = !s.m_RenderSettings.iVMRDisableDesktopComposition;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Disable desktop composition: %s", s.m_RenderSettings.iVMRDisableDesktopComposition? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewAlternativeVSync()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.fVMR9AlterativeVSync = !s.m_RenderSettings.fVMR9AlterativeVSync;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Alternative VSync: %s", s.m_RenderSettings.fVMR9AlterativeVSync? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewResetDefault()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.SetDefault();
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Renderer settings reset to default");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewResetOptimal()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.SetOptimal();
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Renderer settings reset to optimal");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewFullscreenGUISupport()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iVMR9FullscreenGUISupport = !s.m_RenderSettings.iVMR9FullscreenGUISupport;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"D3D Fullscreen GUI Support: %s", s.m_RenderSettings.iVMR9FullscreenGUISupport? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewHighColorResolution()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iEVRHighColorResolution = !s.m_RenderSettings.iEVRHighColorResolution;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"10 bit RGB: %s", s.m_RenderSettings.iEVRHighColorResolution? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewEnableFrameTimeCorrection()
+{
+ AppSettings& s = AfxGetAppSettings();
+ s.m_RenderSettings.iEVREnableFrameTimeCorrection = !s.m_RenderSettings.iEVREnableFrameTimeCorrection;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"Frame Time Correction: %s", s.m_RenderSettings.iEVREnableFrameTimeCorrection? L"On":L"Off");
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewVSyncOffsetIncrease()
+{
+ AppSettings& s = AfxGetAppSettings();
+ ++s.m_RenderSettings.iVMR9VSyncOffset;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"VSync Offset: %d", s.m_RenderSettings.iVMR9VSyncOffset);
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
+void CMainFrame::OnViewVSyncOffsetDecrease()
+{
+ AppSettings& s = AfxGetAppSettings();
+ --s.m_RenderSettings.iVMR9VSyncOffset;
+ s.UpdateData(true);
+ CString Format;
+ Format.Format(L"VSync Offset: %d", s.m_RenderSettings.iVMR9VSyncOffset);
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, Format);
+}
+
void CMainFrame::OnUpdateViewRemainingTime(CCmdUI* pCmdUI)
{
AppSettings& s = AfxGetAppSettings();
@@ -4788,20 +5166,44 @@ void CMainFrame::OnUpdateShaderToggle(CCmdUI* pCmdUI) pCmdUI->SetCheck (m_bToggleShader);
}
+void CMainFrame::OnUpdateShaderToggleScreenSpace(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable (TRUE);
+ pCmdUI->SetCheck (m_bToggleShaderScreenSpace);
+}
+
void CMainFrame::OnShaderToggle()
{
- if (m_bToggleShader)
+ m_bToggleShader = !m_bToggleShader;
+ if (!m_bToggleShader)
{
SetShaders();
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_65));
}
else
{
- if (m_pCAP) m_pCAP->SetPixelShader(NULL, NULL);
+ if (m_pCAP)
+ m_pCAP->SetPixelShader(NULL, NULL);
m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_66));
}
- m_bToggleShader = !m_bToggleShader;
+}
+
+void CMainFrame::OnShaderToggleScreenSpace()
+{
+ m_bToggleShaderScreenSpace = !m_bToggleShaderScreenSpace;
+ if (!m_bToggleShaderScreenSpace)
+ {
+ SetShaders();
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPONSCR));
+ }
+ else
+ {
+ if (m_pCAP2)
+ m_pCAP2->SetPixelShader2(NULL, NULL, true);
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, ResStr(IDS_MAINFRM_PPOFFSCR));
+ }
+
}
void CMainFrame::OnD3DFullscreenToggle()
@@ -5945,7 +6347,7 @@ void CMainFrame::OnPlayFilters(UINT nID) CComPtr<IUnknown> pUnk = m_pparray[nID - ID_FILTERS_SUBITEM_START];
- CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), this);
+ CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), GetModalParent());
if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk)
{
@@ -5955,7 +6357,7 @@ void CMainFrame::OnPlayFilters(UINT nID) if(CComQIPtr<IBaseFilter> pBF = pUnk)
{
HRESULT hr;
- CComPtr<IPropertyPage> pPP = new CInternalPropertyPageTempl<CPinInfoWnd>(NULL, &hr);
+ CComPtr<IPropertyPage> pPP = DNew CInternalPropertyPageTempl<CPinInfoWnd>(NULL, &hr);
ps.AddPage(pPP, pBF);
}
@@ -5971,9 +6373,21 @@ void CMainFrame::OnUpdatePlayFilters(CCmdUI* pCmdUI) pCmdUI->Enable(!m_fCapturing);
}
+enum
+{
+ ID_SHADERS_OFF = ID_SHADERS_START,
+ ID_SHADERS_COMBINE,
+ ID_SHADERS_EDIT,
+ ID_SHADERS_STARTSCR,
+ ID_SHADERS_OFFSCR = ID_SHADERS_STARTSCR,
+ ID_SHADERS_COMBINESCR,
+ ID_SHADERS_ENDSCR,
+ ID_SHADERS_DYNAMIC = ID_SHADERS_ENDSCR,
+};
+
void CMainFrame::OnPlayShaders(UINT nID)
{
- if(nID == ID_SHADERS_START+2)
+ if(nID == ID_SHADERS_EDIT)
{
ShowControlBar(&m_wndShaderEditorBar, TRUE, TRUE);
return;
@@ -5981,16 +6395,25 @@ void CMainFrame::OnPlayShaders(UINT nID) if(!m_pCAP) return;
- if(nID == ID_SHADERS_START)
+ if(nID == ID_SHADERS_OFF)
{
m_shaderlabels.RemoveAll();
}
- else if(nID == ID_SHADERS_START+1)
+ else if(nID == ID_SHADERS_OFFSCR)
+ {
+ m_shaderlabelsScreenSpace.RemoveAll();
+ }
+ else if(nID == ID_SHADERS_COMBINE)
+ {
+ if(IDOK != CShaderCombineDlg(m_shaderlabels, GetModalParent(), false).DoModal())
+ return;
+ }
+ else if(nID == ID_SHADERS_COMBINESCR)
{
- if(IDOK != CShaderCombineDlg(m_shaderlabels, this).DoModal())
+ if(IDOK != CShaderCombineDlg(m_shaderlabelsScreenSpace, GetModalParent(), true).DoModal())
return;
}
- else if(nID >= ID_SHADERS_START+3)
+ else if(nID >= ID_SHADERS_DYNAMIC)
{
MENUITEMINFO mii;
memset(&mii, 0, sizeof(mii));
@@ -6009,17 +6432,28 @@ void CMainFrame::OnUpdatePlayShaders(CCmdUI* pCmdUI) {
if(pCmdUI->m_nID >= ID_SHADERS_START)
{
- pCmdUI->Enable(!!m_pCAP);
+ if (pCmdUI->m_nID >= ID_SHADERS_STARTSCR && pCmdUI->m_nID < ID_SHADERS_ENDSCR )
+ pCmdUI->Enable(!!m_pCAP2);
+ else
+ pCmdUI->Enable(!!m_pCAP);
- if(pCmdUI->m_nID == ID_SHADERS_START)
+ if(pCmdUI->m_nID == ID_SHADERS_OFF)
{
pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
}
- else if(pCmdUI->m_nID == ID_SHADERS_START+1)
+ else if(pCmdUI->m_nID == ID_SHADERS_OFFSCR)
+ {
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.IsEmpty());
+ }
+ else if(pCmdUI->m_nID == ID_SHADERS_COMBINE)
{
pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
}
- else if(pCmdUI->m_nID == ID_SHADERS_START+2)
+ else if(pCmdUI->m_nID == ID_SHADERS_COMBINESCR)
+ {
+ pCmdUI->SetRadio(m_shaderlabelsScreenSpace.GetCount() > 0);
+ }
+ else if(pCmdUI->m_nID == ID_SHADERS_EDIT)
{
pCmdUI->Enable(TRUE);
}
@@ -6120,13 +6554,13 @@ void CMainFrame::OnPlaySubtitles(UINT nID) STSStyle* val;
pRTS->m_styles.GetNextAssoc(pos, key, val);
- CAutoPtr<CPPageSubStyle> page(new CPPageSubStyle());
+ CAutoPtr<CPPageSubStyle> page(DNew CPPageSubStyle());
page->InitStyle(key, *val);
pages.Add(page);
styles.Add(val);
}
- CPropertySheet dlg(_T("Styles..."), this);
+ CPropertySheet dlg(_T("Styles..."), GetModalParent());
for(int i = 0; i < (int)pages.GetCount(); i++)
dlg.AddPage(pages[i]);
@@ -6888,7 +7322,7 @@ void CMainFrame::OnFavoritesDVD(UINT nID) CComPtr<IDvdState> pDvdState;
HRESULT hr = OleLoadFromStream((IStream*)&stream, IID_IDvdState, (void**)&pDvdState);
- CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ CAutoPtr<OpenDVDData> p(DNew OpenDVDData());
if(p) {p->path = fn; p->pDvdState = pDvdState;}
OpenMedia(p);
}
@@ -7259,8 +7693,15 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT m_Change_Monitor = (hm != hm_cur) ? true : false;
if((m_Change_Monitor) && (!m_bToggleShader))
{
- if (m_pCAP) m_pCAP->SetPixelShader(NULL, NULL);
+ if (m_pCAP)
+ m_pCAP->SetPixelShader(NULL, NULL);
+ }
+ if((m_Change_Monitor) && (!m_bToggleShaderScreenSpace))
+ {
+ if (m_pCAP2)
+ m_pCAP2->SetPixelShader2(NULL, NULL, 1);
}
+
}
else
{
@@ -7297,7 +7738,7 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT MoveVideoWindow();
- if((m_Change_Monitor) && (!m_bToggleShader)) // Enabled shader ...
+ if((m_Change_Monitor) && (!m_bToggleShader || !m_bToggleShaderScreenSpace)) // Enabled shader ...
{
SetShaders();
}
@@ -7537,7 +7978,8 @@ double CMainFrame::GetZoomAutoFitScale() void CMainFrame::RepaintVideo()
{
- if(m_pCAP) m_pCAP->Paint(false);
+ if(m_pCAP)
+ m_pCAP->Paint(false);
}
void CMainFrame::SetShaders()
@@ -7556,36 +7998,61 @@ void CMainFrame::SetShaders() }
m_pCAP->SetPixelShader(NULL, NULL);
+ if (m_pCAP2)
+ m_pCAP2->SetPixelShader2(NULL, NULL, true);
- CAtlList<CString> labels;
-
- pos = m_shaderlabels.GetHeadPosition();
- while(pos)
+ for (int i = 0; i < 2; ++i)
{
- const AppSettings::Shader* pShader = NULL;
- if(s2s.Lookup(m_shaderlabels.GetNext(pos), pShader))
- {
- CStringA target = pShader->target;
- CStringA srcdata = pShader->srcdata;
+ if (i == 0 && m_bToggleShader)
+ continue;
+ if (i == 1 && m_bToggleShaderScreenSpace)
+ continue;
+ CAtlList<CString> labels;
- HRESULT hr = m_pCAP->SetPixelShader(srcdata, target);
+ CAtlList<CString> *pLabels;
+ if (i == 0)
+ pLabels = &m_shaderlabels;
+ else
+ {
+ if (!m_pCAP2)
+ break;
+ pLabels = &m_shaderlabelsScreenSpace;
+ }
- if(FAILED(hr))
+ pos = pLabels->GetHeadPosition();
+ while(pos)
+ {
+ const AppSettings::Shader* pShader = NULL;
+ if(s2s.Lookup(pLabels->GetNext(pos), pShader))
{
- m_pCAP->SetPixelShader(NULL, NULL);
- SendStatusMessage(ResStr(IDS_MAINFRM_73) + pShader->label, 3000);
- return;
- }
+ CStringA target = pShader->target;
+ CStringA srcdata = pShader->srcdata;
+
+ HRESULT hr;
+ if (i == 0)
+ hr = m_pCAP->SetPixelShader(srcdata, target);
+ else
+ hr = m_pCAP2->SetPixelShader2(srcdata, target, true);
+
+ if(FAILED(hr))
+ {
+ m_pCAP->SetPixelShader(NULL, NULL);
+ if (m_pCAP2)
+ m_pCAP2->SetPixelShader2(NULL, NULL, true);
+ SendStatusMessage(ResStr(IDS_MAINFRM_73) + pShader->label, 3000);
+ return;
+ }
- labels.AddTail(pShader->label);
+ labels.AddTail(pShader->label);
+ }
}
- }
- if(m_iMediaLoadState == MLS_LOADED)
- {
- CString str = Implode(labels, '|');
- str.Replace(_T("|"), _T(", "));
- SendStatusMessage(ResStr(IDS_AG_SHADER) + str, 3000);
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ CString str = Implode(labels, '|');
+ str.Replace(_T("|"), _T(", "));
+ SendStatusMessage(ResStr(IDS_AG_SHADER) + str, 3000);
+ }
}
}
@@ -7699,7 +8166,7 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) AppSettings& s = AfxGetAppSettings();
// CASIMIR666 todo
- if (s.IsD3DFullscreen() && ((s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) || (s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM)) )
+ if (s.IsD3DFullscreen() && ((s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS) || (s.iDSVideoRendererType == VIDRNDT_DS_EVR_CUSTOM)))
{
CreateFullScreenWindow();
m_pVideoWnd = m_pFullscreenWnd;
@@ -7749,7 +8216,7 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) //if (!IsRealEngineCompatible(p->fns.GetHead()))
// throw ResStr(IDS_REALVIDEO_INCOMPATIBLE);
- if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CRealMediaGraph(m_pVideoWnd->m_hWnd, hr)))
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CRealMediaGraph(m_pVideoWnd->m_hWnd, hr)))
throw ResStr(IDS_AG_OUT_OF_MEMORY);
if(SUCCEEDED(hr) && !!(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
@@ -7757,7 +8224,7 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) }
else if(engine == ShockWave)
{
- if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CShockwaveGraph(m_pVideoWnd->m_hWnd, hr)))
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CShockwaveGraph(m_pVideoWnd->m_hWnd, hr)))
throw ResStr(IDS_AG_OUT_OF_MEMORY);
if(FAILED(hr) || !(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
@@ -7770,7 +8237,7 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) #ifdef _WIN64 // TODOX64
MessageBox (ResStr(IDS_MAINFRM_78), _T(""), MB_OK);
#else
- if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CQuicktimeGraph(m_pVideoWnd->m_hWnd, hr)))
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CQuicktimeGraph(m_pVideoWnd->m_hWnd, hr)))
throw ResStr(IDS_AG_OUT_OF_MEMORY);
if(SUCCEEDED(hr) && !!(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
@@ -7782,16 +8249,16 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) if(!m_fCustomGraph)
{
- pGB = new CFGManagerPlayer(_T("CFGManagerPlayer"), NULL, m_pVideoWnd->m_hWnd);
+ pGB = DNew CFGManagerPlayer(_T("CFGManagerPlayer"), NULL, m_pVideoWnd->m_hWnd);
}
}
else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD))
{
- pGB = new CFGManagerDVD(_T("CFGManagerDVD"), NULL, m_pVideoWnd->m_hWnd);
+ pGB = DNew CFGManagerDVD(_T("CFGManagerDVD"), NULL, m_pVideoWnd->m_hWnd);
}
else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD))
{
- pGB = new CFGManagerCapture(_T("CFGManagerCapture"), NULL, m_pVideoWnd->m_hWnd);
+ pGB = DNew CFGManagerCapture(_T("CFGManagerCapture"), NULL, m_pVideoWnd->m_hWnd);
}
if(!pGB)
@@ -7818,12 +8285,21 @@ void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD) throw _T("Could not set target window for graph notification");
}
- m_pProv = (IUnknown*)new CKeyProvider();
+ m_pProv = (IUnknown*)DNew CKeyProvider();
if(CComQIPtr<IObjectWithSite> pObjectWithSite = pGB)
pObjectWithSite->SetSite(m_pProv);
- m_pCB = new CDSMChapterBag(NULL, NULL);
+ m_pCB = DNew CDSMChapterBag(NULL, NULL);
+}
+
+CWnd *CMainFrame::GetModalParent()
+{
+ AppSettings& s = AfxGetAppSettings();
+ CWnd *pParentWnd = this;
+ if (m_pFullscreenWnd->IsWindow() && s.m_RenderSettings.iVMR9FullscreenGUISupport)
+ pParentWnd = m_pFullscreenWnd;
+ return pParentWnd;
}
void CMainFrame::OpenFile(OpenFileData* pOFD)
@@ -7859,7 +8335,7 @@ void CMainFrame::OpenFile(OpenFileData* pOFD) if(s.fReportFailedPins)
{
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
CString err;
@@ -7904,7 +8380,7 @@ void CMainFrame::OpenFile(OpenFileData* pOFD) if(s.fReportFailedPins)
{
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
if(!(pAMOP = pGB))
@@ -8078,7 +8554,7 @@ void CMainFrame::OpenDVD(OpenDVDData* pODD) if(s.fReportFailedPins)
{
CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
- if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, GetModalParent()).DoModal();
}
BeginEnumFilters(pGB, pEF, pBF)
@@ -8299,11 +8775,11 @@ void CMainFrame::OpenCustomizeGraph() {
if(CComQIPtr<IDirectVobSub2> pDVS2 = pBF)
{
-// pDVS2->AdviseSubClock(m_pSubClock = new CSubClock);
+// pDVS2->AdviseSubClock(m_pSubClock = DNew CSubClock);
// break;
// TODO: test multiple dvobsub instances with one clock
- if(!m_pSubClock) m_pSubClock = new CSubClock;
+ if(!m_pSubClock) m_pSubClock = DNew CSubClock;
pDVS2->AdviseSubClock(m_pSubClock);
}
}
@@ -8773,7 +9249,11 @@ bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD) else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p)) OpenCapture(p);
else throw _T("Can't open, invalid input parameters");
+ m_pCAP2 = NULL;
+ m_pCAP = NULL;
+
pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE);
+ pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter2), (void**)&m_pCAP2, TRUE);
pGB->FindInterface(__uuidof(IVMRMixerControl9), (void**)&m_pMC, TRUE);
pGB->FindInterface(__uuidof(IVMRMixerBitmap9), (void**)&pVMB, TRUE);
pGB->FindInterface(__uuidof(IMFVideoMixerBitmap), (void**)&pMFVMB, TRUE);
@@ -8944,6 +9424,7 @@ void CMainFrame::CloseMediaPrivate() // if(pVW) pVW->put_MessageDrain((OAHWND)NULL), pVW->put_Owner((OAHWND)NULL);
m_pCAP = NULL; // IMPORTANT: IVMRSurfaceAllocatorNotify/IVMRSurfaceAllocatorNotify9 has to be released before the VMR/VMR9, otherwise it will crash in Release()
+ m_pCAP2 = NULL;
m_pMC = NULL;
m_pMFVDC = NULL;
m_OSD.Stop();
@@ -9195,7 +9676,7 @@ void CMainFrame::SetupFiltersSubMenu() continue;
}
- CAutoPtr<CMenu> pSubSub(new CMenu);
+ CAutoPtr<CMenu> pSubSub(DNew CMenu);
pSubSub->CreatePopupMenu();
int nPPages = 0;
@@ -9970,6 +10451,7 @@ void CMainFrame::SetupFavoritesSubMenu() }
}
+
void CMainFrame::SetupShadersSubMenu()
{
CMenu* pSub = &m_shaders;
@@ -9979,16 +10461,21 @@ void CMainFrame::SetupShadersSubMenu() CWinApp* pApp = AfxGetApp();
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_START, ResStr(IDS_SHADER_OFF));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_OFF, ResStr(IDS_SHADER_OFF));
- UINT id = ID_SHADERS_START+1;
if(POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition())
{
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_COMBINE));
- pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_EDIT));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_COMBINE, ResStr(IDS_SHADER_COMBINE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_EDIT, ResStr(IDS_SHADER_EDIT));
pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADER_TOGGLE, ResStr(IDS_SHADER_TOGGLE));
pSub->AppendMenu(MF_SEPARATOR);
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_OFFSCR, ResStr(IDS_SHADER_OFFSCREENSPACE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_COMBINESCR, ResStr(IDS_SHADER_COMBINESCREENSPACE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADER_TOGGLESCREENSPACE, ResStr(IDS_SHADER_TOGGLESCREENSPACE));
+ pSub->AppendMenu(MF_SEPARATOR);
+
+ UINT id = ID_SHADERS_DYNAMIC;
MENUITEMINFO mii;
memset(&mii, 0, sizeof(mii));
@@ -10085,7 +10572,7 @@ void CMainFrame::AddTextPassThruFilter() || mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
continue;
- CComQIPtr<IBaseFilter> pTPTF = new CTextPassThruFilter(this);
+ CComQIPtr<IBaseFilter> pTPTF = DNew CTextPassThruFilter(this);
CStringW name;
name.Format(L"TextPassThru%08x", pTPTF);
if(FAILED(pGB->AddFilter(pTPTF, name)))
@@ -10116,14 +10603,14 @@ bool CMainFrame::LoadSubtitle(CString fn) {
if(!pSubStream)
{
- CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
+ CAutoPtr<CVobSubFile> pVSF(DNew CVobSubFile(&m_csSubLock));
if(CString(CPath(fn).GetExtension()).MakeLower() == _T(".idx") && pVSF && pVSF->Open(fn) && pVSF->GetStreamCount() > 0)
pSubStream = pVSF.Detach();
}
if(!pSubStream)
{
- CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&m_csSubLock));
if(pRTS && pRTS->Open(fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
pSubStream = pRTS.Detach();
}
@@ -10668,8 +11155,10 @@ bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPrevi if(fVidPrev)
{
m_pCAP = NULL;
+ m_pCAP2 = NULL;
pGB->Render(pVidPrevPin);
pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE);
+ pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter2), (void**)&m_pCAP2, TRUE);
}
if(fVidCap)
@@ -10811,10 +11300,12 @@ void CMainFrame::ShowOptions(int idPage) {
AppSettings& s = AfxGetAppSettings();
- CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), pGB, this, idPage);
+ CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), pGB, GetModalParent(), idPage);
+ m_bInOptions = true;
if(options.DoModal() == IDOK)
{
+ m_bInOptions = false;
if(!m_fFullScreen)
SetAlwaysOnTop(s.iOnTop);
@@ -10822,12 +11313,13 @@ void CMainFrame::ShowOptions(int idPage) s.UpdateData(true);
}
+ m_bInOptions = false;
}
void CMainFrame::StartWebServer(int nPort)
{
if(!m_pWebServer)
- m_pWebServer.Attach(new CWebServer(this, nPort));
+ m_pWebServer.Attach(DNew CWebServer(this, nPort));
}
void CMainFrame::StopWebServer()
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h index 6fb7eb658..ad0b09799 100644 --- a/src/apps/mplayerc/MainFrm.h +++ b/src/apps/mplayerc/MainFrm.h @@ -197,6 +197,7 @@ class CMainFrame : public CFrameWnd, public CDropTarget CComPtr<IAMDroppedFrames> pAMDF;
CComPtr<ISubPicAllocatorPresenter> m_pCAP;
+ CComPtr<ISubPicAllocatorPresenter2> m_pCAP2;
void SetBalance(int balance);
@@ -360,6 +361,8 @@ protected: void SendNowPlayingToMSN();
void SendNowPlayingTomIRC();
+ CWnd *GetModalParent();
+
void OpenCreateGraphObject(OpenMediaData* pOMD);
void OpenFile(OpenFileData* pOFD);
void OpenDVD(OpenDVDData* pODD);
@@ -413,6 +416,7 @@ public: // shaders
CAtlList<CString> m_shaderlabels;
+ CAtlList<CString> m_shaderlabelsScreenSpace;
void SetShaders();
void UpdateShaders(CString label);
@@ -640,8 +644,46 @@ public: afx_msg void OnViewTearingTest();
afx_msg void OnUpdateViewDisplayStats(CCmdUI* pCmdUI);
afx_msg void OnViewDisplayStats();
+ afx_msg void OnViewDisplayStatsSC();
+ afx_msg void OnUpdateViewVSync(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewVSyncOffset(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewVSyncAccurate(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewFlushGPU(CCmdUI* pCmdUI);
+
+ afx_msg void OnUpdateViewD3DFullscreen(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewDisableDesktopComposition(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewAlternativeVSync(CCmdUI* pCmdUI);
+
+ afx_msg void OnUpdateViewEVROutputRange(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewFullscreenGUISupport(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewHighColorResolution(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewEnableFrameTimeCorrection(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewVSyncOffsetIncrease(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateViewVSyncOffsetDecrease(CCmdUI* pCmdUI);
+ afx_msg void OnViewVSync();
+ afx_msg void OnViewVSyncAccurate();
+ afx_msg void OnViewEVROutputRange_0_255();
+ afx_msg void OnViewEVROutputRange_16_235();
+
+ afx_msg void OnViewFlushGPUBeforeVSync();
+ afx_msg void OnViewFlushGPUAfterVSync();
+ afx_msg void OnViewFlushGPUWait();
+
+ afx_msg void OnViewD3DFullScreen();
+ afx_msg void OnViewDisableDesktopComposition();
+ afx_msg void OnViewAlternativeVSync();
+ afx_msg void OnViewResetDefault();
+ afx_msg void OnViewResetOptimal();
+
+ afx_msg void OnViewFullscreenGUISupport();
+ afx_msg void OnViewHighColorResolution();
+ afx_msg void OnViewEnableFrameTimeCorrection();
+ afx_msg void OnViewVSyncOffsetIncrease();
+ afx_msg void OnViewVSyncOffsetDecrease();
afx_msg void OnUpdateShaderToggle(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateShaderToggleScreenSpace(CCmdUI* pCmdUI);
afx_msg void OnShaderToggle();
+ afx_msg void OnShaderToggleScreenSpace();
afx_msg void OnUpdateViewRemainingTime(CCmdUI* pCmdUI);
afx_msg void OnViewRemainingTime();
afx_msg void OnD3DFullscreenToggle();
@@ -739,6 +781,8 @@ public: __int64 m_rtCurSubPos;
CString m_strTitle;
bool m_bToggleShader;
+ bool m_bToggleShaderScreenSpace;
+ bool m_bInOptions;
void SetLoadState(MPC_LOADSTATE iState);
void SetPlayState(MPC_PLAYSTATE iState);
diff --git a/src/apps/mplayerc/MediaFormats.cpp b/src/apps/mplayerc/MediaFormats.cpp index 25232ecc5..0be5b62f1 100644 --- a/src/apps/mplayerc/MediaFormats.cpp +++ b/src/apps/mplayerc/MediaFormats.cpp @@ -220,7 +220,7 @@ void CMediaFormats::UpdateData(bool fSave) ADDFMT((ResStr(IDS_MEDIAFORMATS_28), _T("flv")));
ADDFMT((ResStr(IDS_MEDIAFORMATS_29), _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave));
ADDFMT((ResStr(IDS_MEDIAFORMATS_30), _T("mov 3g2 3gp2"), false, _T("QuickTime (Alternative)"), QuickTime));
- ADDFMT((ResStr(IDS_AG_PLAYLIST_FILE), _T("asx m3u pls wvx wax wmx mpcpl")));
+ ADDFMT((ResStr(IDS_AG_PLAYLIST_FILE), _T("asx m3u pls wvx wax wmx mpcpl bdmv")));
ADDFMT((ResStr(IDS_AG_OTHER), _T("divx vp6 rmvb amv tta amr")));
#undef ADDFMT
diff --git a/src/apps/mplayerc/Monitors.cpp b/src/apps/mplayerc/Monitors.cpp index c32310bdc..637a0285e 100644 --- a/src/apps/mplayerc/Monitors.cpp +++ b/src/apps/mplayerc/Monitors.cpp @@ -54,7 +54,7 @@ BOOL CALLBACK CMonitors::AddMonitorsCallBack( HMONITOR hMonitor, HDC hdcMonitor, {
LPADDMONITOR pAddMonitor = (LPADDMONITOR)dwData;
- CMonitor* pMonitor = new CMonitor;
+ CMonitor* pMonitor = DNew CMonitor;
pMonitor->Attach( hMonitor );
pAddMonitor->pMonitors->Add( pMonitor );
diff --git a/src/apps/mplayerc/OpenFileDlg.cpp b/src/apps/mplayerc/OpenFileDlg.cpp index fa9fd13e2..69ac969d0 100644 --- a/src/apps/mplayerc/OpenFileDlg.cpp +++ b/src/apps/mplayerc/OpenFileDlg.cpp @@ -43,7 +43,7 @@ COpenFileDlg::COpenFileDlg(CAtlArray<CString>& mask, bool fAllowDirSelection, LP m_fAllowDirSelection = fAllowDirSelection;
m_pOFN->lpstrInitialDir = lpszFileName;
- m_buff = new TCHAR[10000];
+ m_buff = DNew TCHAR[10000];
m_buff[0] = 0;
m_pOFN->lpstrFile = m_buff;
m_pOFN->nMaxFile = 10000;
diff --git a/src/apps/mplayerc/PPageExternalFilters.cpp b/src/apps/mplayerc/PPageExternalFilters.cpp index d84525e45..7a1c04107 100644 --- a/src/apps/mplayerc/PPageExternalFilters.cpp +++ b/src/apps/mplayerc/PPageExternalFilters.cpp @@ -289,7 +289,7 @@ BOOL CPPageExternalFilters::OnInitDialog() POSITION pos = s.filters.GetHeadPosition();
while(pos)
{
- CAutoPtr<FilterOverride> f(new FilterOverride(s.filters.GetNext(pos)));
+ CAutoPtr<FilterOverride> f(DNew FilterOverride(s.filters.GetNext(pos)));
CString name(_T("<unknown>"));
@@ -328,7 +328,7 @@ BOOL CPPageExternalFilters::OnApply() {
if(POSITION pos = (POSITION)m_filters.GetItemData(i))
{
- CAutoPtr<FilterOverride> f(new FilterOverride(m_pFilters.GetAt(pos)));
+ CAutoPtr<FilterOverride> f(DNew FilterOverride(m_pFilters.GetAt(pos)));
f->fDisabled = !m_filters.GetCheck(i);
s.filters.AddTail(f);
}
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.cpp b/src/apps/mplayerc/PPageFileInfoSheet.cpp index 6b18b5a52..bbd3d62a0 100644 --- a/src/apps/mplayerc/PPageFileInfoSheet.cpp +++ b/src/apps/mplayerc/PPageFileInfoSheet.cpp @@ -30,16 +30,16 @@ // CPPageFileInfoSheet
IMPLEMENT_DYNAMIC(CPPageFileInfoSheet, CPropertySheet)
-CPPageFileInfoSheet::CPPageFileInfoSheet(CString fn, CMainFrame* pParentWnd)
+CPPageFileInfoSheet::CPPageFileInfoSheet(CString fn, CMainFrame* pMainFrame, CWnd* pParentWnd)
: CPropertySheet(ResStr(IDS_PROPSHEET_PROPERTIES), pParentWnd, 0)
- , m_clip(fn, pParentWnd->pGB)
- , m_details(fn, pParentWnd->pGB, pParentWnd->m_pCAP)
- , m_res(fn, pParentWnd->pGB)
+ , m_clip(fn, pMainFrame->pGB)
+ , m_details(fn, pMainFrame->pGB, pMainFrame->m_pCAP)
+ , m_res(fn, pMainFrame->pGB)
{
AddPage(&m_clip);
AddPage(&m_details);
- BeginEnumFilters(pParentWnd->pGB, pEF, pBF)
+ BeginEnumFilters(pMainFrame->pGB, pEF, pBF)
{
if(CComQIPtr<IDSMResourceBag> pRB = pBF)
if(pRB && pRB->ResGetCount() > 0)
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.h b/src/apps/mplayerc/PPageFileInfoSheet.h index 7755e097c..1fe2fa58f 100644 --- a/src/apps/mplayerc/PPageFileInfoSheet.h +++ b/src/apps/mplayerc/PPageFileInfoSheet.h @@ -42,7 +42,7 @@ private: CPPageFileInfoRes m_res;
public:
- CPPageFileInfoSheet(CString fn, CMainFrame* pParentWnd);
+ CPPageFileInfoSheet(CString fn, CMainFrame* pMainFrame, CWnd* pParentWnd);
virtual ~CPPageFileInfoSheet();
protected:
diff --git a/src/apps/mplayerc/PPageOutput.cpp b/src/apps/mplayerc/PPageOutput.cpp index f6ef30d88..a7153a54f 100644 --- a/src/apps/mplayerc/PPageOutput.cpp +++ b/src/apps/mplayerc/PPageOutput.cpp @@ -40,11 +40,12 @@ CPPageOutput::CPPageOutput() , m_iQTVideoRendererType(0)
, m_iAPSurfaceUsage(0)
, m_iAudioRendererType(0)
- , m_fVMRSyncFix(FALSE)
+// , m_fVMRSyncFix(FALSE)
, m_iDX9Resizer(0)
, m_fVMR9MixerMode(FALSE)
, m_fVMR9MixerYUV(FALSE)
- , m_iEvrBuffers(5)
+ , m_fVMR9AlterativeVSync(FALSE)
+ , m_iEvrBuffers(L"5")
{
}
@@ -62,12 +63,14 @@ void CPPageOutput::DoDataExchange(CDataExchange* pDX) DDX_CBIndex(pDX, IDC_DX_SURFACE, m_iAPSurfaceUsage);
DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
- DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
+// DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
DDX_Check(pDX, IDC_DSVMR9LOADMIXER, m_fVMR9MixerMode);
DDX_Check(pDX, IDC_DSVMR9YUVMIXER, m_fVMR9MixerYUV);
+ DDX_Check(pDX, IDC_DSVMR9ALTERNATIVEVSYNC, m_fVMR9AlterativeVSync);
DDX_Check(pDX, IDC_FULLSCREEN_MONITOR_CHECK, m_fD3DFullscreen);
- DDX_CBIndex(pDX, IDC_EVR_BUFFERS, m_iEvrBuffers);
+
+ DDX_CBString(pDX, IDC_EVR_BUFFERS, m_iEvrBuffers);
DDX_CBIndex(pDX, IDC_COMBO2, m_iMonitorType);
DDX_Control(pDX, IDC_COMBO2, m_iMonitorTypeCtrl);
@@ -76,7 +79,7 @@ void CPPageOutput::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
ON_UPDATE_COMMAND_UI(IDC_DSVMR9YUVMIXER, OnUpdateMixerYUV)
ON_CBN_SELCHANGE(IDC_DX_SURFACE, &CPPageOutput::OnSurfaceChange)
- ON_CONTROL_RANGE(BN_CLICKED, IDC_DSSYSDEF, IDC_EVR_CUSTOM, &CPPageOutput::OnDSRendererChange)
+ ON_CONTROL_RANGE(BN_CLICKED, IDC_DSSYSDEF, IDC_DSMADVR, &CPPageOutput::OnDSRendererChange)
ON_BN_CLICKED(IDC_FULLSCREEN_MONITOR_CHECK, OnFullscreenCheck)
END_MESSAGE_MAP()
@@ -103,12 +106,13 @@ BOOL CPPageOutput::OnInitDialog() m_iRMVideoRendererType = s.iRMVideoRendererType;
m_iQTVideoRendererType = s.iQTVideoRendererType;
m_iAPSurfaceUsage = s.iAPSurfaceUsage;
- m_fVMRSyncFix = s.fVMRSyncFix;
+// m_fVMRSyncFix = s.fVMRSyncFix;
m_iDX9Resizer = s.iDX9Resizer;
m_fVMR9MixerMode = s.fVMR9MixerMode;
m_fVMR9MixerYUV = s.fVMR9MixerYUV;
+ m_fVMR9AlterativeVSync = s.m_RenderSettings.fVMR9AlterativeVSync;
m_fD3DFullscreen = s.fD3DFullscreen;
- m_iEvrBuffers = s.iEvrBuffers-3;
+ m_iEvrBuffers.Format(L"%d", s.iEvrBuffers);
// Multi-Monitor code
CString str;
@@ -244,6 +248,11 @@ BOOL CPPageOutput::OnInitDialog() DisableRadioButton(IDC_DSDXR, IDC_DSSYSDEF);
}
+ if(!IsCLSIDRegistered(CLSID_madVR))
+ {
+ DisableRadioButton(IDC_DSMADVR, IDC_DSSYSDEF);
+ }
+
// YUV mixing is not compatible with Vista
if (AfxGetMyApp()->IsVistaOrAbove())
{
@@ -268,13 +277,22 @@ BOOL CPPageOutput::OnApply() s.iRMVideoRendererType = m_iRMVideoRendererType;
s.iQTVideoRendererType = m_iQTVideoRendererType;
s.iAPSurfaceUsage = m_iAPSurfaceUsage;
- s.fVMRSyncFix = !!m_fVMRSyncFix;
+// s.fVMRSyncFix = !!m_fVMRSyncFix;
s.AudioRendererDisplayName = m_AudioRendererDisplayNames[m_iAudioRendererType];
s.iDX9Resizer = m_iDX9Resizer;
s.fVMR9MixerMode = !!m_fVMR9MixerMode;
s.fVMR9MixerYUV = !!m_fVMR9MixerYUV;
+ s.m_RenderSettings.fVMR9AlterativeVSync = m_fVMR9AlterativeVSync != 0;
s.fD3DFullscreen = m_fD3DFullscreen ? true : false;
- s.iEvrBuffers = m_iEvrBuffers+3;
+
+ if (!m_iEvrBuffers.IsEmpty())
+ {
+ int Temp = 5;
+ swscanf(m_iEvrBuffers.GetBuffer(), L"%d", &Temp);
+ s.iEvrBuffers = Temp;
+ }
+ else
+ s.iEvrBuffers = 5;
s.f_hmonitor = m_MonitorDisplayNames[m_iMonitorType];
@@ -297,7 +315,8 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton) GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(FALSE);
GetDlgItem(IDC_DSVMR9LOADMIXER)->EnableWindow(FALSE);
GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(FALSE);
- GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
+ GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(FALSE);
+// GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
GetDlgItem(IDC_EVR_BUFFERS)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
GetDlgItem(IDC_EVR_BUFFERS_TXT)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
@@ -306,10 +325,12 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton) case 6 : // VMR9 renderless
GetDlgItem(IDC_DSVMR9LOADMIXER)->EnableWindow(TRUE);
GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(TRUE);
+ GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
case 11 : // EVR custom presenter
GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
- GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE); // Lock back buffer
+// GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE); // Lock back buffer
+ GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
// Force 3D surface with EVR Custom
if (nIDbutton - IDC_DSSYSDEF == 11)
diff --git a/src/apps/mplayerc/PPageOutput.h b/src/apps/mplayerc/PPageOutput.h index 0ddccd8d4..440243fd4 100644 --- a/src/apps/mplayerc/PPageOutput.h +++ b/src/apps/mplayerc/PPageOutput.h @@ -51,12 +51,13 @@ public: int m_iAPSurfaceUsage;
int m_iAudioRendererType;
CComboBox m_iAudioRendererTypeCtrl;
- BOOL m_fVMRSyncFix;
+// BOOL m_fVMRSyncFix;
int m_iDX9Resizer;
BOOL m_fVMR9MixerMode;
BOOL m_fVMR9MixerYUV;
BOOL m_fD3DFullscreen;
- int m_iEvrBuffers;
+ BOOL m_fVMR9AlterativeVSync;
+ CString m_iEvrBuffers;
int m_iMonitorType;
CComboBox m_iMonitorTypeCtrl;
diff --git a/src/apps/mplayerc/PPageSheet.cpp b/src/apps/mplayerc/PPageSheet.cpp index 18f5252ba..f6847c05e 100644 --- a/src/apps/mplayerc/PPageSheet.cpp +++ b/src/apps/mplayerc/PPageSheet.cpp @@ -76,7 +76,7 @@ CPPageSheet::~CPPageSheet() CTreeCtrl* CPPageSheet::CreatePageTreeObject()
{
- return new CTreePropSheetTreeCtrl();
+ return DNew CTreePropSheetTreeCtrl();
}
BEGIN_MESSAGE_MAP(CPPageSheet, CTreePropSheet)
diff --git a/src/apps/mplayerc/PPageSubtitles.cpp b/src/apps/mplayerc/PPageSubtitles.cpp index 3783bf12c..383d73103 100644 --- a/src/apps/mplayerc/PPageSubtitles.cpp +++ b/src/apps/mplayerc/PPageSubtitles.cpp @@ -37,6 +37,7 @@ CPPageSubtitles::CPPageSubtitles() , m_nVerPos(0)
, m_nSPCSize(0)
, m_fSPCPow2Tex(FALSE)
+ , m_fSPCDisableAnim(FALSE)
, m_nSubDelayInterval(0)
{
}
@@ -59,6 +60,7 @@ void CPPageSubtitles::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_EDIT2, m_nHorPosEdit);
DDX_Control(pDX, IDC_EDIT3, m_nVerPosEdit);
DDX_Check(pDX, IDC_CHECK_SPCPOW2TEX, m_fSPCPow2Tex);
+ DDX_Check(pDX, IDC_CHECK_SPCDISABLEANIM, m_fSPCDisableAnim);
DDX_Text(pDX, IDC_EDIT4, m_nSubDelayInterval);
}
@@ -78,6 +80,48 @@ END_MESSAGE_MAP() // CPPageSubtitles message handlers
+int TranslateResIn(int _In)
+{
+ switch (_In)
+ {
+ case 0:
+ return 0;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ return _In + 4;
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ return _In - 5;
+ }
+ return _In;
+}
+
+int TranslateResOut(int _In)
+{
+ switch (_In)
+ {
+ case 0:
+ return 0;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return _In + 5;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ return _In - 4;
+ }
+ return _In;
+}
+
BOOL CPPageSubtitles::OnInitDialog()
{
__super::OnInitDialog();
@@ -90,15 +134,20 @@ BOOL CPPageSubtitles::OnInitDialog() m_nVerPos = s.nVerPos;
m_nVerPosCtrl.SetRange(110,-10);
m_nSPCSize = s.nSPCSize;
- m_nSPCSizeCtrl.SetRange(0, 10);
+ m_nSPCSizeCtrl.SetRange(0, 60);
m_spmaxres.AddString(_T("Desktop"));
+ m_spmaxres.AddString(_T("2560x1600"));
+ m_spmaxres.AddString(_T("1920x1080"));
+ m_spmaxres.AddString(_T("1320x900"));
+ m_spmaxres.AddString(_T("1280x720"));
m_spmaxres.AddString(_T("1024x768"));
m_spmaxres.AddString(_T("800x600"));
m_spmaxres.AddString(_T("640x480"));
m_spmaxres.AddString(_T("512x384"));
m_spmaxres.AddString(_T("384x288"));
- m_spmaxres.SetCurSel(s.nSPCMaxRes);
+ m_spmaxres.SetCurSel(TranslateResIn(s.nSPCMaxRes));
m_fSPCPow2Tex = s.fSPCPow2Tex;
+ m_fSPCDisableAnim = s.fSPCDisableAnim;
m_nSubDelayInterval = s.nSubDelayInterval;
UpdateData(FALSE);
@@ -120,16 +169,18 @@ BOOL CPPageSubtitles::OnApply() || s.nVerPos != m_nVerPos
|| s.nSPCSize != m_nSPCSize
|| s.nSubDelayInterval != m_nSubDelayInterval
- || s.nSPCMaxRes != m_spmaxres.GetCurSel()
- || s.fSPCPow2Tex != !!m_fSPCPow2Tex)
+ || s.nSPCMaxRes != TranslateResOut(m_spmaxres.GetCurSel())
+ || s.fSPCPow2Tex != !!m_fSPCPow2Tex
+ || s.fSPCDisableAnim != !!m_fSPCDisableAnim)
{
s.fOverridePlacement = !!m_fOverridePlacement;
s.nHorPos = m_nHorPos;
s.nVerPos = m_nVerPos;
s.nSPCSize = m_nSPCSize;
s.nSubDelayInterval = m_nSubDelayInterval;
- s.nSPCMaxRes = m_spmaxres.GetCurSel();
+ s.nSPCMaxRes = TranslateResOut(m_spmaxres.GetCurSel());
s.fSPCPow2Tex = !!m_fSPCPow2Tex;
+ s.fSPCDisableAnim = !!m_fSPCDisableAnim;
if(CMainFrame* pFrame = (CMainFrame*)GetParentFrame())
pFrame->UpdateSubtitle(true);
diff --git a/src/apps/mplayerc/PPageSubtitles.h b/src/apps/mplayerc/PPageSubtitles.h index 1e37b280d..cdad23e66 100644 --- a/src/apps/mplayerc/PPageSubtitles.h +++ b/src/apps/mplayerc/PPageSubtitles.h @@ -47,6 +47,7 @@ public: CSpinButtonCtrl m_nSPCSizeCtrl;
CComboBox m_spmaxres;
BOOL m_fSPCPow2Tex;
+ BOOL m_fSPCDisableAnim;
int m_nSubDelayInterval;
// Dialog Data
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.cpp b/src/apps/mplayerc/PlayerCaptureDialog.cpp index 3d59072fc..8246c37c8 100644 --- a/src/apps/mplayerc/PlayerCaptureDialog.cpp +++ b/src/apps/mplayerc/PlayerCaptureDialog.cpp @@ -260,7 +260,7 @@ static void SetupMediaTypes(CComPtr<IAMStreamConfig> pAMSC, CFormatArray<T>& tfa {
int extra = mt.cbFormat - sizeof(VIDEOINFOHEADER);
int bmiHeaderSize = sizeof(vih->bmiHeader) + extra;
- BYTE* pbmiHeader = new BYTE[bmiHeaderSize];
+ BYTE* pbmiHeader = DNew BYTE[bmiHeaderSize];
memcpy(pbmiHeader, &vih->bmiHeader, bmiHeaderSize);
mt.ReallocFormatBuffer(FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader) + bmiHeaderSize);
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
@@ -827,11 +827,11 @@ void CPlayerCaptureDialog::UpdateMuxer() if(m_muxtype == 0) m_pMux.CoCreateInstance(CLSID_AviDest);
else if(m_muxtype == 1) m_pMux.CoCreateInstance(CLSID_OggMux);
- else if(m_muxtype == 2) m_pMux = new CMatroskaMuxerFilter(NULL, &hr);
- else if(m_muxtype == 3) m_pMux = new CDSMMuxerFilter(NULL, &hr);
+ else if(m_muxtype == 2) m_pMux = DNew CMatroskaMuxerFilter(NULL, &hr);
+ else if(m_muxtype == 3) m_pMux = DNew CDSMMuxerFilter(NULL, &hr);
else return;
- if(m_fSepAudio) m_pAudMux = new CWavDestFilter(NULL, &hr);
+ if(m_fSepAudio) m_pAudMux = DNew CWavDestFilter(NULL, &hr);
}
void CPlayerCaptureDialog::UpdateOutputControls()
@@ -1558,11 +1558,11 @@ void CPlayerCaptureDialog::OnRecord() }
}
- m_pVidBuffer = m_fVidOutput && m_nVidBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? new CBufferFilter(NULL, NULL) : NULL;
+ m_pVidBuffer = m_fVidOutput && m_nVidBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? DNew CBufferFilter(NULL, NULL) : NULL;
if(CComQIPtr<IBufferFilter> pVB = m_pVidBuffer)
{pVB->SetBuffers(m_nVidBuffers); pVB->SetPriority(THREAD_PRIORITY_NORMAL);}
- m_pAudBuffer = m_fAudOutput && m_nAudBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? new CBufferFilter(NULL, NULL) : NULL;
+ m_pAudBuffer = m_fAudOutput && m_nAudBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? DNew CBufferFilter(NULL, NULL) : NULL;
if(CComQIPtr<IBufferFilter> pAB = m_pAudBuffer)
{pAB->SetBuffers(m_nAudBuffers); pAB->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);}
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.h b/src/apps/mplayerc/PlayerCaptureDialog.h index 01616568b..7f68741cd 100644 --- a/src/apps/mplayerc/PlayerCaptureDialog.h +++ b/src/apps/mplayerc/PlayerCaptureDialog.h @@ -64,7 +64,7 @@ public: if(fCreate)
{
- CAutoPtr<CFormat<T> > pf(new CFormat<T>(name));
+ CAutoPtr<CFormat<T> > pf(DNew CFormat<T>(name));
CFormat<T>* tmp = pf;
Add(pf);
return(tmp);
@@ -126,7 +126,7 @@ public: CFormat<T>* pf = Find(MakeFormatName(pmt), true);
if(!pf) {DeleteMediaType(pmt); return(false);}
- CAutoPtr<CFormatElem<T> > pfe(new CFormatElem<T>());
+ CAutoPtr<CFormatElem<T> > pfe(DNew CFormatElem<T>());
pfe->mt = *pmt;
pfe->caps = caps;
pf->Add(pfe);
diff --git a/src/apps/mplayerc/PlayerInfoBar.cpp b/src/apps/mplayerc/PlayerInfoBar.cpp index b7d67a0af..740649a74 100644 --- a/src/apps/mplayerc/PlayerInfoBar.cpp +++ b/src/apps/mplayerc/PlayerInfoBar.cpp @@ -58,11 +58,11 @@ void CPlayerInfoBar::SetLine(CString label, CString info) }
}
- CAutoPtr<CStatusLabel> l(new CStatusLabel(true, false));
+ CAutoPtr<CStatusLabel> l(DNew CStatusLabel(true, false));
l->Create(label, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
m_label.Add(l);
- CAutoPtr<CStatusLabel> i(new CStatusLabel(false, true));
+ CAutoPtr<CStatusLabel> i(DNew CStatusLabel(false, true));
i->Create(info, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
m_info.Add(i);
diff --git a/src/apps/mplayerc/PlayerListCtrl.cpp b/src/apps/mplayerc/PlayerListCtrl.cpp index 7862412dd..8aa676018 100644 --- a/src/apps/mplayerc/PlayerListCtrl.cpp +++ b/src/apps/mplayerc/PlayerListCtrl.cpp @@ -491,7 +491,7 @@ CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint) //
// Create the imagelist with the merged drag images
//
- CImageList* pCompleteImageList = new CImageList;
+ CImageList* pCompleteImageList = DNew CImageList;
pCompleteImageList->Create(cCompleteRect.Width(),
cCompleteRect.Height(),
@@ -566,7 +566,7 @@ CEdit* CPlayerListCtrl::ShowInPlaceEdit(int nItem, int nCol) : (lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT ? ES_RIGHT
: ES_CENTER;
- CEdit* pEdit = new CInPlaceEdit(nItem, nCol, GetItemText(nItem, nCol));
+ CEdit* pEdit = DNew CInPlaceEdit(nItem, nCol, GetItemText(nItem, nCol));
pEdit->Create(dwStyle, rect, this, IDC_EDIT1);
m_fInPlaceDirty = false;
@@ -582,7 +582,7 @@ CComboBox* CPlayerListCtrl::ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CS DWORD dwStyle = /*WS_BORDER|*/WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/
|CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL/*|CBS_NOINTEGRALHEIGHT*/;
- CComboBox* pComboBox = new CInPlaceComboBox(nItem, nCol, lstItems, nSel);
+ CComboBox* pComboBox = DNew CInPlaceComboBox(nItem, nCol, lstItems, nSel);
pComboBox->Create(dwStyle, rect, this, IDC_COMBO1);
CorrectComboListWidth(*pComboBox, GetFont());
@@ -603,7 +603,7 @@ CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CStr return(NULL);
DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/|LBS_NOTIFY;
- CListBox* pListBox = new CInPlaceListBox(nItem, nCol, lstItems, nSel);
+ CListBox* pListBox = DNew CInPlaceListBox(nItem, nCol, lstItems, nSel);
pListBox->Create(dwStyle, rect, this, IDC_LIST1);
CRect ir;
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.cpp b/src/apps/mplayerc/PlayerPlaylistBar.cpp index 8658cea53..35cea3dce 100644 --- a/src/apps/mplayerc/PlayerPlaylistBar.cpp +++ b/src/apps/mplayerc/PlayerPlaylistBar.cpp @@ -316,6 +316,11 @@ void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString> ParseMPCPlayList(fns.GetHead());
return;
}
+ else if(ct == "application/x-bdmv-playlist")
+ {
+ ParseBDMVPlayList(fns.GetHead());
+ return;
+ }
AddItem(fns, subs);
}
@@ -332,6 +337,22 @@ static CString CombinePath(CPath p, CString fn) return (LPCTSTR)p;
}
+bool CPlayerPlaylistBar::ParseBDMVPlayList(CString fn)
+{
+ CHdmvClipInfo ClipInfo;
+ CAtlList<CString> MainPlaylist;
+
+ CPath Path(fn);
+ Path.RemoveFileSpec();
+
+ if (SUCCEEDED (ClipInfo.FindMainMovie (Path + L"\\", MainPlaylist)))
+ {
+ Append(MainPlaylist, MainPlaylist.GetCount()>1, NULL);
+ }
+
+ return m_pl.GetCount() > 0;
+}
+
bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
{
CString str;
@@ -653,7 +674,7 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart) if(fn.Find(_T("video_ts.ifo")) >= 0
|| fn.Find(_T(".ratdvd")) >= 0)
{
- if(OpenDVDData* p = new OpenDVDData())
+ if(OpenDVDData* p = DNew OpenDVDData())
{
p->path = pli.m_fns.GetHead();
p->subs.AddTailList(&pli.m_subs);
@@ -663,7 +684,7 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart) if(pli.m_type == CPlaylistItem::device)
{
- if(OpenDeviceData* p = new OpenDeviceData())
+ if(OpenDeviceData* p = DNew OpenDeviceData())
{
POSITION pos = pli.m_fns.GetHeadPosition();
for(int i = 0; i < countof(p->DisplayName) && pos; i++)
@@ -676,7 +697,7 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart) }
else
{
- if(OpenFileData* p = new OpenFileData())
+ if(OpenFileData* p = DNew OpenFileData())
{
p->fns.AddTailList(&pli.m_fns);
p->subs.AddTailList(&pli.m_subs);
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.h b/src/apps/mplayerc/PlayerPlaylistBar.h index 3cadfc1ed..6d78a2203 100644 --- a/src/apps/mplayerc/PlayerPlaylistBar.h +++ b/src/apps/mplayerc/PlayerPlaylistBar.h @@ -48,6 +48,8 @@ private: void ParsePlayList(CString fn, CAtlList<CString>* subs);
void ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs);
+ bool ParseBDMVPlayList(CString fn);
+
bool ParseMPCPlayList(CString fn);
bool SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRemovePath);
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index 4d9d4a360..65c0f36d2 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -700,7 +700,7 @@ void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) fNeedsUpdate = true;
if(!m_sts.m_styles.Lookup(str))
- m_sts.AddStyle(str, new STSStyle());
+ m_sts.AddStyle(str, DNew STSStyle());
m_sts[pItem->iItem].style = str;
@@ -1001,7 +1001,7 @@ void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) STSStyle* val;
m_sts.m_styles.GetNextAssoc(pos, key, val);
- CAutoPtr<CPPageSubStyle> page(new CPPageSubStyle());
+ CAutoPtr<CPPageSubStyle> page(DNew CPPageSubStyle());
page->InitStyle(key, *val);
pages.Add(page);
styles.Add(val);
diff --git a/src/apps/mplayerc/RealMediaGraph.cpp b/src/apps/mplayerc/RealMediaGraph.cpp index fe45f4827..5cf7efeaa 100644 --- a/src/apps/mplayerc/RealMediaGraph.cpp +++ b/src/apps/mplayerc/RealMediaGraph.cpp @@ -101,7 +101,7 @@ bool CRealMediaPlayer::Init() if(!dllpaths.IsEmpty())
{
- char* s = new char[dllpaths.GetLength()+1];
+ char* s = DNew char[dllpaths.GetLength()+1];
strcpy(s, CStringA(dllpaths));
for(int i = 0, j = strlen(s); i < j; i++) {if(s[i] == '|') s[i] = '\0';}
m_fpSetDLLAccessPath(s);
@@ -521,7 +521,7 @@ bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite) CRealMediaWindowlessSite* pWMWlS;
CComPtr<IRMASiteWindowless> pSiteWindowless;
- pSiteWindowless = (IRMASiteWindowless*)(pWMWlS = new CRealMediaWindowlessSite(hr, m_pPlayer, NULL, NULL));
+ pSiteWindowless = (IRMASiteWindowless*)(pWMWlS = DNew CRealMediaWindowlessSite(hr, m_pPlayer, NULL, NULL));
if(FAILED(hr))
return(false);
@@ -557,8 +557,8 @@ CRealMediaGraph::CRealMediaGraph(HWND hWndParent, HRESULT& hr) hr = S_OK;
m_pRMP = AfxGetAppSettings().iRMVideoRendererType == VIDRNDT_RM_DEFAULT
- ? (CRealMediaPlayer*)new CRealMediaPlayerWindowed(hWndParent, this)
- : (CRealMediaPlayer*)new CRealMediaPlayerWindowless(hWndParent, this);
+ ? (CRealMediaPlayer*)DNew CRealMediaPlayerWindowed(hWndParent, this)
+ : (CRealMediaPlayer*)DNew CRealMediaPlayerWindowless(hWndParent, this);
if(!m_pRMP)
{
diff --git a/src/apps/mplayerc/RealMediaWindowlessSite.cpp b/src/apps/mplayerc/RealMediaWindowlessSite.cpp index 8504a7ec8..8cbd2900f 100644 --- a/src/apps/mplayerc/RealMediaWindowlessSite.cpp +++ b/src/apps/mplayerc/RealMediaWindowlessSite.cpp @@ -36,7 +36,7 @@ void DSObjects::ExtractRects(REGION* pRegion) DWORD sizeNeeed = GetRegionData((HRGN)pRegion->pOSRegion, 0, NULL);
- lpRgnData = (LPRGNDATA)new char[sizeNeeed];
+ lpRgnData = (LPRGNDATA)DNew char[sizeNeeed];
DWORD returnValue = GetRegionData((HRGN)pRegion->pOSRegion, sizeNeeed, lpRgnData);
PN_VECTOR_DELETE(pRegion->rects);
@@ -49,7 +49,7 @@ void DSObjects::ExtractRects(REGION* pRegion) if(lpRgnData->rdh.nCount)
{
- pRegion->rects = new PNxRect[lpRgnData->rdh.nCount];
+ pRegion->rects = DNew PNxRect[lpRgnData->rdh.nCount];
// now extract the information.
@@ -67,7 +67,7 @@ void DSObjects::ExtractRects(REGION* pRegion) }
REGION* DSObjects::RMACreateRectRegion(int left, int top, int right, int bottom)
{
- REGION* retVal = new REGION;
+ REGION* retVal = DNew REGION;
retVal->pOSRegion = (void*)CreateRectRgn(left, top, right, bottom);
ExtractRects(retVal);
return retVal;
@@ -366,7 +366,7 @@ STDMETHODIMP CRealMediaWindowlessSite::CreateChild(REF(IRMASite*) /*OUT*/ pChild HRESULT hr = PNR_OK;
CComPtr<IRMASite> pSite =
- (IRMASite*)new CRealMediaWindowlessSite(hr, m_pContext, this);
+ (IRMASite*)DNew CRealMediaWindowlessSite(hr, m_pContext, this);
if(FAILED(hr) || !pSite)
return E_FAIL;
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.cpp b/src/apps/mplayerc/RegFilterChooserDlg.cpp index fffb76675..cb5eff761 100644 --- a/src/apps/mplayerc/RegFilterChooserDlg.cpp +++ b/src/apps/mplayerc/RegFilterChooserDlg.cpp @@ -130,7 +130,7 @@ void CRegFilterChooserDlg::OnBnClickedOk() if(pMoniker)
{
CFGFilterRegistry fgf(pMoniker);
- FilterOverride* f = new FilterOverride;
+ FilterOverride* f = DNew FilterOverride;
f->fDisabled = false;
f->type = FilterOverride::REGISTERED;
f->name = fgf.GetName();
diff --git a/src/apps/mplayerc/SaveDlg.cpp b/src/apps/mplayerc/SaveDlg.cpp index 457598232..13f3f6116 100644 --- a/src/apps/mplayerc/SaveDlg.cpp +++ b/src/apps/mplayerc/SaveDlg.cpp @@ -92,7 +92,7 @@ BOOL CSaveDlg::OnInitDialog() if(!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda"))
{
hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CCDDAReader(NULL, &hr);
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDDAReader(NULL, &hr);
if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
pReader.Release();
}
@@ -102,7 +102,7 @@ BOOL CSaveDlg::OnInitDialog() if(!pReader)
{
hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CCDXAReader(NULL, &hr);
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDXAReader(NULL, &hr);
if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
pReader.Release();
}
@@ -112,7 +112,7 @@ BOOL CSaveDlg::OnInitDialog() if(!pReader /*&& ext == _T("ifo")*/)
{
hr = S_OK;
- CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CVTSReader(NULL, &hr);
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CVTSReader(NULL, &hr);
if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
pReader.Release();
else
@@ -156,7 +156,7 @@ BOOL CSaveDlg::OnInitDialog() return FALSE;
}
- CComQIPtr<IBaseFilter> pMid = new CStreamDriveThruFilter(NULL, &hr);
+ CComQIPtr<IBaseFilter> pMid = DNew CStreamDriveThruFilter(NULL, &hr);
if(FAILED(pGB->AddFilter(pMid, L"StreamDriveThru")))
{
m_report.SetWindowText(_T("Error"));
diff --git a/src/apps/mplayerc/ShaderCombineDlg.cpp b/src/apps/mplayerc/ShaderCombineDlg.cpp index 43deeab3c..9c5ba5cdc 100644 --- a/src/apps/mplayerc/ShaderCombineDlg.cpp +++ b/src/apps/mplayerc/ShaderCombineDlg.cpp @@ -27,9 +27,10 @@ // CShaderCombineDlg dialog
-CShaderCombineDlg::CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent /*=NULL*/)
+CShaderCombineDlg::CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent , bool bScreenSpace)
: CResizableDialog(CShaderCombineDlg::IDD, pParent)
, m_labels(labels)
+ , m_bScreenSpace(bScreenSpace)
{
}
@@ -69,7 +70,11 @@ BOOL CShaderCombineDlg::OnInitDialog() AppSettings& s = AfxGetAppSettings();
- CString str = s.m_shadercombine.Trim();
+ CString str;
+ if (m_bScreenSpace)
+ str = s.m_shadercombineScreenSpace.Trim();
+ else
+ str = s.m_shadercombine.Trim();
CAtlList<CString> sl;
if(!str.IsEmpty()) Explode(str, sl, '|');
@@ -99,7 +104,10 @@ void CShaderCombineDlg::OnOK() m_labels.AddTail(label);
}
- AfxGetAppSettings().m_shadercombine = Implode(sl, '|');
+ if (m_bScreenSpace)
+ AfxGetAppSettings().m_shadercombineScreenSpace = Implode(sl, '|');
+ else
+ AfxGetAppSettings().m_shadercombine = Implode(sl, '|');
__super::OnOK();
}
diff --git a/src/apps/mplayerc/ShaderCombineDlg.h b/src/apps/mplayerc/ShaderCombineDlg.h index 6c7f859eb..f464fff75 100644 --- a/src/apps/mplayerc/ShaderCombineDlg.h +++ b/src/apps/mplayerc/ShaderCombineDlg.h @@ -31,9 +31,10 @@ class CShaderCombineDlg : public CResizableDialog
{
CAtlList<CString>& m_labels;
+ bool m_bScreenSpace;
public:
- CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent = NULL); // standard constructor
+ CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent, bool bScreenSpace); // standard constructor
virtual ~CShaderCombineDlg();
// Dialog Data
diff --git a/src/apps/mplayerc/ShaderEditorDlg.cpp b/src/apps/mplayerc/ShaderEditorDlg.cpp index b6f0402cd..5e8b9ec89 100644 --- a/src/apps/mplayerc/ShaderEditorDlg.cpp +++ b/src/apps/mplayerc/ShaderEditorDlg.cpp @@ -408,7 +408,7 @@ void CShaderEditorDlg::OnTimer(UINT_PTR nIDEvent) m_pShader->srcdata = srcdata;
m_pShader->target = target;
- if(!m_pPSC) m_pPSC = new CPixelShaderCompiler(NULL);
+ if(!m_pPSC) m_pPSC = DNew CPixelShaderCompiler(NULL);
CString disasm, errmsg;
HRESULT hr = m_pPSC->CompileShader(CStringA(srcdata), "main", CStringA(target), D3DXSHADER_DEBUG, NULL, &disasm, &errmsg);
diff --git a/src/apps/mplayerc/StdAfx.h b/src/apps/mplayerc/StdAfx.h index f318bc65b..323b94595 100644 --- a/src/apps/mplayerc/StdAfx.h +++ b/src/apps/mplayerc/StdAfx.h @@ -30,6 +30,7 @@ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
+#include "..\..\DSUtil\SharedInclude.h"
// VS2005 changed result of OnNCHitTest
#if _MSC_VER >= 1400
@@ -76,6 +77,8 @@ template <class T = CString, class S = CString>
class CAtlStringMap : public CAtlMap<S, T, CStringElementTraits<S> > {};
+
+
//#define BCM_SETSHIELD 0x0000160C // Shield style for button (elevated privilege)
//{{AFX_INSERT_LOCATION}}
diff --git a/src/apps/mplayerc/TextPassThruFilter.cpp b/src/apps/mplayerc/TextPassThruFilter.cpp index 53f14b7d3..453dcd522 100644 --- a/src/apps/mplayerc/TextPassThruFilter.cpp +++ b/src/apps/mplayerc/TextPassThruFilter.cpp @@ -188,8 +188,8 @@ CTextPassThruFilter::CTextPassThruFilter(CMainFrame* pMainFrame) , m_pMainFrame(pMainFrame)
{
HRESULT hr;
- m_pInput = new CTextPassThruInputPin(this, this, &m_pMainFrame->m_csSubLock, &hr);
- m_pOutput = new CTextPassThruOutputPin(this, this, &hr);
+ m_pInput = DNew CTextPassThruInputPin(this, this, &m_pMainFrame->m_csSubLock, &hr);
+ m_pOutput = DNew CTextPassThruOutputPin(this, this, &hr);
}
CTextPassThruFilter::~CTextPassThruFilter()
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp index 5d3b7adc4..69a9800ef 100644 --- a/src/apps/mplayerc/VMROSD.cpp +++ b/src/apps/mplayerc/VMROSD.cpp @@ -50,6 +50,7 @@ CVMROSD::CVMROSD(void) m_bCursorMoving = false;
m_pMFVMB = NULL;
m_pVMB = NULL;
+ memset(&m_BitmapInfo, 0, sizeof(m_BitmapInfo));
}
CVMROSD::~CVMROSD(void)
@@ -75,12 +76,14 @@ void CVMROSD::OnSize(UINT nType, int cx, int cy) void CVMROSD::UpdateBitmap()
{
+ CAutoLock Lock(&m_Lock);
CRect rc;
CWindowDC dc (m_pWnd);
CalcRect();
m_MemDC.DeleteDC();
+ memset(&m_BitmapInfo, 0, sizeof(m_BitmapInfo));
if (m_MemDC.CreateCompatibleDC (&dc))
{
@@ -215,6 +218,8 @@ void CVMROSD::DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPo void CVMROSD::DrawMessage()
{
+ if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0)
+ return;
if (m_nMessagePos != OSD_NOMESSAGE)
{
CRect rectText (0,0,0,0);
@@ -239,6 +244,9 @@ void CVMROSD::DrawMessage() void CVMROSD::Invalidate()
{
+ CAutoLock Lock(&m_Lock);
+ if (m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8) == 0)
+ return;
memsetd(m_BitmapInfo.bmBits, 0xff000000, m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8));
if (m_bSeekBarVisible) DrawSlider(&m_rectSeekBar, m_llSeekMin, m_llSeekMax, m_llSeekPos);
@@ -284,6 +292,12 @@ bool CVMROSD::OnMouseMove(UINT nFlags, CPoint point) else if (m_bSeekBarVisible && !m_rectSeekBar.PtInRect(point))
{
m_bSeekBarVisible = false;
+ // Add new timer for removing any messages
+ if (m_pWnd)
+ {
+ KillTimer(m_pWnd->m_hWnd, (long)this);
+ SetTimer(m_pWnd->m_hWnd, (long)this, 1000, (TIMERPROC)TimerFunc);
+ }
Invalidate();
}
else
@@ -356,10 +370,14 @@ void CVMROSD::TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime) {
pVMROSD->ClearMessage();
}
+ KillTimer(hWnd, nIDEvent);
}
void CVMROSD::ClearMessage()
{
+ CAutoLock Lock(&m_Lock);
+ if (m_bSeekBarVisible)
+ return;
if (m_pVMB)
{
DWORD dwBackup = (m_VMR9AlphaBitmap.dwFlags | VMRBITMAP_DISABLE);
diff --git a/src/apps/mplayerc/VMROSD.h b/src/apps/mplayerc/VMROSD.h index 7495e64cb..143edb0b3 100644 --- a/src/apps/mplayerc/VMROSD.h +++ b/src/apps/mplayerc/VMROSD.h @@ -75,6 +75,7 @@ private : CComPtr<IMFVideoMixerBitmap> m_pMFVMB;
CWnd* m_pWnd;
+ CCritSec m_Lock;
CDC m_MemDC;
VMR9AlphaBitmap m_VMR9AlphaBitmap;
MFVideoAlphaBitmap m_MFVideoAlphaBitmap;
diff --git a/src/apps/mplayerc/WebServer.cpp b/src/apps/mplayerc/WebServer.cpp index 7b990d2e0..7b8bbe1bd 100644 --- a/src/apps/mplayerc/WebServer.cpp +++ b/src/apps/mplayerc/WebServer.cpp @@ -271,7 +271,7 @@ bool CWebServer::LoadPage(UINT resid, CStringA& str, CString path) void CWebServer::OnAccept(CWebServerSocket* pServer)
{
- CAutoPtr<CWebClientSocket> p(new CWebClientSocket(this, m_pMainFrame));
+ CAutoPtr<CWebClientSocket> p(DNew CWebClientSocket(this, m_pMainFrame));
if(pServer->Accept(*p))
{
CString name;
@@ -581,7 +581,7 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod FreeEnvironmentStrings((LPTSTR)lpvEnv);
}
- TCHAR* cmdln = new TCHAR[32768];
+ TCHAR* cmdln = DNew TCHAR[32768];
_sntprintf(cmdln, 32768, _T("\"%s\" \"%s\""), cgi, path);
if(hChildStdinRd && hChildStdoutWr)
diff --git a/src/apps/mplayerc/build - clean.bat b/src/apps/mplayerc/build - clean.bat new file mode 100644 index 000000000..d441098f9 --- /dev/null +++ b/src/apps/mplayerc/build - clean.bat @@ -0,0 +1,2 @@ +call build.bat clean
+pause
diff --git a/src/apps/mplayerc/build - normal.bat b/src/apps/mplayerc/build - normal.bat new file mode 100644 index 000000000..e377ab84d --- /dev/null +++ b/src/apps/mplayerc/build - normal.bat @@ -0,0 +1,3 @@ +
+call build.bat
+pause
diff --git a/src/apps/mplayerc/build.bat b/src/apps/mplayerc/build.bat new file mode 100644 index 000000000..c3605e107 --- /dev/null +++ b/src/apps/mplayerc/build.bat @@ -0,0 +1,120 @@ +@echo off
+
+IF "%VS90COMNTOOLS%"=="" goto BadPaths
+IF "%MINGW32%"=="" goto BadPaths
+IF "%MINGW64%"=="" goto BadPaths
+IF "%MINGW32_GCCLIB%"=="" goto BadPaths
+IF "%MINGW64_GCCLIB%"=="" goto BadPaths
+goto GoodPaths
+
+:BadPaths
+echo "Not all build dependencies found. To build you need:"
+echo "* Visual Studio 2008 installed"
+echo "* MinGW 32 bit build environment with coreMSYS pointed to in MINGW32 env var"
+echo "* MinGW 64 bit build environment with coreMSYS pointed to in MINGW64 env var"
+echo "* MinGW 32 bit gcc library directory pointed to in MINGW32_GCCLIB env var"
+echo "* MinGW 64 bit gcc library directory pointed to in MINGW64_GCCLIB env var"
+pause
+goto EndGood
+
+:GoodPaths
+SET BUILDTYPE=/%1
+IF "%1"=="" set BUILDTYPE=/build
+
+SET ORIGPATH="%CD%"
+call "%VS90COMNTOOLS%vsvars32.bat"
+cd %ORIGPATH%
+
+devenv ../../../mpc-hc.sln %BUILDTYPE% "Release Unicode|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+
+devenv mpciconlib.sln %BUILDTYPE% "Release Unicode|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Chinese simplified|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Chinese traditional|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Czech|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode French|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode German|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Hungarian|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Italian|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Korean|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Polish|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Russian|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Slovak|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Spanish|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Turkish|Win32"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Ukrainian|Win32"
+
+mkdir Build_x86
+xcopy "Release Unicode\*.dll" ".\Build_x86\" /y
+xcopy "Release Unicode\*.exe" ".\Build_x86\" /y
+xcopy AUTHORS ".\Build_x86\" /y
+xcopy ChangeLog ".\Build_x86\" /y
+xcopy Homepage.url ".\Build_x86\" /y
+xcopy ..\..\..\COPYING ".\Build_x86\" /y
+
+rem goto Nox64
+devenv ..\..\..\mpc-hc.sln %BUILDTYPE% "Release Unicode|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpciconlib.sln %BUILDTYPE% "Release Unicode|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Chinese simplified|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Chinese traditional|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Czech|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode French|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode German|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Hungarian|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Italian|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Korean|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Polish|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Russian|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Slovak|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Spanish|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Turkish|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+devenv mpcresources.sln %BUILDTYPE% "Release Unicode Ukrainian|x64"
+IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+
+mkdir Build_x64
+xcopy "x64\Release Unicode\*.dll" ".\Build_x64\" /y
+xcopy "x64\Release Unicode\*.exe" ".\Build_x64\" /y
+xcopy AUTHORS ".\Build_x64\" /y
+xcopy ChangeLog ".\Build_x64\" /y
+xcopy Homepage.url ".\Build_x64\" /y
+xcopy ..\..\..\COPYING ".\Build_x64\" /y
+
+:Nox64
+
+goto EndGood
+
+:EndBad
+echo " "
+echo ERROR: Build failed and aborted
+pause
+
+:EndGood
diff --git a/src/apps/mplayerc/jpeg.cpp b/src/apps/mplayerc/jpeg.cpp index 39c50f4b8..6488b394f 100644 --- a/src/apps/mplayerc/jpeg.cpp +++ b/src/apps/mplayerc/jpeg.cpp @@ -300,13 +300,13 @@ bool CJpegEncoder::Encode(const BYTE* dib) m_w = bi->bmiHeader.biWidth;
m_h = abs(bi->bmiHeader.biHeight);
- m_p = new BYTE[m_w*m_h*4];
+ m_p = DNew BYTE[m_w*m_h*4];
const BYTE* src = dib + sizeof(bi->bmiHeader);
if(bi->bmiHeader.biBitCount <= 8)
{
if(bi->bmiHeader.biClrUsed) src += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
- else src += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]);
+ else src += (1 << bi->bmiHeader.biBitCount) * DWORD(sizeof(bi->bmiColors[0]));
}
int srcpitch = m_w*(bpp>>3);
diff --git a/src/apps/mplayerc/libpng.c b/src/apps/mplayerc/libpng.c index 82e15960e..14b987896 100644 --- a/src/apps/mplayerc/libpng.c +++ b/src/apps/mplayerc/libpng.c @@ -45,8 +45,8 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) unsigned char* row;
unsigned int x, y, c;
- if(png_sig_cmp(png->data, 0, 8) != 0) - return NULL; + if(png_sig_cmp(png->data, 0, 8) != 0)
+ return NULL;
png->pos = 8;
@@ -57,25 +57,25 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) png_set_read_fn(png_ptr, (png_voidp)png, read_data_fn);
- info_ptr = png_create_info_struct(png_ptr); - if(!info_ptr) - { - png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); - return NULL; - } -
- end_info = png_create_info_struct(png_ptr); - if(!end_info) - { - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); - return NULL; - } -
- if(setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - return NULL; - } + info_ptr = png_create_info_struct(png_ptr);
+ if(!info_ptr)
+ {
+ png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
+ return NULL;
+ }
+
+ end_info = png_create_info_struct(png_ptr);
+ if(!end_info)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+ return NULL;
+ }
+
+ if(setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+ return NULL;
+ }
png_set_sig_bytes(png_ptr, 8);
@@ -90,7 +90,7 @@ unsigned char* DecompressPNG(struct png_t* png, int* w, int* h) if(png_get_channels(png_ptr, info_ptr) != 3)
{
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return NULL;
}
diff --git a/src/apps/mplayerc/mpciconlib.cpp b/src/apps/mplayerc/mpciconlib.cpp index 75c706f4c..2c1bf66a5 100644 --- a/src/apps/mplayerc/mpciconlib.cpp +++ b/src/apps/mplayerc/mpciconlib.cpp @@ -51,6 +51,7 @@ int get_icon_index(CString ext) else if(ext.CompareNoCase(_T(".m2ts")) == 0) iconindex = IDI_MPG_ICON;
else if(ext.CompareNoCase(_T(".m2v")) == 0) iconindex = IDI_MPG_ICON;
else if(ext.CompareNoCase(_T(".m3u")) == 0) iconindex = IDI_PLS_ICON;
+ else if(ext.CompareNoCase(_T(".bdmv")) == 0) iconindex = IDI_PLS_ICON;
else if(ext.CompareNoCase(_T(".m4a")) == 0) iconindex = IDI_AAC_ICON;
else if(ext.CompareNoCase(_T(".m4b")) == 0) iconindex = IDI_AAC_ICON;
else if(ext.CompareNoCase(_T(".m4v")) == 0) iconindex = IDI_MP4_ICON;
diff --git a/src/apps/mplayerc/mpciconlib.sln b/src/apps/mplayerc/mpciconlib.sln new file mode 100644 index 000000000..632e0b463 --- /dev/null +++ b/src/apps/mplayerc/mpciconlib.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpciconlib", "mpciconlib_2005.vcproj", "{86251DC4-9298-424C-AE6C-07844F79C0B5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Release Unicode|Win32 = Release Unicode|Win32
+ Release Unicode|x64 = Release Unicode|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {86251DC4-9298-424C-AE6C-07844F79C0B5}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {86251DC4-9298-424C-AE6C-07844F79C0B5}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {86251DC4-9298-424C-AE6C-07844F79C0B5}.Release Unicode|x64.ActiveCfg = Release Unicode|x64
+ {86251DC4-9298-424C-AE6C-07844F79C0B5}.Release Unicode|x64.Build.0 = Release Unicode|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/mplayerc/mpciconlib_2005.vcproj b/src/apps/mplayerc/mpciconlib_2005.vcproj index e1de90018..6682943ee 100644 --- a/src/apps/mplayerc/mpciconlib_2005.vcproj +++ b/src/apps/mplayerc/mpciconlib_2005.vcproj @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="9.00"
Name="mpciconlib"
ProjectGUID="{86251DC4-9298-424C-AE6C-07844F79C0B5}"
RootNamespace="mpciconlib"
Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@@ -71,6 +72,8 @@ SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@@ -135,6 +138,8 @@ Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName).dll"
ModuleDefinitionFile=".\mpciconlib.def"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
diff --git a/src/apps/mplayerc/mplayerc.by.rc b/src/apps/mplayerc/mplayerc.by.rc Binary files differindex 745fa105d..9d4e7de35 100644 --- a/src/apps/mplayerc/mplayerc.by.rc +++ b/src/apps/mplayerc/mplayerc.by.rc diff --git a/src/apps/mplayerc/mplayerc.cpp b/src/apps/mplayerc/mplayerc.cpp index e0f15a090..0fcc8f79d 100644 --- a/src/apps/mplayerc/mplayerc.cpp +++ b/src/apps/mplayerc/mplayerc.cpp @@ -35,6 +35,7 @@ #include "Ifo.h"
#include "MiniDump.h"
+#pragma comment(lib, "winmm.lib")
/////////
#define IDS_RS_ENABLEEDLEDITOR _T("EnableEDLEditor")
@@ -702,7 +703,7 @@ public: spd.pitch = spd.w*spd.bpp>>3;
spd.type = MSP_RGB32;
spd.vidrect = CRect(0, 0, spd.w, spd.h);
- spd.bits = new BYTE[spd.pitch*spd.h];
+ spd.bits = DNew BYTE[spd.pitch*spd.h];
CCritSec csLock;
/*
@@ -955,7 +956,7 @@ BOOL CMPlayerCApp::InitInstance() AfxEnableControlContainer();
- CMainFrame* pFrame = new CMainFrame;
+ CMainFrame* pFrame = DNew CMainFrame;
m_pMainWnd = pFrame;
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE, NULL, NULL);
pFrame->SetDefaultWindowRect((m_s.nCLSwitches&CLSW_MONITOR)?m_s.iMonitor:0);
@@ -1361,12 +1362,18 @@ void CMPlayerCApp::Settings::CreateCommands() ADDCMD((ID_VIEW_TEARING_TEST, 'T', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AG_TEARING_TEST));
ADDCMD((ID_VIEW_REMAINING_TIME, 'I', FVIRTKEY|FCONTROL|FNOINVERT, IDS_MPLAYERC_98));
ADDCMD((ID_SHADER_TOGGLE, 'P', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AT_TOGGLE_SHADER));
+ ADDCMD((ID_SHADER_TOGGLESCREENSPACE, 'P', FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AT_TOGGLE_SHADERSCREENSPACE));
ADDCMD((ID_D3DFULLSCREEN_TOGGLE, 'F', FVIRTKEY|FCONTROL|FNOINVERT, IDS_MPLAYERC_99));
ADDCMD((ID_GOTO_PREV_SUB, 'Y', FVIRTKEY|FNOINVERT, IDS_MPLAYERC_100, APPCOMMAND_BROWSER_BACKWARD));
ADDCMD((ID_GOTO_NEXT_SUB, 'U', FVIRTKEY|FNOINVERT, IDS_MPLAYERC_101, APPCOMMAND_BROWSER_FORWARD));
ADDCMD((ID_SHIFT_SUB_DOWN, VK_NEXT, FVIRTKEY|FNOINVERT, IDS_MPLAYERC_102));
ADDCMD((ID_SHIFT_SUB_UP, VK_PRIOR, FVIRTKEY|FNOINVERT, IDS_MPLAYERC_103));
- ADDCMD((ID_VIEW_DISPLAYSTATS, 'J', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AG_DISPLAY_STATS));
+ ADDCMD((ID_VIEW_DISPLAYSTATS_SC, 'J', FVIRTKEY|FCONTROL|FNOINVERT, IDS_AG_DISPLAY_STATS));
+ ADDCMD((ID_VIEW_VSYNC, 'V', FVIRTKEY|FNOINVERT, IDS_AG_VSYNC));
+ ADDCMD((ID_VIEW_ENABLEFRAMETIMECORRECTION, 'C', FVIRTKEY|FNOINVERT, IDS_AG_ENABLEFRAMETIMECORRECTION));
+ ADDCMD((ID_VIEW_VSYNCACCURATE, 'V', FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AG_VSYNCACCURATE));
+ ADDCMD((ID_VIEW_VSYNCOFFSET_DECREASE, VK_UP, FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AG_VSYNCOFFSET_DECREASE));
+ ADDCMD((ID_VIEW_VSYNCOFFSET_INCREASE, VK_DOWN, FVIRTKEY|FCONTROL|FALT|FNOINVERT, IDS_AG_VSYNCOFFSET_INCREASE));
ADDCMD((ID_SUB_DELAY_DOWN, VK_F1, FVIRTKEY|FNOINVERT, IDS_MPLAYERC_104));
ADDCMD((ID_SUB_DELAY_UP, VK_F2, FVIRTKEY|FNOINVERT, IDS_MPLAYERC_105));
ADDCMD((ID_FILE_SAVE_THUMBNAILS, 0, FVIRTKEY|FNOINVERT, IDS_FILE_SAVE_THUMBNAILS));
@@ -1538,10 +1545,25 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_RMVIDEORENDERERTYPE), iRMVideoRendererType);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QTVIDEORENDERERTYPE), iQTVideoRendererType);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_APSURACEFUSAGE), iAPSurfaceUsage);
- pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), fVMRSyncFix);
+// pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), fVMRSyncFix);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DX9_RESIZER), iDX9Resizer);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERMODE), fVMR9MixerMode);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERYUV), fVMR9MixerYUV);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRAlternateVSync"), m_RenderSettings.fVMR9AlterativeVSync);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSyncOffset"), m_RenderSettings.iVMR9VSyncOffset);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSyncAccurate2"), m_RenderSettings.iVMR9VSyncAccurate);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFullscreenGUISupport"), m_RenderSettings.iVMR9FullscreenGUISupport);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSync"), m_RenderSettings.iVMR9VSync);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRDisableDesktopComposition"), m_RenderSettings.iVMRDisableDesktopComposition);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("EVROutputRange"), m_RenderSettings.iEVROutputRange);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("EVRHighColorRes"), m_RenderSettings.iEVRHighColorResolution);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("EVREnableFrameTimeCorrection"), m_RenderSettings.iEVREnableFrameTimeCorrection);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUBeforeVSync"), m_RenderSettings.iVMRFlushGPUBeforeVSync);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUAfterPresent"), m_RenderSettings.iVMRFlushGPUAfterPresent);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUWait"), m_RenderSettings.iVMRFlushGPUWait);
+
pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIORENDERERTYPE), CString(AudioRendererDisplayName));
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADAUDIO), fAutoloadAudio);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADSUBTITLES), fAutoloadSubtitles);
@@ -1562,6 +1584,7 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCMAXRES), nSPCMaxRes);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SUBDELAYINTERVAL), nSubDelayInterval);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_POW2TEX), fSPCPow2Tex);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("SPCDisabeAnim"), fSPCDisableAnim);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLESUBTITLES), fEnableSubtitles);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOSWITCHER), fEnableAudioSwitcher);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOTIMESHIFT), fAudioTimeShift);
@@ -1598,6 +1621,7 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_SATURATION), strTemp);
pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLIST), strShaderList);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLISTSCREENSPACE), strShaderListScreenSpace);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_EVR_BUFFERS), iEvrBuffers);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHOWOSD), (int)fShowOSD);
pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), IDS_RS_ENABLEEDLEDITOR, (int)fEnableEDLEditor);
@@ -1775,6 +1799,8 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) pApp->WriteProfileString(_T("Shaders"), NULL, NULL);
pApp->WriteProfileInt(_T("Shaders"), _T("Initialized"), 1);
pApp->WriteProfileString(_T("Shaders"), _T("Combine"), m_shadercombine);
+ pApp->WriteProfileString(_T("Shaders"), _T("CombineScreenSpace"), m_shadercombineScreenSpace);
+
pos = m_shaders.GetHeadPosition();
for(int i = 0; pos; i++)
@@ -1844,10 +1870,26 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) iRMVideoRendererType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_RMVIDEORENDERERTYPE), VIDRNDT_RM_DEFAULT);
iQTVideoRendererType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QTVIDEORENDERERTYPE), VIDRNDT_QT_DEFAULT);
iAPSurfaceUsage = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_APSURACEFUSAGE), (IsVistaOrAbove() ? VIDRNDT_AP_TEXTURE3D : VIDRNDT_AP_TEXTURE2D));
- fVMRSyncFix = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), FALSE);
+// fVMRSyncFix = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), FALSE);
iDX9Resizer = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DX9_RESIZER), 1);
fVMR9MixerMode = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERMODE), TRUE);
fVMR9MixerYUV = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERYUV), FALSE);
+ CRendererSettingsEVR DefaultSettings;
+ m_RenderSettings.fVMR9AlterativeVSync = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRAlternateVSync"), DefaultSettings.fVMR9AlterativeVSync);
+ m_RenderSettings.iVMR9VSyncOffset = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSyncOffset"), DefaultSettings.iVMR9VSyncOffset);
+ m_RenderSettings.iVMR9VSyncAccurate = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSyncAccurate2"), DefaultSettings.iVMR9VSyncAccurate);
+ m_RenderSettings.iVMR9FullscreenGUISupport = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFullscreenGUISupport"), DefaultSettings.iVMR9FullscreenGUISupport);
+ m_RenderSettings.iEVRHighColorResolution = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("EVRHighColorRes"), DefaultSettings.iEVRHighColorResolution);
+ m_RenderSettings.iEVREnableFrameTimeCorrection = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("EVREnableFrameTimeCorrection"), DefaultSettings.iEVREnableFrameTimeCorrection);
+ m_RenderSettings.iVMR9VSync = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRVSync"), DefaultSettings.iVMR9VSync);
+ m_RenderSettings.iVMRDisableDesktopComposition = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRDisableDesktopComposition"), DefaultSettings.iVMRDisableDesktopComposition);
+
+ m_RenderSettings.iEVROutputRange = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("EVROutputRange"), DefaultSettings.iEVROutputRange);
+
+ m_RenderSettings.iVMRFlushGPUBeforeVSync = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUBeforeVSync"), DefaultSettings.iVMRFlushGPUBeforeVSync);
+ m_RenderSettings.iVMRFlushGPUAfterPresent = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUAfterPresent"), DefaultSettings.iVMRFlushGPUAfterPresent);
+ m_RenderSettings.iVMRFlushGPUWait = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("VMRFlushGPUWait"), DefaultSettings.iVMRFlushGPUWait);
+
AudioRendererDisplayName = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIORENDERERTYPE), _T(""));
fAutoloadAudio = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADAUDIO), TRUE);
fAutoloadSubtitles = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADSUBTITLES), IsVistaOrAbove() || !IsVSFilterInstalled() );
@@ -1912,6 +1954,15 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) nSPCMaxRes = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCMAXRES), 2);
nSubDelayInterval = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SUBDELAYINTERVAL), 500);
fSPCPow2Tex = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_POW2TEX), TRUE);
+
+ bool bDisableAnim = false;
+ SYSTEM_INFO SysInfo;
+ GetSystemInfo(&SysInfo);
+ if (SysInfo.dwNumberOfProcessors < 3)
+ bDisableAnim = true;
+
+
+ fSPCDisableAnim = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("SPCDisabeAnim"), bDisableAnim);
fEnableSubtitles = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLESUBTITLES), TRUE);
fEnableAudioSwitcher = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOSWITCHER), TRUE);
fAudioTimeShift = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOTIMESHIFT), 0);
@@ -1958,7 +2009,7 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) CString key;
key.Format(_T("%s\\%04d"), ResStr(IDS_R_FILTERS), i);
- CAutoPtr<FilterOverride> f(new FilterOverride);
+ CAutoPtr<FilterOverride> f(DNew FilterOverride);
f->fDisabled = !pApp->GetProfileInt(key, _T("Enabled"), 0);
@@ -2145,6 +2196,7 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) shaders[_T("16-235 -> 0-255 [SD][HD]")] = IDF_SHADER_LEVELS;
shaders[_T("16-235 -> 0-255 [SD]")] = IDF_SHADER_LEVELS2;
+ shaders[_T("0-255 -> 16-235")] = IDF_SHADER_LEVELS3;
shaders[_T("BT.601 -> BT.709")] = IDF_SHADER_BT601_BT709;
shaders[_T("contour")] = IDF_SHADER_CONTOUR;
shaders[_T("deinterlace (blend)")] = IDF_SHADER_DEINTERLACE;
@@ -2226,6 +2278,7 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) dHue = (float)_tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_HUE), _T("0")));
dSaturation = (float)_tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_SATURATION), _T("1")));
strShaderList = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLIST), _T(""));
+ strShaderListScreenSpace = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLISTSCREENSPACE), _T(""));
iEvrBuffers = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_EVR_BUFFERS), 5);
fShowOSD = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHOWOSD), 1);
fEnableEDLEditor= !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), IDS_RS_ENABLEEDLEDITOR, FALSE);
@@ -2271,6 +2324,8 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) // TODO: sort shaders by label
m_shadercombine = pApp->GetProfileString(_T("Shaders"), _T("Combine"), _T(""));
+ m_shadercombineScreenSpace = pApp->GetProfileString(_T("Shaders"), _T("CombineScreenSpace"), _T(""));
+
fInitialized = true;
}
}
@@ -2502,7 +2557,7 @@ void CMPlayerCApp::Settings::CRecentFileAndURLList::Add(LPCTSTR lpszPathName) // fully qualify the path name
TCHAR szTemp[1024];
- if(fURL) _tcscpy(szTemp, lpszPathName);
+ if(fURL) _tcscpy_s(szTemp, lpszPathName);
else AfxFullPath(szTemp, lpszPathName);
// update the MRU list, if an existing MRU string matches file name
@@ -2815,6 +2870,7 @@ CString GetContentType(CString fn, CAtlList<CString>* redir) else if(ext == _T(".m3u")) ct = _T("audio/x-mpegurl");
else if(ext == _T(".qtl")) ct = _T("application/x-quicktimeplayer");
else if(ext == _T(".mpcpl")) ct = _T("application/x-mpc-playlist");
+ else if(ext == _T(".bdmv")) ct = _T("application/x-bdmv-playlist");
if(FILE* f = _tfopen(fn, _T("rb")))
{
@@ -2843,18 +2899,18 @@ CString GetContentType(CString fn, CAtlList<CString>* redir) if(ct == _T("video/x-ms-asf"))
{
// ...://..."/>
- re.Attach(new CAtlRegExpT());
+ re.Attach(DNew CAtlRegExpT());
if(re && REPARSE_ERROR_OK == re->Parse(_T("{[a-zA-Z]+://[^\n\">]*}"), FALSE))
res.AddTail(re);
// Ref#n= ...://...\n
- re.Attach(new CAtlRegExpT());
+ re.Attach(DNew CAtlRegExpT());
if(re && REPARSE_ERROR_OK == re->Parse(_T("Ref\\z\\b*=\\b*[\"]*{([a-zA-Z]+://[^\n\"]+}"), FALSE))
res.AddTail(re);
}
else if(ct == _T("audio/x-scpls"))
{
// File1=...\n
- re.Attach(new CAtlRegExp<>());
+ re.Attach(DNew CAtlRegExp<>());
if(re && REPARSE_ERROR_OK == re->Parse(_T("file\\z\\b*=\\b*[\"]*{[^\n\"]+}"), FALSE))
res.AddTail(re);
}
@@ -2862,14 +2918,14 @@ CString GetContentType(CString fn, CAtlList<CString>* redir) {
// #comment
// ...
- re.Attach(new CAtlRegExp<>());
+ re.Attach(DNew CAtlRegExp<>());
if(re && REPARSE_ERROR_OK == re->Parse(_T("{[^#][^\n]+}"), FALSE))
res.AddTail(re);
}
else if(ct == _T("audio/x-pn-realaudio"))
{
// rtsp://...
- re.Attach(new CAtlRegExp<>());
+ re.Attach(DNew CAtlRegExp<>());
if(re && REPARSE_ERROR_OK == re->Parse(_T("{rtsp://[^\n]+}"), FALSE))
res.AddTail(re);
}
@@ -2891,8 +2947,7 @@ LONGLONG CMPlayerCApp::GetPerfCounter() if (m_PerfFrequency != 0)
{
QueryPerformanceCounter ((LARGE_INTEGER*)&i64Ticks100ns);
- i64Ticks100ns = i64Ticks100ns * 10000000;
- i64Ticks100ns = i64Ticks100ns / m_PerfFrequency;
+ i64Ticks100ns = LONGLONG((double(i64Ticks100ns) * 10000000) / double(m_PerfFrequency) + 0.5);
return i64Ticks100ns;
}
diff --git a/src/apps/mplayerc/mplayerc.cz.rc b/src/apps/mplayerc/mplayerc.cz.rc Binary files differindex d631092dc..7c91a5336 100644 --- a/src/apps/mplayerc/mplayerc.cz.rc +++ b/src/apps/mplayerc/mplayerc.cz.rc diff --git a/src/apps/mplayerc/mplayerc.de.rc b/src/apps/mplayerc/mplayerc.de.rc Binary files differindex 94a4a33ab..50bf1aba1 100644 --- a/src/apps/mplayerc/mplayerc.de.rc +++ b/src/apps/mplayerc/mplayerc.de.rc diff --git a/src/apps/mplayerc/mplayerc.es.rc b/src/apps/mplayerc/mplayerc.es.rc Binary files differindex 3c21eecf9..463ce9765 100644 --- a/src/apps/mplayerc/mplayerc.es.rc +++ b/src/apps/mplayerc/mplayerc.es.rc diff --git a/src/apps/mplayerc/mplayerc.fr.rc b/src/apps/mplayerc/mplayerc.fr.rc Binary files differindex e3cf3db23..e15522dec 100644 --- a/src/apps/mplayerc/mplayerc.fr.rc +++ b/src/apps/mplayerc/mplayerc.fr.rc diff --git a/src/apps/mplayerc/mplayerc.h b/src/apps/mplayerc/mplayerc.h index dfeb7dbba..eb899549a 100644 --- a/src/apps/mplayerc/mplayerc.h +++ b/src/apps/mplayerc/mplayerc.h @@ -159,6 +159,7 @@ enum VIDRNDT_DS_NULL_UNCOMP,
VIDRNDT_DS_EVR,
VIDRNDT_DS_EVR_CUSTOM,
+ VIDRNDT_DS_MADVR
};
enum
@@ -393,7 +394,7 @@ public: // === CASIMIR666 : Ajout CMPlayerCApp
bool m_fTearingTest;
- bool m_fDisplayStats;
+ int m_fDisplayStats;
LONGLONG m_PerfFrequency;
CString m_strVersion;
CString m_strD3DX9Version;
@@ -471,11 +472,78 @@ public: CAutoPtrList<FilterOverride> filters;
+ class CRendererSettingsShared
+ {
+ public:
+ CRendererSettingsShared()
+ {
+ SetDefault();
+ }
+ bool fVMR9AlterativeVSync;
+ int iVMR9VSyncOffset;
+ bool iVMR9VSyncAccurate;
+ bool iVMR9FullscreenGUISupport;
+ bool iVMR9VSync;
+ bool iVMRDisableDesktopComposition;
+ int iVMRFlushGPUBeforeVSync;
+ int iVMRFlushGPUAfterPresent;
+ int iVMRFlushGPUWait;
+
+ void SetDefault()
+ {
+ fVMR9AlterativeVSync = 0;
+ iVMR9VSyncOffset = 0;
+ iVMR9VSyncAccurate = 1;
+ iVMR9FullscreenGUISupport = 0;
+ iVMR9VSync = 1;
+ iVMRDisableDesktopComposition = 0;
+ iVMRFlushGPUBeforeVSync = 1;
+ iVMRFlushGPUAfterPresent = 1;
+ iVMRFlushGPUWait = 0;
+ }
+ void SetOptimal()
+ {
+ fVMR9AlterativeVSync = 1;
+ iVMR9VSyncAccurate = 1;
+ iVMR9VSync = 1;
+ iVMRDisableDesktopComposition = 1;
+ iVMRFlushGPUBeforeVSync = 1;
+ iVMRFlushGPUAfterPresent = 1;
+ iVMRFlushGPUWait = 0;
+ }
+ };
+ class CRendererSettingsEVR : public CRendererSettingsShared
+ {
+ public:
+ bool iEVRHighColorResolution;
+ bool iEVREnableFrameTimeCorrection;
+ int iEVROutputRange;
+
+ CRendererSettingsEVR()
+ {
+ SetDefault();
+ }
+ void SetDefault()
+ {
+ CRendererSettingsShared::SetDefault();
+ iEVRHighColorResolution = 0;
+ iEVREnableFrameTimeCorrection = 0;
+ iEVROutputRange = 0;
+ }
+ void SetOptimal()
+ {
+ CRendererSettingsShared::SetOptimal();
+ iEVRHighColorResolution = 0;
+ }
+ };
+
+ CRendererSettingsEVR m_RenderSettings;
+
int iDSVideoRendererType;
int iRMVideoRendererType;
int iQTVideoRendererType;
int iAPSurfaceUsage;
- bool fVMRSyncFix;
+// bool fVMRSyncFix;
int iDX9Resizer;
bool fVMR9MixerMode;
bool fVMR9MixerYUV;
@@ -528,6 +596,7 @@ public: int nSPCMaxRes;
int nSubDelayInterval;
bool fSPCPow2Tex;
+ bool fSPCDisableAnim;
bool fEnableSubtitles;
bool fDisabeXPToolbars;
@@ -596,9 +665,15 @@ public: CString ISDb;
- struct Shader {CString label, target, srcdata;};
+ struct Shader
+ {
+ CString label;
+ CString target;
+ CString srcdata;
+ };
CAtlList<Shader> m_shaders;
CString m_shadercombine;
+ CString m_shadercombineScreenSpace;
// === CASIMIR666 : nouveau settings
bool fD3DFullscreen;
@@ -610,6 +685,7 @@ public: float dHue;
float dSaturation;
CString strShaderList;
+ CString strShaderListScreenSpace;
bool fRememberDVDPos;
bool fRememberFilePos;
diff --git a/src/apps/mplayerc/mplayerc.hu.rc b/src/apps/mplayerc/mplayerc.hu.rc Binary files differindex c39b41be6..bfad7e792 100644 --- a/src/apps/mplayerc/mplayerc.hu.rc +++ b/src/apps/mplayerc/mplayerc.hu.rc diff --git a/src/apps/mplayerc/mplayerc.it.rc b/src/apps/mplayerc/mplayerc.it.rc Binary files differindex 9356eaa3b..a12b7ad4d 100644 --- a/src/apps/mplayerc/mplayerc.it.rc +++ b/src/apps/mplayerc/mplayerc.it.rc diff --git a/src/apps/mplayerc/mplayerc.kr.rc b/src/apps/mplayerc/mplayerc.kr.rc Binary files differindex e3c5444e1..4f3a81b6d 100644 --- a/src/apps/mplayerc/mplayerc.kr.rc +++ b/src/apps/mplayerc/mplayerc.kr.rc diff --git a/src/apps/mplayerc/mplayerc.pl.rc b/src/apps/mplayerc/mplayerc.pl.rc Binary files differindex eae2c9595..6c6f67982 100644 --- a/src/apps/mplayerc/mplayerc.pl.rc +++ b/src/apps/mplayerc/mplayerc.pl.rc diff --git a/src/apps/mplayerc/mplayerc.rc b/src/apps/mplayerc/mplayerc.rc Binary files differindex 88cf3bdf5..a5e144b0d 100644 --- a/src/apps/mplayerc/mplayerc.rc +++ b/src/apps/mplayerc/mplayerc.rc diff --git a/src/apps/mplayerc/mplayerc.ru.rc b/src/apps/mplayerc/mplayerc.ru.rc Binary files differindex 7d6a5044c..91719b116 100644 --- a/src/apps/mplayerc/mplayerc.ru.rc +++ b/src/apps/mplayerc/mplayerc.ru.rc diff --git a/src/apps/mplayerc/mplayerc.sc.rc b/src/apps/mplayerc/mplayerc.sc.rc Binary files differindex 218398951..3718f3d5f 100644 --- a/src/apps/mplayerc/mplayerc.sc.rc +++ b/src/apps/mplayerc/mplayerc.sc.rc diff --git a/src/apps/mplayerc/mplayerc.sk.rc b/src/apps/mplayerc/mplayerc.sk.rc Binary files differindex 3101d3fd2..1c0e007cd 100644 --- a/src/apps/mplayerc/mplayerc.sk.rc +++ b/src/apps/mplayerc/mplayerc.sk.rc diff --git a/src/apps/mplayerc/mplayerc.tc.rc b/src/apps/mplayerc/mplayerc.tc.rc Binary files differindex f3f566f4d..541b16541 100644 --- a/src/apps/mplayerc/mplayerc.tc.rc +++ b/src/apps/mplayerc/mplayerc.tc.rc diff --git a/src/apps/mplayerc/mplayerc.tr.rc b/src/apps/mplayerc/mplayerc.tr.rc Binary files differindex bbf035267..e1f84ff14 100644 --- a/src/apps/mplayerc/mplayerc.tr.rc +++ b/src/apps/mplayerc/mplayerc.tr.rc diff --git a/src/apps/mplayerc/mplayerc.ua.rc b/src/apps/mplayerc/mplayerc.ua.rc Binary files differindex 4ce91bdaf..a8580b183 100644 --- a/src/apps/mplayerc/mplayerc.ua.rc +++ b/src/apps/mplayerc/mplayerc.ua.rc diff --git a/src/apps/mplayerc/mplayerc.vcproj b/src/apps/mplayerc/mplayerc.vcproj index 9df3e7a38..7dc94fdd5 100644 --- a/src/apps/mplayerc/mplayerc.vcproj +++ b/src/apps/mplayerc/mplayerc.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="mplayerc"
ProjectGUID="{8CE7E5D0-C821-47AC-A247-28EC95B34670}"
RootNamespace="mplayerc"
@@ -27,6 +27,7 @@ UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
+ WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
@@ -50,8 +51,10 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include;..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;DETOURS_X32"
+ UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
/>
@@ -76,6 +79,7 @@ IgnoreDefaultLibraryNames="MSVCRT"
DelayLoadDLLs="d3d9.dll;msimg32.dll;gdiplus.dll;psapi.dll"
SubSystem="2"
+ LargeAddressAware="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="1"
SupportUnloadOfDelayLoadedDLL="true"
@@ -137,8 +141,10 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include;..\..\zlib"
PreprocessorDefinitions="_WIN64;NDEBUG;_WINDOWS;DETOURS_X64"
+ UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
/>
@@ -222,8 +228,10 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include;..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;DETOURS_X32"
+ UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
ShowIncludes="false"
@@ -306,8 +314,10 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include;..\..\zlib"
PreprocessorDefinitions="_WIN64;_DEBUG;_WINDOWS;DETOURS_X64"
+ UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
DebugInformationFormat="3"
@@ -417,6 +427,14 @@ <File
RelativePath="DX9AllocatorPresenter.cpp"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WholeProgramOptimization="true"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\EditListEditor.cpp"
@@ -425,6 +443,14 @@ <File
RelativePath=".\EVRAllocatorPresenter.cpp"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WholeProgramOptimization="true"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\FakeFilterMapper2.cpp"
@@ -473,6 +499,38 @@ <File
RelativePath="..\ShuttlePN31\Common\Interface.c"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\IPinHook.cpp"
@@ -497,6 +555,42 @@ <File
RelativePath=".\libpng.c"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\LineNumberEdit.cpp"
@@ -625,6 +719,42 @@ <File
RelativePath=".\pngdib.c"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ WarningLevel="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="PnSPresetsDlg.cpp"
@@ -853,6 +983,38 @@ <File
RelativePath=".\WebServer.cpp"
>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\WebServerSocket.cpp"
@@ -1795,10 +1957,22 @@ </Filter>
</Filter>
<File
+ RelativePath=".\res\shaders\BT601BT709.psh"
+ >
+ </File>
+ <File
RelativePath=".\ChangeLog"
>
</File>
<File
+ RelativePath=".\res\shaders\levels2.psh"
+ >
+ </File>
+ <File
+ RelativePath=".\res\shaders\levels3.psh"
+ >
+ </File>
+ <File
RelativePath=".\res\PN31Snoop.sys"
>
</File>
diff --git a/src/apps/mplayerc/res/shaders/levels3.psh b/src/apps/mplayerc/res/shaders/levels3.psh new file mode 100644 index 000000000..5b7f16f28 --- /dev/null +++ b/src/apps/mplayerc/res/shaders/levels3.psh @@ -0,0 +1,24 @@ +sampler s0 : register(s0);
+
+#define const_1 (16.0/255.0)
+#define const_2 (219.0/255.0)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ // original pixel
+ float4 c0 = tex2D(s0,tex);
+
+ return (c0 * const_2) + const_1;
+}
+sampler s0 : register(s0);
+
+#define const_1 (16.0/255.0)
+#define const_2 (219.0/255.0)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ // original pixel
+ float4 c0 = tex2D(s0,tex);
+
+ return (c0 * const_2) + const_1;
+}
diff --git a/src/apps/mplayerc/resource.h b/src/apps/mplayerc/resource.h Binary files differindex 9ff018b88..7c5e3dc9c 100644 --- a/src/apps/mplayerc/resource.h +++ b/src/apps/mplayerc/resource.h diff --git a/src/decss/VobFile.cpp b/src/decss/VobFile.cpp index 9215c0c48..b70ddc7e5 100644 --- a/src/decss/VobFile.cpp +++ b/src/decss/VobFile.cpp @@ -190,12 +190,12 @@ bool CDVDSession::SendKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData) switch(KeyType)
{
case DvdChallengeKey:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_CHALLENGE_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_CHALLENGE_KEY_LENGTH]);
key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
Reverse(key->KeyData, pKeyData, 10);
break;
case DvdBusKey2:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_BUS_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_BUS_KEY_LENGTH]);
key->KeyLength = DVD_BUS_KEY_LENGTH;
Reverse(key->KeyData, pKeyData, 5);
break;
@@ -221,22 +221,22 @@ bool CDVDSession::ReadKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData, int lba) switch(KeyType)
{
case DvdChallengeKey:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_CHALLENGE_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_CHALLENGE_KEY_LENGTH]);
key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
key->Parameters.TitleOffset.QuadPart = 0;
break;
case DvdBusKey1:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_BUS_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_BUS_KEY_LENGTH]);
key->KeyLength = DVD_BUS_KEY_LENGTH;
key->Parameters.TitleOffset.QuadPart = 0;
break;
case DvdDiskKey:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_DISK_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_DISK_KEY_LENGTH]);
key->KeyLength = DVD_DISK_KEY_LENGTH;
key->Parameters.TitleOffset.QuadPart = 0;
break;
case DvdTitleKey:
- key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_TITLE_KEY_LENGTH]);
+ key.Attach((DVD_COPY_PROTECT_KEY*)DNew BYTE[DVD_TITLE_KEY_LENGTH]);
key->KeyLength = DVD_TITLE_KEY_LENGTH;
key->Parameters.TitleOffset.QuadPart = 2048i64*lba;
break;
@@ -304,7 +304,7 @@ bool CLBAFile::Open(LPCTSTR path) {
Close();
- return(!!CFile::Open(path, modeRead|typeBinary|shareDenyWrite|osSequentialScan));
+ return(!!CFile::Open(path, modeRead|typeBinary|shareDenyNone|osSequentialScan));
}
void CLBAFile::Close()
@@ -366,7 +366,7 @@ bool CVobFile::HasTitleKey(BYTE* key) bool CVobFile::Open(CString fn, CAtlList<CString>& vobs)
{
CFile f;
- if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
char hdr[13];
diff --git a/src/decss/decss.vcproj b/src/decss/decss.vcproj index ed27cb07c..6f455d13d 100644 --- a/src/decss/decss.vcproj +++ b/src/decss/decss.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
diff --git a/src/decss/stdafx.h b/src/decss/stdafx.h index 48ffc8b90..8a8c808cb 100644 --- a/src/decss/stdafx.h +++ b/src/decss/stdafx.h @@ -4,6 +4,7 @@ //
#pragma once
+#include "..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/dsutil/DSUtil.cpp b/src/dsutil/DSUtil.cpp index 71907d646..2a08a194e 100644 --- a/src/dsutil/DSUtil.cpp +++ b/src/dsutil/DSUtil.cpp @@ -1166,7 +1166,7 @@ unsigned __int64 GetFileVersion(LPCTSTR fn) if(len)
{
- TCHAR* b1 = new TCHAR[len];
+ TCHAR* b1 = DNew TCHAR[len];
if(b1)
{
UINT uLen;
diff --git a/src/dsutil/DSUtil.h b/src/dsutil/DSUtil.h index 38135729e..bbe2d83e5 100644 --- a/src/dsutil/DSUtil.h +++ b/src/dsutil/DSUtil.h @@ -205,7 +205,7 @@ template <class T> static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
{
*phr = S_OK;
- CUnknown* punk = new T(lpunk, phr);
+ CUnknown* punk = DNew T(lpunk, phr);
if(punk == NULL) *phr = E_OUTOFMEMORY;
return punk;
}
diff --git a/src/dsutil/NullRenderers.cpp b/src/dsutil/NullRenderers.cpp index bfb0a309f..cc50bc970 100644 --- a/src/dsutil/NullRenderers.cpp +++ b/src/dsutil/NullRenderers.cpp @@ -155,6 +155,6 @@ HRESULT CNullTextRenderer::CTextInputPin::CheckMediaType(const CMediaType* pmt) CNullTextRenderer::CNullTextRenderer(LPUNKNOWN pUnk, HRESULT* phr)
: CBaseFilter(NAME("CNullTextRenderer"), pUnk, this, __uuidof(this), phr)
{
- m_pInput.Attach(new CTextInputPin(this, this, phr));
+ m_pInput.Attach(DNew CTextInputPin(this, this, phr));
}
#pragma warning (default : 4355)
diff --git a/src/dsutil/SharedInclude.h b/src/dsutil/SharedInclude.h new file mode 100644 index 000000000..7a2ca07ac --- /dev/null +++ b/src/dsutil/SharedInclude.h @@ -0,0 +1,33 @@ +#ifndef IncDSUtil_SharedInclude_h
+#define IncDSUtil_SharedInclude_h
+
+#pragma warning(disable:4018)
+#pragma warning(disable:4800)
+#pragma warning(disable:4355)
+#pragma warning(disable:4244)
+#pragma warning(disable:4995)
+#pragma warning(disable:4996)
+#pragma warning(disable:4305)
+#pragma warning(disable:4200)
+#pragma warning(disable:4101)
+#pragma warning(disable:4101)
+#pragma warning(disable:4267)
+
+#ifdef _DEBUG
+ #define _CRTDBG_MAP_ALLOC // include Microsoft memory leak detection procedures
+
+#if 0
+ #include <crtdbg.h>
+ #define DNew new(_NORMAL_BLOCK, __FILE__, __LINE__)
+#else
+ #define DNew new(__FILE__, __LINE__)
+#endif
+
+#else
+
+#define DNew new
+
+#endif
+#endif // IncDSUtil_SharedInclude_h
+
+
diff --git a/src/dsutil/dsutil.vcproj b/src/dsutil/dsutil.vcproj index f3407048a..08183a828 100644 --- a/src/dsutil/dsutil.vcproj +++ b/src/dsutil/dsutil.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="dsutil"
ProjectGUID="{FC70988B-1AE5-4381-866D-4F405E28AC42}"
RootNamespace="dsutil"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
@@ -103,6 +104,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
Detect64BitPortabilityProblems="false"
@@ -534,6 +536,10 @@ >
</File>
<File
+ RelativePath=".\SharedInclude.h"
+ >
+ </File>
+ <File
RelativePath=".\simd_common.h"
>
</File>
diff --git a/src/dsutil/stdafx.h b/src/dsutil/stdafx.h index c9eea6221..46da40b57 100644 --- a/src/dsutil/stdafx.h +++ b/src/dsutil/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -46,3 +47,4 @@ #include <streams.h>
#include <dvdmedia.h>
+
diff --git a/src/dsutil/text.cpp b/src/dsutil/text.cpp index 9264a5a85..382ee5301 100644 --- a/src/dsutil/text.cpp +++ b/src/dsutil/text.cpp @@ -79,10 +79,10 @@ DWORD CharSetToCodePage(DWORD dwCharSet) CStringA ConvertMBCS(CStringA str, DWORD SrcCharSet, DWORD DstCharSet)
{
- WCHAR* utf16 = new WCHAR[str.GetLength()+1];
+ WCHAR* utf16 = DNew WCHAR[str.GetLength()+1];
memset(utf16, 0, (str.GetLength()+1)*sizeof(WCHAR));
- CHAR* mbcs = new CHAR[str.GetLength()*6+1];
+ CHAR* mbcs = DNew CHAR[str.GetLength()*6+1];
memset(mbcs, 0, str.GetLength()*6+1);
int len = MultiByteToWideChar(
diff --git a/src/filters/BaseClasses/baseclasses.vcproj b/src/filters/BaseClasses/baseclasses.vcproj index 50eeb3f58..dfae4ec21 100644 --- a/src/filters/BaseClasses/baseclasses.vcproj +++ b/src/filters/BaseClasses/baseclasses.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="BaseClasses"
ProjectGUID="{E8A3F6FA-AE1C-4C8E-A0B6-9C8480324EAA}"
RootNamespace="BaseClasses"
@@ -44,6 +44,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
diff --git a/src/filters/BaseClasses/cprop.cpp b/src/filters/BaseClasses/cprop.cpp index c4705b80d..7bd76b4e3 100644 --- a/src/filters/BaseClasses/cprop.cpp +++ b/src/filters/BaseClasses/cprop.cpp @@ -136,7 +136,7 @@ INT_PTR CALLBACK CBasePropertyPage::DialogProc(HWND hwnd, case WM_INITDIALOG:
- SetWindowLongPtr(hwnd, DWLP_USER, lParam);
+ _SetWindowLongPtr(hwnd, DWLP_USER, lParam);
// This pointer may be NULL when calculating size
@@ -149,7 +149,7 @@ INT_PTR CALLBACK CBasePropertyPage::DialogProc(HWND hwnd, // This pointer may be NULL when calculating size
- pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER);
+ pPropertyPage = _GetWindowLongPtr<CBasePropertyPage*>(hwnd, DWLP_USER);
if (pPropertyPage == NULL) {
return (LRESULT) 1;
}
@@ -363,7 +363,8 @@ INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LP CBasePropertyPage *pPropertyPage;
{
- pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER);
+ pPropertyPage = _GetWindowLongPtr<CBasePropertyPage*>(hwnd, DWLP_USER);
+
if (pPropertyPage->m_hwnd == NULL) {
return 0;
}
diff --git a/src/filters/BaseClasses/streams.h b/src/filters/BaseClasses/streams.h index e224980cb..1926321df 100644 --- a/src/filters/BaseClasses/streams.h +++ b/src/filters/BaseClasses/streams.h @@ -123,6 +123,27 @@ typedef struct { #ifndef DWLP_USER
#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
#endif
+
+
+#pragma warning(push)
+#pragma warning(disable: 4312 4244)
+// _GetWindowLongPtr
+// Templated version of GetWindowLongPtr, to suppress spurious compiler warning.
+template <class T>
+T _GetWindowLongPtr(HWND hwnd, int nIndex)
+{
+ return (T)GetWindowLongPtr(hwnd, nIndex);
+}
+
+// _SetWindowLongPtr
+// Templated version of SetWindowLongPtr, to suppress spurious compiler warning.
+template <class T>
+LONG_PTR _SetWindowLongPtr(HWND hwnd, int nIndex, T p)
+{
+ return SetWindowLongPtr(hwnd, nIndex, (LONG_PTR)p);
+}
+#pragma warning(pop)
+
///////////////////////////////////////////////////////////////////////////
// End Platform SDK definitions
///////////////////////////////////////////////////////////////////////////
@@ -171,6 +192,8 @@ typedef struct { #include <edevdefs.h> // External device control interface defines
#include <audevcod.h> // audio filter device error event codes
+
+
#else
#ifdef DEBUG
#pragma message("STREAMS.H included TWICE")
diff --git a/src/filters/BaseClasses/winutil.cpp b/src/filters/BaseClasses/winutil.cpp index c222b8262..6653f4570 100644 --- a/src/filters/BaseClasses/winutil.cpp +++ b/src/filters/BaseClasses/winutil.cpp @@ -425,7 +425,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle // structure. IF we get any messages before WM_NCCREATE we will
// pass them to DefWindowProc.
- CBaseWindow *pBaseWindow = (CBaseWindow *)GetWindowLongPtr(hwnd,0);
+ CBaseWindow *pBaseWindow = _GetWindowLongPtr<CBaseWindow*>(hwnd,0);
+
if (pBaseWindow == NULL) {
// Get the structure pointer from the create struct.
@@ -451,7 +452,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle #ifdef DEBUG
SetLastError(0); // because of the way SetWindowLong works
#endif
- LONG_PTR rc = SetWindowLongPtr(hwnd, (DWORD) 0, (LONG_PTR) pBaseWindow);
+
+ LONG_PTR rc = _SetWindowLongPtr(hwnd, (DWORD) 0, pBaseWindow);
+
+
#ifdef DEBUG
if (0 == rc) {
// SetWindowLong MIGHT have failed. (Read the docs which admit
diff --git a/src/filters/BaseClasses/wxutil.h b/src/filters/BaseClasses/wxutil.h index 0f171394e..305974a5f 100644 --- a/src/filters/BaseClasses/wxutil.h +++ b/src/filters/BaseClasses/wxutil.h @@ -196,7 +196,13 @@ public: // accessor thread calls this when done with thread (having told thread
// to exit)
void Close() {
+
+ // Disable warning: Conversion from LONG to PVOID of greater size
+#pragma warning(push)
+#pragma warning(disable: 4312)
HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hThread, 0);
+#pragma warning(pop)
+
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
diff --git a/src/filters/InternalPropertyPage.h b/src/filters/InternalPropertyPage.h index c49f05aa7..07247bd8a 100644 --- a/src/filters/InternalPropertyPage.h +++ b/src/filters/InternalPropertyPage.h @@ -98,7 +98,7 @@ class CInternalPropertyPageTempl : public CInternalPropertyPage {
virtual CInternalPropertyPageWnd* GetWindow()
{
- return new WndClass();
+ return DNew WndClass();
}
virtual LPCTSTR GetWindowTitle()
diff --git a/src/filters/filters.vcproj b/src/filters/filters.vcproj index 70a3bf154..a791fc2e7 100644 --- a/src/filters/filters.vcproj +++ b/src/filters/filters.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
<Tool
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.cpp b/src/filters/muxer/basemuxer/BaseMuxer.cpp index 004c4c48a..64b1cc5cb 100644 --- a/src/filters/muxer/basemuxer/BaseMuxer.cpp +++ b/src/filters/muxer/basemuxer/BaseMuxer.cpp @@ -31,7 +31,7 @@ CBaseMuxerFilter::CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& cl , m_rtCurrent(0)
{
if(phr) *phr = S_OK;
- m_pOutput.Attach(new CBaseMuxerOutputPin(L"Output", this, this, phr));
+ m_pOutput.Attach(DNew CBaseMuxerOutputPin(L"Output", this, this, phr));
AddInput();
}
@@ -91,7 +91,7 @@ HRESULT CBaseMuxerFilter::CreateInput(CStringW name, CBaseMuxerInputPin** ppPin) {
CheckPointer(ppPin, E_POINTER);
HRESULT hr = S_OK;
- *ppPin = new CBaseMuxerInputPin(name, this, this, &hr);
+ *ppPin = DNew CBaseMuxerInputPin(name, this, this, &hr);
return hr;
}
@@ -99,7 +99,7 @@ HRESULT CBaseMuxerFilter::CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin* {
CheckPointer(ppPin, E_POINTER);
HRESULT hr = S_OK;
- *ppPin = new CBaseMuxerRawOutputPin(name, this, this, &hr);
+ *ppPin = DNew CBaseMuxerRawOutputPin(name, this, this, &hr);
return hr;
}
@@ -253,7 +253,7 @@ CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket() {
REFERENCE_TIME rtMin = _I64_MAX;
CBaseMuxerInputPin* pPinMin = NULL;
- int i = m_pActivePins.GetCount();
+ int i = int(m_pActivePins.GetCount());
POSITION pos = m_pActivePins.GetHeadPosition();
while(pos)
@@ -300,7 +300,7 @@ CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket() int CBaseMuxerFilter::GetPinCount()
{
- return m_pInputs.GetCount() + (m_pOutput ? 1 : 0) + m_pRawOutputs.GetCount();
+ return int(m_pInputs.GetCount()) + (m_pOutput ? 1 : 0) + int(m_pRawOutputs.GetCount());
}
CBasePin* CBaseMuxerFilter::GetPin(int n)
@@ -313,7 +313,7 @@ CBasePin* CBaseMuxerFilter::GetPin(int n) return m_pInputs.GetAt(pos);
}
- n -= m_pInputs.GetCount();
+ n -= int(m_pInputs.GetCount());
if(n == 0 && m_pOutput)
{
@@ -328,7 +328,7 @@ CBasePin* CBaseMuxerFilter::GetPin(int n) return m_pRawOutputs.GetAt(pos);
}
- n -= m_pRawOutputs.GetCount();
+ n -= int(m_pRawOutputs.GetCount());
return NULL;
}
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.vcproj b/src/filters/muxer/basemuxer/BaseMuxer.vcproj index 1757dc54a..05843f3d8 100644 --- a/src/filters/muxer/basemuxer/BaseMuxer.vcproj +++ b/src/filters/muxer/basemuxer/BaseMuxer.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp b/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp index e2d924116..ab1660db7 100644 --- a/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp +++ b/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp @@ -210,7 +210,7 @@ STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample) HRESULT hr = __super::Receive(pSample);
if(FAILED(hr)) return hr;
- CAutoPtr<MuxerPacket> pPacket(new MuxerPacket(this));
+ CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
long len = pSample->GetActualDataLength();
@@ -268,7 +268,7 @@ STDMETHODIMP CBaseMuxerInputPin::EndOfStream() ASSERT(!m_fEOS);
- CAutoPtr<MuxerPacket> pPacket(new MuxerPacket(this));
+ CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
pPacket->flags |= MuxerPacket::eos;
PushPacket(pPacket);
diff --git a/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp index 6c73d29c0..e16362ae7 100644 --- a/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp +++ b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp @@ -44,7 +44,7 @@ IBitStream* CBaseMuxerOutputPin::GetBitStream() {
if(CComQIPtr<IStream> pStream = GetConnected())
{
- m_pBitStream = new CBitStream(pStream, true);
+ m_pBitStream = DNew CBitStream(pStream, true);
}
}
@@ -203,7 +203,7 @@ void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket* if(!pBitStream) return;
const BYTE* pData = pPacket->pData.GetData();
- const int DataSize = pPacket->pData.GetCount();
+ const int DataSize = int(pPacket->pData.GetCount());
if(mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx)
{
diff --git a/src/filters/muxer/basemuxer/stdafx.h b/src/filters/muxer/basemuxer/stdafx.h index d4d4ba8eb..63864cff8 100644 --- a/src/filters/muxer/basemuxer/stdafx.h +++ b/src/filters/muxer/basemuxer/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj b/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj index a689d8de5..d10f2c3eb 100644 --- a/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj +++ b/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="DSMMuxer"
ProjectGUID="{65361C7C-83D6-42E4-870C-4DC85AE641FE}"
RootNamespace="DSMMuxer"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/muxer/dsmmuxer/stdafx.h b/src/filters/muxer/dsmmuxer/stdafx.h index b9b0d1a39..771620b3c 100644 --- a/src/filters/muxer/dsmmuxer/stdafx.h +++ b/src/filters/muxer/dsmmuxer/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -45,3 +46,4 @@ #include <dshow.h>
#include <streams.h>
#include <dvdmedia.h>
+
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp b/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp index 7ad75fd48..8c32b441d 100644 --- a/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp +++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp @@ -81,7 +81,7 @@ CMatroskaMuxerFilter::CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr) {
if(phr) *phr = S_OK;
- m_pOutput.Attach(new CMatroskaMuxerOutputPin(NAME("CMatroskaMuxerOutputPin"), this, this, phr));
+ m_pOutput.Attach(DNew CMatroskaMuxerOutputPin(NAME("CMatroskaMuxerOutputPin"), this, this, phr));
AddInput();
@@ -134,7 +134,7 @@ void CMatroskaMuxerFilter::AddInput() name.Format(L"Track %d", m_pInputs.GetCount()+1);
HRESULT hr;
- CAutoPtr<CMatroskaMuxerInputPin> pPin(new CMatroskaMuxerInputPin(name, this, this, &hr));
+ CAutoPtr<CMatroskaMuxerInputPin> pPin(DNew CMatroskaMuxerInputPin(name, this, this, &hr));
m_pInputs.AddTail(pPin);
}
@@ -337,7 +337,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc() // Segment Info
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(0x1549A966);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -353,7 +353,7 @@ DWORD CMatroskaMuxerFilter::ThreadProc() // Tracks
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(0x1654AE6B);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -361,14 +361,14 @@ DWORD CMatroskaMuxerFilter::ThreadProc() UINT64 TrackNumber = 0;
/*
CNode<Track> Tracks;
- CAutoPtr<Track> pT(new Track());
+ CAutoPtr<Track> pT(DNew Track());
POSITION pos = m_pInputs.GetHeadPosition();
for(int i = 1; pos; i++)
{
CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
if(!pPin->IsConnected()) continue;
- CAutoPtr<TrackEntry> pTE(new TrackEntry());
+ CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
*pTE = *pPin->GetTrackEntry();
if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
TrackNumber = pTE->TrackNumber;
@@ -473,13 +473,13 @@ DWORD CMatroskaMuxerFilter::ThreadProc() if(!fTracksWritten)
{
CNode<Track> Tracks;
- CAutoPtr<Track> pT(new Track());
+ CAutoPtr<Track> pT(DNew Track());
POSITION pos = pActivePins.GetHeadPosition();
for(int i = 1; pos; i++)
{
CMatroskaMuxerInputPin* pPin = pActivePins.GetNext(pos);
- CAutoPtr<TrackEntry> pTE(new TrackEntry());
+ CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
*pTE = *pPin->GetTrackEntry();
if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
TrackNumber = pTE->TrackNumber;
@@ -527,7 +527,7 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") {
if(!c.BlockGroups.IsEmpty())
{
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(c.GetID()/*0x1F43B675*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -550,11 +550,11 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") ULONGLONG clusterpos = GetStreamPosition(pStream) - segpos;
if(lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode)
{
- CAutoPtr<CueTrackPosition> ctp(new CueTrackPosition());
+ CAutoPtr<CueTrackPosition> ctp(DNew CueTrackPosition());
ctp->CueTrack.Set(b->Block.TrackNumber);
ctp->CueClusterPosition.Set(clusterpos);
if(c.BlockGroups.GetCount() > 0) ctp->CueBlockNumber.Set(nBlocksInCueTrack);
- CAutoPtr<CuePoint> cp(new CuePoint());
+ CAutoPtr<CuePoint> cp(DNew CuePoint());
cp->CueTime.Set(b->Block.TimeCode);
cp->CueTrackPositions.AddTail(ctp);
cue.CuePoints.AddTail(cp);
@@ -574,7 +574,7 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") if(!c.BlockGroups.IsEmpty())
{
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(c.GetID()/*0x1F43B675*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -585,7 +585,7 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") ULONGLONG cuepos = 0;
if(!cue.CuePoints.IsEmpty())
{
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(cue.GetID()/*0x1C53BB6B*/);
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -596,7 +596,7 @@ TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n") {
Tags tags;
- sh.Attach(new SeekHead());
+ sh.Attach(DNew SeekHead());
sh->ID.Set(tags.GetID());
sh->Position.Set(GetStreamPosition(pStream) - segpos);
seek.SeekHeads.AddTail(sh);
@@ -718,7 +718,7 @@ HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin) pMS->GetDuration(&m_rtDur);
m_pTE.Free();
- m_pTE.Attach(new TrackEntry());
+ m_pTE.Attach(DNew TrackEntry());
m_pTE->TrackUID.Set(rand());
m_pTE->MinCache.Set(1);
@@ -1204,7 +1204,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample) if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3)
{
- CAutoPtr<CBinary> data(new CBinary(0));
+ CAutoPtr<CBinary> data(DNew CBinary(0));
data->SetCount(len);
memcpy(data->GetData(), pData, len);
m_pVorbisHdrs.Add(data);
@@ -1238,7 +1238,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample) || ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3))
pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
- CAutoPtr<BlockGroup> b(new BlockGroup());
+ CAutoPtr<BlockGroup> b(DNew BlockGroup());
/*
// TODO: test this with a longer capture (pcm, mp3)
if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
@@ -1264,7 +1264,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample) b->BlockDuration.Set((rtStop - rtStart + 5000) / 10000);
}
- CAutoPtr<CBinary> data(new CBinary(0));
+ CAutoPtr<CBinary> data(DNew CBinary(0));
data->SetCount(len);
memcpy(data->GetData(), pData, len);
b->Block.BlockData.AddTail(data);
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj b/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj index 7643df6ca..3d918f70b 100644 --- a/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj +++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MatroskaMuxer"
ProjectGUID="{67827491-8162-4039-9132-F934ABC836A0}"
RootNamespace="MatroskaMuxer"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/muxer/matroskamuxer/stdafx.h b/src/filters/muxer/matroskamuxer/stdafx.h index dd0d28f25..3c154d6ee 100644 --- a/src/filters/muxer/matroskamuxer/stdafx.h +++ b/src/filters/muxer/matroskamuxer/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -41,3 +42,4 @@ #include <dshow.h>
#include <streams.h>
#include <dvdmedia.h>
+
diff --git a/src/filters/muxer/wavdest/stdafx.h b/src/filters/muxer/wavdest/stdafx.h index 7becfecbe..b410f737b 100644 --- a/src/filters/muxer/wavdest/stdafx.h +++ b/src/filters/muxer/wavdest/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/muxer/wavdest/wavdest.cpp b/src/filters/muxer/wavdest/wavdest.cpp index d890f6e63..ac1f57fce 100644 --- a/src/filters/muxer/wavdest/wavdest.cpp +++ b/src/filters/muxer/wavdest/wavdest.cpp @@ -80,7 +80,7 @@ CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr) {
if(SUCCEEDED(*phr))
{
- if(CWavDestOutputPin* pOut = new CWavDestOutputPin(this, phr))
+ if(CWavDestOutputPin* pOut = DNew CWavDestOutputPin(this, phr))
{
if(SUCCEEDED(*phr)) m_pOutput = pOut;
else delete pOut;
@@ -91,7 +91,7 @@ CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr) return;
}
- if(CTransformInputPin* pIn = new CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
+ if(CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
{
if(SUCCEEDED(*phr)) m_pInput = pIn;
else delete pIn;
diff --git a/src/filters/muxer/wavdest/wavdest.vcproj b/src/filters/muxer/wavdest/wavdest.vcproj index b71e4793d..17f8a9639 100644 --- a/src/filters/muxer/wavdest/wavdest.vcproj +++ b/src/filters/muxer/wavdest/wavdest.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="wavdest"
ProjectGUID="{EB202B68-8029-4985-B914-E94B44D2E230}"
RootNamespace="wavdest"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
<Tool
diff --git a/src/filters/parser/avisplitter/AviFile.cpp b/src/filters/parser/avisplitter/AviFile.cpp index 605b1e3a6..9396c1451 100644 --- a/src/filters/parser/avisplitter/AviFile.cpp +++ b/src/filters/parser/avisplitter/AviFile.cpp @@ -188,7 +188,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) if(S_OK != Read(m_avih, 8)) return E_FAIL;
break;
case FCC('strh'):
- if(!strm) strm.Attach(new strm_t());
+ if(!strm) strm.Attach(DNew strm_t());
strm->strh.fcc = FCC('strh');
strm->strh.cb = size;
if(S_OK != Read(strm->strh, 8)) return E_FAIL;
@@ -204,7 +204,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
break;
case FCC('strf'):
- if(!strm) strm.Attach(new strm_t());
+ if(!strm) strm.Attach(DNew strm_t());
strm->strf.SetCount(size);
if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
if (m_isamv)
@@ -226,7 +226,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) break;
case FCC('indx'):
- if(!strm) strm.Attach(new strm_t());
+ if(!strm) strm.Attach(DNew strm_t());
ASSERT(strm->indx == NULL);
AVISUPERINDEX* pSuperIndex;
if (size < MAXDWORD-8)
@@ -234,7 +234,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) // Fix buffer overrun vulnerability : http://www.vulnhunt.com/advisories/CAL-20070912-1_Multiple_vendor_produce_handling_AVI_file_vulnerabilities.txt
TRY
{
- pSuperIndex = (AVISUPERINDEX*)new unsigned char [(size_t)(size + 8)];
+ pSuperIndex = (AVISUPERINDEX*)DNew unsigned char [(size_t)(size + 8)];
}
CATCH (CMemoryException, e)
{
@@ -259,7 +259,7 @@ HRESULT CAviFile::Parse(DWORD parentid, __int64 end) break;
case FCC('idx1'):
ASSERT(m_idx1 == NULL);
- m_idx1.Attach((AVIOLDINDEX*)new BYTE[size + 8]);
+ 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)) return E_FAIL;
@@ -345,7 +345,7 @@ HRESULT CAviFile::BuildIndex() {
Seek(idx->aIndex[j].qwOffset);
- CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)new BYTE[idx->aIndex[j].dwSize]);
+ CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
{
EmptyIndex();
@@ -461,8 +461,8 @@ bool CAviFile::IsInterleaved(bool fKeepInfo) for(int i = 0; i < (int)m_avih.dwStreams; i++)
m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
- DWORD* curchunks = new DWORD[m_avih.dwStreams];
- UINT64* cursizes = new UINT64[m_avih.dwStreams];
+ DWORD* curchunks = DNew DWORD[m_avih.dwStreams];
+ UINT64* cursizes = DNew UINT64[m_avih.dwStreams];
memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
diff --git a/src/filters/parser/avisplitter/AviReportWnd.cpp b/src/filters/parser/avisplitter/AviReportWnd.cpp index 32a4f6e1a..9210b5083 100644 --- a/src/filters/parser/avisplitter/AviReportWnd.cpp +++ b/src/filters/parser/avisplitter/AviReportWnd.cpp @@ -259,7 +259,7 @@ bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd) m_chunkdist.SetCount(w);
memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
- DWORD* curchunks = new DWORD[pAF->m_avih.dwStreams];
+ DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
CAviFile::strm_t::chunk2 cs2last = {-1, 0};
diff --git a/src/filters/parser/avisplitter/AviSplitter.cpp b/src/filters/parser/avisplitter/AviSplitter.cpp index 083e46b9f..a0028a9f7 100644 --- a/src/filters/parser/avisplitter/AviSplitter.cpp +++ b/src/filters/parser/avisplitter/AviSplitter.cpp @@ -140,7 +140,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
m_tFrame.Free();
- m_pFile.Attach(new CAviFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
@@ -305,7 +305,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CAviSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CAviSplitterOutputPin(mts, name, this, this, &hr));
AddOutputPin(i, pPinOut);
}
@@ -325,7 +325,7 @@ HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- m_tFrame.Attach(new DWORD[m_pFile->m_avih.dwStreams]);
+ m_tFrame.Attach(DNew DWORD[m_pFile->m_avih.dwStreams]);
return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
@@ -553,7 +553,7 @@ bool CAviSplitterFilter::DemuxLoop() size = s->cs[f].orgsize;
}
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = minTrack;
p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
diff --git a/src/filters/parser/avisplitter/AviSplitter.vcproj b/src/filters/parser/avisplitter/AviSplitter.vcproj index 4822b4a14..b6eca6d18 100644 --- a/src/filters/parser/avisplitter/AviSplitter.vcproj +++ b/src/filters/parser/avisplitter/AviSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="AviSplitter"
ProjectGUID="{9738B023-FC46-48A2-953A-0035FD897678}"
RootNamespace="AviSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/avisplitter/stdafx.h b/src/filters/parser/avisplitter/stdafx.h index 482cd4924..f57822752 100644 --- a/src/filters/parser/avisplitter/stdafx.h +++ b/src/filters/parser/avisplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/basesplitter/AsyncReader.cpp b/src/filters/parser/basesplitter/AsyncReader.cpp index 15d29491b..1a2c20e74 100644 --- a/src/filters/parser/basesplitter/AsyncReader.cpp +++ b/src/filters/parser/basesplitter/AsyncReader.cpp @@ -36,7 +36,7 @@ CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr) , m_hBreakEvent(NULL)
, m_lOsError(0)
{
- hr = Open(fn, modeRead|shareDenyWrite|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ hr = Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
if(SUCCEEDED(hr)) m_len = GetLength();
}
@@ -80,7 +80,7 @@ STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE* Sleep(1);
CString fn = m_strFileName;
try {Close();} catch(CFileException* e) {e->Delete();}
- try {Open(fn, modeRead|shareDenyWrite|typeBinary|osSequentialScan);} catch(CFileException* e) {e->Delete();}
+ try {Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan);} catch(CFileException* e) {e->Delete();}
m_strFileName = fn;
}
}
diff --git a/src/filters/parser/basesplitter/BaseSplitter.cpp b/src/filters/parser/basesplitter/BaseSplitter.cpp index 246289945..0b3cb9dd5 100644 --- a/src/filters/parser/basesplitter/BaseSplitter.cpp +++ b/src/filters/parser/basesplitter/BaseSplitter.cpp @@ -236,7 +236,7 @@ HRESULT CBaseSplitterOutputPin::SetName(LPCWSTR pName) {
CheckPointer(pName, E_POINTER);
if(m_pName) delete [] m_pName;
- m_pName = new WCHAR[wcslen(pName)+1];
+ m_pName = DNew WCHAR[wcslen(pName)+1];
CheckPointer(m_pName, E_OUTOFMEMORY);
wcscpy(m_pName, pName);
return S_OK;
@@ -596,7 +596,7 @@ void CBaseSplitterOutputPin::MakeISCRHappy() if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)-1;
p->rtStart = -1; p->rtStop = 0;
p->bSyncPoint = FALSE;
@@ -706,7 +706,7 @@ CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* {
if(phr) *phr = S_OK;
- m_pInput.Attach(new CBaseSplitterInputPin(NAME("CBaseSplitterInputPin"), this, this, phr));
+ m_pInput.Attach(DNew CBaseSplitterInputPin(NAME("CBaseSplitterInputPin"), this, this, phr));
}
CBaseSplitterFilter::~CBaseSplitterFilter()
@@ -1150,7 +1150,7 @@ STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYP m_fn = pszFileName;
HRESULT hr = E_FAIL;
- CComPtr<IAsyncReader> pAsyncReader = (IAsyncReader*)new CAsyncFileReader(CString(pszFileName), hr);
+ CComPtr<IAsyncReader> pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
if(FAILED(hr)
|| FAILED(hr = DeleteOutputs())
|| FAILED(hr = CreateOutputs(pAsyncReader)))
diff --git a/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp b/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp index 214085d01..7db6adffb 100644 --- a/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp +++ b/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp @@ -346,7 +346,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
pmt->formattype = FORMAT_MPEGVideo;
int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
- MPEG1VIDEOINFO* vi = (MPEG1VIDEOINFO*)new BYTE[len];
+ MPEG1VIDEOINFO* vi = (MPEG1VIDEOINFO*)DNew BYTE[len];
memset(vi, 0, len);
vi->hdr.dwBitRate = h.bitrate;
vi->hdr.AvgTimePerFrame = h.ifps;
@@ -368,7 +368,7 @@ bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt) pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
pmt->formattype = FORMAT_MPEG2_VIDEO;
int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
- MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)new BYTE[len];
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
memset(vi, 0, len);
vi->hdr.dwBitRate = h.bitrate;
vi->hdr.AvgTimePerFrame = h.ifps;
@@ -475,7 +475,7 @@ bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* p /*int*/ len = h.layer == 3
? sizeof(WAVEFORMATEX/*MPEGLAYER3WAVEFORMAT*/) // no need to overcomplicate this...
: sizeof(MPEG1WAVEFORMAT);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)new BYTE[len];
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[len];
memset(wfe, 0, len);
wfe->cbSize = len - sizeof(WAVEFORMATEX);
@@ -559,7 +559,7 @@ bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt) if(!pmt) return(true);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)new BYTE[sizeof(WAVEFORMATEX)+5];
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[sizeof(WAVEFORMATEX)+5];
memset(wfe, 0, sizeof(WAVEFORMATEX)+5);
wfe->wFormatTag = WAVE_FORMAT_AAC;
wfe->nChannels = h.channels <= 6 ? h.channels : 2;
@@ -1284,7 +1284,7 @@ bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt) //pmt->subtype = MEDIASUBTYPE_H264; // TODO : put MEDIASUBTYPE_H264 to support Windows 7 decoder !
pmt->formattype = FORMAT_MPEG2_VIDEO;
int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extra;
- MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)new BYTE[len];
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
memset(vi, 0, len);
// vi->hdr.dwBitRate = ;
vi->hdr.AvgTimePerFrame = h.AvgTimePerFrame;
@@ -1416,7 +1416,7 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt) //pmt->subtype = FOURCCMap('1CVW');
//pmt->formattype = FORMAT_MPEG2_VIDEO;
//int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extralen + 1;
- //MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)new BYTE[len];
+ //MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
//memset(vi, 0, len);
//// vi->hdr.dwBitRate = ;
//vi->hdr.AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
@@ -1441,7 +1441,7 @@ bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt) pmt->subtype = FOURCCMap('1CVW');
pmt->formattype = FORMAT_VIDEOINFO2;
int len = sizeof(VIDEOINFOHEADER2) + extralen + 1;
- VIDEOINFOHEADER2* vi = (VIDEOINFOHEADER2*)new BYTE[len];
+ VIDEOINFOHEADER2* vi = (VIDEOINFOHEADER2*)DNew BYTE[len];
memset(vi, 0, len);
vi->AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
vi->dwPictAspectRatioX = h.width;
diff --git a/src/filters/parser/basesplitter/basesplitter.vcproj b/src/filters/parser/basesplitter/basesplitter.vcproj index 94a2441e8..34f17f2ba 100644 --- a/src/filters/parser/basesplitter/basesplitter.vcproj +++ b/src/filters/parser/basesplitter/basesplitter.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/basesplitter/stdafx.h b/src/filters/parser/basesplitter/stdafx.h index dd0d28f25..5a2d7facf 100644 --- a/src/filters/parser/basesplitter/stdafx.h +++ b/src/filters/parser/basesplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.cpp b/src/filters/parser/diracsplitter/DiracSplitter.cpp index ad3ebb39a..fa485692a 100644 --- a/src/filters/parser/diracsplitter/DiracSplitter.cpp +++ b/src/filters/parser/diracsplitter/DiracSplitter.cpp @@ -119,14 +119,14 @@ HRESULT CDiracSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new CDiracSplitterFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CDiracSplitterFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
CAtlArray<CMediaType> mts;
mts.Add(m_pFile->GetMediaType());
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
AddOutputPin(0, pPinOut);
m_rtNewStart = m_rtCurrent = 0;
@@ -209,7 +209,7 @@ bool CDiracSplitterFilter::DemuxLoop() if(isFrameStartCode(code))
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->SetCount(size);
memcpy(p->GetData(), pBuff, size);
@@ -328,7 +328,7 @@ HRESULT CDiracVideoDecoder::Receive(IMediaSample* pIn) int wc = decoder->src_params.chroma_width;
int hc = decoder->src_params.chroma_height;
delete [] m_pYUV[0]; m_pYUV[0] = NULL;
- m_pYUV[0] = new BYTE[w*h + wc*hc*2 + w/2*h/2];
+ m_pYUV[0] = DNew BYTE[w*h + wc*hc*2 + w/2*h/2];
m_pYUV[1] = m_pYUV[0] + w*h;
m_pYUV[2] = m_pYUV[1] + wc*hc;
m_pYUV[3] = m_pYUV[2] + wc*hc;
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.vcproj b/src/filters/parser/diracsplitter/DiracSplitter.vcproj index a4a325b5e..3cd6246bd 100644 --- a/src/filters/parser/diracsplitter/DiracSplitter.vcproj +++ b/src/filters/parser/diracsplitter/DiracSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="DiracSplitter"
ProjectGUID="{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}"
RootNamespace="DiracSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\libdirac;..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -103,6 +104,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\libdirac;..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -161,6 +163,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\libdirac;..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244;4800;4355"
@@ -222,6 +225,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\libdirac;..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj b/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj index a9514e19e..f87bca801 100644 --- a/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj +++ b/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj @@ -42,9 +42,11 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="0"
DisableSpecificWarnings="4800;"
/>
<Tool
@@ -105,6 +107,7 @@ AdditionalIncludeDirectories="."
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="0"
DebugInformationFormat="3"
/>
<Tool
@@ -162,6 +165,7 @@ AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_MMX"
UsePrecompiledHeader="0"
+ WarningLevel="0"
DisableSpecificWarnings="4244;4800;4355"
/>
<Tool
@@ -222,6 +226,7 @@ AdditionalIncludeDirectories="."
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB;HAVE_MMX"
UsePrecompiledHeader="0"
+ WarningLevel="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/src/filters/parser/diracsplitter/stdafx.h b/src/filters/parser/diracsplitter/stdafx.h index 128f7fcea..ee9da4d11 100644 --- a/src/filters/parser/diracsplitter/stdafx.h +++ b/src/filters/parser/diracsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.cpp b/src/filters/parser/dsmsplitter/DSMSplitter.cpp index f94af9b5f..99416ed7e 100644 --- a/src/filters/parser/dsmsplitter/DSMSplitter.cpp +++ b/src/filters/parser/dsmsplitter/DSMSplitter.cpp @@ -103,7 +103,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr = E_FAIL;
m_pFile.Free();
- m_pFile.Attach(new CDSMSplitterFile(pAsyncReader, hr, *this, *this));
+ m_pFile.Attach(DNew CDSMSplitterFile(pAsyncReader, hr, *this, *this));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -134,7 +134,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAtlArray<CMediaType> mts;
mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
name.Empty();
@@ -203,7 +203,7 @@ bool CDSMSplitterFilter::DemuxLoop() if(type == DSMP_SAMPLE)
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
if(m_pFile->Read(len, p))
{
if(p->rtStart != Packet::INVALID_TIME)
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.vcproj b/src/filters/parser/dsmsplitter/DSMSplitter.vcproj index f5737d02d..06c8d34e5 100644 --- a/src/filters/parser/dsmsplitter/DSMSplitter.vcproj +++ b/src/filters/parser/dsmsplitter/DSMSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="DSMSplitter"
ProjectGUID="{1E91F58C-0BAE-4021-8087-D1864D8EC066}"
RootNamespace="DSMSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/dsmsplitter/stdafx.h b/src/filters/parser/dsmsplitter/stdafx.h index 67593bb9b..42dcfd9f5 100644 --- a/src/filters/parser/dsmsplitter/stdafx.h +++ b/src/filters/parser/dsmsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/flvsplitter/FLVSplitter.cpp b/src/filters/parser/flvsplitter/FLVSplitter.cpp index fdce698cb..d2c40ddcf 100644 --- a/src/filters/parser/flvsplitter/FLVSplitter.cpp +++ b/src/filters/parser/flvsplitter/FLVSplitter.cpp @@ -194,7 +194,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr = E_FAIL;
m_pFile.Free();
- m_pFile.Attach(new CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
+ m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -434,7 +434,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) __int64 headerOffset = m_pFile->GetPos();
UINT32 headerSize = dataSize - 4;
- BYTE *headerData = new BYTE[headerSize];
+ BYTE *headerData = DNew BYTE[headerSize];
m_pFile->ByteRead(headerData, headerSize);
@@ -528,7 +528,7 @@ HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) {
CAtlArray<CMediaType> mts;
mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(t.TagType, pPinOut)));
}
@@ -720,7 +720,7 @@ bool CFLVSplitterFilter::DemuxLoop() }
__int64 dataSize = next - m_pFile->GetPos();
if (dataSize <= 0) goto NextTag;
- p.Attach(new Packet());
+ p.Attach(DNew Packet());
p->TrackNumber = t.TagType;
p->rtStart = 10000i64 * (t.TimeStamp + tsOffset);
p->rtStop = p->rtStart + 1;
diff --git a/src/filters/parser/flvsplitter/FLVSplitter.vcproj b/src/filters/parser/flvsplitter/FLVSplitter.vcproj index 077391ee7..4b448d6c1 100644 --- a/src/filters/parser/flvsplitter/FLVSplitter.vcproj +++ b/src/filters/parser/flvsplitter/FLVSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="FLVSplitter"
ProjectGUID="{E62223EF-8263-41EB-8174-CD78BBEEF368}"
RootNamespace="FLVSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/flvsplitter/stdafx.h b/src/filters/parser/flvsplitter/stdafx.h index 67593bb9b..42dcfd9f5 100644 --- a/src/filters/parser/flvsplitter/stdafx.h +++ b/src/filters/parser/flvsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/matroskasplitter/MatroskaFile.cpp b/src/filters/parser/matroskasplitter/MatroskaFile.cpp index 7cc2c9c90..4f611b4f2 100644 --- a/src/filters/parser/matroskasplitter/MatroskaFile.cpp +++ b/src/filters/parser/matroskasplitter/MatroskaFile.cpp @@ -555,7 +555,7 @@ HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull) while(pos)
{
MatroskaReader::QWORD len = lens.GetNext(pos);
- CAutoPtr<CBinary> p(new CBinary());
+ CAutoPtr<CBinary> p(DNew CBinary());
p->SetCount((INT_PTR)len);
pMN->Read(p->GetData(), len);
BlockData.AddTail(p);
@@ -985,7 +985,7 @@ HRESULT CSignedLength::Parse(CMatroskaNode* pMN) template<class T>
HRESULT CNode<T>::Parse(CMatroskaNode* pMN)
{
- CAutoPtr<T> p(new T());
+ CAutoPtr<T> p(DNew T());
HRESULT hr = E_OUTOFMEMORY;
if(!p || FAILED(hr = p->Parse(pMN))) return hr;
AddTail(p);
@@ -994,7 +994,7 @@ HRESULT CNode<T>::Parse(CMatroskaNode* pMN) HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull)
{
- CAutoPtr<BlockGroup> p(new BlockGroup());
+ CAutoPtr<BlockGroup> p(DNew BlockGroup());
HRESULT hr = E_OUTOFMEMORY;
if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
AddTail(p);
@@ -1003,7 +1003,7 @@ HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull) HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull)
{
- CAutoPtr<SimpleBlock> p(new SimpleBlock());
+ CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
HRESULT hr = E_OUTOFMEMORY;
if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
AddTail(p);
@@ -1041,7 +1041,7 @@ CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch) {
if(m_len == 0) return CAutoPtr<CMatroskaNode>();
SeekTo(m_start);
- CAutoPtr<CMatroskaNode> pMN(new CMatroskaNode(this));
+ CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
if(id && !pMN->Find(id, fSearch)) pMN.Free();
return pMN;
}
@@ -1119,7 +1119,7 @@ MatroskaReader::QWORD CMatroskaNode::FindPos(DWORD id, MatroskaReader::QWORD sta CAutoPtr<CMatroskaNode> CMatroskaNode::Copy()
{
- CAutoPtr<CMatroskaNode> pNewNode(new CMatroskaNode(m_pMF));
+ CAutoPtr<CMatroskaNode> pNewNode(DNew CMatroskaNode(m_pMF));
pNewNode->m_pParent = m_pParent;
pNewNode->m_id.Set(m_id);
pNewNode->m_len.Set(m_len);
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp b/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp index 07120d86f..fff5e325f 100644 --- a/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp +++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp @@ -115,7 +115,7 @@ HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pTrackEntryMap.RemoveAll();
m_pOrderedTrackArray.RemoveAll();
- m_pFile.Attach(new CMatroskaFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -584,7 +584,7 @@ avcsuccess: HRESULT hr;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
if(!pTE->Name.IsEmpty()) pPinOut->SetProperty(L"NAME", pTE->Name);
if(pTE->Language.GetLength() == 3) pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
AddOutputPin((DWORD)pTE->TrackNumber, pPinOut);
@@ -707,7 +707,7 @@ void CMatroskaSplitterFilter::InstallFonts() {
// assume this is a font resource
- if(BYTE* pData = new BYTE[(UINT)pF->FileDataLen])
+ if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen])
{
m_pFile->Seek(pF->FileDataPos);
@@ -760,7 +760,7 @@ void CMatroskaSplitterFilter::SendVorbisHeaderSample() {
long len = sizes.GetNext(pos);
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)pTE->TrackNumber;
p->rtStart = 0; p->rtStop = 1;
p->bSyncPoint = FALSE;
@@ -794,7 +794,7 @@ bool CMatroskaSplitterFilter::DemuxInit() UINT64 TrackNumber = m_pFile->m_segment.GetMasterTrack();
- CAutoPtr<Cue> pCue(new Cue());
+ CAutoPtr<Cue> pCue(DNew Cue());
do
{
@@ -803,8 +803,8 @@ bool CMatroskaSplitterFilter::DemuxInit() m_pFile->m_segment.SegmentInfo.Duration.Set((float)c.TimeCode - m_pFile->m_rtOffset/10000);
- CAutoPtr<CuePoint> pCuePoint(new CuePoint());
- CAutoPtr<CueTrackPosition> pCueTrackPosition(new CueTrackPosition());
+ CAutoPtr<CuePoint> pCuePoint(DNew CuePoint());
+ CAutoPtr<CueTrackPosition> pCueTrackPosition(DNew CueTrackPosition());
pCuePoint->CueTime.Set(c.TimeCode);
pCueTrackPosition->CueTrack.Set(TrackNumber);
pCueTrackPosition->CueClusterPosition.Set(m_pCluster->m_filepos - m_pSegment->m_start);
@@ -907,7 +907,7 @@ void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt) }
else if(pBlock->m_id == 0xA3)
{
- CAutoPtr<BlockGroup> bg(new BlockGroup());
+ CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(pBlock, true);
if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
bgn.AddTail(bg);
@@ -971,7 +971,7 @@ bool CMatroskaSplitterFilter::DemuxLoop() }
else if(m_pBlock->m_id == 0xA3)
{
- CAutoPtr<BlockGroup> bg(new BlockGroup());
+ CAutoPtr<BlockGroup> bg(DNew BlockGroup());
bg->Block.Parse(m_pBlock, true);
if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
bgn.AddTail(bg);
@@ -979,7 +979,7 @@ bool CMatroskaSplitterFilter::DemuxLoop() while(bgn.GetCount() && SUCCEEDED(hr))
{
- CAutoPtr<MatroskaPacket> p(new MatroskaPacket());
+ CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
p->bg = bgn.RemoveHead();
p->bSyncPoint = !p->bg->ReferenceBlock.IsValid();
@@ -1220,7 +1220,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
while(pos)
{
- CAutoPtr<Packet> tmp(new Packet());
+ CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
tmp->bDiscontinuity = p->bDiscontinuity;
tmp->bSyncPoint = p->bSyncPoint;
@@ -1242,7 +1242,7 @@ HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p) while(pos)
{
const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
- CAutoPtr<Packet> tmp(new Packet());
+ CAutoPtr<Packet> tmp(DNew Packet());
tmp->TrackNumber = p->TrackNumber;
tmp->bDiscontinuity = false;
tmp->bSyncPoint = false;
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj b/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj index a83238796..60f44f9da 100644 --- a/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj +++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MatroskaSplitter"
ProjectGUID="{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
RootNamespace="MatroskaSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/matroskasplitter/stdafx.h b/src/filters/parser/matroskasplitter/stdafx.h index 482cd4924..f57822752 100644 --- a/src/filters/parser/matroskasplitter/stdafx.h +++ b/src/filters/parser/matroskasplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h b/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h index 143d2e86c..6785185d3 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h +++ b/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h @@ -67,5 +67,6 @@ #define AP4_DEBUG
#endif
#endif
-
+#include "../../../../../../DSUtil/SharedInclude.h"
+#include <Afx.h>
#endif // _AP4_CONFIG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h index 3f9ea0518..578438370 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------- | includes +---------------------------------------------------------------------*/ +#include "../../../StdAfx.h" #include "Ap4Config.h" #include "Ap4Types.h" #include "Ap4Constants.h" diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h index 0a057fe0c..2a5d4e43e 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h @@ -89,7 +89,7 @@ AP4_Array<T>::EnsureCapacity(AP4_Cardinal count) } // (re)allocate the items - T* new_items = new T[new_count]; + T* new_items = DNew T[new_count]; if (new_items == NULL) { return AP4_ERROR_OUT_OF_MEMORY; } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp index d62a2f831..57ca254d9 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp @@ -408,7 +408,7 @@ AP4_AtomParent::FindChild(const char* path, if (auto_create && (index == 0)) { AP4_ContainerAtom* container = dynamic_cast<AP4_ContainerAtom*>(parent); if (parent) { - atom = new AP4_ContainerAtom(type, false); + atom = DNew AP4_ContainerAtom(type, false); container->AddChild(atom); } else { return NULL; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp index 8e04759e6..737d79f99 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp @@ -180,153 +180,153 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, // create the atom
switch (type) {
case AP4_ATOM_TYPE_MOOV:
- atom = new AP4_MoovAtom(size, stream, *this);
+ atom = DNew AP4_MoovAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_MVHD:
- atom = new AP4_MvhdAtom(size, stream);
+ atom = DNew AP4_MvhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_TRAK:
- atom = new AP4_TrakAtom(size, stream, *this);
+ atom = DNew AP4_TrakAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_HDLR:
- atom = new AP4_HdlrAtom(size, stream);
+ atom = DNew AP4_HdlrAtom(size, stream);
break;
case AP4_ATOM_TYPE_DREF:
- atom = new AP4_DrefAtom(size, stream, *this);
+ atom = DNew AP4_DrefAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_URL:
- atom = new AP4_UrlAtom(size, stream);
+ atom = DNew AP4_UrlAtom(size, stream);
break;
case AP4_ATOM_TYPE_TKHD:
- atom = new AP4_TkhdAtom(size, stream);
+ atom = DNew AP4_TkhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_MDHD:
- atom = new AP4_MdhdAtom(size, stream);
+ atom = DNew AP4_MdhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_STSD:
- atom = new AP4_StsdAtom(size, stream, *this);
+ atom = DNew AP4_StsdAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_STSC:
- atom = new AP4_StscAtom(size, stream);
+ atom = DNew AP4_StscAtom(size, stream);
break;
case AP4_ATOM_TYPE_STCO:
- atom = new AP4_StcoAtom(size, stream);
+ atom = DNew AP4_StcoAtom(size, stream);
break;
case AP4_ATOM_TYPE_CO64:
- atom = new AP4_Co64Atom(size, stream);
+ atom = DNew AP4_Co64Atom(size, stream);
break;
case AP4_ATOM_TYPE_STSZ:
- atom = new AP4_StszAtom(size, stream);
+ atom = DNew AP4_StszAtom(size, stream);
break;
case AP4_ATOM_TYPE_STTS:
- atom = new AP4_SttsAtom(size, stream);
+ atom = DNew AP4_SttsAtom(size, stream);
break;
case AP4_ATOM_TYPE_CTTS:
- atom = new AP4_CttsAtom(size, stream);
+ atom = DNew AP4_CttsAtom(size, stream);
break;
case AP4_ATOM_TYPE_STSS:
- atom = new AP4_StssAtom(size, stream);
+ atom = DNew AP4_StssAtom(size, stream);
break;
case AP4_ATOM_TYPE_MP4S:
- atom = new AP4_Mp4sSampleEntry(size, stream, *this);
+ atom = DNew AP4_Mp4sSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_MP4A:
atom = parent && parent->GetType() == AP4_ATOM_TYPE_STSD
- ? (AP4_Atom*)new AP4_Mp4aSampleEntry(size, stream, *this)
- : (AP4_Atom*)new AP4_UnknownAtom(type, size, false, stream);
+ ? (AP4_Atom*)DNew AP4_Mp4aSampleEntry(size, stream, *this)
+ : (AP4_Atom*)DNew AP4_UnknownAtom(type, size, false, stream);
break;
case AP4_ATOM_TYPE_MP4V:
- atom = new AP4_Mp4vSampleEntry(size, stream, *this);
+ atom = DNew AP4_Mp4vSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_AVC1:
- atom = new AP4_Avc1SampleEntry(size, stream, *this);
+ atom = DNew AP4_Avc1SampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ENCA:
- atom = new AP4_EncaSampleEntry(size, stream, *this);
+ atom = DNew AP4_EncaSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ENCV:
- atom = new AP4_EncvSampleEntry(size, stream, *this);
+ atom = DNew AP4_EncvSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ESDS:
- atom = new AP4_EsdsAtom(size, stream);
+ atom = DNew AP4_EsdsAtom(size, stream);
break;
case AP4_ATOM_TYPE_VMHD:
- atom = new AP4_VmhdAtom(size, stream);
+ atom = DNew AP4_VmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_SMHD:
- atom = new AP4_SmhdAtom(size, stream);
+ atom = DNew AP4_SmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_NMHD:
- atom = new AP4_NmhdAtom(size, stream);
+ atom = DNew AP4_NmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_HMHD:
- atom = new AP4_HmhdAtom(size, stream);
+ atom = DNew AP4_HmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_FRMA:
- atom = new AP4_FrmaAtom(size, stream);
+ atom = DNew AP4_FrmaAtom(size, stream);
break;
case AP4_ATOM_TYPE_SCHM:
- atom = new AP4_SchmAtom(size, stream);
+ atom = DNew AP4_SchmAtom(size, stream);
break;
case AP4_ATOM_TYPE_FTYP:
- atom = new AP4_FtypAtom(size, stream);
+ atom = DNew AP4_FtypAtom(size, stream);
break;
case AP4_ATOM_TYPE_RTP:
if (m_Context == AP4_ATOM_TYPE_HNTI) {
- atom = new AP4_RtpAtom(size, stream);
+ atom = DNew AP4_RtpAtom(size, stream);
} else {
- atom = new AP4_RtpHintSampleEntry(size, stream, *this);
+ atom = DNew AP4_RtpHintSampleEntry(size, stream, *this);
}
break;
case AP4_ATOM_TYPE_TIMS:
- atom = new AP4_TimsAtom(size, stream);
+ atom = DNew AP4_TimsAtom(size, stream);
break;
case AP4_ATOM_TYPE_SDP:
- atom = new AP4_SdpAtom(size, stream);
+ atom = DNew AP4_SdpAtom(size, stream);
break;
case AP4_ATOM_TYPE_IKMS:
- atom = new AP4_IkmsAtom(size, stream);
+ atom = DNew AP4_IkmsAtom(size, stream);
break;
case AP4_ATOM_TYPE_ISFM:
- atom = new AP4_IsfmAtom(size, stream);
+ atom = DNew AP4_IsfmAtom(size, stream);
break;
case AP4_ATOM_TYPE_HINT:
- atom = new AP4_TrefTypeAtom(type, size, stream);
+ atom = DNew AP4_TrefTypeAtom(type, size, stream);
break;
// container atoms
@@ -354,32 +354,32 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, case AP4_ATOM_TYPE_CMOV: {
AP4_UI32 context = m_Context;
m_Context = type; // set the context for the children
- atom = new AP4_ContainerAtom(type, size, false, stream, *this);
+ atom = DNew AP4_ContainerAtom(type, size, false, stream, *this);
m_Context = context; // restore the previous context
break;
}
// full container atoms
case AP4_ATOM_TYPE_META:
- atom = new AP4_ContainerAtom(type, size, true, stream, *this);
+ atom = DNew AP4_ContainerAtom(type, size, true, stream, *this);
break;
// other
case AP4_ATOM_TYPE_AVCC:
- atom = new AP4_AvcCAtom(size, stream);
+ atom = DNew AP4_AvcCAtom(size, stream);
break;
case AP4_ATOM_TYPE_TEXT:
- atom = new AP4_TextSampleEntry(size, stream, *this);
+ atom = DNew AP4_TextSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_TX3G:
- atom = new AP4_Tx3gSampleEntry(size, stream, *this);
+ atom = DNew AP4_Tx3gSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_FTAB:
- atom = new AP4_FtabAtom(size, stream);
+ atom = DNew AP4_FtabAtom(size, stream);
break;
case AP4_ATOM_TYPE_CVID:
@@ -388,7 +388,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, case AP4_ATOM_TYPE_SVQ3:
case AP4_ATOM_TYPE_H263:
case AP4_ATOM_TYPE_S263:
- atom = new AP4_VisualSampleEntry(type, size, stream, *this);
+ atom = DNew AP4_VisualSampleEntry(type, size, stream, *this);
break;
case AP4_ATOM_TYPE_SAMR:
@@ -398,34 +398,34 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, case AP4_ATOM_TYPE_QDM2:
case AP4_ATOM_TYPE_TWOS:
case AP4_ATOM_TYPE_SOWT:
- atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ atom = DNew AP4_AudioSampleEntry(type, size, stream, *this);
break;
case AP4_ATOM_TYPE__AC3:
- atom = new AP4_AC3SampleEntry(size, stream, *this);
+ atom = DNew AP4_AC3SampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_CHPL:
- atom = new AP4_ChplAtom(size, stream);
+ atom = DNew AP4_ChplAtom(size, stream);
break;
case AP4_ATOM_TYPE_DATA:
- atom = new AP4_DataAtom(size, stream);
+ atom = DNew AP4_DataAtom(size, stream);
break;
case AP4_ATOM_TYPE_DCOM:
- atom = new AP4_DcomAtom(size, stream);
+ atom = DNew AP4_DcomAtom(size, stream);
break;
case AP4_ATOM_TYPE_CMVD:
- atom = new AP4_CmvdAtom(size, stream, *this);
+ atom = DNew AP4_CmvdAtom(size, stream, *this);
break;
default:
if(parent && parent->GetType() == AP4_ATOM_TYPE_STSD && (type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
{
- atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ atom = DNew AP4_AudioSampleEntry(type, size, stream, *this);
}
else // try all the external type handlers
{
@@ -440,7 +440,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, }
if (atom == NULL) {
// no custom handlers, create a generic atom
- atom = new AP4_UnknownAtom(type, size, false, stream);
+ atom = DNew AP4_UnknownAtom(type, size, false, stream);
}
}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp index 2e7052ab4..0385c3a7b 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp @@ -449,7 +449,7 @@ AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_Size size) : m_Position(0),
m_ReferenceCount(1)
{
- m_Buffer = new AP4_UI08[size];
+ m_Buffer = DNew AP4_UI08[size];
}
/*----------------------------------------------------------------------
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp index 053b70fa2..9c3214826 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp @@ -41,7 +41,7 @@ AP4_Co64Atom::AP4_Co64Atom(AP4_UI64* entries, AP4_UI32 entry_count) : AP4_Atom(AP4_ATOM_TYPE_CO64,
AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*8,
true),
- m_Entries(new AP4_UI64[entry_count]),
+ m_Entries(DNew AP4_UI64[entry_count]),
m_EntryCount(entry_count)
{
memcpy(m_Entries, entries, m_EntryCount*8);
@@ -57,7 +57,7 @@ AP4_Co64Atom::AP4_Co64Atom(AP4_Size size, AP4_ByteStream& stream) : if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8) {
m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8;
}
- m_Entries = new AP4_UI64[m_EntryCount];
+ m_Entries = DNew AP4_UI64[m_EntryCount];
for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
stream.ReadUI64(m_Entries[i]);
}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp index f73afbf3f..36e8ca25e 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp @@ -51,7 +51,7 @@ AP4_DataBuffer::AP4_DataBuffer(AP4_Size buffer_size) : m_BufferSize(buffer_size), m_DataSize(0) { - m_Buffer = new AP4_Byte[buffer_size]; + m_Buffer = DNew AP4_Byte[buffer_size]; } /*---------------------------------------------------------------------- @@ -63,7 +63,7 @@ AP4_DataBuffer::AP4_DataBuffer(const AP4_DataBuffer& other) : m_BufferSize(other.m_DataSize), m_DataSize(other.m_DataSize) { - m_Buffer = new AP4_Byte[m_BufferSize]; + m_Buffer = DNew AP4_Byte[m_BufferSize]; memcpy(m_Buffer, other.m_Buffer, m_BufferSize); } @@ -159,7 +159,7 @@ AP4_DataBuffer::ReallocateBuffer(AP4_Size size) if (m_DataSize > size) return AP4_FAILURE; // allocate a new buffer - AP4_Byte* new_buffer = new AP4_Byte[size]; + AP4_Byte* new_buffer = DNew AP4_Byte[size]; // copy the contents of the previous buffer ,is any if (m_Buffer && m_DataSize) { diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp index dfaf40872..de442df29 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp @@ -82,7 +82,7 @@ AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor( stream.ReadUI32(m_AverageBitrate); // read other descriptors - AP4_SubStream* substream = new AP4_SubStream(stream, start+13, payload_size-13); + AP4_SubStream* substream = DNew AP4_SubStream(stream, start+13, payload_size-13); AP4_Descriptor* descriptor = NULL; while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream, descriptor) diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp index d04c9d57c..092458585 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp @@ -85,7 +85,7 @@ AP4_DecoderSpecificInfoDescriptor::WriteFields(AP4_ByteStream& stream) AP4_Result AP4_DecoderSpecificInfoDescriptor::Inspect(AP4_AtomInspector& inspector) { - char* info = new char[m_Info.GetDataSize()*3+1]; + char* info = DNew char[m_Info.GetDataSize()*3+1]; for (unsigned int i=0; i<m_Info.GetDataSize(); i++) { AP4_StringFormat(&info[i*3], 3, "%02x ", m_Info.UseData()[i]); } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp index 4db7b96f9..d2ebd8676 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp @@ -79,24 +79,24 @@ AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream, // create the descriptor switch (tag) { case AP4_DESCRIPTOR_TAG_ES: - descriptor = new AP4_EsDescriptor(stream, header_size, payload_size); + descriptor = DNew AP4_EsDescriptor(stream, header_size, payload_size); break; case AP4_DESCRIPTOR_TAG_DECODER_CONFIG: - descriptor = new AP4_DecoderConfigDescriptor(stream, header_size, payload_size); + descriptor = DNew AP4_DecoderConfigDescriptor(stream, header_size, payload_size); break; case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO: - descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size); + descriptor = DNew AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size); break; case AP4_DESCRIPTOR_TAG_SL_CONFIG: if (payload_size != 1) return AP4_ERROR_INVALID_FORMAT; - descriptor = new AP4_SLConfigDescriptor(header_size); + descriptor = DNew AP4_SLConfigDescriptor(header_size); break; default: - descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size); + descriptor = DNew AP4_UnknownDescriptor(stream, tag, header_size, payload_size); break; } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp index 059e15ba9..1d305869b 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp @@ -73,7 +73,7 @@ AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream, unsigned char url_length; stream.ReadUI08(url_length); if (url_length) { - char* url = new char[url_length+1]; + char* url = DNew char[url_length+1]; if (url) { stream.Read(url, url_length, NULL); url[url_length] = '\0'; @@ -91,7 +91,7 @@ AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream, // read other descriptors AP4_Offset offset; stream.Tell(offset); - AP4_SubStream* substream = new AP4_SubStream(stream, offset, + AP4_SubStream* substream = DNew AP4_SubStream(stream, offset, payload_size-(offset-start)); AP4_Descriptor* descriptor = NULL; while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream, diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp index 8c65dd3ae..995bc4a72 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp @@ -55,7 +55,7 @@ AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) : while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
switch (atom->GetType()) {
case AP4_ATOM_TYPE_MOOV:
- m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
+ m_Movie = DNew AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
stream);
break;
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp index 353ef117e..e6a14ffb8 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp @@ -59,7 +59,7 @@ AP4_HdlrAtom::AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream) : // read the name unless it is empty
int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);
if (name_size > 0) {
- char* name = new char[name_size+1];
+ char* name = DNew char[name_size+1];
stream.Read(name, name_size);
name[name_size] = '\0'; // force a null termination
m_HandlerName = name;
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp index 73b566753..b3ae303bb 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp @@ -121,7 +121,7 @@ AP4_HintTrackReader::GetRtpSample(AP4_Ordinal index) delete m_RtpSampleData; AP4_ByteStream& rtp_data_stream = *m_CurrentHintSample.GetDataStream(); rtp_data_stream.Seek(m_CurrentHintSample.GetOffset()); - m_RtpSampleData = new AP4_RtpSampleData(rtp_data_stream, + m_RtpSampleData = DNew AP4_RtpSampleData(rtp_data_stream, m_CurrentHintSample.GetSize()); // reinit the packet index @@ -234,7 +234,7 @@ AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet, // now write AP4_ByteStream* stream = - new AP4_MemoryByteStream(packet_data.UseData(), packet_data.GetDataSize()); + DNew AP4_MemoryByteStream(packet_data.UseData(), packet_data.GetDataSize()); // header + ssrc stream->WriteUI08(0x80 | (packet->GetPBit() << 5) | (packet->GetXBit() << 4)); diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp index d34398ac6..cb5187127 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp @@ -50,7 +50,7 @@ AP4_IkmsAtom::AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream) : { AP4_Size string_size = size-AP4_FULL_ATOM_HEADER_SIZE; if (string_size) { - char* str = new char[string_size]; + char* str = DNew char[string_size]; stream.Read(str, string_size); str[string_size-1] = '\0'; // force null-termination m_KmsUri = str; @@ -64,7 +64,7 @@ AP4_IkmsAtom::AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream) : AP4_Atom* AP4_IkmsAtom::Clone() { - return new AP4_IkmsAtom(m_KmsUri.c_str()); + return DNew AP4_IkmsAtom(m_KmsUri.c_str()); } /*---------------------------------------------------------------------- diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp index c40ca3664..3757df81d 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp @@ -64,7 +64,7 @@ AP4_IsfmAtom::AP4_IsfmAtom(AP4_Size size, AP4_ByteStream& stream) : AP4_Atom* AP4_IsfmAtom::Clone() { - return new AP4_IsfmAtom(m_SelectiveEncryption, + return DNew AP4_IsfmAtom(m_SelectiveEncryption, m_KeyIndicatorLength, m_IvLength); } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp index 02db0fc0b..22b24a37b 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp @@ -89,7 +89,7 @@ AP4_EncaSampleEntry::ToSampleDescription() schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi")); // create the sample description - return new AP4_IsmaCrypSampleDescription( + return DNew AP4_IsmaCrypSampleDescription( original_sample_description, frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A, schm->GetSchemeType(), @@ -148,7 +148,7 @@ AP4_EncvSampleEntry::ToSampleDescription() schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi")); // create the sample description - return new AP4_IsmaCrypSampleDescription( + return DNew AP4_IsmaCrypSampleDescription( original_sample_description, frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4V, schm->GetSchemeType(), @@ -174,7 +174,7 @@ AP4_IsmaCrypSampleDescription::AP4_IsmaCrypSampleDescription( m_SchemeVersion(scheme_version), m_SchemeUri(scheme_uri) { - m_SchemeInfo = new AP4_IsmaCrypSchemeInfo(schi); + m_SchemeInfo = DNew AP4_IsmaCrypSchemeInfo(schi); } /*---------------------------------------------------------------------- @@ -238,7 +238,7 @@ AP4_IsmaCipher::AP4_IsmaCipher(const AP4_UI08* key, } // create a cipher - m_Cipher = new AP4_StreamCipher(key, salt_128); + m_Cipher = DNew AP4_StreamCipher(key, salt_128); } /*---------------------------------------------------------------------- @@ -372,7 +372,7 @@ AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter( m_CipherParams = (AP4_IsfmAtom*)sample_description->GetSchemeInfo()->GetSchiAtom().FindChild("iSFM"); // instantiate the cipher - m_Cipher = new AP4_IsmaCipher(key, salt, + m_Cipher = DNew AP4_IsmaCipher(key, salt, m_CipherParams->GetIvLength(), m_CipherParams->GetKeyIndicatorLength(), m_CipherParams->GetSelectiveEncryption()); @@ -450,7 +450,7 @@ AP4_IsmaDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak) const AP4_UI08* key; const AP4_UI08* salt; if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) { - return new AP4_IsmaTrackDecrypter(key, salt, ismacryp_desc, entry); + return DNew AP4_IsmaTrackDecrypter(key, salt, ismacryp_desc, entry); } } } @@ -501,7 +501,7 @@ AP4_IsmaTrackEncrypter::AP4_IsmaTrackEncrypter( m_ByteOffset(0) { // instantiate the cipher (fixed params for now) - m_Cipher = new AP4_IsmaCipher(key, salt, 4, 0, false); + m_Cipher = DNew AP4_IsmaCipher(key, salt, 4, 0, false); } /*---------------------------------------------------------------------- @@ -528,18 +528,18 @@ AP4_Result AP4_IsmaTrackEncrypter::ProcessTrack() { // sinf container - AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF); + AP4_ContainerAtom* sinf = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_SINF); // original format - AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType()); + AP4_FrmaAtom* frma = DNew AP4_FrmaAtom(m_SampleEntry->GetType()); // scheme - AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_ISMACRYP_SCHEME_TYPE_IAEC, 1); + AP4_SchmAtom* schm = DNew AP4_SchmAtom(AP4_ISMACRYP_SCHEME_TYPE_IAEC, 1); // scheme info - AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI); - AP4_IkmsAtom* ikms = new AP4_IkmsAtom(m_KmsUri.c_str()); - AP4_IsfmAtom* isfm = new AP4_IsfmAtom(false, 0, 4); + AP4_ContainerAtom* schi = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI); + AP4_IkmsAtom* ikms = DNew AP4_IkmsAtom(m_KmsUri.c_str()); + AP4_IsfmAtom* isfm = DNew AP4_IsfmAtom(false, 0, 4); // populate the schi container schi->AddChild(ikms); @@ -615,7 +615,7 @@ AP4_IsmaEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak) break; } if (format) { - return new AP4_IsmaTrackEncrypter(m_KmsUri.c_str(), + return DNew AP4_IsmaTrackEncrypter(m_KmsUri.c_str(), key, salt, entry, @@ -649,7 +649,7 @@ AP4_IsmaKeyMap::SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* s { KeyEntry* entry = GetEntry(track_id); if (entry == NULL) { - m_KeyEntries.Add(new KeyEntry(track_id, key, salt)); + m_KeyEntries.Add(DNew KeyEntry(track_id, key, salt)); } else { entry->SetKey(key, salt); } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h index 5a722f109..269986d6f 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h @@ -140,7 +140,7 @@ inline AP4_Result AP4_List<T>::Add(T* data) { - return Add(new Item(data)); + return Add(DNew Item(data)); } /*---------------------------------------------------------------------- @@ -225,7 +225,7 @@ template <typename T> AP4_Result AP4_List<T>::Insert(Item* where, T* data) { - Item* item = new Item(data); + Item* item = DNew Item(data); if (where == NULL) { // insert as the head diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp index b252084ce..5dce78879 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp @@ -121,7 +121,7 @@ AP4_MoovAtom::AP4_MoovAtom(AP4_Size size, if(dst)
{
- AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out);
+ AP4_ByteStream* s = DNew AP4_MemoryByteStream(dst, d_stream.total_out);
ReadChildren(atom_factory, *s, d_stream.total_out);
s->Release();
free(dst);
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp index 51b17b780..2a2d9ea41 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp @@ -76,8 +76,8 @@ private: +---------------------------------------------------------------------*/
AP4_Movie::AP4_Movie(AP4_UI32 time_scale)
{
- m_MoovAtom = new AP4_MoovAtom();
- m_MvhdAtom = new AP4_MvhdAtom(0, 0,
+ m_MoovAtom = DNew AP4_MoovAtom();
+ m_MvhdAtom = DNew AP4_MvhdAtom(0, 0,
time_scale,
0,
0x00010000,
@@ -108,7 +108,7 @@ AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat) : trak_atoms = &moov->GetTrakAtoms();
AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem();
while (item) {
- AP4_Track* track = new AP4_Track(*item->GetData(),
+ AP4_Track* track = DNew AP4_Track(*item->GetData(),
mdat,
time_scale);
m_Tracks.Add(track);
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp index 6019bd2f0..ec2918ac2 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp @@ -99,8 +99,8 @@ AP4_Processor::Process(AP4_ByteStream& input, // build an array of track sample cursors AP4_List<AP4_TrakAtom>& trak_atoms = moov->GetTrakAtoms(); AP4_Cardinal track_count = trak_atoms.ItemCount(); - AP4_SampleCursor* cursors = new AP4_SampleCursor[track_count]; - TrackHandler** handlers = new TrackHandler*[track_count]; + AP4_SampleCursor* cursors = DNew AP4_SampleCursor[track_count]; + TrackHandler** handlers = DNew TrackHandler*[track_count]; AP4_List<AP4_TrakAtom>::Item* item = trak_atoms.FirstItem(); unsigned int index = 0; while (item) { @@ -110,7 +110,7 @@ AP4_Processor::Process(AP4_ByteStream& input, if (stbl == NULL) continue; handlers[index] = CreateTrackHandler(item->GetData()); cursors[index].m_Locator.m_TrakIndex = index; - cursors[index].m_Locator.m_SampleTable = new AP4_AtomSampleTable(stbl, input); + cursors[index].m_Locator.m_SampleTable = DNew AP4_AtomSampleTable(stbl, input); cursors[index].m_Locator.m_SampleIndex = 0; cursors[index].m_Locator.m_SampleTable->GetSample(0, cursors[index].m_Locator.m_Sample); cursors[index].m_Locator.m_Chunk = 1; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp index 1cf72cfa2..676792810 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp @@ -47,7 +47,7 @@ AP4_RtpAtom::AP4_RtpAtom(AP4_Size size, AP4_ByteStream& stream) : // sdptext int str_size = size-(AP4_ATOM_HEADER_SIZE+4); if (str_size) { - char* str = new char[str_size+1]; + char* str = DNew char[str_size+1]; stream.Read(str, str_size); str[str_size] = '\0'; // force null-termination m_SdpText = str; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp index e5545618c..111ce13cb 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp @@ -61,7 +61,7 @@ AP4_RtpSampleData::AP4_RtpSampleData(AP4_ByteStream& stream, AP4_Size size) // packets for (AP4_UI16 i=0; i<packet_count; i++) { - AP4_RtpPacket* packet = new AP4_RtpPacket(stream); + AP4_RtpPacket* packet = DNew AP4_RtpPacket(stream); m_Packets.Add(packet); } @@ -106,7 +106,7 @@ AP4_RtpSampleData::ToByteStream() AP4_Size size = GetSize(); // create a memory stream - AP4_MemoryByteStream* stream = new AP4_MemoryByteStream(size); + AP4_MemoryByteStream* stream = DNew AP4_MemoryByteStream(size); // write in it AP4_Result result = stream->WriteUI16(static_cast<AP4_UI16>(m_Packets.ItemCount())); @@ -619,16 +619,16 @@ AP4_RtpConstructorFactory::CreateConstructorFromStream(AP4_ByteStream& stream, switch(type) { case AP4_RTP_CONSTRUCTOR_TYPE_NOOP: - constructor = new AP4_NoopRtpConstructor(stream); + constructor = DNew AP4_NoopRtpConstructor(stream); break; case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE: - constructor = new AP4_ImmediateRtpConstructor(stream); + constructor = DNew AP4_ImmediateRtpConstructor(stream); break; case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE: - constructor = new AP4_SampleRtpConstructor(stream); + constructor = DNew AP4_SampleRtpConstructor(stream); break; case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC: - constructor = new AP4_SampleDescRtpConstructor(stream); + constructor = DNew AP4_SampleDescRtpConstructor(stream); break; default: return AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp index 3c299df57..c2a1bbcb1 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp @@ -55,7 +55,7 @@ AP4_UnknownSampleDescription::~AP4_UnknownSampleDescription() AP4_Atom* AP4_UnknownSampleDescription::ToAtom() const { - return new AP4_SampleEntry(m_SampleEntry->GetType(), + return DNew AP4_SampleEntry(m_SampleEntry->GetType(), m_SampleEntry->GetDataReferenceIndex()); } @@ -78,7 +78,7 @@ AP4_MpegSampleDescription::AP4_MpegSampleDescription( m_AvgBitrate(avg_bitrate) { if (decoder_info != NULL) { - m_DecoderInfo = new AP4_DataBuffer(*decoder_info); + m_DecoderInfo = DNew AP4_DataBuffer(*decoder_info); } } @@ -96,15 +96,15 @@ AP4_MpegSampleDescription::~AP4_MpegSampleDescription() AP4_EsDescriptor* AP4_MpegSampleDescription::CreateEsDescriptor() const { - AP4_EsDescriptor* desc = new AP4_EsDescriptor(0); + AP4_EsDescriptor* desc = DNew AP4_EsDescriptor(0); AP4_DecoderSpecificInfoDescriptor* dsi_desc; if (m_DecoderInfo) { - dsi_desc = new AP4_DecoderSpecificInfoDescriptor(*m_DecoderInfo); + dsi_desc = DNew AP4_DecoderSpecificInfoDescriptor(*m_DecoderInfo); } else { dsi_desc = NULL; } AP4_DecoderConfigDescriptor* decoder_config = - new AP4_DecoderConfigDescriptor(m_StreamType, + DNew AP4_DecoderConfigDescriptor(m_StreamType, m_ObjectTypeId, m_BufferSize, m_MaxBitrate, @@ -139,7 +139,7 @@ AP4_MpegSystemSampleDescription::AP4_MpegSystemSampleDescription( AP4_Atom* AP4_MpegSystemSampleDescription::ToAtom() const { - return new AP4_Mp4sSampleEntry(CreateEsDescriptor()); + return DNew AP4_Mp4sSampleEntry(CreateEsDescriptor()); } /*---------------------------------------------------------------------- @@ -170,7 +170,7 @@ AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription( AP4_Atom* AP4_MpegAudioSampleDescription::ToAtom() const { - return new AP4_Mp4aSampleEntry(m_SampleRate<<16, + return DNew AP4_Mp4aSampleEntry(m_SampleRate<<16, m_SampleSize, m_ChannelCount, CreateEsDescriptor()); @@ -208,7 +208,7 @@ AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription( AP4_Atom* AP4_MpegVideoSampleDescription::ToAtom() const { - return new AP4_Mp4vSampleEntry(m_Width, + return DNew AP4_Mp4vSampleEntry(m_Width, m_Height, m_Depth, m_CompressorName.c_str(), diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp index 219c6ad6b..6e3567d38 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp @@ -190,7 +190,7 @@ AP4_SampleEntry::OnChildChanged(AP4_Atom*) AP4_SampleDescription*
AP4_SampleEntry::ToSampleDescription()
{
- return new AP4_UnknownSampleDescription(this);
+ return DNew AP4_UnknownSampleDescription(this);
}
/*----------------------------------------------------------------------
@@ -200,7 +200,7 @@ AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format, AP4_EsDescriptor* descriptor) :
AP4_SampleEntry(format)
{
- if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+ if (descriptor) AddChild(DNew AP4_EsdsAtom(descriptor));
}
/*----------------------------------------------------------------------
@@ -289,7 +289,7 @@ AP4_Mp4sSampleEntry::ToSampleDescription() }
// create a sample description
- return new AP4_MpegSystemSampleDescription(
+ return DNew AP4_MpegSystemSampleDescription(
dc_desc->GetStreamType(),
dc_desc->GetObjectTypeIndication(),
dsi,
@@ -523,7 +523,7 @@ AP4_AudioSampleEntry::ToSampleDescription() }
// create a sample description
- return new AP4_MpegAudioSampleDescription(
+ return DNew AP4_MpegAudioSampleDescription(
dc_desc->GetObjectTypeIndication(),
m_SampleRate>>16,
m_SampleSize,
@@ -755,7 +755,7 @@ AP4_VisualSampleEntry::ToSampleDescription() }
// create a sample description
- return new AP4_MpegVideoSampleDescription(
+ return DNew AP4_MpegVideoSampleDescription(
dc_desc->GetObjectTypeIndication(),
m_Width,
m_Height,
@@ -834,7 +834,7 @@ AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version, m_MaxPacketSize(max_packet_size)
{
// build an atom for timescale
- AddChild(new AP4_TimsAtom(timescale));
+ AddChild(DNew AP4_TimsAtom(timescale));
}
/*----------------------------------------------------------------------
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp index ab07f2b02..174122504 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp @@ -44,16 +44,16 @@ AP4_Result AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl) { // create the stbl container - stbl = new AP4_ContainerAtom(AP4_ATOM_TYPE_STBL); + stbl = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_STBL); // create the stsd atom - AP4_StsdAtom* stsd = new AP4_StsdAtom(this); + AP4_StsdAtom* stsd = DNew AP4_StsdAtom(this); // create the stsz atom - AP4_StszAtom* stsz = new AP4_StszAtom(); + AP4_StszAtom* stsz = DNew AP4_StszAtom(); // create the stsc atom - AP4_StscAtom* stsc = new AP4_StscAtom(); + AP4_StscAtom* stsc = DNew AP4_StscAtom(); // start chunk table AP4_Cardinal samples_in_chunk = 0; @@ -95,11 +95,11 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl) } // create the stco atom - AP4_StcoAtom* stco = new AP4_StcoAtom(&chunk_offsets[0], + AP4_StcoAtom* stco = DNew AP4_StcoAtom(&chunk_offsets[0], chunk_offsets.ItemCount()); // create the stts atom (for now, we assume sample of equal duration) - AP4_SttsAtom* stts = new AP4_SttsAtom(); + AP4_SttsAtom* stts = DNew AP4_SttsAtom(); stts->AddEntry(sample_count, 1000); // FIXME // attach the children of stbl diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp index e68b2e287..f0b3ff69b 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp @@ -62,7 +62,7 @@ AP4_SchmAtom::AP4_SchmAtom(AP4_Size size, AP4_ByteStream& stream) : if (m_Flags & 1) { int str_size = size-(AP4_FULL_ATOM_HEADER_SIZE+8); if (str_size > 0) { - char* str = new char[str_size]; + char* str = DNew char[str_size]; stream.Read(str, str_size); str[str_size-1] = '\0'; // force null-termination m_SchemeUri = str; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp index 26d0e0410..fe086b895 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp @@ -54,7 +54,7 @@ AP4_SdpAtom::AP4_SdpAtom(AP4_Size size, AP4_ByteStream& stream) : // sdptext AP4_Size str_size = size-AP4_ATOM_HEADER_SIZE; if (str_size > 0) { - char* str = new char[str_size+1]; + char* str = DNew char[str_size+1]; stream.Read(str, str_size); str[str_size] = '\0'; // force null-termination m_SdpText = str; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp index feee85716..4875f5043 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp @@ -41,7 +41,7 @@ AP4_StcoAtom::AP4_StcoAtom(AP4_UI32* entries, AP4_UI32 entry_count) : AP4_Atom(AP4_ATOM_TYPE_STCO,
AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*4,
true),
- m_Entries(new AP4_UI32[entry_count]),
+ m_Entries(DNew AP4_UI32[entry_count]),
m_EntryCount(entry_count)
{
memcpy(m_Entries, entries, m_EntryCount*4);
@@ -57,7 +57,7 @@ AP4_StcoAtom::AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream) : if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4) {
m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4;
}
- m_Entries = new AP4_UI32[m_EntryCount];
+ m_Entries = DNew AP4_UI32[m_EntryCount];
for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
stream.ReadUI32(m_Entries[i]);
i = i;
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp index 852c33516..7c818538c 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp @@ -76,7 +76,7 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_Size size, m_Data.SetDataSize(bytes_available);
stream.Read(m_Data.UseData(), m_Data.GetDataSize());
- AP4_ByteStream* s = new AP4_MemoryByteStream(m_Data.UseData(), m_Data.GetDataSize());
+ AP4_ByteStream* s = DNew AP4_MemoryByteStream(m_Data.UseData(), m_Data.GetDataSize());
for (unsigned int i=0; i<entry_count; i++) {
AP4_Atom* atom;
if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(*s,
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp index 42dc42d99..32e58baef 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp @@ -98,7 +98,7 @@ AP4_Track::AP4_Track(Type type, movie_time_scale);
// create a trak atom
- m_TrakAtom = new AP4_TrakAtom(sample_table,
+ m_TrakAtom = DNew AP4_TrakAtom(sample_table,
hdlr_type,
hdlr_name,
track_id,
@@ -162,7 +162,7 @@ AP4_Track::AP4_Track(AP4_TrakAtom& atom, AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
atom.FindChild("mdia/minf/stbl"));
if (stbl) {
- m_SampleTable = new AP4_AtomSampleTable(stbl, sample_stream);
+ m_SampleTable = DNew AP4_AtomSampleTable(stbl, sample_stream);
}
}
@@ -312,17 +312,17 @@ void AP4_HintTrack::SetSdpText(const char* text)
{
// build an sdp atom
- AP4_SdpAtom* sdp = new AP4_SdpAtom(text);
+ AP4_SdpAtom* sdp = DNew AP4_SdpAtom(text);
// build the hnti
- AP4_ContainerAtom* hnti = new AP4_ContainerAtom(AP4_ATOM_TYPE_HNTI);
+ AP4_ContainerAtom* hnti = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_HNTI);
hnti->AddChild(sdp);
// check if there's already a user data atom
AP4_ContainerAtom* udta = dynamic_cast<AP4_ContainerAtom*>(m_TrakAtom->FindChild("udta"));
if (udta == NULL) {
// otherwise create it
- udta = new AP4_ContainerAtom(AP4_ATOM_TYPE_UDTA);
+ udta = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_UDTA);
m_TrakAtom->AddChild(udta);
}
udta->AddChild(hnti);
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp index 1b96ea120..15bd28412 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp @@ -64,7 +64,7 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table, AP4_Result result;
// create a tkhd atom
- m_TkhdAtom = new AP4_TkhdAtom(creation_time,
+ m_TkhdAtom = DNew AP4_TkhdAtom(creation_time,
modification_time,
track_id,
track_duration,
@@ -75,38 +75,38 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table, // create an edts
// create a mdia atom
- AP4_ContainerAtom* mdia = new AP4_ContainerAtom(AP4_ATOM_TYPE_MDIA);
+ AP4_ContainerAtom* mdia = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_MDIA);
// create a hdlr atom for the mdia atom
- m_HdlrAtom = new AP4_HdlrAtom(hdlr_type, hdlr_name);
+ m_HdlrAtom = DNew AP4_HdlrAtom(hdlr_type, hdlr_name);
// create a minf atom
- AP4_ContainerAtom* minf = new AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
+ AP4_ContainerAtom* minf = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
// create a media header atom for minf (vmhd, smhd, hmhd or nmhd)
AP4_Atom* minf_header;
switch (hdlr_type) {
case AP4_HANDLER_TYPE_VIDE:
- minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
+ minf_header = DNew AP4_VmhdAtom(0, 0, 0, 0);
break;
case AP4_HANDLER_TYPE_SOUN:
- minf_header = new AP4_SmhdAtom(0);
+ minf_header = DNew AP4_SmhdAtom(0);
break;
default:
- minf_header = new AP4_NmhdAtom();
+ minf_header = DNew AP4_NmhdAtom();
break;
}
// create a dinf atom for minf
- AP4_ContainerAtom* dinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_DINF);
+ AP4_ContainerAtom* dinf = DNew AP4_ContainerAtom(AP4_ATOM_TYPE_DINF);
// create a url atom as a ref for dref
- AP4_Atom* url = new AP4_UrlAtom(); // local ref
+ AP4_Atom* url = DNew AP4_UrlAtom(); // local ref
// create a dref atom for dinf
- AP4_DrefAtom* dref = new AP4_DrefAtom(&url, 1);
+ AP4_DrefAtom* dref = DNew AP4_DrefAtom(&url, 1);
// create a stbl atom for minf
AP4_ContainerAtom* stbl;
@@ -122,7 +122,7 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table, if (stbl) minf->AddChild(stbl);
// create a mdhd atom for the mdia atom
- AP4_MdhdAtom* mdhd = new AP4_MdhdAtom(creation_time,
+ AP4_MdhdAtom* mdhd = DNew AP4_MdhdAtom(creation_time,
modification_time,
media_time_scale,
media_duration,
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp index 516126386..b40be3504 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp @@ -53,7 +53,7 @@ AP4_UrlAtom::AP4_UrlAtom(AP4_Size size, AP4_ByteStream& stream) : // not self contained AP4_Size str_size = size-AP4_FULL_ATOM_HEADER_SIZE; if (str_size > 0) { - char* str = new char[str_size]; + char* str = DNew char[str_size]; stream.Read(str, str_size); str[str_size-1] = '\0'; // force null-termination m_Url = str; diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp index 706f533d6..4352d23d0 100644 --- a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp +++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp @@ -63,7 +63,7 @@ AP4_StreamCipher::Reset(const AP4_UI08* key, const AP4_UI08* salt) } // (re)create one - m_BlockCipher = new AP4_AesBlockCipher(key); + m_BlockCipher = DNew AP4_AesBlockCipher(key); } // reset the stream offset diff --git a/src/filters/parser/mp4splitter/MP4Splitter.cpp b/src/filters/parser/mp4splitter/MP4Splitter.cpp index 0070225bb..5f97bf19d 100644 --- a/src/filters/parser/mp4splitter/MP4Splitter.cpp +++ b/src/filters/parser/mp4splitter/MP4Splitter.cpp @@ -126,7 +126,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_trackpos.RemoveAll();
m_pFile.Free();
- m_pFile.Attach(new CMP4SplitterFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CMP4SplitterFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -574,7 +574,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) }
}
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName);
if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
@@ -594,7 +594,7 @@ HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) id ^= 0x80402010; // FIXME: until fixing, let's hope there won't be another track like this...
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName + postfix);
if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
@@ -754,7 +754,7 @@ static CStringW ConvertTX3GToSSA( {
int str_len = str.GetLength();
- SSACharacter* chars = new SSACharacter[str_len];
+ SSACharacter* chars = DNew SSACharacter[str_len];
for(int i = 0; i < str_len; i++) chars[i].c = str[i];
str.Empty();
@@ -1040,7 +1040,7 @@ bool CMP4SplitterFilter::DemuxLoop() {
const CMediaType& mt = pPin->CurrentMediaType();
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)track->GetId();
p->rtStart = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
@@ -1199,7 +1199,7 @@ bool CMP4SplitterFilter::DemuxLoop() if(!dlgln_bkg.IsEmpty())
{
- CAutoPtr<Packet> p2(new Packet());
+ CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber;
p2->rtStart = p->rtStart;
p2->rtStop = p->rtStop;
@@ -1210,7 +1210,7 @@ bool CMP4SplitterFilter::DemuxLoop() if(!dlgln_plaintext.IsEmpty())
{
- CAutoPtr<Packet> p2(new Packet());
+ CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = p->TrackNumber ^ 0x80402010;
p2->rtStart = p->rtStart;
p2->rtStop = p->rtStop;
@@ -1343,7 +1343,7 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr = E_FAIL;
m_pFile.Free();
- m_pFile.Attach(new CBaseSplitterFileEx(pAsyncReader, hr));
+ m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -1546,7 +1546,7 @@ HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
m_rtNewStop = m_rtStop = m_rtDuration;
@@ -1592,7 +1592,7 @@ bool CMPEG4VideoSplitterFilter::DemuxLoop() if(!p)
{
- p.Attach(new Packet());
+ p.Attach(DNew Packet());
p->SetCount(0, 1024);
p->TrackNumber = 0;
p->rtStart = rt;
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.vcproj b/src/filters/parser/mp4splitter/MP4Splitter.vcproj index 936316a1a..0ca3e7790 100644 --- a/src/filters/parser/mp4splitter/MP4Splitter.vcproj +++ b/src/filters/parser/mp4splitter/MP4Splitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MP4Splitter"
ProjectGUID="{9ED4B036-7399-4128-868D-6E71188E0277}"
RootNamespace="MP4Splitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
DisableSpecificWarnings="4812"
@@ -103,6 +104,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -161,6 +163,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4812;4244"
@@ -221,6 +224,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
DisableSpecificWarnings="4812"
@@ -278,6 +282,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
DisableSpecificWarnings="4812"
@@ -354,6 +359,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
DebugInformationFormat="3"
@@ -427,6 +433,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
DisableSpecificWarnings="4812"
@@ -500,6 +507,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto;..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
DisableSpecificWarnings="4812"
diff --git a/src/filters/parser/mp4splitter/MP4SplitterFile.cpp b/src/filters/parser/mp4splitter/MP4SplitterFile.cpp index 4b90e78cc..c51d477b1 100644 --- a/src/filters/parser/mp4splitter/MP4SplitterFile.cpp +++ b/src/filters/parser/mp4splitter/MP4SplitterFile.cpp @@ -28,9 +28,9 @@ HRESULT CMP4SplitterFile::Init() delete (AP4_File*)m_pAp4File;
- AP4_ByteStream* stream = new AP4_AsyncReaderStream(this);
+ AP4_ByteStream* stream = DNew AP4_AsyncReaderStream(this);
- m_pAp4File = new AP4_File(*stream);
+ m_pAp4File = DNew AP4_File(*stream);
AP4_Movie* movie = ((AP4_File*)m_pAp4File)->GetMovie();
diff --git a/src/filters/parser/mp4splitter/stdafx.h b/src/filters/parser/mp4splitter/stdafx.h index 67593bb9b..42dcfd9f5 100644 --- a/src/filters/parser/mp4splitter/stdafx.h +++ b/src/filters/parser/mp4splitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.cpp b/src/filters/parser/mpasplitter/MpaSplitter.cpp index d039550bf..45b7a04fc 100644 --- a/src/filters/parser/mpasplitter/MpaSplitter.cpp +++ b/src/filters/parser/mpasplitter/MpaSplitter.cpp @@ -99,14 +99,14 @@ HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new CMpaSplitterFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CMpaSplitterFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
CAtlArray<CMediaType> mts;
mts.Add(m_pFile->GetMediaType());
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
AddOutputPin(0, pPinOut);
m_rtNewStart = m_rtCurrent = 0;
@@ -171,7 +171,7 @@ bool CMpaSplitterFilter::DemuxLoop() {
if(!m_pFile->Sync(FrameSize, rtDuration)) {Sleep(1); continue;}
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->SetCount(FrameSize);
m_pFile->ByteRead(p->GetData(), FrameSize);
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.vcproj b/src/filters/parser/mpasplitter/MpaSplitter.vcproj index 04b8e0c0a..2d42b7a9f 100644 --- a/src/filters/parser/mpasplitter/MpaSplitter.vcproj +++ b/src/filters/parser/mpasplitter/MpaSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MpaSplitter"
ProjectGUID="{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}"
RootNamespace="MpaSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/mpasplitter/stdafx.h b/src/filters/parser/mpasplitter/stdafx.h index bf33c5dd2..c06b53b78 100644 --- a/src/filters/parser/mpasplitter/stdafx.h +++ b/src/filters/parser/mpasplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -48,6 +49,5 @@ #include "..\..\..\DSUtil\MediaTypes.h"
#include "..\..\..\DSUtil\vd.h"
-#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.cpp b/src/filters/parser/mpegsplitter/MpegSplitter.cpp index aefd53b94..eb9900cdf 100644 --- a/src/filters/parser/mpegsplitter/MpegSplitter.cpp +++ b/src/filters/parser/mpegsplitter/MpegSplitter.cpp @@ -184,7 +184,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) if(GetOutputPin(TrackNumber))
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
p->bSyncPoint = !!h.fpts;
p->bAppendable = !h.fpts;
@@ -226,7 +226,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) if(GetOutputPin(TrackNumber))
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
p->bSyncPoint = !!h2.fpts;
p->bAppendable = !h2.fpts;
@@ -254,7 +254,7 @@ HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset) if(GetOutputPin(TrackNumber))
{
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = TrackNumber;
p->bSyncPoint = !!h.fpts;
p->bAppendable = !h.fpts;
@@ -281,7 +281,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo));
+ m_pFile.Attach(DNew CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -314,7 +314,7 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
HRESULT hr;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CMpegSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, name, this, this, &hr));
if (i == CMpegSplitterFile::subpic)
((CMpegSplitterOutputPin*)pPinOut.m_p)->SetMaxShift (_I64_MAX);
if(S_OK == AddOutputPin(s, pPinOut))
@@ -565,11 +565,11 @@ CString FormatString(const wchar_t *pszFormat, ... ) return Temp;
}
-int GetMediaTypeQuality(const CMediaType *_pMediaType, int _PresentationFormat)
+LONGLONG GetMediaTypeQuality(const CMediaType *_pMediaType, int _PresentationFormat)
{
if (_pMediaType->formattype == FORMAT_WaveFormatEx)
{
- int Ret = 0;
+ __int64 Ret = 0;
const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
int TypePriority = 0;
@@ -635,11 +635,12 @@ int GetMediaTypeQuality(const CMediaType *_pMediaType, int _PresentationFormat) }
}
- Ret += TypePriority * 100000000;
+ Ret += __int64(TypePriority) * 100000000i64 * 1000000000i64;
- Ret += pInfo->nChannels * 1000000;
- Ret += pInfo->nSamplesPerSec * 10;
- Ret += pInfo->wBitsPerSample / 4;
+ Ret += __int64(pInfo->nChannels) * 1000000i64 * 1000000000i64;
+ Ret += __int64(pInfo->nSamplesPerSec) * 10i64 * 1000000000i64;
+ Ret += __int64(pInfo->wBitsPerSample) * 10000000i64;
+ Ret += __int64(pInfo->nAvgBytesPerSec);
return Ret;
}
@@ -666,8 +667,8 @@ bool CMpegSplitterFile::stream::operator < (const stream &_Other) const if (mt.formattype != FORMAT_WaveFormatEx && _Other.mt.formattype == FORMAT_WaveFormatEx)
return false;
- int Quality0 = GetMediaTypeQuality(&mt, StreamType0);
- int Quality1 = GetMediaTypeQuality(&_Other.mt, StreamType1);
+ LONGLONG Quality0 = GetMediaTypeQuality(&mt, StreamType0);
+ LONGLONG Quality1 = GetMediaTypeQuality(&_Other.mt, StreamType1);
if (Quality0 > Quality1)
return true;
if (Quality0 < Quality1)
@@ -1225,7 +1226,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) break;
}
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = m_p->TrackNumber;
p->bDiscontinuity |= m_p->bDiscontinuity; m_p->bDiscontinuity = false;
p->bSyncPoint = m_p->rtStart != Packet::INVALID_TIME;
@@ -1255,7 +1256,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) {
if(!m_p)
{
- m_p.Attach(new Packet());
+ m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity; p->bDiscontinuity = FALSE;
m_p->bSyncPoint = p->bSyncPoint; p->bSyncPoint = FALSE;
@@ -1293,7 +1294,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) ((Nalu.GetDataLength() << 8) & 0x00ff0000) |
((Nalu.GetDataLength() << 24) & 0xff000000);
- CAutoPtr<Packet> p3(new Packet());
+ CAutoPtr<Packet> p3(DNew Packet());
//p2->SetData(start, next - start);
p3->SetCount (Nalu.GetDataLength()+sizeof(dwNalLength));
@@ -1358,7 +1359,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) {
if(!m_p)
{
- m_p.Attach(new Packet());
+ m_p.Attach(DNew Packet());
m_p->TrackNumber = p->TrackNumber;
m_p->bDiscontinuity = p->bDiscontinuity; p->bDiscontinuity = FALSE;
m_p->bSyncPoint = p->bSyncPoint; p->bSyncPoint = FALSE;
@@ -1405,7 +1406,7 @@ HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) int size = next - start - 4;
- CAutoPtr<Packet> p2(new Packet());
+ CAutoPtr<Packet> p2(DNew Packet());
p2->TrackNumber = m_p->TrackNumber;
p2->bDiscontinuity = m_p->bDiscontinuity; m_p->bDiscontinuity = FALSE;
p2->bSyncPoint = m_p->bSyncPoint; m_p->bSyncPoint = FALSE;
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.vcproj b/src/filters/parser/mpegsplitter/MpegSplitter.vcproj index 565c8204a..877a29077 100644 --- a/src/filters/parser/mpegsplitter/MpegSplitter.vcproj +++ b/src/filters/parser/mpegsplitter/MpegSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MpegSplitter"
ProjectGUID="{4628C665-EDE4-40D2-B525-32BE8B8551C8}"
RootNamespace="MpegSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/mpegsplitter/stdafx.h b/src/filters/parser/mpegsplitter/stdafx.h index 9f40ebc2f..c1030c834 100644 --- a/src/filters/parser/mpegsplitter/stdafx.h +++ b/src/filters/parser/mpegsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -48,6 +49,5 @@ #include "..\..\..\DSUtil\MediaTypes.h"
#include "..\..\..\DSUtil\vd.h"
-#pragma warning(disable: 4355) // 'this' : used in base member initializer list
#define EVO_SUPPORT 0
\ No newline at end of file diff --git a/src/filters/parser/nutsplitter/NutFile.cpp b/src/filters/parser/nutsplitter/NutFile.cpp index 2b86a1501..f53c4de49 100644 --- a/src/filters/parser/nutsplitter/NutFile.cpp +++ b/src/filters/parser/nutsplitter/NutFile.cpp @@ -39,7 +39,7 @@ HRESULT CNutFile::Init() }
else if(id == NUTS)
{
- CAutoPtr<stream_header> sh(new stream_header());
+ CAutoPtr<stream_header> sh(DNew stream_header());
Read(*sh);
if(sh->stream_class == SC_VIDEO) Read(sh->vsh);
else if(sh->stream_class == SC_AUDIO) Read(sh->ash);
@@ -130,7 +130,7 @@ void CNutFile::Read(stream_header& sh) sh.reserved = BitRead(6);
while(1)
{
- CAutoPtr<codec_specific> p(new codec_specific());
+ CAutoPtr<codec_specific> p(DNew codec_specific());
Read(p->type);
if(p->type == 0) break;
Read(p->data);
diff --git a/src/filters/parser/nutsplitter/NutSplitter.cpp b/src/filters/parser/nutsplitter/NutSplitter.cpp index ac6567d5b..c2fb58670 100644 --- a/src/filters/parser/nutsplitter/NutSplitter.cpp +++ b/src/filters/parser/nutsplitter/NutSplitter.cpp @@ -89,7 +89,7 @@ HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new CNutFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CNutFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -152,7 +152,7 @@ HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) if(mts.GetCount() > 0)
{
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
AddOutputPin((DWORD)sh->stream_id, pPinOut);
}
}
@@ -242,7 +242,7 @@ bool CNutSplitterFilter::DemuxLoop() TRACE(_T("[%I64d]: %I64d:%I64d\n"), stream_id, sh->msb_timestamp, lsb_timestamp);
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = (DWORD)stream_id;
p->bSyncPoint = fKeyFrame;
p->rtStart = 10000i64 * ((sh->msb_timestamp << sh->msb_timestamp_shift) + lsb_timestamp)
diff --git a/src/filters/parser/nutsplitter/NutSplitter.vcproj b/src/filters/parser/nutsplitter/NutSplitter.vcproj index 111f4fefd..582e6a523 100644 --- a/src/filters/parser/nutsplitter/NutSplitter.vcproj +++ b/src/filters/parser/nutsplitter/NutSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="NutSplitter"
ProjectGUID="{E776D3C2-5BFA-41B9-B998-A35B549AF737}"
RootNamespace="NutSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/nutsplitter/stdafx.h b/src/filters/parser/nutsplitter/stdafx.h index a4dc73d2b..83d054334 100644 --- a/src/filters/parser/nutsplitter/stdafx.h +++ b/src/filters/parser/nutsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -48,4 +49,3 @@ #include "..\..\..\DSUtil\MediaTypes.h"
#include "..\..\..\DSUtil\vd.h"
-#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/oggsplitter/OggSplitter.cpp b/src/filters/parser/oggsplitter/OggSplitter.cpp index d80946fee..a6b1a9c1b 100644 --- a/src/filters/parser/oggsplitter/OggSplitter.cpp +++ b/src/filters/parser/oggsplitter/OggSplitter.cpp @@ -152,7 +152,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new COggFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew COggFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -182,7 +182,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) {
name.Format(L"Theora %d", i);
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- pPinOut.Attach(new COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
+ pPinOut.Attach(DNew COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
nWaitForMore++;
}
@@ -194,28 +194,28 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) if(!memcmp(p, "vorbis", 6))
{
name.Format(L"Vorbis %d", i);
- pPinOut.Attach(new COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
+ pPinOut.Attach(DNew COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
nWaitForMore++;
}
else if(!memcmp(p, "video", 5))
{
name.Format(L"Video %d", i);
- pPinOut.Attach(new COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ pPinOut.Attach(DNew COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
}
else if(!memcmp(p, "audio", 5))
{
name.Format(L"Audio %d", i);
- pPinOut.Attach(new COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ pPinOut.Attach(DNew COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
}
else if(!memcmp(p, "text", 4))
{
name.Format(L"Text %d", i);
- pPinOut.Attach(new COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ pPinOut.Attach(DNew COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
}
else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35))
{
name.Format(L"DirectShow %d", i);
- pPinOut.Attach(new COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
+ pPinOut.Attach(DNew COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
}
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
@@ -233,7 +233,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) // Ogg Flac : method 1
CAutoPtr<CBaseSplitterOutputPin> pPinOut;
name.Format(L"Flac %d", i);
- pPinOut.Attach(new COggFlacOutputPin(p+12, page.GetCount()-14, name, this, this, &hr));
+ pPinOut.Attach(DNew COggFlacOutputPin(p+12, page.GetCount()-14, name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
}
else if (*(long*)(p-1) == 0x43614C66)
@@ -245,7 +245,7 @@ HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) CAutoPtr<CBaseSplitterOutputPin> pPinOut;
name.Format(L"Flac %d", i);
p = page.GetData();
- pPinOut.Attach(new COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
+ pPinOut.Attach(DNew COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
}
}
@@ -594,7 +594,7 @@ void COggSplitterOutputPin::AddComment(BYTE* p, int len) Explode(str, sl, '=', 2);
if(sl.GetCount() == 2)
{
- CAutoPtr<CComment> p(new CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
+ CAutoPtr<CComment> p(DNew CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
if(p->m_key == L"LANGUAGE")
{
@@ -694,7 +694,7 @@ HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page) }
else
{
- CAutoPtr<OggPacket> p(new OggPacket());
+ CAutoPtr<OggPacket> p(DNew OggPacket());
if(last == pos && page.m_hdr.granule_position != -1)
{
@@ -901,7 +901,7 @@ HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_ while(pos)
{
Packet* pi = m_initpackets.GetNext(pos);
- CAutoPtr<OggPacket> p(new OggPacket());
+ CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
p->rtStart = p->rtStop = 0;
@@ -1002,7 +1002,7 @@ HRESULT COggFlacOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TI while(pos)
{
Packet* pi = m_initpackets.GetNext(pos);
- CAutoPtr<OggPacket> p(new OggPacket());
+ CAutoPtr<OggPacket> p(DNew OggPacket());
p->TrackNumber = pi->TrackNumber;
p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
p->rtStart = p->rtStop = 0;
@@ -1224,7 +1224,7 @@ COggTheoraOutputPin::COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pF vih->hdr.dwPictAspectRatioX = (p[14]<<16)|(p[15]<<8)|p[16];
vih->hdr.dwPictAspectRatioY = (p[17]<<16)|(p[18]<<8)|p[19];
- m_KfgShift = ((p[40]<<8+p[41]) &0x3E0) >> 5;
+ m_KfgShift = (((p[40]<<8)+p[41]) &0x3E0) >> 5;
m_nIndexOffset = TH_VERSION_CHECK(p[7],p[8],p[9],3,2,1);
if (m_KfgShift == 0) m_KfgShift = 6; // Is it really default value ?
diff --git a/src/filters/parser/oggsplitter/OggSplitter.vcproj b/src/filters/parser/oggsplitter/OggSplitter.vcproj index 960291203..2eb249d02 100644 --- a/src/filters/parser/oggsplitter/OggSplitter.vcproj +++ b/src/filters/parser/oggsplitter/OggSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="OggSplitter"
ProjectGUID="{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}"
RootNamespace="OggSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/oggsplitter/stdafx.h b/src/filters/parser/oggsplitter/stdafx.h index d3b034114..a4637ab33 100644 --- a/src/filters/parser/oggsplitter/stdafx.h +++ b/src/filters/parser/oggsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp b/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp index 460c9ba04..dde5fd6b7 100644 --- a/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp +++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp @@ -202,7 +202,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) m_pFile.Free();
- m_pFile.Attach(new CRMFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CRMFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -450,7 +450,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut)))
{
if(!m_rtStop)
@@ -476,7 +476,7 @@ HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
AddOutputPin((DWORD)~stream, pPinOut);
}
@@ -527,7 +527,7 @@ bool CRealMediaSplitterFilter::DemuxInit() if(mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart)
{
- CAutoPtr<IndexRecord> pir(new IndexRecord());
+ CAutoPtr<IndexRecord> pir(DNew IndexRecord);
pir->tStart = mph.tStart;
pir->ptrFilePos = (UINT32)filepos;
pir->packet = nPacket;
@@ -657,7 +657,7 @@ bool CRealMediaSplitterFilter::DemuxLoop() {
CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
- CAutoPtr<Packet> p(new Packet);
+ CAutoPtr<Packet> p(DNew Packet);
p->TrackNumber = ~stream;
p->bSyncPoint = TRUE;
@@ -693,7 +693,7 @@ bool CRealMediaSplitterFilter::DemuxLoop() if(S_OK != (hr = m_pFile->Read(mph)))
break;
- CAutoPtr<Packet> p(new Packet);
+ CAutoPtr<Packet> p(DNew Packet);
p->TrackNumber = mph.stream;
p->bSyncPoint = !!(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG);
p->rtStart = 10000i64*(mph.tStart);
@@ -768,7 +768,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverSegments() return S_OK;
}
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = -1;
p->bDiscontinuity = m_segments.fDiscontinuity;
@@ -896,7 +896,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) int len2 = min(len - (pIn - pInOrg), packetlen - packetoffset);
- CAutoPtr<segment> s(new segment);
+ CAutoPtr<segment> s(DNew segment);
s->offset = packetoffset;
s->data.SetCount(len2);
memcpy(s->data.GetData(), pIn, len2);
@@ -944,7 +944,7 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) {
WORD size = sizes.GetNext(pos);
- CAutoPtr<Packet> p(new Packet);
+ CAutoPtr<Packet> p(DNew Packet);
p->bDiscontinuity = bDiscontinuity;
p->bSyncPoint = true;
p->rtStart = rtStart;
@@ -1108,7 +1108,7 @@ HRESULT CRMFile::Init() break;
case 'MDPR':
{
- CAutoPtr<MediaProperies> mp(new MediaProperies);
+ CAutoPtr<MediaProperies> mp(DNew MediaProperies);
if(S_OK != (hr = Read(mp->stream))) return hr;
if(S_OK != (hr = Read(mp->maxBitRate))) return hr;
if(S_OK != (hr = Read(mp->avgBitRate))) return hr;
@@ -1133,7 +1133,7 @@ HRESULT CRMFile::Init() }
case 'DATA':
{
- CAutoPtr<DataChunk> dc(new DataChunk);
+ CAutoPtr<DataChunk> dc(DNew DataChunk);
if(S_OK != (hr = Read(dc->nPackets))) return hr;
if(S_OK != (hr = Read(dc->ptrNext))) return hr;
dc->pos = GetPos();
@@ -1154,7 +1154,7 @@ HRESULT CRMFile::Init() if(S_OK != (hr = Read(object_version))) return hr;
if(object_version == 0)
{
- CAutoPtr<IndexRecord> ir(new IndexRecord);
+ CAutoPtr<IndexRecord> ir(DNew IndexRecord);
if(S_OK != (hr = Read(ir->tStart))) return hr;
if(S_OK != (hr = Read(ir->ptrFilePos))) return hr;
if(S_OK != (hr = Read(ir->packet))) return hr;
@@ -1483,7 +1483,7 @@ HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt) if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002)
{
int nWidthHeight = (1+((rvi.type1>>16)&7));
- UINT32* pWH = new UINT32[nWidthHeight*2];
+ UINT32* pWH = DNew UINT32[nWidthHeight*2];
pWH[0] = rvi.w; pWH[1] = rvi.h;
for(int i = 2; i < nWidthHeight*2; i++)
pWH[i] = rvi.morewh[i-2]*4;
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj b/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj index a9d431833..34a14bc53 100644 --- a/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj +++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="RealMediaSplitter"
ProjectGUID="{53CF9195-19DB-457D-8F55-8DB1706DFA84}"
RootNamespace="RealMediaSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -104,6 +105,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -163,6 +165,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -225,6 +228,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/realmediasplitter/stdafx.h b/src/filters/parser/realmediasplitter/stdafx.h index dd0d28f25..5a2d7facf 100644 --- a/src/filters/parser/realmediasplitter/stdafx.h +++ b/src/filters/parser/realmediasplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.cpp b/src/filters/parser/roqsplitter/RoQSplitter.cpp index 00834c219..1eb6cb557 100644 --- a/src/filters/parser/roqsplitter/RoQSplitter.cpp +++ b/src/filters/parser/roqsplitter/RoQSplitter.cpp @@ -183,7 +183,7 @@ HRESULT CRoQSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
AddOutputPin(0, pPinOut);
}
@@ -218,7 +218,7 @@ HRESULT CRoQSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) mt.lSampleSize = 1;
mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
AddOutputPin(1, pPinOut);
}
@@ -275,7 +275,7 @@ bool CRoQSplitterFilter::DemuxLoop() {
pos += sizeof(rc);
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
{
@@ -823,10 +823,10 @@ HRESULT CRoQVideoDecoder::StartStreaming() int size = bih.biWidth*bih.biHeight;
- m_y[0] = new BYTE[size*3/2];
+ m_y[0] = DNew BYTE[size*3/2];
m_u[0] = m_y[0] + size;
m_v[0] = m_y[0] + size*5/4;
- m_y[1] = new BYTE[size*3/2];
+ m_y[1] = DNew BYTE[size*3/2];
m_u[1] = m_y[1] + size;
m_v[1] = m_y[1] + size*5/4;
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.vcproj b/src/filters/parser/roqsplitter/RoQSplitter.vcproj index afe2b2cb4..ae99a56df 100644 --- a/src/filters/parser/roqsplitter/RoQSplitter.vcproj +++ b/src/filters/parser/roqsplitter/RoQSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="RoQSplitter"
ProjectGUID="{23E1898F-8262-435C-8848-D4D8824E6D71}"
RootNamespace="RoQSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/roqsplitter/stdafx.h b/src/filters/parser/roqsplitter/stdafx.h index a4dc73d2b..83d054334 100644 --- a/src/filters/parser/roqsplitter/stdafx.h +++ b/src/filters/parser/roqsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -48,4 +49,3 @@ #include "..\..\..\DSUtil\MediaTypes.h"
#include "..\..\..\DSUtil\vd.h"
-#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/ssfsplitter/SSFSplitter.cpp b/src/filters/parser/ssfsplitter/SSFSplitter.cpp index 47e8a723a..6b86081c0 100644 --- a/src/filters/parser/ssfsplitter/SSFSplitter.cpp +++ b/src/filters/parser/ssfsplitter/SSFSplitter.cpp @@ -119,7 +119,7 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) HRESULT hr = E_FAIL;
m_pFile.Free();
- m_pFile.Attach(new CBaseSplitterFile(pAsyncReader, hr));
+ m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
if(FAILED(hr)) {m_pFile.Free(); return hr;}
@@ -182,7 +182,7 @@ HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) memcpy(&p[3], (LPCSTR)hdr, hdr.GetLength());
mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Output", this, this, &hr));
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Output", this, this, &hr));
EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
CAtlArray<SegmentItemEx> subs;
@@ -232,7 +232,7 @@ bool CSSFSplitterFilter::DemuxLoop() si.pDef->Dump(s);
CStringA& str = UTF16To8(s.GetString());
- CAutoPtr<Packet> p(new Packet());
+ CAutoPtr<Packet> p(DNew Packet());
p->TrackNumber = 0;
p->bSyncPoint = TRUE; // TODO
diff --git a/src/filters/parser/ssfsplitter/SSFSplitter.vcproj b/src/filters/parser/ssfsplitter/SSFSplitter.vcproj index e78957245..338c1349c 100644 --- a/src/filters/parser/ssfsplitter/SSFSplitter.vcproj +++ b/src/filters/parser/ssfsplitter/SSFSplitter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="SSFSplitter"
ProjectGUID="{CC07B80F-D44F-41A9-9E37-5F2B47B46EDC}"
RootNamespace="SSFSplitter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
diff --git a/src/filters/parser/ssfsplitter/stdafx.h b/src/filters/parser/ssfsplitter/stdafx.h index d6da4d086..02875c68a 100644 --- a/src/filters/parser/ssfsplitter/stdafx.h +++ b/src/filters/parser/ssfsplitter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -46,4 +47,3 @@ #include <atlcoll.h>
#include "..\..\..\DSUtil\DSUtil.h"
-#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/streamdrivethru/StreamDriveThru.cpp b/src/filters/parser/streamdrivethru/StreamDriveThru.cpp index d5031b1f2..ce100f2e9 100644 --- a/src/filters/parser/streamdrivethru/StreamDriveThru.cpp +++ b/src/filters/parser/streamdrivethru/StreamDriveThru.cpp @@ -79,8 +79,8 @@ CStreamDriveThruFilter::CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr) {
if(phr) *phr = S_OK;
- m_pInput = new CStreamDriveThruInputPin(NAME("CStreamDriveThruInputPin"), this, &m_csLock, phr);
- m_pOutput = new CStreamDriveThruOutputPin(NAME("CStreamDriveThruOutputPin"), this, &m_csLock, phr);
+ m_pInput = DNew CStreamDriveThruInputPin(NAME("CStreamDriveThruInputPin"), this, &m_csLock, phr);
+ m_pOutput = DNew CStreamDriveThruOutputPin(NAME("CStreamDriveThruOutputPin"), this, &m_csLock, phr);
CAMThread::Create();
}
diff --git a/src/filters/parser/streamdrivethru/stdafx.h b/src/filters/parser/streamdrivethru/stdafx.h index 30c5835b5..15330b1ee 100644 --- a/src/filters/parser/streamdrivethru/stdafx.h +++ b/src/filters/parser/streamdrivethru/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru.vcproj b/src/filters/parser/streamdrivethru/streamdrivethru.vcproj index 8b4aaae4d..b9bec5985 100644 --- a/src/filters/parser/streamdrivethru/streamdrivethru.vcproj +++ b/src/filters/parser/streamdrivethru/streamdrivethru.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="streamdrivethru"
ProjectGUID="{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}"
RootNamespace="streamdrivethru"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
<Tool
diff --git a/src/filters/reader/asyncreader/asyncio.cpp b/src/filters/reader/asyncreader/asyncio.cpp index 9428dd052..3f6494a6f 100644 --- a/src/filters/reader/asyncreader/asyncio.cpp +++ b/src/filters/reader/asyncreader/asyncio.cpp @@ -161,7 +161,7 @@ CAsyncIo::Request( }
}
- CAsyncRequest* pRequest = new CAsyncRequest;
+ CAsyncRequest* pRequest = DNew CAsyncRequest;
HRESULT hr = pRequest->Request(
this,
diff --git a/src/filters/reader/asyncreader/asyncrdr.cpp b/src/filters/reader/asyncreader/asyncrdr.cpp index b41c55d7e..5e807f8cc 100644 --- a/src/filters/reader/asyncreader/asyncrdr.cpp +++ b/src/filters/reader/asyncreader/asyncrdr.cpp @@ -85,7 +85,7 @@ CAsyncOutputPin::InitAllocator(IMemAllocator **ppAlloc) CMemAllocator *pMemObject = NULL;
/* Create a default memory allocator */
- pMemObject = new CMemAllocator(NAME("Base memory allocator"),NULL, &hr);
+ pMemObject = DNew CMemAllocator(NAME("Base memory allocator"),NULL, &hr);
if (pMemObject == NULL) {
return E_OUTOFMEMORY;
}
diff --git a/src/filters/reader/asyncreader/asyncreader.vcproj b/src/filters/reader/asyncreader/asyncreader.vcproj index c4b478812..29b12559b 100644 --- a/src/filters/reader/asyncreader/asyncreader.vcproj +++ b/src/filters/reader/asyncreader/asyncreader.vcproj @@ -42,6 +42,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
<Tool
@@ -99,6 +100,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
/>
@@ -154,6 +156,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
/>
@@ -212,6 +215,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
<Tool
diff --git a/src/filters/reader/asyncreader/stdafx.h b/src/filters/reader/asyncreader/stdafx.h index 2f0ead283..ae8a67615 100644 --- a/src/filters/reader/asyncreader/stdafx.h +++ b/src/filters/reader/asyncreader/stdafx.h @@ -4,10 +4,11 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// TODO: reference additional headers your program requires here
-
+#include <afx.h>
#include <streams.h>
diff --git a/src/filters/reader/cddareader/stdafx.h b/src/filters/reader/cddareader/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/reader/cddareader/stdafx.h +++ b/src/filters/reader/cddareader/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/reader/cdxareader/stdafx.h b/src/filters/reader/cdxareader/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/reader/cdxareader/stdafx.h +++ b/src/filters/reader/cdxareader/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/reader/udpreader/UDPReader.cpp b/src/filters/reader/udpreader/UDPReader.cpp index b927df68d..996496165 100644 --- a/src/filters/reader/udpreader/UDPReader.cpp +++ b/src/filters/reader/udpreader/UDPReader.cpp @@ -172,7 +172,7 @@ void CUDPStream::Append(BYTE* buff, int len) if(m_drop) return;
}
- m_packets.AddTail(new packet_t(buff, m_len, m_len + len));
+ m_packets.AddTail(DNew packet_t(buff, m_len, m_len + len));
m_len += len;
}
@@ -442,6 +442,6 @@ CUDPStream::packet_t::packet_t(BYTE* p, __int64 start, __int64 end) , m_end(end)
{
int size = end - start;
- m_buff = new BYTE[size];
+ m_buff = DNew BYTE[size];
memcpy(m_buff, p, size);
}
diff --git a/src/filters/reader/udpreader/stdafx.h b/src/filters/reader/udpreader/stdafx.h index 4f7b860b0..47fb81eda 100644 --- a/src/filters/reader/udpreader/stdafx.h +++ b/src/filters/reader/udpreader/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/reader/vtsreader/VTSReader.cpp b/src/filters/reader/vtsreader/VTSReader.cpp index 2be16e51b..a2c6935c7 100644 --- a/src/filters/reader/vtsreader/VTSReader.cpp +++ b/src/filters/reader/vtsreader/VTSReader.cpp @@ -139,7 +139,7 @@ STDMETHODIMP CVTSReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt) CVTSStream::CVTSStream() : m_off(0)
{
- m_vob.Attach(new CVobFile());
+ m_vob.Attach(DNew CVobFile());
}
CVTSStream::~CVTSStream()
diff --git a/src/filters/reader/vtsreader/stdafx.h b/src/filters/reader/vtsreader/stdafx.h index b971954ab..fccd33b00 100644 --- a/src/filters/reader/vtsreader/stdafx.h +++ b/src/filters/reader/vtsreader/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/basesource/BaseSource.h b/src/filters/source/basesource/BaseSource.h index 2d8ddbe51..15a550a2d 100644 --- a/src/filters/source/basesource/BaseSource.h +++ b/src/filters/source/basesource/BaseSource.h @@ -59,7 +59,7 @@ public: return VFW_E_ALREADY_CONNECTED;
HRESULT hr = S_OK;
- if(!(new TStream(pszFileName, this, &hr)))
+ if(!(DNew TStream(pszFileName, this, &hr)))
return E_OUTOFMEMORY;
if(FAILED(hr))
diff --git a/src/filters/source/basesource/basesource.vcproj b/src/filters/source/basesource/basesource.vcproj index ba1fba31f..f966e9fa3 100644 --- a/src/filters/source/basesource/basesource.vcproj +++ b/src/filters/source/basesource/basesource.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
<Tool
diff --git a/src/filters/source/basesource/stdafx.h b/src/filters/source/basesource/stdafx.h index dd0d28f25..3c154d6ee 100644 --- a/src/filters/source/basesource/stdafx.h +++ b/src/filters/source/basesource/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -41,3 +42,4 @@ #include <dshow.h>
#include <streams.h>
#include <dvdmedia.h>
+
diff --git a/src/filters/source/d2vsource/D2VSource.cpp b/src/filters/source/d2vsource/D2VSource.cpp index 0eb75cc0e..9b8ea6b66 100644 --- a/src/filters/source/d2vsource/D2VSource.cpp +++ b/src/filters/source/d2vsource/D2VSource.cpp @@ -101,7 +101,7 @@ CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr) {
CAutoLock cAutoLock(&m_cSharedState);
- m_pDecoder.Attach(new CMPEG2Dec());
+ m_pDecoder.Attach(DNew CMPEG2Dec());
if(!m_pDecoder)
{
if(phr) *phr = E_OUTOFMEMORY;
diff --git a/src/filters/source/d2vsource/MPEG2Dec.cpp b/src/filters/source/d2vsource/MPEG2Dec.cpp index 611f57320..4be664c00 100644 --- a/src/filters/source/d2vsource/MPEG2Dec.cpp +++ b/src/filters/source/d2vsource/MPEG2Dec.cpp @@ -38,7 +38,8 @@ TEST_END: }
}
-
+#pragma warning(disable:4799) // no EMMS
+#pragma warning(disable:4731) // ebp modified
// idct
extern "C" void __fastcall MMX_IDCT(short *block);
extern "C" void __fastcall SSEMMX_IDCT(short *block);
@@ -3780,7 +3781,7 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) BufferOp = (PBufferOp) GetProcAddress(hLibrary, "BufferOp");
for (i=0; i<MAX_FILE_NUMBER; i++)
- Infilename[i] = new char[_MAX_PATH];
+ Infilename[i] = DNew char[_MAX_PATH];
if(1 != fscanf(out->VF_File, "%d", &File_Limit))
return 0;
@@ -3848,11 +3849,11 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) for (i=0; i<8; i++)
{
- p_block[i] = (short *)new BYTE[sizeof(short)*64 + 64];
+ p_block[i] = (short *)DNew BYTE[sizeof(short)*64 + 64];
block[i] = (short *)((long)p_block[i] + 64 - (long)p_block[i]%64);
}
- p_fTempArray = (void *)new BYTE[sizeof(float)*128 + 64];
+ p_fTempArray = (void *)DNew BYTE[sizeof(float)*128 + 64];
fTempArray = (void *)((long)p_fTempArray + 64 - (long)p_fTempArray%64);
for (i=0; i<3; i++)
@@ -3862,9 +3863,9 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) else
size = Chroma_Width * Chroma_Height;
- backward_reference_frame[i] = new unsigned char[size];
- forward_reference_frame[i] = new unsigned char[size];
- auxframe[i] = new unsigned char[size];
+ backward_reference_frame[i] = DNew unsigned char[size];
+ forward_reference_frame[i] = DNew unsigned char[size];
+ auxframe[i] = DNew unsigned char[size];
}
if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "YUVRGB_Scale=%d\n", &i))
@@ -3903,7 +3904,7 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) LumGainMask = ((__int64)i<<48) + ((__int64)i<<32) + ((__int64)i<<16) + (__int64)i;
LumOffsetMask = ((__int64)j<<48) + ((__int64)j<<32) + ((__int64)j<<16) + (__int64)j;
- lum = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ lum = DNew unsigned char[Coded_Picture_Width * Coded_Picture_Height];
}
if(6 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Picture_Size=%d,%d,%d,%d,%d,%d\n",
@@ -3943,11 +3944,11 @@ int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat) HALF_WIDTH_D8 = (Coded_Picture_Width>>1) - 8;
DOUBLE_WIDTH = Coded_Picture_Width<<1;
- u422 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
- v422 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
- u444 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
- v444 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
- dstFrame = new unsigned char[Clip_Width * Clip_Height * 4]; // max value (super set)
+ u422 = DNew unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
+ v422 = DNew unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
+ u444 = DNew unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ v444 = DNew unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ dstFrame = DNew unsigned char[Clip_Width * Clip_Height * 4]; // max value (super set)
if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Field_Operation=%d\n", &FO_Flag))
return 0;
diff --git a/src/filters/source/d2vsource/d2vsource.vcproj b/src/filters/source/d2vsource/d2vsource.vcproj index 522e8de69..1c9f8e4a5 100644 --- a/src/filters/source/d2vsource/d2vsource.vcproj +++ b/src/filters/source/d2vsource/d2vsource.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="d2vsource"
ProjectGUID="{83CC6B88-A112-4192-BD5A-F2A249AF2277}"
RootNamespace="d2vsource"
@@ -324,6 +324,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
<Tool
@@ -382,6 +383,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
/>
@@ -438,6 +440,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244;4799;4731;"
/>
@@ -497,6 +500,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
<Tool
diff --git a/src/filters/source/d2vsource/stdafx.h b/src/filters/source/d2vsource/stdafx.h index f75685894..5936de250 100644 --- a/src/filters/source/d2vsource/stdafx.h +++ b/src/filters/source/d2vsource/stdafx.h @@ -4,6 +4,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/dtsac3source/DTSAC3Source.cpp b/src/filters/source/dtsac3source/DTSAC3Source.cpp index f46bcba7f..089200ee5 100644 --- a/src/filters/source/dtsac3source/DTSAC3Source.cpp +++ b/src/filters/source/dtsac3source/DTSAC3Source.cpp @@ -143,7 +143,7 @@ CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr) CString fn(wfn);
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyWrite))
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone))
{
if(phr) *phr = E_FAIL;
return;
diff --git a/src/filters/source/dtsac3source/dtsac3source.vcproj b/src/filters/source/dtsac3source/dtsac3source.vcproj index 334ba0dc7..f2a962872 100644 --- a/src/filters/source/dtsac3source/dtsac3source.vcproj +++ b/src/filters/source/dtsac3source/dtsac3source.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="dtsac3source"
ProjectGUID="{30D48874-899F-41C6-9B26-A40C96C91102}"
RootNamespace="dtsac3source"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -159,6 +161,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -219,6 +222,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/source/dtsac3source/stdafx.h b/src/filters/source/dtsac3source/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/source/dtsac3source/stdafx.h +++ b/src/filters/source/dtsac3source/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/flacsource/FlacSource.cpp b/src/filters/source/flacsource/FlacSource.cpp index f1334a732..a0c3890cf 100644 --- a/src/filters/source/flacsource/FlacSource.cpp +++ b/src/filters/source/flacsource/FlacSource.cpp @@ -90,9 +90,9 @@ CFilterApp theApp; // Declaration for Flac callbacks
static FLAC__StreamDecoderReadStatus StreamDecoderRead(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static FLAC__StreamDecoderSeekStatus StreamDecoderSeek(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
-static FLAC__StreamDecoderTellStatus StreamDecoderTell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); -static FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_data); +static FLAC__StreamDecoderTellStatus StreamDecoderTell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
+static FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
+static FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_data);
static FLAC__StreamDecoderWriteStatus StreamDecoderWrite(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void StreamDecoderError(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
static void StreamDecoderMetadata(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
@@ -124,7 +124,7 @@ CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr) do
{
- if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyWrite, &ex))
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex))
{
hr = AmHresultFromWin32 (ex.m_lOsError);
break;
@@ -146,13 +146,13 @@ CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr) {
break;
}
- - - if (!FLAC__stream_decoder_process_until_end_of_metadata (_DECODER_) || - !FLAC__stream_decoder_seek_absolute (_DECODER_, 0)) - break; - - FLAC__stream_decoder_get_decode_position(_DECODER_, &m_llOffset); +
+
+ if (!FLAC__stream_decoder_process_until_end_of_metadata (_DECODER_) ||
+ !FLAC__stream_decoder_seek_absolute (_DECODER_, 0))
+ break;
+
+ FLAC__stream_decoder_get_decode_position(_DECODER_, &m_llOffset);
hr = S_OK;
} while (false);
@@ -194,24 +194,24 @@ HRESULT CFlacStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, l FLAC__stream_decoder_seek_absolute (_DECODER_, m_rtPosition * m_i64TotalNumSamples / m_rtDuration);
}
- FLAC__stream_decoder_get_decode_position(_DECODER_, &llCurPos); - - FLAC__stream_decoder_skip_single_frame (_DECODER_); - if (m_bIsEOF) - return S_FALSE; - FLAC__stream_decoder_get_decode_position(_DECODER_, &llNextPos); - - FLAC__uint64 llCurFile = m_file.GetPosition(); - len = llNextPos - llCurPos; - ASSERT (len > 0); - if (len <= 0) return S_FALSE; - - m_file.Seek (llCurPos, CFile::begin); - m_file.Read (pOut, len); - m_file.Seek (llCurFile, CFile::begin); - - m_AvgTimePerFrame = m_rtDuration * len / (m_llFileSize-m_llOffset); - + FLAC__stream_decoder_get_decode_position(_DECODER_, &llCurPos);
+
+ FLAC__stream_decoder_skip_single_frame (_DECODER_);
+ if (m_bIsEOF)
+ return S_FALSE;
+ FLAC__stream_decoder_get_decode_position(_DECODER_, &llNextPos);
+
+ FLAC__uint64 llCurFile = m_file.GetPosition();
+ len = llNextPos - llCurPos;
+ ASSERT (len > 0);
+ if (len <= 0) return S_FALSE;
+
+ m_file.Seek (llCurPos, CFile::begin);
+ m_file.Read (pOut, len);
+ m_file.Seek (llCurFile, CFile::begin);
+
+ m_AvgTimePerFrame = m_rtDuration * len / (m_llFileSize-m_llOffset);
+
return S_OK;
}
@@ -297,26 +297,26 @@ FLAC__StreamDecoderSeekStatus StreamDecoderSeek(const FLAC__StreamDecoder *decod pThis->GetFile()->Seek (absolute_byte_offset, CFile::begin);
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}
- -FLAC__StreamDecoderTellStatus StreamDecoderTell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ +
+FLAC__StreamDecoderTellStatus StreamDecoderTell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
+{
CFlacStream* pThis = (CFlacStream*) client_data;
*absolute_byte_offset = pThis->GetFile()->GetPosition();
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
-} - -FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) -{ +}
+
+FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
+{
CFlacStream* pThis = (CFlacStream*) client_data;
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
-} - -FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_data) -{ +}
+
+FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_data)
+{
CFlacStream* pThis = (CFlacStream*) client_data;
return pThis->m_bIsEOF;
-} +}
FLAC__StreamDecoderWriteStatus StreamDecoderWrite(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
diff --git a/src/filters/source/flacsource/Flacsource.vcproj b/src/filters/source/flacsource/Flacsource.vcproj index 12bdf0feb..017a0f496 100644 --- a/src/filters/source/flacsource/Flacsource.vcproj +++ b/src/filters/source/flacsource/Flacsource.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="flacsource"
ProjectGUID="{916D0FC1-1D86-487A-82DE-37FBEE43FB34}"
RootNamespace="flacsource"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include; ..\..\transform\mpadecfilter\libflac\include"
PreprocessorDefinitions="WIN32;_DEBUG;FLAC__NO_DLL"
/>
@@ -104,6 +105,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include; ..\..\transform\mpadecfilter\libflac\include"
PreprocessorDefinitions="_WIN64;_DEBUG;FLAC__NO_DLL"
DebugInformationFormat="3"
@@ -163,6 +165,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include; ..\..\transform\mpadecfilter\libflac\include"
PreprocessorDefinitions="WIN32;NDEBUG;FLAC__NO_DLL"
DisableSpecificWarnings="4244"
@@ -225,6 +228,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include; ..\..\transform\mpadecfilter\libflac\include"
PreprocessorDefinitions="_WIN64;NDEBUG;FLAC__NO_DLL"
/>
diff --git a/src/filters/source/flacsource/stdafx.h b/src/filters/source/flacsource/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/source/flacsource/stdafx.h +++ b/src/filters/source/flacsource/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/flicsource/FLICSource.cpp b/src/filters/source/flicsource/FLICSource.cpp index 6814561eb..9cb7cf2e9 100644 --- a/src/filters/source/flicsource/FLICSource.cpp +++ b/src/filters/source/flicsource/FLICSource.cpp @@ -118,7 +118,7 @@ STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt) return VFW_E_ALREADY_CONNECTED;
HRESULT hr = S_OK;
- if(!(new CFLICStream(pszFileName, this, &hr)))
+ if(!(DNew CFLICStream(pszFileName, this, &hr)))
return E_OUTOFMEMORY;
if(FAILED(hr))
@@ -159,7 +159,7 @@ CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr) CString fn(wfn);
- if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyWrite))
+ if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyNone))
{
if(phr) *phr = E_FAIL;
return;
diff --git a/src/filters/source/flicsource/flicsource.vcproj b/src/filters/source/flicsource/flicsource.vcproj index b013da2dd..fe9d1b7a1 100644 --- a/src/filters/source/flicsource/flicsource.vcproj +++ b/src/filters/source/flicsource/flicsource.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="flicsource"
ProjectGUID="{431DD5B6-3F2F-47EE-A23F-514BC044B704}"
RootNamespace="flicsource"
@@ -324,6 +324,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
<Tool
@@ -382,6 +383,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
/>
@@ -438,6 +440,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
/>
@@ -497,6 +500,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
<Tool
diff --git a/src/filters/source/flicsource/stdafx.h b/src/filters/source/flicsource/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/source/flicsource/stdafx.h +++ b/src/filters/source/flicsource/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/shoutcastsource/ShoutcastSource.cpp b/src/filters/source/shoutcastsource/ShoutcastSource.cpp index 162d530d6..a2518dd29 100644 --- a/src/filters/source/shoutcastsource/ShoutcastSource.cpp +++ b/src/filters/source/shoutcastsource/ShoutcastSource.cpp @@ -177,7 +177,7 @@ STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* HRESULT hr = E_OUTOFMEMORY;
- if(!(new CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
+ if(!(DNew CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
return hr;
m_fn = pszFileName;
diff --git a/src/filters/source/shoutcastsource/ShoutcastSource.h b/src/filters/source/shoutcastsource/ShoutcastSource.h index c6b18880c..ab45dbf4f 100644 --- a/src/filters/source/shoutcastsource/ShoutcastSource.h +++ b/src/filters/source/shoutcastsource/ShoutcastSource.h @@ -84,7 +84,7 @@ class CShoutcastStream : public CSourceStream BYTE* pData;
REFERENCE_TIME rtStart, rtStop;
CString title;
- mp3frame(DWORD len = 0) {pData = (this->len = len) ? new BYTE[len] : NULL; rtStart = rtStop = 0;}
+ mp3frame(DWORD len = 0) {pData = (this->len = len) ? DNew BYTE[len] : NULL; rtStart = rtStop = 0;}
mp3frame(const mp3frame& f) {*this = f;}
~mp3frame() {delete pData;}
void operator = (const mp3frame& f)
diff --git a/src/filters/source/shoutcastsource/shoutcastsource.vcproj b/src/filters/source/shoutcastsource/shoutcastsource.vcproj index bc9f5423b..28f5a484a 100644 --- a/src/filters/source/shoutcastsource/shoutcastsource.vcproj +++ b/src/filters/source/shoutcastsource/shoutcastsource.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="shoutcastsource"
ProjectGUID="{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}"
RootNamespace="shoutcastsource"
@@ -328,6 +328,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -387,6 +388,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -444,6 +446,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -504,6 +507,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/source/shoutcastsource/stdafx.h b/src/filters/source/shoutcastsource/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/source/shoutcastsource/stdafx.h +++ b/src/filters/source/shoutcastsource/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/subtitlesource/SubtitleSource.cpp b/src/filters/source/subtitlesource/SubtitleSource.cpp index ae256519a..e0b11bf58 100644 --- a/src/filters/source/subtitlesource/SubtitleSource.cpp +++ b/src/filters/source/subtitlesource/SubtitleSource.cpp @@ -173,7 +173,7 @@ STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* p return VFW_E_ALREADY_CONNECTED;
HRESULT hr = S_OK;
- if(!(new CSubtitleStream(pszFileName, this, &hr)))
+ if(!(DNew CSubtitleStream(pszFileName, this, &hr)))
return E_OUTOFMEMORY;
if(FAILED(hr))
diff --git a/src/filters/source/subtitlesource/stdafx.h b/src/filters/source/subtitlesource/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/source/subtitlesource/stdafx.h +++ b/src/filters/source/subtitlesource/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/source/subtitlesource/subtitlesource.vcproj b/src/filters/source/subtitlesource/subtitlesource.vcproj index 9b4616cba..bec203600 100644 --- a/src/filters/source/subtitlesource/subtitlesource.vcproj +++ b/src/filters/source/subtitlesource/subtitlesource.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="subtitlesource"
ProjectGUID="{8F998497-9C51-4FAA-83E4-1D85B22CBA13}"
RootNamespace="subtitlesource"
@@ -328,6 +328,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -387,6 +388,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -444,6 +446,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -504,6 +507,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/stdafx.h b/src/filters/stdafx.h index dd0d28f25..6e3fd91ac 100644 --- a/src/filters/stdafx.h +++ b/src/filters/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/switcher/audioswitcher/Audio.cpp b/src/filters/switcher/audioswitcher/Audio.cpp index 878fb337d..2490b4e77 100644 --- a/src/filters/switcher/audioswitcher/Audio.cpp +++ b/src/filters/switcher/audioswitcher/Audio.cpp @@ -204,7 +204,7 @@ AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate filter_width = ((samp_frac + 0x7ffff)>>19)<<1 <<1;
- if(!(filter_bank = new long[filter_width * 256]))
+ if(!(filter_bank = DNew long[filter_width * 256]))
{
filter_width = 1;
return;
diff --git a/src/filters/switcher/audioswitcher/AudioSwitcher.cpp b/src/filters/switcher/audioswitcher/AudioSwitcher.cpp index d1431b4cb..8e26f2849 100644 --- a/src/filters/switcher/audioswitcher/AudioSwitcher.cpp +++ b/src/filters/switcher/audioswitcher/AudioSwitcher.cpp @@ -319,7 +319,7 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) && wfe->nSamplesPerSec > 44100 && wfeout->nSamplesPerSec == 44100
&& wfe->wBitsPerSample <= 16 && fPCM)
{
- if(BYTE* buff = new BYTE[len*bps])
+ if(BYTE* buff = DNew BYTE[len*bps])
{
for(int ch = 0; ch < wfeout->nChannels; ch++)
{
@@ -342,7 +342,7 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) {
int samples = lenout*wfeout->nChannels;
- if(double* buff = new double[samples])
+ if(double* buff = DNew double[samples])
{
for(int i = 0; i < samples; i++)
{
@@ -475,7 +475,7 @@ void CAudioSwitcherFilter::OnNewOutputMediaType(const CMediaType& mtIn, const CM for(int i = 0; i < wfeout->nChannels; i++)
{
CAutoPtr<AudioStreamResampler> pResampler;
- pResampler.Attach(new AudioStreamResampler(wfeout->wBitsPerSample>>3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
+ pResampler.Attach(DNew AudioStreamResampler(wfeout->wBitsPerSample>>3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
m_pResamplers.Add(pResampler);
}
diff --git a/src/filters/switcher/audioswitcher/StreamSwitcher.cpp b/src/filters/switcher/audioswitcher/StreamSwitcher.cpp index 7dfefe7ae..e42d122a1 100644 --- a/src/filters/switcher/audioswitcher/StreamSwitcher.cpp +++ b/src/filters/switcher/audioswitcher/StreamSwitcher.cpp @@ -492,7 +492,7 @@ HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin) if(!pinName.IsEmpty()) fileName += L" / " + pinName;
- WCHAR* pName = new WCHAR[fileName.GetLength()+1];
+ WCHAR* pName = DNew WCHAR[fileName.GetLength()+1];
if(pName)
{
wcscpy(pName, fileName);
@@ -830,7 +830,7 @@ STDMETHODIMP CStreamSwitcherOutputPin::NonDelegatingQueryInterface(REFIID riid, {
HRESULT hr = S_OK;
m_pStreamSwitcherPassThru = (IUnknown*)(INonDelegatingUnknown*)
- new CStreamSwitcherPassThru(GetOwner(), &hr, (CStreamSwitcherFilter*)m_pFilter);
+ DNew CStreamSwitcherPassThru(GetOwner(), &hr, (CStreamSwitcherFilter*)m_pFilter);
if(!m_pStreamSwitcherPassThru) return E_OUTOFMEMORY;
if(FAILED(hr)) return hr;
@@ -1019,11 +1019,11 @@ CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, cons CAutoPtr<CStreamSwitcherOutputPin> pOutput;
hr = S_OK;
- pInput.Attach(new CStreamSwitcherInputPin(this, &hr, L"Channel 1"));
+ pInput.Attach(DNew CStreamSwitcherInputPin(this, &hr, L"Channel 1"));
if(!pInput || FAILED(hr)) break;
hr = S_OK;
- pOutput.Attach(new CStreamSwitcherOutputPin(this, &hr));
+ pOutput.Attach(DNew CStreamSwitcherOutputPin(this, &hr));
if(!pOutput || FAILED(hr)) break;
CAutoLock cAutoLock(&m_csPins);
@@ -1142,7 +1142,7 @@ HRESULT CStreamSwitcherFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin name.Format(L"Channel %d", ++m_PinVersion);
HRESULT hr = S_OK;
- CStreamSwitcherInputPin* pPin = new CStreamSwitcherInputPin(this, &hr, name);
+ CStreamSwitcherInputPin* pPin = DNew CStreamSwitcherInputPin(this, &hr, name);
if(!pPin || FAILED(hr)) return E_FAIL;
m_pInputs.AddTail(pPin);
}
diff --git a/src/filters/switcher/audioswitcher/audioswitcher.vcproj b/src/filters/switcher/audioswitcher/audioswitcher.vcproj index 21a399fd5..3afc1f2b0 100644 --- a/src/filters/switcher/audioswitcher/audioswitcher.vcproj +++ b/src/filters/switcher/audioswitcher/audioswitcher.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
/>
@@ -117,6 +118,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
DebugInformationFormat="3"
@@ -188,6 +190,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
/>
@@ -262,6 +265,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
/>
@@ -332,6 +336,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -391,6 +396,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -448,6 +454,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -508,6 +515,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/switcher/audioswitcher/stdafx.h b/src/filters/switcher/audioswitcher/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/switcher/audioswitcher/stdafx.h +++ b/src/filters/switcher/audioswitcher/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj b/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj index 61bb2268e..d9606307e 100644 --- a/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj +++ b/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="avi2ac3filter"
ProjectGUID="{339A4575-E25B-45D6-94A1-D835891740B8}"
RootNamespace="avi2ac3filter"
@@ -328,6 +328,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -387,6 +388,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -444,6 +446,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -504,6 +507,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/transform/avi2ac3filter/stdafx.h b/src/filters/transform/avi2ac3filter/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/transform/avi2ac3filter/stdafx.h +++ b/src/filters/transform/avi2ac3filter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/transform/basevideofilter/BaseVideoFilter.cpp b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp index 12baf0137..718e5f0c1 100644 --- a/src/filters/transform/basevideofilter/BaseVideoFilter.cpp +++ b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp @@ -38,10 +38,10 @@ CBaseVideoFilter::CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, {
if(phr) *phr = S_OK;
- if(!(m_pInput = new CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pInput = DNew CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pOutput = new CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pOutput = DNew CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
m_wout = m_win = m_w = 0;
@@ -643,7 +643,7 @@ STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator) if(m_pAllocator == NULL)
{
HRESULT hr = S_OK;
- m_pAllocator = new CBaseVideoInputAllocator(&hr);
+ m_pAllocator = DNew CBaseVideoInputAllocator(&hr);
m_pAllocator->AddRef();
}
diff --git a/src/filters/transform/basevideofilter/basevideofilter.vcproj b/src/filters/transform/basevideofilter/basevideofilter.vcproj index 2a3afaac9..384966b82 100644 --- a/src/filters/transform/basevideofilter/basevideofilter.vcproj +++ b/src/filters/transform/basevideofilter/basevideofilter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="basevideofilter"
ProjectGUID="{54DDA60F-E528-4D07-A152-960A1E818680}"
RootNamespace="basevideofilter"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -160,6 +162,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -221,6 +224,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/transform/basevideofilter/stdafx.h b/src/filters/transform/basevideofilter/stdafx.h index 714c23efc..fd4805916 100644 --- a/src/filters/transform/basevideofilter/stdafx.h +++ b/src/filters/transform/basevideofilter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -41,3 +42,4 @@ #include <streams.h>
#include <dvdmedia.h>
#include <amvideo.h>
+
diff --git a/src/filters/transform/bufferfilter/BufferFilter.cpp b/src/filters/transform/bufferfilter/BufferFilter.cpp index 7ecf064ed..adbdcf0ab 100644 --- a/src/filters/transform/bufferfilter/BufferFilter.cpp +++ b/src/filters/transform/bufferfilter/BufferFilter.cpp @@ -81,10 +81,10 @@ CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr) do
{
- if(!(m_pInput = new CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
+ if(!(m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
if(FAILED(hr)) break;
- if(!(m_pOutput = new CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
+ if(!(m_pOutput = DNew CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
if(FAILED(hr)) {delete m_pInput, m_pInput = NULL; break;}
}
while(false);
@@ -299,7 +299,7 @@ HRESULT CBufferFilterOutputPin::Active() {
HRESULT hr = NOERROR;
- m_pOutputQueue.Attach(new CBufferFilterOutputQueue(m_Connected, &hr));
+ m_pOutputQueue.Attach(DNew CBufferFilterOutputQueue(m_Connected, &hr));
if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
if(FAILED(hr))
diff --git a/src/filters/transform/bufferfilter/bufferfilter.vcproj b/src/filters/transform/bufferfilter/bufferfilter.vcproj index 6c79a9206..1f2f0fae9 100644 --- a/src/filters/transform/bufferfilter/bufferfilter.vcproj +++ b/src/filters/transform/bufferfilter/bufferfilter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="bufferfilter"
ProjectGUID="{9DCFD02A-16A0-4766-BC18-66163E21929D}"
RootNamespace="bufferfilter"
@@ -324,6 +324,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
<Tool
@@ -382,6 +383,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
/>
@@ -438,6 +440,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
/>
@@ -497,6 +500,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
<Tool
diff --git a/src/filters/transform/bufferfilter/stdafx.h b/src/filters/transform/bufferfilter/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/transform/bufferfilter/stdafx.h +++ b/src/filters/transform/bufferfilter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/transform/decssfilter/DeCSSFilter.cpp b/src/filters/transform/decssfilter/DeCSSFilter.cpp index 902226048..6bcf7ca51 100644 --- a/src/filters/transform/decssfilter/DeCSSFilter.cpp +++ b/src/filters/transform/decssfilter/DeCSSFilter.cpp @@ -110,10 +110,10 @@ CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr) {
if(phr) *phr = S_OK;
- if(!(m_pInput = new CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pOutput = new CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
}
diff --git a/src/filters/transform/decssfilter/decssfilter.vcproj b/src/filters/transform/decssfilter/decssfilter.vcproj index 53255b8e7..fd202bc5b 100644 --- a/src/filters/transform/decssfilter/decssfilter.vcproj +++ b/src/filters/transform/decssfilter/decssfilter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="decssfilter"
ProjectGUID="{F6B06383-3FFD-403B-9867-4AA82A20AA83}"
RootNamespace="decssfilter"
@@ -324,6 +324,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
<Tool
@@ -382,6 +383,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
/>
@@ -438,6 +440,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
/>
@@ -497,6 +500,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
<Tool
diff --git a/src/filters/transform/decssfilter/stdafx.h b/src/filters/transform/decssfilter/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/transform/decssfilter/stdafx.h +++ b/src/filters/transform/decssfilter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.cpp b/src/filters/transform/mpadecfilter/MpaDecFilter.cpp index 095f3b42a..b0bb22593 100644 --- a/src/filters/transform/mpadecfilter/MpaDecFilter.cpp +++ b/src/filters/transform/mpadecfilter/MpaDecFilter.cpp @@ -214,7 +214,7 @@ s_scmap_dts[2*10] = {4, {0, 1, 3, 2,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_2F1R|DTS_LFE
{5, {1, 2, 0, 4, 3,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_3F1R|DTS_LFE
{5, {0, 1, 4, 2, 3,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_2F2R|DTS_LFE
- {6, {1, 2, 0, 5, 3, 4,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R|DTS_LFE
+ {6, {1, 2, 5, 0, 3, 4,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R|DTS_LFE
},
s_scmap_vorbis[6] =
{
@@ -277,10 +277,10 @@ CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr) {
if(phr) *phr = S_OK;
- if(!(m_pInput = new CMpaDecInputPin(this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pInput = DNew CMpaDecInputPin(this, phr, L"In"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pOutput = new CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
m_iSpeakerConfig[ac3] = A52_STEREO;
@@ -1234,7 +1234,7 @@ HRESULT CMpaDecFilter::ProcessPS2ADPCM() {
if(m_ps2_state.sync)
{
- double* tmp = new double[samples*channels];
+ double* tmp = DNew double[samples*channels];
for(int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
for(int i = 0; i < wfe->dwInterleave; i += 16, k += 28)
@@ -1924,7 +1924,7 @@ STDMETHODIMP CMpaDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage) if(guid == __uuidof(CMpaDecSettingsWnd))
{
- (*ppPage = new CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
+ (*ppPage = DNew CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
}
return *ppPage ? S_OK : E_FAIL;
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj b/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj index 0d479bce5..387761c4e 100644 --- a/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj +++ b/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="MpaDecFilter"
ProjectGUID="{4421516D-10A6-41C1-ADF3-099573BBB0C6}"
RootNamespace="MpaDecFilter"
@@ -327,6 +327,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include;libflac\include;..\mpcvideodec\ffmpeg;..\mpcvideodec\ffmpeg\libavcodec;..\mpcvideodec\ffmpeg\libavutil"
PreprocessorDefinitions="WIN32;_DEBUG;FLAC__NO_DLL"
/>
@@ -388,6 +389,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include;libflac\include;..\mpcvideodec\ffmpeg;..\mpcvideodec\ffmpeg\libavcodec;..\mpcvideodec\ffmpeg\libavutil"
PreprocessorDefinitions="_WIN64;_DEBUG;FLAC__NO_DLL"
DebugInformationFormat="3"
@@ -447,6 +449,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include;libflac\include;..\mpcvideodec\ffmpeg;..\mpcvideodec\ffmpeg\libavcodec;..\mpcvideodec\ffmpeg\libavutil"
PreprocessorDefinitions="WIN32;NDEBUG;FLAC__NO_DLL;FLAC__NO_DLL"
DisableSpecificWarnings="4244"
@@ -509,6 +512,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include;libflac\include;..\mpcvideodec\ffmpeg;..\mpcvideodec\ffmpeg\libavcodec;..\mpcvideodec\ffmpeg\libavutil"
PreprocessorDefinitions="_WIN64;NDEBUG;FLAC__NO_DLL;FLAC__NO_DLL"
/>
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj index 32cd26aec..1af89907a 100644 --- a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj +++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="liba52"
ProjectGUID="{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}"
RootNamespace="liba52"
@@ -169,6 +169,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".,../include, ..\..\..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
GeneratePreprocessedFile="0"
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c index 152cc3ddb..099b732b7 100644 --- a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c +++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c @@ -43,7 +43,7 @@ void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode, state->current_word = 0;
state->word_mode = word_mode;
state->bigendian_mode = bigendian_mode;
- bitstream_get (state, align * 8);
+ bitstream_get (state, (uint32_t)(align * 8));
}
static inline void bitstream_fill_current (dts_state_t * state)
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj index c6cefad8f..98435067f 100644 --- a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj +++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="libdts"
ProjectGUID="{54F609FD-A8CE-43CF-94AD-23E877B97C13}"
RootNamespace="libdts"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories=".,../include, ..\..\..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
PrecompiledHeaderFile=".\Debug\libdts.pch"
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj index df1a27ab2..904c5eb1f 100644 --- a/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj +++ b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj @@ -47,6 +47,7 @@ AdditionalIncludeDirectories="..\include"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
PrecompiledHeaderFile=".\Release\libfaad.pch"
+ WarningLevel="2"
DisableSpecificWarnings="4244"
/>
<Tool
@@ -113,6 +114,7 @@ AdditionalIncludeDirectories="..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
PrecompiledHeaderFile=".\Release\libfaad.pch"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -171,10 +173,11 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions=""
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB"
PrecompiledHeaderFile=".\Debug\libfaad.pch"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -240,6 +243,7 @@ AdditionalIncludeDirectories="..\include"
PreprocessorDefinitions="_WIN64;_LIB;_DEBUG"
PrecompiledHeaderFile=".\Debug\libfaad.pch"
+ WarningLevel="2"
DebugInformationFormat="3"
/>
<Tool
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c index 72b2af6ce..c8c8fa8ba 100644 --- a/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c +++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c @@ -32,6 +32,7 @@ #include "structs.h" #include <stdlib.h> +#include <memory.h> #include "bits.h" #include "mp4.h" diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c index 6d9c7be90..e7b87f8f2 100644 --- a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c +++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c @@ -33,6 +33,8 @@ #ifdef PS_DEC #include <stdlib.h> +#include <memory.h> + #include "ps_dec.h" #include "ps_tables.h" diff --git a/src/filters/transform/mpadecfilter/libflac/src/libFLAC/libflac.vcproj b/src/filters/transform/mpadecfilter/libflac/src/libFLAC/libflac.vcproj index 1075bba47..f18bea07a 100644 --- a/src/filters/transform/mpadecfilter/libflac/src/libFLAC/libflac.vcproj +++ b/src/filters/transform/mpadecfilter/libflac/src/libFLAC/libflac.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="libflac"
ProjectGUID="{4CEFBC84-C215-11DB-8314-0800200C9A66}"
RootNamespace="libflac"
@@ -44,6 +44,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\include; ..\..\..\..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT"
@@ -51,7 +52,7 @@ BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="1"
@@ -119,7 +120,7 @@ BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="1"
@@ -188,7 +189,7 @@ RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="1"
@@ -258,7 +259,7 @@ RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="1"
@@ -303,11 +304,11 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
- RelativePath=".\include\protected\all.h"
+ RelativePath=".\include\private\all.h"
>
</File>
<File
- RelativePath=".\include\private\all.h"
+ RelativePath=".\include\protected\all.h"
>
</File>
<File
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj index 5c55632be..033d881ea 100644 --- a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj +++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj @@ -43,11 +43,13 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="FPM_DEFAULT;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK;WIN32;_DEBUG;DEBUG"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug\libmad.pch"
AssemblerOutput="0"
+ WarningLevel="1"
CompileAs="0"
/>
<Tool
@@ -114,6 +116,7 @@ UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug\libmad.pch"
AssemblerOutput="0"
+ WarningLevel="1"
DebugInformationFormat="3"
CompileAs="0"
/>
@@ -177,6 +180,7 @@ PreprocessorDefinitions="NDEBUG;FPM_INTEL;WIN32;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release\libmad.pch"
+ WarningLevel="1"
CompileAs="0"
DisableSpecificWarnings="4244"
/>
@@ -243,6 +247,7 @@ PreprocessorDefinitions="_WIN64;NDEBUG;FPM_INTEL;FPM_64BIT;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release\libmad.pch"
+ WarningLevel="1"
CompileAs="0"
/>
<Tool
diff --git a/src/filters/transform/mpadecfilter/libvorbisidec/libvorbisidec.vcproj b/src/filters/transform/mpadecfilter/libvorbisidec/libvorbisidec.vcproj index 84c3f2168..591bb21d4 100644 --- a/src/filters/transform/mpadecfilter/libvorbisidec/libvorbisidec.vcproj +++ b/src/filters/transform/mpadecfilter/libvorbisidec/libvorbisidec.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="libvorbisidec"
ProjectGUID="{A7134255-DFF3-42F7-9BC2-FAC6E71CFFAE}"
RootNamespace="libvorbisidec"
@@ -43,11 +43,13 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="., ..\..\..\..\..\include"
PreprocessorDefinitions="_LIB;_WIN32;WIN32;_DEBUG;DEBUG"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug\libvorbisidec.pch"
AssemblerOutput="0"
+ WarningLevel="1"
CompileAs="0"
/>
<Tool
@@ -114,6 +116,7 @@ UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug\libvorbisidec.pch"
AssemblerOutput="0"
+ WarningLevel="1"
DebugInformationFormat="3"
CompileAs="0"
/>
@@ -177,6 +180,7 @@ PreprocessorDefinitions="_LIB;_WIN32;WIN32;NDEBUG"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release\libvorbisidec.pch"
+ WarningLevel="1"
CompileAs="0"
DisableSpecificWarnings="4244"
/>
@@ -243,6 +247,7 @@ PreprocessorDefinitions="_WIN64;_LIB;NDEBUG"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release\libvorbisidec.pch"
+ WarningLevel="1"
CompileAs="0"
/>
<Tool
@@ -287,13 +292,6 @@ <File
RelativePath=".\bitrate.c"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
</File>
<File
RelativePath=".\bitwise.c"
@@ -310,13 +308,6 @@ <File
RelativePath=".\envelope.c"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
</File>
<File
RelativePath=".\floor0.c"
diff --git a/src/filters/transform/mpadecfilter/stdafx.h b/src/filters/transform/mpadecfilter/stdafx.h index 0029f3c7e..31d136cf9 100644 --- a/src/filters/transform/mpadecfilter/stdafx.h +++ b/src/filters/transform/mpadecfilter/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/filters/transform/mpcvideodec/DXVADecoder.cpp b/src/filters/transform/mpcvideodec/DXVADecoder.cpp index 27ef322a6..d9c4c52d6 100644 --- a/src/filters/transform/mpcvideodec/DXVADecoder.cpp +++ b/src/filters/transform/mpcvideodec/DXVADecoder.cpp @@ -76,7 +76,7 @@ void CDXVADecoder::Init(CMPCVideoDecFilter* pFilter, DXVAMode nMode, int nPicEnt m_pFilter = pFilter;
m_nMode = nMode;
m_nPicEntryNumber = nPicEntryNumber;
- m_pPictureStore = new PICTURE_STORE[nPicEntryNumber];
+ m_pPictureStore = DNew PICTURE_STORE[nPicEntryNumber];
m_dwNumBuffersInfo = 0;
memset (&m_DXVA1Config, 0, sizeof(m_DXVA1Config));
@@ -94,7 +94,7 @@ void CDXVADecoder::Init(CMPCVideoDecFilter* pFilter, DXVAMode nMode, int nPicEnt // === Public functions
void CDXVADecoder::AllocExecuteParams (int nSize)
{
- m_ExecuteParams.pCompressedBuffers = new DXVA2_DecodeBufferDesc[nSize];
+ m_ExecuteParams.pCompressedBuffers = DNew DXVA2_DecodeBufferDesc[nSize];
for (int i=0; i<nSize; i++)
memset (&m_ExecuteParams.pCompressedBuffers[i], 0, sizeof(DXVA2_DecodeBufferDesc));
@@ -169,9 +169,9 @@ CDXVADecoder* CDXVADecoder::CreateDecoder (CMPCVideoDecFilter* pFilter, IAMVideo CDXVADecoder* pDecoder = NULL;
if ((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
- pDecoder = new CDXVADecoderH264 (pFilter, pAMVideoAccelerator, H264_VLD, nPicEntryNumber);
+ pDecoder = DNew CDXVADecoderH264 (pFilter, pAMVideoAccelerator, H264_VLD, nPicEntryNumber);
else if (*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
- pDecoder = new CDXVADecoderVC1 (pFilter, pAMVideoAccelerator, VC1_VLD, nPicEntryNumber);
+ pDecoder = DNew CDXVADecoderVC1 (pFilter, pAMVideoAccelerator, VC1_VLD, nPicEntryNumber);
else
ASSERT (FALSE); // Unknown decoder !!
@@ -184,9 +184,9 @@ CDXVADecoder* CDXVADecoder::CreateDecoder (CMPCVideoDecFilter* pFilter, IDirectX CDXVADecoder* pDecoder = NULL;
if ((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
- pDecoder = new CDXVADecoderH264 (pFilter, pDirectXVideoDec, H264_VLD, nPicEntryNumber, pDXVA2Config);
+ pDecoder = DNew CDXVADecoderH264 (pFilter, pDirectXVideoDec, H264_VLD, nPicEntryNumber, pDXVA2Config);
else if (*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
- pDecoder = new CDXVADecoderVC1 (pFilter, pDirectXVideoDec, VC1_VLD, nPicEntryNumber, pDXVA2Config);
+ pDecoder = DNew CDXVADecoderVC1 (pFilter, pDirectXVideoDec, VC1_VLD, nPicEntryNumber, pDXVA2Config);
else
ASSERT (FALSE); // Unknown decoder !!
@@ -619,7 +619,7 @@ HRESULT CDXVADecoder::DisplayNextFrame() }
-#ifdef _DEBUG
+#if defined(_DEBUG) && 0
static REFERENCE_TIME rtLast = 0;
TRACE ("Deliver : %10I64d - %10I64d (Dur = %10I64d) {Delta prev = %10I64d} Ind = %d\n",
m_pPictureStore[nPicIndex].rtStart,
diff --git a/src/filters/transform/mpcvideodec/MPCVideoDec.vcproj b/src/filters/transform/mpcvideodec/MPCVideoDec.vcproj index 174fda5ad..cc014d9cb 100644 --- a/src/filters/transform/mpcvideodec/MPCVideoDec.vcproj +++ b/src/filters/transform/mpcvideodec/MPCVideoDec.vcproj @@ -200,7 +200,7 @@ LinkLibraryDependencies="false"
AdditionalDependencies="decssRU.lib dsutilRU.lib filtersRU.lib strmbaseRU.lib Winmm.lib zlibR.lib basevideofilterRU.lib libavcodec_gcc.lib libgcc.a libmingwex.a d3d9.lib"
OutputFile="..\..\..\..\bin\x86\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib"
+ AdditionalLibraryDirectories="..\..\..\..\lib;;$(MINGW32)\lib;$(MINGW32_GCCLIB)"
ModuleDefinitionFile="MPCVideoDec.def"
SubSystem="2"
TargetMachine="1"
@@ -270,7 +270,7 @@ Name="VCLinkerTool"
AdditionalDependencies="decssRU.lib dsutilRU.lib filtersRU.lib strmbaseRU.lib Winmm.lib zlibR.lib basevideofilterRU.lib libavcodec_gcc.lib libgcc.a libmingwex.a d3d9.lib"
OutputFile="..\..\..\..\bin\x64\$(ProjectName).ax"
- AdditionalLibraryDirectories="..\..\..\..\lib64"
+ AdditionalLibraryDirectories="..\..\..\..\lib64;$(MINGW64)\lib;$(MINGW64_GCCLIB)"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile="MPCVideoDec.def"
SubSystem="2"
@@ -322,6 +322,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include,ffmpeg,ffmpeg\libavcodec,ffmpeg\libavutil"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -336,6 +337,7 @@ />
<Tool
Name="VCLibrarianTool"
+ LinkLibraryDependencies="true"
AdditionalDependencies="libavcodecD.lib"
OutputFile="..\..\..\..\lib\$(ProjectName)DU.lib"
AdditionalLibraryDirectories="..\..\..\..\lib"
@@ -383,6 +385,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include,ffmpeg,ffmpeg\libavcodec,ffmpeg\libavutil"
PreprocessorDefinitions="_WIN64;_DEBUG;"
DebugInformationFormat="3"
@@ -398,6 +401,7 @@ />
<Tool
Name="VCLibrarianTool"
+ LinkLibraryDependencies="true"
AdditionalDependencies="libavcodecD.lib"
OutputFile="..\..\..\..\lib64\$(ProjectName)DU.lib"
AdditionalLibraryDirectories="..\..\..\..\lib64"
@@ -442,6 +446,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include,ffmpeg,ffmpeg\libavcodec,ffmpeg\libavutil"
PreprocessorDefinitions="WIN32;NDEBUG"
/>
@@ -456,9 +461,10 @@ />
<Tool
Name="VCLibrarianTool"
+ LinkLibraryDependencies="true"
AdditionalDependencies="libavcodec_gcc.lib libgcc.a libmingwex.a"
OutputFile="..\..\..\..\lib\$(ProjectName)RU.lib"
- AdditionalLibraryDirectories="..\..\..\..\lib"
+ AdditionalLibraryDirectories="..\..\..\..\lib;$(MINGW32)\lib;$(MINGW32_GCCLIB)"
/>
<Tool
Name="VCALinkTool"
@@ -503,6 +509,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include,ffmpeg,ffmpeg\libavcodec,ffmpeg\libavutil"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
@@ -517,9 +524,10 @@ />
<Tool
Name="VCLibrarianTool"
- AdditionalDependencies="libavcodec_gcc.lib libgcc.a libmingwex.a"
+ LinkLibraryDependencies="true"
+ AdditionalDependencies="libavcodec_gcc.lib"
OutputFile="..\..\..\..\lib64\$(ProjectName)RU.lib"
- AdditionalLibraryDirectories="..\..\..\..\lib64"
+ AdditionalLibraryDirectories="..\..\..\..\lib64;$(MINGW64_GCCLIB);$(MINGW64)\lib"
/>
<Tool
Name="VCALinkTool"
@@ -565,13 +573,70 @@ RelativePath=".\FfmpegContext.c"
>
<FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
+ WarningLevel="1"
CompileAs="1"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ WarningLevel="1"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\MPCFfmpegDec.cpp"
diff --git a/src/filters/transform/mpcvideodec/VideoDecDXVAAllocator.cpp b/src/filters/transform/mpcvideodec/VideoDecDXVAAllocator.cpp index 467e15f3c..b2f968e5a 100644 --- a/src/filters/transform/mpcvideodec/VideoDecDXVAAllocator.cpp +++ b/src/filters/transform/mpcvideodec/VideoDecDXVAAllocator.cpp @@ -138,7 +138,7 @@ HRESULT CVideoDecDXVAAllocator::Alloc() m_nSurfaceArrayCount = m_lCount;
// Allocate a new array of pointers.
- m_ppRTSurfaceArray = new IDirect3DSurface9*[m_lCount];
+ m_ppRTSurfaceArray = DNew IDirect3DSurface9*[m_lCount];
if (m_ppRTSurfaceArray == NULL)
{
hr = E_OUTOFMEMORY;
@@ -171,7 +171,7 @@ HRESULT CVideoDecDXVAAllocator::Alloc() // Important : create samples in reverse order !
for (m_lAllocated = m_lCount-1; m_lAllocated >= 0; m_lAllocated--)
{
- CDXVA2Sample *pSample = new CDXVA2Sample(this, &hr);
+ CDXVA2Sample *pSample = DNew CDXVA2Sample(this, &hr);
if (pSample == NULL)
{
hr = E_OUTOFMEMORY;
diff --git a/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp b/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp index cb8cf0b41..27963f8ed 100644 --- a/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp +++ b/src/filters/transform/mpcvideodec/VideoDecOutputPin.cpp @@ -47,7 +47,7 @@ HRESULT CVideoDecOutputPin::InitAllocator(IMemAllocator **ppAlloc) if (m_pVideoDecFilter->UseDXVA2())
{
HRESULT hr = S_FALSE;
- m_pDXVA2Allocator = new CVideoDecDXVAAllocator(m_pVideoDecFilter, &hr);
+ m_pDXVA2Allocator = DNew CVideoDecDXVAAllocator(m_pVideoDecFilter, &hr);
if (!m_pDXVA2Allocator)
{
return E_OUTOFMEMORY;
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/Makefile b/src/filters/transform/mpcvideodec/ffmpeg/Makefile index 0a63ad875..060bc190f 100644 --- a/src/filters/transform/mpcvideodec/ffmpeg/Makefile +++ b/src/filters/transform/mpcvideodec/ffmpeg/Makefile @@ -3,7 +3,7 @@ LAVU_DIR=libavutil LAVF_DIR=libavformat
PNG_DIR =../../../../libpng
ifeq ($(64BIT),yes)
- ZLIB_DIR=../../../../../../zlib
+ ZLIB_DIR=../../../../zlib
else
ZLIB_DIR=../../../../zlib
endif
@@ -210,7 +210,7 @@ endif ifeq ($(64BIT),yes)
CFLAGS+=-DARCH_X86_64
- SLIB=../../../../../../../lib64/libavcodec_gcc.lib
+ SLIB=../../../../../lib64/libavcodec_gcc.lib
else
CFLAGS+=-DARCH_X86_32
SLIB=../../../../../lib/libavcodec_gcc.lib
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/gccbuild.bat b/src/filters/transform/mpcvideodec/ffmpeg/gccbuild.bat new file mode 100644 index 000000000..0bad18c83 --- /dev/null +++ b/src/filters/transform/mpcvideodec/ffmpeg/gccbuild.bat @@ -0,0 +1,29 @@ +@echo off
+set PATH=%MINGW32%\bin;%YASM%;%PATH%
+set INCLUDE=%MINGW32%\include;%INCLUDE%
+IF EXIST "%MINGW32%\bin\mingw32-make.exe" copy /y "%MINGW32%\bin\mingw32-make.exe" "%MINGW32%\bin\make.exe"
+IF EXIST "%MINGW32%\bin\mingw32-gcc.exe" copy /y "%MINGW32%\bin\mingw32-gcc.exe" "%MINGW32%\bin\cc.exe"
+
+IF "%1%"=="rebuild" goto DoClean
+IF "%1%"=="clean" goto OnlyClean
+goto NoClean
+
+:OnlyClean
+make.exe clean
+IF EXIST 64bit.build rm 64bit.build
+goto End
+
+:DoClean
+make.exe clean
+IF EXIST 64bit.build rm 64bit.build
+
+:NoClean
+IF NOT EXIST 64bit.build GOTO NoArchClean
+make.exe clean
+rm 64bit.build
+
+:NoArchClean
+touch 32bit.build
+make.exe -j8
+
+:End
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/gccbuild64.bat b/src/filters/transform/mpcvideodec/ffmpeg/gccbuild64.bat new file mode 100644 index 000000000..fd106850f --- /dev/null +++ b/src/filters/transform/mpcvideodec/ffmpeg/gccbuild64.bat @@ -0,0 +1,32 @@ +@echo off
+set PATH=%YASM%;%MINGW64%\bin;%MINGW32%\bin;%PATH%
+set INCLUDE=%MINGW64%\x86_64-pc-mingw32\include;%INCLUDE%
+IF EXIST "%MINGW32%\bin\mingw32-make.exe" copy /y "%MINGW32%\bin\mingw32-make.exe" "%MINGW32%\bin\make.exe"
+IF EXIST "%MINGW64%\x86_64-pc-mingw32\bin\ar.exe" copy /y "%MINGW64%\x86_64-pc-mingw32\bin\ar.exe" "%MINGW64%\bin\x86_64-pc-mingw32-ar.exe"
+IF EXIST "%MINGW64%\bin\x86_64-pc-mingw32-make.exe" copy /y "%MINGW64%\bin\x86_64-pc-mingw32-make.exe" "%MINGW64%\bin\make.exe"
+IF EXIST "%MINGW64%\bin\x86_64-pc-mingw32-gcc.exe" copy /y "%MINGW64%\bin\x86_64-pc-mingw32-gcc.exe" "%MINGW64%\bin\cc.exe"
+IF EXIST "%MINGW64%\bin\x86_64-pc-mingw32-gcc.exe" copy /y "%MINGW64%\bin\x86_64-pc-mingw32-gcc.exe" "%MINGW64%\bin\x86_64-pc-mingw32-cc.exe"
+
+IF "%1%"=="rebuild" goto DoClean
+IF "%1%"=="clean" goto OnlyClean
+goto NoClean
+
+:OnlyClean
+make.exe 64BIT=yes clean
+IF EXIST 32bit.build rm 32bit.build
+goto End
+
+:DoClean
+make.exe 64BIT=yes clean
+IF EXIST 32bit.build rm 32bit.build
+
+:NoClean
+IF NOT EXIST 32bit.build GOTO NoArchClean
+make.exe 64BIT=yes clean
+rm 32bit.build
+
+:NoArchClean
+touch 64bit.build
+make.exe 64BIT=yes -j8
+
+:End
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/libavcodec.vcproj b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec.vcproj index 51a18caea..252a9f7d2 100644 --- a/src/filters/transform/mpcvideodec/ffmpeg/libavcodec.vcproj +++ b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec.vcproj @@ -50,6 +50,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\zlib,.,libavcodec,libavutil, ..\..\..\..\..\include"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_NONSTDC_NO_WARNINGS;_DEBUG;_WINDOWS;HAVE_AV_CONFIG_H;H264_MERGE_TESTING"
@@ -249,7 +250,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\lib\libavcodecR.lib"
+ OutputFile="..\..\..\..\..\lib\libavcodec_gcc.lib"
/>
<Tool
Name="VCALinkTool"
@@ -334,7 +335,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\lib64\libavcodecR.lib"
+ OutputFile="..\..\..\..\..\lib64\libavcodec_gcc.lib"
/>
<Tool
Name="VCALinkTool"
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/libavcodec/vc1.c b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec/vc1.c index 3935d38c1..43a5f06c6 100644 --- a/src/filters/transform/mpcvideodec/ffmpeg/libavcodec/vc1.c +++ b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec/vc1.c @@ -3145,7 +3145,7 @@ static int vc1_decode_p_mb(VC1Context *v) int first_block = 1;
int dst_idx, off;
int skipped, fourmv;
- int block_cbp = 0, pat;
+ int block_cbp = 0, pat = 0;
int apply_loop_filter;
mquant = v->pq; /* Loosy initialization */
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/libavcodec_gcc.vcproj b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec_gcc.vcproj new file mode 100644 index 000000000..d00f6c603 --- /dev/null +++ b/src/filters/transform/mpcvideodec/ffmpeg/libavcodec_gcc.vcproj @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="libavcodec_gcc"
+ ProjectGUID="{438286B7-A9F4-411D-BCC5-948C40E37D8F}"
+ RootNamespace="libavcodec_gcc"
+ Keyword="MakeFileProj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="{MINGW32}\bin\make"
+ ReBuildCommandLine="{MINGW32}\bin\make rebuild"
+ CleanCommandLine="{MINGW32}\bin\make clean"
+ Output="libavcodec_gcc.lib"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="{MINGW32}\bin\make"
+ ReBuildCommandLine="{MINGW32}\bin\make rebuild"
+ CleanCommandLine="{MINGW32}\bin\make clean"
+ Output="libavcodec_gcc.lib"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\"
+ IntermediateDirectory=".\"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="gccbuild.bat"
+ ReBuildCommandLine="gccbuild.bat rebuild"
+ CleanCommandLine="gccbuild.bat clean"
+ Output="..\..\..\..\..\lib\libavcodec_gcc.lib"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="gccbuild64.bat"
+ ReBuildCommandLine="gccbuild64.bat rebuild"
+ CleanCommandLine="gccbuild64.bat clean"
+ Output="libavcodec_gcc.lib"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\gccbuild.bat"
+ >
+ </File>
+ <File
+ RelativePath=".\gccbuild64.bat"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\readme.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpcvideodec/ffmpeg/libavutil/internal.h b/src/filters/transform/mpcvideodec/ffmpeg/libavutil/internal.h index 387e74644..bd8a64f9e 100644 --- a/src/filters/transform/mpcvideodec/ffmpeg/libavutil/internal.h +++ b/src/filters/transform/mpcvideodec/ffmpeg/libavutil/internal.h @@ -310,7 +310,7 @@ static av_always_inline av_const double round(double x) #ifndef roundf
static av_always_inline av_const float roundf(float x)
{
- return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
+ return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
}
#endif
diff --git a/src/filters/transform/mpcvideodec/stdafx.h b/src/filters/transform/mpcvideodec/stdafx.h index 47e52ef78..d37204eb5 100644 --- a/src/filters/transform/mpcvideodec/stdafx.h +++ b/src/filters/transform/mpcvideodec/stdafx.h @@ -22,6 +22,7 @@ #pragma once
+#include "..\..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
@@ -44,6 +45,7 @@ #include <atlcoll.h>
#include <vector>
+
#ifdef _DEBUG
void LOG(LPCTSTR fmt, ...);
#else
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp index 365355352..33c7a0fa8 100644 --- a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp +++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp @@ -199,16 +199,16 @@ CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr) if(FAILED(*phr)) return;
- if(!(m_pInput = new CMpeg2DecInputPin(this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(!(m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
-// if(!(m_pOutput = new CMpeg2DecOutputPin(this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+// if(!(m_pOutput = DNew CMpeg2DecOutputPin(this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
// if(FAILED(*phr)) return;
- if(!(m_pSubpicInput = new CSubpicInputPin(this, phr))) *phr = E_OUTOFMEMORY;
+ if(!(m_pSubpicInput = DNew CSubpicInputPin(this, phr))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
- if(!(m_pClosedCaptionOutput = new CClosedCaptionOutputPin(this, m_pLock, phr))) *phr = E_OUTOFMEMORY;
+ if(!(m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr))) *phr = E_OUTOFMEMORY;
if(FAILED(*phr)) return;
SetDeinterlaceMethod(DIAuto);
@@ -508,7 +508,7 @@ HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn) int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch)
- m_fb.alloc(w, h, pitch);
+ m_fb.Alloc(w, h, pitch);
// start - end
@@ -880,7 +880,7 @@ HRESULT CMpeg2DecFilter::StartStreaming() HRESULT hr = __super::StartStreaming();
if(FAILED(hr)) return hr;
- m_dec.Attach(new CMpeg2Dec());
+ m_dec.Attach(DNew CMpeg2Dec());
if(!m_dec) return E_OUTOFMEMORY;
InputTypeChanged();
@@ -934,7 +934,7 @@ STDMETHODIMP CMpeg2DecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPag if(guid == __uuidof(CMpeg2DecSettingsWnd))
{
- (*ppPage = new CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
+ (*ppPage = DNew CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
}
return *ppPage ? S_OK : E_FAIL;
@@ -1366,7 +1366,7 @@ HRESULT CMpeg2DecOutputPin::Active() {
HRESULT hr = NOERROR;
- m_pOutputQueue.Attach(new COutputQueue(m_Connected, &hr));
+ m_pOutputQueue.Attach(DNew COutputQueue(m_Connected, &hr));
if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
if(FAILED(hr))
@@ -1561,9 +1561,9 @@ HRESULT CSubpicInputPin::Transform(IMediaSample* pSample) CAutoPtr<spu> p;
- if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) p.Attach(new dvdspu());
- else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) p.Attach(new cvdspu());
- else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) p.Attach(new svcdspu());
+ if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) p.Attach(DNew dvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) p.Attach(DNew cvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) p.Attach(DNew svcdspu());
else return E_FAIL;
p->m_rtStart = rtStart;
@@ -1641,14 +1641,14 @@ STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceDat {
fRefresh = true;
sp->m_psphli.Free();
- sp->m_psphli.Attach(new AM_PROPERTY_SPHLI());
+ sp->m_psphli.Attach(DNew AM_PROPERTY_SPHLI);
memcpy((AM_PROPERTY_SPHLI*)sp->m_psphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
}
}
if(!fRefresh) // save it for later, a subpic might be late for this hli
{
- m_sphli.Attach(new AM_PROPERTY_SPHLI());
+ m_sphli.Attach(DNew AM_PROPERTY_SPHLI);
memcpy((AM_PROPERTY_SPHLI*)m_sphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
}
}
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h index 969b6bd1f..ceb9cdd82 100644 --- a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h +++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h @@ -62,8 +62,8 @@ class CMpeg2DecFilter rtStart = rtStop = 0;
flags = 0;
}
- ~framebuf() {free();}
- void alloc(int w, int h, int pitch)
+ ~framebuf() {Free();}
+ void Alloc(int w, int h, int pitch)
{
this->w = w; this->h = h; this->pitch = pitch;
int size = pitch*h;
@@ -76,7 +76,7 @@ class CMpeg2DecFilter buf[2] = p; p += (size/4 + 31) & ~31;
buf[5] = p; p += (size/4 + 31) & ~31;
}
- void free()
+ void Free()
{
if(buf_base) _aligned_free(buf_base);
buf_base = NULL;
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj index c73a05d08..ff17180df 100644 --- a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj +++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="Mpeg2DecFilter"
ProjectGUID="{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}"
RootNamespace="Mpeg2DecFilter"
@@ -303,6 +303,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG"
/>
@@ -364,6 +365,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG"
DebugInformationFormat="3"
@@ -423,6 +425,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG"
DisableSpecificWarnings="4244"
@@ -485,6 +488,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG"
/>
diff --git a/src/filters/transform/mpeg2decfilter/stdafx.h b/src/filters/transform/mpeg2decfilter/stdafx.h index 714c23efc..d4cb512b1 100644 --- a/src/filters/transform/mpeg2decfilter/stdafx.h +++ b/src/filters/transform/mpeg2decfilter/stdafx.h @@ -25,7 +25,7 @@ //
#pragma once
-
+#include "../../../DSUtil/SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/libpng/libpng.vcproj b/src/libpng/libpng.vcproj index 671d6fd07..176503264 100644 --- a/src/libpng/libpng.vcproj +++ b/src/libpng/libpng.vcproj @@ -45,9 +45,11 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -105,9 +107,11 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="2"
DebugInformationFormat="3"
/>
<Tool
@@ -168,6 +172,7 @@ AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="2"
DisableSpecificWarnings="4244"
/>
<Tool
@@ -229,6 +234,7 @@ AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
UsePrecompiledHeader="0"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
diff --git a/src/subpic/DX7SubPic.cpp b/src/subpic/DX7SubPic.cpp index 1079d61b9..400db11bf 100644 --- a/src/subpic/DX7SubPic.cpp +++ b/src/subpic/DX7SubPic.cpp @@ -284,7 +284,7 @@ bool CDX7SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic) if(FAILED(pDD->CreateSurface(&ddsd, &pSurface, NULL)))
return(false);
- if(!(*ppSubPic = new CDX7SubPic(m_pD3DDev, pSurface)))
+ if(!(*ppSubPic = DNew CDX7SubPic(m_pD3DDev, pSurface)))
return(false);
(*ppSubPic)->AddRef();
diff --git a/src/subpic/DX9SubPic.cpp b/src/subpic/DX9SubPic.cpp index 0cb9350dc..4dae0e55b 100644 --- a/src/subpic/DX9SubPic.cpp +++ b/src/subpic/DX9SubPic.cpp @@ -28,8 +28,8 @@ // CDX9SubPic
//
-CDX9SubPic::CDX9SubPic(IDirect3DSurface9* pSurface)
- : m_pSurface(pSurface)
+CDX9SubPic::CDX9SubPic(IDirect3DSurface9* pSurface, CDX9SubPicAllocator *pAllocator)
+ : m_pSurface(pSurface), m_pAllocator(pAllocator)
{
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
@@ -40,6 +40,29 @@ CDX9SubPic::CDX9SubPic(IDirect3DSurface9* pSurface) }
}
+CDX9SubPic::~CDX9SubPic()
+{
+ {
+ CAutoLock Lock(&CDX9SubPicAllocator::ms_SurfaceQueueLock);
+ // Add surface to cache
+ if (m_pAllocator)
+ {
+ for (POSITION pos = m_pAllocator->m_AllocatedSurfaces.GetHeadPosition(); pos; )
+ {
+ POSITION ThisPos = pos;
+ CDX9SubPic *pSubPic = m_pAllocator->m_AllocatedSurfaces.GetNext(pos);
+ if (pSubPic == this)
+ {
+ m_pAllocator->m_AllocatedSurfaces.RemoveAt(ThisPos);
+ break;
+ }
+ }
+ m_pAllocator->m_FreeSurfaces.AddTail(m_pSurface);
+ }
+ }
+}
+
+
// ISubPic
STDMETHODIMP_(void*) CDX9SubPic::GetObject()
@@ -85,7 +108,7 @@ STDMETHODIMP CDX9SubPic::CopyTo(ISubPic* pSubPic) return E_FAIL;
hr = pD3DDev->UpdateTexture((IDirect3DTexture9*)GetObject(), (IDirect3DTexture9*)pSubPic->GetObject());
- ASSERT (SUCCEEDED (hr));
+// ASSERT (SUCCEEDED (hr));
return SUCCEEDED(hr) ? S_OK : E_FAIL;
}
@@ -150,7 +173,7 @@ STDMETHODIMP CDX9SubPic::Lock(SubPicDesc& spd) D3DLOCKED_RECT LockedRect;
ZeroMemory(&LockedRect, sizeof(LockedRect));
- if(FAILED(m_pSurface->LockRect(&LockedRect, NULL, 0)))
+ if(FAILED(m_pSurface->LockRect(&LockedRect, NULL, D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK)))
return E_FAIL;
spd.type = 0;
@@ -185,6 +208,10 @@ STDMETHODIMP CDX9SubPic::Unlock(RECT* pDirtyRect) m_rcDirty = CRect(CPoint(0, 0), m_size);
}
+ CComPtr<IDirect3DTexture9> pTexture = (IDirect3DTexture9*)GetObject();
+ if (pTexture)
+ pTexture->AddDirtyRect(&m_rcDirty);
+
return S_OK;
}
@@ -274,13 +301,13 @@ STDMETHODIMP CDX9SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) hr = pD3DDev->SetPixelShader(NULL);
- if(FAILED(hr = pD3DDev->BeginScene()))
- break;
+// if(FAILED(hr = pD3DDev->BeginScene()))
+// break;
hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pVertices, sizeof(pVertices[0]));
- hr = pD3DDev->EndScene();
+// hr = pD3DDev->EndScene();
//
@@ -310,10 +337,42 @@ CDX9SubPicAllocator::CDX9SubPicAllocator(IDirect3DDevice9* pD3DDev, SIZE maxsize m_maxsize = maxsize;
}
+CCritSec CDX9SubPicAllocator::ms_SurfaceQueueLock;
+
+
+CDX9SubPicAllocator::~CDX9SubPicAllocator()
+{
+ ClearCache();
+}
+
+
+void CDX9SubPicAllocator::GetStats(int &_nFree, int &_nAlloc)
+{
+ CAutoLock Lock(&ms_SurfaceQueueLock);
+ _nFree = m_FreeSurfaces.GetCount();
+ _nAlloc = m_AllocatedSurfaces.GetCount();
+}
+
+void CDX9SubPicAllocator::ClearCache()
+{
+ {
+ // Clear the allocator of any remaining subpics
+ CAutoLock Lock(&ms_SurfaceQueueLock);
+ for (POSITION pos = m_AllocatedSurfaces.GetHeadPosition(); pos; )
+ {
+ CDX9SubPic *pSubPic = m_AllocatedSurfaces.GetNext(pos);
+ pSubPic->m_pAllocator = NULL;
+ }
+ m_AllocatedSurfaces.RemoveAll();
+ m_FreeSurfaces.RemoveAll();
+ }
+}
+
// ISubPicAllocator
STDMETHODIMP CDX9SubPicAllocator::ChangeDevice(IUnknown* pDev)
{
+ ClearCache();
CComQIPtr<IDirect3DDevice9> pD3DDev = pDev;
if(!pD3DDev) return E_NOINTERFACE;
@@ -325,6 +384,7 @@ STDMETHODIMP CDX9SubPicAllocator::ChangeDevice(IUnknown* pDev) STDMETHODIMP CDX9SubPicAllocator::SetMaxTextureSize(SIZE MaxTextureSize)
{
+ ClearCache();
m_maxsize = MaxTextureSize;
SetCurSize(MaxTextureSize);
return S_OK;
@@ -352,18 +412,37 @@ bool CDX9SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic) while(Width < m_maxsize.cx) Width <<= 1;
while(Height < m_maxsize.cy) Height <<= 1;
}
+ if (!fStatic)
+ {
+ CAutoLock cAutoLock(&ms_SurfaceQueueLock);
+ POSITION FreeSurf = m_FreeSurfaces.GetHeadPosition();
+ if (FreeSurf)
+ {
+ pSurface = m_FreeSurfaces.GetHead();
+ m_FreeSurfaces.RemoveHead();
+ }
+ }
- CComPtr<IDirect3DTexture9> pTexture;
- if(FAILED(m_pD3DDev->CreateTexture(Width, Height, 1, 0, D3DFMT_A8R8G8B8, fStatic?D3DPOOL_SYSTEMMEM:D3DPOOL_DEFAULT, &pTexture, NULL)))
- return(false);
+ if (!pSurface)
+ {
+ CComPtr<IDirect3DTexture9> pTexture;
+ if(FAILED(m_pD3DDev->CreateTexture(Width, Height, 1, 0, D3DFMT_A8R8G8B8, fStatic?D3DPOOL_SYSTEMMEM:D3DPOOL_DEFAULT, &pTexture, NULL)))
+ return(false);
- if(FAILED(pTexture->GetSurfaceLevel(0, &pSurface)))
- return(false);
+ if(FAILED(pTexture->GetSurfaceLevel(0, &pSurface)))
+ return(false);
+ }
- if(!(*ppSubPic = new CDX9SubPic(pSurface)))
+ if(!(*ppSubPic = DNew CDX9SubPic(pSurface, fStatic ? 0 : this)))
return(false);
(*ppSubPic)->AddRef();
+ if (!fStatic)
+ {
+ CAutoLock cAutoLock(&ms_SurfaceQueueLock);
+ m_AllocatedSurfaces.AddHead((CDX9SubPic *)*ppSubPic);
+ }
+
return(true);
}
diff --git a/src/subpic/DX9SubPic.h b/src/subpic/DX9SubPic.h index 97543909a..015a2fc3e 100644 --- a/src/subpic/DX9SubPic.h +++ b/src/subpic/DX9SubPic.h @@ -25,6 +25,7 @@ // CDX9SubPic
+class CDX9SubPicAllocator;
class CDX9SubPic : public ISubPicImpl
{
CComPtr<IDirect3DSurface9> m_pSurface;
@@ -33,7 +34,9 @@ protected: STDMETHODIMP_(void*) GetObject(); // returns IDirect3DTexture9*
public:
- CDX9SubPic(IDirect3DSurface9* pSurface);
+ CDX9SubPicAllocator *m_pAllocator;
+ CDX9SubPic(IDirect3DSurface9* pSurface, CDX9SubPicAllocator *pAllocator);
+ ~CDX9SubPic();
// ISubPic
STDMETHODIMP GetDesc(SubPicDesc& spd);
@@ -51,10 +54,19 @@ class CDX9SubPicAllocator : public ISubPicAllocatorImpl, public CCritSec CComPtr<IDirect3DDevice9> m_pD3DDev;
CSize m_maxsize;
+
bool Alloc(bool fStatic, ISubPic** ppSubPic);
public:
+ static CCritSec ms_SurfaceQueueLock;
+ CAtlList<CComPtr<IDirect3DSurface9> > m_FreeSurfaces;
+ CAtlList<CDX9SubPic *> m_AllocatedSurfaces;
+
+ void GetStats(int &_nFree, int &_nAlloc);
+
CDX9SubPicAllocator(IDirect3DDevice9* pD3DDev, SIZE maxsize, bool fPow2Textures);
+ ~CDX9SubPicAllocator();
+ void ClearCache();
// ISubPicAllocator
STDMETHODIMP ChangeDevice(IUnknown* pDev);
diff --git a/src/subpic/ISubPic.cpp b/src/subpic/ISubPic.cpp index 5abae6756..ac6d6f653 100644 --- a/src/subpic/ISubPic.cpp +++ b/src/subpic/ISubPic.cpp @@ -30,6 +30,7 @@ ISubPicImpl::ISubPicImpl()
: CUnknown(NAME("ISubPicImpl"), NULL)
, m_rtStart(0), m_rtStop(0)
+ , m_rtSegmentStart(0), m_rtSegmentStop(0)
, m_rcDirty(0, 0, 0, 0), m_maxsize(0, 0), m_size(0, 0), m_vidrect(0, 0, 0, 0)
, m_VirtualTextureSize(0, 0), m_VirtualTextureTopLeft (0, 0)
{
@@ -54,6 +55,32 @@ STDMETHODIMP_(REFERENCE_TIME) ISubPicImpl::GetStop() return(m_rtStop);
}
+STDMETHODIMP_(REFERENCE_TIME) ISubPicImpl::GetSegmentStart()
+{
+ if (m_rtSegmentStart)
+ return(m_rtSegmentStart);
+ return(m_rtStart);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) ISubPicImpl::GetSegmentStop()
+{
+ if (m_rtSegmentStop)
+ return(m_rtSegmentStop);
+ return(m_rtStop);
+}
+
+STDMETHODIMP_(void) ISubPicImpl::SetSegmentStart(REFERENCE_TIME rtStart)
+{
+ m_rtSegmentStart = rtStart;
+}
+
+STDMETHODIMP_(void) ISubPicImpl::SetSegmentStop(REFERENCE_TIME rtStop)
+{
+ m_rtSegmentStop = rtStop;
+}
+
+
+
STDMETHODIMP_(void) ISubPicImpl::SetStart(REFERENCE_TIME rtStart)
{
m_rtStart = rtStart;
@@ -71,6 +98,8 @@ STDMETHODIMP ISubPicImpl::CopyTo(ISubPic* pSubPic) pSubPic->SetStart(m_rtStart);
pSubPic->SetStop(m_rtStop);
+ pSubPic->SetSegmentStart(m_rtSegmentStart);
+ pSubPic->SetSegmentStop(m_rtSegmentStop);
pSubPic->SetDirtyRect(m_rcDirty);
pSubPic->SetSize(m_size, m_vidrect);
pSubPic->SetVirtualTextureSize(m_VirtualTextureSize, m_VirtualTextureTopLeft);
@@ -274,6 +303,7 @@ ISubPicQueueImpl::ISubPicQueueImpl(ISubPicAllocator* pAllocator, HRESULT* phr) : CUnknown(NAME("ISubPicQueueImpl"), NULL)
, m_pAllocator(pAllocator)
, m_rtNow(0)
+ , m_rtNowLast(0)
, m_fps(25.0)
{
if(phr) *phr = S_OK;
@@ -341,7 +371,7 @@ STDMETHODIMP ISubPicQueueImpl::SetTime(REFERENCE_TIME rtNow) // private
-HRESULT ISubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps)
+HRESULT ISubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps, BOOL bIsAnimated)
{
HRESULT hr = E_FAIL;
@@ -360,7 +390,7 @@ HRESULT ISubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REF && SUCCEEDED(pSubPic->Lock(spd)))
{
CRect r(0,0,0,0);
- hr = pSubPicProvider->Render(spd, (rtStart+rtStop)/2, fps, r);
+ hr = pSubPicProvider->Render(spd, bIsAnimated ? rtStart : ((rtStart+rtStop)/2), fps, r);
pSubPic->SetStart(rtStart);
pSubPic->SetStop(rtStop);
@@ -377,10 +407,12 @@ HRESULT ISubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REF // CSubPicQueue
//
-CSubPicQueue::CSubPicQueue(int nMaxSubPic, ISubPicAllocator* pAllocator, HRESULT* phr)
+CSubPicQueue::CSubPicQueue(int nMaxSubPic, BOOL bDisableAnim, ISubPicAllocator* pAllocator, HRESULT* phr)
: ISubPicQueueImpl(pAllocator, phr)
, m_nMaxSubPic(nMaxSubPic)
- , m_rtQueueStart(0)
+ , m_bDisableAnim(bDisableAnim)
+ ,m_rtQueueMin(0)
+ ,m_rtQueueMax(0)
{
if(phr && FAILED(*phr))
return;
@@ -433,43 +465,87 @@ STDMETHODIMP CSubPicQueue::Invalidate(REFERENCE_TIME rtInvalidate) m_rtInvalidate = rtInvalidate;
m_fBreakBuffering = true;
+#if DSubPicTraceLevel > 0
+ TRACE(_T("Invalidate: %f\n"), double(rtInvalidate) / 10000000.0);
+#endif
+
SetEvent(m_ThreadEvents[EVENT_TIME]);
}
return S_OK;
}
-STDMETHODIMP_(bool) CSubPicQueue::LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic)
+STDMETHODIMP_(bool) CSubPicQueue::LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &ppSubPic)
{
- if(!ppSubPic)
- return(false);
-
- *ppSubPic = NULL;
CAutoLock cQueueLock(&m_csQueueLock);
- POSITION pos = GetHeadPosition();
+ REFERENCE_TIME rtBestStop = 0x7fffffffffffffffi64;
+ POSITION pos = m_Queue.GetHeadPosition();
+#if DSubPicTraceLevel > 2
+ TRACE("Find: ");
+#endif
while(pos)
{
- CComPtr<ISubPic> pSubPic = GetNext(pos);
- if(pSubPic->GetStart() <= rtNow && rtNow < pSubPic->GetStop())
+ CComPtr<ISubPic> pSubPic = m_Queue.GetNext(pos);
+ REFERENCE_TIME rtStart = pSubPic->GetStart();
+ REFERENCE_TIME rtStop = pSubPic->GetStop();
+ REFERENCE_TIME rtSegmentStop = pSubPic->GetSegmentStop();
+ if(rtNow >= rtStart && rtNow < rtSegmentStop)
{
- *ppSubPic = pSubPic.Detach();
- break;
+ REFERENCE_TIME Diff = rtNow - rtStop;
+ if (Diff < rtBestStop)
+ {
+ rtBestStop = Diff;
+// TRACE(" %f->%f", double(Diff) / 10000000.0, double(rtStop) / 10000000.0);
+ ppSubPic = pSubPic;
+ }
+#if DSubPicTraceLevel > 2
+ else
+ TRACE(" !%f->%f", double(Diff) / 10000000.0, double(rtStop) / 10000000.0);
+#endif
}
+#if DSubPicTraceLevel > 2
+ else
+ TRACE(" !!%f->%f", double(rtStart) / 10000000.0, double(rtSegmentStop) / 10000000.0);
+#endif
+
+ }
+#if DSubPicTraceLevel > 2
+ TRACE("\n");
+#endif
+ if (!ppSubPic)
+ {
+#if DSubPicTraceLevel > 1
+ TRACE("NO Display: %f\n", double(rtNow) / 10000000.0);
+#endif
+ }
+ else
+ {
+#if DSubPicTraceLevel > 0
+ REFERENCE_TIME rtStart = (ppSubPic)->GetStart();
+ REFERENCE_TIME rtSegmentStop = (ppSubPic)->GetSegmentStop();
+ CRect r;
+ (ppSubPic)->GetDirtyRect(&r);
+ TRACE("Display: %f->%f %f %dx%d\n", double(rtStart) / 10000000.0, double(rtSegmentStop) / 10000000.0, double(rtNow) / 10000000.0, r.Width(), r.Height());
+#endif
}
- return(!!*ppSubPic);
+ return(!!ppSubPic);
}
STDMETHODIMP CSubPicQueue::GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
CAutoLock cQueueLock(&m_csQueueLock);
- nSubPics = GetCount();
+ nSubPics = m_Queue.GetCount();
rtNow = m_rtNow;
- rtStart = m_rtQueueStart;
- rtStop = GetCount() > 0 ? GetTail()->GetStop() : rtStart;
+ rtStart = m_rtQueueMin;
+ if (rtStart == 0x7fffffffffffffffi64)
+ rtStart = 0;
+ rtStop = m_rtQueueMax;
+ if (rtStop == 0xffffffffffffffffi64)
+ rtStop = 0;
return S_OK;
}
@@ -480,12 +556,12 @@ STDMETHODIMP CSubPicQueue::GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERE rtStart = rtStop = -1;
- if(nSubPic >= 0 && nSubPic < (int)GetCount())
+ if(nSubPic >= 0 && nSubPic < (int)m_Queue.GetCount())
{
- if(POSITION pos = FindIndex(nSubPic))
+ if(POSITION pos = m_Queue.FindIndex(nSubPic))
{
- rtStart = GetAt(pos)->GetStart();
- rtStop = GetAt(pos)->GetStop();
+ rtStart = m_Queue.GetAt(pos)->GetStart();
+ rtStop = m_Queue.GetAt(pos)->GetStop();
}
}
else
@@ -503,41 +579,114 @@ REFERENCE_TIME CSubPicQueue::UpdateQueue() CAutoLock cQueueLock(&m_csQueueLock);
REFERENCE_TIME rtNow = m_rtNow;
+ REFERENCE_TIME rtNowCompare = rtNow;
- if(rtNow < m_rtQueueStart)
+ if (rtNow < m_rtNowLast)
{
- RemoveAll();
+ m_Queue.RemoveAll();
+ m_rtNowLast = rtNow;
}
else
{
- while(GetCount() > 0 && rtNow >= GetHead()->GetStop())
- RemoveHead();
- }
+ m_rtNowLast = rtNow;
+
+ m_rtQueueMin = 0x7fffffffffffffffi64;
+ m_rtQueueMax = 0xffffffffffffffffi64;
+
+ REFERENCE_TIME rtBestStop = 0x7fffffffffffffffi64;
+ POSITION SavePos = 0;
+ {
+ POSITION Iter = m_Queue.GetHeadPosition();
+ while(Iter)
+ {
+ POSITION ThisPos = Iter;
+ ISubPic *pSubPic = m_Queue.GetNext(Iter);
+ REFERENCE_TIME rtStart = pSubPic->GetStart();
+ REFERENCE_TIME rtStop = pSubPic->GetStop();
+ REFERENCE_TIME rtSegmentStop = pSubPic->GetSegmentStop();
+ if(rtNow >= rtStart && rtNow < rtSegmentStop)
+ {
+ REFERENCE_TIME Diff = rtNow - rtStop;
+ if (Diff < rtBestStop)
+ {
+ rtBestStop = Diff;
+ SavePos = ThisPos;
+ }
+ }
+ }
+ }
+
+ #if DSubPicTraceLevel > 3
+ if (SavePos)
+ {
+ ISubPic *pSubPic = GetAt(SavePos);
+ REFERENCE_TIME rtStart = pSubPic->GetStart();
+ REFERENCE_TIME rtStop = pSubPic->GetStop();
+ TRACE("Save: %f->%f\n", double(rtStart) / 10000000.0, double(rtStop) / 10000000.0);
+ }
+ #endif
+ {
+ POSITION Iter = m_Queue.GetHeadPosition();
+ while(Iter)
+ {
+ POSITION ThisPos = Iter;
+ ISubPic *pSubPic = m_Queue.GetNext(Iter);
- m_rtQueueStart = rtNow;
+ REFERENCE_TIME rtStart = pSubPic->GetStart();
+ REFERENCE_TIME rtStop = pSubPic->GetStop();
- if(GetCount() > 0)
- rtNow = GetTail()->GetStop();
+ if (rtStop <= rtNowCompare && ThisPos != SavePos)
+ {
+ #if DSubPicTraceLevel > 0
+ TRACE("Remove: %f->%f\n", double(rtStart) / 10000000.0, double(rtStop) / 10000000.0);
+ #endif
+ m_Queue.RemoveAt(ThisPos);
+ continue;
+ }
+ if (rtStop > rtNow)
+ rtNow = rtStop;
+ m_rtQueueMin = min(m_rtQueueMin, rtStart);
+ m_rtQueueMax = max(m_rtQueueMax, rtStop);
+ }
+ }
+ }
return(rtNow);
}
+int CSubPicQueue::GetQueueCount()
+{
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ return m_Queue.GetCount();
+}
+
void CSubPicQueue::AppendQueue(ISubPic* pSubPic)
{
CAutoLock cQueueLock(&m_csQueueLock);
- AddTail(pSubPic);
+ m_Queue.AddTail(pSubPic);
}
// overrides
DWORD CSubPicQueue::ThreadProc()
{
- SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST/*THREAD_PRIORITY_BELOW_NORMAL*/);
+ BOOL bDisableAnim = m_bDisableAnim;
+ SetThreadPriority(m_hThread, bDisableAnim ? THREAD_PRIORITY_LOWEST : THREAD_PRIORITY_ABOVE_NORMAL/*THREAD_PRIORITY_BELOW_NORMAL*/);
- while((WaitForMultipleObjects(EVENT_COUNT, m_ThreadEvents, FALSE, INFINITE) - WAIT_OBJECT_0) == EVENT_TIME)
+ bool bAgain = true;
+ while(1)
{
+ DWORD Ret = WaitForMultipleObjects(EVENT_COUNT, m_ThreadEvents, FALSE, bAgain ? 0 : INFINITE);
+ bAgain = false;
+
+ if (Ret == WAIT_TIMEOUT)
+ ;
+ else if ((Ret - WAIT_OBJECT_0) != EVENT_TIME)
+ break;
double fps = m_fps;
+ REFERENCE_TIME rtTimePerFrame = 10000000.0/fps;
REFERENCE_TIME rtNow = UpdateQueue();
int nMaxSubPic = m_nMaxSubPic;
@@ -547,7 +696,7 @@ DWORD CSubPicQueue::ThreadProc() && SUCCEEDED(pSubPicProvider->Lock()))
{
for(POSITION pos = pSubPicProvider->GetStartPosition(rtNow, fps);
- pos && !m_fBreakBuffering && GetCount() < (size_t)nMaxSubPic;
+ pos && !m_fBreakBuffering && GetQueueCount() < (size_t)nMaxSubPic;
pos = pSubPicProvider->GetNext(pos))
{
REFERENCE_TIME rtStart = pSubPicProvider->GetStart(pos, fps);
@@ -564,33 +713,72 @@ DWORD CSubPicQueue::ThreadProc() if(rtNow < rtStop)
{
- SIZE MaxTextureSize, VirtualSize;
- POINT VirtualTopLeft;
- HRESULT hr2;
- if (SUCCEEDED (hr2 = pSubPicProvider->GetTextureSize(pos, MaxTextureSize, VirtualSize, VirtualTopLeft)))
- m_pAllocator->SetMaxTextureSize(MaxTextureSize);
-
- CComPtr<ISubPic> pStatic;
- if(FAILED(m_pAllocator->GetStatic(&pStatic)))
- break;
-
- HRESULT hr = RenderTo(pStatic, rtStart, rtStop, fps);
-
- if(FAILED(hr))
- break;
-
- if(S_OK != hr) // subpic was probably empty
- continue;
-
- CComPtr<ISubPic> pDynamic;
- if(FAILED(m_pAllocator->AllocDynamic(&pDynamic))
- || FAILED(pStatic->CopyTo(pDynamic)))
- break;
-
- if (SUCCEEDED (hr2))
- pDynamic->SetVirtualTextureSize (VirtualSize, VirtualTopLeft);
+ REFERENCE_TIME rtCurrent = max(rtNow, rtStart);
+ bool bIsAnimated = pSubPicProvider->IsAnimated(pos) && !bDisableAnim;
+ while (rtCurrent < rtStop)
+ {
+
+ SIZE MaxTextureSize, VirtualSize;
+ POINT VirtualTopLeft;
+ HRESULT hr2;
+ if (SUCCEEDED (hr2 = pSubPicProvider->GetTextureSize(pos, MaxTextureSize, VirtualSize, VirtualTopLeft)))
+ m_pAllocator->SetMaxTextureSize(MaxTextureSize);
- AppendQueue(pDynamic);
+ CComPtr<ISubPic> pStatic;
+ if(FAILED(m_pAllocator->GetStatic(&pStatic)))
+ break;
+
+ HRESULT hr;
+ if (bIsAnimated)
+ {
+ if (rtCurrent < m_rtNow + rtTimePerFrame)
+ rtCurrent = min(m_rtNow + rtTimePerFrame, rtStop-1);
+
+ REFERENCE_TIME rtEndThis = min(rtCurrent + rtTimePerFrame, rtStop);
+ hr = RenderTo(pStatic, rtCurrent, rtEndThis, fps, bIsAnimated);
+ pStatic->SetSegmentStart(rtStart);
+ pStatic->SetSegmentStop(rtStop);
+#if DSubPicTraceLevel > 0
+ CRect r;
+ pStatic->GetDirtyRect(&r);
+ TRACE("Render: %f->%f %f->%f %dx%d\n", double(rtCurrent) / 10000000.0, double(rtEndThis) / 10000000.0, double(rtStart) / 10000000.0, double(rtStop) / 10000000.0, r.Width(), r.Height());
+#endif
+ rtCurrent = rtEndThis;
+
+
+ }
+ else
+ {
+ hr = RenderTo(pStatic, rtStart, rtStop, fps, bIsAnimated);
+ rtCurrent = rtStop;
+ }
+#if DSubPicTraceLevel > 0
+ if (m_rtNow > rtCurrent)
+ {
+ TRACE("BEHIND\n");
+ }
+#endif
+
+ if(FAILED(hr))
+ break;
+
+ if(S_OK != hr) // subpic was probably empty
+ continue;
+
+ CComPtr<ISubPic> pDynamic;
+ if(FAILED(m_pAllocator->AllocDynamic(&pDynamic))
+ || FAILED(pStatic->CopyTo(pDynamic)))
+ break;
+
+ if (SUCCEEDED (hr2))
+ pDynamic->SetVirtualTextureSize (VirtualSize, VirtualTopLeft);
+
+ AppendQueue(pDynamic);
+ bAgain = true;
+
+ if (GetQueueCount() >= (size_t)nMaxSubPic)
+ break;
+ }
}
}
@@ -599,15 +787,40 @@ DWORD CSubPicQueue::ThreadProc() if(m_fBreakBuffering)
{
+ bAgain = true;
CAutoLock cQueueLock(&m_csQueueLock);
REFERENCE_TIME rtInvalidate = m_rtInvalidate;
+ POSITION Iter = m_Queue.GetHeadPosition();
+ while(Iter)
+ {
+ POSITION ThisPos = Iter;
+ ISubPic *pSubPic = m_Queue.GetNext(Iter);
+
+ REFERENCE_TIME rtStart = pSubPic->GetStart();
+ REFERENCE_TIME rtStop = pSubPic->GetStop();
+
+ if (rtStop > rtInvalidate)
+ {
+#if DSubPicTraceLevel >= 0
+ TRACE(_T("Removed subtitle because of invalidation: %f->%f\n"), double(rtStart) / 10000000.0, double(rtStop) / 10000000.0);
+#endif
+ m_Queue.RemoveAt(ThisPos);
+ continue;
+ }
+ }
+
+/*
while(GetCount() && GetTail()->GetStop() > rtInvalidate)
{
if(GetTail()->GetStart() < rtInvalidate) GetTail()->SetStop(rtInvalidate);
- else RemoveTail();
+ else
+ {
+ RemoveTail();
+ }
}
+ */
m_fBreakBuffering = false;
}
@@ -640,12 +853,8 @@ STDMETHODIMP CSubPicQueueNoThread::Invalidate(REFERENCE_TIME rtInvalidate) return S_OK;
}
-STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic)
+STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &ppSubPic)
{
- if(!ppSubPic)
- return(false);
-
- *ppSubPic = NULL;
CComPtr<ISubPic> pSubPic;
@@ -663,7 +872,7 @@ STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, ISu if(pSubPic->GetStart() <= rtNow && rtNow < pSubPic->GetStop())
{
- (*ppSubPic = pSubPic)->AddRef();
+ ppSubPic = pSubPic;
}
else
{
@@ -696,14 +905,14 @@ STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, ISu {
CComPtr<ISubPic> pStatic;
if(SUCCEEDED(m_pAllocator->GetStatic(&pStatic))
- && SUCCEEDED(RenderTo(pStatic, rtStart, rtStop, fps))
+ && SUCCEEDED(RenderTo(pStatic, rtStart, rtStop, fps, false))
&& SUCCEEDED(pStatic->CopyTo(pSubPic)))
- (*ppSubPic = pSubPic)->AddRef();
+ ppSubPic = pSubPic;
}
else
{
- if(SUCCEEDED(RenderTo(m_pSubPic, rtStart, rtStop, fps)))
- (*ppSubPic = pSubPic)->AddRef();
+ if(SUCCEEDED(RenderTo(m_pSubPic, rtStart, rtStop, fps, false)))
+ ppSubPic = pSubPic;
}
if (SUCCEEDED(hr2))
pSubPic->SetVirtualTextureSize (VirtualSize, VirtualTopLeft);
@@ -712,16 +921,16 @@ STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, ISu pSubPicProvider->Unlock();
- if(*ppSubPic)
+ if(ppSubPic)
{
CAutoLock cAutoLock(&m_csLock);
- m_pSubPic = *ppSubPic;
+ m_pSubPic = ppSubPic;
}
}
}
- return(!!*ppSubPic);
+ return(!!ppSubPic);
}
STDMETHODIMP CSubPicQueueNoThread::GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
@@ -759,7 +968,7 @@ STDMETHODIMP CSubPicQueueNoThread::GetStats(int nSubPic, REFERENCE_TIME& rtStart // ISubPicAllocatorPresenterImpl
//
-ISubPicAllocatorPresenterImpl::ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr)
+ISubPicAllocatorPresenterImpl::ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr, CString *_pError)
: CUnknown(NAME("ISubPicAllocatorPresenterImpl"), NULL)
, m_hWnd(hWnd)
, m_NativeVideoSize(0, 0), m_AspectRatio(0, 0)
@@ -767,7 +976,13 @@ ISubPicAllocatorPresenterImpl::ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& , m_fps(25.0)
, m_lSubtitleDelay(0)
{
- if(!IsWindow(m_hWnd)) {hr = E_INVALIDARG; return;}
+ if(!IsWindow(m_hWnd))
+ {
+ hr = E_INVALIDARG;
+ if (_pError)
+ *_pError += "Invalid window handle in ISubPicAllocatorPresenterImpl\n";
+ return;
+ }
GetWindowRect(m_hWnd, &m_WindowRect);
SetVideoAngle(Vector(), false);
hr = S_OK;
@@ -779,15 +994,17 @@ ISubPicAllocatorPresenterImpl::~ISubPicAllocatorPresenterImpl() STDMETHODIMP ISubPicAllocatorPresenterImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
+
return
QI(ISubPicAllocatorPresenter)
+ QI(ISubPicAllocatorPresenter2)
__super::NonDelegatingQueryInterface(riid, ppv);
}
void ISubPicAllocatorPresenterImpl::AlphaBltSubPic(CSize size, SubPicDesc* pTarget)
{
CComPtr<ISubPic> pSubPic;
- if(m_pSubPicQueue->LookupSubPic(m_rtNow, &pSubPic))
+ if(m_pSubPicQueue->LookupSubPic(m_rtNow, pSubPic))
{
CRect rcSource, rcDest;
if (SUCCEEDED (pSubPic->GetSourceAndDest(&size, rcSource, rcDest)))
diff --git a/src/subpic/ISubPic.h b/src/subpic/ISubPic.h index e4aab9427..4b4cb5bb2 100644 --- a/src/subpic/ISubPic.h +++ b/src/subpic/ISubPic.h @@ -69,12 +69,18 @@ interface ISubPic : public IUnknown STDMETHOD (AlphaBlt) (RECT* pSrc, RECT* pDst, SubPicDesc* pTarget = NULL /*[in]*/) PURE;
STDMETHOD (GetSourceAndDest) (SIZE* pSize /*[in]*/, RECT* pRcSource /*[out]*/, RECT* pRcDest /*[out]*/) PURE;
STDMETHOD (SetVirtualTextureSize) (const SIZE pSize, const POINT pTopLeft) PURE;
+
+ STDMETHOD_(REFERENCE_TIME, GetSegmentStart) () PURE;
+ STDMETHOD_(REFERENCE_TIME, GetSegmentStop) () PURE;
+ STDMETHOD_(void, SetSegmentStart) (REFERENCE_TIME rtStart) PURE;
+ STDMETHOD_(void, SetSegmentStop) (REFERENCE_TIME rtStop) PURE;
};
class ISubPicImpl : public CUnknown, public ISubPic
{
protected:
REFERENCE_TIME m_rtStart, m_rtStop;
+ REFERENCE_TIME m_rtSegmentStart, m_rtSegmentStop;
CRect m_rcDirty;
CSize m_maxsize;
CSize m_size;
@@ -142,6 +148,12 @@ public: STDMETHODIMP SetVirtualTextureSize (const SIZE pSize, const POINT pTopLeft);
STDMETHODIMP GetSourceAndDest(SIZE* pSize, RECT* pRcSource, RECT* pRcDest);
+
+ STDMETHODIMP_(REFERENCE_TIME) GetSegmentStart();
+ STDMETHODIMP_(REFERENCE_TIME) GetSegmentStop();
+ STDMETHODIMP_(void) SetSegmentStart(REFERENCE_TIME rtStart);
+ STDMETHODIMP_(void) SetSegmentStop(REFERENCE_TIME rtStop);
+
};
//
@@ -258,7 +270,7 @@ interface ISubPicQueue : public IUnknown STDMETHOD (SetTime) (REFERENCE_TIME rtNow /*[in]*/) PURE;
STDMETHOD (Invalidate) (REFERENCE_TIME rtInvalidate = -1) PURE;
- STDMETHOD_(bool, LookupSubPic) (REFERENCE_TIME rtNow /*[in]*/, ISubPic** ppSubPic /*[out]*/) PURE;
+ STDMETHOD_(bool, LookupSubPic) (REFERENCE_TIME rtNow /*[in]*/, CComPtr<ISubPic> &pSubPic /*[out]*/) PURE;
STDMETHOD (GetStats) (int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;
STDMETHOD (GetStats) (int nSubPic /*[in]*/, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;
@@ -272,10 +284,11 @@ class ISubPicQueueImpl : public CUnknown, public ISubPicQueue protected:
double m_fps;
REFERENCE_TIME m_rtNow;
+ REFERENCE_TIME m_rtNowLast;
CComPtr<ISubPicAllocator> m_pAllocator;
- HRESULT RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps);
+ HRESULT RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps, BOOL bIsAnimated);
public:
ISubPicQueueImpl(ISubPicAllocator* pAllocator, HRESULT* phr);
@@ -300,15 +313,21 @@ public: */
};
-class CSubPicQueue : public ISubPicQueueImpl, private CInterfaceList<ISubPic>, private CAMThread
+class CSubPicQueue : public ISubPicQueueImpl, private CAMThread
{
int m_nMaxSubPic;
+ BOOL m_bDisableAnim;
+
+ CInterfaceList<ISubPic> m_Queue;
CCritSec m_csQueueLock; // for protecting CInterfaceList<ISubPic>
REFERENCE_TIME UpdateQueue();
void AppendQueue(ISubPic* pSubPic);
+ int GetQueueCount();
- REFERENCE_TIME m_rtQueueStart, m_rtInvalidate;
+ REFERENCE_TIME m_rtQueueMin;
+ REFERENCE_TIME m_rtQueueMax;
+ REFERENCE_TIME m_rtInvalidate;
// CAMThread
@@ -318,7 +337,7 @@ class CSubPicQueue : public ISubPicQueueImpl, private CInterfaceList<ISubPic>, p DWORD ThreadProc();
public:
- CSubPicQueue(int nMaxSubPic, ISubPicAllocator* pAllocator, HRESULT* phr);
+ CSubPicQueue(int nMaxSubPic, BOOL bDisableAnim, ISubPicAllocator* pAllocator, HRESULT* phr);
virtual ~CSubPicQueue();
// ISubPicQueue
@@ -327,7 +346,7 @@ public: STDMETHODIMP SetTime(REFERENCE_TIME rtNow);
STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1);
- STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic);
+ STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &pSubPic);
STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
@@ -345,7 +364,7 @@ public: // ISubPicQueue
STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1);
- STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic);
+ STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, CComPtr<ISubPic> &pSubPic);
STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
@@ -378,10 +397,16 @@ interface ISubPicAllocatorPresenter : public IUnknown STDMETHOD (SetPixelShader) (LPCSTR pSrcData, LPCSTR pTarget) PURE;
};
+[uuid("767AEBA8-A084-488a-89C8-F6B74E53A90F")]
+interface ISubPicAllocatorPresenter2 : public ISubPicAllocatorPresenter
+{
+ STDMETHOD (SetPixelShader2) (LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace) PURE;
+};
+
class ISubPicAllocatorPresenterImpl
: public CUnknown
, public CCritSec
- , public ISubPicAllocatorPresenter
+ , public ISubPicAllocatorPresenter2
{
protected:
HWND m_hWnd;
@@ -405,7 +430,7 @@ protected: void Transform(CRect r, Vector v[4]);
public:
- ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr);
+ ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr, CString *_pError);
virtual ~ISubPicAllocatorPresenterImpl();
DECLARE_IUNKNOWN;
@@ -431,6 +456,12 @@ public: STDMETHODIMP SetVideoAngle(Vector v, bool fRepaint = true);
STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget) {return E_NOTIMPL;}
+ STDMETHODIMP SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace)
+ {
+ if (!bScreenSpace)
+ return SetPixelShader(pSrcData, pTarget);
+ return E_NOTIMPL;
+ }
};
//
diff --git a/src/subpic/MemSubPic.cpp b/src/subpic/MemSubPic.cpp index 27b81e595..4157460a7 100644 --- a/src/subpic/MemSubPic.cpp +++ b/src/subpic/MemSubPic.cpp @@ -595,10 +595,10 @@ bool CMemSubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic) spd.bpp = 32;
spd.pitch = (spd.w*spd.bpp)>>3;
spd.type = m_type;
- if(!(spd.bits = new BYTE[spd.pitch*spd.h]))
+ if(!(spd.bits = DNew BYTE[spd.pitch*spd.h]))
return(false);
- if(!(*ppSubPic = new CMemSubPic(spd)))
+ if(!(*ppSubPic = DNew CMemSubPic(spd)))
return(false);
(*ppSubPic)->AddRef();
diff --git a/src/subpic/stdafx.h b/src/subpic/stdafx.h index 39c3ae8e5..1d55b960e 100644 --- a/src/subpic/stdafx.h +++ b/src/subpic/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/subpic/subpic.vcproj b/src/subpic/subpic.vcproj index f511f5754..7db2b4cbd 100644 --- a/src/subpic/subpic.vcproj +++ b/src/subpic/subpic.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="subpic"
ProjectGUID="{D514EA4D-EAFB-47A9-A437-A582CA571251}"
RootNamespace="subpic"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
<Tool
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
/>
diff --git a/src/subtitles/CCDecoder.cpp b/src/subtitles/CCDecoder.cpp index 503b4af5e..2eb033e88 100644 --- a/src/subtitles/CCDecoder.cpp +++ b/src/subtitles/CCDecoder.cpp @@ -337,8 +337,8 @@ void CCDecoder::ExtractCC(BYTE* buff, int len, __int64 time) {
nBytes = (nBytes+1)&~1;
- BYTE* pData1 = new BYTE[nBytes];
- BYTE* pData2 = new BYTE[nBytes];
+ BYTE* pData1 = DNew BYTE[nBytes];
+ BYTE* pData2 = DNew BYTE[nBytes];
if(pData1 && pData2)
{
diff --git a/src/subtitles/HdmvSub.cpp b/src/subtitles/HdmvSub.cpp index 582fdbd3f..79ed365af 100644 --- a/src/subtitles/HdmvSub.cpp +++ b/src/subtitles/HdmvSub.cpp @@ -67,7 +67,7 @@ void CHdmvSub::AllocSegment(int nSize) if (nSize > m_nTotalSegBuffer)
{
delete[] m_pSegBuffer;
- m_pSegBuffer = new BYTE[nSize];
+ m_pSegBuffer = DNew BYTE[nSize];
m_nTotalSegBuffer = nSize;
}
m_nSegBufferPos = 0;
@@ -207,7 +207,7 @@ int CHdmvSub::ParsePresentationSegment(CGolombBuffer* pGBuffer) if (nObjectNumber > 0)
{
delete m_pCurrentObject;
- m_pCurrentObject = new CompositionObject();
+ m_pCurrentObject = DNew CompositionObject();
ParseCompositionObject (pGBuffer, m_pCurrentObject);
}
@@ -410,7 +410,7 @@ void CHdmvSub::CompositionObject::SetPalette (int nNbEntry, HDMV_PALETTE* pPalet void CHdmvSub::CompositionObject::SetRLEData(BYTE* pBuffer, int nSize, int nTotalSize)
{
delete[] m_pRLEData;
- m_pRLEData = new BYTE[nTotalSize];
+ m_pRLEData = DNew BYTE[nTotalSize];
m_nRLEDataSize = nTotalSize;
m_nRLEPos = nSize;
diff --git a/src/subtitles/HdmvSub.h b/src/subtitles/HdmvSub.h index 4e5184bd4..00dad8f05 100644 --- a/src/subtitles/HdmvSub.h +++ b/src/subtitles/HdmvSub.h @@ -123,7 +123,7 @@ public: HRESULT ParseSample (IMediaSample* pSample);
- int GetActiveObjects() { return m_pObjects.GetCount(); };
+ int GetActiveObjects() { return (int)m_pObjects.GetCount(); };
POSITION GetStartPosition(REFERENCE_TIME rt, double fps);
POSITION GetNext(POSITION pos) { m_pObjects.GetNext(pos); return pos; };
diff --git a/src/subtitles/RTS.cpp b/src/subtitles/RTS.cpp index 9ea718486..c2fb9b2ff 100644 --- a/src/subtitles/RTS.cpp +++ b/src/subtitles/RTS.cpp @@ -202,7 +202,7 @@ bool CWord::CreateOpaqueBox() m_width+w, m_ascent+m_descent+h,
-w, m_ascent+m_descent+h);
- m_pOpaqueBox = new CPolygon(style, str, 0, 0, 0, 1.0/8, 1.0/8, 0);
+ m_pOpaqueBox = DNew CPolygon(style, str, 0, 0, 0, 1.0/8, 1.0/8, 0);
return(!!m_pOpaqueBox);
}
@@ -247,7 +247,7 @@ CText::CText(STSStyle& style, CStringW str, int ktype, int kstart, int kend) CWord* CText::Copy()
{
- return(new CText(m_style, m_str, m_ktype, m_kstart, m_kend));
+ return(DNew CText(m_style, m_str, m_ktype, m_kstart, m_kend));
}
bool CText::Append(CWord* w)
@@ -309,7 +309,7 @@ CPolygon::~CPolygon() CWord* CPolygon::Copy()
{
- return(new CPolygon(m_style, m_str, m_ktype, m_kstart, m_kend, m_scalex, m_scaley, m_baseline));
+ return(DNew CPolygon(m_style, m_str, m_ktype, m_kstart, m_kend, m_scalex, m_scaley, m_baseline));
}
bool CPolygon::Append(CWord* w)
@@ -525,7 +525,7 @@ CClipper::CClipper(CStringW str, CSize size, double scalex, double scaley, bool m_size.cx = m_size.cy = 0;
m_pAlphaMask = NULL;
- if(size.cx < 0 || size.cy < 0 || !(m_pAlphaMask = new BYTE[size.cx*size.cy])) return;
+ if(size.cx < 0 || size.cy < 0 || !(m_pAlphaMask = DNew BYTE[size.cx*size.cy])) return;
m_size = size;
m_inverse = inverse;
@@ -574,7 +574,7 @@ CClipper::~CClipper() CWord* CClipper::Copy()
{
- return(new CClipper(m_str, m_size, m_scalex, m_scaley, m_inverse));
+ return(DNew CClipper(m_str, m_size, m_scalex, m_scaley, m_inverse));
}
bool CClipper::Append(CWord* w)
@@ -891,7 +891,7 @@ CLine* CSubtitle::GetNextLine(POSITION& pos, int maxwidth) {
if(pos == NULL) return(NULL);
- CLine* ret = new CLine();
+ CLine* ret = DNew CLine();
if(!ret) return(NULL);
ret->m_width = ret->m_ascent = ret->m_descent = ret->m_borderX = ret->m_borderY = 0;
@@ -975,7 +975,7 @@ void CSubtitle::CreateClippers(CSize size) {
CStringW str;
str.Format(L"m %d %d l %d %d %d %d %d %d", 0, 0, w, 0, w, h, 0, h);
- m_pClipper = new CClipper(str, size, 1, 1, false);
+ m_pClipper = DNew CClipper(str, size, 1, 1, false);
if(!m_pClipper) return;
}
@@ -1009,7 +1009,7 @@ void CSubtitle::CreateClippers(CSize size) {
CStringW str;
str.Format(L"m %d %d l %d %d %d %d %d %d", 0, 0, w, 0, w, h, 0, h);
- m_pClipper = new CClipper(str, size, 1, 1, false);
+ m_pClipper = DNew CClipper(str, size, 1, 1, false);
if(!m_pClipper) return;
}
@@ -1293,7 +1293,7 @@ void CRenderedTextSubtitle::ParseEffect(CSubtitle* sub, CString str) int delay, lefttoright = 0, fadeawaywidth = 0;
if(_stscanf(s, _T("%d;%d;%d"), &delay, &lefttoright, &fadeawaywidth) < 1) return;
- Effect* e = new Effect;
+ Effect* e = DNew Effect;
if(!e) return;
sub->m_effects[e->type = EF_BANNER] = e;
@@ -1310,7 +1310,7 @@ void CRenderedTextSubtitle::ParseEffect(CSubtitle* sub, CString str) if(top > bottom) {int tmp = top; top = bottom; bottom = tmp;}
- Effect* e = new Effect;
+ Effect* e = DNew Effect;
if(!e) return;
sub->m_effects[e->type = EF_SCROLL] = e;
@@ -1339,7 +1339,7 @@ void CRenderedTextSubtitle::ParseString(CSubtitle* sub, CStringW str, STSStyle& if(i < j)
{
- if(CWord* w = new CText(style, str.Mid(i, j-i), m_ktype, m_kstart, m_kend))
+ if(CWord* w = DNew CText(style, str.Mid(i, j-i), m_ktype, m_kstart, m_kend))
{
sub->m_words.AddTail(w);
m_kstart = m_kend;
@@ -1348,7 +1348,7 @@ void CRenderedTextSubtitle::ParseString(CSubtitle* sub, CStringW str, STSStyle& if(c == '\n')
{
- if(CWord* w = new CText(style, CStringW(), m_ktype, m_kstart, m_kend))
+ if(CWord* w = DNew CText(style, CStringW(), m_ktype, m_kstart, m_kend))
{
sub->m_words.AddTail(w);
m_kstart = m_kend;
@@ -1356,7 +1356,7 @@ void CRenderedTextSubtitle::ParseString(CSubtitle* sub, CStringW str, STSStyle& }
else if(c == ' ' || c == '\x00A0')
{
- if(CWord* w = new CText(style, CStringW(c), m_ktype, m_kstart, m_kend))
+ if(CWord* w = DNew CText(style, CStringW(c), m_ktype, m_kstart, m_kend))
{
sub->m_words.AddTail(w);
m_kstart = m_kend;
@@ -1373,7 +1373,7 @@ void CRenderedTextSubtitle::ParsePolygon(CSubtitle* sub, CStringW str, STSStyle& {
if(!sub || !str.GetLength() || !m_nPolygon) return;
- if(CWord* w = new CPolygon(style, str, m_ktype, m_kstart, m_kend, sub->m_scalex/(1<<(m_nPolygon-1)), sub->m_scaley/(1<<(m_nPolygon-1)), m_polygonBaselineOffset))
+ if(CWord* w = DNew CPolygon(style, str, m_ktype, m_kstart, m_kend, sub->m_scalex/(1<<(m_nPolygon-1)), sub->m_scaley/(1<<(m_nPolygon-1)), m_polygonBaselineOffset))
{
sub->m_words.AddTail(w);
m_kstart = m_kend;
@@ -1588,12 +1588,12 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& if(params.GetCount() == 1 && !sub->m_pClipper)
{
- sub->m_pClipper = new CClipper(params[0], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex, sub->m_scaley, invert);
+ sub->m_pClipper = DNew CClipper(params[0], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex, sub->m_scaley, invert);
}
else if(params.GetCount() == 2 && !sub->m_pClipper)
{
int scale = max(wcstol(p, NULL, 10), 1);
- sub->m_pClipper = new CClipper(params[1], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex/(1<<(scale-1)), sub->m_scaley/(1<<(scale-1)), invert);
+ sub->m_pClipper = DNew CClipper(params[1], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex/(1<<(scale-1)), sub->m_scaley/(1<<(scale-1)), invert);
}
else if(params.GetCount() == 4)
{
@@ -1635,7 +1635,7 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& {
if(params.GetCount() == 7 && !sub->m_effects[EF_FADE])// {\fade(a1=param[0], a2=param[1], a3=param[2], t1=t[0], t2=t[1], t3=t[2], t4=t[3])
{
- if(Effect* e = new Effect)
+ if(Effect* e = DNew Effect)
{
for(int i = 0; i < 3; i++)
e->param[i] = wcstol(params[i], NULL, 10);
@@ -1647,7 +1647,7 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& }
else if(params.GetCount() == 2 && !sub->m_effects[EF_FADE]) // {\fad(t1=t[1], t2=t[2])
{
- if(Effect* e = new Effect)
+ if(Effect* e = DNew Effect)
{
e->param[0] = e->param[2] = 0xff;
e->param[1] = 0x00;
@@ -1789,7 +1789,7 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& {
if((params.GetCount() == 4 || params.GetCount() == 6) && !sub->m_effects[EF_MOVE])
{
- if(Effect* e = new Effect)
+ if(Effect* e = DNew Effect)
{
e->param[0] = (int)(sub->m_scalex*wcstod(params[0], NULL)*8);
e->param[1] = (int)(sub->m_scaley*wcstod(params[1], NULL)*8);
@@ -1812,7 +1812,7 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& {
if(params.GetCount() == 2 && !sub->m_effects[EF_ORG])
{
- if(Effect* e = new Effect)
+ if(Effect* e = DNew Effect)
{
e->param[0] = (int)(sub->m_scalex*wcstod(params[0], NULL)*8);
e->param[1] = (int)(sub->m_scaley*wcstod(params[1], NULL)*8);
@@ -1829,7 +1829,7 @@ bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& {
if(params.GetCount() == 2 && !sub->m_effects[EF_MOVE])
{
- if(Effect* e = new Effect)
+ if(Effect* e = DNew Effect)
{
e->param[0] = e->param[2] = (int)(sub->m_scalex*wcstod(params[0], NULL)*8);
e->param[1] = e->param[3] = (int)(sub->m_scaley*wcstod(params[1], NULL)*8);
@@ -2095,7 +2095,7 @@ CSubtitle* CRenderedTextSubtitle::GetSubtitle(int entry) else return(sub);
}
- sub = new CSubtitle();
+ sub = DNew CSubtitle();
if(!sub) return(NULL);
CStringW str = GetStrW(entry, true);
diff --git a/src/subtitles/Rasterizer.cpp b/src/subtitles/Rasterizer.cpp index 412bd30dd..fd97f1331 100644 --- a/src/subtitles/Rasterizer.cpp +++ b/src/subtitles/Rasterizer.cpp @@ -316,8 +316,8 @@ bool Rasterizer::PartialEndPath(HDC hdc, long dx, long dy) if(pNewPoints)
mpPathPoints = pNewPoints;
- BYTE* pTypes = new BYTE[nPoints];
- POINT* pPoints = new POINT[nPoints];
+ BYTE* pTypes = DNew BYTE[nPoints];
+ POINT* pPoints = DNew POINT[nPoints];
if(pNewTypes && pNewPoints && nPoints == GetPath(hdc, pPoints, pTypes, nPoints))
{
@@ -415,7 +415,7 @@ bool Rasterizer::ScanConvert() // Initialize scanline list.
- mpScanBuffer = new unsigned int[mHeight];
+ mpScanBuffer = DNew unsigned int[mHeight];
memset(mpScanBuffer, 0, mHeight*sizeof(unsigned int));
// Scan convert the outline. Yuck, Bezier curves....
@@ -729,7 +729,7 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) mOverlayWidth = ((width+7)>>3) + 1;
mOverlayHeight = ((height+7)>>3) + 1;
- mpOverlayBuffer = new byte[2 * mOverlayWidth * mOverlayHeight];
+ mpOverlayBuffer = DNew byte[2 * mOverlayWidth * mOverlayHeight];
memset(mpOverlayBuffer, 0, 2 * mOverlayWidth * mOverlayHeight);
// Are we doing a border?
@@ -780,7 +780,7 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) {
int pitch = mOverlayWidth*2;
- byte *tmp = new byte[pitch*mOverlayHeight];
+ byte *tmp = DNew byte[pitch*mOverlayHeight];
if(!tmp) return(false);
int border = !mWideOutline.empty() ? 1 : 0;
@@ -802,7 +802,7 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) {
int pitch = mOverlayWidth*2;
- byte* tmp = new byte[pitch*mOverlayHeight];
+ byte* tmp = DNew byte[pitch*mOverlayHeight];
if(!tmp) return(false);
memcpy(tmp, mpOverlayBuffer, pitch*mOverlayHeight);
diff --git a/src/subtitles/SSF.cpp b/src/subtitles/SSF.cpp index e0eed33c7..3eb87224a 100644 --- a/src/subtitles/SSF.cpp +++ b/src/subtitles/SSF.cpp @@ -82,9 +82,9 @@ namespace ssf try
{
- m_file.Attach(new SubtitleFile());
+ m_file.Attach(DNew SubtitleFile());
m_file->Parse(s);
- m_renderer.Attach(new Renderer());
+ m_renderer.Attach(DNew Renderer());
m_name = name;
return true;
}
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp index 01ab71e3e..c3efe9380 100644 --- a/src/subtitles/STS.cpp +++ b/src/subtitles/STS.cpp @@ -668,7 +668,7 @@ static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet static STSStyle* GetMicroDVDStyle(CString str, int CharSet)
{
- STSStyle* ret = new STSStyle();
+ STSStyle* ret = DNew STSStyle();
if(!ret) return(NULL);
for(int i = 0, len = str.GetLength(); i < len; i++)
@@ -1275,7 +1275,7 @@ static bool LoadFont(CString& font) if(!CFileGetStatus(fn, fs))
{
CFile f;
- if(f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
+ if(f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyNone))
{
f.Write(pData, datalen);
f.Close();
@@ -1395,7 +1395,7 @@ static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int C }
else if(entry == L"style")
{
- STSStyle* style = new STSStyle;
+ STSStyle* style = DNew STSStyle;
if(!style) return(false);
try
@@ -1563,7 +1563,7 @@ static bool OpenXombieSub(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet }
else if(entry == L"style")
{
- STSStyle* style = new STSStyle;
+ STSStyle* style = DNew STSStyle;
if(!style) return(false);
try
@@ -1867,7 +1867,7 @@ bool CSimpleTextSubtitle::CopyStyles(const CSTSStyleMap& styles, bool fAppend) STSStyle* val;
styles.GetNextAssoc(pos, key, val);
- STSStyle* s = new STSStyle;
+ STSStyle* s = DNew STSStyle;
if(!s) return(false);
*s = *val;
@@ -2046,7 +2046,7 @@ STSStyle* CSimpleTextSubtitle::CreateDefaultStyle(int CharSet) if(!m_styles.Lookup(def, ret))
{
- STSStyle* style = new STSStyle();
+ STSStyle* style = DNew STSStyle();
style->charSet = CharSet;
AddStyle(def, style);
m_styles.Lookup(def, ret);
diff --git a/src/subtitles/SeparableFilter.h b/src/subtitles/SeparableFilter.h index d88988b3c..895d9c1bf 100644 --- a/src/subtitles/SeparableFilter.h +++ b/src/subtitles/SeparableFilter.h @@ -104,7 +104,7 @@ struct GaussianKernel { { width = (int)(sigma*3 + 0.5) | 1; // binary-or with 1 to make sure the number is odd if (width < 3) width = 3; - kernel = new int[width]; + kernel = DNew int[width]; kernel[width/2] = (int)(NormalDist(sigma, 0) * 255); divisor = kernel[width/2]; for (int x = width/2-1; x >= 0; x--) { diff --git a/src/subtitles/SubtitleInputPin.cpp b/src/subtitles/SubtitleInputPin.cpp index 03a5d1d1a..7c4616506 100644 --- a/src/subtitles/SubtitleInputPin.cpp +++ b/src/subtitles/SubtitleInputPin.cpp @@ -72,7 +72,7 @@ HRESULT CSubtitleInputPin::CompleteConnect(IPin* pReceivePin) {
if(m_mt.majortype == MEDIATYPE_Text)
{
- if(!(m_pSubStream = new CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
+ if(!(m_pSubStream = DNew CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
pRTS->m_name = CString(GetPinName(pReceivePin)) + _T(" (embeded)");
pRTS->m_dstScreenSize = CSize(384, 288);
@@ -94,7 +94,7 @@ HRESULT CSubtitleInputPin::CompleteConnect(IPin* pReceivePin) || m_mt.subtype == MEDIASUBTYPE_ASS
|| m_mt.subtype == MEDIASUBTYPE_ASS2)
{
- if(!(m_pSubStream = new CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
+ if(!(m_pSubStream = DNew CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
pRTS->m_name = name;
pRTS->m_lcid = lcid;
@@ -120,19 +120,19 @@ HRESULT CSubtitleInputPin::CompleteConnect(IPin* pReceivePin) }
else if(m_mt.subtype == MEDIASUBTYPE_SSF)
{
- if(!(m_pSubStream = new ssf::CRenderer(m_pSubLock))) return E_FAIL;
+ if(!(m_pSubStream = DNew ssf::CRenderer(m_pSubLock))) return E_FAIL;
ssf::CRenderer* pSSF = (ssf::CRenderer*)(ISubStream*)m_pSubStream;
pSSF->Open(ssf::MemoryInputStream(m_mt.pbFormat + dwOffset, m_mt.cbFormat - dwOffset, false, false), name);
}
else if(m_mt.subtype == MEDIASUBTYPE_VOBSUB)
{
- if(!(m_pSubStream = new CVobSubStream(m_pSubLock))) return E_FAIL;
+ if(!(m_pSubStream = DNew CVobSubStream(m_pSubLock))) return E_FAIL;
CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)m_pSubStream;
pVSS->Open(name, m_mt.pbFormat + dwOffset, m_mt.cbFormat - dwOffset);
}
else if (m_mt.subtype == MEDIASUBTYPE_HDMVSUB)
{
- if(!(m_pSubStream = new CRenderedHdmvSubtitle(m_pSubLock))) return E_FAIL;
+ if(!(m_pSubStream = DNew CRenderedHdmvSubtitle(m_pSubLock))) return E_FAIL;
}
}
diff --git a/src/subtitles/TextFile.cpp b/src/subtitles/TextFile.cpp index c07a4f3a3..d236e65d9 100644 --- a/src/subtitles/TextFile.cpp +++ b/src/subtitles/TextFile.cpp @@ -32,7 +32,7 @@ CTextFile::CTextFile(enc e) bool CTextFile::Open(LPCTSTR lpszFileName)
{
- if(!__super::Open(lpszFileName, modeRead|typeBinary|shareDenyWrite))
+ if(!__super::Open(lpszFileName, modeRead|typeBinary|shareDenyNone))
return(false);
m_encoding = m_defaultencoding;
@@ -71,7 +71,7 @@ bool CTextFile::Open(LPCTSTR lpszFileName) if(m_encoding == m_defaultencoding)
{
__super::Close(); // CWebTextFile::Close() would delete the temp file if we called it...
- if(!__super::Open(lpszFileName, modeRead|typeText|shareDenyWrite))
+ if(!__super::Open(lpszFileName, modeRead|typeText|shareDenyNone))
return(false);
}
diff --git a/src/subtitles/USFSubtitles.cpp b/src/subtitles/USFSubtitles.cpp index 5796b4973..a758d6433 100644 --- a/src/subtitles/USFSubtitles.cpp +++ b/src/subtitles/USFSubtitles.cpp @@ -271,7 +271,7 @@ bool CUSFSubtitles::ConvertToSTS(CSimpleTextSubtitle& sts) 1;
}
- STSStyle* stss = new STSStyle;
+ STSStyle* stss = DNew STSStyle;
if(!stss) continue;
if(!s->pal.horizontal_margin.IsEmpty())
@@ -418,7 +418,7 @@ bool CUSFSubtitles::ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode) if(name == L"style")
{
- CAutoPtr<style_t> s(new style_t);
+ CAutoPtr<style_t> s(DNew style_t);
if(s)
{
ParseStyle(pGrandChild, s);
@@ -445,7 +445,7 @@ bool CUSFSubtitles::ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode) if(name == L"effect")
{
- CAutoPtr<effect_t> e(new effect_t);
+ CAutoPtr<effect_t> e(DNew effect_t);
if(e)
{
ParseEffect(pGrandChild, e);
@@ -625,7 +625,7 @@ void CUSFSubtitles::ParseEffect(CComPtr<IXMLDOMNode> pNode, effect_t* e) if(name == L"keyframe")
{
- CAutoPtr<keyframe_t> k(new keyframe_t);
+ CAutoPtr<keyframe_t> k(DNew keyframe_t);
if(k)
{
ParseKeyframe(pChild, k);
@@ -671,7 +671,7 @@ void CUSFSubtitles::ParseSubtitle(CComPtr<IXMLDOMNode> pNode, int start, int sto if(name == L"text" || name == L"karaoke")
{
- CAutoPtr<text_t> t(new text_t);
+ CAutoPtr<text_t> t(DNew text_t);
if(t)
{
t->start = start;
diff --git a/src/subtitles/VobSubFile.cpp b/src/subtitles/VobSubFile.cpp index 5bf787f44..2bc2ec178 100644 --- a/src/subtitles/VobSubFile.cpp +++ b/src/subtitles/VobSubFile.cpp @@ -659,7 +659,7 @@ bool CVobSubFile::ReadIdx(CString fn, int& ver) bool CVobSubFile::ReadSub(CString fn)
{
CFile f;
- if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
m_sub.SetLength(f.GetLength());
@@ -788,7 +788,7 @@ bool CVobSubFile::ReadRar(CString fn) bool CVobSubFile::ReadIfo(CString fn)
{
CFile f;
- if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
/* PGC1 */
@@ -1042,7 +1042,7 @@ BYTE* CVobSubFile::GetPacket(int idx, int& packetsize, int& datasize, int iLang) packetsize = (buff[buff[0x16] + 0x18] << 8) + buff[buff[0x16] + 0x19];
datasize = (buff[buff[0x16] + 0x1a] << 8) + buff[buff[0x16] + 0x1b];
- ret = new BYTE[packetsize];
+ ret = DNew BYTE[packetsize];
if(!ret) break;
int i = 0, sizeleft = packetsize;
@@ -2226,7 +2226,7 @@ void CVobSubStream::Add(REFERENCE_TIME tStart, REFERENCE_TIME tStop, BYTE* pData CVobSubImage vsi;
vsi.GetPacketInfo(pData, (pData[0]<<8)|pData[1], (pData[2]<<8)|pData[3]);
- CAutoPtr<SubPic> p(new SubPic());
+ CAutoPtr<SubPic> p(DNew SubPic());
p->tStart = tStart;
p->tStop = vsi.delay > 0 ? (tStart + 10000i64*vsi.delay) : tStop;
p->pData.SetCount(len);
diff --git a/src/subtitles/VobSubFileRipper.cpp b/src/subtitles/VobSubFileRipper.cpp index aca8e01a5..206e55ad6 100644 --- a/src/subtitles/VobSubFileRipper.cpp +++ b/src/subtitles/VobSubFileRipper.cpp @@ -118,7 +118,7 @@ bool CVobSubFileRipper::LoadIfo(CString fn) }
CFile f;
- if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
{
Log(LOG_ERROR, _T("Cannot open ifo"));
return(false);
@@ -901,7 +901,7 @@ bool CVobSubFileRipper::LoadChunks(CAtlArray<vcchunk>& chunks) DWORD chksum = 0, chunklen, version;
__int64 voblen;
- if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
f.Read(&version, sizeof(version));
if(version == 1)
@@ -920,7 +920,7 @@ bool CVobSubFileRipper::LoadChunks(CAtlArray<vcchunk>& chunks) return(false);
}
- if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
DWORD dw, chksum2 = 0;
while(f.Read(&dw, sizeof(dw)) == sizeof(dw)) chksum2 += dw;
@@ -946,7 +946,7 @@ bool CVobSubFileRipper::SaveChunks(CAtlArray<vcchunk>& chunks) DWORD chksum = 0, chunklen = chunks.GetCount();
__int64 voblen = m_vob.GetLength();
- if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyNone))
return(false);
DWORD dw;
while(f.Read(&dw, sizeof(dw)) == sizeof(dw)) chksum += dw;
diff --git a/src/subtitles/VobSubImage.cpp b/src/subtitles/VobSubImage.cpp index 5443d78e3..f44e1de00 100644 --- a/src/subtitles/VobSubImage.cpp +++ b/src/subtitles/VobSubImage.cpp @@ -47,10 +47,10 @@ bool CVobSubImage::Alloc(int w, int h) {
Free();
- lpTemp1 = new RGBQUAD[w*h];
+ lpTemp1 = DNew RGBQUAD[w*h];
if(!lpTemp1) return(false);
- lpTemp2 = new RGBQUAD[(w+2)*(h+2)];
+ lpTemp2 = DNew RGBQUAD[(w+2)*(h+2)];
if(!lpTemp2) {delete [] lpTemp1; lpTemp1 = NULL; return(false);}
org.cx = w;
@@ -328,7 +328,7 @@ CAutoPtrList<COutline>* CVobSubImage::GetOutlineList(CPoint& topleft) CAutoVectorPtr<BYTE> p;
if(!p.Allocate(len)) return NULL;
- CAutoPtrList<COutline>* ol = new CAutoPtrList<COutline>();
+ CAutoPtrList<COutline>* ol = DNew CAutoPtrList<COutline>();
if(!ol) return NULL;
BYTE* cp = p;
@@ -365,7 +365,7 @@ CAutoPtrList<COutline>* CVobSubImage::GetOutlineList(CPoint& topleft) int ox = x, oy = y, odir = dir;
- CAutoPtr<COutline> o(new COutline);
+ CAutoPtr<COutline> o(DNew COutline);
if(!o) break;
do
@@ -461,7 +461,7 @@ CAutoPtrList<COutline>* CVobSubImage::GetOutlineList(CPoint& topleft) static bool FitLine(COutline& o, int& start, int& end)
{
- int len = o.pa.GetCount();
+ int len = int(o.pa.GetCount());
if(len < 7) return(false); // small segments should be handled with beziers...
for(start = 0; start < len && !o.da[start]; start++);
@@ -540,7 +540,7 @@ static bool FitLine(COutline& o, int& start, int& end) static int CalcPossibleCurveDegree(COutline& o)
{
- int len2 = o.da.GetCount();
+ int len2 = int(o.da.GetCount());
CUIntArray la;
@@ -753,7 +753,7 @@ int CVobSubImage::GrabSegment(int start, COutline& o, COutline& ret) {
ret.RemoveAll();
- int len = o.pa.GetCount();
+ int len = int(o.pa.GetCount());
int cur = (start)%len, first = -1, last = -1;
int curDir = 0, lastDir = 0;
@@ -804,7 +804,7 @@ int CVobSubImage::GrabSegment(int start, COutline& o, COutline& ret) void CVobSubImage::SplitOutline(COutline& o, COutline& o1, COutline& o2)
{
- int len = o.pa.GetCount();
+ int len = int(o.pa.GetCount());
if(len < 4) return;
CAtlArray<UINT> la, sa, ea;
@@ -863,7 +863,7 @@ void CVobSubImage::SplitOutline(COutline& o, COutline& o1, COutline& o2) void CVobSubImage::AddSegment(COutline& o, CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pathPoints)
{
- int i, len = o.pa.GetCount();
+ int i, len = int(o.pa.GetCount());
if(len < 3) return;
int nLeftTurns = 0, nRightTurns = 0;
@@ -1069,7 +1069,7 @@ bool CVobSubImage::Polygonize(CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pat pathTypes.Add(PT_MOVETO);
pathPoints.Add(o.pa[0]);
- for(int i = 1, len = o.pa.GetCount(); i < len; i++)
+ for(int i = 1, len = int(o.pa.GetCount()); i < len; i++)
{
pathTypes.Add(PT_LINETO);
pathPoints.Add(o.pa[i]);
@@ -1093,7 +1093,7 @@ bool CVobSubImage::Polygonize(CStringW& assstr, bool fSmooth, int scale) BYTE lastType = 0;
- int nPoints = pathTypes.GetCount();
+ int nPoints = int(pathTypes.GetCount());
for(int i = 0; i < nPoints; i++)
{
@@ -1150,7 +1150,7 @@ void CVobSubImage::Scale2x() int w = rect.Width(), h = rect.Height();
DWORD* src = (DWORD*)lpPixels;
- DWORD* dst = new DWORD[w*h];
+ DWORD* dst = DNew DWORD[w*h];
for(int y = 0; y < h; y++)
{
diff --git a/src/subtitles/libssf/FontWrapper.cpp b/src/subtitles/libssf/FontWrapper.cpp index 2bd59baf4..07bc9cdcf 100644 --- a/src/subtitles/libssf/FontWrapper.cpp +++ b/src/subtitles/libssf/FontWrapper.cpp @@ -34,7 +34,7 @@ namespace ssf if(DWORD nNumPairs = GetKerningPairs(hDC, 0, NULL))
{
- KERNINGPAIR* kp = new KERNINGPAIR[nNumPairs];
+ KERNINGPAIR* kp = DNew KERNINGPAIR[nNumPairs];
GetKerningPairs(hDC, nNumPairs, kp);
for(DWORD i = 0; i < nNumPairs; i++)
m_kerning[(kp[i].wFirst<<16)|kp[i].wSecond] = kp[i].iKernAmount;
diff --git a/src/subtitles/libssf/GlyphPath.cpp b/src/subtitles/libssf/GlyphPath.cpp index 6397d1052..a1947c226 100644 --- a/src/subtitles/libssf/GlyphPath.cpp +++ b/src/subtitles/libssf/GlyphPath.cpp @@ -108,15 +108,15 @@ namespace ssf {
CPoint next = k < end ? src.points[k+1] : src.points[start];
- for(int l = k-1; prev == cur; l--)
+ for(int l = int(k-1); prev == cur; l--)
{
- if(l < (int)start) l = end;
+ if(l < (int)start) l = int(end);
prev = src.points[l];
}
- for(int l = k+1; next == cur; l++)
+ for(int l = int(k+1); next == cur; l++)
{
- if(l > (int)end) l = start;
+ if(l > (int)end) l = int(start);
next = src.points[l];
}
diff --git a/src/subtitles/libssf/Node.cpp b/src/subtitles/libssf/Node.cpp index 52ff46b8f..f959d9ca6 100644 --- a/src/subtitles/libssf/Node.cpp +++ b/src/subtitles/libssf/Node.cpp @@ -207,7 +207,7 @@ namespace ssf if(m_type2def.Lookup(type, pRetDef))
return *pRetDef;
- pRetDef = new Definition(m_pnf, L"");
+ pRetDef = DNew Definition(m_pnf, L"");
pRetDef->m_priority = PLow;
pRetDef->m_type = type;
m_type2def[type] = pRetDef;
diff --git a/src/subtitles/libssf/NodeFactory.cpp b/src/subtitles/libssf/NodeFactory.cpp index c308343de..a20da1ad4 100644 --- a/src/subtitles/libssf/NodeFactory.cpp +++ b/src/subtitles/libssf/NodeFactory.cpp @@ -90,7 +90,7 @@ namespace ssf {
CStringW name = GenName();
- Reference* pRef = new Reference(this, name);
+ Reference* pRef = DNew Reference(this, name);
m_nodes.SetAt(name, pRef);
m_newnodes.AddTail(name);
@@ -132,7 +132,7 @@ namespace ssf if(!pDef)
{
- pDef = new Definition(this, name);
+ pDef = DNew Definition(this, name);
m_nodes.SetAt(name, pDef);
m_newnodes.AddTail(name);
diff --git a/src/subtitles/libssf/Rasterizer.cpp b/src/subtitles/libssf/Rasterizer.cpp index e1ec2ea04..6cb9e2838 100644 --- a/src/subtitles/libssf/Rasterizer.cpp +++ b/src/subtitles/libssf/Rasterizer.cpp @@ -224,7 +224,7 @@ namespace ssf // Initialize scanline list.
- mpScanBuffer = new unsigned int[mHeight];
+ mpScanBuffer = DNew unsigned int[mHeight];
memset(mpScanBuffer, 0, mHeight*sizeof(unsigned int));
// Scan convert the outline. Yuck, Bezier curves....
@@ -248,7 +248,7 @@ namespace ssf {
case PT_MOVETO:
if(lastmoveto >= 0 && firstp != lastp) _EvaluateLine(lastp, firstp);
- lastmoveto = i;
+ lastmoveto = int(i);
fFirstSet = false;
lastp = pt[i];
break;
@@ -495,7 +495,7 @@ namespace ssf mOverlayWidth = ((width + ((1<<FONT_AA)-1)) >> FONT_AA) + 1;
mOverlayHeight = ((height + ((1<<FONT_AA)-1)) >> FONT_AA) + 1;
- mpOverlayBuffer = new BYTE[4 * mOverlayWidth * mOverlayHeight];
+ mpOverlayBuffer = DNew BYTE[4 * mOverlayWidth * mOverlayHeight];
memset(mpOverlayBuffer, 0, 4 * mOverlayWidth * mOverlayHeight);
Array<Span>* pOutline[2] = {&mOutline, &mWideOutline};
@@ -562,7 +562,7 @@ namespace ssf int w = mOverlayWidth;
int h = mOverlayHeight;
int pitch = w*4;
- BYTE* q0 = new BYTE[w*h];
+ BYTE* q0 = DNew BYTE[w*h];
for(int pass = 0, limit = (int)(n + 0.5); pass < n; pass++)
{
diff --git a/src/subtitles/libssf/Renderer.cpp b/src/subtitles/libssf/Renderer.cpp index b39a83961..80a4b4865 100644 --- a/src/subtitles/libssf/Renderer.cpp +++ b/src/subtitles/libssf/Renderer.cpp @@ -194,7 +194,7 @@ namespace ssf for(LPCWSTR c = t.str; *c; c++)
{
- CAutoPtr<Glyph> g(new Glyph());
+ CAutoPtr<Glyph> g(DNew Glyph());
g->c = *c;
g->style = t.style;
@@ -260,7 +260,7 @@ namespace ssf while(pos)
{
CAutoPtr<Glyph> g = glyphs.GetNext(pos);
- if(!row) row.Attach(new Row());
+ if(!row) row.Attach(DNew Row());
WCHAR c = g->c;
row->AddTail(g);
if(c == Text::LSEP || !pos) rows.AddTail(row);
@@ -336,7 +336,7 @@ namespace ssf if(brpos && abs(width) > maxwidth && g->c != Text::SP)
{
- row.Attach(new Row());
+ row.Attach(DNew Row());
POSITION next = brpos;
r->GetNext(next);
do {row->AddHead(r->GetPrev(brpos));} while(brpos);
@@ -468,7 +468,7 @@ namespace ssf // align rows and calc glyph positions
- rs = new RenderedSubtitle(spdrc, clip);
+ rs = DNew RenderedSubtitle(spdrc, clip);
CPoint p = GetAlignPoint(style.placement, scale, frame, size);
CPoint org = GetAlignPoint(style.placement, scale, frame);
@@ -770,7 +770,7 @@ namespace ssf return NULL;
}
- pFW = new FontWrapper(hDC, hFont, key);
+ pFW = DNew FontWrapper(hDC, hFont, key);
Add(key, pFW, false);
@@ -795,7 +795,7 @@ namespace ssf CloseFigure(hDC);
if(!EndPath(hDC)) {AbortPath(hDC); ASSERT(0); return NULL;}
- path = new GlyphPath();
+ path = DNew GlyphPath();
int count = GetPath(hDC, NULL, NULL, 0);
diff --git a/src/subtitles/libssf/Stream.cpp b/src/subtitles/libssf/Stream.cpp index 25e5c9af9..94043b272 100644 --- a/src/subtitles/libssf/Stream.cpp +++ b/src/subtitles/libssf/Stream.cpp @@ -208,7 +208,7 @@ namespace ssf {
if(fCopy)
{
- m_pBytes = new BYTE[len];
+ m_pBytes = DNew BYTE[len];
if(m_pBytes) memcpy(m_pBytes, pBytes, len);
m_fFree = true;
}
diff --git a/src/subtitles/libssf/SubtitleFile.cpp b/src/subtitles/libssf/SubtitleFile.cpp index 788fb1b69..38736efec 100644 --- a/src/subtitles/libssf/SubtitleFile.cpp +++ b/src/subtitles/libssf/SubtitleFile.cpp @@ -121,7 +121,7 @@ namespace ssf {
SegmentItem& si = sis.GetNext(pos);
- CAutoPtr<Subtitle> s(new Subtitle(this));
+ CAutoPtr<Subtitle> s(DNew Subtitle(this));
if(s->Parse(si.pDef, si.start, si.stop, at))
{
diff --git a/src/subtitles/libssf/libssf.vcproj b/src/subtitles/libssf/libssf.vcproj index dc4fd5921..e2f08e8b0 100644 --- a/src/subtitles/libssf/libssf.vcproj +++ b/src/subtitles/libssf/libssf.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="libssf"
ProjectGUID="{DD9D2D92-2241-408A-859E-B85D444B7E3C}"
RootNamespace="libssf"
@@ -44,6 +44,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -106,6 +107,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
diff --git a/src/subtitles/libssf/stdafx.h b/src/subtitles/libssf/stdafx.h index 6e609f06f..946d47359 100644 --- a/src/subtitles/libssf/stdafx.h +++ b/src/subtitles/libssf/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\..\DSUtil\SharedInclude.h"
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
diff --git a/src/subtitles/stdafx.h b/src/subtitles/stdafx.h index 4a25c90b5..6f2138b72 100644 --- a/src/subtitles/stdafx.h +++ b/src/subtitles/stdafx.h @@ -25,6 +25,7 @@ //
#pragma once
+#include "..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/subtitles/subtitles.vcproj b/src/subtitles/subtitles.vcproj index f1ff1d4d3..631ebf173 100644 --- a/src/subtitles/subtitles.vcproj +++ b/src/subtitles/subtitles.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="subtitles"
ProjectGUID="{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
RootNamespace="subtitles"
@@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;"
/>
@@ -102,6 +103,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;"
DebugInformationFormat="3"
diff --git a/src/ui/CmdUI/CmdUI.vcproj b/src/ui/CmdUI/CmdUI.vcproj index 86cac68ae..886ec952f 100644 --- a/src/ui/CmdUI/CmdUI.vcproj +++ b/src/ui/CmdUI/CmdUI.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB;"
/>
<Tool
diff --git a/src/ui/CmdUI/stdafx.h b/src/ui/CmdUI/stdafx.h index e3baf19ae..8adb7dd15 100644 --- a/src/ui/CmdUI/stdafx.h +++ b/src/ui/CmdUI/stdafx.h @@ -4,6 +4,7 @@ //
#pragma once
+#include "..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
diff --git a/src/ui/LCDUI/LCDGfx.cpp b/src/ui/LCDUI/LCDGfx.cpp index 480a27793..450f394b5 100644 --- a/src/ui/LCDUI/LCDGfx.cpp +++ b/src/ui/LCDUI/LCDGfx.cpp @@ -10,6 +10,8 @@ // Copyright 2005 Logitech Inc.
//************************************************************************
+#include "../../DSUtil/SharedInclude.h"
+#include <Afx.h>
#include "LCDGfx.h"
@@ -64,7 +66,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight) }
int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
- m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize];
+ m_pBitmapInfo = (BITMAPINFO *) DNew BYTE [nBMISize];
if(NULL == m_pBitmapInfo)
{
LCDUITRACE(_T("CLCDGfx::Initialize(): failed to allocate bitmap info.\n"));
@@ -104,7 +106,7 @@ HRESULT CLCDGfx::Initialize(int nWidth, int nHeight) return E_FAIL;
}
- m_pLCDScreen = new lgLcdBitmap160x43x1;
+ m_pLCDScreen = DNew lgLcdBitmap160x43x1;
if(NULL == m_pLCDScreen)
{
LCDUITRACE(_T("CLCDGfx::Initialize(): failed to allocate the lcd screen structure.\n"));
diff --git a/src/ui/LCDUI/LCDOutput.cpp b/src/ui/LCDUI/LCDOutput.cpp index ec1a1396a..e9a0dcd27 100644 --- a/src/ui/LCDUI/LCDOutput.cpp +++ b/src/ui/LCDUI/LCDOutput.cpp @@ -10,6 +10,8 @@ // Copyright 2005 Logitech Inc.
//************************************************************************
+#include "../../DSUtil/SharedInclude.h"
+#include <Afx.h>
#include "LCDOutput.h"
#pragma comment(lib, "lgLcd.lib")
@@ -41,7 +43,7 @@ CLCDOutput::CLCDOutput() LGLCD_DEVICE_FAMILY_SPEAKERS_Z10;
m_dwDeviceFamiliesSupportedReserved1 = 0;
- m_pLastBitmap = new lgLcdBitmap160x43x1;
+ m_pLastBitmap = DNew lgLcdBitmap160x43x1;
ClearBitmap(m_pLastBitmap);
// Allow the first update to go through
m_bPriorityHasChanged = TRUE;
diff --git a/src/ui/LCDUI/LCDUI.vcproj b/src/ui/LCDUI/LCDUI.vcproj index 0d97f09f1..97299cf2f 100644 --- a/src/ui/LCDUI/LCDUI.vcproj +++ b/src/ui/LCDUI/LCDUI.vcproj @@ -42,6 +42,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
@@ -100,6 +101,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
@@ -156,6 +158,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
DisableSpecificWarnings="4244"
@@ -215,6 +218,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB;"
/>
diff --git a/src/ui/ResizableLib/ResizableDialog.cpp b/src/ui/ResizableLib/ResizableDialog.cpp index d61d4472b..af9d16b97 100644 --- a/src/ui/ResizableLib/ResizableDialog.cpp +++ b/src/ui/ResizableLib/ResizableDialog.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizableDialog.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////////
// CResizableDialog
diff --git a/src/ui/ResizableLib/ResizableGrip.cpp b/src/ui/ResizableLib/ResizableGrip.cpp index f1464dbb7..d1551ce6b 100644 --- a/src/ui/ResizableLib/ResizableGrip.cpp +++ b/src/ui/ResizableLib/ResizableGrip.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizableGrip.h"
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizableLayout.cpp b/src/ui/ResizableLib/ResizableLayout.cpp index 8d7a4d7a9..750404b02 100644 --- a/src/ui/ResizableLib/ResizableLayout.cpp +++ b/src/ui/ResizableLib/ResizableLayout.cpp @@ -19,12 +19,6 @@ #include "ResizableLayout.h"
#include "ResizableMsgSupport.inl"
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizableLib.vcproj b/src/ui/ResizableLib/ResizableLib.vcproj index 2c7dd5ea5..efee6f810 100644 --- a/src/ui/ResizableLib/ResizableLib.vcproj +++ b/src/ui/ResizableLib/ResizableLib.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB;"
/>
<Tool
diff --git a/src/ui/ResizableLib/ResizableMinMax.cpp b/src/ui/ResizableLib/ResizableMinMax.cpp index 74e576d99..0a19f3002 100644 --- a/src/ui/ResizableLib/ResizableMinMax.cpp +++ b/src/ui/ResizableLib/ResizableMinMax.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizableMinMax.h"
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/ResizablePage.cpp b/src/ui/ResizableLib/ResizablePage.cpp index 10c49366e..06dcc6b96 100644 --- a/src/ui/ResizableLib/ResizablePage.cpp +++ b/src/ui/ResizableLib/ResizablePage.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizablePage.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////////
// CResizablePage
diff --git a/src/ui/ResizableLib/ResizableSheet.cpp b/src/ui/ResizableLib/ResizableSheet.cpp index 95ac673a0..a7048b085 100644 --- a/src/ui/ResizableLib/ResizableSheet.cpp +++ b/src/ui/ResizableLib/ResizableSheet.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizableSheet.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////////
// CResizableSheet
diff --git a/src/ui/ResizableLib/ResizableState.cpp b/src/ui/ResizableLib/ResizableState.cpp index be7e05e4c..748038d1a 100644 --- a/src/ui/ResizableLib/ResizableState.cpp +++ b/src/ui/ResizableLib/ResizableState.cpp @@ -17,12 +17,6 @@ #include "stdafx.h"
#include "ResizableState.h"
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/src/ui/ResizableLib/stdafx.h b/src/ui/ResizableLib/stdafx.h index 17ff29a3b..aa01b8175 100644 --- a/src/ui/ResizableLib/stdafx.h +++ b/src/ui/ResizableLib/stdafx.h @@ -4,7 +4,7 @@ //
#pragma once
-
+#include "../../dsutil/SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/ui/TreePropSheet/PropPageFrame.cpp b/src/ui/TreePropSheet/PropPageFrame.cpp index db76d6546..30f9f048b 100644 --- a/src/ui/TreePropSheet/PropPageFrame.cpp +++ b/src/ui/TreePropSheet/PropPageFrame.cpp @@ -20,14 +20,6 @@ #include "stdafx.h"
#include "PropPageFrame.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-
-
namespace TreePropSheet
{
diff --git a/src/ui/TreePropSheet/PropPageFrameDefault.cpp b/src/ui/TreePropSheet/PropPageFrameDefault.cpp index 667d9cac0..85e69940a 100644 --- a/src/ui/TreePropSheet/PropPageFrameDefault.cpp +++ b/src/ui/TreePropSheet/PropPageFrameDefault.cpp @@ -34,12 +34,6 @@ namespace TreePropSheet #include <vssym32.h>
#endif
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
//-------------------------------------------------------------------
// class CThemeLib
//-------------------------------------------------------------------
diff --git a/src/ui/TreePropSheet/TreePropSheet.cpp b/src/ui/TreePropSheet/TreePropSheet.cpp index 9c5c9f8ec..687226860 100644 --- a/src/ui/TreePropSheet/TreePropSheet.cpp +++ b/src/ui/TreePropSheet/TreePropSheet.cpp @@ -22,13 +22,6 @@ #include "TreePropSheet.h"
#include "PropPageFrameDefault.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-
namespace TreePropSheet
{
@@ -253,13 +246,13 @@ CString CTreePropSheet::GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, L CTreeCtrl* CTreePropSheet::CreatePageTreeObject()
{
- return new CTreeCtrl;
+ return DNew CTreeCtrl;
}
CPropPageFrame* CTreePropSheet::CreatePageFrame()
{
- return new CPropPageFrameDefault;
+ return DNew CPropPageFrameDefault;
}
diff --git a/src/ui/TreePropSheet/TreePropSheet.vcproj b/src/ui/TreePropSheet/TreePropSheet.vcproj index 28a2a840d..9125e1b61 100644 --- a/src/ui/TreePropSheet/TreePropSheet.vcproj +++ b/src/ui/TreePropSheet/TreePropSheet.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB;"
/>
<Tool
diff --git a/src/ui/TreePropSheet/stdafx.h b/src/ui/TreePropSheet/stdafx.h index 48ffc8b90..8917673d9 100644 --- a/src/ui/TreePropSheet/stdafx.h +++ b/src/ui/TreePropSheet/stdafx.h @@ -4,6 +4,7 @@ //
#pragma once
+#include "..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/ui/sizecbar/scbarg.cpp b/src/ui/sizecbar/scbarg.cpp index 23a0ef7e2..50453e395 100644 --- a/src/ui/sizecbar/scbarg.cpp +++ b/src/ui/sizecbar/scbarg.cpp @@ -33,12 +33,6 @@ #include "scbarg.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////
// CSizingControlBarG
diff --git a/src/ui/sizecbar/sizecbar.cpp b/src/ui/sizecbar/sizecbar.cpp index 8cb8d7157..e5c79c15d 100644 --- a/src/ui/sizecbar/sizecbar.cpp +++ b/src/ui/sizecbar/sizecbar.cpp @@ -57,12 +57,6 @@ #include "stdafx.h"
#include "sizecbar.h"
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
/////////////////////////////////////////////////////////////////////////
// CSizingControlBar
@@ -165,7 +159,7 @@ void CSizingControlBar::EnableDocking(DWORD dwDockStyle) m_dwDockStyle = dwDockStyle;
if (m_pDockContext == NULL)
- m_pDockContext = new CSCBDockContext(this);
+ m_pDockContext = DNew CSCBDockContext(this);
// permanently wire the bar's owner to its current parent
if (m_hWndOwner == NULL)
diff --git a/src/ui/sizecbar/sizecbar.vcproj b/src/ui/sizecbar/sizecbar.vcproj index ab907d73a..63a28e88d 100644 --- a/src/ui/sizecbar/sizecbar.vcproj +++ b/src/ui/sizecbar/sizecbar.vcproj @@ -43,6 +43,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
/>
<Tool
@@ -101,6 +102,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;_DEBUG;_LIB;"
DebugInformationFormat="3"
/>
@@ -157,6 +159,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
DisableSpecificWarnings="4244"
/>
@@ -216,6 +219,7 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="_WIN64;NDEBUG;_LIB"
/>
<Tool
diff --git a/src/ui/sizecbar/stdafx.h b/src/ui/sizecbar/stdafx.h index 48ffc8b90..8917673d9 100644 --- a/src/ui/sizecbar/stdafx.h +++ b/src/ui/sizecbar/stdafx.h @@ -4,6 +4,7 @@ //
#pragma once
+#include "..\..\DSUtil\SharedInclude.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
diff --git a/src/zlib/zlib.vcproj b/src/zlib/zlib.vcproj index e9fb8edaa..1ed081730 100644 --- a/src/zlib/zlib.vcproj +++ b/src/zlib/zlib.vcproj @@ -44,8 +44,10 @@ />
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
PrecompiledHeaderFile=".\Debug/zlib.pch"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -107,6 +109,7 @@ Name="VCCLCompilerTool"
PreprocessorDefinitions="_WIN64;_DEBUG;_WINDOWS"
PrecompiledHeaderFile=".\Debug/zlib.pch"
+ WarningLevel="2"
DebugInformationFormat="3"
/>
<Tool
@@ -166,6 +169,7 @@ Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
PrecompiledHeaderFile=".\Release/zlib.pch"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -227,6 +231,7 @@ Name="VCCLCompilerTool"
PreprocessorDefinitions="_WIN64;NDEBUG;_WINDOWS"
PrecompiledHeaderFile=".\Release/zlib.pch"
+ WarningLevel="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
|