public void push(long id) { this.add(id); }
public long[] getValues() { finish(); return values.toArray(); }
public static LongArrayList createLongArrayList() { return new LongArrayList(DEFAULT_GROW_AMOUNT); }
public Long() { super(); this.lastValue = Long.MIN_VALUE; this.values = LongArrayList.createLongArrayList(); }
@Override public Packet nextFrame() throws IOException { MPEGPacket pkt = es.getFrame(); if (pkt == null) return null; int seq = MPEGDecoder.getSequenceNumber(pkt.getData()); if (seq == 0) seqWrap = lastSeqSeen + 1; lastSeqSeen = seq; if (ptsSeen.size() <= 0) { pkt.setPts(Math.min(seq - lastSeq, seq - lastSeq + seqWrap) * durationHistogram.max() + lastPts); } else { pkt.setPts(ptsSeen.shift()); if (lastSeq >= 0 && seq > lastSeq) { durationHistogram.increment((int) (pkt.getPts() - lastPts) / Math.min(seq - lastSeq, seq - lastSeq + seqWrap)); } lastPts = pkt.getPts(); lastSeq = seq; } pkt.setDuration(durationHistogram.max()); System.out.println(seq); return pkt; }
public int estimateSize() { int sizeEstimate = (tokens.size() << 3) + streams.estimateSize() + 128; for (Integer stream : analyzers.keySet()) { sizeEstimate += analyzers.get(stream).estimateSize(); } return sizeEstimate; }
public BaseIndexer() { this.analyzers = new HashMap<Integer, BaseAnalyser>(); this.tokens = LongArrayList.createLongArrayList(); this.streams = new RunLength.Integer(); }
public void push(long id) { this.add(id); }
public MPSIndex serialize() { List<MPSStreamIndex> streamsIndices = new ArrayList<MPSStreamIndex>(); Set<Entry<Integer, BaseAnalyser>> entrySet = analyzers.entrySet(); for (Entry<Integer, BaseAnalyser> entry : entrySet) { streamsIndices.add(entry.getValue().serialize(entry.getKey())); } return new MPSIndex(tokens.toArray(), streams, streamsIndices.toArray(new MPSStreamIndex[0])); }
public FLVDemuxerTrack(FLVTrackDemuxer demuxer, Type type) throws IOException { this.framePositions = LongArrayList.createLongArrayList(); this.demuxer = demuxer; this.type = type; FLVTag frame = demuxer.nextFrameI(type, false); codec = frame.getTagHeader().getCodec(); }
public void push(long id) { this.add(id); }
stbl.add(new SampleSizesBox(frameSize, totalFrames)); stbl.add(new TimeToSampleBox(new TimeToSampleEntry[] { new TimeToSampleEntry(totalFrames, frameDuration) })); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray()));
public MP4MuxerTrack(int trackId, MP4TrackType type) { super(trackId, type); this.sampleDurations = new ArrayList<TimeToSampleEntry>(); this.chunkOffsets = LongArrayList.createLongArrayList(); this.sampleSizes = IntArrayList.createIntArrayList(); this.iframes = IntArrayList.createIntArrayList(); this.compositionOffsets = new ArrayList<LongEntry>(); setTgtChunkDuration(new Rational(1, 1), Unit.FRAME); }
public void add(long value) { if (lastValue == Long.MIN_VALUE || lastValue != value) { if (lastValue != Long.MIN_VALUE) { values.add(lastValue); counts.add(count); count = 0; } lastValue = value; } ++count; }
stbl.add(new SampleSizesBox(sampleSizes.toArray())); stbl.add(new TimeToSampleBox(sampleDurations.toArray(new TimeToSampleEntry[] {}))); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray())); if (!allIframes && iframes.size() > 0) stbl.add(new SyncSamplesBox(iframes.toArray()));
public PCMMP4MuxerTrack(int trackId, AudioFormat format) { super(trackId, MP4TrackType.SOUND); this.chunkOffsets = LongArrayList.createLongArrayList(); this.frameDuration = 1; this.frameSize = (format.getSampleSizeInBits() >> 3) * format.getChannels(); addSampleEntry(AudioSampleEntry.audioSampleEntryPCM(format)); this._timescale = format.getSampleRate(); setTgtChunkDuration(new Rational(1, 2), Unit.SEC); }
protected void finish() { if (lastValue != Long.MIN_VALUE) { values.add(lastValue); counts.add(count); lastValue = Long.MIN_VALUE; count = 0; } }
stbl.add(new SampleSizesBox(frameSize, totalFrames)); stbl.add(new TimeToSampleBox(new TimeToSampleEntry[] { new TimeToSampleEntry(totalFrames, frameDuration) })); stbl.add(new ChunkOffsets64Box(chunkOffsets.toArray()));
protected void savePESMeta(int stream, long token) { tokens.add(token); streams.add(stream); }