com.glookast.commons.capture.PictureFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-capture Show documentation
Show all versions of commons-capture Show documentation
Helper classes with Jackson annotations for easy interfacing with Glookast Products
package com.glookast.commons.capture;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.glookast.commons.base.Rational;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, defaultImpl = PictureFormat.class)
public class PictureFormat
{
protected int width;
protected int height;
protected BufferFieldOrder bufferFieldOrder;
protected Rational frameRate;
protected Rational aspectRatio;
protected PixelFormat pixelFormat;
public PictureFormat(PictureFormat pictureFormat)
{
this.width = pictureFormat.width;
this.height = pictureFormat.height;
this.bufferFieldOrder = pictureFormat.bufferFieldOrder;
this.frameRate = pictureFormat.frameRate != null ? new Rational(pictureFormat.frameRate) : null;
this.aspectRatio = pictureFormat.aspectRatio != null ? new Rational(pictureFormat.aspectRatio) : null;
this.pixelFormat = pictureFormat.pixelFormat;
}
@JsonIgnore
public boolean isInterlaced()
{
return this.bufferFieldOrder == BufferFieldOrder.INTERLACED_UPPER_FIELD_FIRST ||
this.bufferFieldOrder == BufferFieldOrder.INTERLACED_LOWER_FIELD_FIRST;
}
}