Rabbit-R1/original r1/java/sources/androidx/media3/common/Metadata.java
2024-05-21 17:08:36 -04:00

127 lines
4 KiB
Java

package androidx.media3.common;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.media3.common.MediaMetadata;
import androidx.media3.common.util.Util;
import com.google.common.primitives.Longs;
import java.util.Arrays;
import java.util.List;
/* loaded from: classes2.dex */
public final class Metadata implements Parcelable {
public static final Parcelable.Creator<Metadata> CREATOR = new Parcelable.Creator<Metadata>() { // from class: androidx.media3.common.Metadata.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Metadata createFromParcel(Parcel parcel) {
return new Metadata(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public Metadata[] newArray(int i) {
return new Metadata[i];
}
};
private final Entry[] entries;
public final long presentationTimeUs;
/* loaded from: classes2.dex */
public interface Entry extends Parcelable {
default byte[] getWrappedMetadataBytes() {
return null;
}
default Format getWrappedMetadataFormat() {
return null;
}
default void populateMediaMetadata(MediaMetadata.Builder builder) {
}
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public Metadata(Entry... entryArr) {
this(-9223372036854775807L, entryArr);
}
public Metadata(long j, Entry... entryArr) {
this.presentationTimeUs = j;
this.entries = entryArr;
}
public Metadata(List<? extends Entry> list) {
this((Entry[]) list.toArray(new Entry[0]));
}
public Metadata(long j, List<? extends Entry> list) {
this(j, (Entry[]) list.toArray(new Entry[0]));
}
Metadata(Parcel parcel) {
this.entries = new Entry[parcel.readInt()];
int i = 0;
while (true) {
Entry[] entryArr = this.entries;
if (i < entryArr.length) {
entryArr[i] = (Entry) parcel.readParcelable(Entry.class.getClassLoader());
i++;
} else {
this.presentationTimeUs = parcel.readLong();
return;
}
}
}
public int length() {
return this.entries.length;
}
public Entry get(int i) {
return this.entries[i];
}
public Metadata copyWithAppendedEntriesFrom(Metadata metadata) {
return metadata == null ? this : copyWithAppendedEntries(metadata.entries);
}
public Metadata copyWithAppendedEntries(Entry... entryArr) {
return entryArr.length == 0 ? this : new Metadata(this.presentationTimeUs, (Entry[]) Util.nullSafeArrayConcatenation(this.entries, entryArr));
}
public Metadata copyWithPresentationTimeUs(long j) {
return this.presentationTimeUs == j ? this : new Metadata(j, this.entries);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Metadata metadata = (Metadata) obj;
return Arrays.equals(this.entries, metadata.entries) && this.presentationTimeUs == metadata.presentationTimeUs;
}
public int hashCode() {
return (Arrays.hashCode(this.entries) * 31) + Longs.hashCode(this.presentationTimeUs);
}
public String toString() {
return "entries=" + Arrays.toString(this.entries) + (this.presentationTimeUs == -9223372036854775807L ? "" : ", presentationTimeUs=" + this.presentationTimeUs);
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(this.entries.length);
for (Entry entry : this.entries) {
parcel.writeParcelable(entry, 0);
}
parcel.writeLong(this.presentationTimeUs);
}
}