Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu...

19
Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴賴賴 賴賴賴賴 賴賴賴 、、

Transcript of Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu...

Page 1: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Microsoft DirectX 8.0

Project Introduction

Microsoft COM

DirectShow

Instruction: Hsiao Kung Wu

Students: 賴建利、林廷駿、楊惟仁

Page 2: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Project Introduction I

DiskR

TP

RTP

ReceiverPlayer

Split AVI

DiskJRTP

Multicast

search

Network

COMBINE

Page 3: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Project Introduction II

DiskR

TP

RTP

ReceiverPlayer

Sender

Disk

JRTP

Multicast

search

Network

COMBINE

Capture

COMBINE

Page 4: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Project Introduction III

MEMR

TP

RTP

ReceiverPlayer

Sender

MEM

JRTP

Multicast

search

Network

COMBINE

Capture

COMBINE

RTC

P

RTCP

Page 5: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Microsoft COM( Component Object Model)

Single Program

A B

C

A-B

A-C B-C

Small mini program Small mini program

Small mini program

Page 6: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

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++

Page 7: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

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.

Page 8: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow

FilterThe 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.

Page 9: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow

Source FilterSource filters present the raw multimedia data for processing.

Transform FilterTransform filters accept either raw or partially-processed data and process it further before passing it on.

Render FilterRenderer filters generally accept fully-processed data and play it on the system's monitor or through the speakers or possibly through some external device.

Page 10: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow

Filter GraphWhenever 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.

PIN

Page 11: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow

Initial COM Library

Create Filter Graph Manager

Configure Filter Graph

Control Media Stream

Handle Events

Page 12: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

#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(); }

STEP 1

STEP 2

STEP 3

Page 13: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow

Our Program

Page 14: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

DirectShow In Our Project

Video CaptureFilter

Video CompressorFilter

File WriterFilter

Video RenderFilter

AVI MUXFilter

Optional

Receiver SenderNetwork

File Source Filter

AVI Splitter Filter

Audio Render Filter

Video Render Filter

Page 15: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

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.

Page 16: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

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.

Page 17: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Reference

Inside COM--Microsoft Microsoft DirectX8.0 SDK Document Online MSDN

Page 18: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Appendix

Sender圖片

Page 19: Microsoft DirectX 8.0 Project Introduction Microsoft COM DirectShow Instruction: Hsiao Kung Wu Students: 賴建利、林廷駿、楊惟仁.

Appendix

Receiver 圖片

PS.畫面抓不下來