package com.mbridge.msdk.playercommon.exoplayer2; import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.Nullable; import com.ironsource.mediationsdk.logger.IronSourceError; import com.mbridge.msdk.playercommon.exoplayer2.drm.DrmInitData; import com.mbridge.msdk.playercommon.exoplayer2.metadata.Metadata; import com.mbridge.msdk.playercommon.exoplayer2.util.Util; import com.mbridge.msdk.playercommon.exoplayer2.video.ColorInfo; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /* loaded from: classes4.dex */ public final class Format implements Parcelable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: com.mbridge.msdk.playercommon.exoplayer2.Format.1 /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.Creator public Format createFromParcel(Parcel parcel) { return new Format(parcel); } /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.Creator public Format[] newArray(int i) { return new Format[i]; } }; public static final int NO_VALUE = -1; public static final long OFFSET_SAMPLE_RELATIVE = Long.MAX_VALUE; public final int accessibilityChannel; public final int bitrate; public final int channelCount; @Nullable public final String codecs; @Nullable public final ColorInfo colorInfo; @Nullable public final String containerMimeType; @Nullable public final DrmInitData drmInitData; public final int encoderDelay; public final int encoderPadding; public final float frameRate; private int hashCode; public final int height; @Nullable public final String id; public final List initializationData; @Nullable public final String language; public final int maxInputSize; @Nullable public final Metadata metadata; public final int pcmEncoding; public final float pixelWidthHeightRatio; @Nullable public final byte[] projectionData; public final int rotationDegrees; @Nullable public final String sampleMimeType; public final int sampleRate; public final int selectionFlags; public final int stereoMode; public final long subsampleOffsetUs; public final int width; @Override // android.os.Parcelable public final int describeContents() { return 0; } public final int getPixelCount() { int i; int i2 = this.width; if (i2 == -1 || (i = this.height) == -1) { return -1; } return i2 * i; } public static Format createVideoContainerFormat(@Nullable String str, @Nullable String str2, String str3, String str4, int i, int i2, int i3, float f, List list, int i4) { return new Format(str, str2, str3, str4, i, -1, i2, i3, f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, i4, null, -1, Long.MAX_VALUE, list, null, null); } public static Format createVideoSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, float f, List list, @Nullable DrmInitData drmInitData) { return createVideoSampleFormat(str, str2, str3, i, i2, i3, i4, f, list, -1, -1.0f, drmInitData); } public static Format createVideoSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, float f, List list, int i5, float f2, @Nullable DrmInitData drmInitData) { return createVideoSampleFormat(str, str2, str3, i, i2, i3, i4, f, list, i5, f2, null, -1, null, drmInitData); } public static Format createVideoSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, float f, List list, int i5, float f2, byte[] bArr, int i6, @Nullable ColorInfo colorInfo, @Nullable DrmInitData drmInitData) { return new Format(str, null, str2, str3, i, i2, i3, i4, f, i5, f2, bArr, i6, colorInfo, -1, -1, -1, -1, -1, 0, null, -1, Long.MAX_VALUE, list, drmInitData, null); } public static Format createAudioContainerFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, int i, int i2, int i3, List list, int i4, @Nullable String str5) { return new Format(str, str2, str3, str4, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, i2, i3, -1, -1, -1, i4, str5, -1, Long.MAX_VALUE, list, null, null); } public static Format createAudioSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, List list, @Nullable DrmInitData drmInitData, int i5, @Nullable String str4) { return createAudioSampleFormat(str, str2, str3, i, i2, i3, i4, -1, list, drmInitData, i5, str4); } public static Format createAudioSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, int i5, List list, @Nullable DrmInitData drmInitData, int i6, @Nullable String str4) { return createAudioSampleFormat(str, str2, str3, i, i2, i3, i4, i5, -1, -1, list, drmInitData, i6, str4, null); } public static Format createAudioSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, int i5, int i6, int i7, List list, @Nullable DrmInitData drmInitData, int i8, @Nullable String str4, @Nullable Metadata metadata) { return new Format(str, null, str2, str3, i, i2, -1, -1, -1.0f, -1, -1.0f, null, -1, null, i3, i4, i5, i6, i7, i8, str4, -1, Long.MAX_VALUE, list, drmInitData, metadata); } public static Format createTextContainerFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, int i, int i2, @Nullable String str5) { return createTextContainerFormat(str, str2, str3, str4, i, i2, str5, -1); } public static Format createTextContainerFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, int i, int i2, @Nullable String str5, int i3) { return new Format(str, str2, str3, str4, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, i2, str5, i3, Long.MAX_VALUE, null, null, null); } public static Format createTextSampleFormat(@Nullable String str, String str2, int i, @Nullable String str3) { return createTextSampleFormat(str, str2, i, str3, null); } public static Format createTextSampleFormat(@Nullable String str, String str2, int i, @Nullable String str3, @Nullable DrmInitData drmInitData) { return createTextSampleFormat(str, str2, null, -1, i, str3, -1, drmInitData, Long.MAX_VALUE, Collections.emptyList()); } public static Format createTextSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, @Nullable String str4, int i3, @Nullable DrmInitData drmInitData) { return createTextSampleFormat(str, str2, str3, i, i2, str4, i3, drmInitData, Long.MAX_VALUE, Collections.emptyList()); } public static Format createTextSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, @Nullable String str4, @Nullable DrmInitData drmInitData, long j) { return createTextSampleFormat(str, str2, str3, i, i2, str4, -1, drmInitData, j, Collections.emptyList()); } public static Format createTextSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, @Nullable String str4, int i3, @Nullable DrmInitData drmInitData, long j, List list) { return new Format(str, null, str2, str3, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, i2, str4, i3, j, list, drmInitData, null); } public static Format createImageSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, List list, @Nullable String str4, @Nullable DrmInitData drmInitData) { return new Format(str, null, str2, str3, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, i2, str4, -1, Long.MAX_VALUE, list, drmInitData, null); } public static Format createContainerFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, int i, int i2, @Nullable String str5) { return new Format(str, str2, str3, str4, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, i2, str5, -1, Long.MAX_VALUE, null, null, null); } public static Format createSampleFormat(@Nullable String str, @Nullable String str2, long j) { return new Format(str, null, str2, null, -1, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, 0, null, -1, j, null, null, null); } public static Format createSampleFormat(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, @Nullable DrmInitData drmInitData) { return new Format(str, null, str2, str3, i, -1, -1, -1, -1.0f, -1, -1.0f, null, -1, null, -1, -1, -1, -1, -1, 0, null, -1, Long.MAX_VALUE, null, drmInitData, null); } public Format(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, int i, int i2, int i3, int i4, float f, int i5, float f2, @Nullable byte[] bArr, int i6, @Nullable ColorInfo colorInfo, int i7, int i8, int i9, int i10, int i11, int i12, @Nullable String str5, int i13, long j, @Nullable List list, @Nullable DrmInitData drmInitData, @Nullable Metadata metadata) { this.id = str; this.containerMimeType = str2; this.sampleMimeType = str3; this.codecs = str4; this.bitrate = i; this.maxInputSize = i2; this.width = i3; this.height = i4; this.frameRate = f; int i14 = i5; this.rotationDegrees = i14 == -1 ? 0 : i14; this.pixelWidthHeightRatio = f2 == -1.0f ? 1.0f : f2; this.projectionData = bArr; this.stereoMode = i6; this.colorInfo = colorInfo; this.channelCount = i7; this.sampleRate = i8; this.pcmEncoding = i9; int i15 = i10; this.encoderDelay = i15 == -1 ? 0 : i15; this.encoderPadding = i11 != -1 ? i11 : 0; this.selectionFlags = i12; this.language = str5; this.accessibilityChannel = i13; this.subsampleOffsetUs = j; this.initializationData = list == null ? Collections.emptyList() : list; this.drmInitData = drmInitData; this.metadata = metadata; } public Format(Parcel parcel) { this.id = parcel.readString(); this.containerMimeType = parcel.readString(); this.sampleMimeType = parcel.readString(); this.codecs = parcel.readString(); this.bitrate = parcel.readInt(); this.maxInputSize = parcel.readInt(); this.width = parcel.readInt(); this.height = parcel.readInt(); this.frameRate = parcel.readFloat(); this.rotationDegrees = parcel.readInt(); this.pixelWidthHeightRatio = parcel.readFloat(); this.projectionData = Util.readBoolean(parcel) ? parcel.createByteArray() : null; this.stereoMode = parcel.readInt(); this.colorInfo = (ColorInfo) parcel.readParcelable(ColorInfo.class.getClassLoader()); this.channelCount = parcel.readInt(); this.sampleRate = parcel.readInt(); this.pcmEncoding = parcel.readInt(); this.encoderDelay = parcel.readInt(); this.encoderPadding = parcel.readInt(); this.selectionFlags = parcel.readInt(); this.language = parcel.readString(); this.accessibilityChannel = parcel.readInt(); this.subsampleOffsetUs = parcel.readLong(); int readInt = parcel.readInt(); this.initializationData = new ArrayList(readInt); for (int i = 0; i < readInt; i++) { this.initializationData.add(parcel.createByteArray()); } this.drmInitData = (DrmInitData) parcel.readParcelable(DrmInitData.class.getClassLoader()); this.metadata = (Metadata) parcel.readParcelable(Metadata.class.getClassLoader()); } public final Format copyWithMaxInputSize(int i) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, i, this.width, this.height, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, this.selectionFlags, this.language, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, this.drmInitData, this.metadata); } public final Format copyWithSubsampleOffsetUs(long j) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, this.maxInputSize, this.width, this.height, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, this.selectionFlags, this.language, this.accessibilityChannel, j, this.initializationData, this.drmInitData, this.metadata); } public final Format copyWithContainerInfo(@Nullable String str, @Nullable String str2, @Nullable String str3, int i, int i2, int i3, int i4, @Nullable String str4) { return new Format(str, this.containerMimeType, str2, str3, i, this.maxInputSize, i2, i3, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, i4, str4, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, this.drmInitData, this.metadata); } public final Format copyWithManifestFormatInfo(Format format) { if (this == format) { return this; } String str = format.id; String str2 = this.codecs; if (str2 == null) { str2 = format.codecs; } String str3 = str2; int i = this.bitrate; if (i == -1) { i = format.bitrate; } int i2 = i; float f = this.frameRate; if (f == -1.0f) { f = format.frameRate; } float f2 = f; int i3 = this.selectionFlags | format.selectionFlags; String str4 = this.language; if (str4 == null) { str4 = format.language; } return new Format(str, this.containerMimeType, this.sampleMimeType, str3, i2, this.maxInputSize, this.width, this.height, f2, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, i3, str4, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, DrmInitData.createSessionCreationData(format.drmInitData, this.drmInitData), this.metadata); } public final Format copyWithGaplessInfo(int i, int i2) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, this.maxInputSize, this.width, this.height, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, i, i2, this.selectionFlags, this.language, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, this.drmInitData, this.metadata); } public final Format copyWithDrmInitData(@Nullable DrmInitData drmInitData) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, this.maxInputSize, this.width, this.height, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, this.selectionFlags, this.language, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, drmInitData, this.metadata); } public final Format copyWithMetadata(@Nullable Metadata metadata) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, this.maxInputSize, this.width, this.height, this.frameRate, this.rotationDegrees, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, this.selectionFlags, this.language, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, this.drmInitData, metadata); } public final Format copyWithRotationDegrees(int i) { return new Format(this.id, this.containerMimeType, this.sampleMimeType, this.codecs, this.bitrate, this.maxInputSize, this.width, this.height, this.frameRate, i, this.pixelWidthHeightRatio, this.projectionData, this.stereoMode, this.colorInfo, this.channelCount, this.sampleRate, this.pcmEncoding, this.encoderDelay, this.encoderPadding, this.selectionFlags, this.language, this.accessibilityChannel, this.subsampleOffsetUs, this.initializationData, this.drmInitData, this.metadata); } public final String toString() { return "Format(" + this.id + ", " + this.containerMimeType + ", " + this.sampleMimeType + ", " + this.bitrate + ", " + this.language + ", [" + this.width + ", " + this.height + ", " + this.frameRate + "], [" + this.channelCount + ", " + this.sampleRate + "])"; } public final int hashCode() { if (this.hashCode == 0) { String str = this.id; int hashCode = (IronSourceError.ERROR_NON_EXISTENT_INSTANCE + (str == null ? 0 : str.hashCode())) * 31; String str2 = this.containerMimeType; int hashCode2 = (hashCode + (str2 == null ? 0 : str2.hashCode())) * 31; String str3 = this.sampleMimeType; int hashCode3 = (hashCode2 + (str3 == null ? 0 : str3.hashCode())) * 31; String str4 = this.codecs; int hashCode4 = (((((((((((hashCode3 + (str4 == null ? 0 : str4.hashCode())) * 31) + this.bitrate) * 31) + this.width) * 31) + this.height) * 31) + this.channelCount) * 31) + this.sampleRate) * 31; String str5 = this.language; int hashCode5 = (((hashCode4 + (str5 == null ? 0 : str5.hashCode())) * 31) + this.accessibilityChannel) * 31; DrmInitData drmInitData = this.drmInitData; int hashCode6 = (hashCode5 + (drmInitData == null ? 0 : drmInitData.hashCode())) * 31; Metadata metadata = this.metadata; this.hashCode = hashCode6 + (metadata != null ? metadata.hashCode() : 0); } return this.hashCode; } public final boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null || Format.class != obj.getClass()) { return false; } Format format = (Format) obj; return this.bitrate == format.bitrate && this.maxInputSize == format.maxInputSize && this.width == format.width && this.height == format.height && this.frameRate == format.frameRate && this.rotationDegrees == format.rotationDegrees && this.pixelWidthHeightRatio == format.pixelWidthHeightRatio && this.stereoMode == format.stereoMode && this.channelCount == format.channelCount && this.sampleRate == format.sampleRate && this.pcmEncoding == format.pcmEncoding && this.encoderDelay == format.encoderDelay && this.encoderPadding == format.encoderPadding && this.subsampleOffsetUs == format.subsampleOffsetUs && this.selectionFlags == format.selectionFlags && Util.areEqual(this.id, format.id) && Util.areEqual(this.language, format.language) && this.accessibilityChannel == format.accessibilityChannel && Util.areEqual(this.containerMimeType, format.containerMimeType) && Util.areEqual(this.sampleMimeType, format.sampleMimeType) && Util.areEqual(this.codecs, format.codecs) && Util.areEqual(this.drmInitData, format.drmInitData) && Util.areEqual(this.metadata, format.metadata) && Util.areEqual(this.colorInfo, format.colorInfo) && Arrays.equals(this.projectionData, format.projectionData) && initializationDataEquals(format); } public final boolean initializationDataEquals(Format format) { if (this.initializationData.size() != format.initializationData.size()) { return false; } for (int i = 0; i < this.initializationData.size(); i++) { if (!Arrays.equals(this.initializationData.get(i), format.initializationData.get(i))) { return false; } } return true; } public static String toLogString(Format format) { if (format == null) { return "null"; } StringBuilder sb = new StringBuilder(); sb.append("id="); sb.append(format.id); sb.append(", mimeType="); sb.append(format.sampleMimeType); if (format.bitrate != -1) { sb.append(", bitrate="); sb.append(format.bitrate); } if (format.width != -1 && format.height != -1) { sb.append(", res="); sb.append(format.width); sb.append("x"); sb.append(format.height); } if (format.frameRate != -1.0f) { sb.append(", fps="); sb.append(format.frameRate); } if (format.channelCount != -1) { sb.append(", channels="); sb.append(format.channelCount); } if (format.sampleRate != -1) { sb.append(", sample_rate="); sb.append(format.sampleRate); } if (format.language != null) { sb.append(", language="); sb.append(format.language); } return sb.toString(); } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { parcel.writeString(this.id); parcel.writeString(this.containerMimeType); parcel.writeString(this.sampleMimeType); parcel.writeString(this.codecs); parcel.writeInt(this.bitrate); parcel.writeInt(this.maxInputSize); parcel.writeInt(this.width); parcel.writeInt(this.height); parcel.writeFloat(this.frameRate); parcel.writeInt(this.rotationDegrees); parcel.writeFloat(this.pixelWidthHeightRatio); Util.writeBoolean(parcel, this.projectionData != null); byte[] bArr = this.projectionData; if (bArr != null) { parcel.writeByteArray(bArr); } parcel.writeInt(this.stereoMode); parcel.writeParcelable(this.colorInfo, i); parcel.writeInt(this.channelCount); parcel.writeInt(this.sampleRate); parcel.writeInt(this.pcmEncoding); parcel.writeInt(this.encoderDelay); parcel.writeInt(this.encoderPadding); parcel.writeInt(this.selectionFlags); parcel.writeString(this.language); parcel.writeInt(this.accessibilityChannel); parcel.writeLong(this.subsampleOffsetUs); int size = this.initializationData.size(); parcel.writeInt(size); for (int i2 = 0; i2 < size; i2++) { parcel.writeByteArray(this.initializationData.get(i2)); } parcel.writeParcelable(this.drmInitData, 0); parcel.writeParcelable(this.metadata, 0); } }