diff --git a/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SefSlowMotion.java b/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java similarity index 88% rename from library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SefSlowMotion.java rename to library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java index d3e9f29d5c..01448508d7 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SefSlowMotion.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/metadata/mp4/SlowMotionData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.List; /** Holds information about the segments of slow motion playback within a track. */ -public final class SefSlowMotion implements Metadata.Entry { +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 { @@ -114,13 +114,13 @@ public final class SefSlowMotion implements Metadata.Entry { public final List segments; /** Creates an instance with a list of {@link Segment}s. */ - public SefSlowMotion(List segments) { + public SlowMotionData(List segments) { this.segments = segments; } @Override public String toString() { - return "SefSlowMotion: segments=" + segments; + return "SlowMotion: segments=" + segments; } @Override @@ -131,7 +131,7 @@ public final class SefSlowMotion implements Metadata.Entry { if (o == null || getClass() != o.getClass()) { return false; } - SefSlowMotion that = (SefSlowMotion) o; + SlowMotionData that = (SlowMotionData) o; return segments.equals(that.segments); } @@ -150,18 +150,18 @@ public final class SefSlowMotion implements Metadata.Entry { dest.writeList(segments); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator() { @Override - public SefSlowMotion createFromParcel(Parcel in) { + public SlowMotionData createFromParcel(Parcel in) { List slowMotionSegments = new ArrayList<>(); in.readList(slowMotionSegments, Segment.class.getClassLoader()); - return new SefSlowMotion(slowMotionSegments); + return new SlowMotionData(slowMotionSegments); } @Override - public SefSlowMotion[] newArray(int size) { - return new SefSlowMotion[size]; + public SlowMotionData[] newArray(int size) { + return new SlowMotionData[size]; } }; } diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java index 5e5848a017..2a6346fb87 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java @@ -41,7 +41,7 @@ import com.google.android.exoplayer2.extractor.TrackOutput; import com.google.android.exoplayer2.extractor.mp4.Atom.ContainerAtom; import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.metadata.mp4.MotionPhotoMetadata; -import com.google.android.exoplayer2.metadata.mp4.SefSlowMotion; +import com.google.android.exoplayer2.metadata.mp4.SlowMotionData; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.NalUnitUtil; @@ -90,7 +90,7 @@ public final class Mp4Extractor implements Extractor, SeekMap { */ public static final int FLAG_READ_MOTION_PHOTO_METADATA = 1 << 1; /** - * Flag to extract {@link SefSlowMotion} metadata from Samsung Extension Format (SEF) slow motion + * Flag to extract {@link SlowMotionData} metadata from Samsung Extension Format (SEF) slow motion * videos. */ public static final int FLAG_READ_SEF_DATA = 1 << 2; diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java index 2978e0f714..c44671a255 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/SefReader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import com.google.android.exoplayer2.extractor.Extractor; import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.extractor.PositionHolder; import com.google.android.exoplayer2.metadata.Metadata; -import com.google.android.exoplayer2.metadata.mp4.SefSlowMotion; +import com.google.android.exoplayer2.metadata.mp4.SlowMotionData; import com.google.android.exoplayer2.util.ParsableByteArray; import com.google.common.base.Splitter; import java.io.IOException; @@ -184,7 +184,7 @@ import java.util.List; DataReference dataReference = dataReferences.get(i); if (dataReference.dataType == TYPE_SLOW_MOTION_DATA) { scratch.skipBytes(23); // data type (2), data sub info (2), name len (4), name (15). - List segments = new ArrayList<>(); + List segments = new ArrayList<>(); int dataReferenceEndPosition = totalDataReferenceBytesConsumed + dataReference.size; while (scratch.getPosition() < dataReferenceEndPosition) { @Nullable String data = scratch.readDelimiterTerminatedString('*'); @@ -197,13 +197,13 @@ import java.util.List; int endTimeMs = Integer.parseInt(values.get(1)); int speedMode = Integer.parseInt(values.get(2)); int speedDivisor = 1 << (speedMode - 1); - segments.add(new SefSlowMotion.Segment(startTimeMs, endTimeMs, speedDivisor)); + segments.add(new SlowMotionData.Segment(startTimeMs, endTimeMs, speedDivisor)); } catch (NumberFormatException e) { throw new ParserException(e); } } totalDataReferenceBytesConsumed += dataReference.size; - slowMotionMetadataEntries.add(new SefSlowMotion(segments)); + slowMotionMetadataEntries.add(new SlowMotionData(segments)); } } } diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SefSlowMotionTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SlowMotionDataTest.java similarity index 66% rename from library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SefSlowMotionTest.java rename to library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SlowMotionDataTest.java index fe602a1790..5b1c33303d 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SefSlowMotionTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/SlowMotionDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,52 +19,52 @@ import static com.google.common.truth.Truth.assertThat; import android.os.Parcel; import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.google.android.exoplayer2.metadata.mp4.SefSlowMotion; +import com.google.android.exoplayer2.metadata.mp4.SlowMotionData; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -/** Unit test for {@link SefSlowMotion} */ +/** Unit test for {@link SlowMotionData} */ @RunWith(AndroidJUnit4.class) -public class SefSlowMotionTest { +public class SlowMotionDataTest { @Test public void parcelable() { - List segments = new ArrayList<>(); + List segments = new ArrayList<>(); segments.add( - new SefSlowMotion.Segment( + new SlowMotionData.Segment( /* startTimeMs= */ 1000, /* endTimeMs= */ 2000, /* speedDivisor= */ 4)); segments.add( - new SefSlowMotion.Segment( + new SlowMotionData.Segment( /* startTimeMs= */ 2600, /* endTimeMs= */ 4000, /* speedDivisor= */ 8)); segments.add( - new SefSlowMotion.Segment( + new SlowMotionData.Segment( /* startTimeMs= */ 8765, /* endTimeMs= */ 12485, /* speedDivisor= */ 16)); - SefSlowMotion sefSlowMotionToParcel = new SefSlowMotion(segments); + SlowMotionData slowMotionDataToParcel = new SlowMotionData(segments); Parcel parcel = Parcel.obtain(); - sefSlowMotionToParcel.writeToParcel(parcel, /* flags= */ 0); + slowMotionDataToParcel.writeToParcel(parcel, /* flags= */ 0); parcel.setDataPosition(0); - SefSlowMotion sefSlowMotionFromParcel = SefSlowMotion.CREATOR.createFromParcel(parcel); - assertThat(sefSlowMotionFromParcel).isEqualTo(sefSlowMotionToParcel); + SlowMotionData slowMotionDataFromParcel = SlowMotionData.CREATOR.createFromParcel(parcel); + assertThat(slowMotionDataFromParcel).isEqualTo(slowMotionDataToParcel); parcel.recycle(); } @Test public void segment_parcelable() { - SefSlowMotion.Segment segmentToParcel = - new SefSlowMotion.Segment( + SlowMotionData.Segment segmentToParcel = + new SlowMotionData.Segment( /* startTimeMs= */ 1000, /* endTimeMs= */ 2000, /* speedDivisor= */ 4); Parcel parcel = Parcel.obtain(); segmentToParcel.writeToParcel(parcel, /* flags= */ 0); parcel.setDataPosition(0); - SefSlowMotion.Segment segmentFromParcel = - SefSlowMotion.Segment.CREATOR.createFromParcel(parcel); + SlowMotionData.Segment segmentFromParcel = + SlowMotionData.Segment.CREATOR.createFromParcel(parcel); assertThat(segmentFromParcel).isEqualTo(segmentToParcel); parcel.recycle();