- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
261 lines
9.4 KiB
Java
261 lines
9.4 KiB
Java
package com.mbridge.msdk.playercommon.exoplayer2.drm;
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import androidx.annotation.Nullable;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.util.Assertions;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.util.Util;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class DrmInitData implements Parcelable, Comparator<SchemeData> {
|
|
public static final Parcelable.Creator<DrmInitData> CREATOR = new Parcelable.Creator<DrmInitData>() { // from class: com.mbridge.msdk.playercommon.exoplayer2.drm.DrmInitData.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public DrmInitData createFromParcel(Parcel parcel) {
|
|
return new DrmInitData(parcel);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public DrmInitData[] newArray(int i) {
|
|
return new DrmInitData[i];
|
|
}
|
|
};
|
|
private int hashCode;
|
|
public final int schemeDataCount;
|
|
private final SchemeData[] schemeDatas;
|
|
|
|
@Nullable
|
|
public final String schemeType;
|
|
|
|
@Override // android.os.Parcelable
|
|
public final int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Nullable
|
|
public static DrmInitData createSessionCreationData(@Nullable DrmInitData drmInitData, @Nullable DrmInitData drmInitData2) {
|
|
String str;
|
|
ArrayList arrayList = new ArrayList();
|
|
if (drmInitData != null) {
|
|
str = drmInitData.schemeType;
|
|
for (SchemeData schemeData : drmInitData.schemeDatas) {
|
|
if (schemeData.hasData()) {
|
|
arrayList.add(schemeData);
|
|
}
|
|
}
|
|
} else {
|
|
str = null;
|
|
}
|
|
if (drmInitData2 != null) {
|
|
if (str == null) {
|
|
str = drmInitData2.schemeType;
|
|
}
|
|
int size = arrayList.size();
|
|
for (SchemeData schemeData2 : drmInitData2.schemeDatas) {
|
|
if (schemeData2.hasData() && !containsSchemeDataWithUuid(arrayList, size, schemeData2.uuid)) {
|
|
arrayList.add(schemeData2);
|
|
}
|
|
}
|
|
}
|
|
if (arrayList.isEmpty()) {
|
|
return null;
|
|
}
|
|
return new DrmInitData(str, arrayList);
|
|
}
|
|
|
|
public DrmInitData(List<SchemeData> list) {
|
|
this(null, false, (SchemeData[]) list.toArray(new SchemeData[list.size()]));
|
|
}
|
|
|
|
public DrmInitData(String str, List<SchemeData> list) {
|
|
this(str, false, (SchemeData[]) list.toArray(new SchemeData[list.size()]));
|
|
}
|
|
|
|
public DrmInitData(SchemeData... schemeDataArr) {
|
|
this((String) null, schemeDataArr);
|
|
}
|
|
|
|
public DrmInitData(@Nullable String str, SchemeData... schemeDataArr) {
|
|
this(str, true, schemeDataArr);
|
|
}
|
|
|
|
private DrmInitData(@Nullable String str, boolean z, SchemeData... schemeDataArr) {
|
|
this.schemeType = str;
|
|
schemeDataArr = z ? (SchemeData[]) schemeDataArr.clone() : schemeDataArr;
|
|
Arrays.sort(schemeDataArr, this);
|
|
this.schemeDatas = schemeDataArr;
|
|
this.schemeDataCount = schemeDataArr.length;
|
|
}
|
|
|
|
public DrmInitData(Parcel parcel) {
|
|
this.schemeType = parcel.readString();
|
|
SchemeData[] schemeDataArr = (SchemeData[]) parcel.createTypedArray(SchemeData.CREATOR);
|
|
this.schemeDatas = schemeDataArr;
|
|
this.schemeDataCount = schemeDataArr.length;
|
|
}
|
|
|
|
@Deprecated
|
|
public final SchemeData get(UUID uuid) {
|
|
for (SchemeData schemeData : this.schemeDatas) {
|
|
if (schemeData.matches(uuid)) {
|
|
return schemeData;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final SchemeData get(int i) {
|
|
return this.schemeDatas[i];
|
|
}
|
|
|
|
public final DrmInitData copyWithSchemeType(@Nullable String str) {
|
|
return Util.areEqual(this.schemeType, str) ? this : new DrmInitData(str, false, this.schemeDatas);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
if (this.hashCode == 0) {
|
|
String str = this.schemeType;
|
|
this.hashCode = ((str == null ? 0 : str.hashCode()) * 31) + Arrays.hashCode(this.schemeDatas);
|
|
}
|
|
return this.hashCode;
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public final boolean equals(@Nullable Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null || DrmInitData.class != obj.getClass()) {
|
|
return false;
|
|
}
|
|
DrmInitData drmInitData = (DrmInitData) obj;
|
|
return Util.areEqual(this.schemeType, drmInitData.schemeType) && Arrays.equals(this.schemeDatas, drmInitData.schemeDatas);
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public final int compare(SchemeData schemeData, SchemeData schemeData2) {
|
|
UUID uuid = C.UUID_NIL;
|
|
if (uuid.equals(schemeData.uuid)) {
|
|
return uuid.equals(schemeData2.uuid) ? 0 : 1;
|
|
}
|
|
return schemeData.uuid.compareTo(schemeData2.uuid);
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeString(this.schemeType);
|
|
parcel.writeTypedArray(this.schemeDatas, 0);
|
|
}
|
|
|
|
private static boolean containsSchemeDataWithUuid(ArrayList<SchemeData> arrayList, int i, UUID uuid) {
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
if (arrayList.get(i2).uuid.equals(uuid)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final class SchemeData implements Parcelable {
|
|
public static final Parcelable.Creator<SchemeData> CREATOR = new Parcelable.Creator<SchemeData>() { // from class: com.mbridge.msdk.playercommon.exoplayer2.drm.DrmInitData.SchemeData.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SchemeData createFromParcel(Parcel parcel) {
|
|
return new SchemeData(parcel);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SchemeData[] newArray(int i) {
|
|
return new SchemeData[i];
|
|
}
|
|
};
|
|
public final byte[] data;
|
|
private int hashCode;
|
|
|
|
@Nullable
|
|
public final String licenseServerUrl;
|
|
public final String mimeType;
|
|
public final boolean requiresSecureDecryption;
|
|
private final UUID uuid;
|
|
|
|
@Override // android.os.Parcelable
|
|
public final int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
public final boolean hasData() {
|
|
return this.data != null;
|
|
}
|
|
|
|
public SchemeData(UUID uuid, String str, byte[] bArr) {
|
|
this(uuid, str, bArr, false);
|
|
}
|
|
|
|
public SchemeData(UUID uuid, String str, byte[] bArr, boolean z) {
|
|
this(uuid, null, str, bArr, z);
|
|
}
|
|
|
|
public SchemeData(UUID uuid, @Nullable String str, String str2, byte[] bArr, boolean z) {
|
|
this.uuid = (UUID) Assertions.checkNotNull(uuid);
|
|
this.licenseServerUrl = str;
|
|
this.mimeType = (String) Assertions.checkNotNull(str2);
|
|
this.data = bArr;
|
|
this.requiresSecureDecryption = z;
|
|
}
|
|
|
|
public SchemeData(Parcel parcel) {
|
|
this.uuid = new UUID(parcel.readLong(), parcel.readLong());
|
|
this.licenseServerUrl = parcel.readString();
|
|
this.mimeType = parcel.readString();
|
|
this.data = parcel.createByteArray();
|
|
this.requiresSecureDecryption = parcel.readByte() != 0;
|
|
}
|
|
|
|
public final boolean matches(UUID uuid) {
|
|
return C.UUID_NIL.equals(this.uuid) || uuid.equals(this.uuid);
|
|
}
|
|
|
|
public final boolean canReplace(SchemeData schemeData) {
|
|
return hasData() && !schemeData.hasData() && matches(schemeData.uuid);
|
|
}
|
|
|
|
public final boolean equals(@Nullable Object obj) {
|
|
if (!(obj instanceof SchemeData)) {
|
|
return false;
|
|
}
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
SchemeData schemeData = (SchemeData) obj;
|
|
return Util.areEqual(this.licenseServerUrl, schemeData.licenseServerUrl) && Util.areEqual(this.mimeType, schemeData.mimeType) && Util.areEqual(this.uuid, schemeData.uuid) && Arrays.equals(this.data, schemeData.data);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
if (this.hashCode == 0) {
|
|
int hashCode = this.uuid.hashCode() * 31;
|
|
String str = this.licenseServerUrl;
|
|
this.hashCode = ((((hashCode + (str == null ? 0 : str.hashCode())) * 31) + this.mimeType.hashCode()) * 31) + Arrays.hashCode(this.data);
|
|
}
|
|
return this.hashCode;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeLong(this.uuid.getMostSignificantBits());
|
|
parcel.writeLong(this.uuid.getLeastSignificantBits());
|
|
parcel.writeString(this.licenseServerUrl);
|
|
parcel.writeString(this.mimeType);
|
|
parcel.writeByteArray(this.data);
|
|
parcel.writeByte(this.requiresSecureDecryption ? (byte) 1 : (byte) 0);
|
|
}
|
|
}
|
|
}
|