Presentation is loading. Please wait.

Presentation is loading. Please wait.

Direct Show Introduction Direct Show Introduction to DirectShow And, I wish, a discussion.

Similar presentations


Presentation on theme: "Direct Show Introduction Direct Show Introduction to DirectShow And, I wish, a discussion."— Presentation transcript:

1 Direct Show Introduction Direct Show Introduction to DirectShow And, I wish, a discussion

2 Direct Show Introduction Component Model Direct Show can build your application composing filters, Combining them togheter you can view movies, capture and so on.....

3 Direct Show Introduction What does DirectShow manage? Video (play Back / Capture) Audio (play Back / Capture) Compression / Decompression Filtering Splitting / Mux / Demux

4 Direct Show Introduction But, what’s the story with DSound and DMusic? DShow uses DSound to manipulate music a DirectGraphics (3D and Draw) to manipulate images and video effects DMusic is something advanced for music orchestration, a scripting environment to control musical timeline

5 Direct Show Introduction What’s a DShow App like? 1.The application creates an instance of the Filter Graph Manager. 2.The application uses the Filter Graph Manager to build a filter graph. The exact set of filters in the graph will depend on the application. 3.The application uses the Filter Graph Manager to control the filter graph and stream data through the filters. Throughout this process, the application will also respond to events from the Filter Graph Manager.

6 Direct Show Introduction Recrompress Example Open a file with a file Source Split audio and video First decompress the video stream Recompress the Video Use a mux to put video and audio togheter again Write it down to a file

7 Direct Show Introduction The Direct Show Transormation DShow use a graph from sources to renderes (audio and video) Along the graph you can have filters 2 approaches In place transformations Not in place transformations Only C++ (the unmanaged one!)

8 Direct Show Introduction CTransformFilter::Transform This filter uses the CTransformInputPin class for its input pin, and the CTransformOutputPin class for its output pin. Use this base class if you want to try filter and then pass it through the graph Beware of memory leak!

9 Direct Show Introduction Example of transform HRESULT CRleFilter::Transform(IMediaSample *pSource, IMediaSample *pDest) { // Get pointers to the underlying buffers. BYTE *pBufferIn, *pBufferOut; hr = pSource->GetPointer(&pBufferIn); if (FAILED(hr)) { return hr; } hr = pDest->GetPointer(&pBufferOut); if (FAILED(hr)) { return hr; } // Process the data. DWORD cbDest = EncodeFrame(pBufferIn, pBufferOut); KASSERT((long)cbDest GetSize()); pDest->SetActualDataLength(cbDest); pDest->SetSyncPoint(TRUE); return S_OK; }

10 Direct Show Introduction CTransInPlaceFilter::Transform Transform the input sample in place Use it for real real-time processing What do you want more?

11 Direct Show Introduction The Frame Dispatcer Class If you want to apply filter to a real time camera or to an avi file in C# there’s an utility from the Medialab (university of Pisa) that can help you to get your frames inside a managed application!


Download ppt "Direct Show Introduction Direct Show Introduction to DirectShow And, I wish, a discussion."

Similar presentations


Ads by Google