Java Code Examples for com.google.android.exoplayer2.util.MimeTypes#AUDIO_AMR_NB

The following examples show how to use com.google.android.exoplayer2.util.MimeTypes#AUDIO_AMR_NB . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AmrExtractor.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private void maybeOutputFormat() {
  if (!hasOutputFormat) {
    hasOutputFormat = true;
    String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
    int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
    trackOutput.format(
        Format.createAudioSampleFormat(
            /* id= */ null,
            mimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            MAX_FRAME_SIZE_BYTES,
            /* channelCount= */ 1,
            sampleRate,
            /* pcmEncoding= */ Format.NO_VALUE,
            /* initializationData= */ null,
            /* drmInitData= */ null,
            /* selectionFlags= */ 0,
            /* language= */ null));
  }
}
 
Example 2
Source File: AmrExtractor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void maybeOutputFormat() {
  if (!hasOutputFormat) {
    hasOutputFormat = true;
    String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
    int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
    trackOutput.format(
        Format.createAudioSampleFormat(
            /* id= */ null,
            mimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            MAX_FRAME_SIZE_BYTES,
            /* channelCount= */ 1,
            sampleRate,
            /* pcmEncoding= */ Format.NO_VALUE,
            /* initializationData= */ null,
            /* drmInitData= */ null,
            /* selectionFlags= */ 0,
            /* language= */ null));
  }
}
 
Example 3
Source File: AmrExtractor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void maybeOutputFormat() {
  if (!hasOutputFormat) {
    hasOutputFormat = true;
    String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
    int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
    trackOutput.format(
        Format.createAudioSampleFormat(
            /* id= */ null,
            mimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            MAX_FRAME_SIZE_BYTES,
            /* channelCount= */ 1,
            sampleRate,
            /* pcmEncoding= */ Format.NO_VALUE,
            /* initializationData= */ null,
            /* drmInitData= */ null,
            /* selectionFlags= */ 0,
            /* language= */ null));
  }
}
 
Example 4
Source File: AmrExtractor.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void maybeOutputFormat() {
  if (!hasOutputFormat) {
    hasOutputFormat = true;
    String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
    int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
    trackOutput.format(
        Format.createAudioSampleFormat(
            /* id= */ null,
            mimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            MAX_FRAME_SIZE_BYTES,
            /* channelCount= */ 1,
            sampleRate,
            /* pcmEncoding= */ Format.NO_VALUE,
            /* initializationData= */ null,
            /* drmInitData= */ null,
            /* selectionFlags= */ 0,
            /* language= */ null));
  }
}
 
Example 5
Source File: AmrExtractor.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void maybeOutputFormat() {
  if (!hasOutputFormat) {
    hasOutputFormat = true;
    String mimeType = isWideBand ? MimeTypes.AUDIO_AMR_WB : MimeTypes.AUDIO_AMR_NB;
    int sampleRate = isWideBand ? SAMPLE_RATE_WB : SAMPLE_RATE_NB;
    trackOutput.format(
        Format.createAudioSampleFormat(
            /* id= */ null,
            mimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            MAX_FRAME_SIZE_BYTES,
            /* channelCount= */ 1,
            sampleRate,
            /* pcmEncoding= */ Format.NO_VALUE,
            /* initializationData= */ null,
            /* drmInitData= */ null,
            /* selectionFlags= */ 0,
            /* language= */ null));
  }
}
 
Example 6
Source File: FfmpegLibrary.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the name of the FFmpeg decoder that could be used to decode {@code mimeType}.
 */
/* package */ static String getCodecName(String mimeType) {
  switch (mimeType) {
    case MimeTypes.AUDIO_AAC:
      return "aac";
    case MimeTypes.AUDIO_MPEG:
    case MimeTypes.AUDIO_MPEG_L1:
    case MimeTypes.AUDIO_MPEG_L2:
      return "mp3";
    case MimeTypes.AUDIO_AC3:
      return "ac3";
    case MimeTypes.AUDIO_E_AC3:
      return "eac3";
    case MimeTypes.AUDIO_TRUEHD:
      return "truehd";
    case MimeTypes.AUDIO_DTS:
    case MimeTypes.AUDIO_DTS_HD:
      return "dca";
    case MimeTypes.AUDIO_VORBIS:
      return "vorbis";
    case MimeTypes.AUDIO_OPUS:
      return "opus";
    case MimeTypes.AUDIO_AMR_NB:
      return "amrnb";
    case MimeTypes.AUDIO_AMR_WB:
      return "amrwb";
    case MimeTypes.AUDIO_FLAC:
      return "flac";
    case MimeTypes.AUDIO_ALAC:
      return "alac";
    default:
      return null;
  }
}
 
