[vlc-devel] commit: Fixed BDA sample grabber connection. (Laurent Aimar )
git version control
git at videolan.org
Fri Apr 24 21:34:22 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Apr 24 21:01:51 2009 +0200| [9861cd7bca3d90d9c8bd566d2a62fffe3f57f321] | committer: Laurent Aimar
Fixed BDA sample grabber connection.
It seems that two subtype are possible, so try both.
It fixes BDA playback.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9861cd7bca3d90d9c8bd566d2a62fffe3f57f321
---
modules/access/bda/bdagraph.cpp | 43 ++++++++++++++++++++++++--------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/modules/access/bda/bdagraph.cpp b/modules/access/bda/bdagraph.cpp
index fc656cc..5fa59d7 100644
--- a/modules/access/bda/bdagraph.cpp
+++ b/modules/access/bda/bdagraph.cpp
@@ -1284,24 +1284,35 @@ HRESULT BDAGraph::Build()
"Cannot QI Sample Grabber Filter: hr=0x%8lx", hr );
return hr;
}
- ZeroMemory( &grabber_media_type, sizeof( AM_MEDIA_TYPE ) );
- grabber_media_type.majortype = MEDIATYPE_Stream;
- grabber_media_type.subtype = MEDIASUBTYPE_MPEG2_TRANSPORT;
- hr = p_grabber->SetMediaType( &grabber_media_type );
- if( FAILED( hr ) )
- {
- msg_Warn( p_access, "Build: "\
- "Cannot set media type on grabber filter: hr=0x%8lx", hr );
- return hr;
- }
- hr = Connect( p_capture_device, p_sample_grabber );
- if( FAILED( hr ) )
- {
- msg_Warn( p_access, "Build: "\
- "Cannot connect Sample Grabber to Capture device: hr=0x%8lx", hr );
- return hr;
+ /* Try the possible stream type */
+ hr = E_FAIL;
+ for( int i = 0; i < 2; i++ )
+ {
+ ZeroMemory( &grabber_media_type, sizeof( AM_MEDIA_TYPE ) );
+ grabber_media_type.majortype = MEDIATYPE_Stream;
+ grabber_media_type.subtype = i == 0 ? MEDIASUBTYPE_MPEG2_TRANSPORT : KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT;
+ msg_Dbg( p_access, "Build: "
+ "Trying connecting with subtype %s",
+ i == 0 ? "MEDIASUBTYPE_MPEG2_TRANSPORT" : "KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT" );
+ hr = p_grabber->SetMediaType( &grabber_media_type );
+ if( SUCCEEDED( hr ) )
+ {
+ hr = Connect( p_capture_device, p_sample_grabber );
+ if( SUCCEEDED( hr ) )
+ break;
+ msg_Warn( p_access, "Build: "\
+ "Cannot connect Sample Grabber to Capture device: hr=0x%8lx (try %d/2)", hr, 1+i );
+ }
+ else
+ {
+ msg_Warn( p_access, "Build: "\
+ "Cannot set media type on grabber filter: hr=0x%8lx (try %d/2", hr, 1+i );
+ }
}
+ if( hr )
+ return hr;
+
/* We need the MPEG2 Demultiplexer even though we are going to use the VLC
* TS demuxer. The TIF filter connects to the MPEG2 demux and works with
* the Network Provider filter to set up the stream */
More information about the vlc-devel
mailing list