[MPlayer-cvslog] r25093 - trunk/stream/tvi_dshow.c

voroshil subversion at mplayerhq.hu
Sun Nov 18 12:13:29 CET 2007


Author: voroshil
Date: Sun Nov 18 12:13:28 2007
New Revision: 25093

Log:
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).



Modified:
   trunk/stream/tvi_dshow.c

Modified: trunk/stream/tvi_dshow.c
==============================================================================
--- trunk/stream/tvi_dshow.c	(original)
+++ trunk/stream/tvi_dshow.c	Sun Nov 18 12:13:28 2007
@@ -1390,19 +1390,31 @@ static HRESULT build_sub_graph(priv_t * 
             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))
         {



More information about the MPlayer-cvslog mailing list