diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-18 11:13:28 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-18 11:13:28 +0000 |
commit | fa18524d053a04e19bb35f3c32ce5b063271362c (patch) | |
tree | 2b23b48152b71970a1929961c8cf725606228e69 /stream | |
parent | 1e663de8923f2a69b98f95bc4c922d13ab639eaa (diff) |
New media format negotiation code:
loop through all available formats trying to
establish connection between pins.
Negotiation stops either when all formats are rejected
(error reported in this case) or when connection is
established (which can happen only when current media
format is accepted by both of the pins).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25093 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/tvi_dshow.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 87d80455e3..da8443c7f4 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -1390,19 +1390,31 @@ static HRESULT build_sub_graph(priv_t * priv, IBaseFilter * pCaptureFilter, set_buffer_preference(20,(WAVEFORMATEX*)(arpmt[nFormatProbed]->pbFormat),pCapturePin,pSGIn); } + for(nFormatProbed=0; arpmt[nFormatProbed]; nFormatProbed++) + { + DisplayMediaType("Probing format", arpmt[nFormatProbed]); hr = OLE_CALL_ARGS(pSG, SetMediaType, arpmt[nFormatProbed]); //set desired mediatype if(FAILED(hr)){ mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: SetMediaType(pSG) call failed. Error:0x%x\n", (unsigned int)hr); - break; + continue; } /* connecting filters together: VideoCapture --> SampleGrabber */ hr = OLE_CALL_ARGS(priv->pGraph, Connect, pCapturePin, pSGIn); if(FAILED(hr)){ mp_msg(MSGT_TV,MSGL_DBG2,"tvi_dshow: Unable to create pCapturePin<->pSGIn connection. Error:0x%x\n", (unsigned int)hr); - break; + continue; + } + break; } OLE_RELEASE_SAFE(pSG); + if(!arpmt[nFormatProbed]) + { + mp_msg(MSGT_TV, MSGL_WARN, "tvi_dshow: Unable to negotiate media format\n"); + hr = E_FAIL; + break; + } + hr = OLE_CALL_ARGS(pCapturePin, ConnectionMediaType, pmt); if(FAILED(hr)) { |