quartz/filesource: Get rid of the AsyncReader typedef.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-04-01 23:01:00 -05:00 committed by Alexandre Julliard
parent 5603ece70d
commit d1d01de751
1 changed files with 40 additions and 43 deletions

View File

@ -53,7 +53,7 @@ struct request
OVERLAPPED ovl; OVERLAPPED ovl;
}; };
typedef struct AsyncReader struct async_reader
{ {
struct strmbase_filter filter; struct strmbase_filter filter;
IFileSourceFilter IFileSourceFilter_iface; IFileSourceFilter IFileSourceFilter_iface;
@ -70,18 +70,18 @@ typedef struct AsyncReader
struct request *requests; struct request *requests;
unsigned int max_requests; unsigned int max_requests;
CONDITION_VARIABLE sample_cv; CONDITION_VARIABLE sample_cv;
} AsyncReader; };
static const struct strmbase_source_ops source_ops; static const struct strmbase_source_ops source_ops;
static inline AsyncReader *impl_from_strmbase_filter(struct strmbase_filter *iface) static inline struct async_reader *impl_from_strmbase_filter(struct strmbase_filter *iface)
{ {
return CONTAINING_RECORD(iface, AsyncReader, filter); return CONTAINING_RECORD(iface, struct async_reader, filter);
} }
static inline AsyncReader *impl_from_IFileSourceFilter(IFileSourceFilter *iface) static inline struct async_reader *impl_from_IFileSourceFilter(IFileSourceFilter *iface)
{ {
return CONTAINING_RECORD(iface, AsyncReader, IFileSourceFilter_iface); return CONTAINING_RECORD(iface, struct async_reader, IFileSourceFilter_iface);
} }
static const IFileSourceFilterVtbl FileSource_Vtbl; static const IFileSourceFilterVtbl FileSource_Vtbl;
@ -311,7 +311,7 @@ BOOL get_media_type(const WCHAR *filename, GUID *majortype, GUID *subtype, GUID
static struct strmbase_pin *async_reader_get_pin(struct strmbase_filter *iface, unsigned int index) static struct strmbase_pin *async_reader_get_pin(struct strmbase_filter *iface, unsigned int index)
{ {
AsyncReader *filter = impl_from_strmbase_filter(iface); struct async_reader *filter = impl_from_strmbase_filter(iface);
if (!index && filter->pszFileName) if (!index && filter->pszFileName)
return &filter->source.pin; return &filter->source.pin;
@ -320,7 +320,7 @@ static struct strmbase_pin *async_reader_get_pin(struct strmbase_filter *iface,
static void async_reader_destroy(struct strmbase_filter *iface) static void async_reader_destroy(struct strmbase_filter *iface)
{ {
AsyncReader *filter = impl_from_strmbase_filter(iface); struct async_reader *filter = impl_from_strmbase_filter(iface);
if (filter->pszFileName) if (filter->pszFileName)
{ {
@ -359,7 +359,7 @@ static void async_reader_destroy(struct strmbase_filter *iface)
static HRESULT async_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out) static HRESULT async_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
{ {
AsyncReader *filter = impl_from_strmbase_filter(iface); struct async_reader *filter = impl_from_strmbase_filter(iface);
if (IsEqualGUID(iid, &IID_IFileSourceFilter)) if (IsEqualGUID(iid, &IID_IFileSourceFilter))
{ {
@ -380,7 +380,7 @@ static const struct strmbase_filter_ops filter_ops =
static DWORD CALLBACK io_thread(void *arg) static DWORD CALLBACK io_thread(void *arg)
{ {
AsyncReader *filter = arg; struct async_reader *filter = arg;
struct request *req; struct request *req;
OVERLAPPED *ovl; OVERLAPPED *ovl;
ULONG_PTR key; ULONG_PTR key;
@ -416,7 +416,7 @@ static DWORD CALLBACK io_thread(void *arg)
HRESULT async_reader_create(IUnknown *outer, IUnknown **out) HRESULT async_reader_create(IUnknown *outer, IUnknown **out)
{ {
AsyncReader *object; struct async_reader *object;
if (!(object = calloc(1, sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -439,29 +439,26 @@ HRESULT async_reader_create(IUnknown *outer, IUnknown **out)
static HRESULT WINAPI FileSource_QueryInterface(IFileSourceFilter * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI FileSource_QueryInterface(IFileSourceFilter * iface, REFIID riid, LPVOID * ppv)
{ {
AsyncReader *This = impl_from_IFileSourceFilter(iface); struct async_reader *filter = impl_from_IFileSourceFilter(iface);
return IBaseFilter_QueryInterface(&filter->filter.IBaseFilter_iface, riid, ppv);
return IBaseFilter_QueryInterface(&This->filter.IBaseFilter_iface, riid, ppv);
} }
static ULONG WINAPI FileSource_AddRef(IFileSourceFilter * iface) static ULONG WINAPI FileSource_AddRef(IFileSourceFilter * iface)
{ {
AsyncReader *This = impl_from_IFileSourceFilter(iface); struct async_reader *filter = impl_from_IFileSourceFilter(iface);
return IBaseFilter_AddRef(&filter->filter.IBaseFilter_iface);
return IBaseFilter_AddRef(&This->filter.IBaseFilter_iface);
} }
static ULONG WINAPI FileSource_Release(IFileSourceFilter * iface) static ULONG WINAPI FileSource_Release(IFileSourceFilter * iface)
{ {
AsyncReader *This = impl_from_IFileSourceFilter(iface); struct async_reader *filter = impl_from_IFileSourceFilter(iface);
return IBaseFilter_Release(&filter->filter.IBaseFilter_iface);
return IBaseFilter_Release(&This->filter.IBaseFilter_iface);
} }
static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFileName, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFileName, const AM_MEDIA_TYPE * pmt)
{ {
struct async_reader *This = impl_from_IFileSourceFilter(iface);
HANDLE hFile; HANDLE hFile;
AsyncReader *This = impl_from_IFileSourceFilter(iface);
TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt); TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt);
strmbase_dump_media_type(pmt); strmbase_dump_media_type(pmt);
@ -514,7 +511,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter *iface, LPOLESTR *ppszFileName, AM_MEDIA_TYPE *mt) static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter *iface, LPOLESTR *ppszFileName, AM_MEDIA_TYPE *mt)
{ {
AsyncReader *This = impl_from_IFileSourceFilter(iface); struct async_reader *This = impl_from_IFileSourceFilter(iface);
TRACE("filter %p, filename %p, mt %p.\n", This, ppszFileName, mt); TRACE("filter %p, filename %p, mt %p.\n", This, ppszFileName, mt);
@ -548,24 +545,24 @@ static const IFileSourceFilterVtbl FileSource_Vtbl =
FileSource_GetCurFile FileSource_GetCurFile
}; };
static inline AsyncReader *impl_from_strmbase_pin(struct strmbase_pin *iface) static inline struct async_reader *impl_from_strmbase_pin(struct strmbase_pin *iface)
{ {
return CONTAINING_RECORD(iface, AsyncReader, source.pin); return CONTAINING_RECORD(iface, struct async_reader, source.pin);
} }
static inline AsyncReader *impl_from_strmbase_source(struct strmbase_source *iface) static inline struct async_reader *impl_from_strmbase_source(struct strmbase_source *iface)
{ {
return CONTAINING_RECORD(iface, AsyncReader, source); return CONTAINING_RECORD(iface, struct async_reader, source);
} }
static inline AsyncReader *impl_from_IAsyncReader(IAsyncReader *iface) static inline struct async_reader *impl_from_IAsyncReader(IAsyncReader *iface)
{ {
return CONTAINING_RECORD(iface, AsyncReader, IAsyncReader_iface); return CONTAINING_RECORD(iface, struct async_reader, IAsyncReader_iface);
} }
static HRESULT source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt) static HRESULT source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
{ {
AsyncReader *filter = impl_from_strmbase_pin(iface); struct async_reader *filter = impl_from_strmbase_pin(iface);
if (IsEqualGUID(&mt->majortype, &filter->mt.majortype) if (IsEqualGUID(&mt->majortype, &filter->mt.majortype)
&& (!IsEqualGUID(&mt->subtype, &GUID_NULL) && (!IsEqualGUID(&mt->subtype, &GUID_NULL)
@ -577,7 +574,7 @@ static HRESULT source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TY
static HRESULT source_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) static HRESULT source_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
{ {
AsyncReader *filter = impl_from_strmbase_pin(iface); struct async_reader *filter = impl_from_strmbase_pin(iface);
if (index > 1) if (index > 1)
return VFW_S_NO_MORE_ITEMS; return VFW_S_NO_MORE_ITEMS;
@ -591,7 +588,7 @@ static HRESULT source_get_media_type(struct strmbase_pin *iface, unsigned int in
static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out) static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{ {
AsyncReader *filter = impl_from_strmbase_pin(iface); struct async_reader *filter = impl_from_strmbase_pin(iface);
if (IsEqualGUID(iid, &IID_IAsyncReader)) if (IsEqualGUID(iid, &IID_IAsyncReader))
*out = &filter->IAsyncReader_iface; *out = &filter->IAsyncReader_iface;
@ -636,7 +633,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(struct strmbase_sourc
static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(struct strmbase_source *iface, static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(struct strmbase_source *iface,
IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{ {
AsyncReader *This = impl_from_strmbase_source(iface); struct async_reader *This = impl_from_strmbase_source(iface);
ALLOCATOR_PROPERTIES actual; ALLOCATOR_PROPERTIES actual;
if (ppropInputRequest->cbAlign && ppropInputRequest->cbAlign != This->allocProps.cbAlign) if (ppropInputRequest->cbAlign && ppropInputRequest->cbAlign != This->allocProps.cbAlign)
@ -663,26 +660,26 @@ static const struct strmbase_source_ops source_ops =
static HRESULT WINAPI FileAsyncReader_QueryInterface(IAsyncReader *iface, REFIID iid, void **out) static HRESULT WINAPI FileAsyncReader_QueryInterface(IAsyncReader *iface, REFIID iid, void **out)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out); return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out);
} }
static ULONG WINAPI FileAsyncReader_AddRef(IAsyncReader * iface) static ULONG WINAPI FileAsyncReader_AddRef(IAsyncReader * iface)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
return IPin_AddRef(&filter->source.pin.IPin_iface); return IPin_AddRef(&filter->source.pin.IPin_iface);
} }
static ULONG WINAPI FileAsyncReader_Release(IAsyncReader * iface) static ULONG WINAPI FileAsyncReader_Release(IAsyncReader * iface)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
return IPin_Release(&filter->source.pin.IPin_iface); return IPin_Release(&filter->source.pin.IPin_iface);
} }
static HRESULT WINAPI FileAsyncReader_RequestAllocator(IAsyncReader *iface, static HRESULT WINAPI FileAsyncReader_RequestAllocator(IAsyncReader *iface,
IMemAllocator *preferred, ALLOCATOR_PROPERTIES *props, IMemAllocator **ret_allocator) IMemAllocator *preferred, ALLOCATOR_PROPERTIES *props, IMemAllocator **ret_allocator)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
IMemAllocator *allocator; IMemAllocator *allocator;
unsigned int i; unsigned int i;
HRESULT hr; HRESULT hr;
@ -731,7 +728,7 @@ static HRESULT WINAPI FileAsyncReader_RequestAllocator(IAsyncReader *iface,
static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader *iface, IMediaSample *sample, DWORD_PTR cookie) static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader *iface, IMediaSample *sample, DWORD_PTR cookie)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
REFERENCE_TIME start, end; REFERENCE_TIME start, end;
struct request *req; struct request *req;
unsigned int i; unsigned int i;
@ -785,7 +782,7 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader *iface, IMediaSample
static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader *iface, static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader *iface,
DWORD timeout, IMediaSample **sample, DWORD_PTR *cookie) DWORD timeout, IMediaSample **sample, DWORD_PTR *cookie)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
unsigned int i; unsigned int i;
TRACE("filter %p, timeout %u, sample %p, cookie %p.\n", filter, timeout, sample, cookie); TRACE("filter %p, timeout %u, sample %p, cookie %p.\n", filter, timeout, sample, cookie);
@ -855,7 +852,7 @@ static BOOL sync_read(HANDLE file, LONGLONG offset, LONG length, BYTE *buffer, D
static HRESULT WINAPI FileAsyncReader_SyncReadAligned(IAsyncReader *iface, IMediaSample *sample) static HRESULT WINAPI FileAsyncReader_SyncReadAligned(IAsyncReader *iface, IMediaSample *sample)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
REFERENCE_TIME start_time, end_time; REFERENCE_TIME start_time, end_time;
DWORD read_len; DWORD read_len;
BYTE *buffer; BYTE *buffer;
@ -891,7 +888,7 @@ static HRESULT WINAPI FileAsyncReader_SyncReadAligned(IAsyncReader *iface, IMedi
static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader *iface, static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader *iface,
LONGLONG offset, LONG length, BYTE *buffer) LONGLONG offset, LONG length, BYTE *buffer)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
DWORD read_len; DWORD read_len;
HRESULT hr; HRESULT hr;
BOOL ret; BOOL ret;
@ -912,7 +909,7 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader *iface,
static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available) static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader *iface, LONGLONG *total, LONGLONG *available)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
DWORD low, high; DWORD low, high;
TRACE("iface %p, total %p, available %p.\n", iface, total, available); TRACE("iface %p, total %p, available %p.\n", iface, total, available);
@ -927,7 +924,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader *iface, LONGLONG *tota
static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface) static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
unsigned int i; unsigned int i;
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
@ -947,7 +944,7 @@ static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
static HRESULT WINAPI FileAsyncReader_EndFlush(IAsyncReader * iface) static HRESULT WINAPI FileAsyncReader_EndFlush(IAsyncReader * iface)
{ {
AsyncReader *filter = impl_from_IAsyncReader(iface); struct async_reader *filter = impl_from_IAsyncReader(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);