package d3;

import androidx.media3.common.Format;
import androidx.media3.common.MimeTypes;
import androidx.media3.exoplayer.text.SubtitleDecoderFactory;
import androidx.media3.extractor.text.SubtitleDecoder;
import com.google.firebase.sessions.settings.RemoteSettings;
import java.util.List;
import n2.AbstractC2612c;
import x4.AbstractC3251q;

/* JADX INFO: loaded from: classes.dex */
public final class B implements SubtitleDecoderFactory {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final B f15020a = new B();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final SubtitleDecoderFactory f15021b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final List f15022c;

    static {
        SubtitleDecoderFactory DEFAULT = SubtitleDecoderFactory.DEFAULT;
        kotlin.jvm.internal.o.g(DEFAULT, "DEFAULT");
        f15021b = DEFAULT;
        f15022c = AbstractC2612c.q(MimeTypes.APPLICATION_VOBSUB);
    }

    public static boolean a(Format format) {
        String string;
        String str = format.sampleMimeType;
        if (str != null) {
            String str2 = (String) AbstractC3251q.g0(S4.p.d1(str, new String[]{";"}, 6));
            if (str2 != null && (string = S4.p.o1(str2).toString()) != null) {
                str = string;
            }
            List<String> list = f15022c;
            if (list == null || !list.isEmpty()) {
                for (String str3 : list) {
                    if (str.equals(str3)) {
                        return true;
                    }
                    if (S4.w.A0(str, str3 + RemoteSettings.FORWARD_SLASH_STRING, false)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    @Override // androidx.media3.exoplayer.text.SubtitleDecoderFactory
    public final SubtitleDecoder createDecoder(Format format) {
        kotlin.jvm.internal.o.h(format, "format");
        if (a(format)) {
            return new A("NoOpSubtitleDecoder");
        }
        SubtitleDecoder subtitleDecoderCreateDecoder = f15021b.createDecoder(format);
        kotlin.jvm.internal.o.g(subtitleDecoderCreateDecoder, "createDecoder(...)");
        return subtitleDecoderCreateDecoder;
    }

    @Override // androidx.media3.exoplayer.text.SubtitleDecoderFactory
    public final boolean supportsFormat(Format format) {
        kotlin.jvm.internal.o.h(format, "format");
        if (a(format)) {
            return false;
        }
        return f15021b.supportsFormat(format);
    }
}
