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

org.jcodec.containers.mp4.boxes.EncodedPixelBox 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 EncodedPixelBox extends FullBox {
    private float width;
    private float height;
    
    public static String fourcc() {
        return "enof";
    }

    public EncodedPixelBox(Header atom) {
        super(atom);
    }
    
    public EncodedPixelBox() {
        super(new Header(fourcc()));
    }
    
    public EncodedPixelBox(int width, int height) {
        this();
        this.width = width;
        this.height = height;
    }

    public void parse(Input input) throws IOException {
        super.parse(input);
        width = Parser.readInt32(input) / 65536f;
        height = Parser.readInt32(input) / 65536f;
    }

    protected void doWrite(DataOutput out) throws IOException {
        super.doWrite(out);
        out.writeInt((int)(width * 65536f));
        out.writeInt((int)(height * 65536f));
    }

    public float getWidth() {
        return width;
    }

    public float getHeight() {
        return height;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy