mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove Parcelable
interface from Metadata
and Metadata.Entry
`Parcelable` is not safe for IPCs between binaries with potentially different class definitions (e.g. two apps built from different versions of media3). If we get a use case to bundle metadata, then the `Metadata` and `Metadata.Entry` classes needs to provide a `toBundle()` method. PiperOrigin-RevId: 706678892
This commit is contained in:
parent
1326a92350
commit
319ac2e5af
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.common;
|
package androidx.media3.common;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -26,10 +24,10 @@ import java.util.List;
|
|||||||
|
|
||||||
/** A collection of metadata entries. */
|
/** A collection of metadata entries. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class Metadata implements Parcelable {
|
public final class Metadata {
|
||||||
|
|
||||||
/** A metadata entry. */
|
/** A metadata entry. */
|
||||||
public interface Entry extends Parcelable {
|
public interface Entry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Format} that can be used to decode the wrapped metadata in {@link
|
* Returns the {@link Format} that can be used to decode the wrapped metadata in {@link
|
||||||
@ -100,14 +98,6 @@ public final class Metadata implements Parcelable {
|
|||||||
this(presentationTimeUs, entries.toArray(new Entry[0]));
|
this(presentationTimeUs, entries.toArray(new Entry[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ Metadata(Parcel in) {
|
|
||||||
entries = new Metadata.Entry[in.readInt()];
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
|
||||||
entries[i] = in.readParcelable(Entry.class.getClassLoader());
|
|
||||||
}
|
|
||||||
presentationTimeUs = in.readLong();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the number of metadata entries. */
|
/** Returns the number of metadata entries. */
|
||||||
public int length() {
|
public int length() {
|
||||||
return entries.length;
|
return entries.length;
|
||||||
@ -190,33 +180,4 @@ public final class Metadata implements Parcelable {
|
|||||||
+ Arrays.toString(entries)
|
+ Arrays.toString(entries)
|
||||||
+ (presentationTimeUs == C.TIME_UNSET ? "" : ", presentationTimeUs=" + presentationTimeUs);
|
+ (presentationTimeUs == C.TIME_UNSET ? "" : ", presentationTimeUs=" + presentationTimeUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(entries.length);
|
|
||||||
for (Entry entry : entries) {
|
|
||||||
dest.writeParcelable(entry, 0);
|
|
||||||
}
|
|
||||||
dest.writeLong(presentationTimeUs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<Metadata> CREATOR =
|
|
||||||
new Parcelable.Creator<Metadata>() {
|
|
||||||
@Override
|
|
||||||
public Metadata createFromParcel(Parcel in) {
|
|
||||||
return new Metadata(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Metadata[] newArray(int size) {
|
|
||||||
return new Metadata[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.common;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.test.utils.FakeMetadataEntry;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Tests for {@link Metadata}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class MetadataTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
Metadata metadataToParcel =
|
|
||||||
new Metadata(
|
|
||||||
/* presentationTimeUs= */ 1_230_000,
|
|
||||||
new FakeMetadataEntry("id1"),
|
|
||||||
new FakeMetadataEntry("id2"));
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
metadataToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
Metadata metadataFromParcel = Metadata.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(metadataFromParcel).isEqualTo(metadataToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,8 +18,6 @@ package androidx.media3.container;
|
|||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
import static androidx.media3.common.util.Assertions.checkState;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
@ -111,14 +109,6 @@ public final class MdtaMetadataEntry implements Metadata.Entry {
|
|||||||
this.typeIndicator = typeIndicator;
|
this.typeIndicator = typeIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MdtaMetadataEntry(Parcel in) {
|
|
||||||
key = Util.castNonNull(in.readString());
|
|
||||||
value = Util.castNonNull(in.createByteArray());
|
|
||||||
localeIndicator = in.readInt();
|
|
||||||
typeIndicator = in.readInt();
|
|
||||||
validateData(key, value, typeIndicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the auxiliary track types from the {@linkplain #KEY_AUXILIARY_TRACKS_MAP auxiliary
|
* Returns the auxiliary track types from the {@linkplain #KEY_AUXILIARY_TRACKS_MAP auxiliary
|
||||||
* tracks map} metadata.
|
* tracks map} metadata.
|
||||||
@ -191,35 +181,6 @@ public final class MdtaMetadataEntry implements Metadata.Entry {
|
|||||||
return "mdta: key=" + key + ", value=" + formattedValue;
|
return "mdta: key=" + key + ", value=" + formattedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(key);
|
|
||||||
dest.writeByteArray(value);
|
|
||||||
dest.writeInt(localeIndicator);
|
|
||||||
dest.writeInt(typeIndicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<MdtaMetadataEntry> CREATOR =
|
|
||||||
new Parcelable.Creator<MdtaMetadataEntry>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MdtaMetadataEntry createFromParcel(Parcel in) {
|
|
||||||
return new MdtaMetadataEntry(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MdtaMetadataEntry[] newArray(int size) {
|
|
||||||
return new MdtaMetadataEntry[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static void validateData(String key, byte[] value, int typeIndicator) {
|
private static void validateData(String key, byte[] value, int typeIndicator) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case KEY_ANDROID_CAPTURE_FPS:
|
case KEY_ANDROID_CAPTURE_FPS:
|
||||||
|
@ -17,8 +17,6 @@ package androidx.media3.container;
|
|||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.FloatRange;
|
import androidx.annotation.FloatRange;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
@ -47,11 +45,6 @@ public final class Mp4LocationData implements Metadata.Entry {
|
|||||||
this.longitude = longitude;
|
this.longitude = longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mp4LocationData(Parcel in) {
|
|
||||||
latitude = in.readFloat();
|
|
||||||
longitude = in.readFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -76,31 +69,4 @@ public final class Mp4LocationData implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "xyz: latitude=" + latitude + ", longitude=" + longitude;
|
return "xyz: latitude=" + latitude + ", longitude=" + longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeFloat(latitude);
|
|
||||||
dest.writeFloat(longitude);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<Mp4LocationData> CREATOR =
|
|
||||||
new Parcelable.Creator<Mp4LocationData>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4LocationData createFromParcel(Parcel in) {
|
|
||||||
return new Mp4LocationData(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4LocationData[] newArray(int size) {
|
|
||||||
return new Mp4LocationData[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@ package androidx.media3.container;
|
|||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -41,10 +39,6 @@ public final class Mp4OrientationData implements Metadata.Entry {
|
|||||||
this.orientation = orientation;
|
this.orientation = orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mp4OrientationData(Parcel in) {
|
|
||||||
orientation = in.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -68,30 +62,4 @@ public final class Mp4OrientationData implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "Orientation= " + orientation;
|
return "Orientation= " + orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<Mp4OrientationData> CREATOR =
|
|
||||||
new Parcelable.Creator<Mp4OrientationData>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4OrientationData createFromParcel(Parcel in) {
|
|
||||||
return new Mp4OrientationData(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4OrientationData[] newArray(int size) {
|
|
||||||
return new Mp4OrientationData[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.container;
|
package androidx.media3.container;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -76,12 +74,6 @@ public final class Mp4TimestampData implements Metadata.Entry {
|
|||||||
this.timescale = timescale;
|
this.timescale = timescale;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mp4TimestampData(Parcel in) {
|
|
||||||
this.creationTimestampSeconds = in.readLong();
|
|
||||||
this.modificationTimestampSeconds = in.readLong();
|
|
||||||
this.timescale = in.readLong();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an MP4 timestamp (in seconds since midnight, January 1, 1904) from a Unix epoch
|
* Returns an MP4 timestamp (in seconds since midnight, January 1, 1904) from a Unix epoch
|
||||||
* timestamp (in milliseconds since midnight, January 1, 1970).
|
* timestamp (in milliseconds since midnight, January 1, 1970).
|
||||||
@ -124,32 +116,4 @@ public final class Mp4TimestampData implements Metadata.Entry {
|
|||||||
+ ", timescale="
|
+ ", timescale="
|
||||||
+ timescale;
|
+ timescale;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(creationTimestampSeconds);
|
|
||||||
dest.writeLong(modificationTimestampSeconds);
|
|
||||||
dest.writeLong(timescale);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<Mp4TimestampData> CREATOR =
|
|
||||||
new Parcelable.Creator<Mp4TimestampData>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4TimestampData createFromParcel(Parcel in) {
|
|
||||||
return new Mp4TimestampData(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mp4TimestampData[] newArray(int size) {
|
|
||||||
return new Mp4TimestampData[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.container;
|
package androidx.media3.container;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -33,10 +31,6 @@ public final class XmpData implements Metadata.Entry {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private XmpData(Parcel in) {
|
|
||||||
this.data = Util.castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -58,30 +52,4 @@ public final class XmpData implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "XMP: " + Util.toHexString(data);
|
return "XMP: " + Util.toHexString(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeByteArray(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<XmpData> CREATOR =
|
|
||||||
new Parcelable.Creator<XmpData>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public XmpData createFromParcel(Parcel in) {
|
|
||||||
return new XmpData(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public XmpData[] newArray(int size) {
|
|
||||||
return new XmpData[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.container;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link MdtaMetadataEntry}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class MdtaMetadataEntryTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
MdtaMetadataEntry mdtaMetadataEntryToParcel =
|
|
||||||
new MdtaMetadataEntry(
|
|
||||||
/* key= */ "test",
|
|
||||||
/* value= */ new byte[] {1, 2},
|
|
||||||
/* localeIndicator= */ 3,
|
|
||||||
/* typeIndicator= */ 4);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
mdtaMetadataEntryToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
MdtaMetadataEntry mdtaMetadataEntryFromParcel =
|
|
||||||
MdtaMetadataEntry.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(mdtaMetadataEntryFromParcel).isEqualTo(mdtaMetadataEntryToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2024 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.container;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link Mp4OrientationData}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class Mp4OrientationDataTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
Mp4OrientationData mp4OrientationData = new Mp4OrientationData(/* orientation= */ 90);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
mp4OrientationData.writeToParcel(parcel, /* flags= */ 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
Mp4OrientationData mp4OrientationDataFromParcel =
|
|
||||||
Mp4OrientationData.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(mp4OrientationDataFromParcel).isEqualTo(mp4OrientationData);
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.exoplayer.hls;
|
package androidx.media3.exoplayer.hls;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -31,7 +29,7 @@ import java.util.List;
|
|||||||
public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
||||||
|
|
||||||
/** Holds attributes defined in an EXT-X-STREAM-INF tag. */
|
/** Holds attributes defined in an EXT-X-STREAM-INF tag. */
|
||||||
public static final class VariantInfo implements Parcelable {
|
public static final class VariantInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The average bitrate as declared by the AVERAGE-BANDWIDTH attribute of the EXT-X-STREAM-INF
|
* The average bitrate as declared by the AVERAGE-BANDWIDTH attribute of the EXT-X-STREAM-INF
|
||||||
@ -91,15 +89,6 @@ public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
|||||||
this.captionGroupId = captionGroupId;
|
this.captionGroupId = captionGroupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ VariantInfo(Parcel in) {
|
|
||||||
averageBitrate = in.readInt();
|
|
||||||
peakBitrate = in.readInt();
|
|
||||||
videoGroupId = in.readString();
|
|
||||||
audioGroupId = in.readString();
|
|
||||||
subtitleGroupId = in.readString();
|
|
||||||
captionGroupId = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object other) {
|
public boolean equals(@Nullable Object other) {
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
@ -127,36 +116,6 @@ public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
|||||||
result = 31 * result + (captionGroupId != null ? captionGroupId.hashCode() : 0);
|
result = 31 * result + (captionGroupId != null ? captionGroupId.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(averageBitrate);
|
|
||||||
dest.writeInt(peakBitrate);
|
|
||||||
dest.writeString(videoGroupId);
|
|
||||||
dest.writeString(audioGroupId);
|
|
||||||
dest.writeString(subtitleGroupId);
|
|
||||||
dest.writeString(captionGroupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<VariantInfo> CREATOR =
|
|
||||||
new Parcelable.Creator<VariantInfo>() {
|
|
||||||
@Override
|
|
||||||
public VariantInfo createFromParcel(Parcel in) {
|
|
||||||
return new VariantInfo(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VariantInfo[] newArray(int size) {
|
|
||||||
return new VariantInfo[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,17 +150,6 @@ public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
|||||||
this.variantInfos = Collections.unmodifiableList(new ArrayList<>(variantInfos));
|
this.variantInfos = Collections.unmodifiableList(new ArrayList<>(variantInfos));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ HlsTrackMetadataEntry(Parcel in) {
|
|
||||||
groupId = in.readString();
|
|
||||||
name = in.readString();
|
|
||||||
int variantInfoSize = in.readInt();
|
|
||||||
ArrayList<VariantInfo> variantInfos = new ArrayList<>(variantInfoSize);
|
|
||||||
for (int i = 0; i < variantInfoSize; i++) {
|
|
||||||
variantInfos.add(in.readParcelable(VariantInfo.class.getClassLoader()));
|
|
||||||
}
|
|
||||||
this.variantInfos = Collections.unmodifiableList(variantInfos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "HlsTrackMetadataEntry" + (groupId != null ? (" [" + groupId + ", " + name + "]") : "");
|
return "HlsTrackMetadataEntry" + (groupId != null ? (" [" + groupId + ", " + name + "]") : "");
|
||||||
@ -229,35 +177,4 @@ public final class HlsTrackMetadataEntry implements Metadata.Entry {
|
|||||||
result = 31 * result + variantInfos.hashCode();
|
result = 31 * result + variantInfos.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(groupId);
|
|
||||||
dest.writeString(name);
|
|
||||||
int variantInfosSize = variantInfos.size();
|
|
||||||
dest.writeInt(variantInfosSize);
|
|
||||||
for (int i = 0; i < variantInfosSize; i++) {
|
|
||||||
dest.writeParcelable(variantInfos.get(i), /* parcelableFlags= */ 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<HlsTrackMetadataEntry> CREATOR =
|
|
||||||
new Parcelable.Creator<HlsTrackMetadataEntry>() {
|
|
||||||
@Override
|
|
||||||
public HlsTrackMetadataEntry createFromParcel(Parcel in) {
|
|
||||||
return new HlsTrackMetadataEntry(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HlsTrackMetadataEntry[] newArray(int size) {
|
|
||||||
return new HlsTrackMetadataEntry[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.exoplayer.hls;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.exoplayer.hls.HlsTrackMetadataEntry.VariantInfo;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link HlsTrackMetadataEntry}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class HlsTrackMetadataEntryTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void variantInfo_parcelRoundTrip_isEqual() {
|
|
||||||
VariantInfo variantInfoToParcel =
|
|
||||||
new VariantInfo(
|
|
||||||
/* averageBitrate= */ 1024,
|
|
||||||
/* peakBitrate= */ 2048,
|
|
||||||
"videoGroupId",
|
|
||||||
"audioGroupId",
|
|
||||||
"subtitleGroupId",
|
|
||||||
"captionGroupId");
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
variantInfoToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
VariantInfo variantInfoFromParcel = VariantInfo.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(variantInfoFromParcel).isEqualTo(variantInfoToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,10 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.dvbsi;
|
package androidx.media3.extractor.metadata.dvbsi;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.Assertions;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,30 +51,4 @@ public final class AppInfoTable implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "Ait(controlCode=" + controlCode + ",url=" + url + ")";
|
return "Ait(controlCode=" + controlCode + ",url=" + url + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel parcel, int i) {
|
|
||||||
parcel.writeString(url);
|
|
||||||
parcel.writeInt(controlCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<AppInfoTable> CREATOR =
|
|
||||||
new Parcelable.Creator<AppInfoTable>() {
|
|
||||||
@Override
|
|
||||||
public AppInfoTable createFromParcel(Parcel in) {
|
|
||||||
String url = Assertions.checkNotNull(in.readString());
|
|
||||||
int controlCode = in.readInt();
|
|
||||||
return new AppInfoTable(controlCode, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AppInfoTable[] newArray(int size) {
|
|
||||||
return new AppInfoTable[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.emsg;
|
package androidx.media3.extractor.metadata.emsg;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -90,14 +86,6 @@ public final class EventMessage implements Metadata.Entry {
|
|||||||
this.messageData = messageData;
|
this.messageData = messageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ EventMessage(Parcel in) {
|
|
||||||
schemeIdUri = castNonNull(in.readString());
|
|
||||||
value = castNonNull(in.readString());
|
|
||||||
durationMs = in.readLong();
|
|
||||||
id = in.readLong();
|
|
||||||
messageData = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Format getWrappedMetadataFormat() {
|
public Format getWrappedMetadataFormat() {
|
||||||
@ -159,34 +147,4 @@ public final class EventMessage implements Metadata.Entry {
|
|||||||
+ ", value="
|
+ ", value="
|
||||||
+ value;
|
+ value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(schemeIdUri);
|
|
||||||
dest.writeString(value);
|
|
||||||
dest.writeLong(durationMs);
|
|
||||||
dest.writeLong(id);
|
|
||||||
dest.writeByteArray(messageData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<EventMessage> CREATOR =
|
|
||||||
new Parcelable.Creator<EventMessage>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventMessage createFromParcel(Parcel in) {
|
|
||||||
return new EventMessage(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventMessage[] newArray(int size) {
|
|
||||||
return new EventMessage[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.flac;
|
package androidx.media3.extractor.metadata.flac;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
@ -75,17 +71,6 @@ public final class PictureFrame implements Metadata.Entry {
|
|||||||
this.pictureData = pictureData;
|
this.pictureData = pictureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ PictureFrame(Parcel in) {
|
|
||||||
this.pictureType = in.readInt();
|
|
||||||
this.mimeType = castNonNull(in.readString());
|
|
||||||
this.description = castNonNull(in.readString());
|
|
||||||
this.width = in.readInt();
|
|
||||||
this.height = in.readInt();
|
|
||||||
this.depth = in.readInt();
|
|
||||||
this.colors = in.readInt();
|
|
||||||
this.pictureData = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
||||||
builder.maybeSetArtworkData(pictureData, pictureType);
|
builder.maybeSetArtworkData(pictureData, pictureType);
|
||||||
@ -129,23 +114,6 @@ public final class PictureFrame implements Metadata.Entry {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(pictureType);
|
|
||||||
dest.writeString(mimeType);
|
|
||||||
dest.writeString(description);
|
|
||||||
dest.writeInt(width);
|
|
||||||
dest.writeInt(height);
|
|
||||||
dest.writeInt(depth);
|
|
||||||
dest.writeInt(colors);
|
|
||||||
dest.writeByteArray(pictureData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a {@code METADATA_BLOCK_PICTURE} into a {@code PictureFrame} instance.
|
* Parses a {@code METADATA_BLOCK_PICTURE} into a {@code PictureFrame} instance.
|
||||||
*
|
*
|
||||||
@ -176,18 +144,4 @@ public final class PictureFrame implements Metadata.Entry {
|
|||||||
return new PictureFrame(
|
return new PictureFrame(
|
||||||
pictureType, mimeType, description, width, height, depth, colors, pictureData);
|
pictureType, mimeType, description, width, height, depth, colors, pictureData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<PictureFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<PictureFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PictureFrame createFromParcel(Parcel in) {
|
|
||||||
return new PictureFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PictureFrame[] newArray(int size) {
|
|
||||||
return new PictureFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.flac;
|
package androidx.media3.extractor.metadata.flac;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
@ -52,11 +48,6 @@ public class VorbisComment implements Metadata.Entry {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VorbisComment(Parcel in) {
|
|
||||||
this.key = castNonNull(in.readString());
|
|
||||||
this.value = castNonNull(in.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
||||||
// Vorbis comments can have duplicate keys, but all these fields are singular on MediaMetadata,
|
// Vorbis comments can have duplicate keys, but all these fields are singular on MediaMetadata,
|
||||||
@ -134,31 +125,4 @@ public class VorbisComment implements Metadata.Entry {
|
|||||||
result = 31 * result + value.hashCode();
|
result = 31 * result + value.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(key);
|
|
||||||
dest.writeString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<VorbisComment> CREATOR =
|
|
||||||
new Parcelable.Creator<VorbisComment>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VorbisComment createFromParcel(Parcel in) {
|
|
||||||
return new VorbisComment(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VorbisComment[] newArray(int size) {
|
|
||||||
return new VorbisComment[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.icy;
|
package androidx.media3.extractor.metadata.icy;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -167,15 +165,6 @@ public final class IcyHeaders implements Metadata.Entry {
|
|||||||
this.metadataInterval = metadataInterval;
|
this.metadataInterval = metadataInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ IcyHeaders(Parcel in) {
|
|
||||||
bitrate = in.readInt();
|
|
||||||
genre = in.readString();
|
|
||||||
name = in.readString();
|
|
||||||
url = in.readString();
|
|
||||||
isPublic = Util.readBoolean(in);
|
|
||||||
metadataInterval = in.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@ -226,35 +215,4 @@ public final class IcyHeaders implements Metadata.Entry {
|
|||||||
+ ", metadataInterval="
|
+ ", metadataInterval="
|
||||||
+ metadataInterval;
|
+ metadataInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(bitrate);
|
|
||||||
dest.writeString(genre);
|
|
||||||
dest.writeString(name);
|
|
||||||
dest.writeString(url);
|
|
||||||
Util.writeBoolean(dest, isPublic);
|
|
||||||
dest.writeInt(metadataInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<IcyHeaders> CREATOR =
|
|
||||||
new Parcelable.Creator<IcyHeaders>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IcyHeaders createFromParcel(Parcel in) {
|
|
||||||
return new IcyHeaders(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IcyHeaders[] newArray(int size) {
|
|
||||||
return new IcyHeaders[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.icy;
|
package androidx.media3.extractor.metadata.icy;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.Assertions;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@ -51,12 +48,6 @@ public final class IcyInfo implements Metadata.Entry {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ IcyInfo(Parcel in) {
|
|
||||||
rawMetadata = Assertions.checkNotNull(in.createByteArray());
|
|
||||||
title = in.readString();
|
|
||||||
url = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
@ -88,32 +79,4 @@ public final class IcyInfo implements Metadata.Entry {
|
|||||||
return String.format(
|
return String.format(
|
||||||
"ICY: title=\"%s\", url=\"%s\", rawMetadata.length=\"%s\"", title, url, rawMetadata.length);
|
"ICY: title=\"%s\", url=\"%s\", rawMetadata.length=\"%s\"", title, url, rawMetadata.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeByteArray(rawMetadata);
|
|
||||||
dest.writeString(title);
|
|
||||||
dest.writeString(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<IcyInfo> CREATOR =
|
|
||||||
new Parcelable.Creator<IcyInfo>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IcyInfo createFromParcel(Parcel in) {
|
|
||||||
return new IcyInfo(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IcyInfo[] newArray(int size) {
|
|
||||||
return new IcyInfo[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -45,14 +41,6 @@ public final class ApicFrame extends Id3Frame {
|
|||||||
this.pictureData = pictureData;
|
this.pictureData = pictureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ ApicFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
mimeType = castNonNull(in.readString());
|
|
||||||
description = in.readString();
|
|
||||||
pictureType = in.readInt();
|
|
||||||
pictureData = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
public void populateMediaMetadata(MediaMetadata.Builder builder) {
|
||||||
builder.maybeSetArtworkData(pictureData, pictureType);
|
builder.maybeSetArtworkData(pictureData, pictureType);
|
||||||
@ -87,28 +75,4 @@ public final class ApicFrame extends Id3Frame {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id + ": mimeType=" + mimeType + ", description=" + description;
|
return id + ": mimeType=" + mimeType + ", description=" + description;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(mimeType);
|
|
||||||
dest.writeString(description);
|
|
||||||
dest.writeInt(pictureType);
|
|
||||||
dest.writeByteArray(pictureData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<ApicFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<ApicFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApicFrame createFromParcel(Parcel in) {
|
|
||||||
return new ApicFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApicFrame[] newArray(int size) {
|
|
||||||
return new ApicFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -34,11 +30,6 @@ public final class BinaryFrame extends Id3Frame {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ BinaryFrame(Parcel in) {
|
|
||||||
super(castNonNull(in.readString()));
|
|
||||||
data = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -58,24 +49,4 @@ public final class BinaryFrame extends Id3Frame {
|
|||||||
result = 31 * result + Arrays.hashCode(data);
|
result = 31 * result + Arrays.hashCode(data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeByteArray(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<BinaryFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<BinaryFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BinaryFrame createFromParcel(Parcel in) {
|
|
||||||
return new BinaryFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BinaryFrame[] newArray(int size) {
|
|
||||||
return new BinaryFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -58,20 +55,6 @@ public final class ChapterFrame extends Id3Frame {
|
|||||||
this.subFrames = subFrames;
|
this.subFrames = subFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ ChapterFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
this.chapterId = castNonNull(in.readString());
|
|
||||||
this.startTimeMs = in.readInt();
|
|
||||||
this.endTimeMs = in.readInt();
|
|
||||||
this.startOffset = in.readLong();
|
|
||||||
this.endOffset = in.readLong();
|
|
||||||
int subFrameCount = in.readInt();
|
|
||||||
subFrames = new Id3Frame[subFrameCount];
|
|
||||||
for (int i = 0; i < subFrameCount; i++) {
|
|
||||||
subFrames[i] = in.readParcelable(Id3Frame.class.getClassLoader());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the number of sub-frames. */
|
/** Returns the number of sub-frames. */
|
||||||
public int getSubFrameCount() {
|
public int getSubFrameCount() {
|
||||||
return subFrames.length;
|
return subFrames.length;
|
||||||
@ -109,36 +92,4 @@ public final class ChapterFrame extends Id3Frame {
|
|||||||
result = 31 * result + (chapterId != null ? chapterId.hashCode() : 0);
|
result = 31 * result + (chapterId != null ? chapterId.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(chapterId);
|
|
||||||
dest.writeInt(startTimeMs);
|
|
||||||
dest.writeInt(endTimeMs);
|
|
||||||
dest.writeLong(startOffset);
|
|
||||||
dest.writeLong(endOffset);
|
|
||||||
dest.writeInt(subFrames.length);
|
|
||||||
for (Id3Frame subFrame : subFrames) {
|
|
||||||
dest.writeParcelable(subFrame, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<ChapterFrame> CREATOR =
|
|
||||||
new Creator<ChapterFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterFrame createFromParcel(Parcel in) {
|
|
||||||
return new ChapterFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterFrame[] newArray(int size) {
|
|
||||||
return new ChapterFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -49,19 +46,6 @@ public final class ChapterTocFrame extends Id3Frame {
|
|||||||
this.subFrames = subFrames;
|
this.subFrames = subFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ ChapterTocFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
this.elementId = castNonNull(in.readString());
|
|
||||||
this.isRoot = in.readByte() != 0;
|
|
||||||
this.isOrdered = in.readByte() != 0;
|
|
||||||
this.children = castNonNull(in.createStringArray());
|
|
||||||
int subFrameCount = in.readInt();
|
|
||||||
subFrames = new Id3Frame[subFrameCount];
|
|
||||||
for (int i = 0; i < subFrameCount; i++) {
|
|
||||||
subFrames[i] = in.readParcelable(Id3Frame.class.getClassLoader());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the number of sub-frames. */
|
/** Returns the number of sub-frames. */
|
||||||
public int getSubFrameCount() {
|
public int getSubFrameCount() {
|
||||||
return subFrames.length;
|
return subFrames.length;
|
||||||
@ -96,30 +80,4 @@ public final class ChapterTocFrame extends Id3Frame {
|
|||||||
result = 31 * result + (elementId != null ? elementId.hashCode() : 0);
|
result = 31 * result + (elementId != null ? elementId.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(elementId);
|
|
||||||
dest.writeByte((byte) (isRoot ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (isOrdered ? 1 : 0));
|
|
||||||
dest.writeStringArray(children);
|
|
||||||
dest.writeInt(subFrames.length);
|
|
||||||
for (Id3Frame subFrame : subFrames) {
|
|
||||||
dest.writeParcelable(subFrame, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<ChapterTocFrame> CREATOR =
|
|
||||||
new Creator<ChapterTocFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterTocFrame createFromParcel(Parcel in) {
|
|
||||||
return new ChapterTocFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterTocFrame[] newArray(int size) {
|
|
||||||
return new ChapterTocFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -40,13 +36,6 @@ public final class CommentFrame extends Id3Frame {
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ CommentFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
language = castNonNull(in.readString());
|
|
||||||
description = castNonNull(in.readString());
|
|
||||||
text = castNonNull(in.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -74,27 +63,4 @@ public final class CommentFrame extends Id3Frame {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id + ": language=" + language + ", description=" + description + ", text=" + text;
|
return id + ": language=" + language + ", description=" + description + ", text=" + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(language);
|
|
||||||
dest.writeString(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<CommentFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<CommentFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommentFrame createFromParcel(Parcel in) {
|
|
||||||
return new CommentFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommentFrame[] newArray(int size) {
|
|
||||||
return new CommentFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -43,14 +39,6 @@ public final class GeobFrame extends Id3Frame {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ GeobFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
mimeType = castNonNull(in.readString());
|
|
||||||
filename = castNonNull(in.readString());
|
|
||||||
description = castNonNull(in.readString());
|
|
||||||
data = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -86,28 +74,4 @@ public final class GeobFrame extends Id3Frame {
|
|||||||
+ ", description="
|
+ ", description="
|
||||||
+ description;
|
+ description;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(mimeType);
|
|
||||||
dest.writeString(filename);
|
|
||||||
dest.writeString(description);
|
|
||||||
dest.writeByteArray(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<GeobFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<GeobFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeobFrame createFromParcel(Parcel in) {
|
|
||||||
return new GeobFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeobFrame[] newArray(int size) {
|
|
||||||
return new GeobFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,4 @@ public abstract class Id3Frame implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -39,13 +36,6 @@ public final class InternalFrame extends Id3Frame {
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ InternalFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
domain = castNonNull(in.readString());
|
|
||||||
description = castNonNull(in.readString());
|
|
||||||
text = castNonNull(in.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -73,27 +63,4 @@ public final class InternalFrame extends Id3Frame {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id + ": domain=" + domain + ", description=" + description;
|
return id + ": domain=" + domain + ", description=" + description;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(domain);
|
|
||||||
dest.writeString(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<InternalFrame> CREATOR =
|
|
||||||
new Creator<InternalFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InternalFrame createFromParcel(Parcel in) {
|
|
||||||
return new InternalFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InternalFrame[] newArray(int size) {
|
|
||||||
return new InternalFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/** MPEG location lookup table frame. */
|
/** MPEG location lookup table frame. */
|
||||||
@ -47,15 +45,6 @@ public final class MlltFrame extends Id3Frame {
|
|||||||
this.millisecondsDeviations = millisecondsDeviations;
|
this.millisecondsDeviations = millisecondsDeviations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ MlltFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
this.mpegFramesBetweenReference = in.readInt();
|
|
||||||
this.bytesBetweenReference = in.readInt();
|
|
||||||
this.millisecondsBetweenReference = in.readInt();
|
|
||||||
this.bytesDeviations = Util.castNonNull(in.createIntArray());
|
|
||||||
this.millisecondsDeviations = Util.castNonNull(in.createIntArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -82,34 +71,4 @@ public final class MlltFrame extends Id3Frame {
|
|||||||
result = 31 * result + Arrays.hashCode(millisecondsDeviations);
|
result = 31 * result + Arrays.hashCode(millisecondsDeviations);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(mpegFramesBetweenReference);
|
|
||||||
dest.writeInt(bytesBetweenReference);
|
|
||||||
dest.writeInt(millisecondsBetweenReference);
|
|
||||||
dest.writeIntArray(bytesDeviations);
|
|
||||||
dest.writeIntArray(millisecondsDeviations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<MlltFrame> CREATOR =
|
|
||||||
new Creator<MlltFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MlltFrame createFromParcel(Parcel in) {
|
|
||||||
return new MlltFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MlltFrame[] newArray(int size) {
|
|
||||||
return new MlltFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -39,12 +35,6 @@ public final class PrivFrame extends Id3Frame {
|
|||||||
this.privateData = privateData;
|
this.privateData = privateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ PrivFrame(Parcel in) {
|
|
||||||
super(ID);
|
|
||||||
owner = castNonNull(in.readString());
|
|
||||||
privateData = castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -69,26 +59,4 @@ public final class PrivFrame extends Id3Frame {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id + ": owner=" + owner;
|
return id + ": owner=" + owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(owner);
|
|
||||||
dest.writeByteArray(privateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<PrivFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<PrivFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrivFrame createFromParcel(Parcel in) {
|
|
||||||
return new PrivFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrivFrame[] newArray(int size) {
|
|
||||||
return new PrivFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -66,13 +63,6 @@ public final class TextInformationFrame extends Id3Frame {
|
|||||||
this(id, description, ImmutableList.of(value));
|
this(id, description, ImmutableList.of(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextInformationFrame(Parcel in) {
|
|
||||||
this(
|
|
||||||
checkNotNull(in.readString()),
|
|
||||||
in.readString(),
|
|
||||||
ImmutableList.copyOf(checkNotNull(in.createStringArray())));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the first element in {@link #values} to set the relevant field in {@link MediaMetadata}
|
* Uses the first element in {@link #values} to set the relevant field in {@link MediaMetadata}
|
||||||
* (as determined by {@link #id}).
|
* (as determined by {@link #id}).
|
||||||
@ -221,29 +211,6 @@ public final class TextInformationFrame extends Id3Frame {
|
|||||||
return id + ": description=" + description + ": values=" + values;
|
return id + ": description=" + description + ": values=" + values;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(description);
|
|
||||||
dest.writeStringArray(values.toArray(new String[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<TextInformationFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<TextInformationFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextInformationFrame createFromParcel(Parcel in) {
|
|
||||||
return new TextInformationFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextInformationFrame[] newArray(int size) {
|
|
||||||
return new TextInformationFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Private methods
|
// Private methods
|
||||||
|
|
||||||
private static List<Integer> parseId3v2point4TimestampFrameForDate(String value) {
|
private static List<Integer> parseId3v2point4TimestampFrameForDate(String value) {
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.id3;
|
package androidx.media3.extractor.metadata.id3;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -36,12 +32,6 @@ public final class UrlLinkFrame extends Id3Frame {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ UrlLinkFrame(Parcel in) {
|
|
||||||
super(castNonNull(in.readString()));
|
|
||||||
description = in.readString();
|
|
||||||
url = castNonNull(in.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -69,27 +59,4 @@ public final class UrlLinkFrame extends Id3Frame {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return id + ": url=" + url;
|
return id + ": url=" + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(id);
|
|
||||||
dest.writeString(description);
|
|
||||||
dest.writeString(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<UrlLinkFrame> CREATOR =
|
|
||||||
new Parcelable.Creator<UrlLinkFrame>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlLinkFrame createFromParcel(Parcel in) {
|
|
||||||
return new UrlLinkFrame(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UrlLinkFrame[] newArray(int size) {
|
|
||||||
return new UrlLinkFrame[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package androidx.media3.extractor.metadata.mp4;
|
package androidx.media3.extractor.metadata.mp4;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
@ -59,14 +57,6 @@ public final class MotionPhotoMetadata implements Metadata.Entry {
|
|||||||
this.videoSize = videoSize;
|
this.videoSize = videoSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MotionPhotoMetadata(Parcel in) {
|
|
||||||
photoStartPosition = in.readLong();
|
|
||||||
photoSize = in.readLong();
|
|
||||||
photoPresentationTimestampUs = in.readLong();
|
|
||||||
videoStartPosition = in.readLong();
|
|
||||||
videoSize = in.readLong();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -107,34 +97,4 @@ public final class MotionPhotoMetadata implements Metadata.Entry {
|
|||||||
+ ", videoSize="
|
+ ", videoSize="
|
||||||
+ videoSize;
|
+ videoSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(photoStartPosition);
|
|
||||||
dest.writeLong(photoSize);
|
|
||||||
dest.writeLong(photoPresentationTimestampUs);
|
|
||||||
dest.writeLong(videoStartPosition);
|
|
||||||
dest.writeLong(videoSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<MotionPhotoMetadata> CREATOR =
|
|
||||||
new Parcelable.Creator<MotionPhotoMetadata>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MotionPhotoMetadata createFromParcel(Parcel in) {
|
|
||||||
return new MotionPhotoMetadata(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MotionPhotoMetadata[] newArray(int size) {
|
|
||||||
return new MotionPhotoMetadata[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,12 @@ package androidx.media3.extractor.metadata.mp4;
|
|||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ComparisonChain;
|
import com.google.common.collect.ComparisonChain;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -34,7 +31,7 @@ import java.util.List;
|
|||||||
public final class SlowMotionData implements Metadata.Entry {
|
public final class SlowMotionData implements Metadata.Entry {
|
||||||
|
|
||||||
/** Holds information about a single segment of slow motion playback within a track. */
|
/** Holds information about a single segment of slow motion playback within a track. */
|
||||||
public static final class Segment implements Parcelable {
|
public static final class Segment {
|
||||||
|
|
||||||
public static final Comparator<Segment> BY_START_THEN_END_THEN_DIVISOR =
|
public static final Comparator<Segment> BY_START_THEN_END_THEN_DIVISOR =
|
||||||
(s1, s2) ->
|
(s1, s2) ->
|
||||||
@ -97,35 +94,6 @@ public final class SlowMotionData implements Metadata.Entry {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(startTimeMs, endTimeMs, speedDivisor);
|
return Objects.hashCode(startTimeMs, endTimeMs, speedDivisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(startTimeMs);
|
|
||||||
dest.writeLong(endTimeMs);
|
|
||||||
dest.writeInt(speedDivisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<Segment> CREATOR =
|
|
||||||
new Creator<Segment>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Segment createFromParcel(Parcel in) {
|
|
||||||
long startTimeMs = in.readLong();
|
|
||||||
long endTimeMs = in.readLong();
|
|
||||||
int speedDivisor = in.readInt();
|
|
||||||
return new Segment(startTimeMs, endTimeMs, speedDivisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Segment[] newArray(int size) {
|
|
||||||
return new Segment[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<Segment> segments;
|
public final List<Segment> segments;
|
||||||
@ -163,31 +131,6 @@ public final class SlowMotionData implements Metadata.Entry {
|
|||||||
return segments.hashCode();
|
return segments.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeList(segments);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<SlowMotionData> CREATOR =
|
|
||||||
new Creator<SlowMotionData>() {
|
|
||||||
@Override
|
|
||||||
public SlowMotionData createFromParcel(Parcel in) {
|
|
||||||
List<Segment> slowMotionSegments = new ArrayList<>();
|
|
||||||
in.readList(slowMotionSegments, Segment.class.getClassLoader());
|
|
||||||
return new SlowMotionData(slowMotionSegments);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SlowMotionData[] newArray(int size) {
|
|
||||||
return new SlowMotionData[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static boolean doSegmentsOverlap(List<Segment> segments) {
|
private static boolean doSegmentsOverlap(List<Segment> segments) {
|
||||||
if (segments.isEmpty()) {
|
if (segments.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.mp4;
|
package androidx.media3.extractor.metadata.mp4;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
@ -47,11 +45,6 @@ public final class SmtaMetadataEntry implements Metadata.Entry {
|
|||||||
this.svcTemporalLayerCount = svcTemporalLayerCount;
|
this.svcTemporalLayerCount = svcTemporalLayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SmtaMetadataEntry(Parcel in) {
|
|
||||||
captureFrameRate = in.readFloat();
|
|
||||||
svcTemporalLayerCount = in.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -80,31 +73,4 @@ public final class SmtaMetadataEntry implements Metadata.Entry {
|
|||||||
+ ", svcTemporalLayerCount="
|
+ ", svcTemporalLayerCount="
|
||||||
+ svcTemporalLayerCount;
|
+ svcTemporalLayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeFloat(captureFrameRate);
|
|
||||||
dest.writeInt(svcTemporalLayerCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<SmtaMetadataEntry> CREATOR =
|
|
||||||
new Parcelable.Creator<SmtaMetadataEntry>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SmtaMetadataEntry createFromParcel(Parcel in) {
|
|
||||||
return new SmtaMetadataEntry(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SmtaMetadataEntry[] newArray(int size) {
|
|
||||||
return new SmtaMetadataEntry[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.scte35;
|
package androidx.media3.extractor.metadata.scte35;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
|
||||||
|
|
||||||
/** Represents a private command as defined in SCTE35, Section 9.3.6. */
|
/** Represents a private command as defined in SCTE35, Section 9.3.6. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
@ -40,12 +37,6 @@ public final class PrivateCommand extends SpliceCommand {
|
|||||||
this.commandBytes = commandBytes;
|
this.commandBytes = commandBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrivateCommand(Parcel in) {
|
|
||||||
ptsAdjustment = in.readLong();
|
|
||||||
identifier = in.readLong();
|
|
||||||
commandBytes = Util.castNonNull(in.createByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* package */ static PrivateCommand parseFromSection(
|
/* package */ static PrivateCommand parseFromSection(
|
||||||
ParsableByteArray sectionData, int commandLength, long ptsAdjustment) {
|
ParsableByteArray sectionData, int commandLength, long ptsAdjustment) {
|
||||||
long identifier = sectionData.readUnsignedInt();
|
long identifier = sectionData.readUnsignedInt();
|
||||||
@ -62,27 +53,4 @@ public final class PrivateCommand extends SpliceCommand {
|
|||||||
+ identifier
|
+ identifier
|
||||||
+ " }";
|
+ " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(ptsAdjustment);
|
|
||||||
dest.writeLong(identifier);
|
|
||||||
dest.writeByteArray(commandBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<PrivateCommand> CREATOR =
|
|
||||||
new Parcelable.Creator<PrivateCommand>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrivateCommand createFromParcel(Parcel in) {
|
|
||||||
return new PrivateCommand(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrivateCommand[] newArray(int size) {
|
|
||||||
return new PrivateCommand[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,4 @@ public abstract class SpliceCommand implements Metadata.Entry {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "SCTE-35 splice command: type=" + getClass().getSimpleName();
|
return "SCTE-35 splice command: type=" + getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.scte35;
|
package androidx.media3.extractor.metadata.scte35;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
import androidx.media3.common.util.TimestampAdjuster;
|
import androidx.media3.common.util.TimestampAdjuster;
|
||||||
@ -119,27 +117,6 @@ public final class SpliceInsertCommand extends SpliceCommand {
|
|||||||
this.availsExpected = availsExpected;
|
this.availsExpected = availsExpected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpliceInsertCommand(Parcel in) {
|
|
||||||
spliceEventId = in.readLong();
|
|
||||||
spliceEventCancelIndicator = in.readByte() == 1;
|
|
||||||
outOfNetworkIndicator = in.readByte() == 1;
|
|
||||||
programSpliceFlag = in.readByte() == 1;
|
|
||||||
spliceImmediateFlag = in.readByte() == 1;
|
|
||||||
programSplicePts = in.readLong();
|
|
||||||
programSplicePlaybackPositionUs = in.readLong();
|
|
||||||
int componentSpliceListSize = in.readInt();
|
|
||||||
List<ComponentSplice> componentSpliceList = new ArrayList<>(componentSpliceListSize);
|
|
||||||
for (int i = 0; i < componentSpliceListSize; i++) {
|
|
||||||
componentSpliceList.add(ComponentSplice.createFromParcel(in));
|
|
||||||
}
|
|
||||||
this.componentSpliceList = Collections.unmodifiableList(componentSpliceList);
|
|
||||||
autoReturn = in.readByte() == 1;
|
|
||||||
breakDurationUs = in.readLong();
|
|
||||||
uniqueProgramId = in.readInt();
|
|
||||||
availNum = in.readInt();
|
|
||||||
availsExpected = in.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* package */ static SpliceInsertCommand parseFromSection(
|
/* package */ static SpliceInsertCommand parseFromSection(
|
||||||
ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) {
|
ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) {
|
||||||
long spliceEventId = sectionData.readUnsignedInt();
|
long spliceEventId = sectionData.readUnsignedInt();
|
||||||
@ -219,16 +196,6 @@ public final class SpliceInsertCommand extends SpliceCommand {
|
|||||||
this.componentSplicePts = componentSplicePts;
|
this.componentSplicePts = componentSplicePts;
|
||||||
this.componentSplicePlaybackPositionUs = componentSplicePlaybackPositionUs;
|
this.componentSplicePlaybackPositionUs = componentSplicePlaybackPositionUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest) {
|
|
||||||
dest.writeInt(componentTag);
|
|
||||||
dest.writeLong(componentSplicePts);
|
|
||||||
dest.writeLong(componentSplicePlaybackPositionUs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ComponentSplice createFromParcel(Parcel in) {
|
|
||||||
return new ComponentSplice(in.readInt(), in.readLong(), in.readLong());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -239,41 +206,4 @@ public final class SpliceInsertCommand extends SpliceCommand {
|
|||||||
+ programSplicePlaybackPositionUs
|
+ programSplicePlaybackPositionUs
|
||||||
+ " }";
|
+ " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(spliceEventId);
|
|
||||||
dest.writeByte((byte) (spliceEventCancelIndicator ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (outOfNetworkIndicator ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (programSpliceFlag ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (spliceImmediateFlag ? 1 : 0));
|
|
||||||
dest.writeLong(programSplicePts);
|
|
||||||
dest.writeLong(programSplicePlaybackPositionUs);
|
|
||||||
int componentSpliceListSize = componentSpliceList.size();
|
|
||||||
dest.writeInt(componentSpliceListSize);
|
|
||||||
for (int i = 0; i < componentSpliceListSize; i++) {
|
|
||||||
componentSpliceList.get(i).writeToParcel(dest);
|
|
||||||
}
|
|
||||||
dest.writeByte((byte) (autoReturn ? 1 : 0));
|
|
||||||
dest.writeLong(breakDurationUs);
|
|
||||||
dest.writeInt(uniqueProgramId);
|
|
||||||
dest.writeInt(availNum);
|
|
||||||
dest.writeInt(availsExpected);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<SpliceInsertCommand> CREATOR =
|
|
||||||
new Parcelable.Creator<SpliceInsertCommand>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceInsertCommand createFromParcel(Parcel in) {
|
|
||||||
return new SpliceInsertCommand(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceInsertCommand[] newArray(int size) {
|
|
||||||
return new SpliceInsertCommand[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,31 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.scte35;
|
package androidx.media3.extractor.metadata.scte35;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
||||||
/** Represents a splice null command as defined in SCTE35, Section 9.3.1. */
|
/** Represents a splice null command as defined in SCTE35, Section 9.3.1. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class SpliceNullCommand extends SpliceCommand {
|
public final class SpliceNullCommand extends SpliceCommand {}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<SpliceNullCommand> CREATOR =
|
|
||||||
new Creator<SpliceNullCommand>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceNullCommand createFromParcel(Parcel in) {
|
|
||||||
return new SpliceNullCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceNullCommand[] newArray(int size) {
|
|
||||||
return new SpliceNullCommand[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.scte35;
|
package androidx.media3.extractor.metadata.scte35;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -108,25 +106,6 @@ public final class SpliceScheduleCommand extends SpliceCommand {
|
|||||||
this.availsExpected = availsExpected;
|
this.availsExpected = availsExpected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Event(Parcel in) {
|
|
||||||
this.spliceEventId = in.readLong();
|
|
||||||
this.spliceEventCancelIndicator = in.readByte() == 1;
|
|
||||||
this.outOfNetworkIndicator = in.readByte() == 1;
|
|
||||||
this.programSpliceFlag = in.readByte() == 1;
|
|
||||||
int componentSpliceListLength = in.readInt();
|
|
||||||
ArrayList<ComponentSplice> componentSpliceList = new ArrayList<>(componentSpliceListLength);
|
|
||||||
for (int i = 0; i < componentSpliceListLength; i++) {
|
|
||||||
componentSpliceList.add(ComponentSplice.createFromParcel(in));
|
|
||||||
}
|
|
||||||
this.componentSpliceList = Collections.unmodifiableList(componentSpliceList);
|
|
||||||
this.utcSpliceTime = in.readLong();
|
|
||||||
this.autoReturn = in.readByte() == 1;
|
|
||||||
this.breakDurationUs = in.readLong();
|
|
||||||
this.uniqueProgramId = in.readInt();
|
|
||||||
this.availNum = in.readInt();
|
|
||||||
this.availsExpected = in.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Event parseFromSection(ParsableByteArray sectionData) {
|
private static Event parseFromSection(ParsableByteArray sectionData) {
|
||||||
long spliceEventId = sectionData.readUnsignedInt();
|
long spliceEventId = sectionData.readUnsignedInt();
|
||||||
// splice_event_cancel_indicator(1), reserved(7).
|
// splice_event_cancel_indicator(1), reserved(7).
|
||||||
@ -180,28 +159,6 @@ public final class SpliceScheduleCommand extends SpliceCommand {
|
|||||||
availNum,
|
availNum,
|
||||||
availsExpected);
|
availsExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeToParcel(Parcel dest) {
|
|
||||||
dest.writeLong(spliceEventId);
|
|
||||||
dest.writeByte((byte) (spliceEventCancelIndicator ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (outOfNetworkIndicator ? 1 : 0));
|
|
||||||
dest.writeByte((byte) (programSpliceFlag ? 1 : 0));
|
|
||||||
int componentSpliceListSize = componentSpliceList.size();
|
|
||||||
dest.writeInt(componentSpliceListSize);
|
|
||||||
for (int i = 0; i < componentSpliceListSize; i++) {
|
|
||||||
componentSpliceList.get(i).writeToParcel(dest);
|
|
||||||
}
|
|
||||||
dest.writeLong(utcSpliceTime);
|
|
||||||
dest.writeByte((byte) (autoReturn ? 1 : 0));
|
|
||||||
dest.writeLong(breakDurationUs);
|
|
||||||
dest.writeInt(uniqueProgramId);
|
|
||||||
dest.writeInt(availNum);
|
|
||||||
dest.writeInt(availsExpected);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Event createFromParcel(Parcel in) {
|
|
||||||
return new Event(in);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds splicing information for specific splice schedule command components. */
|
/** Holds splicing information for specific splice schedule command components. */
|
||||||
@ -214,15 +171,6 @@ public final class SpliceScheduleCommand extends SpliceCommand {
|
|||||||
this.componentTag = componentTag;
|
this.componentTag = componentTag;
|
||||||
this.utcSpliceTime = utcSpliceTime;
|
this.utcSpliceTime = utcSpliceTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ComponentSplice createFromParcel(Parcel in) {
|
|
||||||
return new ComponentSplice(in.readInt(), in.readLong());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeToParcel(Parcel dest) {
|
|
||||||
dest.writeInt(componentTag);
|
|
||||||
dest.writeLong(utcSpliceTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The list of scheduled events. */
|
/** The list of scheduled events. */
|
||||||
@ -232,15 +180,6 @@ public final class SpliceScheduleCommand extends SpliceCommand {
|
|||||||
this.events = Collections.unmodifiableList(events);
|
this.events = Collections.unmodifiableList(events);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpliceScheduleCommand(Parcel in) {
|
|
||||||
int eventsSize = in.readInt();
|
|
||||||
ArrayList<Event> events = new ArrayList<>(eventsSize);
|
|
||||||
for (int i = 0; i < eventsSize; i++) {
|
|
||||||
events.add(Event.createFromParcel(in));
|
|
||||||
}
|
|
||||||
this.events = Collections.unmodifiableList(events);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* package */ static SpliceScheduleCommand parseFromSection(ParsableByteArray sectionData) {
|
/* package */ static SpliceScheduleCommand parseFromSection(ParsableByteArray sectionData) {
|
||||||
int spliceCount = sectionData.readUnsignedByte();
|
int spliceCount = sectionData.readUnsignedByte();
|
||||||
ArrayList<Event> events = new ArrayList<>(spliceCount);
|
ArrayList<Event> events = new ArrayList<>(spliceCount);
|
||||||
@ -249,29 +188,4 @@ public final class SpliceScheduleCommand extends SpliceCommand {
|
|||||||
}
|
}
|
||||||
return new SpliceScheduleCommand(events);
|
return new SpliceScheduleCommand(events);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
int eventsSize = events.size();
|
|
||||||
dest.writeInt(eventsSize);
|
|
||||||
for (int i = 0; i < eventsSize; i++) {
|
|
||||||
events.get(i).writeToParcel(dest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<SpliceScheduleCommand> CREATOR =
|
|
||||||
new Parcelable.Creator<SpliceScheduleCommand>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceScheduleCommand createFromParcel(Parcel in) {
|
|
||||||
return new SpliceScheduleCommand(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpliceScheduleCommand[] newArray(int size) {
|
|
||||||
return new SpliceScheduleCommand[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.scte35;
|
package androidx.media3.extractor.metadata.scte35;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
import androidx.media3.common.util.TimestampAdjuster;
|
import androidx.media3.common.util.TimestampAdjuster;
|
||||||
@ -72,26 +71,4 @@ public final class TimeSignalCommand extends SpliceCommand {
|
|||||||
+ playbackPositionUs
|
+ playbackPositionUs
|
||||||
+ " }";
|
+ " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcelable implementation.
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeLong(ptsTime);
|
|
||||||
dest.writeLong(playbackPositionUs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<TimeSignalCommand> CREATOR =
|
|
||||||
new Creator<TimeSignalCommand>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TimeSignalCommand createFromParcel(Parcel in) {
|
|
||||||
return new TimeSignalCommand(in.readLong(), in.readLong());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TimeSignalCommand[] newArray(int size) {
|
|
||||||
return new TimeSignalCommand[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.extractor.metadata.vorbis;
|
package androidx.media3.extractor.metadata.vorbis;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
||||||
/** A vorbis comment, extracted from a FLAC or Ogg file. */
|
/** A vorbis comment, extracted from a FLAC or Ogg file. */
|
||||||
@ -30,22 +29,4 @@ public final class VorbisComment extends androidx.media3.extractor.metadata.flac
|
|||||||
public VorbisComment(String key, String value) {
|
public VorbisComment(String key, String value) {
|
||||||
super(key, value);
|
super(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ VorbisComment(Parcel in) {
|
|
||||||
super(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<VorbisComment> CREATOR =
|
|
||||||
new Creator<VorbisComment>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VorbisComment createFromParcel(Parcel in) {
|
|
||||||
return new VorbisComment(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VorbisComment[] newArray(int size) {
|
|
||||||
return new VorbisComment[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.emsg;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link EventMessage}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class EventMessageTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void eventMessageParcelable() {
|
|
||||||
EventMessage eventMessage =
|
|
||||||
new EventMessage("urn:test", "123", 3000, 1000403, new byte[] {0, 1, 2, 3, 4});
|
|
||||||
// Write to parcel.
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
eventMessage.writeToParcel(parcel, 0);
|
|
||||||
// Create from parcel.
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
EventMessage fromParcelEventMessage = EventMessage.CREATOR.createFromParcel(parcel);
|
|
||||||
// Assert equals.
|
|
||||||
assertThat(fromParcelEventMessage).isEqualTo(eventMessage);
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,6 @@ package androidx.media3.extractor.metadata.flac;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
@ -28,21 +27,6 @@ import org.junit.runner.RunWith;
|
|||||||
/** Test for {@link PictureFrame}. */
|
/** Test for {@link PictureFrame}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public final class PictureFrameTest {
|
public final class PictureFrameTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
PictureFrame pictureFrameToParcel = new PictureFrame(0, "", "", 0, 0, 0, 0, new byte[0]);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
pictureFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
PictureFrame pictureFrameFromParcel = PictureFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(pictureFrameFromParcel).isEqualTo(pictureFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateMediaMetadata_setsBuilderValues() {
|
public void populateMediaMetadata_setsBuilderValues() {
|
||||||
byte[] pictureData = new byte[] {-12, 52, 33, 85, 34, 22, 1, -55};
|
byte[] pictureData = new byte[] {-12, 52, 33, 85, 34, 22, 1, -55};
|
||||||
|
@ -17,7 +17,6 @@ package androidx.media3.extractor.metadata.icy;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -26,27 +25,6 @@ import org.junit.runner.RunWith;
|
|||||||
/** Test for {@link IcyHeaders}. */
|
/** Test for {@link IcyHeaders}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public final class IcyHeadersTest {
|
public final class IcyHeadersTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelEquals() {
|
|
||||||
IcyHeaders icyHeaders =
|
|
||||||
new IcyHeaders(
|
|
||||||
/* bitrate= */ 1234,
|
|
||||||
"genre",
|
|
||||||
"name",
|
|
||||||
"url",
|
|
||||||
/* isPublic= */ true,
|
|
||||||
/* metadataInterval= */ 5678);
|
|
||||||
// Write to parcel.
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
icyHeaders.writeToParcel(parcel, 0);
|
|
||||||
// Create from parcel.
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
IcyHeaders fromParcelIcyHeaders = IcyHeaders.CREATOR.createFromParcel(parcel);
|
|
||||||
// Assert equals.
|
|
||||||
assertThat(fromParcelIcyHeaders).isEqualTo(icyHeaders);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateMediaMetadata() {
|
public void populateMediaMetadata() {
|
||||||
IcyHeaders headers =
|
IcyHeaders headers =
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.icy;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link IcyInfo}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class IcyInfoTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelEquals() {
|
|
||||||
IcyInfo streamInfo =
|
|
||||||
new IcyInfo("StreamName='name';StreamUrl='url'".getBytes(UTF_8), "name", "url");
|
|
||||||
// Write to parcel.
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
streamInfo.writeToParcel(parcel, 0);
|
|
||||||
// Create from parcel.
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
IcyInfo fromParcelStreamInfo = IcyInfo.CREATOR.createFromParcel(parcel);
|
|
||||||
// Assert equals.
|
|
||||||
assertThat(fromParcelStreamInfo).isEqualTo(streamInfo);
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,6 @@ package androidx.media3.extractor.metadata.id3;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
@ -28,21 +27,6 @@ import org.junit.runner.RunWith;
|
|||||||
/** Unit test for {@link ApicFrame}. */
|
/** Unit test for {@link ApicFrame}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class ApicFrameTest {
|
public class ApicFrameTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
ApicFrame apicFrameToParcel = new ApicFrame("", "", 0, new byte[0]);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
apicFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
ApicFrame apicFrameFromParcel = ApicFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(apicFrameFromParcel).isEqualTo(apicFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateMediaMetadata_setsBuilderValues() {
|
public void populateMediaMetadata_setsBuilderValues() {
|
||||||
byte[] pictureData = new byte[] {-12, 52, 33, 85, 34, 22, 1, -55};
|
byte[] pictureData = new byte[] {-12, 52, 33, 85, 34, 22, 1, -55};
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.id3;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link ChapterFrame}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class ChapterFrameTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
Id3Frame[] subFrames =
|
|
||||||
new Id3Frame[] {
|
|
||||||
new TextInformationFrame("TIT2", null, ImmutableList.of("title")),
|
|
||||||
new UrlLinkFrame("WXXX", "description", "url")
|
|
||||||
};
|
|
||||||
ChapterFrame chapterFrameToParcel = new ChapterFrame("id", 0, 1, 2, 3, subFrames);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
chapterFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
ChapterFrame chapterFrameFromParcel = ChapterFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(chapterFrameFromParcel).isEqualTo(chapterFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.id3;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link ChapterTocFrame}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class ChapterTocFrameTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
String[] children = new String[] {"child0", "child1"};
|
|
||||||
Id3Frame[] subFrames =
|
|
||||||
new Id3Frame[] {
|
|
||||||
new TextInformationFrame("TIT2", null, ImmutableList.of("title")),
|
|
||||||
new UrlLinkFrame("WXXX", "description", "url")
|
|
||||||
};
|
|
||||||
ChapterTocFrame chapterTocFrameToParcel =
|
|
||||||
new ChapterTocFrame("id", false, true, children, subFrames);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
chapterTocFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
ChapterTocFrame chapterTocFrameFromParcel = ChapterTocFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(chapterTocFrameFromParcel).isEqualTo(chapterTocFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.id3;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link MlltFrame}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public final class MlltFrameTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
MlltFrame mlltFrameToParcel =
|
|
||||||
new MlltFrame(
|
|
||||||
/* mpegFramesBetweenReference= */ 1,
|
|
||||||
/* bytesBetweenReference= */ 1,
|
|
||||||
/* millisecondsBetweenReference= */ 1,
|
|
||||||
/* bytesDeviations= */ new int[] {1, 2},
|
|
||||||
/* millisecondsDeviations= */ new int[] {1, 2});
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
mlltFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
MlltFrame mlltFrameFromParcel = MlltFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(mlltFrameFromParcel).isEqualTo(mlltFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,6 @@ package androidx.media3.extractor.metadata.id3;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.junit.Assert.assertThrows;
|
import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
@ -30,23 +29,6 @@ import org.junit.runner.RunWith;
|
|||||||
/** Unit test for {@link TextInformationFrame}. */
|
/** Unit test for {@link TextInformationFrame}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class TextInformationFrameTest {
|
public class TextInformationFrameTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
TextInformationFrame textInformationFrameToParcel =
|
|
||||||
new TextInformationFrame("", "", ImmutableList.of(""));
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
textInformationFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
TextInformationFrame textInformationFrameFromParcel =
|
|
||||||
TextInformationFrame.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(textInformationFrameFromParcel).isEqualTo(textInformationFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateMediaMetadata_setsBuilderValues() {
|
public void populateMediaMetadata_setsBuilderValues() {
|
||||||
String title = "the title";
|
String title = "the title";
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.mp4;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.C;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link MotionPhotoMetadata}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class MotionPhotoMetadataTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
MotionPhotoMetadata motionPhotoMetadataToParcel =
|
|
||||||
new MotionPhotoMetadata(
|
|
||||||
/* photoStartPosition= */ 0,
|
|
||||||
/* photoSize= */ 10,
|
|
||||||
/* photoPresentationTimestampUs= */ C.TIME_UNSET,
|
|
||||||
/* videoStartPosition= */ 15,
|
|
||||||
/* videoSize= */ 35);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
motionPhotoMetadataToParcel.writeToParcel(parcel, /* flags= */ 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
MotionPhotoMetadata motionPhotoMetadataFromParcel =
|
|
||||||
MotionPhotoMetadata.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(motionPhotoMetadataFromParcel).isEqualTo(motionPhotoMetadataToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.metadata.mp4;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Test for {@link SmtaMetadataEntry}. */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class SmtaMetadataEntryTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
SmtaMetadataEntry smtaMetadataEntryToParcel =
|
|
||||||
new SmtaMetadataEntry(/* captureFrameRate= */ 120, /* svcTemporalLayerCount= */ 4);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
smtaMetadataEntryToParcel.writeToParcel(parcel, /* flags= */ 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
SmtaMetadataEntry smtaMetadataEntryFromParcel =
|
|
||||||
SmtaMetadataEntry.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(smtaMetadataEntryFromParcel).isEqualTo(smtaMetadataEntryToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,6 @@ package androidx.media3.extractor.metadata.vorbis;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.common.MediaMetadata;
|
import androidx.media3.common.MediaMetadata;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
@ -29,21 +28,6 @@ import org.junit.runner.RunWith;
|
|||||||
/** Test for {@link VorbisComment}. */
|
/** Test for {@link VorbisComment}. */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public final class VorbisCommentTest {
|
public final class VorbisCommentTest {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
VorbisComment vorbisCommentFrameToParcel = new VorbisComment("key", "value");
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
vorbisCommentFrameToParcel.writeToParcel(parcel, 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
VorbisComment vorbisCommentFrameFromParcel = VorbisComment.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(vorbisCommentFrameFromParcel).isEqualTo(vorbisCommentFrameToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void populateMediaMetadata_setsMediaMetadataValues() {
|
public void populateMediaMetadata_setsMediaMetadataValues() {
|
||||||
String title = "the title";
|
String title = "the title";
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License 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 androidx.media3.extractor.mp4;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import androidx.media3.extractor.metadata.mp4.SlowMotionData;
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
/** Unit test for {@link SlowMotionData} */
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class SlowMotionDataTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void parcelable() {
|
|
||||||
List<SlowMotionData.Segment> segments = new ArrayList<>();
|
|
||||||
segments.add(
|
|
||||||
new SlowMotionData.Segment(
|
|
||||||
/* startTimeMs= */ 1000, /* endTimeMs= */ 2000, /* speedDivisor= */ 4));
|
|
||||||
segments.add(
|
|
||||||
new SlowMotionData.Segment(
|
|
||||||
/* startTimeMs= */ 2600, /* endTimeMs= */ 4000, /* speedDivisor= */ 8));
|
|
||||||
segments.add(
|
|
||||||
new SlowMotionData.Segment(
|
|
||||||
/* startTimeMs= */ 8765, /* endTimeMs= */ 12485, /* speedDivisor= */ 16));
|
|
||||||
|
|
||||||
SlowMotionData slowMotionDataToParcel = new SlowMotionData(segments);
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
slowMotionDataToParcel.writeToParcel(parcel, /* flags= */ 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
SlowMotionData slowMotionDataFromParcel = SlowMotionData.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(slowMotionDataFromParcel).isEqualTo(slowMotionDataToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void segment_parcelable() {
|
|
||||||
SlowMotionData.Segment segmentToParcel =
|
|
||||||
new SlowMotionData.Segment(
|
|
||||||
/* startTimeMs= */ 1000, /* endTimeMs= */ 2000, /* speedDivisor= */ 4);
|
|
||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
|
||||||
segmentToParcel.writeToParcel(parcel, /* flags= */ 0);
|
|
||||||
parcel.setDataPosition(0);
|
|
||||||
|
|
||||||
SlowMotionData.Segment segmentFromParcel =
|
|
||||||
SlowMotionData.Segment.CREATOR.createFromParcel(parcel);
|
|
||||||
assertThat(segmentFromParcel).isEqualTo(segmentToParcel);
|
|
||||||
|
|
||||||
parcel.recycle();
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,10 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.test.utils;
|
package androidx.media3.test.utils;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Util.castNonNull;
|
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
@ -33,15 +29,6 @@ public final class FakeMetadataEntry implements Metadata.Entry {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ FakeMetadataEntry(Parcel in) {
|
|
||||||
data = castNonNull(in.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
@ -58,23 +45,4 @@ public final class FakeMetadataEntry implements Metadata.Entry {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return data.hashCode();
|
return data.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<FakeMetadataEntry> CREATOR =
|
|
||||||
new Parcelable.Creator<FakeMetadataEntry>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FakeMetadataEntry createFromParcel(Parcel in) {
|
|
||||||
return new FakeMetadataEntry(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FakeMetadataEntry[] newArray(int size) {
|
|
||||||
return new FakeMetadataEntry[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user