Package com.brightcove.player.model
Class MediaFormat
java.lang.Object
com.brightcove.player.model.MediaFormat
- All Implemented Interfaces:
android.os.Parcelable
An immutable
Parcelable object that can be used describe the format of media stream.
This is a derivative of the media format class in ExoPlayer 1 SDK.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanSpecifies whether the format represents an adaptive track, meaning that the format of the actual media data may change (e.g.final intThe average bandwidth in bits per second, orConstants.NO_VALUEif unknown or not applicable.final intThe number of audio channels, orConstants.NO_VALUEif unknown or not applicable.static final android.os.Parcelable.Creator<MediaFormat>final longThe 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.final intThe number of samples to trim from the start of the decoded audio stream.final intThe number of samples to trim from the end of the decoded audio stream.final intThe height of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.final List<byte[]>Initialization data that must be provided to the decoder.final StringThe language of the track, or null if unknown or not applicablefinal intIf the video is flaggedadaptive, this is the maximum height of the video in pixels that will be encountered in the stream.final intThe maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUEif unknown or not applicable.final intIf the video is flaggedadaptive, this is the maximum width of the video in pixels that will be encountered in the stream.final StringThe mime type of the format.static final List<byte[]>Empty initialization data.static final longA value forsubSampleOffsetUsto indicate that sub-sample timestamps are relative to the timestamps of their parent samples.final intThe encoding for PCM audio streams.final floatThe width to height ratio of pixels in the video, orConstants.NO_VALUEif unknown or not applicable.final byte[]The projection data for 360/VR video, or null if not applicable.final intThe 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.final intThe audio sampling rate in Hz, orConstants.NO_VALUEif unknown or not applicable.final intThe stereo layout for 360/3D/VR video, or NO_VALUE if not applicable.final longFor samples that contain sub-samples, this is an offset that should be added to sub-sample timestamps.final StringThe identifier for the track represented by the format, or null if unknown or not applicable.final intThe width of the video in pixels, orConstants.NO_VALUEif unknown or not applicable.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Method Summary
Modifier and TypeMethodDescriptioncopyAsAdaptive(String trackId) copyWithDurationUs(long durationUs) copyWithFixedTrackInfo(String trackId, int bitrate, int width, int height, String language) copyWithGaplessInfo(int encoderDelay, int encoderPadding) copyWithLanguage(String language) copyWithMaxInputSize(int maxInputSize) copyWithMaxVideoDimensions(int maxWidth, int maxHeight) copyWithSubSampleOffsetUs(long subSampleOffsetUs) static MediaFormatcreateAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language) static MediaFormatcreateAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language, int pcmEncoding) static MediaFormatcreateFormatForMimeType(String trackId, String mimeType, int bitrate, long durationUs) static MediaFormatstatic MediaFormatcreateImageFormat(String trackId, String mimeType, int bitrate, long durationUs, List<byte[]> initializationData, String language) static MediaFormatcreateTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language) static MediaFormatcreateTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language, long subSampleOffsetUs) static MediaFormatcreateVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData) static MediaFormatcreateVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio) static MediaFormatcreateVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode) intbooleanfinal android.media.MediaFormatinthashCode()toString()voidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
OFFSET_SAMPLE_RELATIVE
public static final long OFFSET_SAMPLE_RELATIVEA value forsubSampleOffsetUsto indicate that sub-sample timestamps are relative to the timestamps of their parent samples.- See Also:
-
NO_INITIALIZATION_DATA
Empty initialization data. -
trackId
The identifier for the track represented by the format, or null if unknown or not applicable. -
mimeType
The mime type of the format. -
bitrate
public final int bitrateThe average bandwidth in bits per second, orConstants.NO_VALUEif unknown or not applicable. -
maxInputSize
public final int maxInputSizeThe maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUEif unknown or not applicable. -
durationUs
public final long durationUsThe 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
Initialization data that must be provided to the decoder. Set toNO_INITIALIZATION_DATAif there is initialization data. -
adaptive
public final boolean adaptiveSpecifies 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 widthThe width of the video in pixels, orConstants.NO_VALUEif unknown or not applicable. -
height
public final int heightThe height of the video in pixels, orConstants.NO_VALUEif unknown or not applicable. -
maxWidth
public final int maxWidthIf 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 maxHeightIf 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 pixelWidthHeightRatioThe width to height ratio of pixels in the video, orConstants.NO_VALUEif unknown or not applicable. -
stereoMode
public final int stereoModeThe stereo layout for 360/3D/VR video, or NO_VALUE if not applicable. -
rotationDegrees
public final int rotationDegreesThe 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[] projectionDataThe projection data for 360/VR video, or null if not applicable. -
channelCount
public final int channelCountThe number of audio channels, orConstants.NO_VALUEif unknown or not applicable. -
sampleRate
public final int sampleRateThe audio sampling rate in Hz, orConstants.NO_VALUEif unknown or not applicable. -
pcmEncoding
public final int pcmEncodingThe encoding for PCM audio streams. -
encoderDelay
public final int encoderDelayThe number of samples to trim from the start of the decoded audio stream. -
encoderPadding
public final int encoderPaddingThe number of samples to trim from the end of the decoded audio stream. -
language
The language of the track, or null if unknown or not applicable -
subSampleOffsetUs
public final long subSampleOffsetUsFor samples that contain sub-samples, this is an offset that should be added to sub-sample timestamps. -
CREATOR
-
-
Method Details
-
createVideoFormat
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData) -
createVideoFormat
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio) -
createVideoFormat
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode) -
createAudioFormat
public static MediaFormat createAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language) -
createAudioFormat
public static MediaFormat createAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language, int pcmEncoding) -
createTextFormat
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language) -
createTextFormat
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language, long subSampleOffsetUs) -
createImageFormat
public static MediaFormat createImageFormat(String trackId, String mimeType, int bitrate, long durationUs, List<byte[]> initializationData, String language) -
createFormatForMimeType
public static MediaFormat createFormatForMimeType(String trackId, String mimeType, int bitrate, long durationUs) -
createId3Format
-
copyWithMaxInputSize
-
copyWithMaxVideoDimensions
-
copyWithSubSampleOffsetUs
-
copyWithDurationUs
-
copyWithLanguage
-
copyWithFixedTrackInfo
public MediaFormat copyWithFixedTrackInfo(String trackId, int bitrate, int width, int height, String language) -
copyAsAdaptive
-
copyWithGaplessInfo
-
getFrameworkMediaFormatV16
public final android.media.MediaFormat getFrameworkMediaFormatV16() -
toString
-
hashCode
public int hashCode() -
equals
-
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
-