|
| 1 | +////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// EVRPresenter.h : Internal header for building the DLL. |
| 4 | +// |
| 5 | +// Based on a sample from(c) Microsoft Corporation. |
| 6 | +// |
| 7 | +////////////////////////////////////////////////////////////////////////// |
| 8 | + |
| 9 | +#pragma once |
| 10 | + |
| 11 | +#include <windows.h> |
| 12 | +#include <intsafe.h> |
| 13 | +#include <math.h> |
| 14 | +#include <strsafe.h> |
| 15 | +#include <shlwapi.h> |
| 16 | + |
| 17 | +#include <mfapi.h> |
| 18 | +#include <mfidl.h> |
| 19 | +#include <mferror.h> |
| 20 | +#include <evcode.h> // EVR event codes (IMediaEventSink) |
| 21 | +#include <d3d9.h> |
| 22 | +#include <dxva2api.h> |
| 23 | +#include <evr9.h> |
| 24 | + |
| 25 | +#include <Dshow.h> |
| 26 | +#include <Dvdmedia.h> |
| 27 | + |
| 28 | +#include "linklist.h" |
| 29 | +#include "critsec.h" |
| 30 | +#include "MFClasses.h" |
| 31 | + |
| 32 | +// define to write a log-file |
| 33 | +//#define FILE_LOGGING |
| 34 | + |
| 35 | +using namespace Classes; |
| 36 | + |
| 37 | +#ifndef CHECK_HR |
| 38 | +#define CHECK_HR(hr) IF_FAILED_GOTO(hr, done) |
| 39 | +#endif |
| 40 | + |
| 41 | +#ifndef FAILED |
| 42 | +#define FAILED(hr) (((HRESULT)(hr)) < 0) |
| 43 | +#endif |
| 44 | + |
| 45 | +#ifndef SUCCEEDED |
| 46 | +#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) |
| 47 | +#endif |
| 48 | + |
| 49 | +// IF_FAILED_GOTO macro. |
| 50 | +// Jumps to 'label' on failure. |
| 51 | +#ifndef IF_FAILED_GOTO |
| 52 | +#define IF_FAILED_GOTO(hr, label) if (FAILED(hr)) { goto label; } |
| 53 | +#endif |
| 54 | + |
| 55 | +// CheckPointer macro. |
| 56 | +// Returns 'hr' if pointer 'x' is NULL. |
| 57 | +#ifndef CheckPointer |
| 58 | +#define CheckPointer(x, hr) if (x == NULL) { return hr; } |
| 59 | +#endif |
| 60 | + |
| 61 | +// Releases a COM pointer if the pointer is not NULL, and sets the pointer. |
| 62 | +#ifndef SAFE_RELEASE |
| 63 | +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p) = NULL; } } |
| 64 | +#endif |
| 65 | + |
| 66 | +typedef ComPtrList<IMFSample> VideoSampleList; |
| 67 | +typedef interface IEVRPresenterRegisterCallback IEVRPresenterRegisterCallback; |
| 68 | + |
| 69 | + |
| 70 | +MIDL_INTERFACE("B92D8991-6C42-4e51-B942-E61CB8696FCB") |
| 71 | +IEVRPresenterCallback : public IUnknown |
| 72 | +{ |
| 73 | +public: |
| 74 | + virtual HRESULT STDMETHODCALLTYPE PresentSurfaceCB(IDirect3DSurface9 *pSurface) = 0; |
| 75 | +}; |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +MIDL_INTERFACE("9019EA9C-F1B4-44b5-ADD5-D25704313E48") |
| 80 | +IEVRPresenterRegisterCallback : public IUnknown |
| 81 | +{ |
| 82 | +public: |
| 83 | + virtual HRESULT STDMETHODCALLTYPE RegisterCallback(IEVRPresenterCallback *pCallback) = 0; |
| 84 | + |
| 85 | +}; |
| 86 | + |
| 87 | + |
| 88 | +MIDL_INTERFACE("4527B2E7-49BE-4b61-A19D-429066D93A99") |
| 89 | +IEVRPresenterSettings : public IUnknown |
| 90 | +{ |
| 91 | +public: |
| 92 | + virtual HRESULT STDMETHODCALLTYPE SetBufferCount(int bufferCount) = 0; |
| 93 | + virtual HRESULT STDMETHODCALLTYPE GetBufferCount(int* bufferCount) = 0; |
| 94 | + virtual HRESULT STDMETHODCALLTYPE RegisterCallback(IEVRPresenterCallback *pCallback) = 0; |
| 95 | +}; |
| 96 | + |
| 97 | +// Custom Attributes |
| 98 | + |
| 99 | +// MFSamplePresenter_SampleCounter |
| 100 | +// Data type: UINT32 |
| 101 | +// |
| 102 | +// Version number for the video samples. When the presenter increments the version |
| 103 | +// number, all samples with the previous version number are stale and should be |
| 104 | +// discarded. |
| 105 | +static const GUID MFSamplePresenter_SampleCounter = |
| 106 | +{ 0xb0bb83cc, 0xf10f, 0x4e2e, { 0xaa, 0x2b, 0x29, 0xea, 0x5e, 0x92, 0xef, 0x85 } }; |
| 107 | + |
| 108 | +// MFSamplePresenter_SampleSwapChain |
| 109 | +// Data type: IUNKNOWN |
| 110 | +// |
| 111 | +// Pointer to a Direct3D swap chain. |
| 112 | +static const GUID MFSamplePresenter_SampleSwapChain = |
| 113 | +{ 0xad885bd1, 0x7def, 0x414a, { 0xb5, 0xb0, 0xd3, 0xd2, 0x63, 0xd6, 0xe9, 0x6d } }; |
| 114 | + |
| 115 | + |
| 116 | +void DllAddRef(); |
| 117 | +void DllRelease(); |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +// Project headers. |
| 122 | +#include "Helpers.h" |
| 123 | +#include "SamplePool.h" |
| 124 | +#include "Scheduler.h" |
| 125 | +#include "PresentEngine.h" |
| 126 | +#include "Presenter.h" |
| 127 | + |
0 commit comments