org.jcodec.containers.mp4.boxes.ClipRegionBox 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 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 Stanislav Vitvitskiy
*
*/
public class ClipRegionBox extends Box {
private short rgnSize;
private short y;
private short x;
private short height;
private short width;
public static String fourcc() {
return "crgn";
}
public ClipRegionBox(Header atom) {
super(atom);
}
public ClipRegionBox() {
super(new Header(fourcc()));
}
public ClipRegionBox(short x, short y, short width, short height) {
this();
rgnSize = 10;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void parse(Input input) throws IOException {
rgnSize = (short)Parser.readInt16(input);
y = (short)Parser.readInt16(input);
x = (short)Parser.readInt16(input);
height = (short)Parser.readInt16(input);
width = (short)Parser.readInt16(input);
}
protected void doWrite(DataOutput out) throws IOException {
out.writeShort(rgnSize);
out.writeShort(y);
out.writeShort(x);
out.writeShort(height);
out.writeShort(width);
}
public short getRgnSize() {
return rgnSize;
}
public short getY() {
return y;
}
public short getX() {
return x;
}
public short getHeight() {
return height;
}
public short getWidth() {
return width;
}
}