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
Modifier and TypeFieldDescriptionfinal boolean
Specifies whether the format represents an adaptive track, meaning that the format of the actual media data may change (e.g.final int
The average bandwidth in bits per second, orConstants.NO_VALUE
if unknown or not applicable.final int
The number of audio channels, orConstants.NO_VALUE
if unknown or not applicable.static final android.os.Parcelable.Creator<MediaFormat>
final long
The duration in microseconds, orConstants.UNKNOWN_TIME_US
if the duration is unknown, orConstants.MATCH_LONGEST_US
if the duration should match the duration of the longest track whose duration is known.final int
The number of samples to trim from the start of the decoded audio stream.final int
The number of samples to trim from the end of the decoded audio stream.final int
The height of the video in pixels, orConstants.NO_VALUE
if unknown or not applicable.final List<byte[]>
Initialization data that must be provided to the decoder.final String
The language of the track, or null if unknown or not applicablefinal int
If the video is flaggedadaptive
, this is the maximum height of the video in pixels that will be encountered in the stream.final int
The maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUE
if unknown or not applicable.final int
If the video is flaggedadaptive
, this is the maximum width of the video in pixels that will be encountered in the stream.final String
The mime type of the format.static final List<byte[]>
Empty initialization data.static final long
A value forsubSampleOffsetUs
to indicate that sub-sample timestamps are relative to the timestamps of their parent samples.final int
The encoding for PCM audio streams.final float
The width to height ratio of pixels in the video, orConstants.NO_VALUE
if unknown or not applicable.final byte[]
The projection data for 360/VR video, or null if not applicable.final int
The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, orConstants.NO_VALUE
if unknown or not applicable.final int
The audio sampling rate in Hz, orConstants.NO_VALUE
if unknown or not applicable.final int
The stereo layout for 360/3D/VR video, or NO_VALUE if not applicable.final long
For samples that contain sub-samples, this is an offset that should be added to sub-sample timestamps.final String
The identifier for the track represented by the format, or null if unknown or not applicable.final int
The width of the video in pixels, orConstants.NO_VALUE
if 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 MediaFormat
createAudioFormat
(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language) static MediaFormat
createAudioFormat
(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language, int pcmEncoding) static MediaFormat
createFormatForMimeType
(String trackId, String mimeType, int bitrate, long durationUs) static MediaFormat
static MediaFormat
createImageFormat
(String trackId, String mimeType, int bitrate, long durationUs, List<byte[]> initializationData, String language) static MediaFormat
createTextFormat
(String trackId, String mimeType, int bitrate, long durationUs, String language) static MediaFormat
createTextFormat
(String trackId, String mimeType, int bitrate, long durationUs, String language, long subSampleOffsetUs) static MediaFormat
createVideoFormat
(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData) static MediaFormat
createVideoFormat
(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio) 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) int
boolean
final android.media.MediaFormat
int
hashCode()
toString()
void
writeToParcel
(android.os.Parcel dest, int flags)
-
Field Details
-
OFFSET_SAMPLE_RELATIVE
public static final long OFFSET_SAMPLE_RELATIVEA value forsubSampleOffsetUs
to 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_VALUE
if unknown or not applicable. -
maxInputSize
public final int maxInputSizeThe maximum size of a buffer of data (typically one sample) in the format, orConstants.NO_VALUE
if unknown or not applicable. -
durationUs
public final long durationUsThe duration in microseconds, orConstants.UNKNOWN_TIME_US
if the duration is unknown, orConstants.MATCH_LONGEST_US
if 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_DATA
if 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_VALUE
if unknown or not applicable. -
height
public final int heightThe height of the video in pixels, orConstants.NO_VALUE
if 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_VALUE
if 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_VALUE
if unknown or not applicable. -
pixelWidthHeightRatio
public final float pixelWidthHeightRatioThe width to height ratio of pixels in the video, orConstants.NO_VALUE
if 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_VALUE
if 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_VALUE
if unknown or not applicable. -
sampleRate
public final int sampleRateThe audio sampling rate in Hz, orConstants.NO_VALUE
if 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:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-