package io.github.anilbeesetti.nextlib.mediainfo;

import android.os.ParcelFileDescriptor;
import androidx.annotation.Keep;
import d1.C0444a;
import d1.C0445b;
import d1.C0446c;
import d1.C0448e;
import d1.C0449f;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.l;

/* JADX INFO: loaded from: classes.dex */
public final class MediaInfoBuilder {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private boolean f4508a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private String f4509b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private Long f4510c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private Long f4511d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private C0449f f4512e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final List f4513f = new ArrayList();

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final List f4514g = new ArrayList();

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final List f4515h = new ArrayList();

    public MediaInfoBuilder() {
        System.loadLibrary("mediainfo");
    }

    @Keep
    private final native void nativeCreateFromFD(int i2);

    @Keep
    private final native void nativeCreateFromPath(String str);

    @Keep
    private final void onAudioStreamFound(int i2, String str, String str2, String str3, int i3, long j2, String str4, int i4, int i5, String str5, String str6) {
        this.f4513f.add(new C0444a(i2, str, str2, str3, i3, j2, str4, i4, i5, str5, str6));
    }

    @Keep
    private final void onChapterFound(int i2, String str, long j2, long j3) {
        this.f4515h.add(new C0445b(i2, j2, j3, str));
    }

    @Keep
    private final void onError() {
        this.f4508a = true;
    }

    @Keep
    private final void onMediaInfoFound(String str, long j2) {
        this.f4509b = str;
        this.f4510c = Long.valueOf(j2);
    }

    @Keep
    private final void onSubtitleStreamFound(int i2, String str, String str2, String str3, int i3) {
        this.f4514g.add(new C0448e(i2, str, str2, str3, i3));
    }

    @Keep
    private final void onVideoStreamFound(int i2, String str, String str2, String str3, int i3, long j2, double d2, int i4, int i5, int i6, long j3) {
        if (this.f4512e == null) {
            this.f4512e = new C0449f(i2, str, str2, str3, i3, j2, d2, i4, i5, i6);
            if (j3 != -1) {
                this.f4511d = Long.valueOf(j3);
            }
        }
    }

    public final C0446c a() {
        if (this.f4508a) {
            return null;
        }
        String str = this.f4509b;
        l.b(str);
        Long l2 = this.f4510c;
        l.b(l2);
        return new C0446c(str, l2.longValue(), this.f4512e, this.f4513f, this.f4514g, this.f4515h, this.f4511d);
    }

    /* JADX WARN: Removed duplicated region for block: B:9:0x003c  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final io.github.anilbeesetti.nextlib.mediainfo.MediaInfoBuilder b(android.content.Context r6, android.net.Uri r7) {
        /*
            r5 = this;
            java.lang.String r0 = "context"
            kotlin.jvm.internal.l.e(r6, r0)
            java.lang.String r0 = "uri"
            kotlin.jvm.internal.l.e(r7, r0)
            java.lang.String r0 = r7.getScheme()
            if (r0 == 0) goto L3c
            kotlin.jvm.internal.l.b(r0)
            java.util.Locale r1 = java.util.Locale.ROOT
            java.lang.String r0 = r0.toLowerCase(r1)
            java.lang.String r1 = "toLowerCase(...)"
            kotlin.jvm.internal.l.d(r0, r1)
            if (r0 == 0) goto L3c
            r1 = 2
            r2 = 0
            java.lang.String r3 = "http"
            r4 = 0
            boolean r0 = E1.g.y(r0, r3, r4, r1, r2)
            r1 = 1
            if (r0 != r1) goto L3c
            java.lang.String r6 = r7.toString()
            java.lang.String r7 = "toString(...)"
            kotlin.jvm.internal.l.d(r6, r7)
            r5.d(r6)
            goto L5e
        L3c:
            d1.d r0 = d1.C0447d.f3790a
            java.lang.String r0 = r0.b(r6, r7)
            if (r0 == 0) goto L48
            r5.d(r0)
            goto L5e
        L48:
            android.content.ContentResolver r6 = r6.getContentResolver()     // Catch: java.io.FileNotFoundException -> L58
            java.lang.String r0 = "r"
            android.os.ParcelFileDescriptor r6 = r6.openFileDescriptor(r7, r0)     // Catch: java.io.FileNotFoundException -> L58
            if (r6 == 0) goto L5e
            r5.c(r6)     // Catch: java.io.FileNotFoundException -> L58
            goto L5e
        L58:
            r6 = move-exception
            java.lang.String r7 = "error"
            android.util.Log.w(r7, r6)
        L5e:
            return r5
        */
        throw new UnsupportedOperationException("Method not decompiled: io.github.anilbeesetti.nextlib.mediainfo.MediaInfoBuilder.b(android.content.Context, android.net.Uri):io.github.anilbeesetti.nextlib.mediainfo.MediaInfoBuilder");
    }

    public final MediaInfoBuilder c(ParcelFileDescriptor descriptor) {
        l.e(descriptor, "descriptor");
        nativeCreateFromFD(descriptor.getFd());
        return this;
    }

    public final MediaInfoBuilder d(String filePath) {
        l.e(filePath, "filePath");
        nativeCreateFromPath(filePath);
        return this;
    }
}
