Java Code Examples for com.google.android.exoplayer2.util.NalUnitUtil#NAL_START_CODE

The following examples show how to use com.google.android.exoplayer2.util.NalUnitUtil#NAL_START_CODE . 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: MatroskaExtractor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
MatroskaExtractor(EbmlReader reader, @Flags int flags) {
  this.reader = reader;
  this.reader.init(new InnerEbmlReaderOutput());
  seekForCuesEnabled = (flags & FLAG_DISABLE_SEEK_FOR_CUES) == 0;
  varintReader = new VarintReader();
  tracks = new SparseArray<>();
  scratch = new ParsableByteArray(4);
  vorbisNumPageSamples = new ParsableByteArray(ByteBuffer.allocate(4).putInt(-1).array());
  seekEntryIdBytes = new ParsableByteArray(4);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  sampleStrippedBytes = new ParsableByteArray();
  subtitleSample = new ParsableByteArray();
  encryptionInitializationVector = new ParsableByteArray(ENCRYPTION_IV_SIZE);
  encryptionSubsampleData = new ParsableByteArray();
}
 
Example 2
Source File: MatroskaExtractor.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
MatroskaExtractor(EbmlReader reader, @Flags int flags) {
  this.reader = reader;
  this.reader.init(new InnerEbmlProcessor());
  seekForCuesEnabled = (flags & FLAG_DISABLE_SEEK_FOR_CUES) == 0;
  varintReader = new VarintReader();
  tracks = new SparseArray<>();
  scratch = new ParsableByteArray(4);
  vorbisNumPageSamples = new ParsableByteArray(ByteBuffer.allocate(4).putInt(-1).array());
  seekEntryIdBytes = new ParsableByteArray(4);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  sampleStrippedBytes = new ParsableByteArray();
  subtitleSample = new ParsableByteArray();
  encryptionInitializationVector = new ParsableByteArray(ENCRYPTION_IV_SIZE);
  encryptionSubsampleData = new ParsableByteArray();
}
 
Example 3
Source File: FragmentedMp4Extractor.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * @param flags Flags that control the extractor's behavior.
 * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed.
 * @param sideloadedTrack Sideloaded track information, in the case that the extractor
 *     will not receive a moov box in the input data.
 */
public FragmentedMp4Extractor(@Flags int flags, TimestampAdjuster timestampAdjuster,
    Track sideloadedTrack) {
  this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0);
  this.timestampAdjuster = timestampAdjuster;
  this.sideloadedTrack = sideloadedTrack;
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalPrefix = new ParsableByteArray(5);
  nalBuffer = new ParsableByteArray();
  encryptionSignalByte = new ParsableByteArray(1);
  extendedTypeScratch = new byte[16];
  containerAtoms = new Stack<>();
  pendingMetadataSampleInfos = new LinkedList<>();
  trackBundles = new SparseArray<>();
  durationUs = C.TIME_UNSET;
  segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET;
  enterReadingAtomHeaderState();
}
 
Example 4
Source File: MatroskaExtractor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
MatroskaExtractor(EbmlReader reader, @Flags int flags) {
  this.reader = reader;
  this.reader.init(new InnerEbmlReaderOutput());
  seekForCuesEnabled = (flags & FLAG_DISABLE_SEEK_FOR_CUES) == 0;
  varintReader = new VarintReader();
  tracks = new SparseArray<>();
  scratch = new ParsableByteArray(4);
  vorbisNumPageSamples = new ParsableByteArray(ByteBuffer.allocate(4).putInt(-1).array());
  seekEntryIdBytes = new ParsableByteArray(4);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  sampleStrippedBytes = new ParsableByteArray();
  subtitleSample = new ParsableByteArray();
  encryptionInitializationVector = new ParsableByteArray(ENCRYPTION_IV_SIZE);
  encryptionSubsampleData = new ParsableByteArray();
}
 
Example 5
Source File: FragmentedMp4Extractor.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param flags Flags that control the extractor's behavior.
 * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed.
 * @param sideloadedTrack Sideloaded track information, in the case that the extractor will not
 *     receive a moov box in the input data. Null if a moov box is expected.
 * @param sideloadedDrmInitData The {@link DrmInitData} to use for encrypted tracks. If null, the
 *     pssh boxes (if present) will be used.
 * @param closedCaptionFormats For tracks that contain SEI messages, the formats of the closed
 *     caption channels to expose.
 * @param additionalEmsgTrackOutput An extra track output that will receive all emsg messages
 *     targeting the player, even if {@link #FLAG_ENABLE_EMSG_TRACK} is not set. Null if special
 *     handling of emsg messages for players is not required.
 */
public FragmentedMp4Extractor(
    @Flags int flags,
    @Nullable TimestampAdjuster timestampAdjuster,
    @Nullable Track sideloadedTrack,
    @Nullable DrmInitData sideloadedDrmInitData,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput additionalEmsgTrackOutput) {
  this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0);
  this.timestampAdjuster = timestampAdjuster;
  this.sideloadedTrack = sideloadedTrack;
  this.sideloadedDrmInitData = sideloadedDrmInitData;
  this.closedCaptionFormats = Collections.unmodifiableList(closedCaptionFormats);
  this.additionalEmsgTrackOutput = additionalEmsgTrackOutput;
  eventMessageEncoder = new EventMessageEncoder();
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalPrefix = new ParsableByteArray(5);
  nalBuffer = new ParsableByteArray();
  scratchBytes = new byte[16];
  scratch = new ParsableByteArray(scratchBytes);
  containerAtoms = new ArrayDeque<>();
  pendingMetadataSampleInfos = new ArrayDeque<>();
  trackBundles = new SparseArray<>();
  durationUs = C.TIME_UNSET;
  pendingSeekTimeUs = C.TIME_UNSET;
  segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET;
  enterReadingAtomHeaderState();
}
 
