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

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 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 getter(Function g) { return obj -> g.apply((VideoMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Type of compression used in the analyzed video. *

* * @param codec * Type of compression used in the analyzed video. * @return Returns a reference to this object so that method calls can be chained together. */ Builder codec(String codec); /** *

* Length of the video in milliseconds. *

* * @param durationMillis * Length of the video in milliseconds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder durationMillis(Long durationMillis); /** *

* Format of the analyzed video. Possible values are MP4, MOV and AVI. *

* * @param format * Format of the analyzed video. Possible values are MP4, MOV and AVI. * @return Returns a reference to this object so that method calls can be chained together. */ Builder format(String format); /** *

* Number of frames per second in the video. *

* * @param frameRate * Number of frames per second in the video. * @return Returns a reference to this object so that method calls can be chained together. */ Builder frameRate(Float frameRate); /** *

* Vertical pixel dimension of the video. *

* * @param frameHeight * Vertical pixel dimension of the video. * @return Returns a reference to this object so that method calls can be chained together. */ Builder frameHeight(Long frameHeight); /** *

* Horizontal pixel dimension of the video. *

* * @param frameWidth * Horizontal pixel dimension of the video. * @return Returns a reference to this object so that method calls can be chained together. */ Builder frameWidth(Long frameWidth); /** *

* A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255). *

* * @param colorRange * A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to * 255). * @see VideoColorRange * @return Returns a reference to this object so that method calls can be chained together. * @see VideoColorRange */ Builder colorRange(String colorRange); /** *

* A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255). *

* * @param colorRange * A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to * 255). * @see VideoColorRange * @return Returns a reference to this object so that method calls can be chained together. * @see VideoColorRange */ Builder colorRange(VideoColorRange colorRange); } static final class BuilderImpl implements Builder { private String codec; private Long durationMillis; private String format; private Float frameRate; private Long frameHeight; private Long frameWidth; private String colorRange; private BuilderImpl() { } private BuilderImpl(VideoMetadata model) { codec(model.codec); durationMillis(model.durationMillis); format(model.format); frameRate(model.frameRate); frameHeight(model.frameHeight); frameWidth(model.frameWidth); colorRange(model.colorRange); } public final String getCodec() { return codec; } public final void setCodec(String codec) { this.codec = codec; } @Override public final Builder codec(String codec) { this.codec = codec; return this; } public final Long getDurationMillis() { return durationMillis; } public final void setDurationMillis(Long durationMillis) { this.durationMillis = durationMillis; } @Override public final Builder durationMillis(Long durationMillis) { this.durationMillis = durationMillis; return this; } public final String getFormat() { return format; } public final void setFormat(String format) { this.format = format; } @Override public final Builder format(String format) { this.format = format; return this; } public final Float getFrameRate() { return frameRate; } public final void setFrameRate(Float frameRate) { this.frameRate = frameRate; } @Override public final Builder frameRate(Float frameRate) { this.frameRate = frameRate; return this; } public final Long getFrameHeight() { return frameHeight; } public final void setFrameHeight(Long frameHeight) { this.frameHeight = frameHeight; } @Override public final Builder frameHeight(Long frameHeight) { this.frameHeight = frameHeight; return this; } public final Long getFrameWidth() { return frameWidth; } public final void setFrameWidth(Long frameWidth) { this.frameWidth = frameWidth; } @Override public final Builder frameWidth(Long frameWidth) { this.frameWidth = frameWidth; return this; } public final String getColorRange() { return colorRange; } public final void setColorRange(String colorRange) { this.colorRange = colorRange; } @Override public final Builder colorRange(String colorRange) { this.colorRange = colorRange; return this; } @Override public final Builder colorRange(VideoColorRange colorRange) { this.colorRange(colorRange == null ? null : colorRange.toString()); return this; } @Override public VideoMetadata build() { return new VideoMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy