Java 类com.google.android.exoplayer.extractor.ExtractorOutput 实例源码

项目:miku    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  // Skip pointer.
  if (payloadUnitStartIndicator) {
    int pointerField = data.readUnsignedByte();
    data.skipBytes(pointerField);
  }

  data.readBytes(patScratch, 3);
  patScratch.skipBits(12); // table_id (8), section_syntax_indicator (1), '0' (1), reserved (2)
  int sectionLength = patScratch.readBits(12);
  // transport_stream_id (16), reserved (2), version_number (5), current_next_indicator (1),
  // section_number (8), last_section_number (8)
  data.skipBytes(5);

  int programCount = (sectionLength - 9) / 4;
  for (int i = 0; i < programCount; i++) {
    data.readBytes(patScratch, 4);
    patScratch.skipBits(19); // program_number (16), reserved (3)
    int pid = patScratch.readBits(13);
    tsPayloadReaders.put(pid, new PmtReader());
  }

  // Skip CRC_32.
}
项目:ExoPlayer    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  // Skip pointer.
  if (payloadUnitStartIndicator) {
    int pointerField = data.readUnsignedByte();
    data.skipBytes(pointerField);
  }

  data.readBytes(patScratch, 3);
  patScratch.skipBits(12); // table_id (8), section_syntax_indicator (1), '0' (1), reserved (2)
  int sectionLength = patScratch.readBits(12);
  // transport_stream_id (16), reserved (2), version_number (5), current_next_indicator (1),
  // section_number (8), last_section_number (8)
  data.skipBytes(5);

  int programCount = (sectionLength - 9) / 4;
  for (int i = 0; i < programCount; i++) {
    data.readBytes(patScratch, 4);
    patScratch.skipBits(19); // program_number (16), reserved (3)
    int pid = patScratch.readBits(13);
    tsPayloadReaders.put(pid, new PmtReader());
  }

  // Skip CRC_32.
}
项目:ExoPlayer-Demo    文件:FlacExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  this.trackOutput = output.track(0);
  output.endTracks();

  try {
    decoder = new FlacJni();
  } catch (FlacDecoderException e) {
    throw new RuntimeException(e);
  }
}
项目:ExoPlayer-Demo    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  // Skip pointer.
  if (payloadUnitStartIndicator) {
    int pointerField = data.readUnsignedByte();
    data.skipBytes(pointerField);
  }

  data.readBytes(patScratch, 3);
  patScratch.skipBits(12); // table_id (8), section_syntax_indicator (1), '0' (1), reserved (2)
  int sectionLength = patScratch.readBits(12);
  // transport_stream_id (16), reserved (2), version_number (5), current_next_indicator (1),
  // section_number (8), last_section_number (8)
  data.skipBytes(5);

  int programCount = (sectionLength - 9) / 4;
  for (int i = 0; i < programCount; i++) {
    data.readBytes(patScratch, 4);
    int programNumber = patScratch.readBits(16);
    patScratch.skipBits(3); // reserved (3)
    if (programNumber == 0) {
      patScratch.skipBits(13); // network_PID (13)
    } else {
      int pid = patScratch.readBits(13);
      tsPayloadReaders.put(pid, new PmtReader());
    }
  }

  // Skip CRC_32.
}
项目:ExoPlayer-Demo    文件:PsExtractor.java   
/**
 * Consumes the payload of a PS packet.
 *
 * @param data The PES packet. The position will be set to the start of the payload.
 * @param output The output to which parsed data should be written.
 */
