forked from Mirrors/wine-wine
qcap: Added AVICompressorIn_ReceiveConnection implementation.
parent
1a2c6b9570
commit
56fa8f1cc5
|
@ -41,6 +41,10 @@ typedef struct {
|
||||||
|
|
||||||
DWORD fcc_handler;
|
DWORD fcc_handler;
|
||||||
HIC hic;
|
HIC hic;
|
||||||
|
|
||||||
|
VIDEOINFOHEADER *videoinfo;
|
||||||
|
size_t videoinfo_size;
|
||||||
|
DWORD driver_flags;
|
||||||
} AVICompressor;
|
} AVICompressor;
|
||||||
|
|
||||||
static inline AVICompressor *impl_from_BaseFilter(BaseFilter *filter)
|
static inline AVICompressor *impl_from_BaseFilter(BaseFilter *filter)
|
||||||
|
@ -73,6 +77,41 @@ static HRESULT ensure_driver(AVICompressor *This)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT fill_format_info(AVICompressor *This, VIDEOINFOHEADER *src_videoinfo)
|
||||||
|
{
|
||||||
|
DWORD size;
|
||||||
|
ICINFO icinfo;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = ensure_driver(This);
|
||||||
|
if(hres != S_OK)
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
size = ICGetInfo(This->hic, &icinfo, sizeof(icinfo));
|
||||||
|
if(size != sizeof(icinfo))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
size = ICCompressGetFormatSize(This->hic, &src_videoinfo->bmiHeader);
|
||||||
|
if(!size) {
|
||||||
|
FIXME("ICCompressGetFormatSize failed\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
size += FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
|
||||||
|
This->videoinfo = heap_alloc(size);
|
||||||
|
if(!This->videoinfo)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->videoinfo_size = size;
|
||||||
|
This->driver_flags = icinfo.dwFlags;
|
||||||
|
memset(This->videoinfo, 0, sizeof(*This->videoinfo));
|
||||||
|
ICCompressGetFormat(This->hic, &src_videoinfo->bmiHeader, &This->videoinfo->bmiHeader);
|
||||||
|
|
||||||
|
This->videoinfo->dwBitRate = 10000000/src_videoinfo->AvgTimePerFrame * This->videoinfo->bmiHeader.biSizeImage * 8;
|
||||||
|
This->videoinfo->AvgTimePerFrame = src_videoinfo->AvgTimePerFrame;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AVICompressor_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI AVICompressor_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
AVICompressor *This = impl_from_IBaseFilter(iface);
|
AVICompressor *This = impl_from_IBaseFilter(iface);
|
||||||
|
@ -113,6 +152,7 @@ static ULONG WINAPI AVICompressor_Release(IBaseFilter *iface)
|
||||||
if(!ref) {
|
if(!ref) {
|
||||||
if(This->hic)
|
if(This->hic)
|
||||||
ICClose(This->hic);
|
ICClose(This->hic);
|
||||||
|
heap_free(This->videoinfo);
|
||||||
if(This->in)
|
if(This->in)
|
||||||
BaseInputPinImpl_Release(&This->in->pin.IPin_iface);
|
BaseInputPinImpl_Release(&This->in->pin.IPin_iface);
|
||||||
if(This->out)
|
if(This->out)
|
||||||
|
@ -334,9 +374,19 @@ static HRESULT WINAPI AVICompressorIn_ReceiveConnection(IPin *iface,
|
||||||
IPin *pConnector, const AM_MEDIA_TYPE *pmt)
|
IPin *pConnector, const AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
AVICompressor *This = impl_from_IPin(iface);
|
AVICompressor *This = impl_from_IPin(iface);
|
||||||
FIXME("(%p)->(%p AM_MEDIA_TYPE(%p))\n", This, pConnector, pmt);
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p AM_MEDIA_TYPE(%p))\n", This, pConnector, pmt);
|
||||||
dump_AM_MEDIA_TYPE(pmt);
|
dump_AM_MEDIA_TYPE(pmt);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
hres = BaseInputPinImpl_ReceiveConnection(iface, pConnector, pmt);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
hres = fill_format_info(This, (VIDEOINFOHEADER*)pmt->pbFormat);
|
||||||
|
if(FAILED(hres))
|
||||||
|
BasePinImpl_Disconnect(iface);
|
||||||
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AVICompressorIn_Disconnect(IPin *iface)
|
static HRESULT WINAPI AVICompressorIn_Disconnect(IPin *iface)
|
||||||
|
|
Loading…
Reference in New Issue