qedit/samplegrabber: Get rid of the SG_Impl typedef.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
218c382fd4
commit
933195d0b6
|
@ -33,8 +33,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
|
||||
|
||||
/* Sample Grabber filter implementation */
|
||||
typedef struct _SG_Impl {
|
||||
struct sample_grabber
|
||||
{
|
||||
struct strmbase_filter filter;
|
||||
ISampleGrabber ISampleGrabber_iface;
|
||||
|
||||
|
@ -51,7 +51,7 @@ typedef struct _SG_Impl {
|
|||
LONG oneShot;
|
||||
LONG bufferLen;
|
||||
void* bufferData;
|
||||
} SG_Impl;
|
||||
};
|
||||
|
||||
enum {
|
||||
OneShot_None,
|
||||
|
@ -59,24 +59,24 @@ enum {
|
|||
OneShot_Past,
|
||||
};
|
||||
|
||||
static inline SG_Impl *impl_from_strmbase_filter(struct strmbase_filter *iface)
|
||||
static struct sample_grabber *impl_from_strmbase_filter(struct strmbase_filter *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, SG_Impl, filter);
|
||||
return CONTAINING_RECORD(iface, struct sample_grabber, filter);
|
||||
}
|
||||
|
||||
static inline SG_Impl *impl_from_ISampleGrabber(ISampleGrabber *iface)
|
||||
static struct sample_grabber *impl_from_ISampleGrabber(ISampleGrabber *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, SG_Impl, ISampleGrabber_iface);
|
||||
return CONTAINING_RECORD(iface, struct sample_grabber, ISampleGrabber_iface);
|
||||
}
|
||||
|
||||
static inline SG_Impl *impl_from_IMemInputPin(IMemInputPin *iface)
|
||||
static struct sample_grabber *impl_from_IMemInputPin(IMemInputPin *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, SG_Impl, IMemInputPin_iface);
|
||||
return CONTAINING_RECORD(iface, struct sample_grabber, IMemInputPin_iface);
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup at end of life */
|
||||
static void SampleGrabber_cleanup(SG_Impl *This)
|
||||
static void SampleGrabber_cleanup(struct sample_grabber *This)
|
||||
{
|
||||
TRACE("(%p)\n", This);
|
||||
if (This->allocator)
|
||||
|
@ -89,7 +89,7 @@ static void SampleGrabber_cleanup(SG_Impl *This)
|
|||
|
||||
static struct strmbase_pin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int index)
|
||||
{
|
||||
SG_Impl *filter = impl_from_strmbase_filter(iface);
|
||||
struct sample_grabber *filter = impl_from_strmbase_filter(iface);
|
||||
|
||||
if (index == 0)
|
||||
return &filter->sink.pin;
|
||||
|
@ -100,7 +100,7 @@ static struct strmbase_pin *sample_grabber_get_pin(struct strmbase_filter *iface
|
|||
|
||||
static void sample_grabber_destroy(struct strmbase_filter *iface)
|
||||
{
|
||||
SG_Impl *filter = impl_from_strmbase_filter(iface);
|
||||
struct sample_grabber *filter = impl_from_strmbase_filter(iface);
|
||||
|
||||
SampleGrabber_cleanup(filter);
|
||||
strmbase_sink_cleanup(&filter->sink);
|
||||
|
@ -112,7 +112,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface)
|
|||
|
||||
static HRESULT sample_grabber_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
|
||||
{
|
||||
SG_Impl *filter = impl_from_strmbase_filter(iface);
|
||||
struct sample_grabber *filter = impl_from_strmbase_filter(iface);
|
||||
|
||||
if (IsEqualGUID(iid, &IID_ISampleGrabber))
|
||||
*out = &filter->ISampleGrabber_iface;
|
||||
|
@ -131,7 +131,7 @@ static const struct strmbase_filter_ops filter_ops =
|
|||
};
|
||||
|
||||
/* Helper that buffers data and/or calls installed sample callbacks */
|
||||
static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
|
||||
static void SampleGrabber_callback(struct sample_grabber *This, IMediaSample *sample)
|
||||
{
|
||||
double time = 0.0;
|
||||
REFERENCE_TIME tStart, tEnd;
|
||||
|
@ -192,31 +192,31 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_QueryInterface(ISampleGrabber *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_QueryInterface(This->filter.outer_unk, riid, ppv);
|
||||
struct sample_grabber *filter = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppv);
|
||||
}
|
||||
|
||||
/* IUnknown */
|
||||
static ULONG WINAPI
|
||||
SampleGrabber_ISampleGrabber_AddRef(ISampleGrabber *iface)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_AddRef(This->filter.outer_unk);
|
||||
struct sample_grabber *filter = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_AddRef(filter->filter.outer_unk);
|
||||
}
|
||||
|
||||
/* IUnknown */
|
||||
static ULONG WINAPI
|
||||
SampleGrabber_ISampleGrabber_Release(ISampleGrabber *iface)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_Release(This->filter.outer_unk);
|
||||
struct sample_grabber *filter = impl_from_ISampleGrabber(iface);
|
||||
return IUnknown_Release(filter->filter.outer_unk);
|
||||
}
|
||||
|
||||
/* ISampleGrabber */
|
||||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_SetOneShot(ISampleGrabber *iface, BOOL oneShot)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *This = impl_from_ISampleGrabber(iface);
|
||||
TRACE("(%p)->(%u)\n", This, oneShot);
|
||||
This->oneShot = oneShot ? OneShot_Wait : OneShot_None;
|
||||
return S_OK;
|
||||
|
@ -225,7 +225,7 @@ SampleGrabber_ISampleGrabber_SetOneShot(ISampleGrabber *iface, BOOL oneShot)
|
|||
/* ISampleGrabber */
|
||||
static HRESULT WINAPI SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *filter = impl_from_ISampleGrabber(iface);
|
||||
|
||||
TRACE("filter %p, mt %p.\n", filter, mt);
|
||||
strmbase_dump_media_type(mt);
|
||||
|
@ -242,7 +242,7 @@ static HRESULT WINAPI SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *filter = impl_from_ISampleGrabber(iface);
|
||||
|
||||
TRACE("filter %p, mt %p.\n", filter, mt);
|
||||
|
||||
|
@ -260,7 +260,7 @@ SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MED
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL bufferEm)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *This = impl_from_ISampleGrabber(iface);
|
||||
TRACE("(%p)->(%u)\n", This, bufferEm);
|
||||
EnterCriticalSection(&This->filter.csFilter);
|
||||
if (bufferEm) {
|
||||
|
@ -277,7 +277,7 @@ SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL buffer
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSize, LONG *buffer)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *This = impl_from_ISampleGrabber(iface);
|
||||
HRESULT ret = S_OK;
|
||||
TRACE("(%p)->(%p, %p)\n", This, bufSize, buffer);
|
||||
if (!bufSize)
|
||||
|
@ -315,7 +315,7 @@ SampleGrabber_ISampleGrabber_GetCurrentSample(ISampleGrabber *iface, IMediaSampl
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_SetCallback(ISampleGrabber *iface, ISampleGrabberCB *cb, LONG whichMethod)
|
||||
{
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
struct sample_grabber *This = impl_from_ISampleGrabber(iface);
|
||||
TRACE("(%p)->(%p, %u)\n", This, cb, whichMethod);
|
||||
if (This->grabberIface)
|
||||
ISampleGrabberCB_Release(This->grabberIface);
|
||||
|
@ -328,19 +328,19 @@ SampleGrabber_ISampleGrabber_SetCallback(ISampleGrabber *iface, ISampleGrabberCB
|
|||
|
||||
static HRESULT WINAPI SampleGrabber_IMemInputPin_QueryInterface(IMemInputPin *iface, REFIID iid, void **out)
|
||||
{
|
||||
SG_Impl *filter = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *filter = impl_from_IMemInputPin(iface);
|
||||
return IPin_QueryInterface(&filter->sink.pin.IPin_iface, iid, out);
|
||||
}
|
||||
|
||||
static ULONG WINAPI SampleGrabber_IMemInputPin_AddRef(IMemInputPin *iface)
|
||||
{
|
||||
SG_Impl *filter = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *filter = impl_from_IMemInputPin(iface);
|
||||
return IPin_AddRef(&filter->sink.pin.IPin_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI SampleGrabber_IMemInputPin_Release(IMemInputPin *iface)
|
||||
{
|
||||
SG_Impl *filter = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *filter = impl_from_IMemInputPin(iface);
|
||||
return IPin_Release(&filter->sink.pin.IPin_iface);
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ static ULONG WINAPI SampleGrabber_IMemInputPin_Release(IMemInputPin *iface)
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **allocator)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
TRACE("(%p)->(%p) allocator = %p\n", This, allocator, This->allocator);
|
||||
if (!allocator)
|
||||
return E_POINTER;
|
||||
|
@ -363,7 +363,7 @@ SampleGrabber_IMemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **all
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *allocator, BOOL readOnly)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
TRACE("(%p)->(%p, %u) allocator = %p\n", This, allocator, readOnly, This->allocator);
|
||||
if (This->allocator == allocator)
|
||||
return S_OK;
|
||||
|
@ -379,7 +379,7 @@ SampleGrabber_IMemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *a
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_GetAllocatorRequirements(IMemInputPin *iface, ALLOCATOR_PROPERTIES *props)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
FIXME("(%p)->(%p): semi-stub\n", This, props);
|
||||
if (!props)
|
||||
return E_POINTER;
|
||||
|
@ -390,7 +390,7 @@ SampleGrabber_IMemInputPin_GetAllocatorRequirements(IMemInputPin *iface, ALLOCAT
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
HRESULT hr;
|
||||
TRACE("(%p)->(%p) output = %p, grabber = %p\n", This, sample, This->source.pMemInputPin, This->grabberIface);
|
||||
if (!sample)
|
||||
|
@ -412,7 +412,7 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **samples, LONG nSamples, LONG *nProcessed)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
LONG idx;
|
||||
TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->source.pMemInputPin, This->grabberIface);
|
||||
if (!samples || !nProcessed)
|
||||
|
@ -428,7 +428,7 @@ SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **s
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_IMemInputPin_ReceiveCanBlock(IMemInputPin *iface)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
struct sample_grabber *This = impl_from_IMemInputPin(iface);
|
||||
TRACE("(%p)\n", This);
|
||||
return This->source.pMemInputPin ? IMemInputPin_ReceiveCanBlock(This->source.pMemInputPin) : S_OK;
|
||||
}
|
||||
|
@ -460,14 +460,14 @@ static const IMemInputPinVtbl IMemInputPin_VTable =
|
|||
SampleGrabber_IMemInputPin_ReceiveCanBlock,
|
||||
};
|
||||
|
||||
static inline SG_Impl *impl_from_sink_pin(struct strmbase_pin *iface)
|
||||
static struct sample_grabber *impl_from_sink_pin(struct strmbase_pin *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, SG_Impl, sink.pin);
|
||||
return CONTAINING_RECORD(iface, struct sample_grabber, sink.pin);
|
||||
}
|
||||
|
||||
static HRESULT sample_grabber_sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
|
||||
{
|
||||
SG_Impl *filter = impl_from_sink_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_sink_pin(iface);
|
||||
|
||||
if (IsEqualGUID(iid, &IID_IMemInputPin))
|
||||
*out = &filter->IMemInputPin_iface;
|
||||
|
@ -478,7 +478,7 @@ static HRESULT sample_grabber_sink_query_interface(struct strmbase_pin *iface, R
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static BOOL check_filter_mt(SG_Impl *filter, const AM_MEDIA_TYPE *mt)
|
||||
static BOOL check_filter_mt(struct sample_grabber *filter, const AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
if (IsEqualGUID(&filter->filter_mt.majortype, &GUID_NULL))
|
||||
return TRUE;
|
||||
|
@ -500,7 +500,7 @@ static BOOL check_filter_mt(SG_Impl *filter, const AM_MEDIA_TYPE *mt)
|
|||
|
||||
static HRESULT sample_grabber_sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_sink_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_sink_pin(iface);
|
||||
|
||||
return check_filter_mt(filter, mt) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ static HRESULT sample_grabber_sink_query_accept(struct strmbase_pin *iface, cons
|
|||
static HRESULT sample_grabber_sink_get_media_type(struct strmbase_pin *iface,
|
||||
unsigned int index, AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_sink_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_sink_pin(iface);
|
||||
IEnumMediaTypes *enummt;
|
||||
AM_MEDIA_TYPE *pmt;
|
||||
HRESULT hr;
|
||||
|
@ -539,14 +539,14 @@ static const struct strmbase_sink_ops sink_ops =
|
|||
.base.pin_get_media_type = sample_grabber_sink_get_media_type,
|
||||
};
|
||||
|
||||
static inline SG_Impl *impl_from_source_pin(struct strmbase_pin *iface)
|
||||
static struct sample_grabber *impl_from_source_pin(struct strmbase_pin *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, SG_Impl, source.pin);
|
||||
return CONTAINING_RECORD(iface, struct sample_grabber, source.pin);
|
||||
}
|
||||
|
||||
static HRESULT sample_grabber_source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
|
||||
{
|
||||
SG_Impl *filter = impl_from_source_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_source_pin(iface);
|
||||
|
||||
if (IsEqualGUID(iid, &IID_IMediaPosition))
|
||||
*out = &filter->passthrough.IMediaPosition_iface;
|
||||
|
@ -561,7 +561,7 @@ static HRESULT sample_grabber_source_query_interface(struct strmbase_pin *iface,
|
|||
|
||||
static HRESULT sample_grabber_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_source_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_source_pin(iface);
|
||||
|
||||
if (filter->sink.pin.peer && IPin_QueryAccept(filter->sink.pin.peer, mt) != S_OK)
|
||||
return S_FALSE;
|
||||
|
@ -572,7 +572,7 @@ static HRESULT sample_grabber_source_query_accept(struct strmbase_pin *iface, co
|
|||
static HRESULT sample_grabber_source_get_media_type(struct strmbase_pin *iface,
|
||||
unsigned int index, AM_MEDIA_TYPE *mt)
|
||||
{
|
||||
SG_Impl *filter = impl_from_source_pin(iface);
|
||||
struct sample_grabber *filter = impl_from_source_pin(iface);
|
||||
IEnumMediaTypes *enummt;
|
||||
AM_MEDIA_TYPE *pmt;
|
||||
HRESULT hr;
|
||||
|
@ -605,7 +605,7 @@ static inline BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TY
|
|||
static HRESULT WINAPI sample_grabber_source_DecideAllocator(struct strmbase_source *iface,
|
||||
IMemInputPin *peer, IMemAllocator **allocator)
|
||||
{
|
||||
SG_Impl *filter = impl_from_source_pin(&iface->pin);
|
||||
struct sample_grabber *filter = impl_from_source_pin(&iface->pin);
|
||||
const AM_MEDIA_TYPE *mt = &iface->pin.mt;
|
||||
|
||||
if (!compare_media_types(mt, &filter->sink.pin.mt))
|
||||
|
@ -639,7 +639,7 @@ static const struct strmbase_source_ops source_ops =
|
|||
|
||||
HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
|
||||
{
|
||||
SG_Impl *object;
|
||||
struct sample_grabber *object;
|
||||
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
Loading…
Reference in New Issue