winegstreamer: Use strmbase_source_init().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d49417c081
commit
06d72b61ce
|
@ -30,6 +30,7 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "dshow.h"
|
#include "dshow.h"
|
||||||
#include "strmif.h"
|
#include "strmif.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
#include "wine/strmbase.h"
|
#include "wine/strmbase.h"
|
||||||
|
|
||||||
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
|
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
|
||||||
|
|
|
@ -104,7 +104,7 @@ static const IPinVtbl GST_InputPin_Vtbl;
|
||||||
static const IBaseFilterVtbl GST_Vtbl;
|
static const IBaseFilterVtbl GST_Vtbl;
|
||||||
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
|
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
|
||||||
|
|
||||||
static HRESULT GST_AddPin(GSTImpl *This, const PIN_INFO *piOutput, const AM_MEDIA_TYPE *amt);
|
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt);
|
||||||
static HRESULT GST_RemoveOutputPins(GSTImpl *This);
|
static HRESULT GST_RemoveOutputPins(GSTImpl *This);
|
||||||
static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
|
static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
|
||||||
static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
|
static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
|
||||||
|
@ -825,9 +825,9 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = GST_AddPin(This, &piOutput, &amt);
|
if (!create_pin(This, &piOutput, &amt))
|
||||||
if (FAILED(hr)) {
|
{
|
||||||
ERR("%08x\n", hr);
|
ERR("Failed to allocate memory.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,13 +1771,12 @@ static void free_source_pin(GSTOutPin *pin)
|
||||||
gst_object_unref(pin->my_sink);
|
gst_object_unref(pin->my_sink);
|
||||||
CloseHandle(pin->caps_event);
|
CloseHandle(pin->caps_event);
|
||||||
DeleteMediaType(pin->pmt);
|
DeleteMediaType(pin->pmt);
|
||||||
FreeMediaType(&pin->pin.pin.mtCurrent);
|
|
||||||
gst_segment_free(pin->segment);
|
gst_segment_free(pin->segment);
|
||||||
if (pin->gstpool)
|
if (pin->gstpool)
|
||||||
gst_object_unref(pin->gstpool);
|
gst_object_unref(pin->gstpool);
|
||||||
if (pin->pin.pAllocator)
|
|
||||||
IMemAllocator_Release(pin->pin.pAllocator);
|
strmbase_source_cleanup(&pin->pin);
|
||||||
CoTaskMemFree(pin);
|
heap_free(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IPinVtbl GST_OutputPin_Vtbl = {
|
static const IPinVtbl GST_OutputPin_Vtbl = {
|
||||||
|
@ -1811,27 +1810,30 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
|
||||||
GSTOutPin_DecideAllocator,
|
GSTOutPin_DecideAllocator,
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT GST_AddPin(GSTImpl *This, const PIN_INFO *piOutput, const AM_MEDIA_TYPE *amt)
|
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
GSTOutPin *pin, **new_array;
|
||||||
This->ppPins = CoTaskMemRealloc(This->ppPins, (This->cStreams + 1) * sizeof(IPin *));
|
|
||||||
|
|
||||||
hr = BaseOutputPin_Construct(&GST_OutputPin_Vtbl, sizeof(GSTOutPin), piOutput, &output_BaseOutputFuncTable, &This->filter.csFilter, (IPin**)(This->ppPins + This->cStreams));
|
if (!(new_array = CoTaskMemRealloc(filter->ppPins, (filter->cStreams + 1) * sizeof(*new_array))))
|
||||||
if (SUCCEEDED(hr)) {
|
return FALSE;
|
||||||
GSTOutPin *pin = This->ppPins[This->cStreams];
|
filter->ppPins = new_array;
|
||||||
memset((char*)pin + sizeof(pin->pin), 0, sizeof(GSTOutPin) - sizeof(pin->pin));
|
|
||||||
|
if (!(pin = heap_alloc_zero(sizeof(*pin))))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, pin_info,
|
||||||
|
&output_BaseOutputFuncTable, &filter->filter.csFilter);
|
||||||
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
||||||
CopyMediaType(pin->pmt, amt);
|
CopyMediaType(pin->pmt, mt);
|
||||||
pin->pin.pin.pinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
pin->caps_event = CreateEventW(NULL, 0, 0, NULL);
|
|
||||||
pin->segment = gst_segment_new();
|
pin->segment = gst_segment_new();
|
||||||
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,
|
||||||
BaseFilterImpl_IncrementPinVersion(&This->filter);
|
GST_ChangeCurrent, GST_ChangeRate, &filter->filter.csFilter);
|
||||||
} else
|
BaseFilterImpl_IncrementPinVersion(&filter->filter);
|
||||||
ERR("Failed with error %x\n", hr);
|
|
||||||
return hr;
|
filter->ppPins[filter->cStreams++] = pin;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT GST_RemoveOutputPins(GSTImpl *This)
|
static HRESULT GST_RemoveOutputPins(GSTImpl *This)
|
||||||
|
|
Loading…
Reference in New Issue