Class Codecs

java.lang.Object
com.castlabs.utils.Codecs

public class Codecs extends Object
Utility class for handling codecs.
  • Field Details

    • CODEC_NAMES

      public static final Map<String,String> CODEC_NAMES
      Map of codec strings to human-readable names.
    • UNSUPPORTED_AUDIO_CODECS

      public static final Set<String> UNSUPPORTED_AUDIO_CODECS
      Set of unsupported audio codecs.
    • PLUGIN_DECODER_SUPPORT

      public static final Set<String> PLUGIN_DECODER_SUPPORT
      Set of plugin decoder supported codecs.
    • DASH_CODEC_TO_EXOPLAYER_MIMETYPE

      public static final Map<String,String> DASH_CODEC_TO_EXOPLAYER_MIMETYPE
      Map of DASH codec strings to ExoPlayer MIME types.
  • Constructor Details

    • Codecs

      public Codecs()
      Default constructor.
  • Method Details

    • getCodecName

      public static String getCodecName(String codecs)
      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

      public static int getEncodingForMimeType(String mimeType)
      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

      public static boolean isAudioCodec(String codecs)
      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 a MediaCodecAdapter.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 a MediaCodecAdapter.Factory for video codecs, configured based on SDK settings.
      Returns:
      A configured MediaCodecAdapter.Factory.