@Override protected void _parseDetails(ByteBuffer content) { while (content.remaining() >= 4) { trackIds = Mp4Arrays.copyOfAndAppend(trackIds, new long[]{IsoTypeReader.readUInt32(content)}); } }
if (nextTargetTick <= tickN2) { if (Math.abs(tickN1 - nextTargetTick) < Math.abs(tickN2 - nextTargetTick)) { fragments = Mp4Arrays.copyOfAndAppend(fragments, syncSamples[currentSyncSampleIndex]); nextTargetTick = syncSampleTicks[currentSyncSampleIndex] + targetTicks; fragments = Mp4Arrays.copyOfAndAppend(fragments, syncSamples[syncSampleTicks.length - 1]); if (time >= targetDuration) { if (i > 0) { fragments = Mp4Arrays.copyOfAndAppend(fragments, (long) (i + 1));
chunkOffsetBox.setChunkOffsets(Mp4Arrays.copyOfAndAppend(chunkOffsetBox.getChunkOffsets(), offset));
public long[] sampleNumbers(Track track) { long[] segmentStartSamples = new long[]{1L}; long[] sampleDurations = track.getSampleDurations(); long[] syncSamples = track.getSyncSamples(); long timescale = track.getTrackMetaData().getTimescale(); double time = 0.0D; for (int i = 0; i < sampleDurations.length; ++i) { time += (double) sampleDurations[i] / (double) timescale; if (time >= this.fragmentLength && (syncSamples == null || Arrays.binarySearch(syncSamples, (long) (i + 1)) >= 0)) { if (i > 0) { segmentStartSamples = Mp4Arrays.copyOfAndAppend(segmentStartSamples, (long) (i + 1)); } time = 0.0D; } } // In case the last Fragment is shorter: make the previous one a bigger and omit the small one if (time < fragmentLength && segmentStartSamples.length > 1) { long[] nuSegmentStartSamples = new long[segmentStartSamples.length - 1]; System.arraycopy(segmentStartSamples, 0, nuSegmentStartSamples, 0, segmentStartSamples.length - 1); segmentStartSamples = nuSegmentStartSamples; } return segmentStartSamples; }
sampleDurations = Mp4Arrays.copyOfAndAppend(sampleDurations, startTime - mediaTimestampUs); samples.add(EMPTY_SAMPLE); sampleDurations = Mp4Arrays.copyOfAndAppend(sampleDurations, endTime - startTime); VTTCueBox vttCueBox = new VTTCueBox(); if (settings != null) {
pictureOrderCounts = Mp4Arrays.copyOfAndAppend(pictureOrderCounts, picOrderCntMsb + picOrderCountLsb); prevPicOrderCntLsb = picOrderCountLsb; prevPicOrderCntMsb = picOrderCntMsb; pictureOrderCounts = Mp4Arrays.copyOfAndAppend(pictureOrderCounts, samples.size());
protected Box createMvhd() { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(creationTime); mvhd.setModificationTime(creationTime); mvhd.setDuration(0);//no duration in moov for fragmented movies long[] timescales = new long[0]; for (StreamingTrack streamingTrack : source) { Mp4Arrays.copyOfAndAppend(timescales, streamingTrack.getTimescale()); } mvhd.setTimescale(lcm(timescales)); // find the next available trackId mvhd.setNextTrackId(2); return mvhd; }
long time_code = (last_sync_point * vop_time_increment_resolution + (vop_time_increment % vop_time_increment_resolution)); if (last_time_code != -1) { decodingTimes = Mp4Arrays.copyOfAndAppend(decodingTimes, new long[]{time_code - last_time_code}); decodingTimes = Mp4Arrays.copyOfAndAppend(decodingTimes, new long[]{decodingTimes[decodingTimes.length - 1]});
syncSamples = Mp4Arrays.copyOfAndAppend(syncSamples, sampleNumber);