package c.i.a.c.a2.d0; import c.d.b.a.a; import c.i.a.c.a2.w; import c.i.a.c.i2.v; import c.i.a.c.v1.k; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.extractor.flv.TagPayloadReader; import java.util.Collections; /* compiled from: AudioTagPayloadReader */ public final class b extends TagPayloadReader { public static final int[] b = {5512, 11025, 22050, 44100}; /* renamed from: c reason: collision with root package name */ public boolean f649c; public boolean d; public int e; public b(w wVar) { super(wVar); } @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader public boolean b(c.i.a.c.i2.w wVar) throws TagPayloadReader.UnsupportedFormatException { if (!this.f649c) { int s2 = wVar.s(); int i = (s2 >> 4) & 15; this.e = i; if (i == 2) { int i2 = b[(s2 >> 2) & 3]; Format.b bVar = new Format.b(); bVar.k = "audio/mpeg"; bVar.f2212x = 1; bVar.f2213y = i2; this.a.e(bVar.a()); this.d = true; } else if (i == 7 || i == 8) { String str = i == 7 ? "audio/g711-alaw" : "audio/g711-mlaw"; Format.b bVar2 = new Format.b(); bVar2.k = str; bVar2.f2212x = 1; bVar2.f2213y = 8000; this.a.e(bVar2.a()); this.d = true; } else if (i != 10) { StringBuilder L = a.L("Audio format not supported: "); L.append(this.e); throw new TagPayloadReader.UnsupportedFormatException(L.toString()); } this.f649c = true; } else { wVar.E(1); } return true; } @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader public boolean c(c.i.a.c.i2.w wVar, long j) throws ParserException { if (this.e == 2) { int a = wVar.a(); this.a.c(wVar, a); this.a.d(j, 1, a, 0, null); return true; } int s2 = wVar.s(); if (s2 == 0 && !this.d) { int a2 = wVar.a(); byte[] bArr = new byte[a2]; System.arraycopy(wVar.a, wVar.b, bArr, 0, a2); wVar.b += a2; k.b c2 = k.c(new v(bArr), false); Format.b bVar = new Format.b(); bVar.k = "audio/mp4a-latm"; bVar.h = c2.f988c; bVar.f2212x = c2.b; bVar.f2213y = c2.a; bVar.m = Collections.singletonList(bArr); this.a.e(bVar.a()); this.d = true; return false; } else if (this.e == 10 && s2 != 1) { return false; } else { int a3 = wVar.a(); this.a.c(wVar, a3); this.a.d(j, 1, a3, 0, null); return true; } } }