All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.coremedia.iso.boxes.ProgressiveDownloadInformationBox Maven / Gradle / Ivy

Go to download

A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)

There is a newer version: 1.1.22
Show newest version
package com.coremedia.iso.boxes;

import com.coremedia.iso.IsoTypeReader;
import com.coremedia.iso.IsoTypeWriter;
import com.googlecode.mp4parser.AbstractFullBox;

import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
 * 

4cc = "{@value #TYPE}"

*/ public class ProgressiveDownloadInformationBox extends AbstractFullBox { public static final String TYPE = "pdin"; List entries = Collections.emptyList(); public ProgressiveDownloadInformationBox() { super(TYPE); } @Override protected long getContentSize() { return 4 + entries.size() * 8; } @Override protected void getContent(ByteBuffer byteBuffer) { writeVersionAndFlags(byteBuffer); for (Entry entry : entries) { IsoTypeWriter.writeUInt32(byteBuffer, entry.getRate()); IsoTypeWriter.writeUInt32(byteBuffer, entry.getInitialDelay()); } } public List getEntries() { return entries; } public void setEntries(List entries) { this.entries = entries; } @Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); entries = new LinkedList(); while (content.remaining() >= 8) { Entry entry = new Entry(IsoTypeReader.readUInt32(content), IsoTypeReader.readUInt32(content)); entries.add(entry); } } public static class Entry { long rate; long initialDelay; public Entry(long rate, long initialDelay) { this.rate = rate; this.initialDelay = initialDelay; } public long getRate() { return rate; } public void setRate(long rate) { this.rate = rate; } public long getInitialDelay() { return initialDelay; } public void setInitialDelay(long initialDelay) { this.initialDelay = initialDelay; } @Override public String toString() { return "Entry{" + "rate=" + rate + ", initialDelay=" + initialDelay + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Entry entry = (Entry) o; if (initialDelay != entry.initialDelay) return false; if (rate != entry.rate) return false; return true; } @Override public int hashCode() { int result = (int) (rate ^ (rate >>> 32)); result = 31 * result + (int) (initialDelay ^ (initialDelay >>> 32)); return result; } } @Override public String toString() { return "ProgressiveDownloadInfoBox{" + "entries=" + entries + '}'; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy