当前位置: 首页>>代码示例>>Java>>正文


Java MediaFormat.createAudioFormat方法代码示例

本文整理汇总了Java中com.google.android.exoplayer.MediaFormat.createAudioFormat方法的典型用法代码示例。如果您正苦于以下问题:Java MediaFormat.createAudioFormat方法的具体用法?Java MediaFormat.createAudioFormat怎么用?Java MediaFormat.createAudioFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer.MediaFormat的用法示例。


在下文中一共展示了MediaFormat.createAudioFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseAnnexFEAc3Format

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the AC-3 format given {@code data} containing the EC3SpecificBox according to
 * ETSI TS 102 366 Annex F.
 */
public static MediaFormat parseAnnexFEAc3Format(ParsableByteArray data) {
  data.skipBytes(2); // Skip data_rate and num_ind_sub.

  // Read only the first substream.
  // TODO: Read later substreams?
  // fscod (sample rate code)
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATES[fscod];
  int nextByte = data.readUnsignedByte();
  // Map acmod (audio coding mode) onto a channel count.
  int channelCount = CHANNEL_COUNTS[(nextByte & 0x0E) >> 1];
  // lfeon (low frequency effects on)
  if ((nextByte & 0x01) != 0) {
    channelCount++;
  }
  return MediaFormat.createAudioFormat(MimeTypes.AUDIO_EC3, MediaFormat.NO_VALUE,
      channelCount, sampleRate, null);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:23,代码来源:Ac3Util.java

示例2: parseFrameAc3Format

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the AC-3 format given {@code data} containing the frame header starting from the sync
 * word.
 *
 * @param data Data to parse, positioned at the start of the syncword.
 * @return AC-3 format parsed from data in the header.
 */
public static MediaFormat parseFrameAc3Format(ParsableBitArray data) {
  // Skip syncword and crc1.
  data.skipBits(4 * 8);

  int fscod = data.readBits(2);
  data.skipBits(14); // frmsizecod(6) + bsid (5 bits) + bsmod (3 bits)
  int acmod = data.readBits(3);
  if ((acmod & 0x01) != 0 && acmod != 1) {
    data.skipBits(2); // cmixlev
  }
  if ((acmod & 0x04) != 0) {
    data.skipBits(2); // surmixlev
  }
  if (acmod == 0x02) {
    data.skipBits(2); // dsurmod
  }
  boolean lfeon = data.readBit();
  return MediaFormat.createAudioFormat(MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
      CHANNEL_COUNTS[acmod] + (lfeon ? 1 : 0), SAMPLE_RATES[fscod], null);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:28,代码来源:Ac3Util.java

示例3: parsePayload

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
@Override
protected void parsePayload(ParsableByteArray data, long timeUs) {
  int packetType = data.readUnsignedByte();
  // Parse sequence header just in case it was not done before.
  if (packetType == AAC_PACKET_TYPE_SEQUENCE_HEADER && !hasOutputFormat) {
    byte[] audioSpecifiConfig = new byte[data.bytesLeft()];
    data.readBytes(audioSpecifiConfig, 0, audioSpecifiConfig.length);
    Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
        audioSpecifiConfig);
    MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, MimeTypes.AUDIO_AAC,
        MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, getDurationUs(), audioParams.second,
        audioParams.first, Collections.singletonList(audioSpecifiConfig), null);
    output.format(mediaFormat);
    hasOutputFormat = true;
  } else if (packetType == AAC_PACKET_TYPE_AAC_RAW) {
    // Sample audio AAC frames
    int bytesToWrite = data.bytesLeft();
    output.sampleData(data, bytesToWrite);
    output.sampleMetadata(timeUs, C.SAMPLE_FLAG_SYNC, bytesToWrite, 0, null);
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:22,代码来源:AudioTagPayloadReader.java

示例4: read

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
@Override
public int read(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  if (synchronizedHeaderData == 0 && !synchronizeCatchingEndOfInput(input)) {
    return RESULT_END_OF_INPUT;
  }
  if (seeker == null) {
    setupSeeker(input);
    extractorOutput.seekMap(seeker);
    MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, synchronizedHeader.mimeType,
        MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES, seeker.getDurationUs(),
        synchronizedHeader.channels, synchronizedHeader.sampleRate, null, null);
    if (gaplessInfo != null) {
      mediaFormat =
          mediaFormat.copyWithGaplessInfo(gaplessInfo.encoderDelay, gaplessInfo.encoderPadding);
    }
    trackOutput.format(mediaFormat);
  }
  return readSample(input);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:21,代码来源:Mp3Extractor.java

示例5: parseEAc3AnnexFFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * 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, or null.
 * @param durationUs The duration to set on the format, in microseconds.
 * @param language The language to set on the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static MediaFormat parseEAc3AnnexFFormat(ParsableByteArray data, String trackId,
    long durationUs, String language) {
  data.skipBytes(2); // data_rate, num_ind_sub

  // Read only the first substream.
  // TODO: Read later substreams?
  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++;
  }
  return MediaFormat.createAudioFormat(trackId, MimeTypes.AUDIO_E_AC3, MediaFormat.NO_VALUE,
      MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:27,代码来源:Ac3Util.java

示例6: parseAc3SyncframeFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the AC-3 format given {@code data} containing a syncframe. The reading position of
 * {@code data} will be modified.
 *
 * @param data The data to parse, positioned at the start of the syncframe.
 * @param trackId The track identifier to set on the format, or null.
 * @param durationUs The duration to set on the format, in microseconds.
 * @param language The language to set on the format.
 * @return The AC-3 format parsed from data in the header.
 */
public static MediaFormat parseAc3SyncframeFormat(ParsableBitArray data, String trackId,
    long durationUs, String language) {
  data.skipBits(16 + 16); // syncword, crc1
  int fscod = data.readBits(2);
  data.skipBits(6 + 5 + 3); // frmsizecod, bsid, bsmod
  int acmod = data.readBits(3);
  if ((acmod & 0x01) != 0 && acmod != 1) {
    data.skipBits(2); // cmixlev
  }
  if ((acmod & 0x04) != 0) {
    data.skipBits(2); // surmixlev
  }
  if (acmod == 2) {
    data.skipBits(2); // dsurmod
  }
  boolean lfeon = data.readBit();
  return MediaFormat.createAudioFormat(trackId, MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
      MediaFormat.NO_VALUE, durationUs, CHANNEL_COUNT_BY_ACMOD[acmod] + (lfeon ? 1 : 0),
      SAMPLE_RATE_BY_FSCOD[fscod], null, language);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:31,代码来源:Ac3Util.java

示例7: parseEac3SyncframeFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the E-AC-3 format given {@code data} containing a syncframe. The reading position of
 * {@code data} will be modified.
 *
 * @param data The data to parse, positioned at the start of the syncframe.
 * @param trackId The track identifier to set on the format, or null.
 * @param durationUs The duration to set on the format, in microseconds.
 * @param language The language to set on the format.
 * @return The E-AC-3 format parsed from data in the header.
 */
public static MediaFormat parseEac3SyncframeFormat(ParsableBitArray data, String trackId,
    long durationUs, String language) {
  data.skipBits(16 + 2 + 3 + 11); // syncword, strmtype, substreamid, frmsiz
  int sampleRate;
  int fscod = data.readBits(2);
  if (fscod == 3) {
    sampleRate = SAMPLE_RATE_BY_FSCOD2[data.readBits(2)];
  } else {
    data.skipBits(2); // numblkscod
    sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  }
  int acmod = data.readBits(3);
  boolean lfeon = data.readBit();
  return MediaFormat.createAudioFormat(trackId, MimeTypes.AUDIO_E_AC3, MediaFormat.NO_VALUE,
      MediaFormat.NO_VALUE, durationUs, CHANNEL_COUNT_BY_ACMOD[acmod] + (lfeon ? 1 : 0),
      sampleRate, null, language);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:28,代码来源:Ac3Util.java

示例8: parseDtsFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the DTS format given {@code data} containing the DTS frame according to ETSI TS 102 114
 * subsections 5.3/5.4.
 * <p>
 * This method may only be called from one thread at a time.
 *
 * @param frame The DTS frame to parse.
 * @param trackId The track identifier to set on the format, or null.
 * @param durationUs The duration to set on the format, in microseconds.
 * @param language The language to set on the format.
 * @return The DTS format parsed from data in the header.
 */
public static MediaFormat parseDtsFormat(byte[] frame, String trackId, long durationUs,
    String language) {
  ParsableBitArray frameBits = SCRATCH_BITS;
  frameBits.reset(frame);
  frameBits.skipBits(4 * 8 + 1 + 5 + 1 + 7 + 14); // SYNC, FTYPE, SHORT, CPF, NBLKS, FSIZE
  int amode = frameBits.readBits(6);
  int channelCount = CHANNELS_BY_AMODE[amode];
  int sfreq = frameBits.readBits(4);
  int sampleRate = SAMPLE_RATE_BY_SFREQ[sfreq];
  int rate = frameBits.readBits(5);
  int bitrate = rate >= TWICE_BITRATE_KBPS_BY_RATE.length ? MediaFormat.NO_VALUE
      : TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
  frameBits.skipBits(10); // MIX, DYNF, TIMEF, AUXF, HDCD, EXT_AUDIO_ID, EXT_AUDIO, ASPF
  channelCount += frameBits.readBits(2) > 0 ? 1 : 0; // LFF
  return MediaFormat.createAudioFormat(trackId, MimeTypes.AUDIO_DTS, bitrate,
      MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:30,代码来源:DtsUtil.java

示例9: getTrackFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
private static MediaFormat getTrackFormat(int adaptationSetType, Format format,
    String mediaMimeType, long durationUs) {
  switch (adaptationSetType) {
    case AdaptationSet.TYPE_VIDEO:
      return MediaFormat.createVideoFormat(format.id, mediaMimeType, format.bitrate,
          MediaFormat.NO_VALUE, durationUs, format.width, format.height, null);
    case AdaptationSet.TYPE_AUDIO:
      return MediaFormat.createAudioFormat(format.id, mediaMimeType, format.bitrate,
          MediaFormat.NO_VALUE, durationUs, format.audioChannels, format.audioSamplingRate, null,
          format.language);
    case AdaptationSet.TYPE_TEXT:
      return MediaFormat.createTextFormat(format.id, mediaMimeType, format.bitrate,
          durationUs, format.language);
    default:
      return null;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:18,代码来源:DashChunkSource.java

示例10: readHeaderRemainder

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Attempts to read the remaining two bytes of the frame header.
 * <p>
 * If a frame header is read in full then the state is changed to {@link #STATE_READING_FRAME},
 * the media format is output if this has not previously occurred, the four header bytes are
 * output as sample data, and the position of the source is advanced to the byte that immediately
 * follows the header.
 * <p>
 * If a frame header is read in full but cannot be parsed then the state is changed to
 * {@link #STATE_READING_HEADER}.
 * <p>
 * If a frame header is not read in full then the position of the source is advanced to the limit,
 * and the method should be called again with the next source to continue the read.
 *
 * @param source The source from which to read.
 */
private void readHeaderRemainder(ParsableByteArray source) {
  int bytesToRead = Math.min(source.bytesLeft(), HEADER_SIZE - frameBytesRead);
  source.readBytes(headerScratch.data, frameBytesRead, bytesToRead);
  frameBytesRead += bytesToRead;
  if (frameBytesRead < HEADER_SIZE) {
    // We haven't read the whole header yet.
    return;
  }

  headerScratch.setPosition(0);
  boolean parsedHeader = MpegAudioHeader.populateHeader(headerScratch.readInt(), header);
  if (!parsedHeader) {
    // We thought we'd located a frame header, but we hadn't.
    frameBytesRead = 0;
    state = STATE_READING_HEADER;
    return;
  }

  frameSize = header.frameSize;
  if (!hasOutputFormat) {
    frameDurationUs = (C.MICROS_PER_SECOND * header.samplesPerFrame) / header.sampleRate;
    MediaFormat mediaFormat = MediaFormat.createAudioFormat(header.mimeType,
        MpegAudioHeader.MAX_FRAME_SIZE_BYTES, C.UNKNOWN_TIME_US, header.channels,
        header.sampleRate, null);
    output.format(mediaFormat);
    hasOutputFormat = true;
  }

  headerScratch.setPosition(0);
  output.sampleData(headerScratch, HEADER_SIZE);
  state = STATE_READING_FRAME;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:49,代码来源:MpegAudioReader.java

示例11: parseHeader

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Parses the sample header.
 */
private void parseHeader() {
  adtsScratch.setPosition(0);

  if (!hasOutputFormat) {
    int audioObjectType = adtsScratch.readBits(2) + 1;
    int sampleRateIndex = adtsScratch.readBits(4);
    adtsScratch.skipBits(1);
    int channelConfig = adtsScratch.readBits(3);

    byte[] audioSpecificConfig = CodecSpecificDataUtil.buildAacAudioSpecificConfig(
        audioObjectType, sampleRateIndex, channelConfig);
    Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
        audioSpecificConfig);

    MediaFormat mediaFormat = MediaFormat.createAudioFormat(MimeTypes.AUDIO_AAC,
        MediaFormat.NO_VALUE, audioParams.second, audioParams.first,
        Collections.singletonList(audioSpecificConfig));
    frameDurationUs = (C.MICROS_PER_SECOND * 1024L) / mediaFormat.sampleRate;
    output.format(mediaFormat);
    hasOutputFormat = true;
  } else {
    adtsScratch.skipBits(10);
  }

  adtsScratch.skipBits(4);
  sampleSize = adtsScratch.readBits(13) - 2 /* the sync word */ - HEADER_SIZE;
  if (hasCrc) {
    sampleSize -= CRC_SIZE;
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:34,代码来源:AdtsReader.java

示例12: parseAnnexFAc3Format

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the AC-3 format given {@code data} containing the AC3SpecificBox according to
 * ETSI TS 102 366 Annex F.
 */
public static MediaFormat parseAnnexFAc3Format(ParsableByteArray data) {
  // fscod (sample rate code)
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATES[fscod];
  int nextByte = data.readUnsignedByte();
  // Map acmod (audio coding mode) onto a channel count.
  int channelCount = CHANNEL_COUNTS[(nextByte & 0x38) >> 3];
  // lfeon (low frequency effects on)
  if ((nextByte & 0x04) != 0) {
    channelCount++;
  }
  return MediaFormat.createAudioFormat(MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
      channelCount, sampleRate, null);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:Ac3Util.java

示例13: readHeaderRemainder

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Attempts to read the remaining two bytes of the frame header.
 * <p>
 * If a frame header is read in full then the state is changed to {@link #STATE_READING_FRAME},
 * the media format is output if this has not previously occurred, the four header bytes are
 * output as sample data, and the position of the source is advanced to the byte that immediately
 * follows the header.
 * <p>
 * If a frame header is read in full but cannot be parsed then the state is changed to
 * {@link #STATE_READING_HEADER}.
 * <p>
 * If a frame header is not read in full then the position of the source is advanced to the limit,
 * and the method should be called again with the next source to continue the read.
 *
 * @param source The source from which to read.
 */
private void readHeaderRemainder(ParsableByteArray source) {
  int bytesToRead = Math.min(source.bytesLeft(), HEADER_SIZE - frameBytesRead);
  source.readBytes(headerScratch.data, frameBytesRead, bytesToRead);
  frameBytesRead += bytesToRead;
  if (frameBytesRead < HEADER_SIZE) {
    // We haven't read the whole header yet.
    return;
  }

  headerScratch.setPosition(0);
  boolean parsedHeader = MpegAudioHeader.populateHeader(headerScratch.readInt(), header);
  if (!parsedHeader) {
    // We thought we'd located a frame header, but we hadn't.
    frameBytesRead = 0;
    state = STATE_READING_HEADER;
    return;
  }

  frameSize = header.frameSize;
  if (!hasOutputFormat) {
    frameDurationUs = (C.MICROS_PER_SECOND * header.samplesPerFrame) / header.sampleRate;
    MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, header.mimeType,
        MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES, C.UNKNOWN_TIME_US,
        header.channels, header.sampleRate, null, null);
    output.format(mediaFormat);
    hasOutputFormat = true;
  }

  headerScratch.setPosition(0);
  output.sampleData(headerScratch, HEADER_SIZE);
  state = STATE_READING_FRAME;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:49,代码来源:MpegAudioReader.java

示例14: parseAc3AnnexFFormat

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
/**
 * Returns the AC-3 format given {@code data} containing the AC3SpecificBox according to
 * ETSI TS 102 366 Annex F. The reading position of {@code data} will be modified.
 *
 * @param data The AC3SpecificBox to parse.
 * @param trackId The track identifier to set on the format, or null.
 * @param durationUs The duration to set on the format, in microseconds.
 * @param language The language to set on the format.
 * @return The AC-3 format parsed from data in the header.
 */
public static MediaFormat parseAc3AnnexFFormat(ParsableByteArray data, String trackId,
    long durationUs, String language) {
  int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
  int sampleRate = SAMPLE_RATE_BY_FSCOD[fscod];
  int nextByte = data.readUnsignedByte();
  int channelCount = CHANNEL_COUNT_BY_ACMOD[(nextByte & 0x38) >> 3];
  if ((nextByte & 0x04) != 0) { // lfeon
    channelCount++;
  }
  return MediaFormat.createAudioFormat(trackId, MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
      MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:23,代码来源:Ac3Util.java

示例15: parseAudioSampleEntry

import com.google.android.exoplayer.MediaFormat; //导入方法依赖的package包/类
private static void parseAudioSampleEntry(ParsableByteArray parent, int atomType, int position,
    int size, long durationUs, StsdDataHolder out, int entryIndex) {
  parent.setPosition(position + Atom.HEADER_SIZE);
  parent.skipBytes(16);
  int channelCount = parent.readUnsignedShort();
  int sampleSize = parent.readUnsignedShort();
  parent.skipBytes(4);
  int sampleRate = parent.readUnsignedFixedPoint1616();

  // If the atom type determines a MIME type, set it immediately.
  String mimeType = null;
  if (atomType == Atom.TYPE_ac_3) {
    mimeType = MimeTypes.AUDIO_AC3;
  } else if (atomType == Atom.TYPE_ec_3) {
    mimeType = MimeTypes.AUDIO_EC3;
  }

  byte[] initializationData = null;
  int childPosition = parent.getPosition();
  while (childPosition - position < size) {
    parent.setPosition(childPosition);
    int childStartPosition = parent.getPosition();
    int childAtomSize = parent.readInt();
    Assertions.checkArgument(childAtomSize > 0, "childAtomSize should be positive");
    int childAtomType = parent.readInt();
    if (atomType == Atom.TYPE_mp4a || atomType == Atom.TYPE_enca) {
      if (childAtomType == Atom.TYPE_esds) {
        Pair<String, byte[]> mimeTypeAndInitializationData =
            parseEsdsFromParent(parent, childStartPosition);
        mimeType = mimeTypeAndInitializationData.first;
        initializationData = mimeTypeAndInitializationData.second;
        if (MimeTypes.AUDIO_AAC.equals(mimeType)) {
          // TODO: Do we really need to do this? See [Internal: b/10903778]
          // Update sampleRate and channelCount from the AudioSpecificConfig initialization data.
          Pair<Integer, Integer> audioSpecificConfig =
              CodecSpecificDataUtil.parseAacAudioSpecificConfig(initializationData);
          sampleRate = audioSpecificConfig.first;
          channelCount = audioSpecificConfig.second;
        }
      } else if (childAtomType == Atom.TYPE_sinf) {
        out.trackEncryptionBoxes[entryIndex] = parseSinfFromParent(parent, childStartPosition,
            childAtomSize);
      }
    } else if (atomType == Atom.TYPE_ac_3 && childAtomType == Atom.TYPE_dac3) {
      // TODO: Choose the right AC-3 track based on the contents of dac3/dec3.
      // TODO: Add support for encryption (by setting out.trackEncryptionBoxes).
      parent.setPosition(Atom.HEADER_SIZE + childStartPosition);
      out.mediaFormat = Ac3Util.parseAnnexFAc3Format(parent);
      return;
    } else if  (atomType == Atom.TYPE_ec_3 && childAtomType == Atom.TYPE_dec3) {
      parent.setPosition(Atom.HEADER_SIZE + childStartPosition);
      out.mediaFormat = Ac3Util.parseAnnexFEAc3Format(parent);
      return;
    }
    childPosition += childAtomSize;
  }

  // If the media type was not recognized, ignore the track.
  if (mimeType == null) {
    return;
  }

  out.mediaFormat = MediaFormat.createAudioFormat(mimeType, sampleSize, durationUs, channelCount,
      sampleRate,
      initializationData == null ? null : Collections.singletonList(initializationData));
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:67,代码来源:AtomParsers.java


注:本文中的com.google.android.exoplayer.MediaFormat.createAudioFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。