210 likes | 384 Views
Microsoft DirectX 8.0. Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁. Split AVI. Disk. COMBINE. Project Introduction I. Multicast. Network. RTP. JRTP. RTP. Disk. Player. Receiver. search. COMBINE. Project Introduction II.
E N D
Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁
Split AVI Disk COMBINE Project Introduction I Multicast Network RTP JRTP RTP Disk Player Receiver search
COMBINE Project Introduction II Multicast Network Sender RTP Capture JRTP RTP Disk Disk Player Receiver search COMBINE
COMBINE Project Introduction III Multicast Network Sender RTP RTCP Capture RTCP JRTP RTP MEM MEM Player Receiver search COMBINE
Small mini program Small mini program A-B A-C B-C Small mini program Microsoft COM( Component Object Model) Single Program A B C
Microsoft COM( Component Object Model) • COM is a spec, it defines methods of dynamic changing components and standards of cooperation between components and client programs. • COM is not… • A programming language • DLLs、MFC • Must be implemented by C++
Microsoft COM( Component Object Model) • COM Components is an executing code in the form of WIN32 DLL or EXE, and it must satisfy COM spec.
DirectShow • Filter The basic building block of DirectShow is a software component called a filter. DirectShow separates the processing of multimedia data into discrete steps, and a filter represents one (or sometimes more than one) processing step. All DirectShow filters fall into one of these three categories: source filters, transform filters, and renderer filters.
DirectShow • Source Filter Source filters present the raw multimedia data for processing. • Transform Filter Transform filters accept either raw or partially-processed data and process it further before passing it on. • Render Filter Renderer filters generally accept fully-processed data and play it on the system's monitor or through the speakers or possibly through some external device.
PIN DirectShow • Filter Graph Whenever a media file or stream is played, recorded, captured, broadcast, or processed in any way, it is done by means of connecting one or more filters together in a configuration called a filter graph.
DirectShow Initial COM Library Create Filter Graph Manager Control Media Stream Handle Events Configure Filter Graph
STEP 1 STEP 2 STEP 3 #include <dshow.h> void main(void) { IGraphBuilder *pGraph; IMediaControl *pMediaControl; IMediaEvent *pEvent; CoInitialize(NULL); // Create the filter graph manager and query for interfaces. CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph); pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl); pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); // Build the graph. IMPORTANT: Change string to a file on your system. pGraph->RenderFile(L"C:\\Hello_World.avi", NULL); // Run the graph. pMediaControl->Run(); // Wait for completion. long evCode; pEvent->WaitForCompletion(INFINITE, &evCode); // Clean up. pMediaControl->Release(); pEvent->Release(); pGraph->Release(); CoUninitialize(); }
Our Program DirectShow
Optional Video Compressor Filter Video Capture Filter AVI MUX Filter Video Render Filter File Writer Filter Network Receiver Sender File Source Filter AVI Splitter Filter Audio Render Filter Video Render Filter DirectShow In Our Project
Problems • Performance of Play • Because I/O overhead when render files. • Solution: Write a source filter for network stream. • Delay of Real Time • Compression , network transporting data and rendering multiple files cause the delay.
Summary • Using DirectShow is easy. If we want to make it flexible, we must learn how to create filter. • The real time problem must depend on RTP control.
Reference • Inside COM--Microsoft • Microsoft DirectX8.0 SDK Document • Online MSDN
Appendix • Sender圖片
Appendix • Receiver 圖片 PS.畫面抓不下來