package p138.p176.p177.p190.p238;

import android.net.Uri;
import android.util.Base64;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.upstream.DataSourceException;
import java.net.URLDecoder;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྌ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4093 extends AbstractC4092 {

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public C4098 f13066;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public byte[] f13067;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public int f13068;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public int f13069;

    public C4093() {
        super(false);
    }

    @Override // p138.p176.p177.p190.p238.InterfaceC4095
    public void close() {
        if (this.f13067 != null) {
            this.f13067 = null;
            m6581();
        }
        this.f13066 = null;
    }

    @Override // p138.p176.p177.p190.p238.InterfaceC4095
    /* JADX INFO: renamed from: ֏ */
    public int mo1282(byte[] bArr, int i, int i2) {
        if (i2 == 0) {
            return 0;
        }
        int i3 = this.f13068 - this.f13069;
        if (i3 == 0) {
            return -1;
        }
        int iMin = Math.min(i2, i3);
        byte[] bArr2 = this.f13067;
        C4150.m6755(bArr2);
        System.arraycopy(bArr2, this.f13069, bArr, i, iMin);
        this.f13069 += iMin;
        m6579(iMin);
        return iMin;
    }

    @Override // p138.p176.p177.p190.p238.InterfaceC4095
    /* JADX INFO: renamed from: ֏ */
    public long mo1283(C4098 c4098) throws DataSourceException, ParserException {
        m6580(c4098);
        this.f13066 = c4098;
        this.f13069 = (int) c4098.f13081;
        Uri uri = c4098.f13076;
        String scheme = uri.getScheme();
        if (!"data".equals(scheme)) {
            throw new ParserException(C2803.m4879("Unsupported scheme: ", scheme));
        }
        String[] strArrM6781 = C4150.m6781(uri.getSchemeSpecificPart(), ",");
        if (strArrM6781.length != 2) {
            throw new ParserException(C2803.m4876("Unexpected URI format: ", uri));
        }
        String str = strArrM6781[1];
        if (strArrM6781[0].contains(";base64")) {
            try {
                this.f13067 = Base64.decode(str, 0);
            } catch (IllegalArgumentException e) {
                throw new ParserException(C2803.m4879("Error while parsing Base64 encoded string: ", str), e);
            }
        } else {
            this.f13067 = C4150.m6799(URLDecoder.decode(str, "US-ASCII"));
        }
        long j = c4098.f13082;
        int length = j != -1 ? ((int) j) + this.f13069 : this.f13067.length;
        this.f13068 = length;
        if (length > this.f13067.length || this.f13069 > length) {
            this.f13067 = null;
            throw new DataSourceException(0);
        }
        m6582(c4098);
        return ((long) this.f13068) - ((long) this.f13069);
    }

    @Override // p138.p176.p177.p190.p238.InterfaceC4095
    /* JADX INFO: renamed from: ؠ */
    public Uri mo1284() {
        C4098 c4098 = this.f13066;
        if (c4098 != null) {
            return c4098.f13076;
        }
        return null;
    }
}