Example 6
Source File: FragmentedMp4Extractor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param flags Flags that control the extractor's behavior.
 * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed.
 * @param sideloadedTrack Sideloaded track information, in the case that the extractor will not
 *     receive a moov box in the input data. Null if a moov box is expected.
 * @param sideloadedDrmInitData The {@link DrmInitData} to use for encrypted tracks. If null, the
 *     pssh boxes (if present) will be used.
 * @param closedCaptionFormats For tracks that contain SEI messages, the formats of the closed
 *     caption channels to expose.
 * @param additionalEmsgTrackOutput An extra track output that will receive all emsg messages
 *     targeting the player, even if {@link #FLAG_ENABLE_EMSG_TRACK} is not set. Null if special
 *     handling of emsg messages for players is not required.
 */
public FragmentedMp4Extractor(
    @Flags int flags,
    @Nullable TimestampAdjuster timestampAdjuster,
    @Nullable Track sideloadedTrack,
    @Nullable DrmInitData sideloadedDrmInitData,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput additionalEmsgTrackOutput) {
  this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0);
  this.timestampAdjuster = timestampAdjuster;
  this.sideloadedTrack = sideloadedTrack;
  this.sideloadedDrmInitData = sideloadedDrmInitData;
  this.closedCaptionFormats = Collections.unmodifiableList(closedCaptionFormats);
  this.additionalEmsgTrackOutput = additionalEmsgTrackOutput;
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalPrefix = new ParsableByteArray(5);
  nalBuffer = new ParsableByteArray();
  extendedTypeScratch = new byte[16];
  containerAtoms = new ArrayDeque<>();
  pendingMetadataSampleInfos = new ArrayDeque<>();
  trackBundles = new SparseArray<>();
  durationUs = C.TIME_UNSET;
  pendingSeekTimeUs = C.TIME_UNSET;
  segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET;
  enterReadingAtomHeaderState();
}
 
Example 7
Source File: Mp4Extractor.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new extractor for unfragmented MP4 streams, using the specified flags to control the
 * extractor's behavior.
 *
 * @param flags Flags that control the extractor's behavior.
 */
public Mp4Extractor(@Flags int flags) {
  this.flags = flags;
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  containerAtoms = new ArrayDeque<>();
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  scratch = new ParsableByteArray();
  sampleTrackIndex = C.INDEX_UNSET;
}
 
Example 8
Source File: Mp4Extractor.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new extractor for unfragmented MP4 streams, using the specified flags to control the
 * extractor's behavior.
 *
 * @param flags Flags that control the extractor's behavior.
 */
public Mp4Extractor(@Flags int flags) {
  this.flags = flags;
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  containerAtoms = new ArrayDeque<>();
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  scratch = new ParsableByteArray();
  sampleTrackIndex = C.INDEX_UNSET;
}
 
Example 9
Source File: MatroskaExtractor.java    From K-Sonic with MIT License 5 votes vote down vote up
MatroskaExtractor(EbmlReader reader) {
  this.reader = reader;
  this.reader.init(new InnerEbmlReaderOutput());
  varintReader = new VarintReader();
  tracks = new SparseArray<>();
  scratch = new ParsableByteArray(4);
  vorbisNumPageSamples = new ParsableByteArray(ByteBuffer.allocate(4).putInt(-1).array());
  seekEntryIdBytes = new ParsableByteArray(4);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  sampleStrippedBytes = new ParsableByteArray();
  subripSample = new ParsableByteArray();
  encryptionInitializationVector = new ParsableByteArray(ENCRYPTION_IV_SIZE);
  encryptionSubsampleData = new ParsableByteArray();
}
 
Example 10
Source File: Mp4Extractor.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new extractor for unfragmented MP4 streams, using the specified flags to control the
 * extractor's behavior.
 *
 * @param flags Flags that control the extractor's behavior.
 */
public Mp4Extractor(@Flags int flags) {
  this.flags = flags;
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  containerAtoms = new ArrayDeque<>();
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
  scratch = new ParsableByteArray();
  sampleTrackIndex = C.INDEX_UNSET;
}
 
