2 * Implements Asynchronous File/URL Source.
4 * hidenori@a2.ctktv.ne.jp
7 #ifndef WINE_DSHOW_ASYNCSRC_H
8 #define WINE_DSHOW_ASYNCSRC_H
13 typedef struct CAsyncSourceImpl CAsyncSourceImpl;
14 typedef struct CAsyncSourcePinImpl CAsyncSourcePinImpl;
15 typedef struct AsyncSourceRequest AsyncSourceRequest;
16 typedef struct AsyncSourceHandlers AsyncSourceHandlers;
18 typedef struct CAsyncReaderImpl
20 ICOM_VFIELD(IAsyncReader);
23 IUnknown* punkControl;
24 /* IAsyncReader fields */
25 CAsyncSourceImpl* pSource;
27 CRITICAL_SECTION m_csReader;
31 HANDLE m_hEventCancel;
32 HANDLE m_hEventReqQueued;
33 HANDLE m_hEventSampQueued;
35 CRITICAL_SECTION m_csRequest;
36 AsyncSourceRequest* m_pRequestFirst;
37 CRITICAL_SECTION m_csReply;
38 AsyncSourceRequest* m_pReplyFirst;
39 CRITICAL_SECTION m_csFree;
40 AsyncSourceRequest* m_pFreeFirst;
43 typedef struct CFileSourceFilterImpl
45 ICOM_VFIELD(IFileSourceFilter);
48 IUnknown* punkControl;
49 /* IFileSourceFilter fields */
50 CAsyncSourceImpl* pSource;
52 CRITICAL_SECTION* pcsFileSource;
53 WCHAR* m_pwszFileName;
56 } CFileSourceFilterImpl;
58 struct CAsyncSourceImpl
61 CBaseFilterImpl basefilter;
62 CFileSourceFilterImpl filesrc;
64 CRITICAL_SECTION csFilter;
65 CAsyncSourcePinImpl* pPin;
66 const AsyncSourceHandlers* m_pHandler;
70 struct CAsyncSourcePinImpl
74 CAsyncReaderImpl async;
75 QUARTZ_IFDelegation qiext;
77 BOOL bAsyncReaderQueried;
78 CAsyncSourceImpl* pSource;
81 struct AsyncSourceRequest
83 AsyncSourceRequest* pNext;
89 IMediaSample* pSample; /* for async req. */
90 DWORD_PTR dwContext; /* for async req. */
93 struct AsyncSourceHandlers
95 /* all handlers MUST be implemented. */
96 HRESULT (*pLoad)( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName );
97 HRESULT (*pCleanup)( CAsyncSourceImpl* pImpl );
98 HRESULT (*pGetLength)( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable );
99 /* S_OK = OK / S_FALSE = Canceled / other = error */
100 /* hEventCancel may be NULL */
101 HRESULT (*pRead)( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel );
104 #define CAsyncSourceImpl_THIS(iface,member) CAsyncSourceImpl* This = ((CAsyncSourceImpl*)(((char*)iface)-offsetof(CAsyncSourceImpl,member)))
105 #define CAsyncSourcePinImpl_THIS(iface,member) CAsyncSourcePinImpl* This = ((CAsyncSourcePinImpl*)(((char*)iface)-offsetof(CAsyncSourcePinImpl,member)))
108 HRESULT CAsyncReaderImpl_InitIAsyncReader(
109 CAsyncReaderImpl* This, IUnknown* punkControl,
110 CAsyncSourceImpl* pSource );
111 void CAsyncReaderImpl_UninitIAsyncReader(
112 CAsyncReaderImpl* This );
113 HRESULT CFileSourceFilterImpl_InitIFileSourceFilter(
114 CFileSourceFilterImpl* This, IUnknown* punkControl,
115 CAsyncSourceImpl* pSource,
116 CRITICAL_SECTION* pcsFileSource );
117 void CFileSourceFilterImpl_UninitIFileSourceFilter(
118 CFileSourceFilterImpl* This );
121 HRESULT QUARTZ_CreateAsyncSource(
122 IUnknown* punkOuter,void** ppobj,
123 const CLSID* pclsidAsyncSource,
124 LPCWSTR pwszAsyncSourceName,
125 LPCWSTR pwszOutPinName,
126 const AsyncSourceHandlers* pHandler );
127 HRESULT QUARTZ_CreateAsyncSourcePin(
128 CAsyncSourceImpl* pFilter,
129 CRITICAL_SECTION* pcsPin,
130 CAsyncSourcePinImpl** ppPin,
131 LPCWSTR pwszPinName );
134 HRESULT QUARTZ_CreateAsyncReader(IUnknown* punkOuter,void** ppobj);
135 HRESULT QUARTZ_CreateURLReader(IUnknown* punkOuter,void** ppobj);
137 #define ASYNCSRC_FILE_BLOCKSIZE 16384
140 #endif /* WINE_DSHOW_ASYNCSRC_H */