package com.applovin.impl; import com.applovin.impl.f9; import com.applovin.impl.xl; /* loaded from: classes.dex */ final class yq extends xl { private final bh b; private final bh c; private int d; private boolean e; private boolean f; private int g; public yq(qo qoVar) { super(qoVar); this.b = new bh(zf.a); this.c = new bh(4); } @Override // com.applovin.impl.xl public boolean a(bh bhVar) { int w = bhVar.w(); int i = (w >> 4) & 15; int i2 = w & 15; if (i2 == 7) { this.g = i; return i != 5; } throw new xl.a("Video format not supported: " + i2); } @Override // com.applovin.impl.xl public boolean b(bh bhVar, long j) { int w = bhVar.w(); long k = j + (bhVar.k() * 1000); if (w == 0 && !this.e) { bh bhVar2 = new bh(new byte[bhVar.a()]); bhVar.a(bhVar2.c(), 0, bhVar.a()); w1 b = w1.b(bhVar2); this.d = b.b; this.a.a(new f9.b().f("video/avc").a(b.f).q(b.c).g(b.d).b(b.e).a(b.a).a()); this.e = true; return false; } if (w != 1 || !this.e) { return false; } int i = this.g == 1 ? 1 : 0; if (!this.f && i == 0) { return false; } byte[] c = this.c.c(); c[0] = 0; c[1] = 0; c[2] = 0; int i2 = 4 - this.d; int i3 = 0; while (bhVar.a() > 0) { bhVar.a(this.c.c(), i2, this.d); this.c.f(0); int A = this.c.A(); this.b.f(0); this.a.a(this.b, 4); this.a.a(bhVar, A); i3 = i3 + 4 + A; } this.a.a(k, i, i3, 0, null); this.f = true; return true; } }