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

org.jcodec.containers.mp4.boxes.ClipRegionBox Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy