Frank is a Software Engineer with rich experiences on messeging system, embedded system and communication system development. This is his work notes.

Monday, September 28, 2009

first app of DirectShow

Follow Windows Mobile 6 - Sample playback Program.

Problems that I met:
1. Compile error which is couldn't find some interface GUID;
Solved: after include the header file like "strmif.h" "control.h", problem got solved;

2. got linking error 2001: couldn't find extern definition;
Solved: follow MS link to solve http://support.microsoft.com/kb/130869, and also include 'strmiids.lib";

3. while running app, render function return errors and couldn't play media file;
Solved: codec is not properly used, after using the popular file .wav, it can play the wave file.

void TestPlay(void)
{
IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
HRESULT hRes;

CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
// Query for IMediaControl (not shown)
// Filenames start with a \\ instead of a drive letter.
//hRes = pGraph->RenderFile(L"\\music\\AllGoodThings\\drive.wma", NULL);
hRes = pGraph->RenderFile(L"\\music\\pegconn.wav", NULL);
hRes = pMediaControl->Run();
// Block until the user clicks the OK button.
// The filter graph runs on a separate thread.
MessageBox(NULL, L"Click me to end playback.", L"DirectShow", MB_OK);
// Clean up.
pMediaControl->Release();
pGraph->Release();
CoUninitialize();

};

No comments:

Followers