26
Company LOGO (1) Introduction to DirectShow Microsoft’s Multimedia Streaming Architecture

1– Introduction To Direct Show

Embed Size (px)

DESCRIPTION

Introduction to DirectShow programming 1st of nine lectures

Citation preview

Page 1: 1– Introduction To  Direct Show

Company

LOGO

(1) Introduction to DirectShow

Microsoft’s Multimedia Streaming Architecture

Page 2: 1– Introduction To  Direct Show

Intel - Motivation & Goals

DirectShow is the most common architecture for:

STB and IP-STB media streaming and broadcast reception

PC Streaming

Goals Understand STB architecture, its advantages

and disadvantages Fast prototyping and application building for

testing and demonstrations

Page 3: 1– Introduction To  Direct Show

What is DirectX

DirectX is Microsoft's component based architecture for media processing.

Similar streaming architecture were designed by: Real Emblaze (RapidMedia) Linux (GStreaming)

Media processing Audio Video Transport streams text.

Page 4: 1– Introduction To  Direct Show

DirectX – Why we need it?

Software reusability Code blocks can be reused and inherited Common Interfaces

Easy connection between 3rd party modules

Which components? Compression color conversion audio effects Transport stream handlers

Page 5: 1– Introduction To  Direct Show

Company

LOGO

A bit of History

DirectX Evolution from proprietary Codec to Filter base architecture

Page 6: 1– Introduction To  Direct Show

VFW

VFW architecture – a Plug-In architecture that supported CODEC and CAPTURE Interfaces for Audio & Video stream manipulation.

Advantages – All the CODECs have the same interfaces. There is no need specific modifications for each codec

Capture CODEC

Control Interfaces

IO Interfaces

Page 7: 1– Introduction To  Direct Show

VFW Problems

Rigid architectureRigid architecture OnlyOnly three types of filters three types of filters How to add costume filters that split or How to add costume filters that split or

mux transport stream?mux transport stream? Rigid interfaces creates a problem to the Rigid interfaces creates a problem to the

future progress of the architecturefuture progress of the architecture

Page 8: 1– Introduction To  Direct Show

Active Movie

A Filter base architecture that support customize filters

The architecture is built using: Filters that manipulates the stream Pins that handle filter connection graph management which

Connect the filters (automatically) Manage filters states (run, pause, stop) Transfer messages between filters

Page 9: 1– Introduction To  Direct Show

DirectX

Evolution of Active Movie (Audio & Video) to other aspects:

DirectShow – (previously ActiveMovie) Audio/Video/Text.

DirectDraw/Direct3D – Graphics. DirectSound – Sound effects and 3D sound. DirectPlay/DirectInput – Multiplayer Game tools. DirectMusic – Automatic music generation

Page 10: 1– Introduction To  Direct Show

Company

LOGO

Introduction to Directshow

Hands-on DirectShow : GraphEdit

Page 11: 1– Introduction To  Direct Show

GraphEdit

Visual Interface for graph building and testing.

Page 12: 1– Introduction To  Direct Show

GraphEdt – Rendering a file

Render a media file The graph build is what the OS does when you

double-click on a file. File rendering options:

Drag a media file to graph edit Use File->Open File Use:

graph->Insert filters use the circled button as a short cut Select File Source Async. Right click on output pin and select render

Page 13: 1– Introduction To  Direct Show

GraphEdt - Play with it

Use the: Play, Pause, and Stop commands Notice the file progress bar

Use the slider to change the current play position

Page 14: 1– Introduction To  Direct Show

GraphEdit – A bit more

Try looking at filter properties: Use right-click on the filter and select “Filter

Properties” We will later look at the Interface that enables

the communication to property pages. Example of Source file property This property is used only for monitoring and

not for controls. Why?

Page 15: 1– Introduction To  Direct Show

The “Metargemet” video

Lets view it using Graphedt Media\Metargemet.wmv This video is a nice example for information processing

architecture The information is:

Generated at the source (Keren) Processed and translated by a “transform unit” (Riki – translator) Rendered to the students Feedback messages are passed from the Renderer to the

source via the translator

Keren MorInfo. Source

Riki Blich“Transform”

Student“Renderer"

Page 16: 1– Introduction To  Direct Show

DirectShow Basic ideas

Information processing is a sequential process Each processing unit has a clear function The Source “Push” or pump information to

processing units (Blue). Data information is always Unidirectional: “Downstream”

Feedback is sent from the Renderer(s) to the source (Orange) – “Upstream”

No Information loops

Keren MorSource

Riki Blich“Transform”

Student“Renderer"

Page 17: 1– Introduction To  Direct Show

Information passing architecture

There are basically two methods: Push Pull

Those architecture differ in threading, Which filter is the active filter Where is the “Brain” of the graph

Page 18: 1– Introduction To  Direct Show

Push Architecture

Source is active Source generate Media Samples information is pushed by the source Like in the case of the “Metargemet” Source is active, owns the “processing thread” Used in

ASF/WMA/WMV files Video capture (USB cam, video cards) BDA capture

Page 19: 1– Introduction To  Direct Show

Pull Architecture

Information is pulled by a non-source filter Source is passive Does not own the “processing thread” In most file processing schemes (AVI, MPEG2)

the source is “dumb” and passive and the parser (demuxer) holds the “knowledge” of file parsing.

Page 20: 1– Introduction To  Direct Show

Components required

Data Processing unit– used for: Media data Generation Media data manipulation/transform Media data rendering

Interfaces – Generic Interfaces between data processing units

In “Metargemet” we use “Air Interface” with two basic media descriptors

Media descriptors In “Metargemet” we use two media types:

Archaic speech media between Source and Transform “Sleng” between Transform (Riki) and Renderer (Student)

Management unit (in “Metargem” – class/school)

Page 21: 1– Introduction To  Direct Show

Naming

Data processing unit = Filter Used for data manipulation and transform.

Filter Interface = Pin Used to define the connection between filters Include information about:

Direction Memory required Media Type

Page 22: 1– Introduction To  Direct Show

Naming - 2

Media Descriptor = Media Type Include information about the media passed

Data Unit = Media Sample Include the data itself Include information about the data

Page 23: 1– Introduction To  Direct Show

Filters

ActiveX objects (Use COM Interfaces)

Manipulates data Have Pin as members for interfacing other

filters Three basic types: Source, Render,

Transform Identification: GUID Control – property pages

Page 24: 1– Introduction To  Direct Show

Pin

Filters have one or more IO Interfaces - pins Pin is a class which basically holds interfaces to which

connect processing modules (filters) Pins could be exposed or hidden

Look at Infinite Pin tee filter Dynamic creation of pins for many types of filters:

Infinite Pin T MPEG and AVI Splitters

Two basic type: Input Output

Page 25: 1– Introduction To  Direct Show

Graph Builder

Create a streaming process for example: Read from file Demux Decode Encode Stream to network

Tasks: Loads the filters connect Filters Change filter states Disconnect filters Remove filters from graph.

The graph is always unidirectional (No loops) Have three basic states: Play, Pause, Stop.

Page 26: 1– Introduction To  Direct Show

DMOs

DirectX® Media Objects (DMOs) Create stream processing object that

could operate without a graph (Filters could only work as part of a graph)

DMOs could operate inside a graph using a “DMO Wrapper” which acts as a filter

Advantage Simpler interface No need to create a graph