Windows Media Format SDK Overview

Source: Internet
Author: User

Windows Media Content adopts the ASF file format. Microsoft provides the Windows Media Format SDK to support the following three functions: ASF file generation (including ASF data streaming) editing of ASF files and playing of ASF files (including playing of ASF media streams ). Before starting programming, it is necessary to have a general understanding and understanding of the SDK system. (Note: Unless otherwise specified, the sdks or WMF sdks described in this book refer to Windows Media Format SDK .)

The wmf sdk adopts an object-oriented design and is an advanced development kit completely based on the COM component model. This is advanced, which means that the SDK shields the Implementation Details of bottom-layer streaming media technologies such as ASF data format and network transmission control, leaving developers with only relatively upper-layer programming interfaces.

Figure 2.1 wmf sdk System Structure

 

2.1. the SDK introduces a series of objects, such as generators, readers, and editors. These SDK objects mask the implementation details of the Windows Media Technology, making the applicationProgramDevelopers can develop very professional streaming media application systems without having to know much about the underlying technologies of streaming media.

Among the many objects introduced by the SDK, the most important is the three objects listed in figure 2.1. The generator is generally used to encode non-compressed media data into Windows Media Format. The entire coding process is very simple. You only need to configure the target data stream format through an object named profile, then tell the generator the format of the input data, and then pass the input data to the generator in sequence in the established manner, the rest can be handed over to the generator. The Builder automatically selects a Windows Media Encoder Based on the profile configuration, compresses the input data, packs the data, and finally writes the file or streams it to the network.

Figure 2.2 workflow of the generator

 

2.2 is the general workflow of the generator. As you can see, the generator may have a preprocessing process for the input data. Because the data formats acceptable to specific encoders are always limited. If the input data format cannot be accepted by the encoder, the generator automatically performs a preprocessing process. These preprocessing tasks include video image size scaling, frame rate adjustment, color space conversion, watermark superposition, and audio sampling frequency conversion. In addition, the generator itself is not responsible for the final destination of the encoded data, but instead gives the task to an object called sink, for example, a file receiver can save the data as a file, and the network receiver can broadcast the data, and the push receiver can distribute the data to the server running Windows Media Services. The SDK adopts this "generator + receiver" design, which ensures the strong scalability of the SDK system. For example, we can develop our own receiver to determine the final destination of the compressed data according to our requirements.

If you have used the Windows Media Content Encoding software Windows Media Encoder officially released by Microsoft, do not doubt that, through wmf sdk learning, you can also develop a similar encoding software.

Wmf sdk has two readers: asynchronous reader and synchronous reader. The functions of the two readers are similar. They are used to read ASF data. The difference is that they work in the following way: the asynchronous reader comes with a thread to push data streams to the application; the synchronization reader does not have a thread that drives data streams. the application directly (in the Application Thread) acquires data through the interface functions on the synchronization reader. (Note: The asynchronous reader is usually referred to as a reader, and the "Asynchronous" feature is emphasized only when compared with the synchronous reader .)

Figure 2.3 reader Workflow

 

By default, the reader outputs data in a non-compressed format. That is to say, the reader automatically selects an appropriate decoder to decompress the ASF stream data, 2.3. Of course, with proper settings, the reader can also output the original compression format of ASF stream data.

It is worth noting that asynchronous readers can be used in all versions of sdks, while synchronous readers are only available in 9 series sdks. The synchronization reader is added because the synchronous reading mode of data has advantages in some special situations, such as in some content editing applications, you can use a synchronization reader to quickly read part of data at a specified position. In addition, the synchronous reader provides data through direct interface function calls, which is easy to use. Of course, synchronization readers also have obvious shortcomings, such as the inability to read network files and the lack of DRM (Digital Rights Management. Therefore, asynchronous readers are used for reading the vast majority of ASF files.

Finally, let's briefly introduce the editor. It is an editor. Do not misunderstand that it can be used to modify media content. In fact, it can only edit some metadata. Metadata is the title, description, author, copyright, and other information of the media content.

 

 

3 wmf sdk programming and development environment configuration
wmf sdk is only applicable to C/C ++ programming languages , the development platform can be VC ++ 6.0 or Visual Studio. net. this article describes how to set vc6.0.
open VC ++ 6.0, select Tools> options in the menu command, click directories, and select include files from the show directories for drop-down menu, then, place the SDK installation path before the VC standard path.
when developing an application project, you also need to set the debug version of vc6.0 as follows: Select Settings in the menu command project to go To the tag link, and select general from the category drop-down list, set winmm. lib and wmvcore. add the Lib file to object/library modules and select ignore all default libraries.
4. Design of the Streaming Media Player
① use the VC ++ 6.0 Application Wizard to create a dialog box-based MFC program named mymediaplayer, other options are based on the default settings.
② add controls to the dialog box and adjust the layout of the dialog box.
③ select the setting command from the project menu, select the link tab, and enter winmm in object/library modules. lib, wmvcore. lib file, which is required for compiling multimedia programs using the MCI interface.
④ Add the project file wmsdk. h during programming. Wmsdk. h defines the SDK interfaces, constants, data structures, enumerated variables, and guids.
⑤ add Code to each member function of the project. The main initialization functions of the main program class are oninitdialog (), function buttons open () (open), onplay () (play), onpause () (pause), and onstop (STOP), And getheaderattribute (), retrieveattributes ()

 

 

Recommended tutorial http://blog.csdn.net/happydeer/article/details/277996

Lu Qiming's book: Windows Media programming guide

You can download the PDF version online.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.