[vlc-commits] commit: Improve BDA for Windows 7 and Vista (Manol Manolov )

git at videolan.org git at videolan.org
Thu Jul 22 17:30:57 CEST 2010


vlc | branch: master | Manol Manolov <man40dev at gmail.com> | Tue Jul 20 20:42:19 2010 -0400| [b8a09dfe0c858f141f222ed4c2554b73b44e3933] | committer: Jean-Baptiste Kempf 

Improve BDA for Windows 7 and Vista

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 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b8a09dfe0c858f141f222ed4c2554b73b44e3933
---

 modules/access/bda/bdadefs.h    |    5 +++
 modules/access/bda/bdagraph.cpp |   65 ++++++++++++++++++++++-----------------
 2 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/modules/access/bda/bdadefs.h b/modules/access/bda/bdadefs.h
index a113640..9df57d3 100644
--- a/modules/access/bda/bdadefs.h
+++ b/modules/access/bda/bdadefs.h
@@ -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;
diff --git a/modules/access/bda/bdagraph.cpp b/modules/access/bda/bdagraph.cpp
index 1a41bb0..f34799d 100644
--- a/modules/access/bda/bdagraph.cpp
+++ b/modules/access/bda/bdagraph.cpp
@@ -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;



More information about the vlc-commits mailing list