Example 7
Source File: FfmpegLibrary.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the name of the FFmpeg decoder that could be used to decode the format, or {@code null}
 * if it's unsupported.
 */
/* package */ static @Nullable String getCodecName(String mimeType, @C.PcmEncoding int encoding) {
  switch (mimeType) {
    case MimeTypes.AUDIO_AAC:
      return "aac";
    case MimeTypes.AUDIO_MPEG:
    case MimeTypes.AUDIO_MPEG_L1:
    case MimeTypes.AUDIO_MPEG_L2:
      return "mp3";
    case MimeTypes.AUDIO_AC3:
      return "ac3";
    case MimeTypes.AUDIO_E_AC3:
      return "eac3";
    case MimeTypes.AUDIO_TRUEHD:
      return "truehd";
    case MimeTypes.AUDIO_DTS:
    case MimeTypes.AUDIO_DTS_HD:
      return "dca";
    case MimeTypes.AUDIO_VORBIS:
      return "vorbis";
    case MimeTypes.AUDIO_OPUS:
      return "opus";
    case MimeTypes.AUDIO_AMR_NB:
      return "amrnb";
    case MimeTypes.AUDIO_AMR_WB:
      return "amrwb";
    case MimeTypes.AUDIO_FLAC:
      return "flac";
    case MimeTypes.AUDIO_ALAC:
      return "alac";
    case MimeTypes.AUDIO_RAW:
      if (encoding == C.ENCODING_PCM_MU_LAW) {
        return "pcm_mulaw";
      } else if (encoding == C.ENCODING_PCM_A_LAW) {
        return "pcm_alaw";
      } else {
        return null;
      }
    default:
      return null;
  }
}
 
Example 8
Source File: FfmpegLibrary.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the name of the FFmpeg decoder that could be used to decode the format, or {@code null}
 * if it's unsupported.
 */
/* package */ static @Nullable String getCodecName(String mimeType, @C.PcmEncoding int encoding) {
  switch (mimeType) {
    case MimeTypes.AUDIO_AAC:
      return "aac";
    case MimeTypes.AUDIO_MPEG:
    case MimeTypes.AUDIO_MPEG_L1:
    case MimeTypes.AUDIO_MPEG_L2:
      return "mp3";
    case MimeTypes.AUDIO_AC3:
      return "ac3";
    case MimeTypes.AUDIO_E_AC3:
      return "eac3";
    case MimeTypes.AUDIO_TRUEHD:
      return "truehd";
    case MimeTypes.AUDIO_DTS:
    case MimeTypes.AUDIO_DTS_HD:
      return "dca";
    case MimeTypes.AUDIO_VORBIS:
      return "vorbis";
    case MimeTypes.AUDIO_OPUS:
      return "opus";
    case MimeTypes.AUDIO_AMR_NB:
      return "amrnb";
    case MimeTypes.AUDIO_AMR_WB:
      return "amrwb";
    case MimeTypes.AUDIO_FLAC:
      return "flac";
    case MimeTypes.AUDIO_ALAC:
      return "alac";
    case MimeTypes.AUDIO_RAW:
      if (encoding == C.ENCODING_PCM_MU_LAW) {
        return "pcm_mulaw";
      } else if (encoding == C.ENCODING_PCM_A_LAW) {
        return "pcm_alaw";
      } else {
        return null;
      }
    default:
      return null;
  }
}
 
Example 9
Source File: AudioDecoder.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
/**
  * Returns the name of the FFmpeg decoder that could be used to decode the format, or {@code null}
  * if it's unsupported.
  */
