With MPlatform, you can receive and output streams from (to) DirectShow objects. It is a 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 a source in MPlatform. To output from MPlatform to DirectShow, you should use MTransport Source filter.
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 an 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 a virtual device
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 should use Load("mp://"+objectName) method of IFileSourceFilter interface.