Hello World in DirectShow Programming
Every directshow application must perform the following
basic tasks.
- Creates an instance of the FGM
- Build a fliter graph using the FGM
- controls the filter graph and responds to events
Following example code will give an insight into a simple
directshow application, which uses the above mentioned tasks.
- Creating an instance of the FGM
IGraphBuilder Interface is used to create an instance of the
FGM.
IGraphBuilder *pGraph;
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder,
(void **)&pGraph);
- Building a filter graph with the FGM
IMediaControl Interface is used to handle the media stream
in the filter graph
IMediaControl *pMediaControl;
- Run the filter graph using the FGM
RenderFile method is used to read the video stream into the
filter.
Run method is used to run the media stream through the
filter graph
pGraph->RenderFile(L"\\Hello_World.avi", NULL);
pMediaControl->Run();
The Full Source code sample is found on http://msdn.microsoft.com/en-us/library/aa916490.aspx
No comments:
Post a Comment