Android Media codec (GO)

Source: Internet
Author: User
Tags noise suppressor

Media codecs

The Mediacodec class is used to provide access to media codecs that encode and decode low-level media. You can instantiate a Mediacodec class by calling the Createencoderbytype () method to encode the media file or call Createdecoderbytype () to decode the media file. Each method takes a MIME type as the type of media file you want to encode or decode, such as "VIDEO/3GPP" or "Audio/vorbis".

After the Mediacodec instance is created, you can call the Configure () method to specify properties such as media format or whether to encrypt the content.

Whether you encode your media files or decode them, the rest of the process is the same after you create the Mediacodec instance. First, an array of input Bytebuffer objects is obtained by means of the Getinputbuffers () method and the Getoutputbuffers () method is used to obtain an array of output Bytebuffer objects.

You can combine Mediacrypto APIs, rather than the normal Queueinputbuffer () method, by calling the Queuesecureinputbuffer () method to handle the encrypted data of the media media codec.

For more information on how to use codecs, refer to the MEDIACODEC documentation.

Custom Recording

The new Method startrecording () allows you to start recording on the basis of the Mediasyncevent definition prompt. This mediasyncevent specifies an audio conversation (such as a dialog defined by MediaPlayer) that automatically touches the recorder when it is finished to start recording. For example, you can use this function to play a beep to indicate the beginning of a recording session, and then the recording will start automatically, so you don't have to manually sync the beep and the recording to start the operation.

Timed text Tracks

mediaplayer This class can now handle text tracks in-band and out-of-band. The In-band text track is a text track of a MP4 or 3GPP media source. With a foreign language this track can be added as an external text using the Addtimedtextsource () method. After all the external text tracks have been added, call the Gettrackinfo () method to refresh the list of all available tracks in the data source.

When you know that the text track is ready to start, implement Mediaplayer.ontimedtextlistener this interface and upload it to the Setontimedtextlistener () method.

Audio effects

Audioeffect This class now supports additional audio preprocessing types when capturing to audio:

As an acoustic echo Canceller (AEC), the Acousticechocanceler class eliminates the effects of signals from remote capture to audio signals.

As an automatic gain control (AGC) Automaticgaincontrol, this class automatically recovers the normally captured signal output.

As a noise suppressor (NS), the Noisesuppressor class can eliminate background noise from captured signals.

You can apply the audio capture preprocessing effect on the Audiorecord class that leverages the Audioeffect one subclass.

Note: There is no guarantee that all devices will support these effects, so you should first call the IsAvailable () method on the corresponding audio effect class to detect its availability.

Seamless Playback

Now you can perform a seamless playback on two completely separate MediaPlayer classes. Call Setnextmediaplayer () This method at any time before the end of your first MediaPlayer class execution, and then the Android system will play the second file immediately after you first stop.

media router. This new APIs mediarouter,mediarouteactionprovider and Mediaroutebutton provide you with a standard mechanism and interface for playing files where you choose

-------------------------------------------------------------------------

http://blog.csdn.net/dahuaishu2010_/article/details/14103289

Android Media codec (GO)

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.