IT. Expert System.

Android Reference

MediaFormat


android.media

Class MediaFormat



  • public final class MediaFormat
    extends Object
    Encapsulates the information describing the format of media data, be it audio or video. The format of the media data is specified as string/value pairs. Keys common to all formats:
    NameValue TypeDescription
    KEY_MIMEStringThe type of the format.
    KEY_MAX_INPUT_SIZEIntegeroptional, maximum size of a buffer of input data
    KEY_BIT_RATEIntegerencoder-only, desired bitrate in bits/second
    Video formats have the following keys:
    NameValue TypeDescription
    KEY_WIDTHInteger
    KEY_HEIGHTInteger
    KEY_COLOR_FORMATIntegerencoder-only
    KEY_FRAME_RATEInteger or Floatencoder-only
    KEY_I_FRAME_INTERVALIntegerencoder-only
    Audio formats have the following keys:
    NameValue TypeDescription
    KEY_CHANNEL_COUNTInteger
    KEY_SAMPLE_RATEInteger
    KEY_IS_ADTSIntegeroptional, if content is AAC audio, setting this key to 1 indicates that each audio frame is prefixed by the ADTS header.
    KEY_AAC_PROFILEIntegerencoder-only, optional, if content is AAC audio, specifies the desired profile.
    KEY_CHANNEL_MASKIntegerA mask of audio channel assignments
    KEY_FLAC_COMPRESSION_LEVELIntegerencoder-only, optional, if content is FLAC audio, specifies the desired compression level.
    • Field Detail

      • KEY_MIME

        public static final String KEY_MIME
        A key describing the mime type of the MediaFormat. The associated value is a string.
        See Also:
        Constant Field Values
      • KEY_SAMPLE_RATE

        public static final String KEY_SAMPLE_RATE
        A key describing the sample rate of an audio format. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_CHANNEL_COUNT

        public static final String KEY_CHANNEL_COUNT
        A key describing the number of channels in an audio format. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_WIDTH

        public static final String KEY_WIDTH
        A key describing the width of the content in a video format. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_HEIGHT

        public static final String KEY_HEIGHT
        A key describing the height of the content in a video format. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_MAX_INPUT_SIZE

        public static final String KEY_MAX_INPUT_SIZE
        A key describing the maximum size in bytes of a buffer of data described by this MediaFormat. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_BIT_RATE

        public static final String KEY_BIT_RATE
        A key describing the bitrate in bits/sec. The associated value is an integer
        See Also:
        Constant Field Values
      • KEY_FRAME_RATE

        public static final String KEY_FRAME_RATE
        A key describing the frame rate of a video format in frames/sec. The associated value is an integer or a float.
        See Also:
        Constant Field Values
      • KEY_I_FRAME_INTERVAL

        public static final String KEY_I_FRAME_INTERVAL
        A key describing the frequency of I frames expressed in secs between I frames. The associated value is an integer.
        See Also:
        Constant Field Values
      • KEY_DURATION

        public static final String KEY_DURATION
        A key describing the duration (in microseconds) of the content. The associated value is a long.
        See Also:
        Constant Field Values
      • KEY_IS_ADTS

        public static final String KEY_IS_ADTS
        A key mapping to a value of 1 if the content is AAC audio and audio frames are prefixed with an ADTS header. The associated value is an integer (0 or 1).
        See Also:
        Constant Field Values
      • KEY_CHANNEL_MASK

        public static final String KEY_CHANNEL_MASK
        A key describing the channel composition of audio content. This mask is composed of bits drawn from channel mask definitions in AudioFormat. The associated value is an integer.
        See Also:
        Constant Field Values
      • KEY_FLAC_COMPRESSION_LEVEL

        public static final String KEY_FLAC_COMPRESSION_LEVEL
        A key describing the FLAC compression level to be used (FLAC audio format only). The associated value is an integer ranging from 0 (fastest, least compression) to 8 (slowest, most compression).
        See Also:
        Constant Field Values
    • Constructor Detail

      • MediaFormat

        public MediaFormat()
        Creates an empty MediaFormat
    • Method Detail

      • containsKey

        public final boolean containsKey(String name)
        Returns true iff a key of the given name exists in the format.
      • getInteger

        public final int getInteger(String name)
        Returns the value of an integer key.
      • getLong

        public final long getLong(String name)
        Returns the value of a long key.
      • getFloat

        public final float getFloat(String name)
        Returns the value of a float key.
      • getString

        public final String getString(String name)
        Returns the value of a string key.
      • getByteBuffer

        public final ByteBuffer getByteBuffer(String name)
        Returns the value of a ByteBuffer key.
      • setInteger

        public final void setInteger(String name,
                      int value)
        Sets the value of an integer key.
      • setLong

        public final void setLong(String name,
                   long value)
        Sets the value of a long key.
      • setFloat

        public final void setFloat(String name,
                    float value)
        Sets the value of a float key.
      • setString

        public final void setString(String name,
                     String value)
        Sets the value of a string key.
      • setByteBuffer

        public final void setByteBuffer(String name,
                         ByteBuffer bytes)
        Sets the value of a ByteBuffer key.
      • createAudioFormat

        public static final MediaFormat createAudioFormat(String mime,
                                    int sampleRate,
                                    int channelCount)
        Creates a minimal audio format.
        Parameters:
        mime - The mime type of the content.
        sampleRate - The sampling rate of the content.
        channelCount - The number of audio channels in the content.
      • createVideoFormat

        public static final MediaFormat createVideoFormat(String mime,
                                    int width,
                                    int height)
        Creates a minimal video format.
        Parameters:
        mime - The mime type of the content.
        width - The width of the content (in pixels)
        height - The height of the content (in pixels)
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class Object
        Returns:
        a printable representation of this object.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1703 / 96487502. Delta: 0.03860 с