Class MimeTypes
java.lang.Object
com.castlabs.sdk.base.subtitles.utilities.MimeTypes
Defines common MIME types and helper methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
allSamplesAreSyncSamples
(String mimeType) Returns true if it is known that all samples in a stream of the given sample MIME type are guaranteed to be sync samples (i.e.,Constants.BUFFER_FLAG_KEY_FRAME
is guaranteed to be set on every sample).static String
getAudioMediaMimeType
(String codecs) Derives a audio sample mimeType from a codecs attribute.static String
getMediaMimeType
(String codec) Derives a mimeType from a codec identifier, as defined in RFC 6381.static String
getMimeTypeFromMp4ObjectType
(int objectType) Derives a mimeType from MP4 object type identifier, as defined in RFC 6381 and https://mp4ra.org/#/object_types.static int
getTrackType
(String mimeType) Returns theConstants
.TRACK_TYPE_*
constant that corresponds to a specified MIME type.static int
getTrackTypeOfCodec
(String codec) Equivalent togetTrackType(getMediaMimeType(codec))
.static String
getVideoMediaMimeType
(String codecs) Derives a video sample mimeType from a codecs attribute.static boolean
isApplication
(String mimeType) Returns whether the given string is an application MIME type.static boolean
Returns whether the given string is an audio MIME type.static boolean
Whether the top-level type ofmimeType
is image.static boolean
Returns whether the given string is a text MIME type.static boolean
Returns whether the given string is a video MIME type.static void
registerCustomMimeType
(String mimeType, String codecPrefix, int trackType) Registers a custom MIME type.
-
Field Details
-
BASE_TYPE_VIDEO
- See Also:
-
BASE_TYPE_AUDIO
- See Also:
-
BASE_TYPE_TEXT
- See Also:
-
BASE_TYPE_APPLICATION
- See Also:
-
BASE_TYPE_IMAGE
- See Also:
-
VIDEO_MP4
- See Also:
-
VIDEO_WEBM
- See Also:
-
VIDEO_H263
- See Also:
-
VIDEO_H264
- See Also:
-
VIDEO_H265
- See Also:
-
VIDEO_VP8
- See Also:
-
VIDEO_VP9
- See Also:
-
VIDEO_AV1
- See Also:
-
VIDEO_MP4V
- See Also:
-
VIDEO_MPEG
- See Also:
-
VIDEO_MPEG2
- See Also:
-
VIDEO_VC1
- See Also:
-
VIDEO_DIVX
- See Also:
-
VIDEO_DOLBY_VISION
- See Also:
-
VIDEO_UNKNOWN
- See Also:
-
AUDIO_MP4
- See Also:
-
AUDIO_AAC
- See Also:
-
AUDIO_WEBM
- See Also:
-
AUDIO_MPEG
- See Also:
-
AUDIO_MPEG_L1
- See Also:
-
AUDIO_MPEG_L2
- See Also:
-
AUDIO_RAW
- See Also:
-
AUDIO_ALAW
- See Also:
-
AUDIO_MLAW
- See Also:
-
AUDIO_AC3
- See Also:
-
AUDIO_E_AC3
- See Also:
-
AUDIO_E_AC3_JOC
- See Also:
-
AUDIO_AC4
- See Also:
-
AUDIO_TRUEHD
- See Also:
-
AUDIO_DTS
- See Also:
-
AUDIO_DTS_HD
- See Also:
-
AUDIO_DTS_EXPRESS
- See Also:
-
AUDIO_VORBIS
- See Also:
-
AUDIO_OPUS
- See Also:
-
AUDIO_AMR_NB
- See Also:
-
AUDIO_AMR_WB
- See Also:
-
AUDIO_FLAC
- See Also:
-
AUDIO_ALAC
- See Also:
-
AUDIO_MSGSM
- See Also:
-
AUDIO_UNKNOWN
- See Also:
-
TEXT_VTT
- See Also:
-
TEXT_SSA
- See Also:
-
APPLICATION_MP4
- See Also:
-
APPLICATION_WEBM
- See Also:
-
APPLICATION_MPD
- See Also:
-
APPLICATION_M3U8
- See Also:
-
APPLICATION_SS
- See Also:
-
APPLICATION_ID3
- See Also:
-
APPLICATION_CEA608
- See Also:
-
APPLICATION_CEA708
- See Also:
-
APPLICATION_SUBRIP
- See Also:
-
APPLICATION_TTML
- See Also:
-
APPLICATION_TX3G
- See Also:
-
APPLICATION_MP4VTT
- See Also:
-
APPLICATION_MP4CEA608
- See Also:
-
APPLICATION_RAWCC
- See Also:
-
APPLICATION_VOBSUB
- See Also:
-
APPLICATION_PGS
- See Also:
-
APPLICATION_SCTE35
- See Also:
-
APPLICATION_CAMERA_MOTION
- See Also:
-
APPLICATION_EMSG
- See Also:
-
APPLICATION_DVBSUBS
- See Also:
-
APPLICATION_EXIF
- See Also:
-
APPLICATION_ICY
- See Also:
-
APPLICATION_DVBTTX
- See Also:
-
-
Method Details
-
registerCustomMimeType
Registers a custom MIME type. Most applications do not need to call this method, as handling of standard MIME types is built in. These built-in MIME types take precedence over any registered via this method. If this method is used, it must be called before creating any player(s).- Parameters:
mimeType
- The custom MIME type to register.codecPrefix
- The RFC 6381-style codec string prefix associated with the MIME type.trackType
- TheConstants
.TRACK_TYPE_*
constant associated with the MIME type. This value is ignored if the top-level type ofmimeType
is audio, video or text.
-
isAudio
Returns whether the given string is an audio MIME type. -
isVideo
Returns whether the given string is a video MIME type. -
isText
Returns whether the given string is a text MIME type. -
isApplication
Returns whether the given string is an application MIME type. -
allSamplesAreSyncSamples
Returns true if it is known that all samples in a stream of the given sample MIME type are guaranteed to be sync samples (i.e.,Constants.BUFFER_FLAG_KEY_FRAME
is guaranteed to be set on every sample).- Parameters:
mimeType
- The sample MIME type.- Returns:
- True if it is known that all samples in a stream of the given sample MIME type are
guaranteed to be sync samples. False otherwise, including if
null
is passed.
-
isImage
Whether the top-level type ofmimeType
is image.- Parameters:
mimeType
- The mimeType to test.- Returns:
- Whether the top level type is image.
-
getVideoMediaMimeType
Derives a video sample mimeType from a codecs attribute.- Parameters:
codecs
- The codecs attribute.- Returns:
- The derived video mimeType, or null if it could not be derived.
-
getAudioMediaMimeType
Derives a audio sample mimeType from a codecs attribute.- Parameters:
codecs
- The codecs attribute.- Returns:
- The derived audio mimeType, or null if it could not be derived.
-
getMediaMimeType
Derives a mimeType from a codec identifier, as defined in RFC 6381.- Parameters:
codec
- The codec identifier to derive.- Returns:
- The mimeType, or null if it could not be derived.
-
getMimeTypeFromMp4ObjectType
Derives a mimeType from MP4 object type identifier, as defined in RFC 6381 and https://mp4ra.org/#/object_types.- Parameters:
objectType
- The objectType identifier to derive.- Returns:
- The mimeType, or null if it could not be derived.
-
getTrackType
Returns theConstants
.TRACK_TYPE_*
constant that corresponds to a specified MIME type.Constants.TRACK_TYPE_UNKNOWN
if the MIME type is not known or the mapping cannot be established.- Parameters:
mimeType
- The MIME type.- Returns:
- The
Constants
.TRACK_TYPE_*
constant that corresponds to a specified MIME type.
-
getTrackTypeOfCodec
Equivalent togetTrackType(getMediaMimeType(codec))
.- Parameters:
codec
- The codec.- Returns:
- The
Constants
.TRACK_TYPE_*
constant that corresponds to a specified codec.
-