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"
25 static const WCHAR wszOutputPinName
[] = { 'O','u','t','p','u','t',0 };
27 typedef struct AsyncReader
30 IFileSourceFilter IFileSourceFilter_iface
;
31 IAMFilterMiscFlags IAMFilterMiscFlags_iface
;
38 static inline AsyncReader
*impl_from_BaseFilter(BaseFilter
*iface
)
40 return CONTAINING_RECORD(iface
, AsyncReader
, filter
);
43 static inline AsyncReader
*impl_from_IBaseFilter(IBaseFilter
*iface
)
45 return CONTAINING_RECORD(iface
, AsyncReader
, filter
.IBaseFilter_iface
);
48 static inline AsyncReader
*impl_from_IFileSourceFilter(IFileSourceFilter
*iface
)
50 return CONTAINING_RECORD(iface
, AsyncReader
, IFileSourceFilter_iface
);
53 static inline AsyncReader
*impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags
*iface
)
55 return CONTAINING_RECORD(iface
, AsyncReader
, IAMFilterMiscFlags_iface
);
58 static const IBaseFilterVtbl AsyncReader_Vtbl
;
59 static const IFileSourceFilterVtbl FileSource_Vtbl
;
60 static const IAsyncReaderVtbl FileAsyncReader_Vtbl
;
61 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
;
63 static HRESULT
FileAsyncReader_Construct(HANDLE hFile
, IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
);
65 static const WCHAR mediatype_name
[] = {
66 'M', 'e', 'd', 'i', 'a', ' ', 'T', 'y', 'p', 'e', 0 };
67 static const WCHAR subtype_name
[] = {
68 'S', 'u', 'b', 't', 'y', 'p', 'e', 0 };
69 static const WCHAR source_filter_name
[] = {
70 'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
72 static HRESULT
process_extensions(HKEY hkeyExtensions
, LPCOLESTR pszFileName
, GUID
* majorType
, GUID
* minorType
, GUID
* sourceFilter
)
83 /* Get the part of the name that matters */
84 extension
= PathFindExtensionW(pszFileName
);
85 if (*extension
!= '.')
88 l
= RegOpenKeyExW(hkeyExtensions
, extension
, 0, KEY_READ
, &hsub
);
94 size
= sizeof(keying
);
95 l
= RegQueryValueExW(hsub
, mediatype_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
97 CLSIDFromString(keying
, majorType
);
102 size
= sizeof(keying
);
104 l
= RegQueryValueExW(hsub
, subtype_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
106 CLSIDFromString(keying
, minorType
);
111 size
= sizeof(keying
);
113 l
= RegQueryValueExW(hsub
, source_filter_name
, NULL
, NULL
, (LPBYTE
)keying
, &size
);
115 CLSIDFromString(keying
, sourceFilter
);
125 static unsigned char byte_from_hex_char(WCHAR wHex
)
127 switch (tolowerW(wHex
))
139 return (wHex
- '0') & 0xf;
146 return (wHex
- 'a' + 10) & 0xf;
152 static HRESULT
process_pattern_string(LPCWSTR wszPatternString
, IAsyncReader
* pReader
)
162 TRACE("\t\tPattern string: %s\n", debugstr_w(wszPatternString
));
164 /* format: "offset, bytestocompare, mask, value" */
166 ulOffset
= strtolW(wszPatternString
, NULL
, 10);
168 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
171 wszPatternString
++; /* skip ',' */
173 ulBytes
= strtolW(wszPatternString
, NULL
, 10);
175 pbMask
= HeapAlloc(GetProcessHeap(), 0, ulBytes
);
176 pbValue
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, ulBytes
);
177 pbFile
= HeapAlloc(GetProcessHeap(), 0, ulBytes
);
179 /* default mask is match everything */
180 memset(pbMask
, 0xFF, ulBytes
);
182 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
187 wszPatternString
++; /* skip ',' */
188 while (!isxdigitW(*wszPatternString
) && (*wszPatternString
!= ',')) wszPatternString
++;
190 for (strpos
= 0; isxdigitW(*wszPatternString
) && (strpos
/2 < ulBytes
); wszPatternString
++, strpos
++)
192 if ((strpos
% 2) == 1) /* odd numbered position */
193 pbMask
[strpos
/ 2] |= byte_from_hex_char(*wszPatternString
);
195 pbMask
[strpos
/ 2] = byte_from_hex_char(*wszPatternString
) << 4;
198 if (!(wszPatternString
= strchrW(wszPatternString
, ',')))
201 wszPatternString
++; /* skip ',' */
206 for ( ; !isxdigitW(*wszPatternString
) && (*wszPatternString
!= ','); wszPatternString
++)
209 for (strpos
= 0; isxdigitW(*wszPatternString
) && (strpos
/2 < ulBytes
); wszPatternString
++, strpos
++)
211 if ((strpos
% 2) == 1) /* odd numbered position */
212 pbValue
[strpos
/ 2] |= byte_from_hex_char(*wszPatternString
);
214 pbValue
[strpos
/ 2] = byte_from_hex_char(*wszPatternString
) << 4;
219 hr
= IAsyncReader_SyncRead(pReader
, ulOffset
, ulBytes
, pbFile
);
224 for (i
= 0; i
< ulBytes
; i
++)
225 if ((pbFile
[i
] & pbMask
[i
]) != pbValue
[i
])
232 HeapFree(GetProcessHeap(), 0, pbMask
);
233 HeapFree(GetProcessHeap(), 0, pbValue
);
234 HeapFree(GetProcessHeap(), 0, pbFile
);
236 /* if we encountered no errors with this string, and there is a following tuple, then we
237 * have to match that as well to succeed */
238 if ((hr
== S_OK
) && (wszPatternString
= strchrW(wszPatternString
, ',')))
239 return process_pattern_string(wszPatternString
+ 1, pReader
);
244 HRESULT
GetClassMediaFile(IAsyncReader
* pReader
, LPCOLESTR pszFileName
, GUID
* majorType
, GUID
* minorType
, GUID
* sourceFilter
)
246 HKEY hkeyMediaType
= NULL
;
250 static const WCHAR wszMediaType
[] = {'M','e','d','i','a',' ','T','y','p','e',0};
252 TRACE("(%p, %s, %p, %p)\n", pReader
, debugstr_w(pszFileName
), majorType
, minorType
);
255 *majorType
= GUID_NULL
;
257 *minorType
= GUID_NULL
;
259 *sourceFilter
= GUID_NULL
;
261 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszMediaType
, 0, KEY_READ
, &hkeyMediaType
);
262 hr
= HRESULT_FROM_WIN32(lRet
);
268 for (indexMajor
= 0; !bFound
; indexMajor
++)
271 WCHAR wszMajorKeyName
[CHARS_IN_GUID
];
272 DWORD dwKeyNameLength
= sizeof(wszMajorKeyName
) / sizeof(wszMajorKeyName
[0]);
273 static const WCHAR wszExtensions
[] = {'E','x','t','e','n','s','i','o','n','s',0};
275 if (RegEnumKeyExW(hkeyMediaType
, indexMajor
, wszMajorKeyName
, &dwKeyNameLength
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
277 if (RegOpenKeyExW(hkeyMediaType
, wszMajorKeyName
, 0, KEY_READ
, &hkeyMajor
) != ERROR_SUCCESS
)
279 TRACE("%s\n", debugstr_w(wszMajorKeyName
));
280 if (!strcmpW(wszExtensions
, wszMajorKeyName
))
282 if (process_extensions(hkeyMajor
, pszFileName
, majorType
, minorType
, sourceFilter
) == S_OK
)
285 /* We need a reader interface to check bytes */
290 for (indexMinor
= 0; !bFound
; indexMinor
++)
293 WCHAR wszMinorKeyName
[CHARS_IN_GUID
];
294 DWORD dwMinorKeyNameLen
= sizeof(wszMinorKeyName
) / sizeof(wszMinorKeyName
[0]);
295 WCHAR wszSourceFilterKeyName
[CHARS_IN_GUID
];
296 DWORD dwSourceFilterKeyNameLen
= sizeof(wszSourceFilterKeyName
);
300 if (RegEnumKeyExW(hkeyMajor
, indexMinor
, wszMinorKeyName
, &dwMinorKeyNameLen
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
303 if (RegOpenKeyExW(hkeyMajor
, wszMinorKeyName
, 0, KEY_READ
, &hkeyMinor
) != ERROR_SUCCESS
)
306 TRACE("\t%s\n", debugstr_w(wszMinorKeyName
));
308 if (RegQueryInfoKeyW(hkeyMinor
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, &maxValueLen
, NULL
, NULL
) != ERROR_SUCCESS
)
311 for (indexValue
= 0; !bFound
; indexValue
++)
314 WCHAR wszValueName
[14]; /* longest name we should encounter will be "Source Filter" */
315 LPWSTR wszPatternString
= HeapAlloc(GetProcessHeap(), 0, maxValueLen
);
316 DWORD dwValueNameLen
= sizeof(wszValueName
) / sizeof(wszValueName
[0]); /* remember this is in chars */
317 DWORD dwDataLen
= maxValueLen
; /* remember this is in bytes */
319 if (RegEnumValueW(hkeyMinor
, indexValue
, wszValueName
, &dwValueNameLen
, NULL
, &dwType
, (LPBYTE
)wszPatternString
, &dwDataLen
) != ERROR_SUCCESS
)
321 HeapFree(GetProcessHeap(), 0, wszPatternString
);
325 if (strcmpW(wszValueName
, source_filter_name
)==0) {
326 HeapFree(GetProcessHeap(), 0, wszPatternString
);
330 /* if it is not the source filter value */
331 if (process_pattern_string(wszPatternString
, pReader
) == S_OK
)
333 HeapFree(GetProcessHeap(), 0, wszPatternString
);
334 if (majorType
&& FAILED(CLSIDFromString(wszMajorKeyName
, majorType
)))
336 if (minorType
&& FAILED(CLSIDFromString(wszMinorKeyName
, minorType
)))
340 /* Look up the source filter key */
341 if (RegQueryValueExW(hkeyMinor
, source_filter_name
, NULL
, NULL
, (LPBYTE
)wszSourceFilterKeyName
, &dwSourceFilterKeyNameLen
))
343 if (FAILED(CLSIDFromString(wszSourceFilterKeyName
, sourceFilter
)))
348 HeapFree(GetProcessHeap(), 0, wszPatternString
);
350 CloseHandle(hkeyMinor
);
353 CloseHandle(hkeyMajor
);
356 CloseHandle(hkeyMediaType
);
358 if (SUCCEEDED(hr
) && !bFound
)
360 ERR("Media class not found\n");
365 TRACE("Found file's class:\n");
367 TRACE("\tmajor = %s\n", qzdebugstr_guid(majorType
));
369 TRACE("\tsubtype = %s\n", qzdebugstr_guid(minorType
));
371 TRACE("\tsource filter = %s\n", qzdebugstr_guid(sourceFilter
));
377 static IPin
* WINAPI
AsyncReader_GetPin(BaseFilter
*iface
, int pos
)
379 AsyncReader
*This
= impl_from_BaseFilter(iface
);
381 if (pos
>= 1 || !This
->pOutputPin
)
384 IPin_AddRef(This
->pOutputPin
);
385 return This
->pOutputPin
;
388 static LONG WINAPI
AsyncReader_GetPinCount(BaseFilter
*iface
)
390 AsyncReader
*This
= impl_from_BaseFilter(iface
);
392 if (!This
->pOutputPin
)
398 static const BaseFilterFuncTable BaseFuncTable
= {
400 AsyncReader_GetPinCount
403 HRESULT
AsyncReader_create(IUnknown
* pUnkOuter
, LPVOID
* ppv
)
405 AsyncReader
*pAsyncRead
;
408 return CLASS_E_NOAGGREGATION
;
410 pAsyncRead
= CoTaskMemAlloc(sizeof(AsyncReader
));
413 return E_OUTOFMEMORY
;
415 BaseFilter_Init(&pAsyncRead
->filter
, &AsyncReader_Vtbl
, &CLSID_AsyncReader
, (DWORD_PTR
)(__FILE__
": AsyncReader.csFilter"), &BaseFuncTable
);
417 pAsyncRead
->IFileSourceFilter_iface
.lpVtbl
= &FileSource_Vtbl
;
418 pAsyncRead
->IAMFilterMiscFlags_iface
.lpVtbl
= &IAMFilterMiscFlags_Vtbl
;
419 pAsyncRead
->pOutputPin
= NULL
;
421 pAsyncRead
->pszFileName
= NULL
;
422 pAsyncRead
->pmt
= NULL
;
426 TRACE("-- created at %p\n", pAsyncRead
);
431 /** IUnknown methods **/
433 static HRESULT WINAPI
AsyncReader_QueryInterface(IBaseFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
435 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
437 TRACE("(%s, %p)\n", qzdebugstr_guid(riid
), ppv
);
441 if (IsEqualIID(riid
, &IID_IUnknown
))
443 else if (IsEqualIID(riid
, &IID_IPersist
))
445 else if (IsEqualIID(riid
, &IID_IMediaFilter
))
447 else if (IsEqualIID(riid
, &IID_IBaseFilter
))
449 else if (IsEqualIID(riid
, &IID_IFileSourceFilter
))
450 *ppv
= &This
->IFileSourceFilter_iface
;
451 else if (IsEqualIID(riid
, &IID_IAMFilterMiscFlags
))
452 *ppv
= &This
->IAMFilterMiscFlags_iface
;
456 IUnknown_AddRef((IUnknown
*)(*ppv
));
460 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IMediaSeeking
) &&
461 !IsEqualIID(riid
, &IID_IVideoWindow
) && !IsEqualIID(riid
, &IID_IBasicAudio
))
462 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
464 return E_NOINTERFACE
;
467 static ULONG WINAPI
AsyncReader_Release(IBaseFilter
* iface
)
469 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
470 ULONG refCount
= BaseFilterImpl_Release(iface
);
472 TRACE("(%p)->() Release from %d\n", This
, refCount
+ 1);
476 if (This
->pOutputPin
)
479 if(SUCCEEDED(IPin_ConnectedTo(This
->pOutputPin
, &pConnectedTo
)))
481 IPin_Disconnect(pConnectedTo
);
482 IPin_Release(pConnectedTo
);
484 IPin_Disconnect(This
->pOutputPin
);
485 IPin_Release(This
->pOutputPin
);
487 CoTaskMemFree(This
->pszFileName
);
489 FreeMediaType(This
->pmt
);
497 /** IMediaFilter methods **/
499 static HRESULT WINAPI
AsyncReader_Stop(IBaseFilter
* iface
)
501 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
505 This
->filter
.state
= State_Stopped
;
510 static HRESULT WINAPI
AsyncReader_Pause(IBaseFilter
* iface
)
512 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
516 This
->filter
.state
= State_Paused
;
521 static HRESULT WINAPI
AsyncReader_Run(IBaseFilter
* iface
, REFERENCE_TIME tStart
)
523 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
525 TRACE("(%x%08x)\n", (ULONG
)(tStart
>> 32), (ULONG
)tStart
);
527 This
->filter
.state
= State_Running
;
532 /** IBaseFilter methods **/
534 static HRESULT WINAPI
AsyncReader_FindPin(IBaseFilter
* iface
, LPCWSTR Id
, IPin
**ppPin
)
536 AsyncReader
*This
= impl_from_IBaseFilter(iface
);
537 TRACE("(%s, %p)\n", debugstr_w(Id
), ppPin
);
542 if (strcmpW(Id
, wszOutputPinName
))
545 return VFW_E_NOT_FOUND
;
548 *ppPin
= This
->pOutputPin
;
553 static const IBaseFilterVtbl AsyncReader_Vtbl
=
555 AsyncReader_QueryInterface
,
556 BaseFilterImpl_AddRef
,
558 BaseFilterImpl_GetClassID
,
562 BaseFilterImpl_GetState
,
563 BaseFilterImpl_SetSyncSource
,
564 BaseFilterImpl_GetSyncSource
,
565 BaseFilterImpl_EnumPins
,
567 BaseFilterImpl_QueryFilterInfo
,
568 BaseFilterImpl_JoinFilterGraph
,
569 BaseFilterImpl_QueryVendorInfo
572 static HRESULT WINAPI
FileSource_QueryInterface(IFileSourceFilter
* iface
, REFIID riid
, LPVOID
* ppv
)
574 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
576 return IBaseFilter_QueryInterface(&This
->filter
.IBaseFilter_iface
, riid
, ppv
);
579 static ULONG WINAPI
FileSource_AddRef(IFileSourceFilter
* iface
)
581 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
583 return IBaseFilter_AddRef(&This
->filter
.IBaseFilter_iface
);
586 static ULONG WINAPI
FileSource_Release(IFileSourceFilter
* iface
)
588 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
590 return IBaseFilter_Release(&This
->filter
.IBaseFilter_iface
);
593 static HRESULT WINAPI
FileSource_Load(IFileSourceFilter
* iface
, LPCOLESTR pszFileName
, const AM_MEDIA_TYPE
* pmt
)
597 IAsyncReader
* pReader
= NULL
;
598 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
600 TRACE("(%s, %p)\n", debugstr_w(pszFileName
), pmt
);
603 /* FIXME: check the sharing values that native uses */
604 hFile
= CreateFileW(pszFileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, FILE_FLAG_OVERLAPPED
, NULL
);
606 if (hFile
== INVALID_HANDLE_VALUE
)
608 return HRESULT_FROM_WIN32(GetLastError());
612 hr
= FileAsyncReader_Construct(hFile
, &This
->filter
.IBaseFilter_iface
, &This
->filter
.csFilter
, &This
->pOutputPin
);
613 BaseFilterImpl_IncrementPinVersion(&This
->filter
);
616 hr
= IPin_QueryInterface(This
->pOutputPin
, &IID_IAsyncReader
, (LPVOID
*)&pReader
);
618 /* store file name & media type */
621 CoTaskMemFree(This
->pszFileName
);
623 FreeMediaType(This
->pmt
);
625 This
->pszFileName
= CoTaskMemAlloc((strlenW(pszFileName
) + 1) * sizeof(WCHAR
));
626 strcpyW(This
->pszFileName
, pszFileName
);
628 This
->pmt
= CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
));
631 This
->pmt
->bFixedSizeSamples
= TRUE
;
632 This
->pmt
->bTemporalCompression
= FALSE
;
633 This
->pmt
->cbFormat
= 0;
634 This
->pmt
->pbFormat
= NULL
;
635 This
->pmt
->pUnk
= NULL
;
636 This
->pmt
->lSampleSize
= 0;
637 This
->pmt
->formattype
= FORMAT_None
;
638 hr
= GetClassMediaFile(pReader
, pszFileName
, &This
->pmt
->majortype
, &This
->pmt
->subtype
, NULL
);
641 CoTaskMemFree(This
->pmt
);
646 CopyMediaType(This
->pmt
, pmt
);
650 IAsyncReader_Release(pReader
);
654 if (This
->pOutputPin
)
656 IPin_Release(This
->pOutputPin
);
657 This
->pOutputPin
= NULL
;
660 CoTaskMemFree(This
->pszFileName
);
662 FreeMediaType(This
->pmt
);
663 This
->pszFileName
= NULL
;
669 /* FIXME: check return codes */
673 static HRESULT WINAPI
FileSource_GetCurFile(IFileSourceFilter
* iface
, LPOLESTR
* ppszFileName
, AM_MEDIA_TYPE
* pmt
)
675 AsyncReader
*This
= impl_from_IFileSourceFilter(iface
);
677 TRACE("(%p, %p)\n", ppszFileName
, pmt
);
682 /* copy file name & media type if available, otherwise clear the outputs */
683 if (This
->pszFileName
)
685 *ppszFileName
= CoTaskMemAlloc((strlenW(This
->pszFileName
) + 1) * sizeof(WCHAR
));
686 strcpyW(*ppszFileName
, This
->pszFileName
);
689 *ppszFileName
= NULL
;
694 CopyMediaType(pmt
, This
->pmt
);
696 ZeroMemory(pmt
, sizeof(*pmt
));
702 static const IFileSourceFilterVtbl FileSource_Vtbl
=
704 FileSource_QueryInterface
,
708 FileSource_GetCurFile
712 /* the dwUserData passed back to user */
713 typedef struct DATAREQUEST
715 IMediaSample
* pSample
; /* sample passed to us by user */
716 DWORD_PTR dwUserData
; /* user data passed to us */
717 OVERLAPPED ovl
; /* our overlapped structure */
720 typedef struct FileAsyncReader
723 IAsyncReader IAsyncReader_iface
;
725 ALLOCATOR_PROPERTIES allocProps
;
728 /* Why would you need more? Every sample has its own handle */
732 CRITICAL_SECTION csList
; /* critical section to prevent concurrency issues */
733 DATAREQUEST
*sample_list
;
735 /* Have a handle for every sample, and then one more as flushing handle */
739 static inline FileAsyncReader
*impl_from_IPin(IPin
*iface
)
741 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
.pin
.IPin_iface
);
744 static inline FileAsyncReader
*impl_from_BasePin(BasePin
*iface
)
746 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
.pin
);
749 static inline FileAsyncReader
*impl_from_BaseOutputPin(BaseOutputPin
*iface
)
751 return CONTAINING_RECORD(iface
, FileAsyncReader
, pin
);
754 static inline BaseOutputPin
*impl_BaseOututPin_from_BasePin(BasePin
*iface
)
756 return CONTAINING_RECORD(iface
, BaseOutputPin
, pin
);
759 static inline FileAsyncReader
*impl_from_IAsyncReader(IAsyncReader
*iface
)
761 return CONTAINING_RECORD(iface
, FileAsyncReader
, IAsyncReader_iface
);
764 static HRESULT WINAPI
FileAsyncReaderPin_QueryAccept(IPin
*iface
, const AM_MEDIA_TYPE
*pmt
)
766 FileAsyncReader
*This
= impl_from_IPin(iface
);
767 AM_MEDIA_TYPE
*pmt_filter
= impl_from_IBaseFilter(This
->pin
.pin
.pinInfo
.pFilter
)->pmt
;
769 FIXME("(%p, %p)\n", iface
, pmt
);
771 if (IsEqualGUID(&pmt
->majortype
, &pmt_filter
->majortype
) &&
772 IsEqualGUID(&pmt
->subtype
, &pmt_filter
->subtype
) &&
773 IsEqualGUID(&pmt
->formattype
, &FORMAT_None
))
779 static HRESULT WINAPI
FileAsyncReaderPin_GetMediaType(BasePin
*iface
, int iPosition
, AM_MEDIA_TYPE
*pmt
)
781 FileAsyncReader
*This
= impl_from_BasePin(iface
);
785 return VFW_S_NO_MORE_ITEMS
;
786 CopyMediaType(pmt
, impl_from_IBaseFilter(This
->pin
.pin
.pinInfo
.pFilter
)->pmt
);
790 /* overridden pin functions */
792 static HRESULT WINAPI
FileAsyncReaderPin_QueryInterface(IPin
* iface
, REFIID riid
, LPVOID
* ppv
)
794 FileAsyncReader
*This
= impl_from_IPin(iface
);
795 TRACE("(%s, %p)\n", qzdebugstr_guid(riid
), ppv
);
799 if (IsEqualIID(riid
, &IID_IUnknown
))
801 else if (IsEqualIID(riid
, &IID_IPin
))
803 else if (IsEqualIID(riid
, &IID_IAsyncReader
))
804 *ppv
= &This
->IAsyncReader_iface
;
808 IUnknown_AddRef((IUnknown
*)(*ppv
));
812 if (!IsEqualIID(riid
, &IID_IPin
) && !IsEqualIID(riid
, &IID_IMediaSeeking
))
813 FIXME("No interface for %s!\n", qzdebugstr_guid(riid
));
815 return E_NOINTERFACE
;
818 static ULONG WINAPI
FileAsyncReaderPin_Release(IPin
* iface
)
820 FileAsyncReader
*This
= impl_from_IPin(iface
);
821 ULONG refCount
= InterlockedDecrement(&This
->pin
.pin
.refCount
);
824 TRACE("(%p)->() Release from %d\n", This
, refCount
+ 1);
828 CoTaskMemFree(This
->sample_list
);
829 if (This
->handle_list
)
831 for (x
= 0; x
<= This
->samples
; ++x
)
832 CloseHandle(This
->handle_list
[x
]);
833 CoTaskMemFree(This
->handle_list
);
835 CloseHandle(This
->hFile
);
836 This
->csList
.DebugInfo
->Spare
[0] = 0;
837 DeleteCriticalSection(&This
->csList
);
844 static const IPinVtbl FileAsyncReaderPin_Vtbl
=
846 FileAsyncReaderPin_QueryInterface
,
848 FileAsyncReaderPin_Release
,
849 BaseOutputPinImpl_Connect
,
850 BaseOutputPinImpl_ReceiveConnection
,
851 BasePinImpl_Disconnect
,
852 BasePinImpl_ConnectedTo
,
853 BasePinImpl_ConnectionMediaType
,
854 BasePinImpl_QueryPinInfo
,
855 BasePinImpl_QueryDirection
,
857 FileAsyncReaderPin_QueryAccept
,
858 BasePinImpl_EnumMediaTypes
,
859 BasePinImpl_QueryInternalConnections
,
860 BaseOutputPinImpl_EndOfStream
,
861 BaseOutputPinImpl_BeginFlush
,
862 BaseOutputPinImpl_EndFlush
,
863 BasePinImpl_NewSegment
866 /* Function called as a helper to IPin_Connect */
867 /* specific AM_MEDIA_TYPE - it cannot be NULL */
868 /* this differs from standard OutputPin_AttemptConnection only in that it
869 * doesn't need the IMemInputPin interface on the receiving pin */
870 static HRESULT WINAPI
FileAsyncReaderPin_AttemptConnection(BasePin
* iface
, IPin
* pReceivePin
, const AM_MEDIA_TYPE
* pmt
)
872 BaseOutputPin
*This
= impl_BaseOututPin_from_BasePin(iface
);
875 TRACE("(%p, %p)\n", pReceivePin
, pmt
);
876 dump_AM_MEDIA_TYPE(pmt
);
878 /* FIXME: call queryacceptproc */
880 This
->pin
.pConnectedTo
= pReceivePin
;
881 IPin_AddRef(pReceivePin
);
882 CopyMediaType(&This
->pin
.mtCurrent
, pmt
);
884 hr
= IPin_ReceiveConnection(pReceivePin
, &iface
->IPin_iface
, pmt
);
888 IPin_Release(This
->pin
.pConnectedTo
);
889 This
->pin
.pConnectedTo
= NULL
;
890 FreeMediaType(&This
->pin
.mtCurrent
);
893 TRACE(" -- %x\n", hr
);
897 static HRESULT WINAPI
FileAsyncReaderPin_DecideBufferSize(BaseOutputPin
*iface
, IMemAllocator
*pAlloc
, ALLOCATOR_PROPERTIES
*ppropInputRequest
)
899 FileAsyncReader
*This
= impl_from_BaseOutputPin(iface
);
900 ALLOCATOR_PROPERTIES actual
;
902 if (ppropInputRequest
->cbAlign
&& ppropInputRequest
->cbAlign
!= This
->allocProps
.cbAlign
)
903 FIXME("Requested Buffer cbAlign mismatch %i,%i\n",This
->allocProps
.cbAlign
, ppropInputRequest
->cbAlign
);
904 if (ppropInputRequest
->cbPrefix
)
905 FIXME("Requested Buffer cbPrefix mismatch %i,%i\n",This
->allocProps
.cbPrefix
, ppropInputRequest
->cbPrefix
);
906 if (ppropInputRequest
->cbBuffer
)
907 FIXME("Requested Buffer cbBuffer mismatch %i,%i\n",This
->allocProps
.cbBuffer
, ppropInputRequest
->cbBuffer
);
908 if (ppropInputRequest
->cBuffers
)
909 FIXME("Requested Buffer cBuffers mismatch %i,%i\n",This
->allocProps
.cBuffers
, ppropInputRequest
->cBuffers
);
911 return IMemAllocator_SetProperties(pAlloc
, &This
->allocProps
, &actual
);
914 static const BasePinFuncTable output_BaseFuncTable
= {
916 FileAsyncReaderPin_AttemptConnection
,
917 BasePinImpl_GetMediaTypeVersion
,
918 FileAsyncReaderPin_GetMediaType
921 static const BaseOutputPinFuncTable output_BaseOutputFuncTable
= {
922 FileAsyncReaderPin_DecideBufferSize
,
923 BaseOutputPinImpl_DecideAllocator
,
924 BaseOutputPinImpl_BreakConnect
927 static HRESULT
FileAsyncReader_Construct(HANDLE hFile
, IBaseFilter
* pBaseFilter
, LPCRITICAL_SECTION pCritSec
, IPin
** ppPin
)
933 piOutput
.dir
= PINDIR_OUTPUT
;
934 piOutput
.pFilter
= pBaseFilter
;
935 strcpyW(piOutput
.achName
, wszOutputPinName
);
936 hr
= BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl
, sizeof(FileAsyncReader
), &piOutput
, &output_BaseFuncTable
, &output_BaseOutputFuncTable
, pCritSec
, ppPin
);
940 FileAsyncReader
*pPinImpl
= (FileAsyncReader
*)*ppPin
;
941 pPinImpl
->IAsyncReader_iface
.lpVtbl
= &FileAsyncReader_Vtbl
;
942 pPinImpl
->hFile
= hFile
;
943 pPinImpl
->bFlushing
= FALSE
;
944 pPinImpl
->sample_list
= NULL
;
945 pPinImpl
->handle_list
= NULL
;
946 pPinImpl
->queued_number
= 0;
947 InitializeCriticalSection(&pPinImpl
->csList
);
948 pPinImpl
->csList
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": FileAsyncReader.csList");
955 static HRESULT WINAPI
FileAsyncReader_QueryInterface(IAsyncReader
* iface
, REFIID riid
, LPVOID
* ppv
)
957 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
959 return IPin_QueryInterface(&This
->pin
.pin
.IPin_iface
, riid
, ppv
);
962 static ULONG WINAPI
FileAsyncReader_AddRef(IAsyncReader
* iface
)
964 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
966 return IPin_AddRef(&This
->pin
.pin
.IPin_iface
);
969 static ULONG WINAPI
FileAsyncReader_Release(IAsyncReader
* iface
)
971 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
973 return IPin_Release(&This
->pin
.pin
.IPin_iface
);
976 #define DEF_ALIGNMENT 1
978 static HRESULT WINAPI
FileAsyncReader_RequestAllocator(IAsyncReader
* iface
, IMemAllocator
* pPreferred
, ALLOCATOR_PROPERTIES
* pProps
, IMemAllocator
** ppActual
)
980 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
984 TRACE("(%p, %p, %p)\n", pPreferred
, pProps
, ppActual
);
986 if (!pProps
->cbAlign
|| (pProps
->cbAlign
% DEF_ALIGNMENT
) != 0)
987 pProps
->cbAlign
= DEF_ALIGNMENT
;
991 hr
= IMemAllocator_SetProperties(pPreferred
, pProps
, pProps
);
992 /* FIXME: check we are still aligned */
995 IMemAllocator_AddRef(pPreferred
);
996 *ppActual
= pPreferred
;
997 TRACE("FileAsyncReader_RequestAllocator -- %x\n", hr
);
1004 hr
= CoCreateInstance(&CLSID_MemoryAllocator
, NULL
, CLSCTX_INPROC
, &IID_IMemAllocator
, (LPVOID
*)&pPreferred
);
1008 hr
= IMemAllocator_SetProperties(pPreferred
, pProps
, pProps
);
1009 /* FIXME: check we are still aligned */
1012 *ppActual
= pPreferred
;
1013 TRACE("FileAsyncReader_RequestAllocator -- %x\n", hr
);
1020 CoTaskMemFree(This
->sample_list
);
1021 if (This
->handle_list
)
1024 for (x
= 0; x
<= This
->samples
; ++x
)
1025 CloseHandle(This
->handle_list
[x
]);
1026 CoTaskMemFree(This
->handle_list
);
1029 This
->samples
= pProps
->cBuffers
;
1030 This
->oldest_sample
= 0;
1031 TRACE("Samples: %u\n", This
->samples
);
1032 This
->sample_list
= CoTaskMemAlloc(sizeof(This
->sample_list
[0]) * pProps
->cBuffers
);
1033 This
->handle_list
= CoTaskMemAlloc(sizeof(HANDLE
) * pProps
->cBuffers
* 2);
1035 if (This
->sample_list
&& This
->handle_list
)
1038 ZeroMemory(This
->sample_list
, sizeof(This
->sample_list
[0]) * pProps
->cBuffers
);
1039 for (x
= 0; x
< This
->samples
; ++x
)
1041 This
->sample_list
[x
].ovl
.hEvent
= This
->handle_list
[x
] = CreateEventW(NULL
, 0, 0, NULL
);
1042 if (x
+ 1 < This
->samples
)
1043 This
->handle_list
[This
->samples
+ 1 + x
] = This
->handle_list
[x
];
1045 This
->handle_list
[This
->samples
] = CreateEventW(NULL
, 1, 0, NULL
);
1046 This
->allocProps
= *pProps
;
1051 CoTaskMemFree(This
->sample_list
);
1052 CoTaskMemFree(This
->handle_list
);
1054 This
->sample_list
= NULL
;
1055 This
->handle_list
= NULL
;
1063 IMemAllocator_Release(pPreferred
);
1066 TRACE("-- %x\n", hr
);
1070 /* we could improve the Request/WaitForNext mechanism by allowing out of order samples.
1071 * however, this would be quite complicated to do and may be a bit error prone */
1072 static HRESULT WINAPI
FileAsyncReader_Request(IAsyncReader
* iface
, IMediaSample
* pSample
, DWORD_PTR dwUser
)
1075 REFERENCE_TIME Start
;
1076 REFERENCE_TIME Stop
;
1077 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1078 LPBYTE pBuffer
= NULL
;
1080 TRACE("(%p, %lx)\n", pSample
, dwUser
);
1085 /* get start and stop positions in bytes */
1087 hr
= IMediaSample_GetTime(pSample
, &Start
, &Stop
);
1090 hr
= IMediaSample_GetPointer(pSample
, &pBuffer
);
1092 EnterCriticalSection(&This
->csList
);
1093 if (This
->bFlushing
)
1095 LeaveCriticalSection(&This
->csList
);
1096 return VFW_E_WRONG_STATE
;
1101 DWORD dwLength
= (DWORD
) BYTES_FROM_MEDIATIME(Stop
- Start
);
1102 DATAREQUEST
*pDataRq
;
1105 /* Try to insert above the waiting sample if possible */
1106 for (x
= This
->oldest_sample
; x
< This
->samples
; ++x
)
1108 if (!This
->sample_list
[x
].pSample
)
1112 if (x
>= This
->samples
)
1113 for (x
= 0; x
< This
->oldest_sample
; ++x
)
1115 if (!This
->sample_list
[x
].pSample
)
1119 /* There must be a sample we have found */
1120 assert(x
< This
->samples
);
1121 ++This
->queued_number
;
1123 pDataRq
= This
->sample_list
+ x
;
1125 pDataRq
->ovl
.u
.s
.Offset
= (DWORD
) BYTES_FROM_MEDIATIME(Start
);
1126 pDataRq
->ovl
.u
.s
.OffsetHigh
= (DWORD
)(BYTES_FROM_MEDIATIME(Start
) >> (sizeof(DWORD
) * 8));
1127 pDataRq
->dwUserData
= dwUser
;
1129 /* we violate traditional COM rules here by maintaining
1130 * a reference to the sample, but not calling AddRef, but
1131 * that's what MSDN says to do */
1132 pDataRq
->pSample
= pSample
;
1134 /* this is definitely not how it is implemented on Win9x
1135 * as they do not support async reads on files, but it is
1136 * sooo much easier to use this than messing around with threads!
1138 if (!ReadFile(This
->hFile
, pBuffer
, dwLength
, NULL
, &pDataRq
->ovl
))
1139 hr
= HRESULT_FROM_WIN32(GetLastError());
1141 /* ERROR_IO_PENDING is not actually an error since this is what we want! */
1142 if (hr
== HRESULT_FROM_WIN32(ERROR_IO_PENDING
))
1146 LeaveCriticalSection(&This
->csList
);
1148 TRACE("-- %x\n", hr
);
1152 static HRESULT WINAPI
FileAsyncReader_WaitForNext(IAsyncReader
* iface
, DWORD dwTimeout
, IMediaSample
** ppSample
, DWORD_PTR
* pdwUser
)
1155 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1158 TRACE("(%u, %p, %p)\n", dwTimeout
, ppSample
, pdwUser
);
1163 EnterCriticalSection(&This
->csList
);
1164 if (!This
->bFlushing
)
1166 LONG oldest
= This
->oldest_sample
;
1168 if (!This
->queued_number
)
1170 /* It could be that nothing is queued right now, but that can be fixed */
1171 WARN("Called without samples in queue and not flushing!!\n");
1173 LeaveCriticalSection(&This
->csList
);
1175 /* wait for an object to read, or time out */
1176 buffer
= WaitForMultipleObjectsEx(This
->samples
+1, This
->handle_list
+ oldest
, FALSE
, dwTimeout
, TRUE
);
1178 EnterCriticalSection(&This
->csList
);
1179 if (buffer
<= This
->samples
)
1181 /* Re-scale the buffer back to normal */
1184 /* Uh oh, we overshot the flusher handle, renormalize it back to 0..Samples-1 */
1185 if (buffer
> This
->samples
)
1186 buffer
-= This
->samples
+ 1;
1187 assert(buffer
<= This
->samples
);
1190 if (buffer
>= This
->samples
)
1192 if (buffer
!= This
->samples
)
1194 FIXME("Returned: %u (%08x)\n", buffer
, GetLastError());
1198 hr
= VFW_E_WRONG_STATE
;
1202 --This
->queued_number
;
1205 if (This
->bFlushing
&& buffer
== ~0)
1207 for (buffer
= 0; buffer
< This
->samples
; ++buffer
)
1209 if (This
->sample_list
[buffer
].pSample
)
1211 ResetEvent(This
->handle_list
[buffer
]);
1215 if (buffer
== This
->samples
)
1217 assert(!This
->queued_number
);
1222 --This
->queued_number
;
1229 REFERENCE_TIME rtStart
, rtStop
;
1230 REFERENCE_TIME rtSampleStart
, rtSampleStop
;
1231 DATAREQUEST
*pDataRq
= This
->sample_list
+ buffer
;
1234 /* get any errors */
1235 if (!This
->bFlushing
&& !GetOverlappedResult(This
->hFile
, &pDataRq
->ovl
, &dwBytes
, FALSE
))
1236 hr
= HRESULT_FROM_WIN32(GetLastError());
1238 /* Return the sample no matter what so it can be destroyed */
1239 *ppSample
= pDataRq
->pSample
;
1240 *pdwUser
= pDataRq
->dwUserData
;
1242 if (This
->bFlushing
)
1243 hr
= VFW_E_WRONG_STATE
;
1248 /* Set the time on the sample */
1249 IMediaSample_SetActualDataLength(pDataRq
->pSample
, dwBytes
);
1251 rtStart
= (DWORD64
)pDataRq
->ovl
.u
.s
.Offset
+ ((DWORD64
)pDataRq
->ovl
.u
.s
.OffsetHigh
<< 32);
1252 rtStart
= MEDIATIME_FROM_BYTES(rtStart
);
1253 rtStop
= rtStart
+ MEDIATIME_FROM_BYTES(dwBytes
);
1255 IMediaSample_GetTime(pDataRq
->pSample
, &rtSampleStart
, &rtSampleStop
);
1256 assert(rtStart
== rtSampleStart
);
1257 assert(rtStop
<= rtSampleStop
);
1259 IMediaSample_SetTime(pDataRq
->pSample
, &rtStart
, &rtStop
);
1260 assert(rtStart
== rtSampleStart
);
1262 assert(rtStop
== rtSampleStop
);
1264 assert(rtStop
== rtStart
);
1266 This
->sample_list
[buffer
].pSample
= NULL
;
1267 assert(This
->oldest_sample
< This
->samples
);
1269 if (buffer
== This
->oldest_sample
)
1272 for (x
= This
->oldest_sample
+ 1; x
< This
->samples
; ++x
)
1273 if (This
->sample_list
[x
].pSample
)
1275 if (x
>= This
->samples
)
1276 for (x
= 0; x
< This
->oldest_sample
; ++x
)
1277 if (This
->sample_list
[x
].pSample
)
1279 if (This
->oldest_sample
== x
)
1280 /* No samples found, reset to 0 */
1282 This
->oldest_sample
= x
;
1285 LeaveCriticalSection(&This
->csList
);
1287 TRACE("-- %x\n", hr
);
1291 static HRESULT WINAPI
FileAsyncReader_SyncRead(IAsyncReader
* iface
, LONGLONG llPosition
, LONG lLength
, BYTE
* pBuffer
);
1293 static HRESULT WINAPI
FileAsyncReader_SyncReadAligned(IAsyncReader
* iface
, IMediaSample
* pSample
)
1296 REFERENCE_TIME tStart
;
1297 REFERENCE_TIME tStop
;
1300 TRACE("(%p)\n", pSample
);
1302 hr
= IMediaSample_GetTime(pSample
, &tStart
, &tStop
);
1305 hr
= IMediaSample_GetPointer(pSample
, &pBuffer
);
1308 hr
= FileAsyncReader_SyncRead(iface
,
1309 BYTES_FROM_MEDIATIME(tStart
),
1310 (LONG
) BYTES_FROM_MEDIATIME(tStop
- tStart
),
1313 TRACE("-- %x\n", hr
);
1317 static HRESULT WINAPI
FileAsyncReader_SyncRead(IAsyncReader
* iface
, LONGLONG llPosition
, LONG lLength
, BYTE
* pBuffer
)
1321 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1323 TRACE("(%x%08x, %d, %p)\n", (ULONG
)(llPosition
>> 32), (ULONG
)llPosition
, lLength
, pBuffer
);
1325 ZeroMemory(&ovl
, sizeof(ovl
));
1327 ovl
.hEvent
= CreateEventW(NULL
, 0, 0, NULL
);
1328 /* NOTE: llPosition is the actual byte position to start reading from */
1329 ovl
.u
.s
.Offset
= (DWORD
) llPosition
;
1330 ovl
.u
.s
.OffsetHigh
= (DWORD
) (llPosition
>> (sizeof(DWORD
) * 8));
1332 if (!ReadFile(This
->hFile
, pBuffer
, lLength
, NULL
, &ovl
))
1333 hr
= HRESULT_FROM_WIN32(GetLastError());
1335 if (hr
== HRESULT_FROM_WIN32(ERROR_IO_PENDING
))
1342 if (!GetOverlappedResult(This
->hFile
, &ovl
, &dwBytesRead
, TRUE
))
1343 hr
= HRESULT_FROM_WIN32(GetLastError());
1346 CloseHandle(ovl
.hEvent
);
1348 TRACE("-- %x\n", hr
);
1352 static HRESULT WINAPI
FileAsyncReader_Length(IAsyncReader
* iface
, LONGLONG
* pTotal
, LONGLONG
* pAvailable
)
1356 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1358 TRACE("(%p, %p)\n", pTotal
, pAvailable
);
1360 if (((dwSizeLow
= GetFileSize(This
->hFile
, &dwSizeHigh
)) == -1) &&
1361 (GetLastError() != NO_ERROR
))
1362 return HRESULT_FROM_WIN32(GetLastError());
1364 *pTotal
= (LONGLONG
)dwSizeLow
| (LONGLONG
)dwSizeHigh
<< (sizeof(DWORD
) * 8);
1366 *pAvailable
= *pTotal
;
1371 static HRESULT WINAPI
FileAsyncReader_BeginFlush(IAsyncReader
* iface
)
1373 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1377 EnterCriticalSection(&This
->csList
);
1378 This
->bFlushing
= TRUE
;
1379 CancelIo(This
->hFile
);
1380 SetEvent(This
->handle_list
[This
->samples
]);
1381 LeaveCriticalSection(&This
->csList
);
1386 static HRESULT WINAPI
FileAsyncReader_EndFlush(IAsyncReader
* iface
)
1388 FileAsyncReader
*This
= impl_from_IAsyncReader(iface
);
1393 EnterCriticalSection(&This
->csList
);
1394 ResetEvent(This
->handle_list
[This
->samples
]);
1395 This
->bFlushing
= FALSE
;
1396 for (x
= 0; x
< This
->samples
; ++x
)
1397 assert(!This
->sample_list
[x
].pSample
);
1399 LeaveCriticalSection(&This
->csList
);
1404 static const IAsyncReaderVtbl FileAsyncReader_Vtbl
=
1406 FileAsyncReader_QueryInterface
,
1407 FileAsyncReader_AddRef
,
1408 FileAsyncReader_Release
,
1409 FileAsyncReader_RequestAllocator
,
1410 FileAsyncReader_Request
,
1411 FileAsyncReader_WaitForNext
,
1412 FileAsyncReader_SyncReadAligned
,
1413 FileAsyncReader_SyncRead
,
1414 FileAsyncReader_Length
,
1415 FileAsyncReader_BeginFlush
,
1416 FileAsyncReader_EndFlush
,
1420 static HRESULT WINAPI
AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags
*iface
, REFIID riid
, void **ppv
) {
1421 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1422 return IUnknown_QueryInterface((IUnknown
*)This
, riid
, ppv
);
1425 static ULONG WINAPI
AMFilterMiscFlags_AddRef(IAMFilterMiscFlags
*iface
) {
1426 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1427 return IUnknown_AddRef((IUnknown
*)This
);
1430 static ULONG WINAPI
AMFilterMiscFlags_Release(IAMFilterMiscFlags
*iface
) {
1431 AsyncReader
*This
= impl_from_IAMFilterMiscFlags(iface
);
1432 return IUnknown_Release((IUnknown
*)This
);
1435 static ULONG WINAPI
AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags
*iface
) {
1436 return AM_FILTER_MISC_FLAGS_IS_SOURCE
;
1439 static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl
= {
1440 AMFilterMiscFlags_QueryInterface
,
1441 AMFilterMiscFlags_AddRef
,
1442 AMFilterMiscFlags_Release
,
1443 AMFilterMiscFlags_GetMiscFlags