public void consume(ParsableByteArray data, ExtractorOutput output) {
  data.readBytes(pesScratch.data, 0, 3);
  pesScratch.setPosition(0);
  parseHeader();
  data.readBytes(pesScratch.data, 0, extendedHeaderLength);
  pesScratch.setPosition(0);
  parseHeaderExtension();
  pesPayloadReader.packetStarted(timeUs, true);
  pesPayloadReader.consume(data);
  // We always have complete PES packets with program stream.
  pesPayloadReader.packetFinished();
}
项目:ExoPlayer-Demo    文件:WavExtractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
  trackOutput = output.track(0);
  wavHeader = null;
  output.endTracks();
}
项目:ExoPlayer-Demo    文件:FragmentedMp4Extractor.java   
@Override
public final void init(ExtractorOutput output) {
  extractorOutput = output;
  if (sideloadedTrack != null) {
    TrackBundle bundle = new TrackBundle(output.track(0));
    bundle.init(sideloadedTrack, new DefaultSampleValues(0, 0, 0, 0));
    trackBundles.put(0, bundle);
    extractorOutput.endTracks();
  }
}
项目:miku    文件:AdtsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  adtsReader = new AdtsReader(output.track(0));
  output.endTracks();
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:miku    文件:TsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:miku    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  if (payloadUnitStartIndicator) {
    switch (state) {
      case STATE_FINDING_HEADER:
      case STATE_READING_HEADER:
        // Expected.
        break;
      case STATE_READING_HEADER_EXTENSION:
        Log.w(TAG, "Unexpected start indicator reading extended header");
        break;
      case STATE_READING_BODY:
        // If payloadSize == -1 then the length of the previous packet was unspecified, and so
        // we only know that it's finished now that we've seen the start of the next one. This
        // is expected. If payloadSize != -1, then the length of the previous packet was known,
        // but we didn't receive that amount of data. This is not expected.
        if (payloadSize != -1) {
          Log.w(TAG, "Unexpected start indicator: expected " + payloadSize + " more bytes");
        }
        // Either way, if the body was started, notify the reader that it has now finished.
        if (bodyStarted) {
          pesPayloadReader.packetFinished();
        }
        break;
    }
    setState(STATE_READING_HEADER);
  }

  while (data.bytesLeft() > 0) {
    switch (state) {
      case STATE_FINDING_HEADER:
        data.skipBytes(data.bytesLeft());
        break;
      case STATE_READING_HEADER:
        if (continueRead(data, pesScratch.data, HEADER_SIZE)) {
          setState(parseHeader() ? STATE_READING_HEADER_EXTENSION : STATE_FINDING_HEADER);
        }
        break;
      case STATE_READING_HEADER_EXTENSION:
        int readLength = Math.min(MAX_HEADER_EXTENSION_SIZE, extendedHeaderLength);
        // Read as much of the extended header as we're interested in, and skip the rest.
        if (continueRead(data, pesScratch.data, readLength)
            && continueRead(data, null, extendedHeaderLength)) {
          parseHeaderExtension();
          bodyStarted = false;
          setState(STATE_READING_BODY);
        }
        break;
      case STATE_READING_BODY:
        readLength = data.bytesLeft();
        int padding = payloadSize == -1 ? 0 : readLength - payloadSize;
        if (padding > 0) {
          readLength -= padding;
          data.setLimit(data.getPosition() + readLength);
        }
        pesPayloadReader.consume(data, timeUs, !bodyStarted);
        bodyStarted = true;
        if (payloadSize != -1) {
          payloadSize -= readLength;
          if (payloadSize == 0) {
            pesPayloadReader.packetFinished();
            setState(STATE_READING_HEADER);
          }
        }
        break;
    }
  }
}
项目:miku    文件:Mp4Extractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:miku    文件:FragmentedMp4Extractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
  trackOutput = output.track(0);
  extractorOutput.endTracks();
}
项目:miku    文件:Mp3Extractor.java   
@Override
public void init(ExtractorOutput extractorOutput) {
  this.extractorOutput = extractorOutput;
  trackOutput = extractorOutput.track(0);
  extractorOutput.endTracks();
}
项目:miku    文件:WebmExtractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:ExoPlayer-Demo    文件:WebvttExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer-Demo    文件:AdtsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  adtsReader = new AdtsReader(output.track(0), output.track(1));
  output.endTracks();
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer-Demo    文件:TsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer-Demo    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  if (payloadUnitStartIndicator) {
    switch (state) {
      case STATE_FINDING_HEADER:
      case STATE_READING_HEADER:
        // Expected.
        break;
      case STATE_READING_HEADER_EXTENSION:
        Log.w(TAG, "Unexpected start indicator reading extended header");
        break;
      case STATE_READING_BODY:
        // If payloadSize == -1 then the length of the previous packet was unspecified, and so
        // we only know that it's finished now that we've seen the start of the next one. This
        // is expected. If payloadSize != -1, then the length of the previous packet was known,
        // but we didn't receive that amount of data. This is not expected.
        if (payloadSize != -1) {
          Log.w(TAG, "Unexpected start indicator: expected " + payloadSize + " more bytes");
        }
        // Either way, notify the reader that it has now finished.
        pesPayloadReader.packetFinished();
        break;
    }
    setState(STATE_READING_HEADER);
  }

  while (data.bytesLeft() > 0) {
    switch (state) {
      case STATE_FINDING_HEADER:
        data.skipBytes(data.bytesLeft());
        break;
      case STATE_READING_HEADER:
        if (continueRead(data, pesScratch.data, HEADER_SIZE)) {
          setState(parseHeader() ? STATE_READING_HEADER_EXTENSION : STATE_FINDING_HEADER);
        }
        break;
      case STATE_READING_HEADER_EXTENSION:
        int readLength = Math.min(MAX_HEADER_EXTENSION_SIZE, extendedHeaderLength);
        // Read as much of the extended header as we're interested in, and skip the rest.
        if (continueRead(data, pesScratch.data, readLength)
            && continueRead(data, null, extendedHeaderLength)) {
          parseHeaderExtension();
          pesPayloadReader.packetStarted(timeUs, dataAlignmentIndicator);
          setState(STATE_READING_BODY);
        }
        break;
      case STATE_READING_BODY:
        readLength = data.bytesLeft();
        int padding = payloadSize == -1 ? 0 : readLength - payloadSize;
        if (padding > 0) {
          readLength -= padding;
          data.setLimit(data.getPosition() + readLength);
        }
        pesPayloadReader.consume(data);
        if (payloadSize != -1) {
          payloadSize -= readLength;
          if (payloadSize == 0) {
            pesPayloadReader.packetFinished();
            setState(STATE_READING_HEADER);
          }
        }
        break;
    }
  }
}
项目:ExoPlayer-Demo    文件:PsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer-Demo    文件:OggExtractor.java   
@Override
public void init(ExtractorOutput output) {
  TrackOutput trackOutput = output.track(0);
  output.endTracks();
  streamReader.init(output, trackOutput);
}
项目:ExoPlayer-Demo    文件:StreamReader.java   
void init(ExtractorOutput output, TrackOutput trackOutput) {
  this.extractorOutput = output;
  this.trackOutput = trackOutput;
}
项目:ExoPlayer-Demo    文件:Mp4Extractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:ExoPlayer-Demo    文件:FlvExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.extractorOutput = output;
}
项目:ExoPlayer-Demo    文件:Mp3Extractor.java   
@Override
public void init(ExtractorOutput extractorOutput) {
  this.extractorOutput = extractorOutput;
  trackOutput = extractorOutput.track(0);
  extractorOutput.endTracks();
}
项目:ExoPlayer-Demo    文件:WebmExtractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:ExoPlayer    文件:AdtsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  adtsReader = new AdtsReader(output.track(0));
  output.endTracks();
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer    文件:TsExtractor.java   
@Override
public void init(ExtractorOutput output) {
  this.output = output;
  output.seekMap(SeekMap.UNSEEKABLE);
}
项目:ExoPlayer    文件:TsExtractor.java   
@Override
public void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output) {
  if (payloadUnitStartIndicator) {
    switch (state) {
      case STATE_FINDING_HEADER:
      case STATE_READING_HEADER:
        // Expected.
        break;
      case STATE_READING_HEADER_EXTENSION:
        Log.w(TAG, "Unexpected start indicator reading extended header");
        break;
      case STATE_READING_BODY:
        // If payloadSize == -1 then the length of the previous packet was unspecified, and so
        // we only know that it's finished now that we've seen the start of the next one. This
        // is expected. If payloadSize != -1, then the length of the previous packet was known,
        // but we didn't receive that amount of data. This is not expected.
        if (payloadSize != -1) {
          Log.w(TAG, "Unexpected start indicator: expected " + payloadSize + " more bytes");
        }
        // Either way, if the body was started, notify the reader that it has now finished.
        if (bodyStarted) {
          pesPayloadReader.packetFinished();
        }
        break;
    }
    setState(STATE_READING_HEADER);
  }

  while (data.bytesLeft() > 0) {
    switch (state) {
      case STATE_FINDING_HEADER:
        data.skipBytes(data.bytesLeft());
        break;
      case STATE_READING_HEADER:
        if (continueRead(data, pesScratch.data, HEADER_SIZE)) {
          setState(parseHeader() ? STATE_READING_HEADER_EXTENSION : STATE_FINDING_HEADER);
        }
        break;
      case STATE_READING_HEADER_EXTENSION:
        int readLength = Math.min(MAX_HEADER_EXTENSION_SIZE, extendedHeaderLength);
        // Read as much of the extended header as we're interested in, and skip the rest.
        if (continueRead(data, pesScratch.data, readLength)
            && continueRead(data, null, extendedHeaderLength)) {
          parseHeaderExtension();
          bodyStarted = false;
          setState(STATE_READING_BODY);
        }
        break;
      case STATE_READING_BODY:
        readLength = data.bytesLeft();
        int padding = payloadSize == -1 ? 0 : readLength - payloadSize;
        if (padding > 0) {
          readLength -= padding;
          data.setLimit(data.getPosition() + readLength);
        }
        pesPayloadReader.consume(data, timeUs, !bodyStarted);
        bodyStarted = true;
        if (payloadSize != -1) {
          payloadSize -= readLength;
          if (payloadSize == 0) {
            pesPayloadReader.packetFinished();
            setState(STATE_READING_HEADER);
          }
        }
        break;
    }
  }
}
项目:ExoPlayer    文件:Mp4Extractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:ExoPlayer    文件:FragmentedMp4Extractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
  trackOutput = output.track(0);
  extractorOutput.endTracks();
}
项目:ExoPlayer    文件:Mp3Extractor.java   
@Override
public void init(ExtractorOutput extractorOutput) {
  this.extractorOutput = extractorOutput;
  trackOutput = extractorOutput.track(0);
  extractorOutput.endTracks();
}
项目:ExoPlayer    文件:WebmExtractor.java   
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
}
项目:miku    文件:TsExtractor.java   
/**
 * Consumes the payload of a TS packet.
 *
 * @param data The TS packet. The position will be set to the start of the payload.
 * @param payloadUnitStartIndicator Whether payloadUnitStartIndicator was set on the TS packet.
 * @param output The output to which parsed data should be written.
 */
public abstract void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output);
项目:ExoPlayer-Demo    文件:TsExtractor.java   
/**
 * Consumes the payload of a TS packet.
 *
 * @param data The TS packet. The position will be set to the start of the payload.
 * @param payloadUnitStartIndicator Whether payloadUnitStartIndicator was set on the TS packet.
 * @param output The output to which parsed data should be written.
 */
public abstract void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output);
项目:ExoPlayer    文件:TsExtractor.java   
/**
 * Consumes the payload of a TS packet.
 *
 * @param data The TS packet. The position will be set to the start of the payload.
 * @param payloadUnitStartIndicator Whether payloadUnitStartIndicator was set on the TS packet.
 * @param output The output to which parsed data should be written.
 */
public abstract void consume(ParsableByteArray data, boolean payloadUnitStartIndicator,
    ExtractorOutput output);