private static @Nullable
String getCodecName(String mimeType, @C.PcmEncoding int encoding) {
   switch (mimeType) {
     case MimeTypes.AUDIO_AAC:
       return "aac";
     case MimeTypes.AUDIO_MPEG:
     case MimeTypes.AUDIO_MPEG_L1:
     case MimeTypes.AUDIO_MPEG_L2:
       return "mp3";
     case MimeTypes.AUDIO_AC3:
       return "ac3";
     case MimeTypes.AUDIO_E_AC3:
     case MimeTypes.AUDIO_E_AC3_JOC:
       return "eac3";
     case MimeTypes.AUDIO_TRUEHD:
       return "truehd";
     case MimeTypes.AUDIO_DTS:
     case MimeTypes.AUDIO_DTS_HD:
       return "dca";
     case MimeTypes.AUDIO_VORBIS:
       return "vorbis";
     case MimeTypes.AUDIO_OPUS:
       return "opus";
     case MimeTypes.AUDIO_AMR_NB:
       return "amrnb";
     case MimeTypes.AUDIO_AMR_WB:
       return "amrwb";
     case MimeTypes.AUDIO_FLAC:
       return "flac";
     case MimeTypes.AUDIO_ALAC:
       return "alac";
     case MimeTypes.AUDIO_RAW:
       if (encoding == C.ENCODING_PCM_MU_LAW) {
         return "pcm_mulaw";
       } else if (encoding == C.ENCODING_PCM_A_LAW) {
         return "pcm_alaw";
       } else {
         return null;
       }
     default:
       return null;
   }
 }
 
Example 10
Source File: FfmpegLibrary.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the name of the FFmpeg decoder that could be used to decode the format, or {@code null}
 * if it's unsupported.
 */
/* package */ static @Nullable String getCodecName(String mimeType, @C.PcmEncoding int encoding) {
  switch (mimeType) {
    case MimeTypes.AUDIO_AAC:
      return "aac";
    case MimeTypes.AUDIO_MPEG:
    case MimeTypes.AUDIO_MPEG_L1:
    case MimeTypes.AUDIO_MPEG_L2:
      return "mp3";
    case MimeTypes.AUDIO_AC3:
      return "ac3";
    case MimeTypes.AUDIO_E_AC3:
    case MimeTypes.AUDIO_E_AC3_JOC:
      return "eac3";
    case MimeTypes.AUDIO_TRUEHD:
      return "truehd";
    case MimeTypes.AUDIO_DTS:
    case MimeTypes.AUDIO_DTS_HD:
      return "dca";
    case MimeTypes.AUDIO_VORBIS:
      return "vorbis";
    case MimeTypes.AUDIO_OPUS:
      return "opus";
    case MimeTypes.AUDIO_AMR_NB:
      return "amrnb";
    case MimeTypes.AUDIO_AMR_WB:
      return "amrwb";
    case MimeTypes.AUDIO_FLAC:
      return "flac";
    case MimeTypes.AUDIO_ALAC:
      return "alac";
    case MimeTypes.AUDIO_RAW:
      if (encoding == C.ENCODING_PCM_MU_LAW) {
        return "pcm_mulaw";
      } else if (encoding == C.ENCODING_PCM_A_LAW) {
        return "pcm_alaw";
      } else {
        return null;
      }
    default:
      return null;
  }
}
 
Example 11
Source File: FfmpegLibrary.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the name of the FFmpeg decoder that could be used to decode the format, or {@code null}
 * if it's unsupported.
 */
/* package */ static @Nullable String getCodecName(String mimeType, @C.PcmEncoding int encoding) {
  switch (mimeType) {
    case MimeTypes.AUDIO_AAC:
      return "aac";
    case MimeTypes.AUDIO_MPEG:
    case MimeTypes.AUDIO_MPEG_L1:
    case MimeTypes.AUDIO_MPEG_L2:
      return "mp3";
    case MimeTypes.AUDIO_AC3:
      return "ac3";
    case MimeTypes.AUDIO_E_AC3:
    case MimeTypes.AUDIO_E_AC3_JOC:
      return "eac3";
    case MimeTypes.AUDIO_TRUEHD:
      return "truehd";
    case MimeTypes.AUDIO_DTS:
    case MimeTypes.AUDIO_DTS_HD:
      return "dca";
    case MimeTypes.AUDIO_VORBIS:
      return "vorbis";
    case MimeTypes.AUDIO_OPUS:
      return "opus";
    case MimeTypes.AUDIO_AMR_NB:
      return "amrnb";
    case MimeTypes.AUDIO_AMR_WB:
      return "amrwb";
    case MimeTypes.AUDIO_FLAC:
      return "flac";
    case MimeTypes.AUDIO_ALAC:
      return "alac";
    case MimeTypes.AUDIO_RAW:
      if (encoding == C.ENCODING_PCM_MU_LAW) {
        return "pcm_mulaw";
      } else if (encoding == C.ENCODING_PCM_A_LAW) {
        return "pcm_alaw";
      } else {
        return null;
      }
    default:
      return null;
  }
}