Package com.castlabs.utils
Class Codecs
java.lang.Object
com.castlabs.utils.Codecs
Utility class for handling codecs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of codec strings to human-readable names.Map of DASH codec strings to ExoPlayer MIME types.Set of plugin decoder supported codecs.Set of unsupported audio codecs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Factory
Creates aMediaCodecAdapter.Factory
for audio codecs, configured based on SDK settings.static com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Factory
Creates aMediaCodecAdapter.Factory
for video codecs, configured based on SDK settings.static String
getCodecName
(String codecs) Gets the human-readable name for a given codec string.static int
getEncodingForMimeType
(String mimeType) Gets the ExoPlayer encoding constant for a given MIME type.static boolean
isAudioCodec
(String codecs) Checks if a given codec string represents an audio codec.
-
Field Details
-
CODEC_NAMES
Map of codec strings to human-readable names. -
UNSUPPORTED_AUDIO_CODECS
Set of unsupported audio codecs. -
PLUGIN_DECODER_SUPPORT
Set of plugin decoder supported codecs. -
DASH_CODEC_TO_EXOPLAYER_MIMETYPE
Map of DASH codec strings to ExoPlayer MIME types.
-
-
Constructor Details
-
Codecs
public Codecs()Default constructor.
-
-
Method Details
-
getCodecName
Gets the human-readable name for a given codec string.- Parameters:
codecs
- The codec string.- Returns:
- The human-readable name, or the original codec string if not found.
-
getEncodingForMimeType
Gets the ExoPlayer encoding constant for a given MIME type.- Parameters:
mimeType
- The MIME type.- Returns:
- The ExoPlayer encoding constant, or
AudioFormat.ENCODING_INVALID
if not found.
-
isAudioCodec
Checks if a given codec string represents an audio codec.- Parameters:
codecs
- The codec string.- Returns:
- True if it's an audio codec, false otherwise.
-
createAudioCodecAdapterFactory
public static com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Factory createAudioCodecAdapterFactory()Creates aMediaCodecAdapter.Factory
for audio codecs, configured based on SDK settings.- Returns:
- A configured
MediaCodecAdapter.Factory
.
-
createVideoCodecAdapterFactory
public static com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Factory createVideoCodecAdapterFactory()Creates aMediaCodecAdapter.Factory
for video codecs, configured based on SDK settings.- Returns:
- A configured
MediaCodecAdapter.Factory
.
-