dshowsrcwrapper: fix DirectShow caps negotiation and set capture pin caps
Some cameras (IDS) have broken DirectShow drivers which incorrectly fill some fields in the VIDEOINFOHEADER structure; comparison between suggested and supported media types in CBaseRenderer should ignore deprecated and/or not essential fields; additionaly explicitely setting the mediatype for the capture pin before trying to connect it works around another IDS driver bug, and should have been already done anyway. https://bugzilla.gnome.org/show_bug.cgi?id=765428
This commit is contained in:
parent
26dfb7db83
commit
c7e0e8d6ab
@ -46,12 +46,19 @@ STDMETHODIMP
|
|||||||
|
|
||||||
HRESULT CDshowFakeSink::CheckMediaType (const CMediaType * pmt)
|
HRESULT CDshowFakeSink::CheckMediaType (const CMediaType * pmt)
|
||||||
{
|
{
|
||||||
if (pmt != NULL) {
|
if (!IsEqualGUID(pmt->majortype, m_MediaType.majortype) ||
|
||||||
if (*pmt == m_MediaType)
|
!IsEqualGUID(pmt->subtype, m_MediaType.subtype) ||
|
||||||
return S_OK;
|
!IsEqualGUID(pmt->formattype, m_MediaType.formattype) ||
|
||||||
}
|
(pmt->cbFormat != m_MediaType.cbFormat))
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
return S_FALSE;
|
VIDEOINFOHEADER *info1 = (VIDEOINFOHEADER*)pmt->pbFormat;
|
||||||
|
VIDEOINFOHEADER *info2 = (VIDEOINFOHEADER*)m_MediaType.pbFormat;
|
||||||
|
|
||||||
|
if (memcmp(&info1->bmiHeader, &info2->bmiHeader, sizeof(BITMAPINFOHEADER)))
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDshowFakeSink::DoRenderSample (IMediaSample * pMediaSample)
|
HRESULT CDshowFakeSink::DoRenderSample (IMediaSample * pMediaSample)
|
||||||
|
@ -682,6 +682,12 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
|
|||||||
src->filter_graph->Disconnect (input_pin);
|
src->filter_graph->Disconnect (input_pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hres = src->pVSC->SetFormat(pin_mediatype->mediatype);
|
||||||
|
if (FAILED (hres)) {
|
||||||
|
GST_ERROR ("Failed to set capture pin format (error=0x%x)", hres);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
hres = src->filter_graph->ConnectDirect (pin_mediatype->capture_pin,
|
hres = src->filter_graph->ConnectDirect (pin_mediatype->capture_pin,
|
||||||
input_pin, pin_mediatype->mediatype);
|
input_pin, pin_mediatype->mediatype);
|
||||||
input_pin->Release ();
|
input_pin->Release ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user