Java Code Examples for com.google.android.exoplayer.SampleSource#SAMPLE_READ
The following examples show how to use
com.google.android.exoplayer.SampleSource#SAMPLE_READ .
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: VLCSampleExtractor.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public int readSample(int track, SampleHolder sampleHolder) throws IOException { Assertions.checkState(prepared); long ct = lib.getTime(); sampleHolder.timeUs = ct * ExoVlcUtil.MS_2_MICRO; sampleHolder.flags = android.media.MediaExtractor.SAMPLE_FLAG_SYNC; return ct >= 0L ? SampleSource.SAMPLE_READ : SampleSource.END_OF_STREAM; }
Example 2
Source File: FrameworkSampleExtractor.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public int readSample(int track, SampleHolder sampleHolder) { int sampleTrack = mediaExtractor.getSampleTrackIndex(); if (sampleTrack != track) { return sampleTrack < 0 ? SampleSource.END_OF_STREAM : SampleSource.NOTHING_READ; } if (sampleHolder.data != null) { int offset = sampleHolder.data.position(); sampleHolder.size = mediaExtractor.readSampleData(sampleHolder.data, offset); sampleHolder.data.position(offset + sampleHolder.size); } else { sampleHolder.size = 0; } sampleHolder.timeUs = mediaExtractor.getSampleTime(); sampleHolder.flags = mediaExtractor.getSampleFlags(); if ((sampleHolder.flags & MediaExtractor.SAMPLE_FLAG_ENCRYPTED) != 0) { sampleHolder.cryptoInfo.setFromExtractorV16(mediaExtractor); } // // yy debug stuff // if (MediaCodecVideoTrackRenderer.bb == null) { // MediaCodecVideoTrackRenderer.bb = new ArrayList<byte[]>(); // } // int len = sampleHolder.size; // byte[] dd = new byte[len]; // for (int i=0; i<len; i++) { // dd[i] = sampleHolder.data.get(i); // } // MediaCodecVideoTrackRenderer.bb.add(dd); // // if (MediaCodecVideoTrackRenderer.pts == null) { // MediaCodecVideoTrackRenderer.pts = new ArrayList<Long>(); // } // MediaCodecVideoTrackRenderer.pts.add(new Long(sampleHolder.timeUs)); mediaExtractor.advance(); return SampleSource.SAMPLE_READ; }
Example 3
Source File: VLCSampleExtractor.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public int readSample(int track, SampleHolder sampleHolder) throws IOException { Assertions.checkState(prepared); long ct = lib.getTime(); sampleHolder.timeUs = ct * ExoVlcUtil.MS_2_MICRO; sampleHolder.flags = android.media.MediaExtractor.SAMPLE_FLAG_SYNC; return ct >= 0L ? SampleSource.SAMPLE_READ : SampleSource.END_OF_STREAM; }