4 * Copyright 2003 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "quartz_private.h"
23 static const WCHAR wszOutputPinName
[] = { 'O','u','t','p','u','t',0 };
25 typedef struct AsyncReader
28 IFileSourceFilter IFileSourceFilter_iface
;
29 IAMFilterMiscFlags IAMFilterMiscFlags_iface
;
36 static inline AsyncReader
*impl_from_BaseFilter(BaseFilter
*iface
)
38 return CONTAINING_RECORD(iface
, AsyncReader
, filter
);
41 static inline AsyncReader
*impl_from_IBaseFilter(IBaseFilter
*iface
)
43 return CONTAINING_RECORD(iface
, AsyncReader
, filter
.IBaseFilter_iface
);
46 static inline AsyncReader
*impl_from_IFileSourceFilter(IFileSourceFilter
*iface
)
48 return CONTAINING_RECORD(iface
, AsyncReader
, IFileSourceFilter_iface
);
51 static inline AsyncReader
*impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
)
53 return CONTAINING_RECORD(iface
, AsyncReader
, IAMFilterMiscFlags_iface
);
56 static const IBaseFilterVtbl AsyncReader_Vtbl
;
57 static const IFileSourceFilterVtbl FileSource_Vtbl
;
58 static const IAsyncReaderVtbl FileAsyncReader_Vtbl
;
59 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
;
61 static HRESULT
FileAsyncReader_Construct(HANDLE hFile
, IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
);
63 static const WCHAR mediatype_name
[] = {
64 'M', 'e', 'd', 'i', 'a', ' ', 'T', 'y', 'p', 'e', 0 };
65 static const WCHAR subtype_name
[] = {
66 'S', 'u', 'b', 't', 'y', 'p', 'e', 0 };
67 static const WCHAR source_filter_name
[] = {
68 'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
70 static HRESULT
process_extensions(HKEY hkeyExtensions
, LPCOLESTR pszFileName
, GUID
* majorType
, GUID
* minorType
, GUID
* sourceFilter
)
81 /* Get the part of the name that matters */
82 extension
= PathFindExtensionW(pszFileName
);
83 if (*extension
!= '.')
86 l
= RegOpenKeyExW(hkeyExtensions
, extension
, 0, KEY_READ
, &hsub
);
92 size
= sizeof(keying
);
93 l
= RegQueryValueExW(hsub
, mediatype_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
95 CLSIDFromString(keying
, majorType
);
100 size
= sizeof(keying
);
102 l
= RegQueryValueExW(hsub
, subtype_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
104 CLSIDFromString(keying
, minorType
);
109 size
= sizeof(keying
);
111 l
= RegQueryValueExW(hsub
, source_filter_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
113 CLSIDFromString(keying
, sourceFilter
);
123 static unsigned char byte_from_hex_char(WCHAR wHex
)
125 switch (tolowerW(wHex
))
137 return (wHex
- '0') & 0xf;
144 return (wHex
- 'a' + 10) & 0xf;
150 static HRESULT
process_pattern_string(LPCWSTR wszPatternString
, IAsyncReader
* pReader
)
160 TRACE("\t\tPattern string: %s\n", debugstr_w(wszPatternString
));
162 /* format: "offset, bytestocompare, mask, value" */
164 ulOffset
= strtolW(wszPatternString
, NULL
, 10);
166 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
169 wszPatternString
++; /* skip ',' */
171 ulBytes
= strtolW(wszPatternString
, NULL
, 10);
173 pbMask
= HeapAlloc(GetProcessHeap(), 0, ulBytes
);
174 pbValue
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, ulBytes
);
175 pbFile
= HeapAlloc(GetProcessHeap(), 0, ulBytes
);
177 /* default mask is match everything */
178 memset(pbMask
, 0xFF, ulBytes
);
180 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
185 wszPatternString
++; /* skip ',' */
186 while (!isxdigitW(*wszPatternString
) && (*wszPatternString
!= ',')) wszPatternString
++;
188 for (strpos
= 0; isxdigitW(*wszPatternString
) && (strpos
/2 < ulBytes
); wszPatternString
++, strpos
++)
190 if ((strpos
% 2) == 1) /* odd numbered position */
191 pbMask
[strpos
/ 2] |= byte_from_hex_char(*wszPatternString
);
193 pbMask
[strpos
/ 2] = byte_from_hex_char(*wszPatternString
) << 4;
196 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
199 wszPatternString
++; /* skip ',' */
204 for ( ; !isxdigitW(*wszPatternString
) && (*wszPatternString
!= ','); wszPatternString
++)
207 for (strpos
= 0; isxdigitW(*wszPatternString
) && (strpos
/2 < ulBytes
); wszPatternString
++, strpos
++)
209 if ((strpos
% 2) == 1) /* odd numbered position */
210 pbValue
[strpos
/ 2] |= byte_from_hex_char(*wszPatternString
);
212 pbValue
[strpos
/ 2] = byte_from_hex_char(*wszPatternString
) << 4;
217 hr
= IAsyncReader_SyncRead(pReader
, ulOffset
, ulBytes
, pbFile
);
222 for (i
= 0; i
< ulBytes
; i
++)
223 if ((pbFile
[i
] & pbMask
[i
]) != pbValue
[i
])
230 HeapFree(GetProcessHeap(), 0, pbMask
);
231 HeapFree(GetProcessHeap(), 0, pbValue
);
232 HeapFree(GetProcessHeap(), 0, pbFile
);
234 /* if we encountered no errors with this string, and there is a following tuple, then we
235 * have to match that as well to succeed */
236 if ((hr
== S_OK
) && (wszPatternString
= strchrW(wszPatternString
, ',')))
237 return process_pattern_string(wszPatternString
+ 1, pReader
);
242 HRESULT
GetClassMediaFile(IAsyncReader
* pReader
, LPCOLESTR pszFileName
, GUID
* majorType
, GUID
* minorType
, GUID
* sourceFilter
)
244 HKEY hkeyMediaType
= NULL
;
248 static const WCHAR wszMediaType
[] = {'M','e','d','i','a',' ','T','y','p','e',0};
250 TRACE("(%p, %s, %p, %p)\n", pReader
, debugstr_w(pszFileName
), majorType
, minorType
);
253 *majorType
= GUID_NULL
;
255 *minorType
= GUID_NULL
;
257 *sourceFilter
= GUID_NULL
;
259 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszMediaType
, 0, KEY_READ
, &hkeyMediaType
);
260 hr
= HRESULT_FROM_WIN32(lRet
);
266 for (indexMajor
= 0; !bFound
; indexMajor
++)
269 WCHAR wszMajorKeyName
[CHARS_IN_GUID
];
270 DWORD dwKeyNameLength
= sizeof(wszMajorKeyName
) / sizeof(wszMajorKeyName
[0]);
271 static const WCHAR wszExtensions
[] = {'E','x','t','e','n','s','i','o','n','s',0};
273 if (RegEnumKeyExW(hkeyMediaType
, indexMajor
, wszMajorKeyName
, &dwKeyNameLength
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
275 if (RegOpenKeyExW(hkeyMediaType
, wszMajorKeyName
, 0, KEY_READ
, &hkeyMajor
) != ERROR_SUCCESS
)
277 TRACE("%s\n", debugstr_w(wszMajorKeyName
));
278 if (!strcmpW(wszExtensions
, wszMajorKeyName
))
280 if (process_extensions(hkeyMajor
, pszFileName
, majorType
, minorType
, sourceFilter
) == S_OK
)
283 /* We need a reader interface to check bytes */
288 for (indexMinor
= 0; !bFound
; indexMinor
++)
291 WCHAR wszMinorKeyName
[CHARS_IN_GUID
];
292 DWORD dwMinorKeyNameLen
= sizeof(wszMinorKeyName
) / sizeof(wszMinorKeyName
[0]);
293 WCHAR wszSourceFilterKeyName
[CHARS_IN_GUID
];
294 DWORD dwSourceFilterKeyNameLen
= sizeof(wszSourceFilterKeyName
);
298 if (RegEnumKeyExW(hkeyMajor
, indexMinor
, wszMinorKeyName
, &dwMinorKeyNameLen
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
301 if (RegOpenKeyExW(hkeyMajor
, wszMinorKeyName
, 0, KEY_READ
, &hkeyMinor
) != ERROR_SUCCESS
)
304 TRACE("\t%s\n", debugstr_w(wszMinorKeyName
));
306 if (RegQueryInfoKeyW(hkeyMinor
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, &maxValueLen
, NULL
, NULL
) != ERROR_SUCCESS
)
309 for (indexValue
= 0; !bFound
; indexValue
++)
312 WCHAR wszValueName
[14]; /* longest name we should encounter will be "Source Filter" */
313 LPWSTR wszPatternString
= HeapAlloc(GetProcessHeap(), 0, maxValueLen
);
314 DWORD dwValueNameLen
= sizeof(wszValueName
) / sizeof(wszValueName
[0]); /* remember this is in chars */
315 DWORD dwDataLen
= maxValueLen
; /* remember this is in bytes */
317 if (RegEnumValueW(hkeyMinor
, indexValue
, wszValueName
, &dwValueNameLen
, NULL
, &dwType
, (LPBYTE
)wszPatternString
, &dwDataLen
) != ERROR_SUCCESS
)
319 HeapFree(GetProcessHeap(), 0, wszPatternString
);
323 if (strcmpW(wszValueName
, source_filter_name
)==0) {
324 HeapFree(GetProcessHeap(), 0, wszPatternString
);
328 /* if it is not the source filter value */
329 if (process_pattern_string(wszPatternString
, pReader
) == S_OK
)
331 HeapFree(GetProcessHeap(), 0, wszPatternString
);
332 if (majorType
&& FAILED(CLSIDFromString(wszMajorKeyName
, majorType
)))
334 if (minorType
&& FAILED(CLSIDFromString(wszMinorKeyName
, minorType
)))
338 /* Look up the source filter key */
339 if (RegQueryValueExW(hkeyMinor
, source_filter_name
, NULL
, NULL
, (LPBYTE
)wszSourceFilterKeyName
, &dwSourceFilterKeyNameLen
))
341 if (FAILED(CLSIDFromString(wszSourceFilterKeyName
, sourceFilter
)))
346 HeapFree(GetProcessHeap(), 0, wszPatternString
);
348 CloseHandle(hkeyMinor
);
351 CloseHandle(hkeyMajor
);
354 CloseHandle(hkeyMediaType
);
356 if (SUCCEEDED(hr
) && !bFound
)
358 ERR("Media class not found\n");
363 TRACE("Found file's class:\n");
365 TRACE("\tmajor = %s\n", qzdebugstr_guid(majorType
));
367 TRACE("\tsubtype = %s\n", qzdebugstr_guid(minorType
));
369 TRACE("\tsource filter = %s\n", qzdebugstr_guid(sourceFilter
));
375 static IPin
* WINAPI
AsyncReader_GetPin(BaseFilter
*iface
, int pos
)
377 AsyncReader
*This
= impl_from_BaseFilter(iface
);
379 if (pos
>= 1 || !This
->pOutputPin
)
382 IPin_AddRef(This
->pOutputPin
);
383 return This
->pOutputPin
;
386 static LONG WINAPI
AsyncReader_GetPinCount(BaseFilter
*iface
)
388 AsyncReader
*This
= impl_from_BaseFilter(iface
);
390 if (!This
->pOutputPin
)
396 static const BaseFilterFuncTable BaseFuncTable
= {
398 AsyncReader_GetPinCount
401 HRESULT
AsyncReader_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
403 AsyncReader
*pAsyncRead
;
406 return CLASS_E_NOAGGREGATION
;
408 pAsyncRead
= CoTaskMemAlloc(sizeof(AsyncReader
));
411 return E_OUTOFMEMORY
;
413 BaseFilter_Init(&pAsyncRead
->filter
, &AsyncReader_Vtbl
, &CLSID_AsyncReader
, (DWORD_PTR
)(__FILE__
": AsyncReader.csFilter"), &BaseFuncTable
);
415 pAsyncRead
->IFileSourceFilter_iface
.lpVtbl
= &FileSource_Vtbl
;
416 pAsyncRead
->IAMFilterMiscFlags_iface
.lpVtbl
= &IAMFilterMiscFlags_Vtbl
;
417 pAsyncRead
->pOutputPin
= NULL
;
419 pAsyncRead
->pszFileName
= NULL
;
420 pAsyncRead
->pmt
= NULL
;
424 TRACE("-- created at %p\n", pAsyncRead
);
429 /** IUnknown methods **/
431 static HRESULT WINAPI
AsyncReader_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
433 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
435 TRACE("(%s, %p)\n", qzdebugstr_guid(riid
), ppv
);
439 if (IsEqualIID(riid
, &IID_IUnknown
))
441 else if (IsEqualIID(riid
, &IID_IPersist
))
443 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
445 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
447 else if (IsEqualIID(riid
, &IID_IFileSourceFilter
))
448 *ppv
= &This
->IFileSourceFilter_iface
;
449 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
450 *ppv
= &This
->IAMFilterMiscFlags_iface
;
454 IUnknown_AddRef((IUnknown
*)(*ppv
));
458 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IMediaSeeking
) &&
459 !IsEqualIID(riid
, &IID_IVideoWindow
) && !IsEqualIID(riid
, &IID_IBasicAudio
))
460 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
462 return E_NOINTERFACE
;
465 static ULONG WINAPI
AsyncReader_Release(IBaseFilter
* iface
)
467 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
468 ULONG refCount
= InterlockedDecrement(&This
->filter
.refCount
);
470 TRACE("(%p)->() Release from %d\n", This
, refCount
+ 1);
474 if (This
->pOutputPin
)
477 if(SUCCEEDED(IPin_ConnectedTo(This
->pOutputPin
, &pConnectedTo
)))
479 IPin_Disconnect(pConnectedTo
);
480 IPin_Release(pConnectedTo
);
482 IPin_Disconnect(This
->pOutputPin
);
483 IPin_Release(This
->pOutputPin
);
485 CoTaskMemFree(This
->pszFileName
);
487 FreeMediaType(This
->pmt
);
488 BaseFilter_Destroy(&This
->filter
);
496 /** IMediaFilter methods **/
498 static HRESULT WINAPI
AsyncReader_Stop(IBaseFilter
* iface
)
500 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
504 This
->filter
.state
= State_Stopped
;
509 static HRESULT WINAPI
AsyncReader_Pause(IBaseFilter
* iface
)
511 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
515 This
->filter
.state
= State_Paused
;
520 static HRESULT WINAPI
AsyncReader_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
522 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
524 TRACE("(%x%08x)\n", (ULONG
)(tStart
>> 32), (ULONG
)tStart
);
526 This
->filter
.state
= State_Running
;
531 /** IBaseFilter methods **/
533 static HRESULT WINAPI
AsyncReader_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
535 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
536 TRACE("(%s, %p)\n", debugstr_w(Id
), ppPin
);
541 if (strcmpW(Id
, wszOutputPinName
))
544 return VFW_E_NOT_FOUND
;
547 *ppPin
= This
->pOutputPin
;
552 static const IBaseFilterVtbl AsyncReader_Vtbl
=
554 AsyncReader_QueryInterface
,
555 BaseFilterImpl_AddRef
,
557 BaseFilterImpl_GetClassID
,
561 BaseFilterImpl_GetState
,
562 BaseFilterImpl_SetSyncSource
,
563 BaseFilterImpl_GetSyncSource
,
564 BaseFilterImpl_EnumPins
,
566 BaseFilterImpl_QueryFilterInfo
,
567 BaseFilterImpl_JoinFilterGraph
,
568 BaseFilterImpl_QueryVendorInfo
571 static HRESULT WINAPI
FileSource_QueryInterface(IFileSourceFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
573 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
575 return IBaseFilter_QueryInterface(&This
->filter
.IBaseFilter_iface
, riid
, ppv
);
578 static ULONG WINAPI
FileSource_AddRef(IFileSourceFilter
* iface
)
580 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
582 return IBaseFilter_AddRef(&This
->filter
.IBaseFilter_iface
);
585 static ULONG WINAPI
FileSource_Release(IFileSourceFilter
* iface
)
587 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
589 return IBaseFilter_Release(&This
->filter
.IBaseFilter_iface
);
592 static HRESULT WINAPI
FileSource_Load(IFileSourceFilter
* iface
, LPCOLESTR pszFileName
, const AM_MEDIA_TYPE
* pmt
)
596 IAsyncReader
* pReader
= NULL
;
597 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
599 TRACE("(%s, %p)\n", debugstr_w(pszFileName
), pmt
);
602 /* FIXME: check the sharing values that native uses */
603 hFile
= CreateFileW(pszFileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, FILE_FLAG_OVERLAPPED
, NULL
);
605 if (hFile
== INVALID_HANDLE_VALUE
)
607 return HRESULT_FROM_WIN32(GetLastError());
611 hr
= FileAsyncReader_Construct(hFile
, &This
->filter
.IBaseFilter_iface
, &This
->filter
.csFilter
, &This
->pOutputPin
);
612 BaseFilterImpl_IncrementPinVersion(&This
->filter
);
615 hr
= IPin_QueryInterface(This
->pOutputPin
, &IID_IAsyncReader
, (LPVOID
*)&pReader
);
617 /* store file name & media type */
620 CoTaskMemFree(This
->pszFileName
);
622 FreeMediaType(This
->pmt
);
624 This
->pszFileName
= CoTaskMemAlloc((strlenW(pszFileName
) + 1) * sizeof(WCHAR
));
625 strcpyW(This
->pszFileName
, pszFileName
);
627 This
->pmt
= CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
));
630 This
->pmt
->bFixedSizeSamples
= TRUE
;
631 This
->pmt
->bTemporalCompression
= FALSE
;
632 This
->pmt
->cbFormat
= 0;
633 This
->pmt
->pbFormat
= NULL
;
634 This
->pmt
->pUnk
= NULL
;
635 This
->pmt
->lSampleSize
= 0;
636 This
->pmt
->formattype
= FORMAT_None
;
637 hr
= GetClassMediaFile(pReader
, pszFileName
, &This
->pmt
->majortype
, &This
->pmt
->subtype
, NULL
);
640 CoTaskMemFree(This
->pmt
);
645 CopyMediaType(This
->pmt
, pmt
);
649 IAsyncReader_Release(pReader
);
653 if (This
->pOutputPin
)
655 IPin_Release(This
->pOutputPin
);
656 This
->pOutputPin
= NULL
;
659 CoTaskMemFree(This
->pszFileName
);
661 FreeMediaType(This
->pmt
);
662 This
->pszFileName
= NULL
;
668 /* FIXME: check return codes */
672 static HRESULT WINAPI
FileSource_GetCurFile(IFileSourceFilter
* iface
, LPOLESTR
* ppszFileName
, AM_MEDIA_TYPE
* pmt
)
674 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
676 TRACE("(%p, %p)\n", ppszFileName
, pmt
);
681 /* copy file name & media type if available, otherwise clear the outputs */
682 if (This
->pszFileName
)
684 *ppszFileName
= CoTaskMemAlloc((strlenW(This
->pszFileName
) + 1) * sizeof(WCHAR
));
685 strcpyW(*ppszFileName
, This
->pszFileName
);
688 *ppszFileName
= NULL
;
693 CopyMediaType(pmt
, This
->pmt
);
695 ZeroMemory(pmt
, sizeof(*pmt
));
701 static const IFileSourceFilterVtbl FileSource_Vtbl
=
703 FileSource_QueryInterface
,
707 FileSource_GetCurFile
711 /* the dwUserData passed back to user */
712 typedef struct DATAREQUEST
714 IMediaSample
* pSample
; /* sample passed to us by user */
715 DWORD_PTR dwUserData
; /* user data passed to us */
716 OVERLAPPED ovl
; /* our overlapped structure */
719 typedef struct FileAsyncReader
722 IAsyncReader IAsyncReader_iface
;
724 ALLOCATOR_PROPERTIES allocProps
;
727 /* Why would you need more? Every sample has its own handle */
731 CRITICAL_SECTION csList
; /* critical section to prevent concurrency issues */
732 DATAREQUEST
*sample_list
;
734 /* Have a handle for every sample, and then one more as flushing handle */
738 static inline FileAsyncReader
*impl_from_IPin(IPin
*iface
)
740 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
.pin
.IPin_iface
);
743 static inline FileAsyncReader
*impl_from_BasePin(BasePin
*iface
)
745 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
.pin
);
748 static inline FileAsyncReader
*impl_from_BaseOutputPin(BaseOutputPin
*iface
)
750 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
);
753 static inline BaseOutputPin
*impl_BaseOututPin_from_BasePin(BasePin
*iface
)
755 return CONTAINING_RECORD(iface
, BaseOutputPin
, pin
);
758 static inline FileAsyncReader
*impl_from_IAsyncReader(IAsyncReader
*iface
)
760 return CONTAINING_RECORD(iface
, FileAsyncReader
, IAsyncReader_iface
);
763 static HRESULT WINAPI
FileAsyncReaderPin_QueryAccept(IPin
*iface
, const AM_MEDIA_TYPE
*pmt
)
765 FileAsyncReader
*This
= impl_from_IPin(iface
);
766 AM_MEDIA_TYPE
*pmt_filter
= impl_from_IBaseFilter(This
->pin
.pin
.pinInfo
.pFilter
)->pmt
;
768 FIXME("(%p, %p)\n", iface
, pmt
);
770 if (IsEqualGUID(&pmt
->majortype
, &pmt_filter
->majortype
) &&
771 IsEqualGUID(&pmt
->subtype
, &pmt_filter
->subtype
) &&
772 IsEqualGUID(&pmt
->formattype
, &FORMAT_None
))
778 static HRESULT WINAPI
FileAsyncReaderPin_GetMediaType(BasePin
*iface
, int iPosition
, AM_MEDIA_TYPE
*pmt
)
780 FileAsyncReader
*This
= impl_from_BasePin(iface
);
784 return VFW_S_NO_MORE_ITEMS
;
785 CopyMediaType(pmt
, impl_from_IBaseFilter(This
->pin
.pin
.pinInfo
.pFilter
)->pmt
);
789 /* overridden pin functions */
791 static HRESULT WINAPI
FileAsyncReaderPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
)
793 FileAsyncReader
*This
= impl_from_IPin(iface
);
794 TRACE("(%s, %p)\n", qzdebugstr_guid(riid
), ppv
);
798 if (IsEqualIID(riid
, &IID_IUnknown
))
800 else if (IsEqualIID(riid
, &IID_IPin
))
802 else if (IsEqualIID(riid
, &IID_IAsyncReader
))
803 *ppv
= &This
->IAsyncReader_iface
;
807 IUnknown_AddRef((IUnknown
*)(*ppv
));
811 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IMediaSeeking
))
812 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
814 return E_NOINTERFACE
;
817 static ULONG WINAPI
FileAsyncReaderPin_Release(IPin
* iface
)
819 FileAsyncReader
*This
= impl_from_IPin(iface
);
820 ULONG refCount
= InterlockedDecrement(&This
->pin
.pin
.refCount
);
823 TRACE("(%p)->() Release from %d\n", This
, refCount
+ 1);
827 CoTaskMemFree(This
->sample_list
);
828 if (This
->handle_list
)
830 for (x
= 0; x
<= This
->samples
; ++x
)
831 CloseHandle(This
->handle_list
[x
]);
832 CoTaskMemFree(This
->handle_list
);
834 CloseHandle(This
->hFile
);
835 This
->csList
.DebugInfo
->Spare
[0] = 0;
836 DeleteCriticalSection(&This
->csList
);
837 BaseOutputPin_Destroy(&This
->pin
);
843 static const IPinVtbl FileAsyncReaderPin_Vtbl
=
845 FileAsyncReaderPin_QueryInterface
,
847 FileAsyncReaderPin_Release
,
848 BaseOutputPinImpl_Connect
,
849 BaseOutputPinImpl_ReceiveConnection
,
850 BasePinImpl_Disconnect
,
851 BasePinImpl_ConnectedTo
,
852 BasePinImpl_ConnectionMediaType
,
853 BasePinImpl_QueryPinInfo
,
854 BasePinImpl_QueryDirection
,
856 FileAsyncReaderPin_QueryAccept
,
857 BasePinImpl_EnumMediaTypes
,
858 BasePinImpl_QueryInternalConnections
,
859 BaseOutputPinImpl_EndOfStream
,
860 BaseOutputPinImpl_BeginFlush
,
861 BaseOutputPinImpl_EndFlush
,
862 BasePinImpl_NewSegment
865 /* Function called as a helper to IPin_Connect */
866 /* specific AM_MEDIA_TYPE - it cannot be NULL */
867 /* this differs from standard OutputPin_AttemptConnection only in that it
868 * doesn't need the IMemInputPin interface on the receiving pin */
869 static HRESULT WINAPI
FileAsyncReaderPin_AttemptConnection(BasePin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
)
871 BaseOutputPin
*This
= impl_BaseOututPin_from_BasePin(iface
);
874 TRACE("(%p, %p)\n", pReceivePin
, pmt
);
875 dump_AM_MEDIA_TYPE(pmt
);
877 /* FIXME: call queryacceptproc */
879 This
->pin
.pConnectedTo
= pReceivePin
;
880 IPin_AddRef(pReceivePin
);
881 CopyMediaType(&This
->pin
.mtCurrent
, pmt
);
883 hr
= IPin_ReceiveConnection(pReceivePin
, &iface
->IPin_iface
, pmt
);
887 IPin_Release(This
->pin
.pConnectedTo
);
888 This
->pin
.pConnectedTo
= NULL
;
889 FreeMediaType(&This
->pin
.mtCurrent
);
892 TRACE(" -- %x\n", hr
);
896 static HRESULT WINAPI
FileAsyncReaderPin_DecideBufferSize(BaseOutputPin
*iface
, IMemAllocator
*pAlloc
, ALLOCATOR_PROPERTIES
*ppropInputRequest
)
898 FileAsyncReader
*This
= impl_from_BaseOutputPin(iface
);
899 ALLOCATOR_PROPERTIES actual
;
901 if (ppropInputRequest
->cbAlign
&& ppropInputRequest
->cbAlign
!= This
->allocProps
.cbAlign
)
902 FIXME("Requested Buffer cbAlign mismatch %i,%i\n",This
->allocProps
.cbAlign
, ppropInputRequest
->cbAlign
);
903 if (ppropInputRequest
->cbPrefix
)
904 FIXME("Requested Buffer cbPrefix mismatch %i,%i\n",This
->allocProps
.cbPrefix
, ppropInputRequest
->cbPrefix
);
905 if (ppropInputRequest
->cbBuffer
)
906 FIXME("Requested Buffer cbBuffer mismatch %i,%i\n",This
->allocProps
.cbBuffer
, ppropInputRequest
->cbBuffer
);
907 if (ppropInputRequest
->cBuffers
)
908 FIXME("Requested Buffer cBuffers mismatch %i,%i\n",This
->allocProps
.cBuffers
, ppropInputRequest
->cBuffers
);
910 return IMemAllocator_SetProperties(pAlloc
, &This
->allocProps
, &actual
);
913 static const BaseOutputPinFuncTable output_BaseOutputFuncTable
= {
916 FileAsyncReaderPin_AttemptConnection
,
917 BasePinImpl_GetMediaTypeVersion
,
918 FileAsyncReaderPin_GetMediaType
920 FileAsyncReaderPin_DecideBufferSize
,
921 BaseOutputPinImpl_DecideAllocator
,
922 BaseOutputPinImpl_BreakConnect
925 static HRESULT
FileAsyncReader_Construct(HANDLE hFile
, IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
)
931 piOutput
.dir
= PINDIR_OUTPUT
;
932 piOutput
.pFilter
= pBaseFilter
;
933 strcpyW(piOutput
.achName
, wszOutputPinName
);
934 hr
= BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl
, sizeof(FileAsyncReader
), &piOutput
, &output_BaseOutputFuncTable
, pCritSec
, ppPin
);
938 FileAsyncReader
*pPinImpl
= (FileAsyncReader
*)*ppPin
;
939 pPinImpl
->IAsyncReader_iface
.lpVtbl
= &FileAsyncReader_Vtbl
;
940 pPinImpl
->hFile
= hFile
;
941 pPinImpl
->bFlushing
= FALSE
;
942 pPinImpl
->sample_list
= NULL
;
943 pPinImpl
->handle_list
= NULL
;
944 pPinImpl
->queued_number
= 0;
945 InitializeCriticalSection(&pPinImpl
->csList
);
946 pPinImpl
->csList
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": FileAsyncReader.csList");
953 static HRESULT WINAPI
FileAsyncReader_QueryInterface(IAsyncReader
* iface
, REFIID riid
, LPVOID
* ppv
)
955 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
957 return IPin_QueryInterface(&This
->pin
.pin
.IPin_iface
, riid
, ppv
);
960 static ULONG WINAPI
FileAsyncReader_AddRef(IAsyncReader
* iface
)
962 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
964 return IPin_AddRef(&This
->pin
.pin
.IPin_iface
);
967 static ULONG WINAPI
FileAsyncReader_Release(IAsyncReader
* iface
)
969 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
971 return IPin_Release(&This
->pin
.pin
.IPin_iface
);
974 #define DEF_ALIGNMENT 1
976 static HRESULT WINAPI
FileAsyncReader_RequestAllocator(IAsyncReader
* iface
, IMemAllocator
* pPreferred
, ALLOCATOR_PROPERTIES
* pProps
, IMemAllocator
** ppActual
)
978 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
982 TRACE("(%p, %p, %p)\n", pPreferred
, pProps
, ppActual
);
984 if (!pProps
->cbAlign
|| (pProps
->cbAlign
% DEF_ALIGNMENT
) != 0)
985 pProps
->cbAlign
= DEF_ALIGNMENT
;
989 hr
= IMemAllocator_SetProperties(pPreferred
, pProps
, pProps
);
990 /* FIXME: check we are still aligned */
993 IMemAllocator_AddRef(pPreferred
);
994 *ppActual
= pPreferred
;
995 TRACE("FileAsyncReader_RequestAllocator -- %x\n", hr
);
1002 hr
= CoCreateInstance(&CLSID_MemoryAllocator
, NULL
, CLSCTX_INPROC
, &IID_IMemAllocator
, (LPVOID
*)&pPreferred
);
1006 hr
= IMemAllocator_SetProperties(pPreferred
, pProps
, pProps
);
1007 /* FIXME: check we are still aligned */
1010 *ppActual
= pPreferred
;
1011 TRACE("FileAsyncReader_RequestAllocator -- %x\n", hr
);
1018 CoTaskMemFree(This
->sample_list
);
1019 if (This
->handle_list
)
1022 for (x
= 0; x
<= This
->samples
; ++x
)
1023 CloseHandle(This
->handle_list
[x
]);
1024 CoTaskMemFree(This
->handle_list
);
1027 This
->samples
= pProps
->cBuffers
;
1028 This
->oldest_sample
= 0;
1029 TRACE("Samples: %u\n", This
->samples
);
1030 This
->sample_list
= CoTaskMemAlloc(sizeof(This
->sample_list
[0]) * pProps
->cBuffers
);
1031 This
->handle_list
= CoTaskMemAlloc(sizeof(HANDLE
) * pProps
->cBuffers
* 2);
1033 if (This
->sample_list
&& This
->handle_list
)
1036 ZeroMemory(This
->sample_list
, sizeof(This
->sample_list
[0]) * pProps
->cBuffers
);
1037 for (x
= 0; x
< This
->samples
; ++x
)
1039 This
->sample_list
[x
].ovl
.hEvent
= This
->handle_list
[x
] = CreateEventW(NULL
, 0, 0, NULL
);
1040 if (x
+ 1 < This
->samples
)
1041 This
->handle_list
[This
->samples
+ 1 + x
] = This
->handle_list
[x
];
1043 This
->handle_list
[This
->samples
] = CreateEventW(NULL
, 1, 0, NULL
);
1044 This
->allocProps
= *pProps
;
1049 CoTaskMemFree(This
->sample_list
);
1050 CoTaskMemFree(This
->handle_list
);
1052 This
->sample_list
= NULL
;
1053 This
->handle_list
= NULL
;
1061 IMemAllocator_Release(pPreferred
);
1064 TRACE("-- %x\n", hr
);
1068 /* we could improve the Request/WaitForNext mechanism by allowing out of order samples.
1069 * however, this would be quite complicated to do and may be a bit error prone */
1070 static HRESULT WINAPI
FileAsyncReader_Request(IAsyncReader
* iface
, IMediaSample
* pSample
, DWORD_PTR dwUser
)
1073 REFERENCE_TIME Start
;
1074 REFERENCE_TIME Stop
;
1075 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1076 LPBYTE pBuffer
= NULL
;
1078 TRACE("(%p, %lx)\n", pSample
, dwUser
);
1083 /* get start and stop positions in bytes */
1085 hr
= IMediaSample_GetTime(pSample
, &Start
, &Stop
);
1088 hr
= IMediaSample_GetPointer(pSample
, &pBuffer
);
1090 EnterCriticalSection(&This
->csList
);
1091 if (This
->bFlushing
)
1093 LeaveCriticalSection(&This
->csList
);
1094 return VFW_E_WRONG_STATE
;
1099 DWORD dwLength
= (DWORD
) BYTES_FROM_MEDIATIME(Stop
- Start
);
1100 DATAREQUEST
*pDataRq
;
1103 /* Try to insert above the waiting sample if possible */
1104 for (x
= This
->oldest_sample
; x
< This
->samples
; ++x
)
1106 if (!This
->sample_list
[x
].pSample
)
1110 if (x
>= This
->samples
)
1111 for (x
= 0; x
< This
->oldest_sample
; ++x
)
1113 if (!This
->sample_list
[x
].pSample
)
1117 /* There must be a sample we have found */
1118 assert(x
< This
->samples
);
1119 ++This
->queued_number
;
1121 pDataRq
= This
->sample_list
+ x
;
1123 pDataRq
->ovl
.u
.s
.Offset
= (DWORD
) BYTES_FROM_MEDIATIME(Start
);
1124 pDataRq
->ovl
.u
.s
.OffsetHigh
= (DWORD
)(BYTES_FROM_MEDIATIME(Start
) >> (sizeof(DWORD
) * 8));
1125 pDataRq
->dwUserData
= dwUser
;
1127 /* we violate traditional COM rules here by maintaining
1128 * a reference to the sample, but not calling AddRef, but
1129 * that's what MSDN says to do */
1130 pDataRq
->pSample
= pSample
;
1132 /* this is definitely not how it is implemented on Win9x
1133 * as they do not support async reads on files, but it is
1134 * sooo much easier to use this than messing around with threads!
1136 if (!ReadFile(This
->hFile
, pBuffer
, dwLength
, NULL
, &pDataRq
->ovl
))
1137 hr
= HRESULT_FROM_WIN32(GetLastError());
1139 /* ERROR_IO_PENDING is not actually an error since this is what we want! */
1140 if (hr
== HRESULT_FROM_WIN32(ERROR_IO_PENDING
))
1144 LeaveCriticalSection(&This
->csList
);
1146 TRACE("-- %x\n", hr
);
1150 static HRESULT WINAPI
FileAsyncReader_WaitForNext(IAsyncReader
* iface
, DWORD dwTimeout
, IMediaSample
** ppSample
, DWORD_PTR
* pdwUser
)
1153 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1156 TRACE("(%u, %p, %p)\n", dwTimeout
, ppSample
, pdwUser
);
1161 EnterCriticalSection(&This
->csList
);
1162 if (!This
->bFlushing
)
1164 LONG oldest
= This
->oldest_sample
;
1166 if (!This
->queued_number
)
1168 /* It could be that nothing is queued right now, but that can be fixed */
1169 WARN("Called without samples in queue and not flushing!!\n");
1171 LeaveCriticalSection(&This
->csList
);
1173 /* wait for an object to read, or time out */
1174 buffer
= WaitForMultipleObjectsEx(This
->samples
+1, This
->handle_list
+ oldest
, FALSE
, dwTimeout
, TRUE
);
1176 EnterCriticalSection(&This
->csList
);
1177 if (buffer
<= This
->samples
)
1179 /* Re-scale the buffer back to normal */
1182 /* Uh oh, we overshot the flusher handle, renormalize it back to 0..Samples-1 */
1183 if (buffer
> This
->samples
)
1184 buffer
-= This
->samples
+ 1;
1185 assert(buffer
<= This
->samples
);
1188 if (buffer
>= This
->samples
)
1190 if (buffer
!= This
->samples
)
1192 FIXME("Returned: %u (%08x)\n", buffer
, GetLastError());
1196 hr
= VFW_E_WRONG_STATE
;
1200 --This
->queued_number
;
1203 if (This
->bFlushing
&& buffer
== ~0)
1205 for (buffer
= 0; buffer
< This
->samples
; ++buffer
)
1207 if (This
->sample_list
[buffer
].pSample
)
1209 ResetEvent(This
->handle_list
[buffer
]);
1213 if (buffer
== This
->samples
)
1215 assert(!This
->queued_number
);
1220 --This
->queued_number
;
1227 REFERENCE_TIME rtStart
, rtStop
;
1228 REFERENCE_TIME rtSampleStart
, rtSampleStop
;
1229 DATAREQUEST
*pDataRq
= This
->sample_list
+ buffer
;
1232 /* get any errors */
1233 if (!This
->bFlushing
&& !GetOverlappedResult(This
->hFile
, &pDataRq
->ovl
, &dwBytes
, FALSE
))
1234 hr
= HRESULT_FROM_WIN32(GetLastError());
1236 /* Return the sample no matter what so it can be destroyed */
1237 *ppSample
= pDataRq
->pSample
;
1238 *pdwUser
= pDataRq
->dwUserData
;
1240 if (This
->bFlushing
)
1241 hr
= VFW_E_WRONG_STATE
;
1246 /* Set the time on the sample */
1247 IMediaSample_SetActualDataLength(pDataRq
->pSample
, dwBytes
);
1249 rtStart
= (DWORD64
)pDataRq
->ovl
.u
.s
.Offset
+ ((DWORD64
)pDataRq
->ovl
.u
.s
.OffsetHigh
<< 32);
1250 rtStart
= MEDIATIME_FROM_BYTES(rtStart
);
1251 rtStop
= rtStart
+ MEDIATIME_FROM_BYTES(dwBytes
);
1253 IMediaSample_GetTime(pDataRq
->pSample
, &rtSampleStart
, &rtSampleStop
);
1254 assert(rtStart
== rtSampleStart
);
1255 assert(rtStop
<= rtSampleStop
);
1257 IMediaSample_SetTime(pDataRq
->pSample
, &rtStart
, &rtStop
);
1258 assert(rtStart
== rtSampleStart
);
1260 assert(rtStop
== rtSampleStop
);
1262 assert(rtStop
== rtStart
);
1264 This
->sample_list
[buffer
].pSample
= NULL
;
1265 assert(This
->oldest_sample
< This
->samples
);
1267 if (buffer
== This
->oldest_sample
)
1270 for (x
= This
->oldest_sample
+ 1; x
< This
->samples
; ++x
)
1271 if (This
->sample_list
[x
].pSample
)
1273 if (x
>= This
->samples
)
1274 for (x
= 0; x
< This
->oldest_sample
; ++x
)
1275 if (This
->sample_list
[x
].pSample
)
1277 if (This
->oldest_sample
== x
)
1278 /* No samples found, reset to 0 */
1280 This
->oldest_sample
= x
;
1283 LeaveCriticalSection(&This
->csList
);
1285 TRACE("-- %x\n", hr
);
1289 static HRESULT WINAPI
FileAsyncReader_SyncRead(IAsyncReader
* iface
, LONGLONG llPosition
, LONG lLength
, BYTE
* pBuffer
);
1291 static HRESULT WINAPI
FileAsyncReader_SyncReadAligned(IAsyncReader
* iface
, IMediaSample
* pSample
)
1294 REFERENCE_TIME tStart
;
1295 REFERENCE_TIME tStop
;
1298 TRACE("(%p)\n", pSample
);
1300 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
1303 hr
= IMediaSample_GetPointer(pSample
, &pBuffer
);
1306 hr
= FileAsyncReader_SyncRead(iface
,
1307 BYTES_FROM_MEDIATIME(tStart
),
1308 (LONG
) BYTES_FROM_MEDIATIME(tStop
- tStart
),
1311 TRACE("-- %x\n", hr
);
1315 static HRESULT WINAPI
FileAsyncReader_SyncRead(IAsyncReader
* iface
, LONGLONG llPosition
, LONG lLength
, BYTE
* pBuffer
)
1319 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1321 TRACE("(%x%08x, %d, %p)\n", (ULONG
)(llPosition
>> 32), (ULONG
)llPosition
, lLength
, pBuffer
);
1323 ZeroMemory(&ovl
, sizeof(ovl
));
1325 ovl
.hEvent
= CreateEventW(NULL
, 0, 0, NULL
);
1326 /* NOTE: llPosition is the actual byte position to start reading from */
1327 ovl
.u
.s
.Offset
= (DWORD
) llPosition
;
1328 ovl
.u
.s
.OffsetHigh
= (DWORD
) (llPosition
>> (sizeof(DWORD
) * 8));
1330 if (!ReadFile(This
->hFile
, pBuffer
, lLength
, NULL
, &ovl
))
1331 hr
= HRESULT_FROM_WIN32(GetLastError());
1333 if (hr
== HRESULT_FROM_WIN32(ERROR_IO_PENDING
))
1340 if (!GetOverlappedResult(This
->hFile
, &ovl
, &dwBytesRead
, TRUE
))
1341 hr
= HRESULT_FROM_WIN32(GetLastError());
1344 CloseHandle(ovl
.hEvent
);
1346 TRACE("-- %x\n", hr
);
1350 static HRESULT WINAPI
FileAsyncReader_Length(IAsyncReader
* iface
, LONGLONG
* pTotal
, LONGLONG
* pAvailable
)
1354 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1356 TRACE("(%p, %p)\n", pTotal
, pAvailable
);
1358 if (((dwSizeLow
= GetFileSize(This
->hFile
, &dwSizeHigh
)) == -1) &&
1359 (GetLastError() != NO_ERROR
))
1360 return HRESULT_FROM_WIN32(GetLastError());
1362 *pTotal
= (LONGLONG
)dwSizeLow
| (LONGLONG
)dwSizeHigh
<< (sizeof(DWORD
) * 8);
1364 *pAvailable
= *pTotal
;
1369 static HRESULT WINAPI
FileAsyncReader_BeginFlush(IAsyncReader
* iface
)
1371 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1375 EnterCriticalSection(&This
->csList
);
1376 This
->bFlushing
= TRUE
;
1377 CancelIo(This
->hFile
);
1378 SetEvent(This
->handle_list
[This
->samples
]);
1379 LeaveCriticalSection(&This
->csList
);
1384 static HRESULT WINAPI
FileAsyncReader_EndFlush(IAsyncReader
* iface
)
1386 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1391 EnterCriticalSection(&This
->csList
);
1392 ResetEvent(This
->handle_list
[This
->samples
]);
1393 This
->bFlushing
= FALSE
;
1394 for (x
= 0; x
< This
->samples
; ++x
)
1395 assert(!This
->sample_list
[x
].pSample
);
1397 LeaveCriticalSection(&This
->csList
);
1402 static const IAsyncReaderVtbl FileAsyncReader_Vtbl
=
1404 FileAsyncReader_QueryInterface
,
1405 FileAsyncReader_AddRef
,
1406 FileAsyncReader_Release
,
1407 FileAsyncReader_RequestAllocator
,
1408 FileAsyncReader_Request
,
1409 FileAsyncReader_WaitForNext
,
1410 FileAsyncReader_SyncReadAligned
,
1411 FileAsyncReader_SyncRead
,
1412 FileAsyncReader_Length
,
1413 FileAsyncReader_BeginFlush
,
1414 FileAsyncReader_EndFlush
,
1418 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, REFIID riid
, void **ppv
) {
1419 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1420 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
1423 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
) {
1424 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1425 return IUnknown_AddRef((IUnknown
*)This
);
1428 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
) {
1429 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1430 return IUnknown_Release((IUnknown
*)This
);
1433 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
) {
1434 return AM_FILTER_MISC_FLAGS_IS_SOURCE
;
1437 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
1438 AMFilterMiscFlags_QueryInterface
,
1439 AMFilterMiscFlags_AddRef
,
1440 AMFilterMiscFlags_Release
,
1441 AMFilterMiscFlags_GetMiscFlags