Commit 6dc6f7fe authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

winegstreamer: Remove some casts that are not needed.

parent 30cdd1fb
...@@ -788,7 +788,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) ...@@ -788,7 +788,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
TRACE("%p %p %p\n", This, bin, pad); TRACE("%p %p %p\n", This, bin, pad);
piOutput.dir = PINDIR_OUTPUT; piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = (IBaseFilter *)This; piOutput.pFilter = &This->filter.IBaseFilter_iface;
name = gst_pad_get_name(pad); name = gst_pad_get_name(pad);
MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]) - 1); MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]) - 1);
TRACE("Name: %s\n", name); TRACE("Name: %s\n", name);
...@@ -1193,20 +1193,20 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) ...@@ -1193,20 +1193,20 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
static IPin* WINAPI GST_GetPin(BaseFilter *iface, int pos) static IPin* WINAPI GST_GetPin(BaseFilter *iface, int pos)
{ {
GSTImpl *This = (GSTImpl *)iface; GSTImpl *This = (GSTImpl *)iface;
IPin *pin;
TRACE("%p: Asking for pos %x\n", This, pos); TRACE("%p: Asking for pos %x\n", This, pos);
if (pos > This->cStreams || pos < 0) if (pos > This->cStreams || pos < 0)
return NULL; return NULL;
if (!pos) if (!pos)
{ pin = &This->pInputPin.pin.IPin_iface;
IPin_AddRef((IPin*)&This->pInputPin);
return (IPin*)&This->pInputPin;
}
else else
{ pin = &This->ppPins[pos - 1]->pin.pin.IPin_iface;
IPin_AddRef((IPin*)This->ppPins[pos - 1]);
return (IPin*)This->ppPins[pos - 1]; IPin_AddRef(pin);
} return pin;
} }
static LONG WINAPI GST_GetPinCount(BaseFilter *iface) static LONG WINAPI GST_GetPinCount(BaseFilter *iface)
...@@ -1238,13 +1238,13 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr) ...@@ -1238,13 +1238,13 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr)
mark_wine_thread(); mark_wine_thread();
This = CoTaskMemAlloc(sizeof(*This)); This = CoTaskMemAlloc(sizeof(*This));
obj = (IUnknown*)This;
if (!This) if (!This)
{ {
*phr = E_OUTOFMEMORY; *phr = E_OUTOFMEMORY;
return NULL; return NULL;
} }
obj = (IUnknown*)&This->filter.IBaseFilter_iface;
BaseFilter_Init(&This->filter, &GST_Vtbl, &CLSID_Gstreamer_Splitter, (DWORD_PTR)(__FILE__ ": GSTImpl.csFilter"), &BaseFuncTable); BaseFilter_Init(&This->filter, &GST_Vtbl, &CLSID_Gstreamer_Splitter, (DWORD_PTR)(__FILE__ ": GSTImpl.csFilter"), &BaseFuncTable);
This->cStreams = 0; This->cStreams = 0;
...@@ -1255,7 +1255,7 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr) ...@@ -1255,7 +1255,7 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr)
piInput = &This->pInputPin.pin.pinInfo; piInput = &This->pInputPin.pin.pinInfo;
piInput->dir = PINDIR_INPUT; piInput->dir = PINDIR_INPUT;
piInput->pFilter = (IBaseFilter *)This; piInput->pFilter = &This->filter.IBaseFilter_iface;
lstrcpynW(piInput->achName, wcsInputPinName, sizeof(piInput->achName) / sizeof(piInput->achName[0])); lstrcpynW(piInput->achName, wcsInputPinName, sizeof(piInput->achName) / sizeof(piInput->achName[0]));
This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
This->pInputPin.pin.refCount = 1; This->pInputPin.pin.refCount = 1;
...@@ -1285,17 +1285,17 @@ static void GST_Destroy(GSTImpl *This) ...@@ -1285,17 +1285,17 @@ static void GST_Destroy(GSTImpl *This)
hr = IPin_Disconnect(connected); hr = IPin_Disconnect(connected);
assert(hr == S_OK); assert(hr == S_OK);
IPin_Release(connected); IPin_Release(connected);
hr = IPin_Disconnect((IPin *)&This->pInputPin); hr = IPin_Disconnect(&This->pInputPin.pin.IPin_iface);
assert(hr == S_OK); assert(hr == S_OK);
} }
pinref = IPin_Release((IPin *)&This->pInputPin); pinref = IPin_Release(&This->pInputPin.pin.IPin_iface);
if (pinref) { if (pinref) {
/* Valgrind could find this, if I kill it here */ /* Valgrind could find this, if I kill it here */
ERR("pinref should be null, is %u, destroying anyway\n", pinref); ERR("pinref should be null, is %u, destroying anyway\n", pinref);
assert((LONG)pinref > 0); assert((LONG)pinref > 0);
while (pinref) while (pinref)
pinref = IPin_Release((IPin *)&This->pInputPin); pinref = IPin_Release(&This->pInputPin.pin.IPin_iface);
} }
if (This->bus) { if (This->bus) {
gst_bus_set_sync_handler(This->bus, NULL, NULL, NULL); gst_bus_set_sync_handler(This->bus, NULL, NULL, NULL);
...@@ -1313,14 +1313,13 @@ static HRESULT WINAPI GST_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID ...@@ -1313,14 +1313,13 @@ static HRESULT WINAPI GST_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID
*ppv = NULL; *ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown)) if (IsEqualIID(riid, &IID_IUnknown) ||
*ppv = This; IsEqualIID(riid, &IID_IPersist) ||
else if (IsEqualIID(riid, &IID_IPersist)) IsEqualIID(riid, &IID_IMediaFilter) ||
*ppv = This; IsEqualIID(riid, &IID_IBaseFilter))
else if (IsEqualIID(riid, &IID_IMediaFilter)) {
*ppv = This; *ppv = &This->filter.IBaseFilter_iface;
else if (IsEqualIID(riid, &IID_IBaseFilter)) }
*ppv = This;
if (*ppv) { if (*ppv) {
IUnknown_AddRef((IUnknown *)(*ppv)); IUnknown_AddRef((IUnknown *)(*ppv));
...@@ -1426,7 +1425,7 @@ static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart) ...@@ -1426,7 +1425,7 @@ static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
This->filter.rtStreamStart = tStart; This->filter.rtStreamStart = tStart;
for (i = 0; i < This->cStreams; i++) { for (i = 0; i < This->cStreams; i++) {
hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[i]); hr = BaseOutputPinImpl_Active(&This->ppPins[i]->pin);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr_any = hr; hr_any = hr;
} }
...@@ -1518,19 +1517,19 @@ static HRESULT WINAPI GST_ChangeRate(IMediaSeeking *iface) ...@@ -1518,19 +1517,19 @@ static HRESULT WINAPI GST_ChangeRate(IMediaSeeking *iface)
static HRESULT WINAPI GST_Seeking_QueryInterface(IMediaSeeking *iface, REFIID riid, void **ppv) static HRESULT WINAPI GST_Seeking_QueryInterface(IMediaSeeking *iface, REFIID riid, void **ppv)
{ {
GSTOutPin *This = impl_from_IMediaSeeking(iface); GSTOutPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_QueryInterface((IUnknown *)This, riid, ppv); return IPin_QueryInterface(&This->pin.pin.IPin_iface, riid, ppv);
} }
static ULONG WINAPI GST_Seeking_AddRef(IMediaSeeking *iface) static ULONG WINAPI GST_Seeking_AddRef(IMediaSeeking *iface)
{ {
GSTOutPin *This = impl_from_IMediaSeeking(iface); GSTOutPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_AddRef((IUnknown *)This); return IPin_AddRef(&This->pin.pin.IPin_iface);
} }
static ULONG WINAPI GST_Seeking_Release(IMediaSeeking *iface) static ULONG WINAPI GST_Seeking_Release(IMediaSeeking *iface)
{ {
GSTOutPin *This = impl_from_IMediaSeeking(iface); GSTOutPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_Release((IUnknown *)This); return IPin_Release(&This->pin.pin.IPin_iface);
} }
static HRESULT WINAPI GST_Seeking_GetCurrentPosition(IMediaSeeking *iface, REFERENCE_TIME *pos) static HRESULT WINAPI GST_Seeking_GetCurrentPosition(IMediaSeeking *iface, REFERENCE_TIME *pos)
...@@ -1650,25 +1649,25 @@ static const IMediaSeekingVtbl GST_Seeking_Vtbl = ...@@ -1650,25 +1649,25 @@ static const IMediaSeekingVtbl GST_Seeking_Vtbl =
static inline GSTOutPin *impl_from_IQualityControl( IQualityControl *iface ) static inline GSTOutPin *impl_from_IQualityControl( IQualityControl *iface )
{ {
return (GSTOutPin*)CONTAINING_RECORD(iface, GSTOutPin, IQualityControl_iface); return CONTAINING_RECORD(iface, GSTOutPin, IQualityControl_iface);
} }
static HRESULT WINAPI GST_QualityControl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) static HRESULT WINAPI GST_QualityControl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv)
{ {
GSTOutPin *pin = impl_from_IQualityControl(iface); GSTOutPin *pin = impl_from_IQualityControl(iface);
return IPin_QueryInterface((IPin*)pin, riid, ppv); return IPin_QueryInterface(&pin->pin.pin.IPin_iface, riid, ppv);
} }
static ULONG WINAPI GST_QualityControl_AddRef(IQualityControl *iface) static ULONG WINAPI GST_QualityControl_AddRef(IQualityControl *iface)
{ {
GSTOutPin *pin = impl_from_IQualityControl(iface); GSTOutPin *pin = impl_from_IQualityControl(iface);
return IPin_AddRef((IPin*)pin); return IPin_AddRef(&pin->pin.pin.IPin_iface);
} }
static ULONG WINAPI GST_QualityControl_Release(IQualityControl *iface) static ULONG WINAPI GST_QualityControl_Release(IQualityControl *iface)
{ {
GSTOutPin *pin = impl_from_IQualityControl(iface); GSTOutPin *pin = impl_from_IQualityControl(iface);
return IPin_Release((IPin*)pin); return IPin_Release(&pin->pin.pin.IPin_iface);
} }
static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm)
...@@ -1889,13 +1888,13 @@ static HRESULT GST_AddPin(GSTImpl *This, const PIN_INFO *piOutput, const AM_MEDI ...@@ -1889,13 +1888,13 @@ static HRESULT GST_AddPin(GSTImpl *This, const PIN_INFO *piOutput, const AM_MEDI
memset((char*)pin + sizeof(pin->pin), 0, sizeof(GSTOutPin) - sizeof(pin->pin)); memset((char*)pin + sizeof(pin->pin), 0, sizeof(GSTOutPin) - sizeof(pin->pin));
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, amt); CopyMediaType(pin->pmt, amt);
pin->pin.pin.pinInfo.pFilter = (LPVOID)This; pin->pin.pin.pinInfo.pFilter = &This->filter.IBaseFilter_iface;
pin->caps_event = CreateEventW(NULL, 0, 0, NULL); pin->caps_event = CreateEventW(NULL, 0, 0, NULL);
pin->segment = gst_segment_new(); pin->segment = gst_segment_new();
This->cStreams++; This->cStreams++;
pin->IQualityControl_iface.lpVtbl = &GSTOutPin_QualityControl_Vtbl; pin->IQualityControl_iface.lpVtbl = &GSTOutPin_QualityControl_Vtbl;
SourceSeeking_Init(&pin->seek, &GST_Seeking_Vtbl, GST_ChangeStop, GST_ChangeCurrent, GST_ChangeRate, &This->filter.csFilter); SourceSeeking_Init(&pin->seek, &GST_Seeking_Vtbl, GST_ChangeStop, GST_ChangeCurrent, GST_ChangeRate, &This->filter.csFilter);
BaseFilterImpl_IncrementPinVersion((BaseFilter*)This); BaseFilterImpl_IncrementPinVersion(&This->filter);
} else } else
ERR("Failed with error %x\n", hr); ERR("Failed with error %x\n", hr);
return hr; return hr;
...@@ -1921,14 +1920,14 @@ static HRESULT GST_RemoveOutputPins(GSTImpl *This) ...@@ -1921,14 +1920,14 @@ static HRESULT GST_RemoveOutputPins(GSTImpl *This)
for (i = 0; i < This->cStreams; i++) { for (i = 0; i < This->cStreams; i++) {
hr = BaseOutputPinImpl_BreakConnect(&ppOldPins[i]->pin); hr = BaseOutputPinImpl_BreakConnect(&ppOldPins[i]->pin);
TRACE("Disconnect: %08x\n", hr); TRACE("Disconnect: %08x\n", hr);
IPin_Release((IPin*)ppOldPins[i]); IPin_Release(&ppOldPins[i]->pin.pin.IPin_iface);
} }
This->cStreams = 0; This->cStreams = 0;
This->ppPins = NULL; This->ppPins = NULL;
gst_element_set_bus(This->container, NULL); gst_element_set_bus(This->container, NULL);
gst_object_unref(This->container); gst_object_unref(This->container);
This->container = NULL; This->container = NULL;
BaseFilterImpl_IncrementPinVersion((BaseFilter*)This); BaseFilterImpl_IncrementPinVersion(&This->filter);
CoTaskMemFree(ppOldPins); CoTaskMemFree(ppOldPins);
return S_OK; return S_OK;
} }
......
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