Welcome to mirror list, hosted at ThFree Co, Russian Federation.

IPinHook.h « VideoRenderers « renderer « filters « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7425224a9aba2ae6fff47d505ed8dcecea15d148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 * (C) 2003-2006 Gabest
 * (C) 2006-2015 see Authors.txt
 *
 * This file is part of MPC-HC.
 *
 * MPC-HC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * MPC-HC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once

#include <videoacc.h>

interface IPinC;

typedef struct IPinCVtbl {
    BEGIN_INTERFACE
    HRESULT(STDMETHODCALLTYPE* QueryInterface)(IPinC* This, /* [in] */ REFIID riid, /* [iid_is][out] */ void** ppvObject);
    ULONG(STDMETHODCALLTYPE* AddRef)(IPinC* This);
    ULONG(STDMETHODCALLTYPE* Release)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* Connect)(IPinC* This, /* [in] */ IPinC* pReceivePin, /* [in] */ const AM_MEDIA_TYPE* pmt);
    HRESULT(STDMETHODCALLTYPE* ReceiveConnection)(IPinC* This, /* [in] */ IPinC* pConnector, /* [in] */ const AM_MEDIA_TYPE* pmt);
    HRESULT(STDMETHODCALLTYPE* Disconnect)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* ConnectedTo)(IPinC* This, /* [out] */ IPinC** pPin);
    HRESULT(STDMETHODCALLTYPE* ConnectionMediaType)(IPinC* This, /* [out] */ AM_MEDIA_TYPE* pmt);
    HRESULT(STDMETHODCALLTYPE* QueryPinInfo)(IPinC* This, /* [out] */ PIN_INFO* pInfo);
    HRESULT(STDMETHODCALLTYPE* QueryDirection)(IPinC* This, /* [out] */ PIN_DIRECTION* pPinDir);
    HRESULT(STDMETHODCALLTYPE* QueryId)(IPinC* This, /* [out] */ LPWSTR* Id);
    HRESULT(STDMETHODCALLTYPE* QueryAccept)(IPinC* This, /* [in] */ const AM_MEDIA_TYPE* pmt);
    HRESULT(STDMETHODCALLTYPE* EnumMediaTypes)(IPinC* This, /* [out] */ IEnumMediaTypes** ppEnum);
    HRESULT(STDMETHODCALLTYPE* QueryInternalConnections)(IPinC* This, /* [out] */ IPinC** apPin, /* [out][in] */ ULONG* nPin);
    HRESULT(STDMETHODCALLTYPE* EndOfStream)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* BeginFlush)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* EndFlush)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* NewSegment)(IPinC* This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate);
    END_INTERFACE
} IPinCVtbl;

interface IPinC {
    CONST_VTBL struct IPinCVtbl* lpVtbl;
};

interface IMemInputPinC;

typedef struct IMemInputPinCVtbl {
    BEGIN_INTERFACE
    HRESULT(STDMETHODCALLTYPE* QueryInterface)(IPinC* This, /* [in] */ REFIID riid, /* [iid_is][out] */ void** ppvObject);
    ULONG(STDMETHODCALLTYPE* AddRef)(IPinC* This);
    ULONG(STDMETHODCALLTYPE* Release)(IPinC* This);
    HRESULT(STDMETHODCALLTYPE* GetAllocator)(IMemInputPinC* This, IMemAllocator** ppAllocator);
    HRESULT(STDMETHODCALLTYPE* NotifyAllocator)(IMemInputPinC* This, IMemAllocator* pAllocator, BOOL bReadOnly);
    HRESULT(STDMETHODCALLTYPE* GetAllocatorRequirements)(IMemInputPinC* This, ALLOCATOR_PROPERTIES* pProps);
    HRESULT(STDMETHODCALLTYPE* Receive)(IMemInputPinC* This, IMediaSample* pSample);
    HRESULT(STDMETHODCALLTYPE* ReceiveMultiple)(IMemInputPinC* This, IMediaSample** pSamples, long nSamples, long* nSamplesProcessed);
    HRESULT(STDMETHODCALLTYPE* ReceiveCanBlock)(IMemInputPinC* This);
    END_INTERFACE
} IMemInputPinCVtbl;

interface IMemInputPinC {
    CONST_VTBL struct IMemInputPinCVtbl* lpVtbl;
};

extern bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPin);
extern void UnhookNewSegmentAndReceive();
extern REFERENCE_TIME g_tSegmentStart, g_tSampleStart, g_rtTimePerFrame;

extern void HookWorkAround10BitBug(IBaseFilter* pBF);
extern void UnhookWorkAround10BitBug();

//

interface IAMVideoAcceleratorC;

typedef struct IAMVideoAcceleratorCVtbl {
    BEGIN_INTERFACE

    HRESULT(STDMETHODCALLTYPE* QueryInterface)(
        IAMVideoAcceleratorC* This,
        /* [in] */ REFIID riid,
        /* [iid_is][out] */ void** ppvObject);

    ULONG(STDMETHODCALLTYPE* AddRef)(
        IAMVideoAcceleratorC* This);

    ULONG(STDMETHODCALLTYPE* Release)(
        IAMVideoAcceleratorC* This);

    HRESULT(STDMETHODCALLTYPE* GetVideoAcceleratorGUIDs)(
        IAMVideoAcceleratorC* This,
        /* [out][in] */ LPDWORD pdwNumGuidsSupported,
        /* [out][in] */ LPGUID pGuidsSupported);

    HRESULT(STDMETHODCALLTYPE* GetUncompFormatsSupported)(
        IAMVideoAcceleratorC* This,
        /* [in] */ const GUID* pGuid,
        /* [out][in] */ LPDWORD pdwNumFormatsSupported,
        /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported);

    HRESULT(STDMETHODCALLTYPE* GetInternalMemInfo)(
        IAMVideoAcceleratorC* This,
        /* [in] */ const GUID* pGuid,
        /* [in] */ const AMVAUncompDataInfo* pamvaUncompDataInfo,
        /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo);

    HRESULT(STDMETHODCALLTYPE* GetCompBufferInfo)(
        IAMVideoAcceleratorC* This,
        /* [in] */ const GUID* pGuid,
        /* [in] */ const AMVAUncompDataInfo* pamvaUncompDataInfo,
        /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
        /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo);

    HRESULT(STDMETHODCALLTYPE* GetInternalCompBufferInfo)(
        IAMVideoAcceleratorC* This,
        /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
        /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo);

    HRESULT(STDMETHODCALLTYPE* BeginFrame)(
        IAMVideoAcceleratorC* This,
        /* [in] */ const AMVABeginFrameInfo* amvaBeginFrameInfo);

    HRESULT(STDMETHODCALLTYPE* EndFrame)(
        IAMVideoAcceleratorC* This,
        /* [in] */ const AMVAEndFrameInfo* pEndFrameInfo);

    HRESULT(STDMETHODCALLTYPE* GetBuffer)(
        IAMVideoAcceleratorC* This,
        /* [in] */ DWORD dwTypeIndex,
        /* [in] */ DWORD dwBufferIndex,
        /* [in] */ BOOL bReadOnly,
        /* [out] */ LPVOID* ppBuffer,
        /* [out] */ LONG* lpStride);

    HRESULT(STDMETHODCALLTYPE* ReleaseBuffer)(
        IAMVideoAcceleratorC* This,
        /* [in] */ DWORD dwTypeIndex,
        /* [in] */ DWORD dwBufferIndex);

    HRESULT(STDMETHODCALLTYPE* Execute)(
        IAMVideoAcceleratorC* This,
        /* [in] */ DWORD dwFunction,
        /* [in] */ LPVOID lpPrivateInputData,
        /* [in] */ DWORD cbPrivateInputData,
        /* [in] */ LPVOID lpPrivateOutputDat,
        /* [in] */ DWORD cbPrivateOutputData,
        /* [in] */ DWORD dwNumBuffers,
        /* [in] */ const AMVABUFFERINFO* pamvaBufferInfo);

    HRESULT(STDMETHODCALLTYPE* QueryRenderStatus)(
        IAMVideoAcceleratorC* This,
        /* [in] */ DWORD dwTypeIndex,
        /* [in] */ DWORD dwBufferIndex,
        /* [in] */ DWORD dwFlags);

    HRESULT(STDMETHODCALLTYPE* DisplayFrame)(
        IAMVideoAcceleratorC* This,
        /* [in] */ DWORD dwFlipToIndex,
        /* [in] */ IMediaSample* pMediaSample);

    END_INTERFACE
} IAMVideoAcceleratorCVtbl;

interface IAMVideoAcceleratorC {
    CONST_VTBL struct IAMVideoAcceleratorCVtbl* lpVtbl;
};

void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC);

// DXVA2 hooks
void HookDirectXVideoDecoderService(void* pIDirectXVideoDecoderService);
LPCTSTR GetDXVADecoderDescription();
LPCTSTR GetDXVAVersion();
void ClearDXVAState();