1– Introduction To Direct Show

1,084 views

Published on

Introduction to DirectShow programming 1st of nine lectures

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,084
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

1– Introduction To Direct Show

  1. 1. (1) Introduction to DirectShow Microsoft’s Multimedia Streaming Architecture
  2. 2. Intel - Motivation & Goals <ul><li>DirectShow is the most common architecture for: </li></ul><ul><li>STB and IP-STB media streaming and broadcast reception </li></ul><ul><li>PC Streaming </li></ul><ul><li>Goals </li></ul><ul><li>Understand STB architecture, its advantages and disadvantages </li></ul><ul><li>Fast prototyping and application building for testing and demonstrations </li></ul>
  3. 3. What is DirectX <ul><li>DirectX is Microsoft's component based architecture for media processing. </li></ul><ul><li>Similar streaming architecture were designed by: </li></ul><ul><ul><li>Real </li></ul></ul><ul><ul><li>Emblaze (RapidMedia) </li></ul></ul><ul><ul><li>Linux (GStreaming) </li></ul></ul><ul><li>Media processing </li></ul><ul><ul><li>Audio </li></ul></ul><ul><ul><li>Video </li></ul></ul><ul><ul><li>Transport streams </li></ul></ul><ul><ul><li>text. </li></ul></ul>
  4. 4. DirectX – Why we need it? <ul><li>Software reusability </li></ul><ul><ul><li>Code blocks can be reused and inherited </li></ul></ul><ul><ul><li>Common Interfaces </li></ul></ul><ul><li>Easy connection between 3 rd party modules </li></ul><ul><li>Which components? </li></ul><ul><ul><li>Compression </li></ul></ul><ul><ul><li>color conversion </li></ul></ul><ul><ul><li>audio effects </li></ul></ul><ul><ul><li>Transport stream handlers </li></ul></ul>
  5. 5. A bit of History DirectX Evolution from proprietary Codec to Filter base architecture
  6. 6. VFW <ul><li>VFW architecture – a Plug-In architecture that supported CODEC and CAPTURE Interfaces for Audio & Video stream manipulation. </li></ul><ul><li>Advantages – All the CODECs have the same interfaces. There is no need specific modifications for each codec </li></ul>Capture CODEC Control Interfaces IO Interfaces
  7. 7. VFW Problems <ul><li>Rigid architecture </li></ul><ul><li>Only three types of filters </li></ul><ul><li>How to add costume filters that split or mux transport stream? </li></ul><ul><li>Rigid interfaces creates a problem to the future progress of the architecture </li></ul>
  8. 8. Active Movie <ul><li>A Filter base architecture that support customize filters </li></ul><ul><li>The architecture is built using: </li></ul><ul><ul><li>Filters that manipulates the stream </li></ul></ul><ul><ul><li>Pins that handle filter connection </li></ul></ul><ul><ul><li>graph management which </li></ul></ul><ul><ul><ul><li>Connect the filters (automatically) </li></ul></ul></ul><ul><ul><ul><li>Manage filters states (run, pause, stop) </li></ul></ul></ul><ul><ul><ul><li>Transfer messages between filters </li></ul></ul></ul>
  9. 9. DirectX <ul><li>Evolution of Active Movie (Audio & Video) to other aspects: </li></ul><ul><ul><li>DirectShow – (previously ActiveMovie) Audio/Video/Text. </li></ul></ul><ul><ul><li>DirectDraw/Direct3D – Graphics. </li></ul></ul><ul><ul><li>DirectSound – Sound effects and 3D sound. </li></ul></ul><ul><ul><li>DirectPlay/DirectInput – Multiplayer Game tools. </li></ul></ul><ul><ul><li>DirectMusic – Automatic music generation </li></ul></ul>
  10. 10. Introduction to Directshow Hands-on DirectShow : GraphEdit
  11. 11. GraphEdit <ul><li>Visual Interface for graph building and testing. </li></ul>
  12. 12. GraphEdt – Rendering a file <ul><li>Render a media file </li></ul><ul><li>The graph build is what the OS does when you double-click on a file. </li></ul><ul><li>File rendering options: </li></ul><ul><ul><li>Drag a media file to graph edit </li></ul></ul><ul><ul><li>Use File->Open File </li></ul></ul><ul><ul><li>Use: </li></ul></ul><ul><ul><ul><li>graph->Insert filters use the circled button as a short cut </li></ul></ul></ul><ul><ul><ul><li>Select File Source Async. </li></ul></ul></ul><ul><ul><ul><li>Right click on output pin and select render </li></ul></ul></ul>
  13. 13. GraphEdt - Play with it <ul><li>Use the: Play, Pause, and Stop commands </li></ul><ul><ul><li>Notice the file progress bar </li></ul></ul><ul><li>Use the slider to change the current play position </li></ul>
  14. 14. GraphEdit – A bit more <ul><li>Try looking at filter properties: </li></ul><ul><li>Use right-click on the filter and select “Filter Properties” </li></ul><ul><li>We will later look at the Interface that enables the communication to property pages. </li></ul><ul><li>Example of Source file property </li></ul><ul><li>This property is used only for monitoring and not for controls. Why? </li></ul>
  15. 15. The “Metargemet” video <ul><li>Lets view it using Graphedt Media Metargemet.wmv </li></ul><ul><li>This video is a nice example for information processing architecture </li></ul><ul><li>The information is: </li></ul><ul><ul><li>Generated at the source (Keren) </li></ul></ul><ul><ul><li>Processed and translated by a “transform unit” (Riki – translator) </li></ul></ul><ul><ul><li>Rendered to the students </li></ul></ul><ul><ul><li>Feedback messages are passed from the Renderer to the source via the translator </li></ul></ul>Keren Mor Info. Source Riki Blich “ Transform” Student “ Renderer &quot;
  16. 16. DirectShow Basic ideas <ul><li>Information processing is a sequential process </li></ul><ul><li>Each processing unit has a clear function </li></ul><ul><li>The Source “Push” or pump information to processing units (Blue). Data information is always Unidirectional: “ Downstream ” </li></ul><ul><li>Feedback is sent from the Renderer(s) to the source (Orange) – “ Upstream ” </li></ul><ul><li>No Information loops </li></ul>Keren Mor Source Riki Blich “ Transform” Student “ Renderer &quot;
  17. 17. Information passing architecture <ul><li>There are basically two methods: </li></ul><ul><ul><li>Push </li></ul></ul><ul><ul><li>Pull </li></ul></ul><ul><li>Those architecture differ in </li></ul><ul><ul><li>threading, </li></ul></ul><ul><ul><li>Which filter is the active filter </li></ul></ul><ul><ul><li>Where is the “Brain” of the graph </li></ul></ul>
  18. 18. Push Architecture <ul><li>Source is active </li></ul><ul><li>Source generate Media Samples </li></ul><ul><li>information is pushed by the source </li></ul><ul><li>Like in the case of the “Metargemet” </li></ul><ul><li>Source is active, owns the “processing thread” </li></ul><ul><li>Used in </li></ul><ul><ul><li>ASF/WMA/WMV files </li></ul></ul><ul><ul><li>Video capture (USB cam, video cards) </li></ul></ul><ul><ul><li>BDA capture </li></ul></ul>
  19. 19. Pull Architecture <ul><li>Information is pulled by a non-source filter </li></ul><ul><li>Source is passive </li></ul><ul><li>Does not own the “processing thread” </li></ul><ul><li>In most file processing schemes (AVI, MPEG2) the source is “dumb” and passive and the parser (demuxer) holds the “knowledge” of file parsing. </li></ul>
  20. 20. Components required <ul><li>Data Processing unit– used for: </li></ul><ul><ul><li>Media data Generation </li></ul></ul><ul><ul><li>Media data manipulation/transform </li></ul></ul><ul><ul><li>Media data rendering </li></ul></ul><ul><li>Interfaces – Generic Interfaces between data processing units </li></ul><ul><ul><li>In “Metargemet” we use “Air Interface” with two basic media descriptors </li></ul></ul><ul><li>Media descriptors </li></ul><ul><ul><li>In “Metargemet” we use two media types: </li></ul></ul><ul><ul><ul><li>Archaic speech media between Source and Transform </li></ul></ul></ul><ul><ul><ul><li>“ Sleng” between Transform (Riki) and Renderer (Student) </li></ul></ul></ul><ul><li>Management unit (in “Metargem” – class/school) </li></ul>
  21. 21. Naming <ul><li>Data processing unit = Filter </li></ul><ul><ul><li>Used for data manipulation and transform. </li></ul></ul><ul><li>Filter Interface = Pin </li></ul><ul><ul><li>Used to define the connection between filters </li></ul></ul><ul><ul><li>Include information about: </li></ul></ul><ul><ul><ul><li>Direction </li></ul></ul></ul><ul><ul><ul><li>Memory required </li></ul></ul></ul><ul><ul><ul><li>Media Type </li></ul></ul></ul>
  22. 22. Naming - 2 <ul><li>Media Descriptor = Media Type </li></ul><ul><ul><li>Include information about the media passed </li></ul></ul><ul><li>Data Unit = Media Sample </li></ul><ul><ul><li>Include the data itself </li></ul></ul><ul><ul><li>Include information about the data </li></ul></ul>
  23. 23. Filters <ul><li>ActiveX objects </li></ul><ul><ul><li>(Use COM Interfaces) </li></ul></ul><ul><li>Manipulates data </li></ul><ul><li>Have Pin as members for interfacing other filters </li></ul><ul><li>Three basic types: Source, Render, Transform </li></ul><ul><li>Identification: GUID </li></ul><ul><li>Control – property pages </li></ul>
  24. 24. Pin <ul><li>Filters have one or more IO Interfaces - pins </li></ul><ul><li>Pin is a class which basically holds interfaces to which connect processing modules (filters) </li></ul><ul><li>Pins could be exposed or hidden </li></ul><ul><ul><li>Look at Infinite Pin tee filter </li></ul></ul><ul><ul><li>Dynamic creation of pins for many types of filters: </li></ul></ul><ul><ul><ul><li>Infinite Pin T </li></ul></ul></ul><ul><ul><ul><li>MPEG and AVI Splitters </li></ul></ul></ul><ul><li>Two basic type: </li></ul><ul><ul><li>Input </li></ul></ul><ul><ul><li>Output </li></ul></ul>
  25. 25. Graph Builder <ul><li>Create a streaming process for example: </li></ul><ul><ul><li>Read from file </li></ul></ul><ul><ul><li>Demux </li></ul></ul><ul><ul><li>Decode </li></ul></ul><ul><ul><li>Encode </li></ul></ul><ul><ul><li>Stream to network </li></ul></ul><ul><li>Tasks: </li></ul><ul><ul><li>Loads the filters </li></ul></ul><ul><ul><li>connect Filters </li></ul></ul><ul><ul><li>Change filter states </li></ul></ul><ul><ul><li>Disconnect filters </li></ul></ul><ul><ul><li>Remove filters from graph. </li></ul></ul><ul><li>The graph is always unidirectional (No loops) </li></ul><ul><li>Have three basic states: Play, Pause, Stop. </li></ul>
  26. 26. DMOs <ul><li>DirectX® Media Objects ( DMOs ) </li></ul><ul><li>Create stream processing object that could operate without a graph (Filters could only work as part of a graph) </li></ul><ul><li>DMOs could operate inside a graph using a “DMO Wrapper” which acts as a filter </li></ul><ul><li>Advantage </li></ul><ul><ul><li>Simpler interface </li></ul></ul><ul><ul><li>No need to create a graph </li></ul></ul>

×