Use Multimedia Streams in programs

Source: Internet
Author: User

Translated from msdn-Using Multimedia Streams in applications

Multimedia stream interfaces no longer rely on hardware or software sources with certain features. This greatly simplifies the process of processing multimedia data and provides support for all Microsoft DirectX Media formats. A stream abstracts the data to a very high level. An application can move the data of a stream to another stream without understanding anything about the data format.

To create a multimedia stream, follow these steps:

Create a multimedia stream. The method of creation and Initialization is determined by the architecture. DirectShow supports the iammultimediastream interface, which can be used to initialize a stream. Other imultimediastreams implemented by In-process servers use different mechanisms to create and initialize them.
After the multimedia stream object is initialized, the application uses QueryInterface to obtain the object's imultimediastream interface. Use this interface to determine the attributes of a stream and enumerate its own streams. You can also use a specific purpose ID (purpose ID) to call the imultimediastream: getmediastream method to obtain a specific stream. Mspid_primaryvideo and mspid_primaryaudio are the most common usage IDs.
Call iunknown: QueryInterface to obtain the interface of a specific streaming media type. For example, if you want to render a video stream, you can obtain its idirectdrawmediastream interface. For specific media interfaces, more methods must be defined to enable more effective use of a format function.
Create one or more samples from the stream data. Each media stream supports the imediastream: createsharedsample method to create a sample. The obtained sampling supports the istreamsample interface, which provides control over sampling and sampling features. Generally, a media stream supports the creation of sampling methods in a specific format. These methods are more powerful than the istreamsample method. For example, idirectdrawmediastream can create samples appended to the required DirectDraw surface and some rectangles (clipping rectangle. However, in some cases, you must process data in an unknown data format. If you want to process stream data that is not related to the format, use the imediastream: createsharedsample method to create a data sample.
After creating all the stream samples, call imultimediastream: setstate (using the streamstate_run flag as a parameter) to start the stream.
Call istreamsample: Update to update stream sampling. When the istreamsample: update method exits, you can access the sampled data. If you want to trigger a specific event or function when an update is returned, you can pass an appropriate pointer to the istreamsample: update method.

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.