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

The following examples show how to use com.google.android.exoplayer2.util.MimeTypes#AUDIO_E_AC3_JOC . 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: DashManifestParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
protected static String parseEac3SupplementalProperties(List<Descriptor> supplementalProperties) {
  for (int i = 0; i < supplementalProperties.size(); i++) {
    Descriptor descriptor = supplementalProperties.get(i);
    String schemeIdUri = descriptor.schemeIdUri;
    if (("tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(schemeIdUri)
            && "JOC".equals(descriptor.value))
        || ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(schemeIdUri)
            && "ec+3".equals(descriptor.value))) {
      return MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return MimeTypes.AUDIO_E_AC3;
}
 
Example 2
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
protected static String parseEac3SupplementalProperties(List<Descriptor> supplementalProperties) {
  for (int i = 0; i < supplementalProperties.size(); i++) {
    Descriptor descriptor = supplementalProperties.get(i);
    String schemeIdUri = descriptor.schemeIdUri;
    if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(schemeIdUri)
        && "ec+3".equals(descriptor.value)) {
      return MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return MimeTypes.AUDIO_E_AC3;
}
 
Example 3
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
protected static String parseEac3SupplementalProperties(List<Descriptor> supplementalProperties) {
  for (int i = 0; i < supplementalProperties.size(); i++) {
    Descriptor descriptor = supplementalProperties.get(i);
    String schemeIdUri = descriptor.schemeIdUri;
    if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(schemeIdUri)
        && "ec+3".equals(descriptor.value)) {
      return MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return MimeTypes.AUDIO_E_AC3;
}
 
Example 4
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
protected static String parseEac3SupplementalProperties(List<Descriptor> supplementalProperties) {
  for (int i = 0; i < supplementalProperties.size(); i++) {
    Descriptor descriptor = supplementalProperties.get(i);
    String schemeIdUri = descriptor.schemeIdUri;
    if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(schemeIdUri)
        && "ec+3".equals(descriptor.value)) {
      return MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return MimeTypes.AUDIO_E_AC3;
}
 
Example 5
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
protected static String parseEac3SupplementalProperties(List<Descriptor> supplementalProperties) {
  for (int i = 0; i < supplementalProperties.size(); i++) {
    Descriptor descriptor = supplementalProperties.get(i);
    String schemeIdUri = descriptor.schemeIdUri;
    if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(schemeIdUri)
        && "ec+3".equals(descriptor.value)) {
      return MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return MimeTypes.AUDIO_E_AC3;
}
 
Example 6
Source File: Ac3Util.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the E-AC-3 format given {@code data} containing the EC3SpecificBox according to ETSI TS
 * 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The EC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format.
 * @param language The language to set on the format.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static Format parseEAc3AnnexFFormat(
    ParsableByteArray data, String trackId, String language, @Nullable DrmInitData drmInitData) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read the first independent substream.
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x0E) >> 1];
  if ((nextByte & 0x01) != 0) { // lfeon
    channelCount++;
  }

  // Read the first dependent substream.
  nextByte = data.readUnsignedByte();
  int numDepSub = ((nextByte & 0x1E) >> 1);
  if (numDepSub > 0) {
    int lowByteChanLoc = data.readUnsignedByte();
    // Read Lrs/Rrs pair
    // TODO: Read other channel configuration
    if ((lowByteChanLoc & 0x02) != 0) {
      channelCount += 2;
    }
  }
  String mimeType = MimeTypes.AUDIO_E_AC3;
  if (data.bytesLeft() > 0) {
    nextByte = data.readUnsignedByte();
    if ((nextByte & 0x01) != 0) { // flag_ec3_extension_type_a
      mimeType = MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return Format.createAudioSampleFormat(
      trackId,
      mimeType,
      /* codecs= */ null,
      Format.NO_VALUE,
      Format.NO_VALUE,
      channelCount,
      sampleRate,
      /* initializationData= */ null,
      drmInitData,
      /* selectionFlags= */ 0,
      language);
}
 
Example 7
Source File: Ac3Util.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the E-AC-3 format given {@code data} containing the EC3SpecificBox according to ETSI TS
 * 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The EC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format.
 * @param language The language to set on the format.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static Format parseEAc3AnnexFFormat(
    ParsableByteArray data, String trackId, String language, DrmInitData drmInitData) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read the first independent substream.
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x0E) >> 1];
  if ((nextByte & 0x01) != 0) { // lfeon
    channelCount++;
  }

  // Read the first dependent substream.
  nextByte = data.readUnsignedByte();
  int numDepSub = ((nextByte & 0x1E) >> 1);
  if (numDepSub > 0) {
    int lowByteChanLoc = data.readUnsignedByte();
    // Read Lrs/Rrs pair
    // TODO: Read other channel configuration
    if ((lowByteChanLoc & 0x02) != 0) {
      channelCount += 2;
    }
  }
  String mimeType = MimeTypes.AUDIO_E_AC3;
  if (data.bytesLeft() > 0) {
    nextByte = data.readUnsignedByte();
    if ((nextByte & 0x01) != 0) { // flag_ec3_extension_type_a
      mimeType = MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return Format.createAudioSampleFormat(
      trackId,
      mimeType,
      /* codecs= */ null,
      Format.NO_VALUE,
      Format.NO_VALUE,
      channelCount,
      sampleRate,
      /* initializationData= */ null,
      drmInitData,
      /* selectionFlags= */ 0,
      language);
}
 
Example 8
Source File: Ac3Util.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the E-AC-3 format given {@code data} containing the EC3SpecificBox according to ETSI TS
 * 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The EC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format.
 * @param language The language to set on the format.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static Format parseEAc3AnnexFFormat(
    ParsableByteArray data, String trackId, String language, DrmInitData drmInitData) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read the first independent substream.
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x0E) >> 1];
  if ((nextByte & 0x01) != 0) { // lfeon
    channelCount++;
  }

  // Read the first dependent substream.
  nextByte = data.readUnsignedByte();
  int numDepSub = ((nextByte & 0x1E) >> 1);
  if (numDepSub > 0) {
    int lowByteChanLoc = data.readUnsignedByte();
    // Read Lrs/Rrs pair
    // TODO: Read other channel configuration
    if ((lowByteChanLoc & 0x02) != 0) {
      channelCount += 2;
    }
  }
  String mimeType = MimeTypes.AUDIO_E_AC3;
  if (data.bytesLeft() > 0) {
    nextByte = data.readUnsignedByte();
    if ((nextByte & 0x01) != 0) { // flag_ec3_extension_type_a
      mimeType = MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return Format.createAudioSampleFormat(
      trackId,
      mimeType,
      /* codecs= */ null,
      Format.NO_VALUE,
      Format.NO_VALUE,
      channelCount,
      sampleRate,
      /* initializationData= */ null,
      drmInitData,
      /* selectionFlags= */ 0,
      language);
}
 
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: Ac3Util.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the E-AC-3 format given {@code data} containing the EC3SpecificBox according to ETSI TS
 * 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The EC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format.
 * @param language The language to set on the format.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static Format parseEAc3AnnexFFormat(
    ParsableByteArray data, String trackId, String language, DrmInitData drmInitData) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read the first independent substream.
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x0E) >> 1];
  if ((nextByte & 0x01) != 0) { // lfeon
    channelCount++;
  }

  // Read the first dependent substream.
  nextByte = data.readUnsignedByte();
  int numDepSub = ((nextByte & 0x1E) >> 1);
  if (numDepSub > 0) {
    int lowByteChanLoc = data.readUnsignedByte();
    // Read Lrs/Rrs pair
    // TODO: Read other channel configuration
    if ((lowByteChanLoc & 0x02) != 0) {
      channelCount += 2;
    }
  }
  String mimeType = MimeTypes.AUDIO_E_AC3;
  if (data.bytesLeft() > 0) {
    nextByte = data.readUnsignedByte();
    if ((nextByte & 0x01) != 0) { // flag_ec3_extension_type_a
      mimeType = MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return Format.createAudioSampleFormat(
      trackId,
      mimeType,
      /* codecs= */ null,
      Format.NO_VALUE,
      Format.NO_VALUE,
      channelCount,
      sampleRate,
      /* initializationData= */ null,
      drmInitData,
      /* selectionFlags= */ 0,
      language);
}
 
Example 11
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 12
Source File: Ac3Util.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the E-AC-3 format given {@code data} containing the EC3SpecificBox according to ETSI TS
 * 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The EC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format.
 * @param language The language to set on the format.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static Format parseEAc3AnnexFFormat(
    ParsableByteArray data, String trackId, String language, DrmInitData drmInitData) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read the first independent substream.
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x0E) >> 1];
  if ((nextByte & 0x01) != 0) { // lfeon
    channelCount++;
  }

  // Read the first dependent substream.
  nextByte = data.readUnsignedByte();
  int numDepSub = ((nextByte & 0x1E) >> 1);
  if (numDepSub > 0) {
    int lowByteChanLoc = data.readUnsignedByte();
    // Read Lrs/Rrs pair
    // TODO: Read other channel configuration
    if ((lowByteChanLoc & 0x02) != 0) {
      channelCount += 2;
    }
  }
  String mimeType = MimeTypes.AUDIO_E_AC3;
  if (data.bytesLeft() > 0) {
    nextByte = data.readUnsignedByte();
    if ((nextByte & 0x01) != 0) { // flag_ec3_extension_type_a
      mimeType = MimeTypes.AUDIO_E_AC3_JOC;
    }
  }
  return Format.createAudioSampleFormat(
      trackId,
      mimeType,
      /* codecs= */ null,
      Format.NO_VALUE,
      Format.NO_VALUE,
      channelCount,
      sampleRate,
      /* initializationData= */ null,
      drmInitData,
      /* selectionFlags= */ 0,
      language);
}
 
Example 13
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;
  }
}