Rabbit-R1/original r1/java/sources/org/webrtc/MediaCodecUtils.java
2024-05-21 17:08:36 -04:00

108 lines
4.5 KiB
Java

package org.webrtc;
import android.media.MediaCodecInfo;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes3.dex */
class MediaCodecUtils {
static final String EXYNOS_PREFIX = "OMX.Exynos.";
static final String INTEL_PREFIX = "OMX.Intel.";
static final String NVIDIA_PREFIX = "OMX.Nvidia.";
static final String QCOM_PREFIX = "OMX.qcom.";
private static final String TAG = "MediaCodecUtils";
static final String[] SOFTWARE_IMPLEMENTATION_PREFIXES = {"OMX.google.", "OMX.SEC.", "c2.android"};
static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar32m4ka = 2141391873;
static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar16m4ka = 2141391874;
static final int COLOR_QCOM_FORMATYVU420PackedSemiPlanar64x32Tile2m8ka = 2141391875;
static final int COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m = 2141391876;
static final int[] DECODER_COLOR_FORMATS = {19, 21, 2141391872, COLOR_QCOM_FORMATYVU420PackedSemiPlanar32m4ka, COLOR_QCOM_FORMATYVU420PackedSemiPlanar16m4ka, COLOR_QCOM_FORMATYVU420PackedSemiPlanar64x32Tile2m8ka, COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m};
static final int[] ENCODER_COLOR_FORMATS = {19, 21, 2141391872, COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m};
static final int[] TEXTURE_COLOR_FORMATS = getTextureColorFormats();
private static int[] getTextureColorFormats() {
return new int[]{2130708361};
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Integer selectColorFormat(int[] iArr, MediaCodecInfo.CodecCapabilities codecCapabilities) {
for (int i : iArr) {
for (int i2 : codecCapabilities.colorFormats) {
if (i2 == i) {
return Integer.valueOf(i2);
}
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean codecSupportsType(MediaCodecInfo mediaCodecInfo, VideoCodecMimeType videoCodecMimeType) {
for (String str : mediaCodecInfo.getSupportedTypes()) {
if (videoCodecMimeType.mimeType().equals(str)) {
return true;
}
}
return false;
}
/* renamed from: org.webrtc.MediaCodecUtils$1, reason: invalid class name */
/* loaded from: classes3.dex */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$org$webrtc$VideoCodecMimeType;
static {
int[] iArr = new int[VideoCodecMimeType.values().length];
$SwitchMap$org$webrtc$VideoCodecMimeType = iArr;
try {
iArr[VideoCodecMimeType.VP8.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$webrtc$VideoCodecMimeType[VideoCodecMimeType.VP9.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$org$webrtc$VideoCodecMimeType[VideoCodecMimeType.AV1.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$org$webrtc$VideoCodecMimeType[VideoCodecMimeType.H264.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Map<String, String> getCodecProperties(VideoCodecMimeType videoCodecMimeType, boolean z) {
int i = AnonymousClass1.$SwitchMap$org$webrtc$VideoCodecMimeType[videoCodecMimeType.ordinal()];
if (i == 1 || i == 2 || i == 3) {
return new HashMap();
}
if (i == 4) {
return H264Utils.getDefaultH264Params(z);
}
throw new IllegalArgumentException("Unsupported codec: " + videoCodecMimeType);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean isHardwareAccelerated(MediaCodecInfo mediaCodecInfo) {
return isHardwareAcceleratedQOrHigher(mediaCodecInfo);
}
private static boolean isHardwareAcceleratedQOrHigher(MediaCodecInfo mediaCodecInfo) {
return mediaCodecInfo.isHardwareAccelerated();
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean isSoftwareOnly(MediaCodecInfo mediaCodecInfo) {
return isSoftwareOnlyQOrHigher(mediaCodecInfo);
}
private static boolean isSoftwareOnlyQOrHigher(MediaCodecInfo mediaCodecInfo) {
return mediaCodecInfo.isSoftwareOnly();
}
private MediaCodecUtils() {
}
}