Commit bd83b11a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Return a strmbase_pin pointer from the filter_get_pin() callback.

parent ad96d919
......@@ -67,7 +67,7 @@ static const IBaseFilterVtbl AudioRecordVtbl = {
BaseFilterImpl_QueryVendorInfo
};
static IPin *audio_record_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *audio_record_get_pin(struct strmbase_filter *iface, unsigned int index)
{
FIXME("iface %p, index %u, stub!\n", iface, index);
return NULL;
......
......@@ -178,14 +178,14 @@ static const IBaseFilterVtbl AVICompressorVtbl = {
BaseFilterImpl_QueryVendorInfo,
};
static IPin *avi_compressor_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *avi_compressor_get_pin(struct strmbase_filter *iface, unsigned int index)
{
AVICompressor *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin.IPin_iface;
return &filter->sink.pin;
else if (index == 1)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -113,14 +113,14 @@ static inline AviMux* impl_from_strmbase_filter(struct strmbase_filter *filter)
return CONTAINING_RECORD(filter, AviMux, filter);
}
static IPin *avi_mux_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *avi_mux_get_pin(struct strmbase_filter *iface, unsigned int index)
{
AviMux *filter = impl_from_strmbase_filter(iface);
if (!index)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
else if (index <= filter->input_pin_no)
return &filter->in[index - 1]->pin.pin.IPin_iface;
return &filter->in[index - 1]->pin.pin;
return NULL;
}
......
......@@ -69,16 +69,16 @@ static const IBaseFilterVtbl SmartTeeFilterVtbl = {
BaseFilterImpl_QueryVendorInfo
};
static IPin *smart_tee_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *smart_tee_get_pin(struct strmbase_filter *iface, unsigned int index)
{
SmartTeeFilter *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin.IPin_iface;
return &filter->sink.pin;
else if (index == 1)
return &filter->capture.pin.IPin_iface;
return &filter->capture.pin;
else if (index == 2)
return &filter->preview.pin.IPin_iface;
return &filter->preview.pin;
return NULL;
}
......
......@@ -82,14 +82,14 @@ static inline VfwCapture *impl_from_IPersistPropertyBag(IPersistPropertyBag *ifa
return CONTAINING_RECORD(iface, VfwCapture, IPersistPropertyBag_iface);
}
static IPin *vfw_capture_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *vfw_capture_get_pin(struct strmbase_filter *iface, unsigned int index)
{
VfwCapture *This = impl_from_strmbase_filter(iface);
if (index >= 1)
return NULL;
return &This->source.pin.IPin_iface;
return &This->source.pin;
}
static void vfw_capture_destroy(struct strmbase_filter *iface)
......
......@@ -100,14 +100,14 @@ static void SampleGrabber_cleanup(SG_Impl *This)
IUnknown_Release(This->seekthru_unk);
}
static IPin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int index)
{
SG_Impl *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin.IPin_iface;
return &filter->sink.pin;
else if (index == 1)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -341,12 +341,12 @@ BOOL get_media_type(const WCHAR *filename, GUID *majortype, GUID *subtype, GUID
return FALSE;
}
static IPin *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);
if (!index && filter->pszFileName)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -519,11 +519,11 @@ static inline struct testfilter *impl_from_BaseFilter(struct strmbase_filter *if
return CONTAINING_RECORD(iface, struct testfilter, filter);
}
static IPin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct testfilter *filter = impl_from_BaseFilter(iface);
if (!index)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -879,11 +879,11 @@ static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filte
return CONTAINING_RECORD(iface, struct testfilter, filter);
}
static IPin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct testfilter *filter = impl_from_strmbase_filter(iface);
if (!index)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -883,11 +883,11 @@ static inline struct testfilter *impl_from_strmbase_filter(struct strmbase_filte
return CONTAINING_RECORD(iface, struct testfilter, filter);
}
static IPin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct testfilter *filter = impl_from_strmbase_filter(iface);
if (!index)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -42,7 +42,6 @@ static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT enum_pins_create(struct strmbase_filter *base, IEnumPins **out)
{
IEnumPinsImpl *object;
IPin *pin;
if (!out)
return E_POINTER;
......@@ -59,7 +58,7 @@ HRESULT enum_pins_create(struct strmbase_filter *base, IEnumPins **out)
IBaseFilter_AddRef(&base->IBaseFilter_iface);
object->Version = base->pin_version;
while ((pin = base->ops->filter_get_pin(base, object->count)))
while (base->ops->filter_get_pin(base, object->count))
++object->count;
TRACE("Created enumerator %p.\n", object);
......@@ -137,12 +136,12 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin **
for (i = 0; i < cPins; ++i)
{
IPin *pin = This->base->ops->filter_get_pin(This->base, This->uIndex + i);
struct strmbase_pin *pin = This->base->ops->filter_get_pin(This->base, This->uIndex + i);
if (!pin)
break;
IPin_AddRef(ppPins[i] = pin);
IPin_AddRef(ppPins[i] = &pin->IPin_iface);
}
if (pcFetched)
......@@ -173,14 +172,13 @@ static HRESULT WINAPI IEnumPinsImpl_Skip(IEnumPins *iface, ULONG count)
static HRESULT WINAPI IEnumPinsImpl_Reset(IEnumPins *iface)
{
IEnumPinsImpl *enum_pins = impl_from_IEnumPins(iface);
IPin *pin;
TRACE("iface %p.\n", iface);
if (enum_pins->Version != enum_pins->base->pin_version)
{
enum_pins->count = 0;
while ((pin = enum_pins->base->ops->filter_get_pin(enum_pins->base, enum_pins->count)))
while (enum_pins->base->ops->filter_get_pin(enum_pins->base, enum_pins->count))
++enum_pins->count;
}
......
......@@ -250,24 +250,16 @@ HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter *iface, IEnumPins **enum_pins
HRESULT WINAPI BaseFilterImpl_FindPin(IBaseFilter *iface, const WCHAR *id, IPin **ret)
{
struct strmbase_filter *This = impl_from_IBaseFilter(iface);
struct strmbase_pin *pin;
unsigned int i;
PIN_INFO info;
HRESULT hr;
IPin *pin;
TRACE("(%p)->(%s, %p)\n", This, debugstr_w(id), ret);
for (i = 0; (pin = This->ops->filter_get_pin(This, i)); ++i)
{
hr = IPin_QueryPinInfo(pin, &info);
if (FAILED(hr))
return hr;
if (info.pFilter) IBaseFilter_Release(info.pFilter);
if (!lstrcmpW(id, info.achName))
if (!lstrcmpW(id, pin->name))
{
IPin_AddRef(*ret = pin);
IPin_AddRef(*ret = &pin->IPin_iface);
return S_OK;
}
}
......
......@@ -163,12 +163,12 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl =
BaseInputPinImpl_NewSegment
};
static IPin *renderer_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *renderer_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct strmbase_renderer *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin.IPin_iface;
return &filter->sink.pin;
return NULL;
}
......
......@@ -114,14 +114,14 @@ static HRESULT source_get_media_type(struct strmbase_pin *This, unsigned int iPo
return S_OK;
}
static IPin *transform_get_pin(struct strmbase_filter *iface, unsigned int index)
static struct strmbase_pin *transform_get_pin(struct strmbase_filter *iface, unsigned int index)
{
TransformFilter *filter = impl_from_strmbase_filter(iface);
if (index == 0)
return &filter->sink.pin.IPin_iface;
return &filter->sink.pin;
else if (index == 1)
return &filter->source.pin.IPin_iface;
return &filter->source.pin;
return NULL;
}
......
......@@ -1188,14 +1188,14 @@ static inline struct gstdemux_source *impl_from_IMediaSeeking(IMediaSeeking *ifa
return CONTAINING_RECORD(iface, struct gstdemux_source, seek.IMediaSeeking_iface);
}
static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
static struct strmbase_pin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
{
struct gstdemux *filter = impl_from_strmbase_filter(base);
if (!index)
return &filter->sink.IPin_iface;
return &filter->sink;
else if (index <= filter->cStreams)
return &filter->ppPins[index - 1]->pin.pin.IPin_iface;
return &filter->ppPins[index - 1]->pin.pin;
return NULL;
}
......
......@@ -208,21 +208,21 @@ static inline QTInPin *impl_from_IPin(IPin *iface)
* Base Filter
*/
static IPin *qt_splitter_get_pin(struct strmbase_filter *base, unsigned int index)
static struct strmbase_pin *qt_splitter_get_pin(struct strmbase_filter *base, unsigned int index)
{
QTSplitter *filter = impl_from_strmbase_filter(base);
if (index == 0)
return &filter->pInputPin.pin.IPin_iface;
return &filter->pInputPin.pin;
else if (index == 1)
{
if (filter->pVideo_Pin)
return &filter->pVideo_Pin->pin.pin.IPin_iface;
return &filter->pVideo_Pin->pin.pin;
else if (filter->pAudio_Pin)
return &filter->pAudio_Pin->pin.pin.IPin_iface;
return &filter->pAudio_Pin->pin.pin;
}
else if (index == 2 && filter->pVideo_Pin && filter->pAudio_Pin)
return &filter->pAudio_Pin->pin.pin.IPin_iface;
return &filter->pAudio_Pin->pin.pin;
return NULL;
}
......
......@@ -166,7 +166,7 @@ struct strmbase_filter
struct strmbase_filter_ops
{
IPin *(*filter_get_pin)(struct strmbase_filter *iface, unsigned int index);
struct strmbase_pin *(*filter_get_pin)(struct strmbase_filter *iface, unsigned int index);
void (*filter_destroy)(struct strmbase_filter *iface);
HRESULT (*filter_query_interface)(struct strmbase_filter *iface, REFIID iid, void **out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment