A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / IPinHook.cpp
blobbde5d8e2a553033820c4bcfae98a9050c135fa33
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "stdafx.h"
23 #include "IPinHook.h"
24 #include "DX9AllocatorPresenter.h"
26 REFERENCE_TIME g_tSegmentStart = 0;
27 REFERENCE_TIME g_tSampleStart = 0;
29 static HRESULT (STDMETHODCALLTYPE * NewSegmentOrg)(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) = NULL;
31 static HRESULT STDMETHODCALLTYPE NewSegmentMine(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate)
33 g_tSegmentStart = tStart;
34 return NewSegmentOrg(This, tStart, tStop, dRate);
37 static HRESULT ( STDMETHODCALLTYPE *ReceiveOrg )( IMemInputPinC * This, IMediaSample *pSample) = NULL;
39 static HRESULT STDMETHODCALLTYPE ReceiveMineI(IMemInputPinC * This, IMediaSample *pSample)
41 REFERENCE_TIME rtStart, rtStop;
42 if(pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop)))
43 g_tSampleStart = rtStart;
44 return ReceiveOrg(This, pSample);
47 static HRESULT STDMETHODCALLTYPE ReceiveMine(IMemInputPinC * This, IMediaSample *pSample)
49 // Support ffdshow queueing.
50 // To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with CMainFrame::OnPlayPause.
51 if(queueu_ffdshow_support)
53 CAutoLock lck(&g_ffdshowReceive);
54 return ReceiveMineI(This,pSample);
56 return ReceiveMineI(This,pSample);
59 bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
61 if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000))
62 return false;
64 g_tSegmentStart = 0;
65 g_tSampleStart = 0;
67 BOOL res;
68 DWORD flOldProtect = 0;
69 DWORD flSetProtect = 0;
71 res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), PAGE_WRITECOPY, &flOldProtect);
72 flSetProtect = flOldProtect;
73 if(NewSegmentOrg == NULL) NewSegmentOrg = pPinC->lpVtbl->NewSegment;
74 pPinC->lpVtbl->NewSegment = NewSegmentMine;
75 res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), flSetProtect /* PAGE_EXECUTE */, &flOldProtect);
77 flOldProtect = 0;
78 res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), PAGE_WRITECOPY, &flOldProtect);
79 flSetProtect = flOldProtect;
81 if(ReceiveOrg == NULL) ReceiveOrg = pMemInputPinC->lpVtbl->Receive;
82 pMemInputPinC->lpVtbl->Receive = ReceiveMine;
83 res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), flSetProtect /*PAGE_EXECUTE*/, &flOldProtect);
85 return true;
88 static HRESULT ( STDMETHODCALLTYPE *GetVideoAcceleratorGUIDsOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumGuidsSupported,/* [out][in] */ LPGUID pGuidsSupported) = NULL;
89 static HRESULT ( STDMETHODCALLTYPE *GetUncompFormatsSupportedOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [out][in] */ LPDWORD pdwNumFormatsSupported,/* [out][in] */ LPDDPIXELFORMAT pFormatsSupported) = NULL;
90 static HRESULT ( STDMETHODCALLTYPE *GetInternalMemInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo) = NULL;
91 static HRESULT ( STDMETHODCALLTYPE *GetCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL;
92 static HRESULT ( STDMETHODCALLTYPE *GetInternalCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL;
93 static HRESULT ( STDMETHODCALLTYPE *BeginFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo) = NULL;
94 static HRESULT ( STDMETHODCALLTYPE *EndFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVAEndFrameInfo *pEndFrameInfo) = NULL;
95 static HRESULT ( STDMETHODCALLTYPE *GetBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ BOOL bReadOnly,/* [out] */ LPVOID *ppBuffer,/* [out] */ LONG *lpStride) = NULL;
96 static HRESULT ( STDMETHODCALLTYPE *ReleaseBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex) = NULL;
97 static HRESULT ( STDMETHODCALLTYPE *ExecuteOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFunction,/* [in] */ LPVOID lpPrivateInputData,/* [in] */ DWORD cbPrivateInputData,/* [in] */ LPVOID lpPrivateOutputDat,/* [in] */ DWORD cbPrivateOutputData,/* [in] */ DWORD dwNumBuffers,/* [in] */ const AMVABUFFERINFO *pamvaBufferInfo) = NULL;
98 static HRESULT ( STDMETHODCALLTYPE *QueryRenderStatusOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ DWORD dwFlags) = NULL;
99 static HRESULT ( STDMETHODCALLTYPE *DisplayFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFlipToIndex,/* [in] */ IMediaSample *pMediaSample) = NULL;
101 static void LOG(LPCTSTR fmt, ...)
103 va_list args;
104 va_start(args, fmt);
105 if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1])
107 _vstprintf(buff, fmt, args);
108 if(FILE* f = _tfopen(_T("c:\\dxva.log"), _T("at")))
110 fseek(f, 0, 2);
111 _ftprintf(f, _T("%s\n"), buff);
112 fclose(f);
114 delete [] buff;
116 va_end(args);
119 static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n)
121 for(int i = 0; i < n; i++)
123 LOG(_T("%s[%d].dwSize = %d"), prefix, i, p[i].dwSize);
124 LOG(_T("%s[%d].dwFlags = %08x"), prefix, i, p[i].dwFlags);
125 LOG(_T("%s[%d].dwFourCC = %4.4hs"), prefix, i, &p[i].dwFourCC);
126 LOG(_T("%s[%d].dwRGBBitCount = %08x"), prefix, i, &p[i].dwRGBBitCount);
127 LOG(_T("%s[%d].dwRBitMask = %08x"), prefix, i, &p[i].dwRBitMask);
128 LOG(_T("%s[%d].dwGBitMask = %08x"), prefix, i, &p[i].dwGBitMask);
129 LOG(_T("%s[%d].dwBBitMask = %08x"), prefix, i, &p[i].dwBBitMask);
130 LOG(_T("%s[%d].dwRGBAlphaBitMask = %08x"), prefix, i, &p[i].dwRGBAlphaBitMask);
134 static void LOGUDI(LPCTSTR prefix, const AMVAUncompDataInfo* p, int n)
136 for(int i = 0; i < n; i++)
138 LOG(_T("%s[%d].dwUncompWidth = %d"), prefix, i, p[i].dwUncompWidth);
139 LOG(_T("%s[%d].dwUncompHeight = %d"), prefix, i, p[i].dwUncompHeight);
141 CString prefix2;
142 prefix2.Format(_T("%s[%d]"), prefix, i);
143 LOGPF(prefix2, &p[i].ddUncompPixelFormat, 1);
147 static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(
148 IAMVideoAcceleratorC * This,
149 /* [out][in] */ LPDWORD pdwNumGuidsSupported,
150 /* [out][in] */ LPGUID pGuidsSupported)
152 LOG(_T("\nGetVideoAcceleratorGUIDs"));
154 if(pdwNumGuidsSupported)
156 LOG(_T("[in] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
159 HRESULT hr = GetVideoAcceleratorGUIDsOrg(This, pdwNumGuidsSupported, pGuidsSupported);
161 LOG(_T("hr = %08x"), hr);
163 if(pdwNumGuidsSupported)
165 LOG(_T("[out] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
167 if(pGuidsSupported)
169 for(int i = 0; i < *pdwNumGuidsSupported; i++)
171 LOG(_T("[out] pGuidsSupported[%d] = %s"), i, CStringFromGUID(pGuidsSupported[i]));
176 return hr;
179 static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(
180 IAMVideoAcceleratorC * This,
181 /* [in] */ const GUID *pGuid,
182 /* [out][in] */ LPDWORD pdwNumFormatsSupported,
183 /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported)
185 LOG(_T("\nGetUncompFormatsSupported"));
187 if(pGuid)
189 LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
192 if(pdwNumFormatsSupported)
194 LOG(_T("[in] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
197 HRESULT hr = GetUncompFormatsSupportedOrg(This, pGuid, pdwNumFormatsSupported, pFormatsSupported);
199 LOG(_T("hr = %08x"), hr);
201 if(pdwNumFormatsSupported)
203 LOG(_T("[out] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
205 if(pFormatsSupported)
207 LOGPF(_T("[out] pFormatsSupported"), pFormatsSupported, *pdwNumFormatsSupported);
211 return hr;
214 static HRESULT STDMETHODCALLTYPE GetInternalMemInfoMine(
215 IAMVideoAcceleratorC * This,
216 /* [in] */ const GUID *pGuid,
217 /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
218 /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo)
220 LOG(_T("\nGetInternalMemInfo"));
222 HRESULT hr = GetInternalMemInfoOrg(This, pGuid, pamvaUncompDataInfo, pamvaInternalMemInfo);
224 LOG(_T("hr = %08x"), hr);
226 return hr;
229 static HRESULT STDMETHODCALLTYPE GetCompBufferInfoMine(
230 IAMVideoAcceleratorC * This,
231 /* [in] */ const GUID *pGuid,
232 /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
233 /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
234 /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo)
236 LOG(_T("\nGetCompBufferInfo"));
238 if(pGuid)
240 LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
242 if(pdwNumTypesCompBuffers)
244 LOG(_T("[in] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
248 HRESULT hr = GetCompBufferInfoOrg(This, pGuid, pamvaUncompDataInfo, pdwNumTypesCompBuffers, pamvaCompBufferInfo);
250 LOG(_T("hr = %08x"), hr);
252 if(pdwNumTypesCompBuffers)
254 LOG(_T("[out] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
256 if(pamvaUncompDataInfo)
258 LOGUDI(_T("[out] pamvaUncompDataInfo"), pamvaUncompDataInfo, *pdwNumTypesCompBuffers);
262 return hr;
265 static HRESULT STDMETHODCALLTYPE GetInternalCompBufferInfoMine(
266 IAMVideoAcceleratorC * This,
267 /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
268 /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo)
270 LOG(_T("\nGetInternalCompBufferInfo"));
272 HRESULT hr = GetInternalCompBufferInfoOrg(This, pdwNumTypesCompBuffers, pamvaCompBufferInfo);
274 LOG(_T("hr = %08x"), hr);
276 return hr;
279 static HRESULT STDMETHODCALLTYPE BeginFrameMine(
280 IAMVideoAcceleratorC * This,
281 /* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo)
283 LOG(_T("\nBeginFrame"));
285 if(amvaBeginFrameInfo)
287 LOG(_T("[in] amvaBeginFrameInfo->dwDestSurfaceIndex = %08x"), amvaBeginFrameInfo->dwDestSurfaceIndex);
288 LOG(_T("[in] amvaBeginFrameInfo->pInputData = %08x"), amvaBeginFrameInfo->pInputData);
289 LOG(_T("[in] amvaBeginFrameInfo->dwSizeInputData = %08x"), amvaBeginFrameInfo->dwSizeInputData);
290 LOG(_T("[in] amvaBeginFrameInfo->pOutputData = %08x"), amvaBeginFrameInfo->pOutputData);
291 LOG(_T("[in] amvaBeginFrameInfo->dwSizeOutputData = %08x"), amvaBeginFrameInfo->dwSizeOutputData);
294 HRESULT hr = BeginFrameOrg(This, amvaBeginFrameInfo);
296 LOG(_T("hr = %08x"), hr);
298 if(amvaBeginFrameInfo && amvaBeginFrameInfo->pOutputData)
300 LOG(_T("[out] amvaBeginFrameInfo->pOutputData = %02x %02x %02x %02x..."),
301 ((BYTE*)amvaBeginFrameInfo->pOutputData)[0],
302 ((BYTE*)amvaBeginFrameInfo->pOutputData)[1],
303 ((BYTE*)amvaBeginFrameInfo->pOutputData)[2],
304 ((BYTE*)amvaBeginFrameInfo->pOutputData)[3]);
307 return hr;
310 static HRESULT STDMETHODCALLTYPE EndFrameMine(
311 IAMVideoAcceleratorC * This,
312 /* [in] */ const AMVAEndFrameInfo *pEndFrameInfo)
314 LOG(_T("\nEndFrame"));
316 if(pEndFrameInfo)
318 LOG(_T("[in] pEndFrameInfo->dwSizeMiscData = %08x"), pEndFrameInfo->dwSizeMiscData);
319 LOG(_T("[in] pEndFrameInfo->pMiscData = %08x"), pEndFrameInfo->pMiscData);
322 HRESULT hr = EndFrameOrg(This, pEndFrameInfo);
324 LOG(_T("hr = %08x"), hr);
326 return hr;
329 static HRESULT STDMETHODCALLTYPE GetBufferMine(
330 IAMVideoAcceleratorC * This,
331 /* [in] */ DWORD dwTypeIndex,
332 /* [in] */ DWORD dwBufferIndex,
333 /* [in] */ BOOL bReadOnly,
334 /* [out] */ LPVOID *ppBuffer,
335 /* [out] */ LONG *lpStride)
337 LOG(_T("\nGetBuffer"));
339 LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex);
340 LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex);
341 LOG(_T("[in] bReadOnly = %08x"), bReadOnly);
342 LOG(_T("[in] ppBuffer = %08x"), ppBuffer);
343 LOG(_T("[in] lpStride = %08x"), lpStride);
345 HRESULT hr = GetBufferOrg(This, dwTypeIndex, dwBufferIndex, bReadOnly, ppBuffer, lpStride);
347 LOG(_T("hr = %08x"), hr);
349 LOG(_T("[out] *ppBuffer = %02x %02x %02x %02x ..."), ((BYTE*)*ppBuffer)[0], ((BYTE*)*ppBuffer)[1], ((BYTE*)*ppBuffer)[2], ((BYTE*)*ppBuffer)[3]);
350 LOG(_T("[out] *lpStride = %08x"), *lpStride);
352 return hr;
355 static HRESULT STDMETHODCALLTYPE ReleaseBufferMine(
356 IAMVideoAcceleratorC * This,
357 /* [in] */ DWORD dwTypeIndex,
358 /* [in] */ DWORD dwBufferIndex)
360 LOG(_T("\nReleaseBuffer"));
362 LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex);
363 LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex);
365 HRESULT hr = ReleaseBufferOrg(This, dwTypeIndex, dwBufferIndex);
367 LOG(_T("hr = %08x"), hr);
369 return hr;
372 static HRESULT STDMETHODCALLTYPE ExecuteMine(
373 IAMVideoAcceleratorC * This,
374 /* [in] */ DWORD dwFunction,
375 /* [in] */ LPVOID lpPrivateInputData,
376 /* [in] */ DWORD cbPrivateInputData,
377 /* [in] */ LPVOID lpPrivateOutputData,
378 /* [in] */ DWORD cbPrivateOutputData,
379 /* [in] */ DWORD dwNumBuffers,
380 /* [in] */ const AMVABUFFERINFO *pamvaBufferInfo)
382 LOG(_T("\nExecute"));
384 LOG(_T("[in] dwFunction = %08x"), dwFunction);
385 if(lpPrivateInputData)
387 LOG(_T("[in] lpPrivateInputData = %02x %02x %02x %02x ..."),
388 ((BYTE*)lpPrivateInputData)[0],
389 ((BYTE*)lpPrivateInputData)[1],
390 ((BYTE*)lpPrivateInputData)[2],
391 ((BYTE*)lpPrivateInputData)[3]);
393 LOG(_T("[in] cbPrivateInputData = %08x"), cbPrivateInputData);
394 LOG(_T("[in] lpPrivateOutputData = %08"), lpPrivateOutputData);
395 LOG(_T("[in] cbPrivateOutputData = %08x"), cbPrivateOutputData);
396 LOG(_T("[in] dwNumBuffers = %08x"), dwNumBuffers);
397 if(pamvaBufferInfo)
399 LOG(_T("[in] pamvaBufferInfo->dwTypeIndex = %08x"), pamvaBufferInfo->dwTypeIndex);
400 LOG(_T("[in] pamvaBufferInfo->dwBufferIndex = %08x"), pamvaBufferInfo->dwBufferIndex);
401 LOG(_T("[in] pamvaBufferInfo->dwDataOffset = %08x"), pamvaBufferInfo->dwDataOffset);
402 LOG(_T("[in] pamvaBufferInfo->dwDataSize = %08x"), pamvaBufferInfo->dwDataSize);
405 HRESULT hr = ExecuteOrg(This, dwFunction, lpPrivateInputData, cbPrivateInputData, lpPrivateOutputData, cbPrivateOutputData, dwNumBuffers, pamvaBufferInfo);
407 LOG(_T("hr = %08x"), hr);
409 if(lpPrivateOutputData)
411 LOG(_T("[out] *lpPrivateOutputData = %08"), lpPrivateOutputData);
413 if(cbPrivateOutputData)
415 LOG(_T("[out] cbPrivateOutputData = %02x %02x %02x %02x ..."),
416 ((BYTE*)lpPrivateOutputData)[0],
417 ((BYTE*)lpPrivateOutputData)[1],
418 ((BYTE*)lpPrivateOutputData)[2],
419 ((BYTE*)lpPrivateOutputData)[3]);
423 return hr;
426 static HRESULT STDMETHODCALLTYPE QueryRenderStatusMine(
427 IAMVideoAcceleratorC * This,
428 /* [in] */ DWORD dwTypeIndex,
429 /* [in] */ DWORD dwBufferIndex,
430 /* [in] */ DWORD dwFlags)
432 LOG(_T("\nQueryRenderStatus"));
434 HRESULT hr = QueryRenderStatusOrg(This, dwTypeIndex, dwBufferIndex, dwFlags);
436 LOG(_T("hr = %08x"), hr);
438 return hr;
441 static HRESULT STDMETHODCALLTYPE DisplayFrameMine(
442 IAMVideoAcceleratorC * This,
443 /* [in] */ DWORD dwFlipToIndex,
444 /* [in] */ IMediaSample *pMediaSample)
446 LOG(_T("\nDisplayFrame"));
448 HRESULT hr = DisplayFrameOrg(This, dwFlipToIndex, pMediaSample);
450 LOG(_T("hr = %08x"), hr);
452 return hr;
455 void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC)
457 BOOL res;
458 DWORD flOldProtect = 0;
459 res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_WRITECOPY, &flOldProtect);
462 if(GetVideoAcceleratorGUIDsOrg == NULL) GetVideoAcceleratorGUIDsOrg = pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs;
463 if(GetUncompFormatsSupportedOrg == NULL) GetUncompFormatsSupportedOrg = pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported;
464 if(GetInternalMemInfoOrg == NULL) GetInternalMemInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo;
465 if(GetCompBufferInfoOrg == NULL) GetCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo;
466 if(GetInternalCompBufferInfoOrg == NULL) GetInternalCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo;
467 if(BeginFrameOrg == NULL) BeginFrameOrg = pAMVideoAcceleratorC->lpVtbl->BeginFrame;
468 if(EndFrameOrg == NULL) EndFrameOrg = pAMVideoAcceleratorC->lpVtbl->EndFrame;
469 if(GetBufferOrg == NULL) GetBufferOrg = pAMVideoAcceleratorC->lpVtbl->GetBuffer;
470 if(ReleaseBufferOrg == NULL) ReleaseBufferOrg = pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer;
471 if(ExecuteOrg == NULL) ExecuteOrg = pAMVideoAcceleratorC->lpVtbl->Execute;
472 if(QueryRenderStatusOrg == NULL) QueryRenderStatusOrg = pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus;
473 if(DisplayFrameOrg == NULL) DisplayFrameOrg = pAMVideoAcceleratorC->lpVtbl->DisplayFrame;
478 pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs = GetVideoAcceleratorGUIDsMine;
479 pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported = GetUncompFormatsSupportedMine;
480 pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo = GetInternalMemInfoMine;
481 pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo = GetCompBufferInfoMine;
482 pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo = GetInternalCompBufferInfoMine;
483 pAMVideoAcceleratorC->lpVtbl->BeginFrame = BeginFrameMine;
484 pAMVideoAcceleratorC->lpVtbl->EndFrame = EndFrameMine;
485 pAMVideoAcceleratorC->lpVtbl->GetBuffer = GetBufferMine;
486 pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer = ReleaseBufferMine;
487 pAMVideoAcceleratorC->lpVtbl->Execute = ExecuteMine;
488 pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus = QueryRenderStatusMine;
489 pAMVideoAcceleratorC->lpVtbl->DisplayFrame = DisplayFrameMine;
492 res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_EXECUTE, &flOldProtect);