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

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

There is a newer version: 0.2.5
Show newest version
package org.jcodec.containers.mp4.boxes;

import java.nio.ByteBuffer;

public class CleanApertureExtension extends Box {
    private int vertOffsetDenominator;
    private int vertOffsetNumerator;
    private int horizOffsetDenominator;
    private int horizOffsetNumerator;
    private int apertureHeightDenominator;
    private int apertureHeightNumerator;
    private int apertureWidthDenominator;
    private int apertureWidthNumerator;

    public CleanApertureExtension(int apertureWidthN, int apertureWidthD, int apertureHeightN, int apertureHeightD,
            int horizOffN, int horizOffD, int vertOffN, int vertOffD) {
        super(new Header(fourcc()));
        this.apertureWidthNumerator = apertureWidthN;
        this.apertureWidthDenominator = apertureWidthD;
        this.apertureHeightNumerator = apertureHeightN;
        this.apertureHeightDenominator = apertureHeightD;
        this.horizOffsetNumerator = horizOffN;
        this.horizOffsetDenominator = horizOffD;
        this.vertOffsetNumerator = vertOffN;
        this.vertOffsetDenominator = vertOffD;
    }

    public CleanApertureExtension() {
        super(new Header(fourcc()));
    }

    @Override
    public void parse(ByteBuffer is) {
        this.apertureWidthNumerator = is.getInt();
        this.apertureWidthDenominator = is.getInt();

        this.apertureHeightNumerator = is.getInt();
        this.apertureHeightDenominator = is.getInt();

        this.horizOffsetNumerator = is.getInt();
        this.horizOffsetDenominator = is.getInt();

        this.vertOffsetNumerator = is.getInt();
        this.vertOffsetDenominator = is.getInt();
    }

    public static String fourcc() {
        return "clap";
    }

    @Override
    public void doWrite(ByteBuffer out) {
        out.putInt((int) this.apertureWidthNumerator);
        out.putInt((int) this.apertureWidthDenominator);

        out.putInt((int) this.apertureHeightNumerator);
        out.putInt((int) this.apertureHeightDenominator);

        out.putInt((int) this.horizOffsetNumerator);
        out.putInt((int) this.horizOffsetDenominator);

        out.putInt((int) this.vertOffsetNumerator);
        out.putInt((int) this.vertOffsetDenominator);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy