MPlatform allows you to receive and output a streams from (to) DirectShow objects. It is useful feature if you have a DirectShow solution and want to include MPlatform into this or if you want to use your custom DirectShow source or receiver with MPlatform. To do it you should use Medialooks MTransport Sink and Medialooks MTransport Source filters. These filters are included in MPlatform. MTransport Sink allows you to use DirectShow graph as source in MPlatform. To output from MPlatform to DirectShow you should use MTransport Source filter or operate with virtual objects.
Receive a stream from DirectShow
This simple example shows you how to use MTransport Sink filter.
- Create a simple DirectShow graph with GraphEdit utility.
Remove Video Renderer and Default DirectSound Device.
- Select Graph - Insert Filters. Then select Medialooks MTransport Sink filter:
Click Insert Filter button.
- Connect Audio and Video pins as it is shown on picture:
- Run the graph.
- At the moment you have created external MPlatform object like any playlist or live source. To use it in your application that is based on MPlatform you should get this object. The procedure is quite the same as in multiple usage of objects. The general difference is that MTransport Sink objects have "MSink" name:
Output to DirectShow
- With virtual device
To do it you should create a virtual device in MPlatform with ObjectVirtualSourceCreate method. Then you are able to use this object as Video Capture Source:
- With MTransport Source filter
To do it you don't need to create a virtual device. You should insert Medialooks MTransport Source filter in your DirectShow graph:
Click Cancel button (if you use GraphEdit). Render this filter. A source in this example is:
And GraphEdit output is:
In GraphEdit MTransport Source filter is connected to the 1st external MPlatform object. To set required sink you need to use Load("mp://"+objectName) method of IFileSourceFilter interface.
If you use GraphEdit then usage of virtual object is much simpler cause you are able to set device name. In this case you can set parameters of this device.