Commit b8a09dfe authored by Manol Manolov's avatar Manol Manolov Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 09fc0953
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment