`
`Page 112of116
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`handle
`New value for the window handle.
`
`Remarks
`
`This property offers a way for applications to set the owner of the video window. This is often
`used when playing videos in compound documents.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+QH"·h' 111.q9 Topic Contents 1@1§111¥+
`
`SetWindowForeground Method (IVideoWindow
`Object)
`
`IVideoWindow Object
`
`Sets the video window as the foreground window and optionally gives it focus.
`
`objVideoWindow.SetWindowForeground Focus
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`Focus
`..LQ.ng value that specifies whether the video window will have focus. A value of -1 gives
`the window focus and 0 does not.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qij[.jij,M 111.11119 Topic Contents 1@1§111¥+
`
`SetWindowPosition Method (IVideoWindow
`Object)
`
`IVideoWindow Object
`
`136
`
`
`
`ActiveMovie Control
`
`Page 113of116
`
`Sets the position of the video window (not the client rectangle position) in device coordinates.
`
`objVideoWindow.SetWindowPosition Left, Top, Width, Height
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`
`Left
`
`Specifies the x-axis origin of the window.
`
`Top
`
`Specifies the y-axis origin of the window.
`Width
`Specifies the width of the window.
`Height
`Specifies the height of the window.
`
`Remarks
`
`Specify, in window coordinates, where the video should appear. For example, setting a
`destination of (100,50,200,400) positions the video playback at an origin of 100 pixels from
`the left of the client area, 50 pixels from the top, and with an overall size of 200 x 400 pixels.
`If the video is smaller than this (or a source rectangle has been specified that is smaller than
`the video), it will be stretched appropriately. Similarly, if the video is larger than the
`destination rectangle, the video is compressed into the visible rectangle. There are fairly
`severe performance penalties if an application does not keep the source and destination
`rectangles the same size.
`
`Under typical circumstances, when no destination rectangle has been set, the video fills the
`entire visible client window area (regardless of how much the user has stretched the window).
`Also, the destination rectangle properties correctly return the size of the video window client
`area.
`
`This method has the same effect as individually setting the Left, Tup_, Width, and Height
`properties.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQi@[.jlj,M l!i.! 11ij Topic Contents
`
`l@i§i 11111+
`
`MQ<§i[.jlj,M 111.Hj Topic Contents
`
`l@i§lllMM
`
`Top Property (IVideoWindow Object)
`
`IVideoWindow Object
`
`Retrieves or sets the y-axis coordinate of the video window.
`
`137
`
`
`
`ActiveMovie Control
`
`Page 114of116
`
`objVideoWindow.Top [= /Value]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`/Value
`New value for the y-axis origin.
`
`Remarks
`
`Calling this method does not affect the height of the video window.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQi@[.jjj,M l!i.! 111j Topic Contents
`
`l@IJll!MM
`
`Visible Property (IVideoWindow Object)
`
`IVideoWindow Object
`
`Retrieves or sets the visibility of the video window.
`
`objVideoWindow.Visible [= boolean]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`boolean
`If set to True, the window is shown; if False, the window is hidden.
`
`© 1997 Microsoft Comoration. All rights reserved. Terms of Use.
`
`+;<§1[.]jj,+ 11!.Hj Topic Contents
`
`l@i§il!MM
`
`Width Property (IVideoWindow Object)
`
`IVideoWindow Object
`
`Retrieves or sets the width of the video window.
`
`138
`
`
`
`ActiveMovie Control
`
`Page 115of116
`
`objVideoWindow.Width [= /Value]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`/Value
`New value of the width.
`
`Remarks
`
`The Width property is independent of the video window's Height property (the x-coordinate).
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQi@[.jjj,M l!i.! 111j Topic Contents
`
`l@IJll!MM
`
`WindowState Property (IVideoWindow Object)
`
`IVideoWindow Object
`
`Returns or sets the state of the video window.
`
`objVideoWindow.WindowState [= /Value]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`/Value
`New value for the WindowState property.
`
`© 1997 Microsoft Comoration. All rights reserved. Terms of Use.
`
`+;<§1[.]jj,+ 11!.Hj Topic Contents
`
`l@i§il!MM
`
`WindowStyle Property (IVideoWindow Object)
`
`IVideoWindow Object
`
`Retrieves or sets the style parameters for the video window.
`
`139
`
`
`
`ActiveMovie Control
`
`Page 116of116
`
`objVideoWindow.WindowStyle [=/Value]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`/Value
`New value for the WindowStyle property.
`
`Remarks
`
`For a complete list of window styles, see the CreateWindow function in the Microsoft® Platform
`Software Development Kit (SDK).
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQl@[.jjj,M l!i.l:.ij Topic Contents
`
`l@i§i llfttiM
`
`WindowStyleEx Property (IVideoWindow
`Object)
`
`IVideoWindow Object
`
`Changes the style parameters for the video window.
`
`objVideoWindow.WindowStyleEx [=/Value]
`
`Parts
`
`objVideo Window
`Object expression that evaluates to an IVideoWindow object.
`/Value
`New value for the flags. Valid values include only those flags that can be set by the
`GWL_STYLE value of the Microsoft Win32 GetWindowLong function.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use .
`
`140
`
`
`
`DirectShow Basics
`
`Page 1of62
`
`MQi@[.jjj,M M!i.!111j Topic Contents
`
`l@i§il!MM
`
`DirectShow Basics
`
`This section contains articles covering basic DirectShow concepts, such as filter graph
`architecture and data flow, how to use the Filter Graph Editor tool, and a list of the filters and
`sample filters supplied with DirectShow. You can use this section as a high-level introduction to
`DirectShow. You need only a general understanding of programming and media to understand
`the topics in this section.
`
`· Using DirectShow
`
`· Filter Graph Manager and Filter Graphs
`
`· Filters and Pins
`
`· Stream Control Architecture
`
`•Quality-Control Management
`
`· About Capture Filter Graphs
`
`· Improving Capture Performance
`
`· Data Flow in the Filter Graph
`
`· Constructing Filter Graphs Using Visual Basic
`
`· Controlling Filter Graphs Using Visual Basic
`
`· List of Filters and Samples
`
`· About the DirectShow Filter Graph Editor
`
`· Using the Filter Graph Editor
`
`· COM Overview
`
`· Overview of DVD Interfaces and Data Types
`
`· About WDM Video Capture
`
`© 1997 Microsoft Corooration . All rights reserved. Terms of Use.
`
`MQ<§i[.jjj,M lh.Hj Topic Contents
`
`i@faii!MM
`
`141
`
`
`
`DirectShow Basics
`
`Page 2of62
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`Using DirectShow
`
`Microsoft® DirectShow™ is an architecture that controls and processes streams of multimedia
`data through custom or built-in filters. You can also use the set of media streaming interfaces
`to stream media data without creating filters. See Use Multimedia Streaming in DirectShow
`Applications for more information.
`
`In addition to the architecture and the set of classes and interfaces to support it, DirectShow is
`also a run time that uses this architecture to enable users to play digital movies and sound
`encoded in various formats, including MPEG, AVI, MOV (Apple® QuickTime®) and WAV(cid:173)
`formatted files. The DirectShow run time is a control (.ocx), called the ActiveMovie Control,
`and a set of dynamic-link libraries (DLLs) that enable you to play back supported media files.
`
`DirectShow playback uses video and audio hardware cards that support the Microsoft DirectX®
`set of application programming interfaces (APis). The video and audio capture capability lets
`you programmatically control your system's video and audio capture hardware, as well as video
`and audio compressors and decompressors (codecs). The Plug and Play capability lets
`DirectShow automatically retrieve and use your filters, once you register their properties.
`
`Use the DirectShow architecture for most new multimedia applications for Windows® 95 or
`Windows NT®. With a few exceptions, it replaces multimedia playback services, APis, and
`architectures provided by Microsoft in earlier versions of the Windows Software Development
`Kit (SDK). However, libraries will continue to be available and supported for applications that
`use the earlier Microsoft multimedia playback services, such as Microsoft Video for Windows.
`
`Contents of this article:
`
`• DirectShow Architecture
`• Choosing the Right Programming Model
`• Playing Back Files Over the Internet
`
`DirectShow Architecture
`
`The DirectShow architecture defines how to control and process streams of multimedia data
`using modular components called filters. The filters have input or output pins, or both, and are
`connected to each other in a configuration called a filter graph. Applications use an object
`called the filter graph manager to assemble the filter graph and move data through it. By
`default, the filter graph manager automatically handles data flow for you; for example, it
`automatically inserts the proper codec if needed, and it automatically connects a transform
`filter's output pin to the default rendering filter. You can always specify your own filters and
`connections if you don't want to use the default configuration.
`
`The filter graph manager provides a set of Component Object Model (COM) interfaces so that
`applications can access the filter graph. Applications can directly call the filter graph manager
`interfaces to control the media stream or retrieve filter events, or they can use the ActiveMovie
`Control to play back media files.
`
`142
`
`
`
`DirectShow Basics
`
`Page 3 of 62
`
`Thus, you can access DirectShow through the COM interface, the ActiveMovie Control, or media
`control interfaces (MCI), as shown in the following rnustratiOn.
`
`Application
`
`ActiveMovie
`Control
`
`MCI
`
`Filter graph manager
`
`Source
`filter
`
`Transform
`filter
`
`Renderer
`filter
`
`Media source
`
`Media destination
`
`Because of the DirectShow architecture's flexible, modular design, filter graphs have many
`potential uses and applications. Examples include filter graphs that implement video capture,
`control remote devices such as VCRs, or enable MIDI recording and editing.
`
`Choosing the Right Programming M()(lel
`
`DirectShow is accessible at several levels, and the approach you use depends on what you
`need and how much programming you want to do. You might plan to rewrite an existing
`multimedia program, write a new multimedia program, or add multimedia capabilities to an
`existing program. Typically, existing applications that use the MCI command set are easily
`ported, whereas applications that access lower-level multimedia serviees require more time to
`rewrite. You can quickly add DirectShow playback services to new applications by using the
`ActiveMovie Control, or with a few direct !'unctions that call the COM interfaces. C or C+ +
`programmers can write filters that change or enhance multimedia data already managed by
`existing filter graphs.
`
`This section contains the following topics.
`
`• Rewriting Existing Applications
`• Writing New Applications
`
`Rewriting Existing Applications
`
`If you have an application that plays AV I-encoded movies and sounds and want to adapt it to
`use DirectShow to play AVI files, porting is straightforward if your application uses MCI
`commands or the Mierosoft Video for Windows® API. Your choice depends on the services the
`application uses and your goals. If your applicatiOn uses MCI commands, you can use the MCI
`subset that DirectShow provides. In the majority of cases, this will be a straightforward
`upgrade that maintains AVI playback and adds MPEG and QuickTime playback capabilities to
`your applieation. If your exiSting C-based application uses Video for Windows API, you can
`replace most of these with calls to the COM interfaces.
`
`Writing New Applications
`
`You can take a variety of approaches when writing a new applieation with DirectShow. For
`example, if you only want to add MPEG playback to your application, you can incorporate the
`ActiveMovie Control into your application or directly access the COM interfaces on the filter
`
`143
`
`
`
`DirectShow Basics
`
`Page 4of62
`
`graph manager. Both Microsoft Visual Basic® version 5.x and later and Microsoft Visual C++®
`version 5.x and later allow access to the ActiveMovie Control or the COM interfaces. Filters
`within a filter graph are typically written in C++ using the DirectShow class library.
`
`If your application must process the media stream in some way or capture a media stream,
`you can incorporate both the filter graph manager and a custom filter into your application.
`The instantiated filter graph manager generates and manages the filter graph. You can insert
`the custom filter into a preconfigured filter graph (which you create and save by using the
`Filter Graph Editor tool in the DirectShow SDK). You also could insert the filter into an existing
`filter graph at run time.
`
`Playing Back Files Over the Internet
`
`The ActiveMovie Control is incorporated into Microsoft Internet Explorer so that you can place
`the control on a Web page and program it by using Microsoft Visual Basic® Scripting Edition
`(VBScript) commands. To a programmer, the ActiveMovie Control is another ActiveX™ Control,
`one that has real-time playback capability. Real-time playback means that the ActiveMovie
`Control can play video or audio files over the Internet while the file is downloading, rather than
`requiring the user to wait until the whole file is downloaded to begin playback.
`
`The same filter graphs constructed to play media from files can play media from the Internet
`by simply changing the source filter. Take, for example, a filter graph that plays MPEG movies
`from a disk file. The first filter in the graph might be a file reader filter. By replacing this filter
`with a filter capable of reading from an Internet URL address, you can play MPEG movies from
`the Internet. Both file and URL reader source filters just deliver an unparsed stream of data. A
`parser filter pulls the data from the reader, parses it into separate streams of video, audio,
`text, or other data types, and pushes it downstream. This filter remains unchanged regardless
`of whether the source filter is a file or URL reader filter.
`
`The source filter that reads from an Internet server is called the File Source CURL) filter.
`DirectShow provides this as a built-in filter. It knows how to read, but not parse, data from a
`URL address. Therefore, a media parser follows the File Source (URL) filter in the filter graph.
`For MPEG sources, this parser is built into the MPEG splitter filter. Other media types have
`their own parser filters (for example, a QuickTime parser).
`
`The source filter that reads from files is the File Source (Async) filter. DirectShow also provides
`this as a built-in filter. It does no parsing on its own but simply reads data off a disk to play
`back. Most DirectShow filter graphs use this source filter.
`
`The architecture's modularity allows most of the same components to be reused between file
`and Internet playback. This modularity also means that if you want to render a new type of
`data, often you only need to write a parser and renderer, and you can still use the existing file
`or URL filter.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+;<§1[.]jj,i '!!·!:.!¥ Topic Contents i@i§ll!¥+
`
`MQl@[.jjj,M M!i.l:.19 Topic Contents
`
`i@i§i i!fttiM
`
`144
`
`
`
`DirectShow Basics
`
`Page 5 of 62
`
`Filter Graph Manager and Filter Graphs
`
`To use the filter graph manager from an application, it is not necessary to know much about
`the underlying filter graphs. However, it is usefUI to understand at least the basic principles of
`filter graphs if you ever want to configure your own filter graph rather than letting the filter
`graph manager configure them for you.
`
`A filter graph is composed of a collection of filters of different types. Most filters can be
`categorized into one of the following three types.
`
`• A source filter, which takes the data from some source, such as a file on disk, a satellite
`feed, an Internet server, or a VCR, and introduces it into the filter graph.
`• A transform filter, which takes the data, processes it, and then passes it along.
`• A rendering filter, which renders the data; typically this is rendered to a hardware
`device, but could be rendered to any location that accepts media input (such as memory
`or a diSk file).
`
`In addition to these three types, there are other kinds of filters, for example, effect filters,
`which add effects without changing the data type, and parser filters, which understand the
`format of the source data and know how to read the correct bytes, create times stamps, and
`perform seeks.
`
`For example, a filter graph whose purpose is to play back an MPEG·compressed video from a
`file would use the following filters.
`
`• A source filter to read the data off the disk.
`• An MPEG filter to parse the stream and split the MPEG audio and video data streams.
`• A transform filter to decompress the video data.
`• A transform filter to decompress the audio data.
`• A video renderer filter to display the video data on the screen.
`• An audio renderer filter to send the audio to the sound card.
`
`The following illustration shows such a filter graph.
`
`File or URL
`moniker
`source
`filter
`
`f->
`
`MPEG
`splitter
`filter
`
`MPEG video
`decompression
`
`filter
`
`J transform
`~ MPEG audio
`
`Ho
`
`Video
`renderer
`filter
`
`decompression f->
`filter
`
`Audio
`renderer
`filter
`
`It is possible for some filters to represent a combination of types. For example, a filter might
`be an audio renderer that also acts as a transform filter by passing through the video data. But
`typically, filters fit only one of these three types.
`
`Filter graphs stream multimedia data through filters. In the media stream, one filter passes the
`
`145
`
`
`
`DirectShow Basics
`
`Page 6 of 62
`
`media <1cwn$tream to the next filter. An up$tream filter describes the filter that passes data to
`the filter; a <1Cwn$tream filter describes the next filter in line for the data. This distinction is
`important because media flows downstream, but other information can go upstream.
`
`To make a filter graph work, filters must be connected in the proper order, and the data
`stream must be started and stopped in the proper order. The filter graph manager connects
`filters and controls the media stream. It also has the ability to search for a configuration of
`filters that will render a partieular media type and build that filter graph. Filter graphs can also
`be preconfigured, in which case the filter graph manager does not need to search for a
`configuration.
`
`When searching for a rendering configuration, the filter graph manager uses the filter mapper,
`which first reads the registry and determines the types of filters available. The filter graph
`manager then attempts to link filters that accept that data type until it reaches a rendering
`filter. A merit value iS registered with each filter and, of the filters that might be capable of
`hand ling the data, the filters with the highest merit are tried first.
`
`Controlling the media stream means starting, pausing, or stopping the media stream. It can
`also mean playing for a partieular duration or seeking to a partieular point in the stream. The
`filter graph manager allows the applieation or Activex Control to specify these actiVities, and
`then calls the appropriate methods on the filters to invoke them. It also allows filters to post
`events that the applieation can retrieve. Therefore an application can, for example, retrieve
`status about some special filter it has installed.
`
`8 41411·!11* 1 11·'"'* T op1c Contents
`
`Topic Contents
`
`Filters and Pins
`
`The two basic components used in the stream architecture are filters and pins. A filter is a COM
`object that performs a specific task, such as reading data from a disk. For each stream it
`handles, it exposes at least one pin. A pin is a COM object created by the filter, that represents
`a point of connection for a unidirectional data stream on the filter, as shown in the following
`mustration.
`
`Source
`filter
`
`Output pin
`
`Input pin
`
`Transform
`filter
`
`Output pin
`
`Input pin
`
`Renderer
`filter
`
`Input pin$ accept data into the filter, and output pin$ provide data to other filters. A source
`filter provides one output pin for each stream of data in the file. A typical transform filter, such
`as a compression/decompression (codec) filter, provides one input pin and one output pin,
`while an audio output filter typically exposes only one input pin. More complex arrangements
`are also possible.
`
`You can name pins anything you want. If your pin name begins with the tilde ( ~) character,
`
`146
`
`
`
`DirectShow Basics
`
`Page 7 of 62
`
`the filter graph will not automatically render that pin when an application calls
`!GraohBuilder: :RenderFile. This can apply to pins that are just informational and are not meant
`to be rendered, or need to be enumerated so that their properties can be set. The tilde(~)
`prefix only affects the behavior of RenderFile and intelligent connect (!GraohBuilder: :Connect).
`Note that intelligent connect can still be used to connect pins with this property if they
`implement the !Pin: :Connect method. However, output pins of intermediate filters which are
`being used to complete the connection which have the tilde at the start of their name will not
`be connected as part of the intelligent connection attempt.
`
`At a minimum, a filter exposes the !BaseFilter interface. This interface provides methods that
`allow the enumeration of the pins on the filter and return filter information. It also provides the
`inherited methods from !Media Filter; these methods allow control of state processing (for
`example running, pausing, and stopping) and synchronization, and are called primarily by the
`filter graph manager.
`
`In addition, a filter might expose several other interfaces, depending on the media types
`supported and tasks performed. For example, a filter can expose the !SoecifyProoertyPages
`interface to support a property page.
`
`Pins are responsible for providing interfaces to connect with other pins and for transporting the
`data. The pin interfaces support the following:
`
`• The transfer of time-stamped data using shared memory or other resource.
`• Negotiation of data formats at each pin-to-pin connection.
`• Buffer management and buffer allocation negotiation designed to minimize data copying
`and maximize throughput.
`
`Pin interfaces differ slightly, depending on whether they are output pins or input pins.
`
`An output pin typically exposes the following interfaces.
`
`• !Pin methods are called to allow the pin to be queried for pin, connection, and data type
`information, and to send flush notifications downstream when the filter graph stops.
`• !MediaSeeking allows information about the stream's duration, start time, and stop time
`to be relayed from the renderer. The renderer passes the media position information
`upstream to the filter (typically the source filter) responsible for queuing the stream to
`the appropriate position.
`• !QualityControl passes quality-control messages upstream from the renderer to the filter
`that is responsible for increasing or decreasing the media supply.
`
`An input pin typically exposes the following interfaces.
`
`• !Pin allows the pin to connect to an output pin and provides information about the pin
`and its internal connections.
`• !MemlnputPin allows the pin to propose its own transport memory allocator, to be
`notified of the allocator that an output pin is supplying, to receive media samples
`through the established allocator, and to flush the buffer. This interface can create a
`shared memory allocator object if the connected pin does not supply a transport memory
`allocator.
`
`The standard transport interface, !MemlnputPin, provides data transfer through shared
`memory buffers, although other transport interfaces can be used. For example, where two
`components are connected directly in hardware, they can connect to each other by using the
`
`147
`
`
`
`DirectShow Basics
`
`Page 8of62
`
`IPin interface, and then seek a private interface that can manage the transfer of data directly
`between the two components.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`w Q<M [.] +• 111.H5 Topic Contents •@M* 1gnw
`MQi§1[.]1!,M 11!.HM Topic Contents
`
`i@faii!MM
`
`Stream Control Architecture
`
`The stream architecture allows applications to communicate with the filter graph manager; it
`also allows the filter graph manager to communicate with individual filters to control the
`movement of the data through the filter graph. Using the stream architecture, filters can post
`events that the application can retrieve, so an application can, for example, retrieve status
`information about a special filter it has installed.
`
`The filter graph manager exposes media control and media positioning interfaces to the
`application. The media control interface, IMediaControl, allows the application to issue
`commands to run, pause, and stop the stream. The positioning interface, IMediaSeeking, lets
`the application specify which section of the stream to play.
`
`Individual filters expose an IBaseFilter interface so that the filter graph manager can issue the
`run, pause, and stop control commands. The filter graph manager is responsible for calling
`these methods in the correct order on all the filters in the filter graph. (The application should
`not do this directly.)
`
`For position commands, the filter graph manager is called by the application to, for example,
`play a specified length of media stream starting at some specified stream time. However,
`unlike the IBaseFilter interface, only the renderer filter exposes an IMediaSeekinq interface.
`Therefore, the filter graph manager calls only the renderer filter with positioning information.
`The renderer then passes this position control information upstream through IMediaSeeking
`interfaces exposed on the pins, which simply pass it on. The positioning of the media stream is
`actually handled by the output pin on the filter that is able to seek to a particular position,
`usually a parser filter such as the AVI splitter.
`
`Position information is passed serially upstream because there might be filters between the
`renderer and the source filter that require position information. Consider a transform filter that
`is written to perform some video or audio modification only during the first 10 seconds of a
`video clip (for example, increasing the volume or fading in the video). This filter probably
`needs to have information about where the stream is starting so that it can determine its
`correct behavior. For example, it should not perform if the start time is after the first 10
`seconds, or it should adjust accordingly if the start time is within this duration.
`
`Filters also get position information from the I Pin:: NewSeqment method which provides the
`media start and stop times for the next set of samples and the rate to be associated with those
`samples.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`148
`
`
`
`DirectShow Basics
`
`Page 9of62
`
`+Qi§1[.]i!:+ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`MQi@[.ji!:M 111.11119 Topic Contents
`
`i@l§i i!lltiM
`
`Quality-Control Management
`
`The Microsoft® DirectShow™ stream architecture provides for graceful adaptation of media
`rendering to overloaded or underloaded media streams. The IQualityControl interface is used
`to send quality-control notifications from a renderer filter either upstream, eventually to be
`acted on by some filter in the graph, or directly to a designated quality control manager. The
`base classes implement the passing of quality control notifications upstream by providing the
`IQualityControl interface on the output pins of filters. Quality control notification uses a
`Quality structure, which indicates whether the renderer is overloaded or underloaded. A filter
`capable of, say, discarding samples to relieve an overloaded condition, can then act on this
`notification. This is typically done by a source filter but could be done by other filters. For
`example, the DirectShow AVI Decoder filter skips samples until the next key frame when it
`receives a quality control notification.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQi@[.ji!:M 111.11119 Topic Contents
`
`i@l§i i!lltiM
`
`About Capture Filter Graphs
`
`This article provides a brief introduction to capture and introduces the fundamentals of filter
`graphs that provide video or audio capture or preview capabilities. It includes conceptual
`diagrams of the most common capture-related filter graphs to help you visualize the
`components in each filter graph and see how they fit together. It discusses the role of
`particular filters such as video and audio capture filters, the AVI MUX (multiplexer) filter, and
`the file writer filter. It also highlights unusual points such as filters (for audio capture in this
`case) that have input pins.
`
`See Where Can I Learn About. .. for a list of topics relating to capture, including articles that
`discuss writing code to perform capture.
`
`If you are new to DirectShow, read Filter Graph Manager and Filter Graphs and Filters and Pins
`to familiarize yourself with the architecture's fundamental concepts.
`
`Contents of this article:
`
`• Capture Introduction
`• Video and Audio Capture Filter Graphs
`
`149
`
`
`
`DirectShow Basics
`
`Page 10 of 62
`
`Capture Introduction
`
`Video and audio capture enable you to take multimedia data from an external source such as a
`VCR or camera, and view it, listen to it, or save it on your computer's hard drive. Your
`computer must include video or audio capture hardware to perform capture. For audio capture,
`a sound card with a microphone or line-in jack is usually sufficient. Some video capture cards
`support audio capture as well, so you might not need two separate cards. The DirectShow
`architecture provides default components (filters) that enable you to capture video and audio
`data streams given the appropriate capture hardware and drivers. DirectShow takes advantage
`of new capture drivers that are written as DirectShow filters and also uses existing Video for
`Windows-style drivers.
`
`Video and Audio Capture Filter Graphs
`
`Typical filter graphs that provide video and audio capture and video preview capability must
`include video capture, audio capture, multiplexer (MUX), file writer, and video renderer filters.
`If you need a subset of these features your filter graph can be simpler and contain fewer
`filters. This section begins by discussing the simpler capture filter graphs and the components
`they contain. It then discusses filter graphs that combine features and build upon the basic
`capture filter graphs to provide more functionality.
`
`This section contains the following topics:
`
`• Video Preview Filter Graphs
`• Video Capture Filter Graphs
`• Video Capture and Preview Filter Graphs Combined
`• Adding Audio Capture
`• Capture Filter Input Pins
`• Example Capture Filter Graph
`
`Video Preview Filter Graphs
`
`A video preview filter graph enables you to watch the video on your computer screen as it
`plays from your VCR, camera, or other video source. The video preview filter graph is very
`simple. It contains a video capture filter and a video renderer. The capture filter provides the
`video data from the capture card, exposing a pin called Preview to which the video renderer
`connects. The video renderer provides a playback window in which it displays the video data. If
`the capture filter produces compressed data, you must insert a decompressor filter between
`the capture filter and the renderer.
`
`Note Capture filters are not required to expose a preview pin.
`
`The portion of the graph from the preview pin downstream to and including the video renderer
`is called the preview section of the filter graph.
`
`DirectShow provides video capture and video renderer filters. If you have an existing Video for
`Windows-style capture driver, the video caoture filter wraps the functionality provided by that
`driver so that it works with the DirectShow arc