2001-10-08 22:56:08 +02:00
|
|
|
/*
|
|
|
|
* Implements Asynchronous File/URL Source.
|
|
|
|
*
|
|
|
|
* hidenori@a2.ctktv.ne.jp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WINE_DSHOW_ASYNCSRC_H
|
|
|
|
#define WINE_DSHOW_ASYNCSRC_H
|
|
|
|
|
|
|
|
#include "iunk.h"
|
|
|
|
#include "basefilt.h"
|
|
|
|
|
|
|
|
typedef struct CAsyncSourceImpl CAsyncSourceImpl;
|
|
|
|
typedef struct CAsyncSourcePinImpl CAsyncSourcePinImpl;
|
2001-10-14 18:13:14 +02:00
|
|
|
typedef struct AsyncSourceRequest AsyncSourceRequest;
|
2001-10-08 22:56:08 +02:00
|
|
|
typedef struct AsyncSourceHandlers AsyncSourceHandlers;
|
|
|
|
|
|
|
|
typedef struct CAsyncReaderImpl
|
|
|
|
{
|
|
|
|
ICOM_VFIELD(IAsyncReader);
|
|
|
|
|
|
|
|
/* IUnknown fields */
|
|
|
|
IUnknown* punkControl;
|
|
|
|
/* IAsyncReader fields */
|
|
|
|
CAsyncSourceImpl* pSource;
|
|
|
|
|
2001-10-14 18:13:14 +02:00
|
|
|
CRITICAL_SECTION m_csReader;
|
|
|
|
BOOL m_bInFlushing;
|
|
|
|
BOOL m_bAbortThread;
|
2001-10-08 22:56:08 +02:00
|
|
|
HANDLE m_hEventInit;
|
2001-10-14 18:13:14 +02:00
|
|
|
HANDLE m_hEventCancel;
|
2001-10-08 22:56:08 +02:00
|
|
|
HANDLE m_hEventReqQueued;
|
|
|
|
HANDLE m_hEventSampQueued;
|
|
|
|
HANDLE m_hThread;
|
2001-10-14 18:13:14 +02:00
|
|
|
CRITICAL_SECTION m_csRequest;
|
|
|
|
AsyncSourceRequest* m_pRequestFirst;
|
|
|
|
CRITICAL_SECTION m_csReply;
|
|
|
|
AsyncSourceRequest* m_pReplyFirst;
|
|
|
|
CRITICAL_SECTION m_csFree;
|
|
|
|
AsyncSourceRequest* m_pFreeFirst;
|
2001-10-08 22:56:08 +02:00
|
|
|
} CAsyncReaderImpl;
|
|
|
|
|
|
|
|
typedef struct CFileSourceFilterImpl
|
|
|
|
{
|
|
|
|
ICOM_VFIELD(IFileSourceFilter);
|
|
|
|
|
|
|
|
/* IUnknown fields */
|
|
|
|
IUnknown* punkControl;
|
|
|
|
/* IFileSourceFilter fields */
|
|
|
|
CAsyncSourceImpl* pSource;
|
|
|
|
|
|
|
|
CRITICAL_SECTION* pcsFileSource;
|
|
|
|
WCHAR* m_pwszFileName;
|
|
|
|
DWORD m_cbFileName;
|
|
|
|
AM_MEDIA_TYPE m_mt;
|
|
|
|
} CFileSourceFilterImpl;
|
|
|
|
|
|
|
|
struct CAsyncSourceImpl
|
|
|
|
{
|
|
|
|
QUARTZ_IUnkImpl unk;
|
|
|
|
CBaseFilterImpl basefilter;
|
|
|
|
CFileSourceFilterImpl filesrc;
|
|
|
|
|
|
|
|
CRITICAL_SECTION csFilter;
|
|
|
|
CAsyncSourcePinImpl* pPin;
|
|
|
|
const AsyncSourceHandlers* m_pHandler;
|
|
|
|
void* m_pUserData;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CAsyncSourcePinImpl
|
|
|
|
{
|
|
|
|
QUARTZ_IUnkImpl unk;
|
|
|
|
CPinBaseImpl pin;
|
|
|
|
CAsyncReaderImpl async;
|
|
|
|
QUARTZ_IFDelegation qiext;
|
|
|
|
|
|
|
|
BOOL bAsyncReaderQueried;
|
|
|
|
CAsyncSourceImpl* pSource;
|
|
|
|
};
|
|
|
|
|
2001-10-14 18:13:14 +02:00
|
|
|
struct AsyncSourceRequest
|
|
|
|
{
|
|
|
|
AsyncSourceRequest* pNext;
|
|
|
|
|
|
|
|
LONGLONG llStart;
|
|
|
|
LONG lLength;
|
|
|
|
LONG lActual;
|
|
|
|
BYTE* pBuf;
|
|
|
|
IMediaSample* pSample; /* for async req. */
|
|
|
|
DWORD_PTR dwContext; /* for async req. */
|
|
|
|
};
|
|
|
|
|
2001-10-08 22:56:08 +02:00
|
|
|
struct AsyncSourceHandlers
|
|
|
|
{
|
|
|
|
/* all handlers MUST be implemented. */
|
|
|
|
HRESULT (*pLoad)( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName );
|
|
|
|
HRESULT (*pCleanup)( CAsyncSourceImpl* pImpl );
|
|
|
|
HRESULT (*pGetLength)( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable );
|
2001-10-14 18:13:14 +02:00
|
|
|
/* S_OK = OK / S_FALSE = Canceled / other = error */
|
|
|
|
/* hEventCancel may be NULL */
|
|
|
|
HRESULT (*pRead)( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel );
|
2001-10-08 22:56:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CAsyncSourceImpl_THIS(iface,member) CAsyncSourceImpl* This = ((CAsyncSourceImpl*)(((char*)iface)-offsetof(CAsyncSourceImpl,member)))
|
|
|
|
#define CAsyncSourcePinImpl_THIS(iface,member) CAsyncSourcePinImpl* This = ((CAsyncSourcePinImpl*)(((char*)iface)-offsetof(CAsyncSourcePinImpl,member)))
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT CAsyncReaderImpl_InitIAsyncReader(
|
|
|
|
CAsyncReaderImpl* This, IUnknown* punkControl,
|
2001-10-14 18:13:14 +02:00
|
|
|
CAsyncSourceImpl* pSource );
|
2001-10-08 22:56:08 +02:00
|
|
|
void CAsyncReaderImpl_UninitIAsyncReader(
|
|
|
|
CAsyncReaderImpl* This );
|
|
|
|
HRESULT CFileSourceFilterImpl_InitIFileSourceFilter(
|
|
|
|
CFileSourceFilterImpl* This, IUnknown* punkControl,
|
|
|
|
CAsyncSourceImpl* pSource,
|
|
|
|
CRITICAL_SECTION* pcsFileSource );
|
|
|
|
void CFileSourceFilterImpl_UninitIFileSourceFilter(
|
|
|
|
CFileSourceFilterImpl* This );
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT QUARTZ_CreateAsyncSource(
|
|
|
|
IUnknown* punkOuter,void** ppobj,
|
|
|
|
const CLSID* pclsidAsyncSource,
|
|
|
|
LPCWSTR pwszAsyncSourceName,
|
|
|
|
LPCWSTR pwszOutPinName,
|
|
|
|
const AsyncSourceHandlers* pHandler );
|
|
|
|
HRESULT QUARTZ_CreateAsyncSourcePin(
|
|
|
|
CAsyncSourceImpl* pFilter,
|
|
|
|
CRITICAL_SECTION* pcsPin,
|
|
|
|
CAsyncSourcePinImpl** ppPin,
|
|
|
|
LPCWSTR pwszPinName );
|
|
|
|
|
|
|
|
|
2001-10-14 18:13:14 +02:00
|
|
|
HRESULT QUARTZ_CreateAsyncReader(IUnknown* punkOuter,void** ppobj);
|
|
|
|
HRESULT QUARTZ_CreateURLReader(IUnknown* punkOuter,void** ppobj);
|
|
|
|
|
2001-10-22 21:03:26 +02:00
|
|
|
#define ASYNCSRC_FILE_BLOCKSIZE 16384
|
2001-10-14 18:13:14 +02:00
|
|
|
|
|
|
|
|
2001-10-08 22:56:08 +02:00
|
|
|
#endif /* WINE_DSHOW_ASYNCSRC_H */
|