
software.amazon.awssdk.services.rekognition.model.VideoMetadata Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.rekognition.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about a video that Amazon Rekognition analyzed. Videometadata
is returned in every page of
* paginated responses from a Amazon Rekognition video operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VideoMetadata implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CODEC_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Codec")
.getter(getter(VideoMetadata::codec)).setter(setter(Builder::codec))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Codec").build()).build();
private static final SdkField DURATION_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("DurationMillis").getter(getter(VideoMetadata::durationMillis)).setter(setter(Builder::durationMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DurationMillis").build()).build();
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format")
.getter(getter(VideoMetadata::format)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build();
private static final SdkField FRAME_RATE_FIELD = SdkField. builder(MarshallingType.FLOAT)
.memberName("FrameRate").getter(getter(VideoMetadata::frameRate)).setter(setter(Builder::frameRate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameRate").build()).build();
private static final SdkField FRAME_HEIGHT_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("FrameHeight").getter(getter(VideoMetadata::frameHeight)).setter(setter(Builder::frameHeight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameHeight").build()).build();
private static final SdkField FRAME_WIDTH_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("FrameWidth").getter(getter(VideoMetadata::frameWidth)).setter(setter(Builder::frameWidth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameWidth").build()).build();
private static final SdkField COLOR_RANGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ColorRange").getter(getter(VideoMetadata::colorRangeAsString)).setter(setter(Builder::colorRange))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ColorRange").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CODEC_FIELD,
DURATION_MILLIS_FIELD, FORMAT_FIELD, FRAME_RATE_FIELD, FRAME_HEIGHT_FIELD, FRAME_WIDTH_FIELD, COLOR_RANGE_FIELD));
private static final long serialVersionUID = 1L;
private final String codec;
private final Long durationMillis;
private final String format;
private final Float frameRate;
private final Long frameHeight;
private final Long frameWidth;
private final String colorRange;
private VideoMetadata(BuilderImpl builder) {
this.codec = builder.codec;
this.durationMillis = builder.durationMillis;
this.format = builder.format;
this.frameRate = builder.frameRate;
this.frameHeight = builder.frameHeight;
this.frameWidth = builder.frameWidth;
this.colorRange = builder.colorRange;
}
/**
*
* Type of compression used in the analyzed video.
*
*
* @return Type of compression used in the analyzed video.
*/
public final String codec() {
return codec;
}
/**
*
* Length of the video in milliseconds.
*
*
* @return Length of the video in milliseconds.
*/
public final Long durationMillis() {
return durationMillis;
}
/**
*
* Format of the analyzed video. Possible values are MP4, MOV and AVI.
*
*
* @return Format of the analyzed video. Possible values are MP4, MOV and AVI.
*/
public final String format() {
return format;
}
/**
*
* Number of frames per second in the video.
*
*
* @return Number of frames per second in the video.
*/
public final Float frameRate() {
return frameRate;
}
/**
*
* Vertical pixel dimension of the video.
*
*
* @return Vertical pixel dimension of the video.
*/
public final Long frameHeight() {
return frameHeight;
}
/**
*
* Horizontal pixel dimension of the video.
*
*
* @return Horizontal pixel dimension of the video.
*/
public final Long frameWidth() {
return frameWidth;
}
/**
*
* A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #colorRange} will
* return {@link VideoColorRange#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #colorRangeAsString}.
*
*
* @return A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).
* @see VideoColorRange
*/
public final VideoColorRange colorRange() {
return VideoColorRange.fromValue(colorRange);
}
/**
*
* A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #colorRange} will
* return {@link VideoColorRange#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #colorRangeAsString}.
*
*
* @return A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).
* @see VideoColorRange
*/
public final String colorRangeAsString() {
return colorRange;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(codec());
hashCode = 31 * hashCode + Objects.hashCode(durationMillis());
hashCode = 31 * hashCode + Objects.hashCode(format());
hashCode = 31 * hashCode + Objects.hashCode(frameRate());
hashCode = 31 * hashCode + Objects.hashCode(frameHeight());
hashCode = 31 * hashCode + Objects.hashCode(frameWidth());
hashCode = 31 * hashCode + Objects.hashCode(colorRangeAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof VideoMetadata)) {
return false;
}
VideoMetadata other = (VideoMetadata) obj;
return Objects.equals(codec(), other.codec()) && Objects.equals(durationMillis(), other.durationMillis())
&& Objects.equals(format(), other.format()) && Objects.equals(frameRate(), other.frameRate())
&& Objects.equals(frameHeight(), other.frameHeight()) && Objects.equals(frameWidth(), other.frameWidth())
&& Objects.equals(colorRangeAsString(), other.colorRangeAsString());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("VideoMetadata").add("Codec", codec()).add("DurationMillis", durationMillis())
.add("Format", format()).add("FrameRate", frameRate()).add("FrameHeight", frameHeight())
.add("FrameWidth", frameWidth()).add("ColorRange", colorRangeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Codec":
return Optional.ofNullable(clazz.cast(codec()));
case "DurationMillis":
return Optional.ofNullable(clazz.cast(durationMillis()));
case "Format":
return Optional.ofNullable(clazz.cast(format()));
case "FrameRate":
return Optional.ofNullable(clazz.cast(frameRate()));
case "FrameHeight":
return Optional.ofNullable(clazz.cast(frameHeight()));
case "FrameWidth":
return Optional.ofNullable(clazz.cast(frameWidth()));
case "ColorRange":
return Optional.ofNullable(clazz.cast(colorRangeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function