package z0;

import android.net.Uri;
import java.util.Collections;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class x implements h {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final h f19181q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public long f19182r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public Uri f19183s;

    public x(h hVar) {
        hVar.getClass();
        this.f19181q = hVar;
        this.f19183s = Uri.EMPTY;
        Map map = Collections.EMPTY_MAP;
    }

    @Override // z0.h
    public final void close() {
        this.f19181q.close();
    }

    @Override // z0.h
    public final Uri e() {
        return this.f19181q.e();
    }

    @Override // z0.h
    public final long g(k kVar) {
        h hVar = this.f19181q;
        this.f19183s = kVar.f19138a;
        Map map = Collections.EMPTY_MAP;
        try {
            return hVar.g(kVar);
        } finally {
            Uri uriE = hVar.e();
            if (uriE != null) {
                this.f19183s = uriE;
            }
            hVar.m();
        }
    }

    @Override // z0.h
    public final void k(y yVar) {
        yVar.getClass();
        this.f19181q.k(yVar);
    }

    @Override // z0.h
    public final Map m() {
        return this.f19181q.m();
    }

    @Override // u0.InterfaceC1571g
    public final int p(byte[] bArr, int i, int i5) {
        int iP = this.f19181q.p(bArr, i, i5);
        if (iP != -1) {
            this.f19182r += (long) iP;
        }
        return iP;
    }
}
