374 lines
16 KiB
Java
374 lines
16 KiB
Java
package c.i.a.c.b2;
|
|
|
|
import android.graphics.Point;
|
|
import android.media.MediaCodecInfo;
|
|
import android.util.Log;
|
|
import android.util.Pair;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import c.d.b.a.a;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.x1.e;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
|
|
import java.util.Objects;
|
|
/* compiled from: MediaCodecInfo */
|
|
public final class s {
|
|
public final String a;
|
|
public final String b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final String f779c;
|
|
@Nullable
|
|
public final MediaCodecInfo.CodecCapabilities d;
|
|
public final boolean e;
|
|
public final boolean f;
|
|
public final boolean g;
|
|
|
|
@VisibleForTesting
|
|
public s(String str, String str2, String str3, @Nullable MediaCodecInfo.CodecCapabilities codecCapabilities, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7) {
|
|
Objects.requireNonNull(str);
|
|
this.a = str;
|
|
this.b = str2;
|
|
this.f779c = str3;
|
|
this.d = codecCapabilities;
|
|
this.e = z5;
|
|
this.f = z7;
|
|
this.g = c.i.a.c.i2.s.j(str2);
|
|
}
|
|
|
|
@RequiresApi(21)
|
|
public static Point a(MediaCodecInfo.VideoCapabilities videoCapabilities, int i, int i2) {
|
|
int widthAlignment = videoCapabilities.getWidthAlignment();
|
|
int heightAlignment = videoCapabilities.getHeightAlignment();
|
|
return new Point(f0.f(i, widthAlignment) * widthAlignment, f0.f(i2, heightAlignment) * heightAlignment);
|
|
}
|
|
|
|
@RequiresApi(21)
|
|
public static boolean b(MediaCodecInfo.VideoCapabilities videoCapabilities, int i, int i2, double d) {
|
|
Point a = a(videoCapabilities, i, i2);
|
|
int i3 = a.x;
|
|
int i4 = a.y;
|
|
return (d == -1.0d || d < 1.0d) ? videoCapabilities.isSizeSupported(i3, i4) : videoCapabilities.areSizeAndRateSupported(i3, i4, Math.floor(d));
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:44:0x0076, code lost:
|
|
if ((c.i.a.c.i2.f0.a >= 21 && r15.isFeatureSupported("secure-playback")) != false) goto L_0x007b;
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:23:0x0048 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:27:0x004f */
|
|
/* JADX WARNING: Removed duplicated region for block: B:37:0x0065 */
|
|
public static s i(String str, String str2, String str3, @Nullable MediaCodecInfo.CodecCapabilities codecCapabilities, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6) {
|
|
boolean z7;
|
|
boolean z8;
|
|
boolean z9;
|
|
boolean z10;
|
|
if (!z5 && codecCapabilities != null) {
|
|
int i = f0.a;
|
|
if (i >= 19 && codecCapabilities.isFeatureSupported("adaptive-playback")) {
|
|
if (i <= 22) {
|
|
String str4 = f0.d;
|
|
if (("ODROID-XU3".equals(str4) || "Nexus 10".equals(str4)) && ("OMX.Exynos.AVC.Decoder".equals(str) || "OMX.Exynos.AVC.Decoder.secure".equals(str))) {
|
|
z10 = true;
|
|
if (!z10) {
|
|
z7 = true;
|
|
if (codecCapabilities != null) {
|
|
if (f0.a >= 21 && codecCapabilities.isFeatureSupported("tunneled-playback")) {
|
|
z8 = true;
|
|
if (!z6) {
|
|
if (codecCapabilities != null) {
|
|
}
|
|
z9 = false;
|
|
return new s(str, str2, str3, codecCapabilities, z2, z3, z4, z7, z8, z9);
|
|
}
|
|
z9 = true;
|
|
return new s(str, str2, str3, codecCapabilities, z2, z3, z4, z7, z8, z9);
|
|
}
|
|
}
|
|
z8 = false;
|
|
if (!z6) {
|
|
}
|
|
z9 = true;
|
|
return new s(str, str2, str3, codecCapabilities, z2, z3, z4, z7, z8, z9);
|
|
}
|
|
}
|
|
}
|
|
z10 = false;
|
|
if (!z10) {
|
|
}
|
|
}
|
|
}
|
|
z7 = false;
|
|
if (codecCapabilities != null) {
|
|
}
|
|
z8 = false;
|
|
if (!z6) {
|
|
}
|
|
z9 = true;
|
|
return new s(str, str2, str3, codecCapabilities, z2, z3, z4, z7, z8, z9);
|
|
}
|
|
|
|
public e c(Format format, Format format2) {
|
|
boolean z2 = false;
|
|
int i = !f0.a(format.t, format2.t) ? 8 : 0;
|
|
if (this.g) {
|
|
if (format.B != format2.B) {
|
|
i |= 1024;
|
|
}
|
|
if (!this.e && !(format.f2275y == format2.f2275y && format.f2276z == format2.f2276z)) {
|
|
i |= 512;
|
|
}
|
|
if (!f0.a(format.F, format2.F)) {
|
|
i |= 2048;
|
|
}
|
|
String str = this.a;
|
|
if (f0.d.startsWith("SM-T230") && "OMX.MARVELL.VIDEO.HW.CODA7542DECODER".equals(str)) {
|
|
z2 = true;
|
|
}
|
|
if (z2 && !format.b(format2)) {
|
|
i |= 2;
|
|
}
|
|
if (i == 0) {
|
|
return new e(this.a, format, format2, format.b(format2) ? 3 : 2, 0);
|
|
}
|
|
} else {
|
|
if (format.G != format2.G) {
|
|
i |= 4096;
|
|
}
|
|
if (format.H != format2.H) {
|
|
i |= 8192;
|
|
}
|
|
if (format.I != format2.I) {
|
|
i |= 16384;
|
|
}
|
|
if (i == 0 && "audio/mp4a-latm".equals(this.b)) {
|
|
Pair<Integer, Integer> c2 = MediaCodecUtil.c(format);
|
|
Pair<Integer, Integer> c3 = MediaCodecUtil.c(format2);
|
|
if (!(c2 == null || c3 == null)) {
|
|
int intValue = ((Integer) c2.first).intValue();
|
|
int intValue2 = ((Integer) c3.first).intValue();
|
|
if (intValue == 42 && intValue2 == 42) {
|
|
return new e(this.a, format, format2, 3, 0);
|
|
}
|
|
}
|
|
}
|
|
if (!format.b(format2)) {
|
|
i |= 32;
|
|
}
|
|
if ("audio/opus".equals(this.b)) {
|
|
i |= 2;
|
|
}
|
|
if (i == 0) {
|
|
return new e(this.a, format, format2, 1, 0);
|
|
}
|
|
}
|
|
return new e(this.a, format, format2, 0, i);
|
|
}
|
|
|
|
public MediaCodecInfo.CodecProfileLevel[] d() {
|
|
MediaCodecInfo.CodecProfileLevel[] codecProfileLevelArr;
|
|
MediaCodecInfo.CodecCapabilities codecCapabilities = this.d;
|
|
return (codecCapabilities == null || (codecProfileLevelArr = codecCapabilities.profileLevels) == null) ? new MediaCodecInfo.CodecProfileLevel[0] : codecProfileLevelArr;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:156:? A[RETURN, SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:157:? A[RETURN, SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:70:0x0118 A[RETURN] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:71:0x0119 */
|
|
public boolean e(Format format) throws MediaCodecUtil.DecoderQueryException {
|
|
boolean z2;
|
|
boolean z3;
|
|
boolean z4;
|
|
int i;
|
|
String c2;
|
|
MediaCodecInfo.VideoCapabilities videoCapabilities;
|
|
String str = format.q;
|
|
int i2 = 16;
|
|
boolean z5 = false;
|
|
if (!(str == null || this.b == null || (c2 = c.i.a.c.i2.s.c(str)) == null)) {
|
|
if (!this.b.equals(c2)) {
|
|
StringBuilder P = a.P("codec.mime ");
|
|
P.append(format.q);
|
|
P.append(", ");
|
|
P.append(c2);
|
|
h(P.toString());
|
|
} else {
|
|
Pair<Integer, Integer> c3 = MediaCodecUtil.c(format);
|
|
if (c3 != null) {
|
|
int intValue = ((Integer) c3.first).intValue();
|
|
int intValue2 = ((Integer) c3.second).intValue();
|
|
if (this.g || intValue == 42) {
|
|
MediaCodecInfo.CodecProfileLevel[] d = d();
|
|
if (f0.a <= 23 && "video/x-vnd.on2.vp9".equals(this.b) && d.length == 0) {
|
|
MediaCodecInfo.CodecCapabilities codecCapabilities = this.d;
|
|
int intValue3 = (codecCapabilities == null || (videoCapabilities = codecCapabilities.getVideoCapabilities()) == null) ? 0 : videoCapabilities.getBitrateRange().getUpper().intValue();
|
|
int i3 = intValue3 >= 180000000 ? 1024 : intValue3 >= 120000000 ? 512 : intValue3 >= 60000000 ? 256 : intValue3 >= 30000000 ? 128 : intValue3 >= 18000000 ? 64 : intValue3 >= 12000000 ? 32 : intValue3 >= 7200000 ? 16 : intValue3 >= 3600000 ? 8 : intValue3 >= 1800000 ? 4 : intValue3 >= 800000 ? 2 : 1;
|
|
MediaCodecInfo.CodecProfileLevel codecProfileLevel = new MediaCodecInfo.CodecProfileLevel();
|
|
codecProfileLevel.profile = 1;
|
|
codecProfileLevel.level = i3;
|
|
d = new MediaCodecInfo.CodecProfileLevel[]{codecProfileLevel};
|
|
}
|
|
for (MediaCodecInfo.CodecProfileLevel codecProfileLevel2 : d) {
|
|
if (codecProfileLevel2.profile != intValue || codecProfileLevel2.level < intValue2) {
|
|
}
|
|
}
|
|
StringBuilder P2 = a.P("codec.profileLevel, ");
|
|
P2.append(format.q);
|
|
P2.append(", ");
|
|
P2.append(c2);
|
|
h(P2.toString());
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (z2) {
|
|
return false;
|
|
}
|
|
if (this.g) {
|
|
int i4 = format.f2275y;
|
|
if (i4 <= 0 || (i = format.f2276z) <= 0) {
|
|
return true;
|
|
}
|
|
if (f0.a >= 21) {
|
|
return g(i4, i, (double) format.A);
|
|
}
|
|
if (i4 * i <= MediaCodecUtil.i()) {
|
|
z5 = true;
|
|
}
|
|
if (!z5) {
|
|
StringBuilder P3 = a.P("legacyFrameSize, ");
|
|
P3.append(format.f2275y);
|
|
P3.append("x");
|
|
P3.append(format.f2276z);
|
|
h(P3.toString());
|
|
}
|
|
return z5;
|
|
}
|
|
int i5 = f0.a;
|
|
if (i5 >= 21) {
|
|
int i6 = format.H;
|
|
if (i6 != -1) {
|
|
MediaCodecInfo.CodecCapabilities codecCapabilities2 = this.d;
|
|
if (codecCapabilities2 == null) {
|
|
h("sampleRate.caps");
|
|
} else {
|
|
MediaCodecInfo.AudioCapabilities audioCapabilities = codecCapabilities2.getAudioCapabilities();
|
|
if (audioCapabilities == null) {
|
|
h("sampleRate.aCaps");
|
|
} else if (!audioCapabilities.isSampleRateSupported(i6)) {
|
|
h("sampleRate.support, " + i6);
|
|
} else {
|
|
z4 = true;
|
|
if (!z4) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
z4 = false;
|
|
if (!z4) {
|
|
}
|
|
}
|
|
int i7 = format.G;
|
|
if (i7 != -1) {
|
|
MediaCodecInfo.CodecCapabilities codecCapabilities3 = this.d;
|
|
if (codecCapabilities3 == null) {
|
|
h("channelCount.caps");
|
|
} else {
|
|
MediaCodecInfo.AudioCapabilities audioCapabilities2 = codecCapabilities3.getAudioCapabilities();
|
|
if (audioCapabilities2 == null) {
|
|
h("channelCount.aCaps");
|
|
} else {
|
|
String str2 = this.a;
|
|
String str3 = this.b;
|
|
int maxInputChannelCount = audioCapabilities2.getMaxInputChannelCount();
|
|
if (maxInputChannelCount <= 1 && ((i5 < 26 || maxInputChannelCount <= 0) && !"audio/mpeg".equals(str3) && !"audio/3gpp".equals(str3) && !"audio/amr-wb".equals(str3) && !"audio/mp4a-latm".equals(str3) && !"audio/vorbis".equals(str3) && !"audio/opus".equals(str3) && !"audio/raw".equals(str3) && !"audio/flac".equals(str3) && !"audio/g711-alaw".equals(str3) && !"audio/g711-mlaw".equals(str3) && !"audio/gsm".equals(str3))) {
|
|
if ("audio/ac3".equals(str3)) {
|
|
i2 = 6;
|
|
} else if (!"audio/eac3".equals(str3)) {
|
|
i2 = 30;
|
|
}
|
|
Log.w("MediaCodecInfo", "AssumedMaxChannelAdjustment: " + str2 + ", [" + maxInputChannelCount + " to " + i2 + "]");
|
|
maxInputChannelCount = i2;
|
|
}
|
|
if (maxInputChannelCount < i7) {
|
|
h("channelCount.support, " + i7);
|
|
} else {
|
|
z3 = true;
|
|
if (z3) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z3 = false;
|
|
if (z3) {
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
z2 = true;
|
|
if (z2) {
|
|
}
|
|
}
|
|
|
|
public boolean f(Format format) {
|
|
if (this.g) {
|
|
return this.e;
|
|
}
|
|
Pair<Integer, Integer> c2 = MediaCodecUtil.c(format);
|
|
return c2 != null && ((Integer) c2.first).intValue() == 42;
|
|
}
|
|
|
|
@RequiresApi(21)
|
|
public boolean g(int i, int i2, double d) {
|
|
MediaCodecInfo.CodecCapabilities codecCapabilities = this.d;
|
|
if (codecCapabilities == null) {
|
|
h("sizeAndRate.caps");
|
|
return false;
|
|
}
|
|
MediaCodecInfo.VideoCapabilities videoCapabilities = codecCapabilities.getVideoCapabilities();
|
|
if (videoCapabilities == null) {
|
|
h("sizeAndRate.vCaps");
|
|
return false;
|
|
}
|
|
if (!b(videoCapabilities, i, i2, d)) {
|
|
if (i < i2) {
|
|
if ((!"OMX.MTK.VIDEO.DECODER.HEVC".equals(this.a) || !"mcv5a".equals(f0.b)) && b(videoCapabilities, i2, i, d)) {
|
|
StringBuilder R = a.R("sizeAndRate.rotated, ", i, "x", i2, "x");
|
|
R.append(d);
|
|
StringBuilder V = a.V("AssumedSupport [", R.toString(), "] [");
|
|
V.append(this.a);
|
|
V.append(", ");
|
|
V.append(this.b);
|
|
V.append("] [");
|
|
V.append(f0.e);
|
|
V.append("]");
|
|
Log.d("MediaCodecInfo", V.toString());
|
|
}
|
|
}
|
|
StringBuilder R2 = a.R("sizeAndRate.support, ", i, "x", i2, "x");
|
|
R2.append(d);
|
|
h(R2.toString());
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final void h(String str) {
|
|
StringBuilder V = a.V("NoSupport [", str, "] [");
|
|
V.append(this.a);
|
|
V.append(", ");
|
|
V.append(this.b);
|
|
V.append("] [");
|
|
V.append(f0.e);
|
|
V.append("]");
|
|
Log.d("MediaCodecInfo", V.toString());
|
|
}
|
|
|
|
public String toString() {
|
|
return this.a;
|
|
}
|
|
}
|