software.amazon.awssdk.services.elastictranscoder.model.CaptionFormat 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.Consumer;
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;
/**
*
* The file format of the output captions. If you leave this value blank, Elastic Transcoder returns an error.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CaptionFormat implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format")
.getter(getter(CaptionFormat::format)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build();
private static final SdkField PATTERN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Pattern")
.getter(getter(CaptionFormat::pattern)).setter(setter(Builder::pattern))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Pattern").build()).build();
private static final SdkField ENCRYPTION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Encryption").getter(getter(CaptionFormat::encryption)).setter(setter(Builder::encryption))
.constructor(Encryption::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Encryption").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FORMAT_FIELD, PATTERN_FIELD,
ENCRYPTION_FIELD));
private static final long serialVersionUID = 1L;
private final String format;
private final String pattern;
private final Encryption encryption;
private CaptionFormat(BuilderImpl builder) {
this.format = builder.format;
this.pattern = builder.pattern;
this.encryption = builder.encryption;
}
/**
*
* The format you specify determines whether Elastic Transcoder generates an embedded or sidecar caption for this
* output.
*
*
* -
*
* Valid Embedded Caption Formats:
*
*
* -
*
* for FLAC: None
*
*
* -
*
* For MP3: None
*
*
* -
*
* For MP4: mov-text
*
*
* -
*
* For MPEG-TS: None
*
*
* -
*
* For ogg: None
*
*
* -
*
* For webm: None
*
*
*
*
* -
*
* Valid Sidecar Caption Formats: Elastic Transcoder supports dfxp (first div element only), scc, srt, and
* webvtt. If you want ttml or smpte-tt compatible captions, specify dfxp as your output format.
*
*
* -
*
* For FMP4: dfxp
*
*
* -
*
* Non-FMP4 outputs: All sidecar types
*
*
*
*
* fmp4
captions have an extension of .ismt
*
*
*
*
* @return The format you specify determines whether Elastic Transcoder generates an embedded or sidecar caption for
* this output.
*
* -
*
* Valid Embedded Caption Formats:
*
*
* -
*
* for FLAC: None
*
*
* -
*
* For MP3: None
*
*
* -
*
* For MP4: mov-text
*
*
* -
*
* For MPEG-TS: None
*
*
* -
*
* For ogg: None
*
*
* -
*
* For webm: None
*
*
*
*
* -
*
* Valid Sidecar Caption Formats: Elastic Transcoder supports dfxp (first div element only), scc,
* srt, and webvtt. If you want ttml or smpte-tt compatible captions, specify dfxp as your output format.
*
*
* -
*
* For FMP4: dfxp
*
*
* -
*
* Non-FMP4 outputs: All sidecar types
*
*
*
*
* fmp4
captions have an extension of .ismt
*
*
*/
public final String format() {
return format;
}
/**
*
* The prefix for caption filenames, in the form description-{language}
, where:
*
*
* -
*
* description is a description of the video.
*
*
* -
*
* {language}
is a literal value that Elastic Transcoder replaces with the two- or three-letter code
* for the language of the caption in the output file names.
*
*
*
*
* If you don't include {language}
in the file name pattern, Elastic Transcoder automatically appends "
* {language}
" to the value that you specify for the description. In addition, Elastic Transcoder
* automatically appends the count to the end of the segment files.
*
*
* For example, suppose you're transcoding into srt format. When you enter "Sydney-{language}-sunrise", and the
* language of the captions is English (en), the name of the first caption file is be Sydney-en-sunrise00000.srt.
*
*
* @return The prefix for caption filenames, in the form description-{language}
, where:
*
* -
*
* description is a description of the video.
*
*
* -
*
* {language}
is a literal value that Elastic Transcoder replaces with the two- or three-letter
* code for the language of the caption in the output file names.
*
*
*
*
* If you don't include {language}
in the file name pattern, Elastic Transcoder automatically
* appends "{language}
" to the value that you specify for the description. In addition, Elastic
* Transcoder automatically appends the count to the end of the segment files.
*
*
* For example, suppose you're transcoding into srt format. When you enter "Sydney-{language}-sunrise", and
* the language of the captions is English (en), the name of the first caption file is be
* Sydney-en-sunrise00000.srt.
*/
public final String pattern() {
return pattern;
}
/**
*
* The encryption settings, if any, that you want Elastic Transcoder to apply to your caption formats.
*
*
* @return The encryption settings, if any, that you want Elastic Transcoder to apply to your caption formats.
*/
public final Encryption encryption() {
return encryption;
}
@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(format());
hashCode = 31 * hashCode + Objects.hashCode(pattern());
hashCode = 31 * hashCode + Objects.hashCode(encryption());
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 CaptionFormat)) {
return false;
}
CaptionFormat other = (CaptionFormat) obj;
return Objects.equals(format(), other.format()) && Objects.equals(pattern(), other.pattern())
&& Objects.equals(encryption(), other.encryption());
}
/**
* 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("CaptionFormat").add("Format", format()).add("Pattern", pattern())
.add("Encryption", encryption()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Format":
return Optional.ofNullable(clazz.cast(format()));
case "Pattern":
return Optional.ofNullable(clazz.cast(pattern()));
case "Encryption":
return Optional.ofNullable(clazz.cast(encryption()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function