zhaojiahai / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

DirectShow video player cannot play .wmv #127

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using?
2.1.1

Please provide any additional information below.
WMV files cannot be loaded rendered after being loaded with the File source 
(async) filter. Instead, the method to use is graph.AddSourceFilter. Since 
this is a general method which also works for other decoders it should be 
used instead of the current implementation in 
AForge.Video.DirectShow.FileVideoSource (WorkerThread):

...
graph = (IGraphBuilder) graphObject;

// create source device's object
int hr = graph.AddSourceFilter(fileName, "source", out sourceBase);
if (sourceBase == null)
  throw new ApplicationException( "Failed creating source filter" );

// get type for sample grabber
type = Type.GetTypeFromCLSID( Clsid.SampleGrabber );
if ( type == null )
  throw new ApplicationException( "Failed creating sample grabber" );

// create sample grabber
grabberObject = Activator.CreateInstance( type );
sampleGrabber = (ISampleGrabber) grabberObject;
grabberBase = (IBaseFilter) grabberObject;

// add grabber filter to graph
graph.AddFilter( grabberBase, "grabber" );

// set media type
AMMediaType mediaType = new AMMediaType( );
...

Of course, sourceBase has to be released instead of sourceObject.

Original issue reported on code.google.com by uja...@gmail.com on 17 Feb 2010 at 1:28

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 22 Feb 2010 at 2:34

GoogleCodeExporter commented 8 years ago
Fixed as suggested. Thank you for the hint.

Was committed in revision 1187. Will be released in version 2.1.2

Original comment by andrew.k...@gmail.com on 24 Feb 2010 at 3:35

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 10 Mar 2010 at 3:12