• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParserException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer2.ParserException的典型用法代码示例。如果您正苦于以下问题:Java ParserException类的具体用法?Java ParserException怎么用?Java ParserException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParserException类属于com.google.android.exoplayer2包,在下文中一共展示了ParserException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onLoadError

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
public int onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs,
    long loadDurationMs, IOException error) {
  boolean isFatal = error instanceof ParserException;
  eventDispatcher.loadError(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs,
      loadDurationMs, loadable.bytesLoaded(), error, isFatal);
  if (isFatal) {
    return Loader.DONT_RETRY_FATAL;
  }
  boolean shouldRetry = true;
  if (ChunkedTrackBlacklistUtil.shouldBlacklist(error)) {
    blacklistUntilMs =
        SystemClock.elapsedRealtime() + ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS;
    notifyPlaylistBlacklisting(playlistUrl,
        ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS);
    shouldRetry = primaryHlsUrl == playlistUrl && !maybeSelectNewPrimaryUrl();
  }
  return shouldRetry ? Loader.RETRY : Loader.DONT_RETRY;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:20,代码来源:HlsPlaylistTracker.java


示例2: readVorbisIdentificationHeader

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
/**
 * Reads a vorbis identification header from {@code headerData}.
 *
 * @see <a href="https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-630004.2.2">Vorbis
 *     spec/Identification header</a>
 * @param headerData a {@link ParsableByteArray} wrapping the header data.
 * @return a {@link VorbisUtil.VorbisIdHeader} with meta data.
 * @throws ParserException thrown if invalid capture pattern is detected.
 */
public static VorbisIdHeader readVorbisIdentificationHeader(ParsableByteArray headerData)
    throws ParserException {

  verifyVorbisHeaderCapturePattern(0x01, headerData, false);

  long version = headerData.readLittleEndianUnsignedInt();
  int channels = headerData.readUnsignedByte();
  long sampleRate = headerData.readLittleEndianUnsignedInt();
  int bitrateMax = headerData.readLittleEndianInt();
  int bitrateNominal = headerData.readLittleEndianInt();
  int bitrateMin = headerData.readLittleEndianInt();

  int blockSize = headerData.readUnsignedByte();
  int blockSize0 = (int) Math.pow(2, blockSize & 0x0F);
  int blockSize1 = (int) Math.pow(2, (blockSize & 0xF0) >> 4);

  boolean framingFlag = (headerData.readUnsignedByte() & 0x01) > 0;
  // raw data of vorbis setup header has to be passed to decoder as CSD buffer #1
  byte[] data = Arrays.copyOf(headerData.data, headerData.limit());

  return new VorbisIdHeader(version, channels, sampleRate, bitrateMax, bitrateNominal, bitrateMin,
      blockSize0, blockSize1, framingFlag, data);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:33,代码来源:VorbisUtil.java


示例3: sniff

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
public boolean sniff(ExtractorInput input) throws IOException, InterruptedException {
  try {
    OggPageHeader header = new OggPageHeader();
    if (!header.populate(input, true) || (header.type & 0x02) != 0x02) {
      return false;
    }

    int length = Math.min(header.bodySize, MAX_VERIFICATION_BYTES);
    ParsableByteArray scratch = new ParsableByteArray(length);
    input.peekFully(scratch.data, 0, length);

    if (FlacReader.verifyBitstreamType(resetPosition(scratch))) {
      streamReader = new FlacReader();
    } else if (VorbisReader.verifyBitstreamType(resetPosition(scratch))) {
      streamReader = new VorbisReader();
    } else if (OpusReader.verifyBitstreamType(resetPosition(scratch))) {
      streamReader = new OpusReader();
    } else {
      return false;
    }
    return true;
  } catch (ParserException e) {
    return false;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:27,代码来源:OggExtractor.java


示例4: processAtomEnded

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private void processAtomEnded(long atomEndPosition) throws ParserException {
  while (!containerAtoms.isEmpty() && containerAtoms.peek().endPosition == atomEndPosition) {
    Atom.ContainerAtom containerAtom = containerAtoms.pop();
    if (containerAtom.type == Atom.TYPE_moov) {
      // We've reached the end of the moov atom. Process it and prepare to read samples.
      processMoovAtom(containerAtom);
      containerAtoms.clear();
      parserState = STATE_READING_SAMPLE;
    } else if (!containerAtoms.isEmpty()) {
      containerAtoms.peek().add(containerAtom);
    }
  }
  if (parserState != STATE_READING_SAMPLE) {
    enterReadingAtomHeaderState();
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:17,代码来源:Mp4Extractor.java


示例5: parseSaio

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
/**
 * Parses a saio atom (defined in 14496-12).
 *
 * @param saio The saio atom to decode.
 * @param out The {@link TrackFragment} to populate with data from the saio atom.
 */
private static void parseSaio(ParsableByteArray saio, TrackFragment out) throws ParserException {
  saio.setPosition(Atom.HEADER_SIZE);
  int fullAtom = saio.readInt();
  int flags = Atom.parseFullAtomFlags(fullAtom);
  if ((flags & 0x01) == 1) {
    saio.skipBytes(8);
  }

  int entryCount = saio.readUnsignedIntToInt();
  if (entryCount != 1) {
    // We only support one trun element currently, so always expect one entry.
    throw new ParserException("Unexpected saio entry count: " + entryCount);
  }

  int version = Atom.parseFullAtomVersion(fullAtom);
  out.auxiliaryDataPosition +=
      version == 0 ? saio.readUnsignedInt() : saio.readUnsignedLongToLong();
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:25,代码来源:FragmentedMp4Extractor.java


示例6: parseSenc

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private static void parseSenc(ParsableByteArray senc, int offset, TrackFragment out)
    throws ParserException {
  senc.setPosition(Atom.HEADER_SIZE + offset);
  int fullAtom = senc.readInt();
  int flags = Atom.parseFullAtomFlags(fullAtom);

  if ((flags & 0x01 /* override_track_encryption_box_parameters */) != 0) {
    // TODO: Implement this.
    throw new ParserException("Overriding TrackEncryptionBox parameters is unsupported.");
  }

  boolean subsampleEncryption = (flags & 0x02 /* use_subsample_encryption */) != 0;
  int sampleCount = senc.readUnsignedIntToInt();
  if (sampleCount != out.sampleCount) {
    throw new ParserException("Length mismatch: " + sampleCount + ", " + out.sampleCount);
  }

  Arrays.fill(out.sampleHasSubsampleEncryptionTable, 0, sampleCount, subsampleEncryption);
  out.initEncryptionData(senc.bytesLeft());
  out.fillEncryptionData(senc);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:22,代码来源:FragmentedMp4Extractor.java


示例7: readEncryptionData

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private void readEncryptionData(ExtractorInput input) throws IOException, InterruptedException {
  TrackBundle nextTrackBundle = null;
  long nextDataOffset = Long.MAX_VALUE;
  int trackBundlesSize = trackBundles.size();
  for (int i = 0; i < trackBundlesSize; i++) {
    TrackFragment trackFragment = trackBundles.valueAt(i).fragment;
    if (trackFragment.sampleEncryptionDataNeedsFill
        && trackFragment.auxiliaryDataPosition < nextDataOffset) {
      nextDataOffset = trackFragment.auxiliaryDataPosition;
      nextTrackBundle = trackBundles.valueAt(i);
    }
  }
  if (nextTrackBundle == null) {
    parserState = STATE_READING_SAMPLE_START;
    return;
  }
  int bytesToSkip = (int) (nextDataOffset - input.getPosition());
  if (bytesToSkip < 0) {
    throw new ParserException("Offset to encryption data was negative.");
  }
  input.skipFully(bytesToSkip);
  nextTrackBundle.fragment.fillEncryptionData(input);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:24,代码来源:FragmentedMp4Extractor.java


示例8: stringElement

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
void stringElement(int id, String value) throws ParserException {
  switch (id) {
    case ID_DOC_TYPE:
      // Validate that DocType is supported.
      if (!DOC_TYPE_WEBM.equals(value) && !DOC_TYPE_MATROSKA.equals(value)) {
        throw new ParserException("DocType " + value + " not supported");
      }
      break;
    case ID_CODEC_ID:
      currentTrack.codecId = value;
      break;
    case ID_LANGUAGE:
      currentTrack.language = value;
      break;
    default:
      break;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:19,代码来源:MatroskaExtractor.java


示例9: parseMsAcmCodecPrivate

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
/**
 * Parses an MS/ACM codec private, returning whether it indicates PCM audio.
 *
 * @return Whether the codec private indicates PCM audio.
 * @throws ParserException If a parsing error occurs.
 */
private static boolean parseMsAcmCodecPrivate(ParsableByteArray buffer) throws ParserException {
  try {
    int formatTag = buffer.readLittleEndianUnsignedShort();
    if (formatTag == WAVE_FORMAT_PCM) {
      return true;
    } else if (formatTag == WAVE_FORMAT_EXTENSIBLE) {
      buffer.setPosition(WAVE_FORMAT_SIZE + 6); // unionSamples(2), channelMask(4)
      return buffer.readLong() == WAVE_SUBFORMAT_PCM.getMostSignificantBits()
          && buffer.readLong() == WAVE_SUBFORMAT_PCM.getLeastSignificantBits();
    } else {
      return false;
    }
  } catch (ArrayIndexOutOfBoundsException e) {
    throw new ParserException("Error parsing MS/ACM codec private");
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:23,代码来源:MatroskaExtractor.java


示例10: parsePayload

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
protected void parsePayload(ParsableByteArray data, long timeUs) throws ParserException {
  int nameType = readAmfType(data);
  if (nameType != AMF_TYPE_STRING) {
    // Should never happen.
    throw new ParserException();
  }
  String name = readAmfString(data);
  if (!NAME_METADATA.equals(name)) {
    // We're only interested in metadata.
    return;
  }
  int type = readAmfType(data);
  if (type != AMF_TYPE_ECMA_ARRAY) {
    // We're not interested in this metadata.
    return;
  }
  // Set the duration to the value contained in the metadata, if present.
  Map<String, Object> metadata = readAmfEcmaArray(data);
  if (metadata.containsKey(KEY_DURATION)) {
    double durationSeconds = (double) metadata.get(KEY_DURATION);
    if (durationSeconds > 0.0) {
      durationUs = (long) (durationSeconds * C.MICROS_PER_SECOND);
    }
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:27,代码来源:ScriptTagPayloadReader.java


示例11: parseTimestampAndSampleCount

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private boolean parseTimestampAndSampleCount(ExtractorInput input) throws IOException,
    InterruptedException {
  dataScratch.reset();
  if (version == 0) {
    if (!input.readFully(dataScratch.data, 0, TIMESTAMP_SIZE_V0 + 1, true)) {
      return false;
    }
    // version 0 timestamps are 45kHz, so we need to convert them into us
    timestampUs = dataScratch.readUnsignedInt() * 1000 / 45;
  } else if (version == 1) {
    if (!input.readFully(dataScratch.data, 0, TIMESTAMP_SIZE_V1 + 1, true)) {
      return false;
    }
    timestampUs = dataScratch.readLong();
  } else {
    throw new ParserException("Unsupported version number: " + version);
  }

  remainingSampleCount = dataScratch.readUnsignedByte();
  sampleBytesWritten = 0;
  return true;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:23,代码来源:RawCcExtractor.java


示例12: errorFor

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
static NoPlayer.PlayerError errorFor(Exception e) {
    if (e instanceof HttpDataSource.InvalidResponseCodeException) {
        return new NoPlayerError(PlayerErrorType.INVALID_RESPONSE_CODE, formatMessage(e));
    }

    if (e instanceof ParserException) {
        return new NoPlayerError(PlayerErrorType.MALFORMED_CONTENT, formatMessage(e));
    }

    Throwable cause = e.getCause();
    if (e.getCause() instanceof MediaCodec.CryptoException) {
        return new NoPlayerError(PlayerErrorType.FAILED_DRM_DECRYPTION, formatMessage(e));
    }

    if (cause instanceof StreamingModularDrm.DrmRequestException) {
        return new NoPlayerError(PlayerErrorType.FAILED_DRM_REQUEST, formatMessage(e));
    }

    if (e instanceof IOException || cause instanceof IOException) {
        return new NoPlayerError(PlayerErrorType.CONNECTIVITY_ERROR, cause == null ? formatMessage(e) : formatMessage(cause));
    }
    return new NoPlayerError(PlayerErrorType.UNKNOWN, formatMessage(e));
}
 
开发者ID:novoda,项目名称:no-player,代码行数:24,代码来源:ExoPlayerErrorMapper.java


示例13: parseStreamElementStartTag

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException {
  type = parseType(parser);
  putNormalizedAttribute(KEY_TYPE, type);
  if (type == C.TRACK_TYPE_TEXT) {
    subType = parseRequiredString(parser, KEY_SUB_TYPE);
  } else {
    subType = parser.getAttributeValue(null, KEY_SUB_TYPE);
  }
  name = parser.getAttributeValue(null, KEY_NAME);
  url = parseRequiredString(parser, KEY_URL);
  maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE);
  maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE);
  displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, Format.NO_VALUE);
  displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, Format.NO_VALUE);
  language = parser.getAttributeValue(null, KEY_LANGUAGE);
  putNormalizedAttribute(KEY_LANGUAGE, language);
  timescale = parseInt(parser, KEY_TIME_SCALE, -1);
  if (timescale == -1) {
    timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE);
  }
  startTimes = new ArrayList<>();
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:23,代码来源:SsManifestParser.java


示例14: readSampleGroup

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private void readSampleGroup(JsonReader reader, List<SampleGroup> groups) throws IOException {
  String groupName = "";
  ArrayList<Sample> samples = new ArrayList<>();

  reader.beginObject();
  while (reader.hasNext()) {
    String name = reader.nextName();
    switch (name) {
      case "name":
        groupName = reader.nextString();
        break;
      case "samples":
        reader.beginArray();
        while (reader.hasNext()) {
          samples.add(readEntry(reader, false));
        }
        reader.endArray();
        break;
      case "offline_samples":
        reader.beginArray();
        while (reader.hasNext()){
          samples.add(readOfflineEntry(reader));
        }
        reader.endArray();
        break;
      case "_comment":
        reader.nextString(); // Ignore.
        break;
      default:
        throw new ParserException("Unsupported name: " + name);
    }
  }
  reader.endObject();

  SampleGroup group = getGroup(groupName, groups);
  group.samples.addAll(samples);
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:38,代码来源:SampleChooserActivity.java


示例15: getDrmUuid

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private UUID getDrmUuid(String typeString) throws ParserException {
  switch (typeString.toLowerCase()) {
    case "widevine":
      return C.WIDEVINE_UUID;
    case "playready":
      return C.PLAYREADY_UUID;
    default:
      try {
        return UUID.fromString(typeString);
      } catch (RuntimeException e) {
        throw new ParserException("Unsupported drm type: " + typeString);
      }
  }
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:15,代码来源:SampleChooserActivity.java


示例16: onLoadCompleted

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
public void onLoadCompleted(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs,
    long loadDurationMs) {
  HlsPlaylist result = loadable.getResult();
  if (result instanceof HlsMediaPlaylist) {
    processLoadedPlaylist((HlsMediaPlaylist) result);
    eventDispatcher.loadCompleted(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs,
        loadDurationMs, loadable.bytesLoaded());
  } else {
    onLoadError(loadable, elapsedRealtimeMs, loadDurationMs,
        new ParserException("Loaded playlist has unexpected type."));
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:HlsPlaylistTracker.java


示例17: parse

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException {
  BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
  Queue<String> extraLines = new LinkedList<>();
  String line;
  try {
    if (!checkPlaylistHeader(reader)) {
      throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.",
          uri);
    }
    while ((line = reader.readLine()) != null) {
      line = line.trim();
      if (line.isEmpty()) {
        // Do nothing.
      } else if (line.startsWith(TAG_STREAM_INF)) {
        extraLines.add(line);
        return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString());
      } else if (line.startsWith(TAG_TARGET_DURATION)
          || line.startsWith(TAG_MEDIA_SEQUENCE)
          || line.startsWith(TAG_MEDIA_DURATION)
          || line.startsWith(TAG_KEY)
          || line.startsWith(TAG_BYTERANGE)
          || line.equals(TAG_DISCONTINUITY)
          || line.equals(TAG_DISCONTINUITY_SEQUENCE)
          || line.equals(TAG_ENDLIST)) {
        extraLines.add(line);
        return parseMediaPlaylist(new LineIterator(extraLines, reader), uri.toString());
      } else {
        extraLines.add(line);
      }
    }
  } finally {
    Util.closeQuietly(reader);
  }
  throw new ParserException("Failed to parse the playlist, could not identify any tags.");
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:37,代码来源:HlsPlaylistParser.java


示例18: parseStringAttr

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
private static String parseStringAttr(String line, Pattern pattern) throws ParserException {
  Matcher matcher = pattern.matcher(line);
  if (matcher.find() && matcher.groupCount() == 1) {
    return matcher.group(1);
  }
  throw new ParserException("Couldn't match " + pattern.pattern() + " in " + line);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:8,代码来源:HlsPlaylistParser.java


示例19: skipToData

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
/**
 * Skips to the data in the given WAV input stream and returns its data size. After calling, the
 * input stream's position will point to the start of sample data in the WAV.
 * <p>
 * If an exception is thrown, the input position will be left pointing to a chunk header.
 *
 * @param input Input stream to skip to the data chunk in. Its peek position must be pointing to
 *     a valid chunk header.
 * @param wavHeader WAV header to populate with data bounds.
 * @throws ParserException If an error occurs parsing chunks.
 * @throws IOException If reading from the input fails.
 * @throws InterruptedException If interrupted while reading from input.
 */
public static void skipToData(ExtractorInput input, WavHeader wavHeader)
    throws IOException, InterruptedException {
  Assertions.checkNotNull(input);
  Assertions.checkNotNull(wavHeader);

  // Make sure the peek position is set to the read position before we peek the first header.
  input.resetPeekPosition();

  ParsableByteArray scratch = new ParsableByteArray(ChunkHeader.SIZE_IN_BYTES);
  // Skip all chunks until we hit the data header.
  ChunkHeader chunkHeader = ChunkHeader.peek(input, scratch);
  while (chunkHeader.id != Util.getIntegerCodeForString("data")) {
    Log.w(TAG, "Ignoring unknown WAV chunk: " + chunkHeader.id);
    long bytesToSkip = ChunkHeader.SIZE_IN_BYTES + chunkHeader.size;
    // Override size of RIFF chunk, since it describes its size as the entire file.
    if (chunkHeader.id == Util.getIntegerCodeForString("RIFF")) {
      bytesToSkip = ChunkHeader.SIZE_IN_BYTES + 4;
    }
    if (bytesToSkip > Integer.MAX_VALUE) {
      throw new ParserException("Chunk is too large (~2GB+) to skip; id: " + chunkHeader.id);
    }
    input.skipFully((int) bytesToSkip);
    chunkHeader = ChunkHeader.peek(input, scratch);
  }
  // Skip past the "data" header.
  input.skipFully(ChunkHeader.SIZE_IN_BYTES);

  wavHeader.setDataBounds(input.getPosition(), chunkHeader.size);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:43,代码来源:WavHeaderReader.java


示例20: read

import com.google.android.exoplayer2.ParserException; //导入依赖的package包/类
@Override
public int read(ExtractorInput input, PositionHolder seekPosition)
    throws IOException, InterruptedException {
  if (wavHeader == null) {
    wavHeader = WavHeaderReader.peek(input);
    if (wavHeader == null) {
      // Should only happen if the media wasn't sniffed.
      throw new ParserException("Unsupported or unrecognized wav header.");
    }
    Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, null,
        wavHeader.getBitrate(), MAX_INPUT_SIZE, wavHeader.getNumChannels(),
        wavHeader.getSampleRateHz(), wavHeader.getEncoding(), null, null, 0, null);
    trackOutput.format(format);
    bytesPerFrame = wavHeader.getBytesPerFrame();
  }

  if (!wavHeader.hasDataBounds()) {
    WavHeaderReader.skipToData(input, wavHeader);
    extractorOutput.seekMap(this);
  }

  int bytesAppended = trackOutput.sampleData(input, MAX_INPUT_SIZE - pendingBytes, true);
  if (bytesAppended != RESULT_END_OF_INPUT) {
    pendingBytes += bytesAppended;
  }

  // Samples must consist of a whole number of frames.
  int pendingFrames = pendingBytes / bytesPerFrame;
  if (pendingFrames > 0) {
    long timeUs = wavHeader.getTimeUs(input.getPosition() - pendingBytes);
    int size = pendingFrames * bytesPerFrame;
    pendingBytes -= size;
    trackOutput.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, size, pendingBytes, null);
  }

  return bytesAppended == RESULT_END_OF_INPUT ? RESULT_END_OF_INPUT : RESULT_CONTINUE;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:38,代码来源:WavExtractor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Route类代码示例发布时间:2022-05-22
下一篇:
Java DropDown类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap