DirectShow's "Hello World" (from SDK Sample)

xiaoxiao2021-03-06  16

#include void __cdecl main (void) {IGraphBuilder * pGraph; IMediaControl * pMediaControl; CoInitialize (NULL); // Create the filter graph manager CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **). & pgraph); pgraph-> queryinterface (IID_IMEDIACONTROL, (void **) & pmediacontrol);

// build the graph. (Important: Change String to a file on your system.) Pgraph-> renderfile (L "// Hello_World.avi", NULL)

// Run the graph. Pmediacontrol-> run ();

// block untric the user clicks the OK button. // The Filter Graph Runs on a Separate Thread. MessageBox (NULL, _T ("Click me to end playback."), _T ("directshow"), MB_OK);

// clean up. Pmediacontrol-> release (); pgraph-> release (); couninitialize ();} is the source code, built a console application in PB4.2, then add 3 libraries in Project Settings LINK ( Strmbase.lib, strmiid.lib, ole32.lib, then compile, you can download to the Emulator downloaded to the SDK.

To pay attention: 1. Your SDK must contain DirectShow, otherwise custom one with PB.

2. Don't forget to put That Hello World.avi in ​​Emulator

转载请注明原文地址:https://www.9cbs.com/read-44046.html

New Post(0)