software.amazon.awssdk.services.elastictranscoder.model.PresetWatermark Maven / Gradle / Ivy
Show all versions of elastictranscoder Show documentation
/*
* 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.elastictranscoder.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;
/**
*
* Settings for the size, location, and opacity of graphics that you want Elastic Transcoder to overlay over videos that
* are transcoded using this preset. You can specify settings for up to four watermarks. Watermarks appear in the
* specified size and location, and with the specified opacity for the duration of the transcoded video.
*
*
* Watermarks can be in .png or .jpg format. If you want to display a watermark that is not rectangular, use the .png
* format, which supports transparency.
*
*
* When you create a job that uses this preset, you specify the .png or .jpg graphics that you want Elastic Transcoder
* to include in the transcoded videos. You can specify fewer graphics in the job than you specify watermark settings in
* the preset, which allows you to use the same preset for up to four watermarks that have different dimensions.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PresetWatermark implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(PresetWatermark::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField MAX_WIDTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxWidth").getter(getter(PresetWatermark::maxWidth)).setter(setter(Builder::maxWidth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxWidth").build()).build();
private static final SdkField MAX_HEIGHT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxHeight").getter(getter(PresetWatermark::maxHeight)).setter(setter(Builder::maxHeight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxHeight").build()).build();
private static final SdkField SIZING_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SizingPolicy").getter(getter(PresetWatermark::sizingPolicy)).setter(setter(Builder::sizingPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SizingPolicy").build()).build();
private static final SdkField HORIZONTAL_ALIGN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HorizontalAlign").getter(getter(PresetWatermark::horizontalAlign))
.setter(setter(Builder::horizontalAlign))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HorizontalAlign").build()).build();
private static final SdkField HORIZONTAL_OFFSET_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HorizontalOffset").getter(getter(PresetWatermark::horizontalOffset))
.setter(setter(Builder::horizontalOffset))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HorizontalOffset").build()).build();
private static final SdkField VERTICAL_ALIGN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VerticalAlign").getter(getter(PresetWatermark::verticalAlign)).setter(setter(Builder::verticalAlign))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerticalAlign").build()).build();
private static final SdkField VERTICAL_OFFSET_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VerticalOffset").getter(getter(PresetWatermark::verticalOffset)).setter(setter(Builder::verticalOffset))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerticalOffset").build()).build();
private static final SdkField OPACITY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Opacity")
.getter(getter(PresetWatermark::opacity)).setter(setter(Builder::opacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Opacity").build()).build();
private static final SdkField TARGET_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Target")
.getter(getter(PresetWatermark::target)).setter(setter(Builder::target))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Target").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, MAX_WIDTH_FIELD,
MAX_HEIGHT_FIELD, SIZING_POLICY_FIELD, HORIZONTAL_ALIGN_FIELD, HORIZONTAL_OFFSET_FIELD, VERTICAL_ALIGN_FIELD,
VERTICAL_OFFSET_FIELD, OPACITY_FIELD, TARGET_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String maxWidth;
private final String maxHeight;
private final String sizingPolicy;
private final String horizontalAlign;
private final String horizontalOffset;
private final String verticalAlign;
private final String verticalOffset;
private final String opacity;
private final String target;
private PresetWatermark(BuilderImpl builder) {
this.id = builder.id;
this.maxWidth = builder.maxWidth;
this.maxHeight = builder.maxHeight;
this.sizingPolicy = builder.sizingPolicy;
this.horizontalAlign = builder.horizontalAlign;
this.horizontalOffset = builder.horizontalOffset;
this.verticalAlign = builder.verticalAlign;
this.verticalOffset = builder.verticalOffset;
this.opacity = builder.opacity;
this.target = builder.target;
}
/**
*
* A unique identifier for the settings for one watermark. The value of Id
can be up to 40 characters
* long.
*
*
* @return A unique identifier for the settings for one watermark. The value of Id
can be up to 40
* characters long.
*/
public final String id() {
return id;
}
/**
*
* The maximum width of the watermark in one of the following formats:
*
*
* -
*
* number of pixels (px): The minimum value is 16 pixels, and the maximum value is the value of
* MaxWidth
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100. Use the value of Target
to specify
* whether you want Elastic Transcoder to include the black bars that are added by Elastic Transcoder, if any, in
* the calculation.
*
*
* If you specify the value in pixels, it must be less than or equal to the value of MaxWidth
.
*
*
*
*
* @return The maximum width of the watermark in one of the following formats:
*
* -
*
* number of pixels (px): The minimum value is 16 pixels, and the maximum value is the value of
* MaxWidth
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100. Use the value of Target
to
* specify whether you want Elastic Transcoder to include the black bars that are added by Elastic
* Transcoder, if any, in the calculation.
*
*
* If you specify the value in pixels, it must be less than or equal to the value of MaxWidth
.
*
*
*/
public final String maxWidth() {
return maxWidth;
}
/**
*
* The maximum height of the watermark in one of the following formats:
*
*
* -
*
* number of pixels (px): The minimum value is 16 pixels, and the maximum value is the value of
* MaxHeight
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100. Use the value of Target
to specify
* whether you want Elastic Transcoder to include the black bars that are added by Elastic Transcoder, if any, in
* the calculation.
*
*
*
*
* If you specify the value in pixels, it must be less than or equal to the value of MaxHeight
.
*
*
* @return The maximum height of the watermark in one of the following formats:
*
* -
*
* number of pixels (px): The minimum value is 16 pixels, and the maximum value is the value of
* MaxHeight
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100. Use the value of Target
to
* specify whether you want Elastic Transcoder to include the black bars that are added by Elastic
* Transcoder, if any, in the calculation.
*
*
*
*
* If you specify the value in pixels, it must be less than or equal to the value of MaxHeight
.
*/
public final String maxHeight() {
return maxHeight;
}
/**
*
* A value that controls scaling of the watermark:
*
*
* -
*
* Fit: Elastic Transcoder scales the watermark so it matches the value that you specified in either
* MaxWidth
or MaxHeight
without exceeding the other value.
*
*
* -
*
* Stretch: Elastic Transcoder stretches the watermark to match the values that you specified for
* MaxWidth
and MaxHeight
. If the relative proportions of the watermark and the values of
* MaxWidth
and MaxHeight
are different, the watermark will be distorted.
*
*
* -
*
* ShrinkToFit: Elastic Transcoder scales the watermark down so that its dimensions match the values that you
* specified for at least one of MaxWidth
and MaxHeight
without exceeding either value. If
* you specify this option, Elastic Transcoder does not scale the watermark up.
*
*
*
*
* @return A value that controls scaling of the watermark:
*
* -
*
* Fit: Elastic Transcoder scales the watermark so it matches the value that you specified in either
* MaxWidth
or MaxHeight
without exceeding the other value.
*
*
* -
*
* Stretch: Elastic Transcoder stretches the watermark to match the values that you specified for
* MaxWidth
and MaxHeight
. If the relative proportions of the watermark and the
* values of MaxWidth
and MaxHeight
are different, the watermark will be
* distorted.
*
*
* -
*
* ShrinkToFit: Elastic Transcoder scales the watermark down so that its dimensions match the values
* that you specified for at least one of MaxWidth
and MaxHeight
without exceeding
* either value. If you specify this option, Elastic Transcoder does not scale the watermark up.
*
*
*/
public final String sizingPolicy() {
return sizingPolicy;
}
/**
*
* The horizontal position of the watermark unless you specify a non-zero value for HorizontalOffset
:
*
*
* -
*
* Left: The left edge of the watermark is aligned with the left border of the video.
*
*
* -
*
* Right: The right edge of the watermark is aligned with the right border of the video.
*
*
* -
*
* Center: The watermark is centered between the left and right borders.
*
*
*
*
* @return The horizontal position of the watermark unless you specify a non-zero value for
* HorizontalOffset
:
*
* -
*
* Left: The left edge of the watermark is aligned with the left border of the video.
*
*
* -
*
* Right: The right edge of the watermark is aligned with the right border of the video.
*
*
* -
*
* Center: The watermark is centered between the left and right borders.
*
*
*/
public final String horizontalAlign() {
return horizontalAlign;
}
/**
*
* The amount by which you want the horizontal position of the watermark to be offset from the position specified by
* HorizontalAlign:
*
*
* -
*
* number of pixels (px): The minimum value is 0 pixels, and the maximum value is the value of MaxWidth.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100.
*
*
*
*
* For example, if you specify Left for HorizontalAlign
and 5px for HorizontalOffset
, the
* left side of the watermark appears 5 pixels from the left border of the output video.
*
*
* HorizontalOffset
is only valid when the value of HorizontalAlign
is Left
* or Right
. If you specify an offset that causes the watermark to extend beyond the left or right
* border and Elastic Transcoder has not added black bars, the watermark is cropped. If Elastic Transcoder has added
* black bars, the watermark extends into the black bars. If the watermark extends beyond the black bars, it is
* cropped.
*
*
* Use the value of Target
to specify whether you want to include the black bars that are added by
* Elastic Transcoder, if any, in the offset calculation.
*
*
* @return The amount by which you want the horizontal position of the watermark to be offset from the position
* specified by HorizontalAlign:
*
* -
*
* number of pixels (px): The minimum value is 0 pixels, and the maximum value is the value of MaxWidth.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100.
*
*
*
*
* For example, if you specify Left for HorizontalAlign
and 5px for
* HorizontalOffset
, the left side of the watermark appears 5 pixels from the left border of
* the output video.
*
*
* HorizontalOffset
is only valid when the value of HorizontalAlign
is
* Left
or Right
. If you specify an offset that causes the watermark to extend
* beyond the left or right border and Elastic Transcoder has not added black bars, the watermark is
* cropped. If Elastic Transcoder has added black bars, the watermark extends into the black bars. If the
* watermark extends beyond the black bars, it is cropped.
*
*
* Use the value of Target
to specify whether you want to include the black bars that are added
* by Elastic Transcoder, if any, in the offset calculation.
*/
public final String horizontalOffset() {
return horizontalOffset;
}
/**
*
* The vertical position of the watermark unless you specify a non-zero value for VerticalOffset
:
*
*
* -
*
* Top: The top edge of the watermark is aligned with the top border of the video.
*
*
* -
*
* Bottom: The bottom edge of the watermark is aligned with the bottom border of the video.
*
*
* -
*
* Center: The watermark is centered between the top and bottom borders.
*
*
*
*
* @return The vertical position of the watermark unless you specify a non-zero value for
* VerticalOffset
:
*
* -
*
* Top: The top edge of the watermark is aligned with the top border of the video.
*
*
* -
*
* Bottom: The bottom edge of the watermark is aligned with the bottom border of the video.
*
*
* -
*
* Center: The watermark is centered between the top and bottom borders.
*
*
*/
public final String verticalAlign() {
return verticalAlign;
}
/**
*
* VerticalOffset
*
*
* The amount by which you want the vertical position of the watermark to be offset from the position specified by
* VerticalAlign:
*
*
* -
*
* number of pixels (px): The minimum value is 0 pixels, and the maximum value is the value of
* MaxHeight
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100.
*
*
*
*
* For example, if you specify Top
for VerticalAlign
and 5px
for
* VerticalOffset
, the top of the watermark appears 5 pixels from the top border of the output video.
*
*
* VerticalOffset
is only valid when the value of VerticalAlign is Top or Bottom.
*
*
* If you specify an offset that causes the watermark to extend beyond the top or bottom border and Elastic
* Transcoder has not added black bars, the watermark is cropped. If Elastic Transcoder has added black bars, the
* watermark extends into the black bars. If the watermark extends beyond the black bars, it is cropped.
*
*
* Use the value of Target
to specify whether you want Elastic Transcoder to include the black bars
* that are added by Elastic Transcoder, if any, in the offset calculation.
*
*
* @return VerticalOffset
*
* The amount by which you want the vertical position of the watermark to be offset from the position
* specified by VerticalAlign:
*
*
* -
*
* number of pixels (px): The minimum value is 0 pixels, and the maximum value is the value of
* MaxHeight
.
*
*
* -
*
* integer percentage (%): The range of valid values is 0 to 100.
*
*
*
*
* For example, if you specify Top
for VerticalAlign
and 5px
for
* VerticalOffset
, the top of the watermark appears 5 pixels from the top border of the output
* video.
*
*
* VerticalOffset
is only valid when the value of VerticalAlign is Top or Bottom.
*
*
* If you specify an offset that causes the watermark to extend beyond the top or bottom border and Elastic
* Transcoder has not added black bars, the watermark is cropped. If Elastic Transcoder has added black
* bars, the watermark extends into the black bars. If the watermark extends beyond the black bars, it is
* cropped.
*
*
* Use the value of Target
to specify whether you want Elastic Transcoder to include the black
* bars that are added by Elastic Transcoder, if any, in the offset calculation.
*/
public final String verticalOffset() {
return verticalOffset;
}
/**
*
* A percentage that indicates how much you want a watermark to obscure the video in the location where it appears.
* Valid values are 0 (the watermark is invisible) to 100 (the watermark completely obscures the video in the
* specified location). The datatype of Opacity
is float.
*
*
* Elastic Transcoder supports transparent .png graphics. If you use a transparent .png, the transparent portion of
* the video appears as if you had specified a value of 0 for Opacity
. The .jpg file format doesn't
* support transparency.
*
*
* @return A percentage that indicates how much you want a watermark to obscure the video in the location where it
* appears. Valid values are 0 (the watermark is invisible) to 100 (the watermark completely obscures the
* video in the specified location). The datatype of Opacity
is float.
*
* Elastic Transcoder supports transparent .png graphics. If you use a transparent .png, the transparent
* portion of the video appears as if you had specified a value of 0 for Opacity
. The .jpg file
* format doesn't support transparency.
*/
public final String opacity() {
return opacity;
}
/**
*
* A value that determines how Elastic Transcoder interprets values that you specified for
* HorizontalOffset
, VerticalOffset
, MaxWidth
, and MaxHeight
:
*
*
* -
*
* Content: HorizontalOffset
and VerticalOffset
values are calculated based on the
* borders of the video excluding black bars added by Elastic Transcoder, if any. In addition, MaxWidth
* and MaxHeight
, if specified as a percentage, are calculated based on the borders of the video
* excluding black bars added by Elastic Transcoder, if any.
*
*
* -
*
* Frame: HorizontalOffset
and VerticalOffset
values are calculated based on the
* borders of the video including black bars added by Elastic Transcoder, if any. In addition, MaxWidth
* and MaxHeight
, if specified as a percentage, are calculated based on the borders of the video
* including black bars added by Elastic Transcoder, if any.
*
*
*
*
* @return A value that determines how Elastic Transcoder interprets values that you specified for
* HorizontalOffset
, VerticalOffset
, MaxWidth
, and
* MaxHeight
:
*
* -
*
* Content: HorizontalOffset
and VerticalOffset
values are calculated based
* on the borders of the video excluding black bars added by Elastic Transcoder, if any. In addition,
* MaxWidth
and MaxHeight
, if specified as a percentage, are calculated based on
* the borders of the video excluding black bars added by Elastic Transcoder, if any.
*
*
* -
*
* Frame: HorizontalOffset
and VerticalOffset
values are calculated based
* on the borders of the video including black bars added by Elastic Transcoder, if any. In addition,
* MaxWidth
and MaxHeight
, if specified as a percentage, are calculated based on
* the borders of the video including black bars added by Elastic Transcoder, if any.
*
*
*/
public final String target() {
return target;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(maxWidth());
hashCode = 31 * hashCode + Objects.hashCode(maxHeight());
hashCode = 31 * hashCode + Objects.hashCode(sizingPolicy());
hashCode = 31 * hashCode + Objects.hashCode(horizontalAlign());
hashCode = 31 * hashCode + Objects.hashCode(horizontalOffset());
hashCode = 31 * hashCode + Objects.hashCode(verticalAlign());
hashCode = 31 * hashCode + Objects.hashCode(verticalOffset());
hashCode = 31 * hashCode + Objects.hashCode(opacity());
hashCode = 31 * hashCode + Objects.hashCode(target());
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 PresetWatermark)) {
return false;
}
PresetWatermark other = (PresetWatermark) obj;
return Objects.equals(id(), other.id()) && Objects.equals(maxWidth(), other.maxWidth())
&& Objects.equals(maxHeight(), other.maxHeight()) && Objects.equals(sizingPolicy(), other.sizingPolicy())
&& Objects.equals(horizontalAlign(), other.horizontalAlign())
&& Objects.equals(horizontalOffset(), other.horizontalOffset())
&& Objects.equals(verticalAlign(), other.verticalAlign())
&& Objects.equals(verticalOffset(), other.verticalOffset()) && Objects.equals(opacity(), other.opacity())
&& Objects.equals(target(), other.target());
}
/**
* 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("PresetWatermark").add("Id", id()).add("MaxWidth", maxWidth()).add("MaxHeight", maxHeight())
.add("SizingPolicy", sizingPolicy()).add("HorizontalAlign", horizontalAlign())
.add("HorizontalOffset", horizontalOffset()).add("VerticalAlign", verticalAlign())
.add("VerticalOffset", verticalOffset()).add("Opacity", opacity()).add("Target", target()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "MaxWidth":
return Optional.ofNullable(clazz.cast(maxWidth()));
case "MaxHeight":
return Optional.ofNullable(clazz.cast(maxHeight()));
case "SizingPolicy":
return Optional.ofNullable(clazz.cast(sizingPolicy()));
case "HorizontalAlign":
return Optional.ofNullable(clazz.cast(horizontalAlign()));
case "HorizontalOffset":
return Optional.ofNullable(clazz.cast(horizontalOffset()));
case "VerticalAlign":
return Optional.ofNullable(clazz.cast(verticalAlign()));
case "VerticalOffset":
return Optional.ofNullable(clazz.cast(verticalOffset()));
case "Opacity":
return Optional.ofNullable(clazz.cast(opacity()));
case "Target":
return Optional.ofNullable(clazz.cast(target()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function