]> git.sesse.net Git - vlc/commitdiff
Improve BDA for Windows 7 and Vista
authorManol Manolov <man40dev@gmail.com>
Wed, 21 Jul 2010 00:42:19 +0000 (20:42 -0400)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 22 Jul 2010 15:28:21 +0000 (17:28 +0200)
Add support for the universal Network Provider
Move put_TuneRequest after the capture filter is created and connected to the network provider. If not moved the request won't be accepted.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/access/bda/bdadefs.h
modules/access/bda/bdagraph.cpp

index a11364066d4ed99aafce77cc64715e6535cc56ff..9df57d30083f9e889aee53f4ac94ef812cb87202 100644 (file)
@@ -914,6 +914,11 @@ public:
 };
 
 extern "C" {
+/* Following GUIDs are for the new windows 7 interfaces  */
+/* windows 7 universal provider applies to all networks */
+const CLSID CLSID_NetworkProvider =
+    {0xB2F3A67C,0x29DA,0x4C78,{0x88,0x31,0x09,0x1E,0xD5,0x09,0xA4,0x75}};
+
 extern const CLSID CLSID_ATSCLocator;
 extern const CLSID CLSID_ATSCNetworkProvider;
 extern const CLSID CLSID_ATSCTuningSpace;
index 1a41bb0d78195a7c2ca6a5a372c9abcd427174a0..f34799d909afb7e06bd9f98af62051def0b0e452 100644 (file)
@@ -1204,14 +1204,22 @@ HRESULT BDAGraph::Build()
     }
 
     /* First filter in the graph is the Network Provider and
-     * its Scanning Tuner which takes the Tune Request*/
-    hr = ::CoCreateInstance( guid_network_type, NULL, CLSCTX_INPROC_SERVER,
+     * its Scanning Tuner which takes the Tune Request
+     * Try to build the Win 7 Universal Network Provider first*/
+    hr = ::CoCreateInstance( CLSID_NetworkProvider, NULL, CLSCTX_INPROC_SERVER,
         IID_IBaseFilter, (void**)&p_network_provider);
     if( FAILED( hr ) )
     {
         msg_Warn( p_access, "Build: "\
-            "Cannot CoCreate Network Provider: hr=0x%8lx", hr );
-        return hr;
+            "Cannot CoCreate the Universal Network Provider, trying the old way...");
+        hr = ::CoCreateInstance( guid_network_type, NULL, CLSCTX_INPROC_SERVER,
+            IID_IBaseFilter, (void**)&p_network_provider);
+        if( FAILED( hr ) )
+        {
+            msg_Warn( p_access, "Build: "\
+                "Cannot CoCreate Network Provider: hr=0x%8lx", hr );
+            return hr;
+        }
     }
     hr = p_filter_graph->AddFilter( p_network_provider, L"Network Provider" );
     if( FAILED( hr ) )
@@ -1221,30 +1229,6 @@ HRESULT BDAGraph::Build()
         return hr;
     }
 
-    hr = p_network_provider->QueryInterface( IID_IScanningTuner,
-        (void**)&p_scanning_tuner );
-    if( FAILED( hr ) )
-    {
-        msg_Warn( p_access, "Build: "\
-            "Cannot QI Network Provider for Scanning Tuner: hr=0x%8lx", hr );
-        return hr;
-    }
-
-    hr = p_scanning_tuner->Validate( p_tune_request );
-    if( FAILED( hr ) )
-    {
-        msg_Warn( p_access, "Build: "\
-            "Tune Request is invalid: hr=0x%8lx", hr );
-        return hr;
-    }
-    hr = p_scanning_tuner->put_TuneRequest( p_tune_request );
-    if( FAILED( hr ) )
-    {
-        msg_Warn( p_access, "Build: "\
-            "Cannot submit the tune request: hr=0x%8lx", hr );
-        return hr;
-    }
-
     /* Add the Network Tuner to the Network Provider. On subsequent calls,
      * l_tuner_used will cause a different tuner to be selected
      * To select a specific device first get the parameter that nominates the
@@ -1290,6 +1274,31 @@ HRESULT BDAGraph::Build()
         msg_Warn( p_access, "Build: "\
             "Cannot find Capture device. Connecting to tuner: hr=0x%8lx", hr );
     }
+
+    hr = p_network_provider->QueryInterface( IID_IScanningTuner,
+        (void**)&p_scanning_tuner );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "Build: "\
+            "Cannot QI Network Provider for Scanning Tuner: hr=0x%8lx", hr );
+        return hr;
+    }
+
+    hr = p_scanning_tuner->Validate( p_tune_request );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "Build: "\
+            "Tune Request is invalid: hr=0x%8lx", hr );
+        //return hr; it is not mandatory to validate. Validate fails, but the request is successfully accepted
+    }
+    hr = p_scanning_tuner->put_TuneRequest( p_tune_request );
+    if( FAILED( hr ) )
+    {
+        msg_Warn( p_access, "Build: "\
+            "Cannot submit the tune request: hr=0x%8lx", hr );
+        return hr;
+    }
+
     if( p_sample_grabber )
          p_sample_grabber->Release();
     p_sample_grabber = NULL;