Package com.brightcove.player.model
Class MediaFormat
- java.lang.Object
-
- com.brightcove.player.model.MediaFormat
-
- All Implemented Interfaces:
android.os.Parcelable
public final class MediaFormat extends java.lang.Object implements android.os.ParcelableAn immutableParcelableobject that can be used describe the format of media stream.This is a derivative of the media format class in ExoPlayer 1 SDK.
-
-
Field Summary
Fields Modifier and Type Field Description booleanadaptiveSpecifies whether the format represents an adaptive track, meaning that the format of the actual media data may change (e.g.intbitrateThe average bandwidth in bits per second, orConstants.NO_VALUEif unknown or not applicable.intchannelCountThe number of audio channels, orConstants.NO_VALUEif unknown or not applicable.static android.os.Parcelable.Creator<MediaFormat>CREATORlongdurationUsThe duration in microseconds, orConstants.UNKNOWN_TIME_USif the duration is unknown, orConstants.MATCH_LONGEST_USif the duration should match the duration of the longest track whose duration is known.intencoderDelayThe number of samples to trim from the start of the decoded audio stream.intencoderPaddingThe number of samples to trim from the end of the decoded audio stream.intheightThe height of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.java.util.List<byte[]>initializationDataInitialization data that must be provided to the decoder.java.lang.StringlanguageThe language of the track, or null if unknown or not applicableintmaxHeightIf the video is flaggedadaptive, this is the maximum height of the video in pixels that will be encountered in the stream.intmaxInputSizeThe maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUEif unknown or not applicable.intmaxWidthIf the video is flaggedadaptive, this is the maximum width of the video in pixels that will be encountered in the stream.java.lang.StringmimeTypeThe mime type of the format.static java.util.List<byte[]>NO_INITIALIZATION_DATAEmpty initialization data.static longOFFSET_SAMPLE_RELATIVEA value forsubSampleOffsetUsto indicate that sub-sample timestamps are relative to the timestamps of their parent samples.intpcmEncodingThe encoding for PCM audio streams.floatpixelWidthHeightRatioThe width to height ratio of pixels in the video, orConstants.NO_VALUEif unknown or not applicable.byte[]projectionDataThe projection data for 360/VR video, or null if not applicable.introtationDegreesThe clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, orConstants.NO_VALUEif unknown or not applicable.intsampleRateThe audio sampling rate in Hz, orConstants.NO_VALUEif unknown or not applicable.intstereoModeThe stereo layout for 360/3D/VR video, or NO_VALUE if not applicable.longsubSampleOffsetUsFor samples that contain sub-samples, this is an offset that should be added to sub-sample timestamps.java.lang.StringtrackIdThe identifier for the track represented by the format, or null if unknown or not applicable.intwidthThe width of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MediaFormatcopyAsAdaptive(java.lang.String trackId)MediaFormatcopyWithDurationUs(long durationUs)MediaFormatcopyWithFixedTrackInfo(java.lang.String trackId, int bitrate, int width, int height, java.lang.String language)MediaFormatcopyWithGaplessInfo(int encoderDelay, int encoderPadding)MediaFormatcopyWithLanguage(java.lang.String language)MediaFormatcopyWithMaxInputSize(int maxInputSize)MediaFormatcopyWithMaxVideoDimensions(int maxWidth, int maxHeight)MediaFormatcopyWithSubSampleOffsetUs(long subSampleOffsetUs)static MediaFormatcreateAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language)static MediaFormatcreateAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language, int pcmEncoding)static MediaFormatcreateFormatForMimeType(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs)static MediaFormatcreateId3Format()static MediaFormatcreateImageFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.util.List<byte[]> initializationData, java.lang.String language)static MediaFormatcreateTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language)static MediaFormatcreateTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language, long subSampleOffsetUs)static MediaFormatcreateVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData)static MediaFormatcreateVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio)static MediaFormatcreateVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode)intdescribeContents()booleanequals(java.lang.Object obj)android.media.MediaFormatgetFrameworkMediaFormatV16()inthashCode()java.lang.StringtoString()voidwriteToParcel(android.os.Parcel dest, int flags)
-
-
-
Field Detail
-
OFFSET_SAMPLE_RELATIVE
public static final long OFFSET_SAMPLE_RELATIVE
A value forsubSampleOffsetUsto indicate that sub-sample timestamps are relative to the timestamps of their parent samples.- See Also:
- Constant Field Values
-
NO_INITIALIZATION_DATA
public static final java.util.List<byte[]> NO_INITIALIZATION_DATA
Empty initialization data.
-
trackId
@Nullable public final java.lang.String trackId
The identifier for the track represented by the format, or null if unknown or not applicable.
-
mimeType
@NonNull public final java.lang.String mimeType
The mime type of the format.
-
bitrate
public final int bitrate
The average bandwidth in bits per second, orConstants.NO_VALUEif unknown or not applicable.
-
maxInputSize
public final int maxInputSize
The maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUEif unknown or not applicable.
-
durationUs
public final long durationUs
The duration in microseconds, orConstants.UNKNOWN_TIME_USif the duration is unknown, orConstants.MATCH_LONGEST_USif the duration should match the duration of the longest track whose duration is known.
-
initializationData
@NonNull public final java.util.List<byte[]> initializationData
Initialization data that must be provided to the decoder. Set toNO_INITIALIZATION_DATAif there is initialization data.
-
adaptive
public final boolean adaptive
Specifies whether the format represents an adaptive track, meaning that the format of the actual media data may change (e.g. to adapt to network conditions).
-
width
public final int width
The width of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.
-
height
public final int height
The height of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.
-
maxWidth
public final int maxWidth
If the video is flaggedadaptive, this is the maximum width of the video in pixels that will be encountered in the stream. Set toConstants.NO_VALUEif unknown or not applicable.
-
maxHeight
public final int maxHeight
If the video is flaggedadaptive, this is the maximum height of the video in pixels that will be encountered in the stream. Set toConstants.NO_VALUEif unknown or not applicable.
-
pixelWidthHeightRatio
public final float pixelWidthHeightRatio
The width to height ratio of pixels in the video, orConstants.NO_VALUEif unknown or not applicable.
-
stereoMode
public final int stereoMode
The stereo layout for 360/3D/VR video, or NO_VALUE if not applicable.
-
rotationDegrees
public final int rotationDegrees
The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, orConstants.NO_VALUEif unknown or not applicable.
-
projectionData
@Nullable public final byte[] projectionData
The projection data for 360/VR video, or null if not applicable.
-
channelCount
public final int channelCount
The number of audio channels, orConstants.NO_VALUEif unknown or not applicable.
-
sampleRate
public final int sampleRate
The audio sampling rate in Hz, orConstants.NO_VALUEif unknown or not applicable.
-
pcmEncoding
public final int pcmEncoding
The encoding for PCM audio streams.
-
encoderDelay
public final int encoderDelay
The number of samples to trim from the start of the decoded audio stream.
-
encoderPadding
public final int encoderPadding
The number of samples to trim from the end of the decoded audio stream.
-
language
@Nullable public final java.lang.String language
The language of the track, or null if unknown or not applicable
-
subSampleOffsetUs
public final long subSampleOffsetUs
For samples that contain sub-samples, this is an offset that should be added to sub-sample timestamps.
-
CREATOR
public static final android.os.Parcelable.Creator<MediaFormat> CREATOR
-
-
Method Detail
-
createVideoFormat
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData)
-
createVideoFormat
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio)
-
createVideoFormat
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode)
-
createAudioFormat
public static MediaFormat createAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language)
-
createAudioFormat
public static MediaFormat createAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language, int pcmEncoding)
-
createTextFormat
public static MediaFormat createTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language)
-
createTextFormat
public static MediaFormat createTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language, long subSampleOffsetUs)
-
createImageFormat
public static MediaFormat createImageFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.util.List<byte[]> initializationData, java.lang.String language)
-
createFormatForMimeType
public static MediaFormat createFormatForMimeType(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs)
-
createId3Format
public static MediaFormat createId3Format()
-
copyWithMaxInputSize
public MediaFormat copyWithMaxInputSize(int maxInputSize)
-
copyWithMaxVideoDimensions
public MediaFormat copyWithMaxVideoDimensions(int maxWidth, int maxHeight)
-
copyWithSubSampleOffsetUs
public MediaFormat copyWithSubSampleOffsetUs(long subSampleOffsetUs)
-
copyWithDurationUs
public MediaFormat copyWithDurationUs(long durationUs)
-
copyWithLanguage
public MediaFormat copyWithLanguage(java.lang.String language)
-
copyWithFixedTrackInfo
public MediaFormat copyWithFixedTrackInfo(java.lang.String trackId, int bitrate, int width, int height, java.lang.String language)
-
copyAsAdaptive
public MediaFormat copyAsAdaptive(java.lang.String trackId)
-
copyWithGaplessInfo
public MediaFormat copyWithGaplessInfo(int encoderDelay, int encoderPadding)
-
getFrameworkMediaFormatV16
public final android.media.MediaFormat getFrameworkMediaFormatV16()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags)- Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-
-