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

strmbase: Pass an AM_MEDIA_TYPE pointer to CompleteConnect().

parent 264c539e
......@@ -413,18 +413,13 @@ static void dsound_render_start_stream(struct strmbase_renderer *iface)
}
}
static HRESULT WINAPI DSoundRender_CompleteConnect(struct strmbase_renderer *iface, IPin *pReceivePin)
static HRESULT dsound_render_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
const AM_MEDIA_TYPE *pmt = &This->renderer.sink.pin.mt;
const WAVEFORMATEX *format = (WAVEFORMATEX *)mt->pbFormat;
HRESULT hr = S_OK;
WAVEFORMATEX *format;
DSBUFFERDESC buf_desc;
TRACE("(%p)->(%p)\n", This, pReceivePin);
format = (WAVEFORMATEX*)pmt->pbFormat;
This->buf_size = format->nAvgBytesPerSec;
memset(&buf_desc,0,sizeof(DSBUFFERDESC));
......@@ -433,7 +428,7 @@ static HRESULT WINAPI DSoundRender_CompleteConnect(struct strmbase_renderer *ifa
DSBCAPS_CTRLFREQUENCY | DSBCAPS_GLOBALFOCUS |
DSBCAPS_GETCURRENTPOSITION2;
buf_desc.dwBufferBytes = This->buf_size;
buf_desc.lpwfxFormat = format;
buf_desc.lpwfxFormat = (WAVEFORMATEX *)format;
hr = IDirectSound8_CreateSoundBuffer(This->dsound, &buf_desc, &This->dsbuffer, NULL);
This->writepos = This->buf_size;
if (FAILED(hr))
......@@ -539,7 +534,7 @@ static const struct strmbase_renderer_ops renderer_ops =
.renderer_stop_stream = dsound_render_stop_stream,
.pfnShouldDrawSampleNow = DSoundRender_ShouldDrawSampleNow,
.pfnPrepareReceive = DSoundRender_PrepareReceive,
.pfnCompleteConnect = DSoundRender_CompleteConnect,
.renderer_connect = dsound_render_connect,
.pfnBreakConnect = DSoundRender_BreakConnect,
.pfnEndOfStream = DSoundRender_EndOfStream,
.pfnEndFlush = DSoundRender_EndFlush,
......
......@@ -331,38 +331,20 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi
return hr;
}
static HRESULT WINAPI VMR9_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI VMR9_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
{
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
const VIDEOINFOHEADER *vih;
if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) || !pmt->pbFormat)
if (!IsEqualIID(&mt->majortype, &MEDIATYPE_Video) || !mt->pbFormat)
return S_FALSE;
/* Ignore subtype, test for bicompression instead */
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
{
VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
if (!IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo)
&& !IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo2))
return S_FALSE;
This->bmiheader = format->bmiHeader;
This->VideoWidth = format->bmiHeader.biWidth;
This->VideoHeight = format->bmiHeader.biHeight;
SetRect(&This->source_rect, 0, 0, This->VideoWidth, This->VideoHeight);
}
else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
{
VIDEOINFOHEADER2 *format = (VIDEOINFOHEADER2 *)pmt->pbFormat;
vih = (VIDEOINFOHEADER *)mt->pbFormat;
This->bmiheader = format->bmiHeader;
This->VideoWidth = format->bmiHeader.biWidth;
This->VideoHeight = format->bmiHeader.biHeight;
SetRect(&This->source_rect, 0, 0, This->VideoWidth, This->VideoHeight);
}
else
{
ERR("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
return S_FALSE;
}
if (This->bmiheader.biCompression != BI_RGB)
if (vih->bmiHeader.biCompression != BI_RGB)
return S_FALSE;
return S_OK;
}
......@@ -461,16 +443,33 @@ static HRESULT WINAPI VMR9_ShouldDrawSampleNow(struct strmbase_renderer *iface,
return S_FALSE;
}
static HRESULT WINAPI VMR9_CompleteConnect(struct strmbase_renderer *This, IPin *pReceivePin)
static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
{
struct quartz_vmr *pVMR9 = impl_from_IBaseFilter(&This->filter.IBaseFilter_iface);
struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
HRESULT hr;
TRACE("(%p)\n", This);
if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo))
{
VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)mt->pbFormat;
filter->bmiheader = format->bmiHeader;
filter->VideoWidth = format->bmiHeader.biWidth;
filter->VideoHeight = format->bmiHeader.biHeight;
SetRect(&filter->source_rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
}
else if (IsEqualIID(&mt->formattype, &FORMAT_VideoInfo2))
{
VIDEOINFOHEADER2 *format = (VIDEOINFOHEADER2 *)mt->pbFormat;
filter->bmiheader = format->bmiHeader;
filter->VideoWidth = format->bmiHeader.biWidth;
filter->VideoHeight = format->bmiHeader.biHeight;
SetRect(&filter->source_rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
}
if (pVMR9->mode ||
SUCCEEDED(hr = IVMRFilterConfig9_SetRenderingMode(&pVMR9->IVMRFilterConfig9_iface, VMR9Mode_Windowed)))
hr = VMR9_maybe_init(pVMR9, FALSE);
if (filter->mode
|| SUCCEEDED(hr = IVMRFilterConfig9_SetRenderingMode(&filter->IVMRFilterConfig9_iface, VMR9Mode_Windowed)))
hr = VMR9_maybe_init(filter, FALSE);
return hr;
}
......@@ -576,7 +575,7 @@ static const struct strmbase_renderer_ops renderer_ops =
.renderer_start_stream = vmr_start_stream,
.renderer_stop_stream = vmr_stop_stream,
.pfnShouldDrawSampleNow = VMR9_ShouldDrawSampleNow,
.pfnCompleteConnect = VMR9_CompleteConnect,
.renderer_connect = vmr_connect,
.pfnBreakConnect = VMR9_BreakConnect,
.renderer_destroy = vmr_destroy,
.renderer_query_interface = vmr_query_interface,
......
......@@ -52,8 +52,8 @@ static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin
hr = BaseInputPinImpl_ReceiveConnection(iface, peer, mt);
if (SUCCEEDED(hr))
{
if (filter->pFuncsTable->pfnCompleteConnect)
hr = filter->pFuncsTable->pfnCompleteConnect(filter, peer);
if (filter->pFuncsTable->renderer_connect)
hr = filter->pFuncsTable->renderer_connect(filter, mt);
}
LeaveCriticalSection(&filter->filter.csFilter);
......
......@@ -523,7 +523,6 @@ typedef HRESULT (WINAPI *BaseRenderer_EndOfStream)(struct strmbase_renderer *ifa
typedef HRESULT (WINAPI *BaseRenderer_BeginFlush) (struct strmbase_renderer *iface);
typedef HRESULT (WINAPI *BaseRenderer_EndFlush) (struct strmbase_renderer *iface);
typedef HRESULT (WINAPI *BaseRenderer_BreakConnect) (struct strmbase_renderer *iface);
typedef HRESULT (WINAPI *BaseRenderer_CompleteConnect) (struct strmbase_renderer *iface, IPin *peer);
struct strmbase_renderer_ops
{
......@@ -534,7 +533,7 @@ struct strmbase_renderer_ops
void (*renderer_stop_stream)(struct strmbase_renderer *iface);
BaseRenderer_ShouldDrawSampleNow pfnShouldDrawSampleNow;
BaseRenderer_PrepareReceive pfnPrepareReceive;
BaseRenderer_CompleteConnect pfnCompleteConnect;
HRESULT (*renderer_connect)(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt);
BaseRenderer_BreakConnect pfnBreakConnect;
BaseRenderer_EndOfStream pfnEndOfStream;
BaseRenderer_EndFlush pfnEndFlush;
......
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