org.jcodec.containers.mp4.boxes.DataRefBox Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcodec Show documentation
Show all versions of jcodec Show documentation
Pure Java implementation of video/audio codecs and formats
package org.jcodec.containers.mp4.boxes;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.jcodec.containers.mp4.io.Input;
import org.jcodec.containers.mp4.io.Parser;
/**
* This class is part of JCodec ( www.jcodec.org )
* This software is distributed under FreeBSD License
*
* @author stan
*
*/
public class DataRefBox extends NodeBox {
private static final MyFactory FACTORY = new MyFactory();
public static String fourcc() {
return "dref";
}
public DataRefBox() {
this(new Header(fourcc()));
}
private DataRefBox(Header atom) {
super(atom);
factory = FACTORY;
}
@Override
public void parse(Input input) throws IOException {
Parser.readInt32(input);
Parser.readInt32(input);
super.parse(input);
}
@Override
public void doWrite(DataOutput out) throws IOException {
out.writeInt(0);
out.writeInt(boxes.size());
super.doWrite(out);
}
public static class MyFactory extends BoxFactory {
private Map> mappings = new HashMap>();
public MyFactory() {
mappings.put(UrlBox.fourcc(), UrlBox.class);
mappings.put(AliasBox.fourcc(), AliasBox.class);
}
public Class extends Box> toClass(String fourcc) {
return mappings.get(fourcc);
}
}
}