/* * Copyright 2010-2023 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 com.amazonaws.services.rekognition.model; import java.io.Serializable; /** *

* A technical cue or shot detection segment detected in a video. An array of * SegmentDetection objects containing all segments detected in a * stored video is returned by GetSegmentDetection. *

*/ public class SegmentDetection implements Serializable { /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT */ private String type; /** *

* The start time of the detected segment in milliseconds from the start of * the video. This value is rounded down. For example, if the actual * timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a * value of 100 millis. *

*/ private Long startTimestampMillis; /** *

* The end time of the detected segment, in milliseconds, from the start of * the video. This value is rounded down. *

*/ private Long endTimestampMillis; /** *

* The duration of the detected segment in milliseconds. *

*

* Constraints:
* Range: 0 -
*/ private Long durationMillis; /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the * start of a detected segment. StartTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

*/ private String startTimecodeSMPTE; /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the end * of a detected segment. EndTimecode is in HH:MM:SS:fr * format (and ;fr for drop frame-rates). *

*/ private String endTimecodeSMPTE; /** *

* The duration of the timecode for the detected segment in SMPTE format. *

*/ private String durationSMPTE; /** *

* If the segment is a technical cue, contains information about the * technical cue. *

*/ private TechnicalCueSegment technicalCueSegment; /** *

* If the segment is a shot detection, contains information about the shot * detection. *

*/ private ShotSegment shotSegment; /** *

* The frame number of the start of a video segment, using a frame index * that starts with 0. *

*

* Constraints:
* Range: 0 -
*/ private Long startFrameNumber; /** *

* The frame number at the end of a video segment, using a frame index that * starts with 0. *

*

* Constraints:
* Range: 0 -
*/ private Long endFrameNumber; /** *

* The duration of a video segment, expressed in frames. *

*

* Constraints:
* Range: 0 -
*/ private Long durationFrames; /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT * * @return

* The type of the segment. Valid values are * TECHNICAL_CUE and SHOT. *

* @see SegmentType */ public String getType() { return type; } /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT * * @param type

* The type of the segment. Valid values are * TECHNICAL_CUE and SHOT. *

* @see SegmentType */ public void setType(String type) { this.type = type; } /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT * * @param type

* The type of the segment. Valid values are * TECHNICAL_CUE and SHOT. *

* @return A reference to this updated object so that method calls can be * chained together. * @see SegmentType */ public SegmentDetection withType(String type) { this.type = type; return this; } /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT * * @param type

* The type of the segment. Valid values are * TECHNICAL_CUE and SHOT. *

* @see SegmentType */ public void setType(SegmentType type) { this.type = type.toString(); } /** *

* The type of the segment. Valid values are TECHNICAL_CUE and * SHOT. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Allowed Values: TECHNICAL_CUE, SHOT * * @param type

* The type of the segment. Valid values are * TECHNICAL_CUE and SHOT. *

* @return A reference to this updated object so that method calls can be * chained together. * @see SegmentType */ public SegmentDetection withType(SegmentType type) { this.type = type.toString(); return this; } /** *

* The start time of the detected segment in milliseconds from the start of * the video. This value is rounded down. For example, if the actual * timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a * value of 100 millis. *

* * @return

* The start time of the detected segment in milliseconds from the * start of the video. This value is rounded down. For example, if * the actual timestamp is 100.6667 milliseconds, Amazon Rekognition * Video returns a value of 100 millis. *

*/ public Long getStartTimestampMillis() { return startTimestampMillis; } /** *

* The start time of the detected segment in milliseconds from the start of * the video. This value is rounded down. For example, if the actual * timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a * value of 100 millis. *

* * @param startTimestampMillis

* The start time of the detected segment in milliseconds from * the start of the video. This value is rounded down. For * example, if the actual timestamp is 100.6667 milliseconds, * Amazon Rekognition Video returns a value of 100 millis. *

*/ public void setStartTimestampMillis(Long startTimestampMillis) { this.startTimestampMillis = startTimestampMillis; } /** *

* The start time of the detected segment in milliseconds from the start of * the video. This value is rounded down. For example, if the actual * timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a * value of 100 millis. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param startTimestampMillis

* The start time of the detected segment in milliseconds from * the start of the video. This value is rounded down. For * example, if the actual timestamp is 100.6667 milliseconds, * Amazon Rekognition Video returns a value of 100 millis. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withStartTimestampMillis(Long startTimestampMillis) { this.startTimestampMillis = startTimestampMillis; return this; } /** *

* The end time of the detected segment, in milliseconds, from the start of * the video. This value is rounded down. *

* * @return

* The end time of the detected segment, in milliseconds, from the * start of the video. This value is rounded down. *

*/ public Long getEndTimestampMillis() { return endTimestampMillis; } /** *

* The end time of the detected segment, in milliseconds, from the start of * the video. This value is rounded down. *

* * @param endTimestampMillis

* The end time of the detected segment, in milliseconds, from * the start of the video. This value is rounded down. *

*/ public void setEndTimestampMillis(Long endTimestampMillis) { this.endTimestampMillis = endTimestampMillis; } /** *

* The end time of the detected segment, in milliseconds, from the start of * the video. This value is rounded down. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param endTimestampMillis

* The end time of the detected segment, in milliseconds, from * the start of the video. This value is rounded down. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withEndTimestampMillis(Long endTimestampMillis) { this.endTimestampMillis = endTimestampMillis; return this; } /** *

* The duration of the detected segment in milliseconds. *

*

* Constraints:
* Range: 0 -
* * @return

* The duration of the detected segment in milliseconds. *

*/ public Long getDurationMillis() { return durationMillis; } /** *

* The duration of the detected segment in milliseconds. *

*

* Constraints:
* Range: 0 -
* * @param durationMillis

* The duration of the detected segment in milliseconds. *

*/ public void setDurationMillis(Long durationMillis) { this.durationMillis = durationMillis; } /** *

* The duration of the detected segment in milliseconds. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 -
* * @param durationMillis

* The duration of the detected segment in milliseconds. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withDurationMillis(Long durationMillis) { this.durationMillis = durationMillis; return this; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the * start of a detected segment. StartTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

* * @return

* The frame-accurate SMPTE timecode, from the start of a video, for * the start of a detected segment. StartTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

*/ public String getStartTimecodeSMPTE() { return startTimecodeSMPTE; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the * start of a detected segment. StartTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

* * @param startTimecodeSMPTE

* The frame-accurate SMPTE timecode, from the start of a video, * for the start of a detected segment. * StartTimecode is in HH:MM:SS:fr format * (and ;fr for drop frame-rates). *

*/ public void setStartTimecodeSMPTE(String startTimecodeSMPTE) { this.startTimecodeSMPTE = startTimecodeSMPTE; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the * start of a detected segment. StartTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param startTimecodeSMPTE

* The frame-accurate SMPTE timecode, from the start of a video, * for the start of a detected segment. * StartTimecode is in HH:MM:SS:fr format * (and ;fr for drop frame-rates). *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withStartTimecodeSMPTE(String startTimecodeSMPTE) { this.startTimecodeSMPTE = startTimecodeSMPTE; return this; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the end * of a detected segment. EndTimecode is in HH:MM:SS:fr * format (and ;fr for drop frame-rates). *

* * @return

* The frame-accurate SMPTE timecode, from the start of a video, for * the end of a detected segment. EndTimecode is in * HH:MM:SS:fr format (and ;fr for drop frame-rates). *

*/ public String getEndTimecodeSMPTE() { return endTimecodeSMPTE; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the end * of a detected segment. EndTimecode is in HH:MM:SS:fr * format (and ;fr for drop frame-rates). *

* * @param endTimecodeSMPTE

* The frame-accurate SMPTE timecode, from the start of a video, * for the end of a detected segment. EndTimecode is * in HH:MM:SS:fr format (and ;fr for drop * frame-rates). *

*/ public void setEndTimecodeSMPTE(String endTimecodeSMPTE) { this.endTimecodeSMPTE = endTimecodeSMPTE; } /** *

* The frame-accurate SMPTE timecode, from the start of a video, for the end * of a detected segment. EndTimecode is in HH:MM:SS:fr * format (and ;fr for drop frame-rates). *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param endTimecodeSMPTE

* The frame-accurate SMPTE timecode, from the start of a video, * for the end of a detected segment. EndTimecode is * in HH:MM:SS:fr format (and ;fr for drop * frame-rates). *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withEndTimecodeSMPTE(String endTimecodeSMPTE) { this.endTimecodeSMPTE = endTimecodeSMPTE; return this; } /** *

* The duration of the timecode for the detected segment in SMPTE format. *

* * @return

* The duration of the timecode for the detected segment in SMPTE * format. *

*/ public String getDurationSMPTE() { return durationSMPTE; } /** *

* The duration of the timecode for the detected segment in SMPTE format. *

* * @param durationSMPTE

* The duration of the timecode for the detected segment in SMPTE * format. *

*/ public void setDurationSMPTE(String durationSMPTE) { this.durationSMPTE = durationSMPTE; } /** *

* The duration of the timecode for the detected segment in SMPTE format. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param durationSMPTE

* The duration of the timecode for the detected segment in SMPTE * format. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withDurationSMPTE(String durationSMPTE) { this.durationSMPTE = durationSMPTE; return this; } /** *

* If the segment is a technical cue, contains information about the * technical cue. *

* * @return

* If the segment is a technical cue, contains information about the * technical cue. *

*/ public TechnicalCueSegment getTechnicalCueSegment() { return technicalCueSegment; } /** *

* If the segment is a technical cue, contains information about the * technical cue. *

* * @param technicalCueSegment

* If the segment is a technical cue, contains information about * the technical cue. *

*/ public void setTechnicalCueSegment(TechnicalCueSegment technicalCueSegment) { this.technicalCueSegment = technicalCueSegment; } /** *

* If the segment is a technical cue, contains information about the * technical cue. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param technicalCueSegment

* If the segment is a technical cue, contains information about * the technical cue. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withTechnicalCueSegment(TechnicalCueSegment technicalCueSegment) { this.technicalCueSegment = technicalCueSegment; return this; } /** *

* If the segment is a shot detection, contains information about the shot * detection. *

* * @return

* If the segment is a shot detection, contains information about * the shot detection. *

*/ public ShotSegment getShotSegment() { return shotSegment; } /** *

* If the segment is a shot detection, contains information about the shot * detection. *

* * @param shotSegment

* If the segment is a shot detection, contains information about * the shot detection. *

*/ public void setShotSegment(ShotSegment shotSegment) { this.shotSegment = shotSegment; } /** *

* If the segment is a shot detection, contains information about the shot * detection. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param shotSegment

* If the segment is a shot detection, contains information about * the shot detection. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withShotSegment(ShotSegment shotSegment) { this.shotSegment = shotSegment; return this; } /** *

* The frame number of the start of a video segment, using a frame index * that starts with 0. *

*

* Constraints:
* Range: 0 -
* * @return

* The frame number of the start of a video segment, using a frame * index that starts with 0. *

*/ public Long getStartFrameNumber() { return startFrameNumber; } /** *

* The frame number of the start of a video segment, using a frame index * that starts with 0. *

*

* Constraints:
* Range: 0 -
* * @param startFrameNumber

* The frame number of the start of a video segment, using a * frame index that starts with 0. *

*/ public void setStartFrameNumber(Long startFrameNumber) { this.startFrameNumber = startFrameNumber; } /** *

* The frame number of the start of a video segment, using a frame index * that starts with 0. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 -
* * @param startFrameNumber

* The frame number of the start of a video segment, using a * frame index that starts with 0. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withStartFrameNumber(Long startFrameNumber) { this.startFrameNumber = startFrameNumber; return this; } /** *

* The frame number at the end of a video segment, using a frame index that * starts with 0. *

*

* Constraints:
* Range: 0 -
* * @return

* The frame number at the end of a video segment, using a frame * index that starts with 0. *

*/ public Long getEndFrameNumber() { return endFrameNumber; } /** *

* The frame number at the end of a video segment, using a frame index that * starts with 0. *

*

* Constraints:
* Range: 0 -
* * @param endFrameNumber

* The frame number at the end of a video segment, using a frame * index that starts with 0. *

*/ public void setEndFrameNumber(Long endFrameNumber) { this.endFrameNumber = endFrameNumber; } /** *

* The frame number at the end of a video segment, using a frame index that * starts with 0. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 -
* * @param endFrameNumber

* The frame number at the end of a video segment, using a frame * index that starts with 0. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withEndFrameNumber(Long endFrameNumber) { this.endFrameNumber = endFrameNumber; return this; } /** *

* The duration of a video segment, expressed in frames. *

*

* Constraints:
* Range: 0 -
* * @return

* The duration of a video segment, expressed in frames. *

*/ public Long getDurationFrames() { return durationFrames; } /** *

* The duration of a video segment, expressed in frames. *

*

* Constraints:
* Range: 0 -
* * @param durationFrames

* The duration of a video segment, expressed in frames. *

*/ public void setDurationFrames(Long durationFrames) { this.durationFrames = durationFrames; } /** *

* The duration of a video segment, expressed in frames. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 -
* * @param durationFrames

* The duration of a video segment, expressed in frames. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SegmentDetection withDurationFrames(Long durationFrames) { this.durationFrames = durationFrames; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getType() != null) sb.append("Type: " + getType() + ","); if (getStartTimestampMillis() != null) sb.append("StartTimestampMillis: " + getStartTimestampMillis() + ","); if (getEndTimestampMillis() != null) sb.append("EndTimestampMillis: " + getEndTimestampMillis() + ","); if (getDurationMillis() != null) sb.append("DurationMillis: " + getDurationMillis() + ","); if (getStartTimecodeSMPTE() != null) sb.append("StartTimecodeSMPTE: " + getStartTimecodeSMPTE() + ","); if (getEndTimecodeSMPTE() != null) sb.append("EndTimecodeSMPTE: " + getEndTimecodeSMPTE() + ","); if (getDurationSMPTE() != null) sb.append("DurationSMPTE: " + getDurationSMPTE() + ","); if (getTechnicalCueSegment() != null) sb.append("TechnicalCueSegment: " + getTechnicalCueSegment() + ","); if (getShotSegment() != null) sb.append("ShotSegment: " + getShotSegment() + ","); if (getStartFrameNumber() != null) sb.append("StartFrameNumber: " + getStartFrameNumber() + ","); if (getEndFrameNumber() != null) sb.append("EndFrameNumber: " + getEndFrameNumber() + ","); if (getDurationFrames() != null) sb.append("DurationFrames: " + getDurationFrames()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getStartTimestampMillis() == null) ? 0 : getStartTimestampMillis().hashCode()); hashCode = prime * hashCode + ((getEndTimestampMillis() == null) ? 0 : getEndTimestampMillis().hashCode()); hashCode = prime * hashCode + ((getDurationMillis() == null) ? 0 : getDurationMillis().hashCode()); hashCode = prime * hashCode + ((getStartTimecodeSMPTE() == null) ? 0 : getStartTimecodeSMPTE().hashCode()); hashCode = prime * hashCode + ((getEndTimecodeSMPTE() == null) ? 0 : getEndTimecodeSMPTE().hashCode()); hashCode = prime * hashCode + ((getDurationSMPTE() == null) ? 0 : getDurationSMPTE().hashCode()); hashCode = prime * hashCode + ((getTechnicalCueSegment() == null) ? 0 : getTechnicalCueSegment().hashCode()); hashCode = prime * hashCode + ((getShotSegment() == null) ? 0 : getShotSegment().hashCode()); hashCode = prime * hashCode + ((getStartFrameNumber() == null) ? 0 : getStartFrameNumber().hashCode()); hashCode = prime * hashCode + ((getEndFrameNumber() == null) ? 0 : getEndFrameNumber().hashCode()); hashCode = prime * hashCode + ((getDurationFrames() == null) ? 0 : getDurationFrames().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SegmentDetection == false) return false; SegmentDetection other = (SegmentDetection) obj; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getStartTimestampMillis() == null ^ this.getStartTimestampMillis() == null) return false; if (other.getStartTimestampMillis() != null && other.getStartTimestampMillis().equals(this.getStartTimestampMillis()) == false) return false; if (other.getEndTimestampMillis() == null ^ this.getEndTimestampMillis() == null) return false; if (other.getEndTimestampMillis() != null && other.getEndTimestampMillis().equals(this.getEndTimestampMillis()) == false) return false; if (other.getDurationMillis() == null ^ this.getDurationMillis() == null) return false; if (other.getDurationMillis() != null && other.getDurationMillis().equals(this.getDurationMillis()) == false) return false; if (other.getStartTimecodeSMPTE() == null ^ this.getStartTimecodeSMPTE() == null) return false; if (other.getStartTimecodeSMPTE() != null && other.getStartTimecodeSMPTE().equals(this.getStartTimecodeSMPTE()) == false) return false; if (other.getEndTimecodeSMPTE() == null ^ this.getEndTimecodeSMPTE() == null) return false; if (other.getEndTimecodeSMPTE() != null && other.getEndTimecodeSMPTE().equals(this.getEndTimecodeSMPTE()) == false) return false; if (other.getDurationSMPTE() == null ^ this.getDurationSMPTE() == null) return false; if (other.getDurationSMPTE() != null && other.getDurationSMPTE().equals(this.getDurationSMPTE()) == false) return false; if (other.getTechnicalCueSegment() == null ^ this.getTechnicalCueSegment() == null) return false; if (other.getTechnicalCueSegment() != null && other.getTechnicalCueSegment().equals(this.getTechnicalCueSegment()) == false) return false; if (other.getShotSegment() == null ^ this.getShotSegment() == null) return false; if (other.getShotSegment() != null && other.getShotSegment().equals(this.getShotSegment()) == false) return false; if (other.getStartFrameNumber() == null ^ this.getStartFrameNumber() == null) return false; if (other.getStartFrameNumber() != null && other.getStartFrameNumber().equals(this.getStartFrameNumber()) == false) return false; if (other.getEndFrameNumber() == null ^ this.getEndFrameNumber() == null) return false; if (other.getEndFrameNumber() != null && other.getEndFrameNumber().equals(this.getEndFrameNumber()) == false) return false; if (other.getDurationFrames() == null ^ this.getDurationFrames() == null) return false; if (other.getDurationFrames() != null && other.getDurationFrames().equals(this.getDurationFrames()) == false) return false; return true; } }