Example 11
Source File: FragmentedMp4Extractor.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param flags Flags that control the extractor's behavior.
 * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed.
 * @param sideloadedTrack Sideloaded track information, in the case that the extractor will not
 *     receive a moov box in the input data. Null if a moov box is expected.
 * @param sideloadedDrmInitData The {@link DrmInitData} to use for encrypted tracks. If null, the
 *     pssh boxes (if present) will be used.
 * @param closedCaptionFormats For tracks that contain SEI messages, the formats of the closed
 *     caption channels to expose.
 * @param additionalEmsgTrackOutput An extra track output that will receive all emsg messages
 *     targeting the player, even if {@link #FLAG_ENABLE_EMSG_TRACK} is not set. Null if special
 *     handling of emsg messages for players is not required.
 */
public FragmentedMp4Extractor(
    @Flags int flags,
    @Nullable TimestampAdjuster timestampAdjuster,
    @Nullable Track sideloadedTrack,
    @Nullable DrmInitData sideloadedDrmInitData,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput additionalEmsgTrackOutput) {
  this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0);
  this.timestampAdjuster = timestampAdjuster;
  this.sideloadedTrack = sideloadedTrack;
  this.sideloadedDrmInitData = sideloadedDrmInitData;
  this.closedCaptionFormats = Collections.unmodifiableList(closedCaptionFormats);
  this.additionalEmsgTrackOutput = additionalEmsgTrackOutput;
  eventMessageEncoder = new EventMessageEncoder();
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalPrefix = new ParsableByteArray(5);
  nalBuffer = new ParsableByteArray();
  scratchBytes = new byte[16];
  scratch = new ParsableByteArray(scratchBytes);
  containerAtoms = new ArrayDeque<>();
  pendingMetadataSampleInfos = new ArrayDeque<>();
  trackBundles = new SparseArray<>();
  durationUs = C.TIME_UNSET;
  pendingSeekTimeUs = C.TIME_UNSET;
  segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET;
  enterReadingAtomHeaderState();
}
 
Example 12
Source File: FragmentedMp4Extractor.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @param flags Flags that control the extractor's behavior.
 * @param timestampAdjuster Adjusts sample timestamps. May be null if no adjustment is needed.
 * @param sideloadedTrack Sideloaded track information, in the case that the extractor will not
 *     receive a moov box in the input data. Null if a moov box is expected.
 * @param sideloadedDrmInitData The {@link DrmInitData} to use for encrypted tracks. If null, the
 *     pssh boxes (if present) will be used.
 * @param closedCaptionFormats For tracks that contain SEI messages, the formats of the closed
 *     caption channels to expose.
 * @param additionalEmsgTrackOutput An extra track output that will receive all emsg messages
 *     targeting the player, even if {@link #FLAG_ENABLE_EMSG_TRACK} is not set. Null if special
 *     handling of emsg messages for players is not required.
 */
public FragmentedMp4Extractor(
    @Flags int flags,
    @Nullable TimestampAdjuster timestampAdjuster,
    @Nullable Track sideloadedTrack,
    @Nullable DrmInitData sideloadedDrmInitData,
    List<Format> closedCaptionFormats,
    @Nullable TrackOutput additionalEmsgTrackOutput) {
  this.flags = flags | (sideloadedTrack != null ? FLAG_SIDELOADED : 0);
  this.timestampAdjuster = timestampAdjuster;
  this.sideloadedTrack = sideloadedTrack;
  this.sideloadedDrmInitData = sideloadedDrmInitData;
  this.closedCaptionFormats = Collections.unmodifiableList(closedCaptionFormats);
  this.additionalEmsgTrackOutput = additionalEmsgTrackOutput;
  eventMessageEncoder = new EventMessageEncoder();
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalPrefix = new ParsableByteArray(5);
  nalBuffer = new ParsableByteArray();
  scratchBytes = new byte[16];
  scratch = new ParsableByteArray(scratchBytes);
  containerAtoms = new ArrayDeque<>();
  pendingMetadataSampleInfos = new ArrayDeque<>();
  trackBundles = new SparseArray<>();
  durationUs = C.TIME_UNSET;
  pendingSeekTimeUs = C.TIME_UNSET;
  segmentIndexEarliestPresentationTimeUs = C.TIME_UNSET;
  enterReadingAtomHeaderState();
}
 
Example 13
Source File: VideoTagPayloadReader.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 14
Source File: VideoTagPayloadReader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 15
Source File: VideoTagPayloadReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 16
Source File: VideoTagPayloadReader.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 17
Source File: VideoTagPayloadReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 18
Source File: VideoTagPayloadReader.java    From LiveVideoBroadcaster with Apache License 2.0 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 19
Source File: Mp4Extractor.java    From K-Sonic with MIT License 4 votes vote down vote up
public Mp4Extractor() {
  atomHeader = new ParsableByteArray(Atom.LONG_HEADER_SIZE);
  containerAtoms = new Stack<>();
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}
 
Example 20
Source File: VideoTagPayloadReader.java    From K-Sonic with MIT License 4 votes vote down vote up
/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
public VideoTagPayloadReader(TrackOutput output) {
  super(output);
  nalStartCode = new ParsableByteArray(NalUnitUtil.NAL_START_CODE);
  nalLength = new ParsableByteArray(4);
}