From 1be4960464d6949db4b0333a76c694059a9a30b7 Mon Sep 17 00:00:00 2001 From: samrobinson Date: Mon, 18 Jan 2021 14:22:30 +0000 Subject: [PATCH] Implement a segment based speed provider and interface. PiperOrigin-RevId: 352401836 --- .../exoplayer2/metadata/mp4/SlowMotionData.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java b/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java index 88623f6305..ae8698b66a 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java @@ -23,7 +23,9 @@ import androidx.annotation.Nullable; import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.util.Util; import com.google.common.base.Objects; +import com.google.common.collect.ComparisonChain; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; /** Holds information about the segments of slow motion playback within a track. */ @@ -32,6 +34,14 @@ public final class SlowMotionData implements Metadata.Entry { /** Holds information about a single segment of slow motion playback within a track. */ public static final class Segment implements Parcelable { + public static final Comparator BY_START_THEN_END_THEN_DIVISOR = + (s1, s2) -> + ComparisonChain.start() + .compare(s1.startTimeMs, s2.startTimeMs) + .compare(s1.endTimeMs, s2.endTimeMs) + .compare(s1.speedDivisor, s2.speedDivisor) + .result(); + /** The start time, in milliseconds, of the track segment that is intended to be slow motion. */ public final long startTimeMs; /** The end time, in milliseconds, of the track segment that is intended to be slow motion. */