package c.i.a.c.i2; import android.text.TextUtils; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import c.i.a.c.v1.k; import java.util.ArrayList; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; /* compiled from: MimeTypes */ public final class s { public static final ArrayList a = new ArrayList<>(); public static final Pattern b = Pattern.compile("^mp4a\\.([a-zA-Z0-9]{2})(?:\\.([0-9]{1,2}))?$"); /* compiled from: MimeTypes */ public static final class a { } /* compiled from: MimeTypes */ @VisibleForTesting public static final class b { public final int a; public final int b; public b(int i, int i2) { this.a = i; this.b = i2; } } public static boolean a(@Nullable String str, @Nullable String str2) { b e; int a2; if (str == null) { return false; } char c2 = 65535; switch (str.hashCode()) { case -2123537834: if (str.equals("audio/eac3-joc")) { c2 = 0; break; } break; case -432837260: if (str.equals("audio/mpeg-L1")) { c2 = 1; break; } break; case -432837259: if (str.equals("audio/mpeg-L2")) { c2 = 2; break; } break; case -53558318: if (str.equals("audio/mp4a-latm")) { c2 = 3; break; } break; case 187078296: if (str.equals("audio/ac3")) { c2 = 4; break; } break; case 187094639: if (str.equals("audio/raw")) { c2 = 5; break; } break; case 1504578661: if (str.equals("audio/eac3")) { c2 = 6; break; } break; case 1504619009: if (str.equals("audio/flac")) { c2 = 7; break; } break; case 1504831518: if (str.equals("audio/mpeg")) { c2 = '\b'; break; } break; case 1903231877: if (str.equals("audio/g711-alaw")) { c2 = '\t'; break; } break; case 1903589369: if (str.equals("audio/g711-mlaw")) { c2 = '\n'; break; } break; } switch (c2) { case 0: case 1: case 2: case 4: case 5: case 6: case 7: case '\b': case '\t': case '\n': return true; case 3: return (str2 == null || (e = e(str2)) == null || (a2 = k.a(e.b)) == 0 || a2 == 16) ? false : true; default: return false; } } public static int b(String str, @Nullable String str2) { b e; char c2 = 65535; switch (str.hashCode()) { case -2123537834: if (str.equals("audio/eac3-joc")) { c2 = 0; break; } break; case -1095064472: if (str.equals("audio/vnd.dts")) { c2 = 1; break; } break; case -53558318: if (str.equals("audio/mp4a-latm")) { c2 = 2; break; } break; case 187078296: if (str.equals("audio/ac3")) { c2 = 3; break; } break; case 187078297: if (str.equals("audio/ac4")) { c2 = 4; break; } break; case 1504578661: if (str.equals("audio/eac3")) { c2 = 5; break; } break; case 1504831518: if (str.equals("audio/mpeg")) { c2 = 6; break; } break; case 1505942594: if (str.equals("audio/vnd.dts.hd")) { c2 = 7; break; } break; case 1556697186: if (str.equals("audio/true-hd")) { c2 = '\b'; break; } break; } switch (c2) { case 0: return 18; case 1: return 7; case 2: if (str2 == null || (e = e(str2)) == null) { return 0; } return k.a(e.b); case 3: return 5; case 4: return 17; case 5: return 6; case 6: return 9; case 7: return 8; case '\b': return 14; default: return 0; } } @Nullable public static String c(@Nullable String str) { b e; String str2 = null; if (str == null) { return null; } String K = f0.K(str.trim()); if (K.startsWith("avc1") || K.startsWith("avc3")) { return "video/avc"; } if (K.startsWith("hev1") || K.startsWith("hvc1")) { return "video/hevc"; } if (K.startsWith("dvav") || K.startsWith("dva1") || K.startsWith("dvhe") || K.startsWith("dvh1")) { return "video/dolby-vision"; } if (K.startsWith("av01")) { return "video/av01"; } if (K.startsWith("vp9") || K.startsWith("vp09")) { return "video/x-vnd.on2.vp9"; } if (K.startsWith("vp8") || K.startsWith("vp08")) { return "video/x-vnd.on2.vp8"; } if (K.startsWith("mp4a")) { if (K.startsWith("mp4a.") && (e = e(K)) != null) { str2 = d(e.a); } return str2 == null ? "audio/mp4a-latm" : str2; } else if (K.startsWith("ac-3") || K.startsWith("dac3")) { return "audio/ac3"; } else { if (K.startsWith("ec-3") || K.startsWith("dec3")) { return "audio/eac3"; } if (K.startsWith("ec+3")) { return "audio/eac3-joc"; } if (K.startsWith("ac-4") || K.startsWith("dac4")) { return "audio/ac4"; } if (K.startsWith("dtsc") || K.startsWith("dtse")) { return "audio/vnd.dts"; } if (K.startsWith("dtsh") || K.startsWith("dtsl")) { return "audio/vnd.dts.hd"; } if (K.startsWith("opus")) { return "audio/opus"; } if (K.startsWith("vorbis")) { return "audio/vorbis"; } if (K.startsWith("flac")) { return "audio/flac"; } if (K.startsWith("stpp")) { return "application/ttml+xml"; } if (K.startsWith("wvtt")) { return "text/vtt"; } if (K.contains("cea708")) { return "application/cea-708"; } if (K.contains("eia608") || K.contains("cea608")) { return "application/cea-608"; } int size = a.size(); for (int i = 0; i < size; i++) { Objects.requireNonNull(a.get(i)); if (K.startsWith(null)) { break; } } return null; } } @Nullable public static String d(int i) { if (i == 32) { return "video/mp4v-es"; } if (i == 33) { return "video/avc"; } if (i == 35) { return "video/hevc"; } if (i == 64) { return "audio/mp4a-latm"; } if (i == 163) { return "video/wvc1"; } if (i == 177) { return "video/x-vnd.on2.vp9"; } if (i == 165) { return "audio/ac3"; } if (i == 166) { return "audio/eac3"; } switch (i) { case 96: case 97: case 98: case 99: case 100: case 101: return "video/mpeg2"; case 102: case 103: case 104: return "audio/mp4a-latm"; case 105: case 107: return "audio/mpeg"; case 106: return "video/mpeg"; default: switch (i) { case 169: case 172: return "audio/vnd.dts"; case 170: case 171: return "audio/vnd.dts.hd"; case 173: return "audio/opus"; case 174: return "audio/ac4"; default: return null; } } } @Nullable @VisibleForTesting public static b e(String str) { Matcher matcher = b.matcher(str); if (!matcher.matches()) { return null; } String group = matcher.group(1); Objects.requireNonNull(group); String group2 = matcher.group(2); int i = 0; try { int parseInt = Integer.parseInt(group, 16); if (group2 != null) { i = Integer.parseInt(group2); } return new b(parseInt, i); } catch (NumberFormatException unused) { return null; } } @Nullable public static String f(@Nullable String str) { int indexOf; if (str == null || (indexOf = str.indexOf(47)) == -1) { return null; } return str.substring(0, indexOf); } public static int g(@Nullable String str) { if (TextUtils.isEmpty(str)) { return -1; } if (h(str)) { return 1; } if (j(str)) { return 2; } if (i(str)) { return 3; } if ("application/id3".equals(str) || "application/x-emsg".equals(str) || "application/x-scte35".equals(str)) { return 5; } if ("application/x-camera-motion".equals(str)) { return 6; } int size = a.size(); for (int i = 0; i < size; i++) { Objects.requireNonNull(a.get(i)); if (str.equals(null)) { return 0; } } return -1; } public static boolean h(@Nullable String str) { return "audio".equals(f(str)); } public static boolean i(@Nullable String str) { return "text".equals(f(str)) || "application/cea-608".equals(str) || "application/cea-708".equals(str) || "application/x-mp4-cea-608".equals(str) || "application/x-subrip".equals(str) || "application/ttml+xml".equals(str) || "application/x-quicktime-tx3g".equals(str) || "application/x-mp4-vtt".equals(str) || "application/x-rawcc".equals(str) || "application/vobsub".equals(str) || "application/pgs".equals(str) || "application/dvbsubs".equals(str); } public static boolean j(@Nullable String str) { return "video".equals(f(str)); } }