Vous êtes sur la page 1sur 18

DirectShow

Introduction to DirectShow
playback or capture video and audio streams Support format
Advanced System Format (ASF) Motion Picture Experts Group (MPEG) Audio-Video Interleaved (AVI) MPEG Audio Layer-3 (MP3) WAV sound files

Introduction to DirectShow
automatically detects video and audio acceleration hardware Simplifies
Media playback, format conversion, capture task Provides access to the underlying stream control architecture you can create your own component to support new format

Introduction to DirectShow
Applications you can write
DVD player, video editing APs, AVI to ASF converter, MP3 players Digital video capture

Techniques
Component Object Model (COM) If you want to extend DirectShow, you need understand COM

Supports Formats in DirectShow


File Types
Windows Media Audio (WMA) Advanced Systems Format (ASF)* AVI WAV AU (Unix Audio) MIDI Windows Media Video (WMV)* MPEG
( WMA WMV)

QuickTime (version 2 and lower) AIFF SND (Sound File)

* Need Windows Media Format SDK

Supports Formats in DirectShow


Compression formats
ISO MPEG-4 video version 1.0* WMA*, WMV*, MP3 Microsoft MPEG-4 version 3* Digital Video (DV) MJPEG Sipro Labs ACELP* MPEG-1 (decompression only) Cinepak

MPEG2 decoder is not support by DirectShow

DirectShow FAQ
What OS does DirectShow support?
Win98, Win2000, WinME, WinXP

Do I need to know COM knowledge?


How to instantiate them Access the interface they expose Manage reference count (Filter designer requires more ) Is there a DirectShow Hardware Compatibility List (HCL) ? Using DirectDraw & DirectSound hardware, if they available Or using GDI video & waveOut* audio

DirectShow FAQ
What language can I use ?
DirectShow is designed for C++ VB access subset of the API Script based DVD or TV AP

Will it accessible through managed code?


no current plans, the CLR is not recommended for performance reasons

How does DirectShow relate to Microsoft ActiveMovie?


the original name for DirectShow

DirectShow FAQ
Information
MSDN DirectX Developer Center
http://go.microsoft.com/fwlink/?LinkId=10138

MSDN Audio & Video node


http://go.microsoft.com/fwlink/?LinkId=19380

Mail list
http://discuss.microsoft.com/archives/DIRECT XAV.htm

Use Net
microsoft.public.win32.programmer.directx.vi deo

FAQ
Books
Programming Microsoft DirectShow for Digital Video and Television DirectShow: Core Media Technology in Windows XP Empowers You to Create Custom Audio/Video Processing Components

FAQ
How do I build my application?
Header File Header file Dshow.h Required For All DirectShow APs

Library Files Library file Description Exports the Class ID (CLSIDs) Interface ID (IIDs) Exports the AMGetErrorText function, , link

Strmiids.lib Quartz.lib

FAQ
Detect whether DirectShow is installed?
IGraphBuilder *pGraph; HRESULT hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **) &pGraph);

Introduction to DirectShow Application Programming

Filter & Filter Graphs


Filter is a component and building block
receive input and produce output

MPEG-1 encoded stream

Filter Decode MPEG-1

Frame1 Frame2 Frame3

Filter Graph
APs performs task by connecting chains of filters together

a filter graph for playing an AVI file

A set of connected filters is called a filter graph

Writing a DirectShow Application


Three tasks must be performed
1
Filter Graph Manager

3
Filter Graph Manager filter graph Filter Graph Manager filter graph

When processing is completed, the application releases the Filter Graph Manager and all of the filters

Using COM

DirectX SDK

COM COM object COM interface COM lifetime C COM Macros DirectX COM Method

Vous aimerez peut-être aussi