그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc
以下内容为反编译后的 i0.java 源代码,内容仅作参考
package k0;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.TextureView;
import androidx.annotation.Nullable;
import c2.o;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.drm.d;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.a;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArraySet;
import k0.a;
import k0.b;
import k0.d0;
import l0.a;
import l0.b;
public final class i0 extends c implements d0.c, d0.b {
@Nullable
public f2.g A;
@Nullable
public g2.a B;
public boolean C;
public final f0[] f9092b;
public final o f9093c;
public final Handler f9094d;
public final b f9095e;
public final CopyOnWriteArraySet<f2.i> f9096f;
public final CopyOnWriteArraySet<m0.d> f9097g;
public final CopyOnWriteArraySet<q1.k> f9098h;
public final CopyOnWriteArraySet<b1.d> i;
public final CopyOnWriteArraySet<f2.m> f9099j;
public final CopyOnWriteArraySet<m0.k> f9100k;
public final c2.d f9101l;
public final l0.a f9102m;
public final k0.a f9103n;
public final k0.b f9104o;
public final k0 f9105p;
@Nullable
public Surface q;
public boolean f9106r;
@Nullable
public SurfaceHolder f9107s;
@Nullable
public TextureView f9108t;
public int f9109u;
public int f9110v;
public int f9111w;
public float f9112x;
@Nullable
public i1.m f9113y;
public List<q1.b> f9114z;
public static final class a {
public final Context f9115a;
public final i f9116b;
public final e2.c f9117c;
public z1.d f9118d;
public v f9119e;
public final c2.d f9120f;
public final l0.a f9121g;
public Looper f9122h;
public boolean i;
public a(Context context, i iVar) {
c2.o oVar;
a.c cVar = new a.c();
DefaultTrackSelector.Parameters parameters = DefaultTrackSelector.Parameters.F;
DefaultTrackSelector defaultTrackSelector = new DefaultTrackSelector(new DefaultTrackSelector.c(context).a(), cVar);
g gVar = new g();
Map<String, int[]> map = c2.o.f1039n;
synchronized (c2.o.class) {
if (c2.o.f1043s == null) {
c2.o.f1043s = new o.a(context).a();
}
oVar = c2.o.f1043s;
}
Looper myLooper = Looper.myLooper();
myLooper = myLooper == null ? Looper.getMainLooper() : myLooper;
e2.x xVar = e2.c.f6749a;
l0.a aVar = new l0.a();
this.f9115a = context;
this.f9116b = iVar;
this.f9118d = defaultTrackSelector;
this.f9119e = gVar;
this.f9120f = oVar;
this.f9122h = myLooper;
this.f9121g = aVar;
this.f9117c = xVar;
}
}
public final class b implements f2.m, m0.k, q1.k, b1.d, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, b.InterfaceC0168b, a.b, d0.a {
public b() {
}
@Override
public final void onAudioDecoderInitialized(String str, long j10, long j11) {
Iterator<m0.k> it2 = i0.this.f9100k.iterator();
while (it2.hasNext()) {
it2.next().onAudioDecoderInitialized(str, j10, j11);
}
}
@Override
public final void onAudioDisabled(n0.e eVar) {
i0 i0Var = i0.this;
Iterator<m0.k> it2 = i0Var.f9100k.iterator();
while (it2.hasNext()) {
it2.next().onAudioDisabled(eVar);
}
i0Var.f9111w = 0;
}
@Override
public final void onAudioEnabled(n0.e eVar) {
i0 i0Var = i0.this;
i0Var.getClass();
Iterator<m0.k> it2 = i0Var.f9100k.iterator();
while (it2.hasNext()) {
it2.next().onAudioEnabled(eVar);
}
}
@Override
public final void onAudioInputFormatChanged(Format format) {
i0 i0Var = i0.this;
i0Var.getClass();
Iterator<m0.k> it2 = i0Var.f9100k.iterator();
while (it2.hasNext()) {
it2.next().onAudioInputFormatChanged(format);
}
}
@Override
public final void onAudioSessionId(int i) {
CopyOnWriteArraySet<m0.k> copyOnWriteArraySet;
i0 i0Var = i0.this;
if (i0Var.f9111w == i) {
return;
}
i0Var.f9111w = i;
Iterator<m0.d> it2 = i0Var.f9097g.iterator();
while (true) {
boolean hasNext = it2.hasNext();
copyOnWriteArraySet = i0Var.f9100k;
if (!hasNext) {
break;
}
m0.d next = it2.next();
if (!copyOnWriteArraySet.contains(next)) {
next.onAudioSessionId(i);
}
}
Iterator<m0.k> it3 = copyOnWriteArraySet.iterator();
while (it3.hasNext()) {
it3.next().onAudioSessionId(i);
}
}
@Override
public final void onAudioSinkUnderrun(int i, long j10, long j11) {
Iterator<m0.k> it2 = i0.this.f9100k.iterator();
while (it2.hasNext()) {
it2.next().onAudioSinkUnderrun(i, j10, j11);
}
}
@Override
public final void onCues(List<q1.b> list) {
i0 i0Var = i0.this;
i0Var.f9114z = list;
Iterator<q1.k> it2 = i0Var.f9098h.iterator();
while (it2.hasNext()) {
it2.next().onCues(list);
}
}
@Override
public final void onDroppedFrames(int i, long j10) {
Iterator<f2.m> it2 = i0.this.f9099j.iterator();
while (it2.hasNext()) {
it2.next().onDroppedFrames(i, j10);
}
}
@Override
public final void onIsPlayingChanged(boolean z10) {
}
@Override
public final void onLoadingChanged(boolean z10) {
i0.this.getClass();
}
@Override
public final void onMetadata(Metadata metadata) {
Iterator<b1.d> it2 = i0.this.i.iterator();
while (it2.hasNext()) {
it2.next().onMetadata(metadata);
}
}
@Override
public final void onPlaybackParametersChanged(b0 b0Var) {
}
@Override
public final void onPlaybackSuppressionReasonChanged(int i) {
}
@Override
public final void onPlayerError(j jVar) {
}
@Override
public final void onPlayerStateChanged(boolean z10, int i) {
i0 i0Var = i0.this;
if (i != 1) {
if (i != 2 && i != 3) {
if (i != 4) {
return;
}
} else {
i0Var.f9105p.getClass();
return;
}
}
i0Var.f9105p.getClass();
}
@Override
public final void onPositionDiscontinuity(int i) {
}
@Override
public final void onRenderedFirstFrame(Surface surface) {
i0 i0Var = i0.this;
if (i0Var.q == surface) {
Iterator<f2.i> it2 = i0Var.f9096f.iterator();
while (it2.hasNext()) {
it2.next().b();
}
}
Iterator<f2.m> it3 = i0Var.f9099j.iterator();
while (it3.hasNext()) {
it3.next().onRenderedFirstFrame(surface);
}
}
@Override
public final void onRepeatModeChanged(int i) {
}
@Override
public final void onSeekProcessed() {
}
@Override
public final void onShuffleModeEnabledChanged(boolean z10) {
}
@Override
public final void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i10) {
Surface surface = new Surface(surfaceTexture);
i0 i0Var = i0.this;
i0Var.O(surface, true);
i0Var.G(i, i10);
}
@Override
public final boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
i0 i0Var = i0.this;
i0Var.O(null, true);
i0Var.G(0, 0);
return true;
}
@Override
public final void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i10) {
i0.this.G(i, i10);
}
@Override
public final void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public final void onTimelineChanged(j0 j0Var, int i) {
androidx.appcompat.widget.d.a(this, j0Var, i);
}
@Override
public final void onTracksChanged(TrackGroupArray trackGroupArray, z1.c cVar) {
}
@Override
public final void onVideoDecoderInitialized(String str, long j10, long j11) {
Iterator<f2.m> it2 = i0.this.f9099j.iterator();
while (it2.hasNext()) {
it2.next().onVideoDecoderInitialized(str, j10, j11);
}
}
@Override
public final void onVideoDisabled(n0.e eVar) {
Iterator<f2.m> it2 = i0.this.f9099j.iterator();
while (it2.hasNext()) {
it2.next().onVideoDisabled(eVar);
}
}
@Override
public final void onVideoEnabled(n0.e eVar) {
i0 i0Var = i0.this;
i0Var.getClass();
Iterator<f2.m> it2 = i0Var.f9099j.iterator();
while (it2.hasNext()) {
it2.next().onVideoEnabled(eVar);
}
}
@Override
public final void onVideoInputFormatChanged(Format format) {
i0 i0Var = i0.this;
i0Var.getClass();
Iterator<f2.m> it2 = i0Var.f9099j.iterator();
while (it2.hasNext()) {
it2.next().onVideoInputFormatChanged(format);
}
}
@Override
public final void onVideoSizeChanged(int i, int i10, int i11, float f10) {
CopyOnWriteArraySet<f2.m> copyOnWriteArraySet;
i0 i0Var = i0.this;
Iterator<f2.i> it2 = i0Var.f9096f.iterator();
while (true) {
boolean hasNext = it2.hasNext();
copyOnWriteArraySet = i0Var.f9099j;
if (!hasNext) {
break;
}
f2.i next = it2.next();
if (!copyOnWriteArraySet.contains(next)) {
next.onVideoSizeChanged(i, i10, i11, f10);
}
}
Iterator<f2.m> it3 = copyOnWriteArraySet.iterator();
while (it3.hasNext()) {
it3.next().onVideoSizeChanged(i, i10, i11, f10);
}
}
@Override
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i10, int i11) {
i0.this.G(i10, i11);
}
@Override
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
i0.this.O(surfaceHolder.getSurface(), false);
}
@Override
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
i0 i0Var = i0.this;
i0Var.O(null, false);
i0Var.G(0, 0);
}
@Override
public final void onTimelineChanged(j0 j0Var, Object obj, int i) {
}
}
public i0(Context context, i iVar, z1.d dVar, v vVar, c2.d dVar2, l0.a aVar, e2.c cVar, Looper looper) {
int i;
Intent registerReceiver;
boolean z10;
int i10;
m0.c cVar2;
int i11;
int i12;
boolean z11;
int i13;
d.a aVar2 = com.google.android.exoplayer2.drm.d.f1462a;
this.f9101l = dVar2;
this.f9102m = aVar;
b bVar = new b();
this.f9095e = bVar;
this.f9096f = new CopyOnWriteArraySet<>();
this.f9097g = new CopyOnWriteArraySet<>();
this.f9098h = new CopyOnWriteArraySet<>();
this.i = new CopyOnWriteArraySet<>();
this.f9099j = new CopyOnWriteArraySet<>();
this.f9100k = new CopyOnWriteArraySet<>();
Handler handler = new Handler(looper);
this.f9094d = handler;
iVar.getClass();
ArrayList arrayList = new ArrayList();
int i14 = iVar.f9091b;
Context context2 = iVar.f9090a;
arrayList.add(new f2.d(context2, aVar2, handler, bVar));
if (i14 != 0) {
int size = arrayList.size();
int i15 = i14 == 2 ? size - 1 : size;
try {
try {
i13 = i15 + 1;
try {
arrayList.add(i15, (f0) Class.forName("com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer").getConstructor(Long.TYPE, Handler.class, f2.m.class, Integer.TYPE).newInstance(5000L, handler, bVar, 50));
Log.i("DefaultRenderersFactory", "Loaded LibvpxVideoRenderer.");
} catch (ClassNotFoundException unused) {
i15 = i13;
i13 = i15;
try {
Constructor<?> constructor = Class.forName("com.google.android.exoplayer2.ext.av1.Libgav1VideoRenderer").getConstructor(Long.TYPE, Handler.class, f2.m.class, Integer.TYPE);
Object[] objArr = new Object[4];
objArr[0] = 5000L;
objArr[1] = handler;
try {
objArr[2] = bVar;
objArr[3] = 50;
arrayList.add(i13, (f0) constructor.newInstance(objArr));
Log.i("DefaultRenderersFactory", "Loaded Libgav1VideoRenderer.");
} catch (ClassNotFoundException unused2) {
i = iVar.f9091b;
m0.e[] eVarArr = new m0.e[0];
m0.c cVar3 = m0.c.f9869c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (e2.d0.f6754a < 17) {
}
z10 = false;
if (z10) {
}
if (registerReceiver == null) {
}
cVar2 = m0.c.f9869c;
arrayList.add(new m0.t(context2, aVar2, handler, bVar, new m0.r(cVar2, eVarArr)));
if (i == 0) {
}
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar = new o(f0VarArr, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
i = iVar.f9091b;
m0.e[] eVarArr2 = new m0.e[0];
m0.c cVar32 = m0.c.f9869c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (e2.d0.f6754a < 17) {
}
z10 = false;
if (z10) {
}
if (registerReceiver == null) {
}
cVar2 = m0.c.f9869c;
arrayList.add(new m0.t(context2, aVar2, handler, bVar, new m0.r(cVar2, eVarArr2)));
if (i == 0) {
}
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr2 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr2;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar2 = new o(f0VarArr2, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar2;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar2;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
} catch (Exception e10) {
throw new RuntimeException("Error instantiating AV1 extension", e10);
}
}
} catch (Exception e11) {
throw new RuntimeException("Error instantiating VP9 extension", e11);
}
} catch (ClassNotFoundException unused3) {
}
try {
Constructor<?> constructor2 = Class.forName("com.google.android.exoplayer2.ext.av1.Libgav1VideoRenderer").getConstructor(Long.TYPE, Handler.class, f2.m.class, Integer.TYPE);
Object[] objArr2 = new Object[4];
objArr2[0] = 5000L;
objArr2[1] = handler;
objArr2[2] = bVar;
objArr2[3] = 50;
arrayList.add(i13, (f0) constructor2.newInstance(objArr2));
Log.i("DefaultRenderersFactory", "Loaded Libgav1VideoRenderer.");
} catch (ClassNotFoundException unused4) {
}
}
i = iVar.f9091b;
m0.e[] eVarArr22 = new m0.e[0];
m0.c cVar322 = m0.c.f9869c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (e2.d0.f6754a < 17 && "Amazon".equals(e2.d0.f6756c)) {
z10 = true;
} else {
z10 = false;
}
if (z10) {
i10 = 0;
if (Settings.Global.getInt(context2.getContentResolver(), "external_surround_sound_enabled", 0) == 1) {
cVar2 = m0.c.f9870d;
arrayList.add(new m0.t(context2, aVar2, handler, bVar, new m0.r(cVar2, eVarArr22)));
if (i == 0) {
int size2 = arrayList.size();
size2 = i == 2 ? size2 - 1 : size2;
try {
try {
i11 = size2 + 1;
} catch (ClassNotFoundException unused5) {
}
try {
try {
arrayList.add(size2, (f0) Class.forName("com.google.android.exoplayer2.ext.opus.LibopusAudioRenderer").getConstructor(Handler.class, m0.k.class, m0.e[].class).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded LibopusAudioRenderer.");
} catch (ClassNotFoundException unused6) {
size2 = i11;
i11 = size2;
i12 = i11 + 1;
arrayList.add(i11, (f0) Class.forName("com.google.android.exoplayer2.ext.flac.LibflacAudioRenderer").getConstructor(Handler.class, m0.k.class, m0.e[].class).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded LibflacAudioRenderer.");
try {
Class<?> cls = Class.forName("com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer");
Class<?>[] clsArr = new Class[3];
clsArr[0] = Handler.class;
clsArr[1] = m0.k.class;
clsArr[2] = m0.e[].class;
arrayList.add(i12, (f0) cls.getConstructor(clsArr).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr22 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr22;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar22 = new o(f0VarArr22, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar22;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar22;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
} catch (Exception e12) {
throw new RuntimeException("Error instantiating FFmpeg extension", e12);
}
}
i12 = i11 + 1;
try {
arrayList.add(i11, (f0) Class.forName("com.google.android.exoplayer2.ext.flac.LibflacAudioRenderer").getConstructor(Handler.class, m0.k.class, m0.e[].class).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded LibflacAudioRenderer.");
} catch (ClassNotFoundException unused7) {
i11 = i12;
i12 = i11;
Class<?> cls2 = Class.forName("com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer");
Class<?>[] clsArr2 = new Class[3];
clsArr2[0] = Handler.class;
clsArr2[1] = m0.k.class;
clsArr2[2] = m0.e[].class;
arrayList.add(i12, (f0) cls2.getConstructor(clsArr2).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr222 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr222;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar222 = new o(f0VarArr222, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar222;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar222;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
try {
Class<?> cls22 = Class.forName("com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer");
Class<?>[] clsArr22 = new Class[3];
clsArr22[0] = Handler.class;
} catch (ClassNotFoundException unused8) {
}
try {
clsArr22[1] = m0.k.class;
clsArr22[2] = m0.e[].class;
arrayList.add(i12, (f0) cls22.getConstructor(clsArr22).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
} catch (ClassNotFoundException unused9) {
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr2222 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr2222;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar2222 = new o(f0VarArr2222, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar2222;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar2222;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
} catch (Exception e13) {
throw new RuntimeException("Error instantiating FLAC extension", e13);
}
} catch (Exception e14) {
throw new RuntimeException("Error instantiating Opus extension", e14);
}
}
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr22222 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr22222;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar22222 = new o(f0VarArr22222, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar22222;
if (aVar.f9659d == null && !aVar.f9658c.f9663a.isEmpty()) {
z11 = false;
} else {
z11 = true;
}
e2.a.e(z11);
aVar.f9659d = oVar22222;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
this.f9103n = new k0.a(context, this.f9094d, this.f9095e);
this.f9104o = new k0.b(context, this.f9094d, this.f9095e);
this.f9105p = new k0(context);
return;
}
com.google.android.exoplayer2.drm.b bVar2 = (com.google.android.exoplayer2.drm.b) aVar2;
throw null;
}
} else {
i10 = 0;
}
if (registerReceiver == null && registerReceiver.getIntExtra("android.media.extra.AUDIO_PLUG_STATE", i10) != 0) {
cVar2 = new m0.c(registerReceiver.getIntArrayExtra("android.media.extra.ENCODINGS"), registerReceiver.getIntExtra("android.media.extra.MAX_CHANNEL_COUNT", 8));
} else {
cVar2 = m0.c.f9869c;
}
arrayList.add(new m0.t(context2, aVar2, handler, bVar, new m0.r(cVar2, eVarArr22)));
if (i == 0) {
}
arrayList.add(new q1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new g2.b());
f0[] f0VarArr222222 = (f0[]) arrayList.toArray(new f0[0]);
this.f9092b = f0VarArr222222;
this.f9112x = 1.0f;
this.f9111w = 0;
this.f9114z = Collections.emptyList();
o oVar222222 = new o(f0VarArr222222, dVar, vVar, dVar2, cVar, looper);
this.f9093c = oVar222222;
if (aVar.f9659d == null) {
}
z11 = true;
e2.a.e(z11);
aVar.f9659d = oVar222222;
j(aVar);
j(this.f9095e);
this.f9099j.add(aVar);
this.f9096f.add(aVar);
this.f9100k.add(aVar);
this.f9097g.add(aVar);
this.i.add(aVar);
dVar2.e(this.f9094d, aVar);
if (!(aVar2 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
@Override
public final boolean A() {
S();
return this.f9093c.f9168o;
}
@Override
public final long B() {
S();
return this.f9093c.B();
}
@Override
public final z1.c C() {
S();
return this.f9093c.C();
}
@Override
public final int D(int i) {
S();
return this.f9093c.D(i);
}
@Override
@Nullable
public final d0.b E() {
return this;
}
public final void G(int i, int i10) {
if (i != this.f9109u || i10 != this.f9110v) {
this.f9109u = i;
this.f9110v = i10;
Iterator<f2.i> it2 = this.f9096f.iterator();
while (it2.hasNext()) {
it2.next().c(i, i10);
}
}
}
public final void H() {
String str;
S();
k0.a aVar = this.f9103n;
a.RunnableC0167a runnableC0167a = aVar.f9011b;
Context context = aVar.f9010a;
if (aVar.f9012c) {
context.unregisterReceiver(runnableC0167a);
aVar.f9012c = false;
}
this.f9104o.a();
this.f9105p.getClass();
o oVar = this.f9093c;
oVar.getClass();
StringBuilder sb2 = new StringBuilder("Release ");
sb2.append(Integer.toHexString(System.identityHashCode(oVar)));
sb2.append(" [ExoPlayerLib/2.11.3] [");
sb2.append(e2.d0.f6758e);
sb2.append("] [");
HashSet<String> hashSet = s.f9227a;
synchronized (s.class) {
str = s.f9228b;
}
sb2.append(str);
sb2.append("]");
Log.i("ExoPlayerImpl", sb2.toString());
oVar.f9160f.r();
oVar.f9159e.removeCallbacksAndMessages(null);
oVar.f9174v = oVar.H(false, false, false, 1);
I();
Surface surface = this.q;
if (surface != null) {
if (this.f9106r) {
surface.release();
}
this.q = null;
}
i1.m mVar = this.f9113y;
if (mVar != null) {
mVar.b(this.f9102m);
this.f9113y = null;
}
this.f9101l.a(this.f9102m);
this.f9114z = Collections.emptyList();
}
public final void I() {
TextureView textureView = this.f9108t;
b bVar = this.f9095e;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != bVar) {
Log.w("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
} else {
this.f9108t.setSurfaceTextureListener(null);
}
this.f9108t = null;
}
SurfaceHolder surfaceHolder = this.f9107s;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(bVar);
this.f9107s = null;
}
}
public final void J() {
f0[] f0VarArr;
float f10 = this.f9112x * this.f9104o.f9033e;
for (f0 f0Var : this.f9092b) {
if (f0Var.getTrackType() == 1) {
e0 G = this.f9093c.G(f0Var);
G.d(2);
G.c(Float.valueOf(f10));
G.b();
}
}
}
public final void K(@Nullable b0 b0Var) {
S();
o oVar = this.f9093c;
if (b0Var == null) {
oVar.getClass();
b0Var = b0.f9036e;
}
if (!oVar.f9172t.equals(b0Var)) {
oVar.f9171s++;
oVar.f9172t = b0Var;
oVar.f9160f.f9202g.a(4, b0Var).sendToTarget();
oVar.J(new androidx.core.view.a(b0Var));
}
}
public final void L(@Nullable f2.e eVar) {
f0[] f0VarArr;
for (f0 f0Var : this.f9092b) {
if (f0Var.getTrackType() == 2) {
e0 G = this.f9093c.G(f0Var);
G.d(8);
G.c(eVar);
G.b();
}
}
}
public final void M(@Nullable Surface surface) {
S();
I();
if (surface != null) {
S();
L(null);
}
int i = 0;
O(surface, false);
if (surface != null) {
i = -1;
}
G(i, i);
}
public final void N(@Nullable SurfaceHolder surfaceHolder) {
S();
I();
if (surfaceHolder != null) {
S();
L(null);
}
this.f9107s = surfaceHolder;
if (surfaceHolder == null) {
O(null, false);
G(0, 0);
return;
}
surfaceHolder.addCallback(this.f9095e);
Surface surface = surfaceHolder.getSurface();
if (surface != null && surface.isValid()) {
O(surface, false);
Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
G(surfaceFrame.width(), surfaceFrame.height());
return;
}
O(null, false);
G(0, 0);
}
public final void O(@Nullable Surface surface, boolean z10) {
f0[] f0VarArr;
boolean z11;
ArrayList arrayList = new ArrayList();
for (f0 f0Var : this.f9092b) {
if (f0Var.getTrackType() == 2) {
e0 G = this.f9093c.G(f0Var);
G.d(1);
G.c(surface);
G.b();
arrayList.add(G);
}
}
Surface surface2 = this.q;
if (surface2 != null && surface2 != surface) {
try {
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
e0 e0Var = (e0) it2.next();
synchronized (e0Var) {
e2.a.e(e0Var.f9065f);
if (e0Var.f9064e.getLooper().getThread() != Thread.currentThread()) {
z11 = true;
} else {
z11 = false;
}
e2.a.e(z11);
while (!e0Var.f9066g) {
e0Var.wait();
}
}
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
if (this.f9106r) {
this.q.release();
}
}
this.q = surface;
this.f9106r = z10;
}
public final void P(@Nullable TextureView textureView) {
SurfaceTexture surfaceTexture;
S();
I();
if (textureView != null) {
S();
L(null);
}
this.f9108t = textureView;
if (textureView == null) {
O(null, true);
G(0, 0);
return;
}
if (textureView.getSurfaceTextureListener() != null) {
Log.w("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.f9095e);
if (textureView.isAvailable()) {
surfaceTexture = textureView.getSurfaceTexture();
} else {
surfaceTexture = null;
}
if (surfaceTexture == null) {
O(null, true);
G(0, 0);
return;
}
O(new Surface(surfaceTexture), true);
G(textureView.getWidth(), textureView.getHeight());
}
public final void Q() {
S();
o oVar = this.f9093c;
a0 H = oVar.H(false, false, false, 1);
oVar.f9169p++;
oVar.f9160f.f9202g.f6848a.obtainMessage(6, 0, 0).sendToTarget();
oVar.M(H, false, 4, 1, false);
i1.m mVar = this.f9113y;
if (mVar != null) {
l0.a aVar = this.f9102m;
mVar.b(aVar);
aVar.i();
}
this.f9104o.a();
this.f9114z = Collections.emptyList();
}
public final void R(int i, boolean z10) {
boolean z11;
int i10 = 0;
if (z10 && i != -1) {
z11 = true;
} else {
z11 = false;
}
if (z11 && i != 1) {
i10 = 1;
}
this.f9093c.K(i10, z11);
}
public final void S() {
IllegalStateException illegalStateException;
if (Looper.myLooper() != z()) {
if (this.C) {
illegalStateException = null;
} else {
illegalStateException = new IllegalStateException();
}
Log.w("SimpleExoPlayer", "Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread", illegalStateException);
this.C = true;
}
}
@Override
public final boolean a() {
S();
return this.f9093c.a();
}
@Override
public final long b() {
S();
return this.f9093c.b();
}
@Override
public final b0 c() {
S();
return this.f9093c.f9172t;
}
@Override
public final void d(int i, long j10) {
S();
l0.a aVar = this.f9102m;
a.b bVar = aVar.f9658c;
if (!bVar.f9670h) {
b.a g10 = aVar.g();
bVar.f9670h = true;
Iterator<l0.b> it2 = aVar.f9656a.iterator();
while (it2.hasNext()) {
it2.next().onSeekStarted(g10);
}
}
this.f9093c.d(i, j10);
}
@Override
public final boolean e() {
S();
return this.f9093c.f9165l;
}
@Override
public final void f(boolean z10) {
S();
this.f9093c.f(z10);
}
@Override
@Nullable
public final j g() {
S();
return this.f9093c.f9174v.f9022f;
}
@Override
public final long getCurrentPosition() {
S();
return this.f9093c.getCurrentPosition();
}
@Override
public final long getDuration() {
S();
return this.f9093c.getDuration();
}
@Override
public final int i() {
S();
return this.f9093c.i();
}
@Override
public final void j(d0.a aVar) {
S();
this.f9093c.j(aVar);
}
@Override
public final int k() {
S();
return this.f9093c.k();
}
@Override
public final void l(d0.a aVar) {
S();
this.f9093c.l(aVar);
}
@Override
public final void m(boolean z10) {
int i;
S();
int r10 = r();
k0.b bVar = this.f9104o;
bVar.getClass();
if (!z10) {
bVar.a();
} else {
i = 1;
if (r10 != 1) {
bVar.b();
}
R(i, z10);
}
i = -1;
R(i, z10);
}
@Override
@Nullable
public final d0.c n() {
return this;
}
@Override
public final long o() {
S();
return this.f9093c.o();
}
@Override
public final long q() {
S();
return this.f9093c.q();
}
@Override
public final int r() {
S();
return this.f9093c.f9174v.f9021e;
}
@Override
public final int s() {
S();
return this.f9093c.s();
}
@Override
public final void t(int i) {
S();
this.f9093c.t(i);
}
@Override
public final int v() {
S();
return this.f9093c.f9166m;
}
@Override
public final TrackGroupArray w() {
S();
return this.f9093c.f9174v.f9024h;
}
@Override
public final int x() {
S();
return this.f9093c.f9167n;
}
@Override
public final j0 y() {
S();
return this.f9093c.f9174v.f9017a;
}
@Override
public final Looper z() {
return this.f9093c.z();
}
}