밤친구 v4.7.3版本的 MD5 值为:a58175795b36d9d722726efa7eb4c52a
以下内容为反编译后的 k0.java 源代码,内容仅作参考
package l0;
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 com.google.android.exoplayer2.Format;
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 d2.o;
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 l0.a;
import l0.c;
import l0.f0;
import m0.a;
import m0.b;
public final class k0 extends d implements f0.c, f0.b {
@Nullable
public g2.g A;
@Nullable
public h2.a B;
public boolean C;
public final h0[] f12009b;
public final q f12010c;
public final Handler f12011d;
public final b f12012e;
public final CopyOnWriteArraySet<g2.i> f12013f;
public final CopyOnWriteArraySet<n0.d> f12014g;
public final CopyOnWriteArraySet<r1.k> f12015h;
public final CopyOnWriteArraySet<c1.d> i;
public final CopyOnWriteArraySet<g2.m> f12016j;
public final CopyOnWriteArraySet<n0.j> f12017k;
public final d2.d f12018l;
public final m0.a f12019m;
public final l0.a f12020n;
public final c f12021o;
public final m0 f12022p;
@Nullable
public Surface q;
public boolean f12023r;
@Nullable
public SurfaceHolder f12024s;
@Nullable
public TextureView f12025t;
public int f12026u;
public int f12027v;
public int f12028w;
public float f12029x;
@Nullable
public j1.m f12030y;
public List<r1.b> f12031z;
public static final class a {
public final Context f12032a;
public final j f12033b;
public final f2.c f12034c;
public a2.d f12035d;
public x f12036e;
public final d2.d f12037f;
public final m0.a f12038g;
public Looper f12039h;
public boolean i;
public a(Context context, j jVar) {
d2.o oVar;
a.c cVar = new a.c();
DefaultTrackSelector.Parameters parameters = DefaultTrackSelector.Parameters.F;
DefaultTrackSelector defaultTrackSelector = new DefaultTrackSelector(new DefaultTrackSelector.c(context).a(), cVar);
h hVar = new h();
Map<String, int[]> map = d2.o.f8770n;
synchronized (d2.o.class) {
if (d2.o.f8774s == null) {
d2.o.f8774s = new o.a(context).a();
}
oVar = d2.o.f8774s;
}
Looper myLooper = Looper.myLooper();
myLooper = myLooper == null ? Looper.getMainLooper() : myLooper;
f2.x xVar = f2.c.f9484a;
m0.a aVar = new m0.a();
this.f12032a = context;
this.f12033b = jVar;
this.f12035d = defaultTrackSelector;
this.f12036e = hVar;
this.f12037f = oVar;
this.f12039h = myLooper;
this.f12038g = aVar;
this.f12034c = xVar;
}
}
public final class b implements g2.m, n0.j, r1.k, c1.d, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, c.b, a.b, f0.a {
public b() {
}
@Override
public final void onAudioDecoderInitialized(String str, long j10, long j11) {
Iterator<n0.j> it2 = k0.this.f12017k.iterator();
while (it2.hasNext()) {
it2.next().onAudioDecoderInitialized(str, j10, j11);
}
}
@Override
public final void onAudioDisabled(o0.d dVar) {
k0 k0Var = k0.this;
Iterator<n0.j> it2 = k0Var.f12017k.iterator();
while (it2.hasNext()) {
it2.next().onAudioDisabled(dVar);
}
k0Var.f12028w = 0;
}
@Override
public final void onAudioEnabled(o0.d dVar) {
k0 k0Var = k0.this;
k0Var.getClass();
Iterator<n0.j> it2 = k0Var.f12017k.iterator();
while (it2.hasNext()) {
it2.next().onAudioEnabled(dVar);
}
}
@Override
public final void onAudioInputFormatChanged(Format format) {
k0 k0Var = k0.this;
k0Var.getClass();
Iterator<n0.j> it2 = k0Var.f12017k.iterator();
while (it2.hasNext()) {
it2.next().onAudioInputFormatChanged(format);
}
}
@Override
public final void onAudioSessionId(int i) {
CopyOnWriteArraySet<n0.j> copyOnWriteArraySet;
k0 k0Var = k0.this;
if (k0Var.f12028w == i) {
return;
}
k0Var.f12028w = i;
Iterator<n0.d> it2 = k0Var.f12014g.iterator();
while (true) {
boolean hasNext = it2.hasNext();
copyOnWriteArraySet = k0Var.f12017k;
if (!hasNext) {
break;
}
n0.d next = it2.next();
if (!copyOnWriteArraySet.contains(next)) {
next.onAudioSessionId(i);
}
}
Iterator<n0.j> it3 = copyOnWriteArraySet.iterator();
while (it3.hasNext()) {
it3.next().onAudioSessionId(i);
}
}
@Override
public final void onAudioSinkUnderrun(int i, long j10, long j11) {
Iterator<n0.j> it2 = k0.this.f12017k.iterator();
while (it2.hasNext()) {
it2.next().onAudioSinkUnderrun(i, j10, j11);
}
}
@Override
public final void onCues(List<r1.b> list) {
k0 k0Var = k0.this;
k0Var.f12031z = list;
Iterator<r1.k> it2 = k0Var.f12015h.iterator();
while (it2.hasNext()) {
it2.next().onCues(list);
}
}
@Override
public final void onDroppedFrames(int i, long j10) {
Iterator<g2.m> it2 = k0.this.f12016j.iterator();
while (it2.hasNext()) {
it2.next().onDroppedFrames(i, j10);
}
}
@Override
public final void onLoadingChanged(boolean z10) {
k0.this.getClass();
}
@Override
public final void onMetadata(Metadata metadata) {
Iterator<c1.d> it2 = k0.this.i.iterator();
while (it2.hasNext()) {
it2.next().onMetadata(metadata);
}
}
@Override
public final void onPlayerStateChanged(boolean z10, int i) {
k0 k0Var = k0.this;
if (i != 1) {
if (i != 2 && i != 3) {
if (i != 4) {
return;
}
} else {
k0Var.f12022p.getClass();
return;
}
}
k0Var.f12022p.getClass();
}
@Override
public final void onRenderedFirstFrame(Surface surface) {
k0 k0Var = k0.this;
if (k0Var.q == surface) {
Iterator<g2.i> it2 = k0Var.f12013f.iterator();
while (it2.hasNext()) {
it2.next().b();
}
}
Iterator<g2.m> it3 = k0Var.f12016j.iterator();
while (it3.hasNext()) {
it3.next().onRenderedFirstFrame(surface);
}
}
@Override
public final void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
Surface surface = new Surface(surfaceTexture);
k0 k0Var = k0.this;
k0Var.O(surface, true);
k0Var.G(i, i2);
}
@Override
public final boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
k0 k0Var = k0.this;
k0Var.O(null, true);
k0Var.G(0, 0);
return true;
}
@Override
public final void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
k0.this.G(i, i2);
}
@Override
public final void onTimelineChanged(l0 l0Var, int i) {
a9.f.a(this, l0Var, i);
}
@Override
public final void onVideoDecoderInitialized(String str, long j10, long j11) {
Iterator<g2.m> it2 = k0.this.f12016j.iterator();
while (it2.hasNext()) {
it2.next().onVideoDecoderInitialized(str, j10, j11);
}
}
@Override
public final void onVideoDisabled(o0.d dVar) {
Iterator<g2.m> it2 = k0.this.f12016j.iterator();
while (it2.hasNext()) {
it2.next().onVideoDisabled(dVar);
}
}
@Override
public final void onVideoEnabled(o0.d dVar) {
k0 k0Var = k0.this;
k0Var.getClass();
Iterator<g2.m> it2 = k0Var.f12016j.iterator();
while (it2.hasNext()) {
it2.next().onVideoEnabled(dVar);
}
}
@Override
public final void onVideoInputFormatChanged(Format format) {
k0 k0Var = k0.this;
k0Var.getClass();
Iterator<g2.m> it2 = k0Var.f12016j.iterator();
while (it2.hasNext()) {
it2.next().onVideoInputFormatChanged(format);
}
}
@Override
public final void onVideoSizeChanged(int i, int i2, int i10, float f10) {
CopyOnWriteArraySet<g2.m> copyOnWriteArraySet;
k0 k0Var = k0.this;
Iterator<g2.i> it2 = k0Var.f12013f.iterator();
while (true) {
boolean hasNext = it2.hasNext();
copyOnWriteArraySet = k0Var.f12016j;
if (!hasNext) {
break;
}
g2.i next = it2.next();
if (!copyOnWriteArraySet.contains(next)) {
next.onVideoSizeChanged(i, i2, i10, f10);
}
}
Iterator<g2.m> it3 = copyOnWriteArraySet.iterator();
while (it3.hasNext()) {
it3.next().onVideoSizeChanged(i, i2, i10, f10);
}
}
@Override
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i10) {
k0.this.G(i2, i10);
}
@Override
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
k0.this.O(surfaceHolder.getSurface(), false);
}
@Override
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
k0 k0Var = k0.this;
k0Var.O(null, false);
k0Var.G(0, 0);
}
@Override
public final void onTimelineChanged(l0 l0Var, Object obj, int i) {
}
@Override
public final void onIsPlayingChanged(boolean z10) {
}
@Override
public final void onPlaybackParametersChanged(d0 d0Var) {
}
@Override
public final void onPlaybackSuppressionReasonChanged(int i) {
}
@Override
public final void onPlayerError(k kVar) {
}
@Override
public final void onPositionDiscontinuity(int i) {
}
@Override
public final void onRepeatModeChanged(int i) {
}
@Override
public final void onSeekProcessed() {
}
@Override
public final void onShuffleModeEnabledChanged(boolean z10) {
}
@Override
public final void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public final void onTracksChanged(TrackGroupArray trackGroupArray, a2.c cVar) {
}
}
public k0(Context context, j jVar, a2.d dVar, x xVar, d2.d dVar2, m0.a aVar, f2.c cVar, Looper looper) {
int i;
Intent registerReceiver;
boolean z10;
int i2;
n0.c cVar2;
int i10;
int i11;
boolean z11;
int i12;
com.google.android.exoplayer2.drm.d dVar3 = com.google.android.exoplayer2.drm.d.f3996a;
this.f12018l = dVar2;
this.f12019m = aVar;
b bVar = new b();
this.f12012e = bVar;
this.f12013f = new CopyOnWriteArraySet<>();
this.f12014g = new CopyOnWriteArraySet<>();
this.f12015h = new CopyOnWriteArraySet<>();
this.i = new CopyOnWriteArraySet<>();
this.f12016j = new CopyOnWriteArraySet<>();
this.f12017k = new CopyOnWriteArraySet<>();
Handler handler = new Handler(looper);
this.f12011d = handler;
jVar.getClass();
ArrayList arrayList = new ArrayList();
int i13 = jVar.f12000b;
Context context2 = jVar.f11999a;
arrayList.add(new g2.d(context2, dVar3, handler, bVar));
if (i13 != 0) {
int size = arrayList.size();
int i14 = i13 == 2 ? size - 1 : size;
try {
try {
i12 = i14 + 1;
try {
arrayList.add(i14, (h0) Class.forName("com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer").getConstructor(Long.TYPE, Handler.class, g2.m.class, Integer.TYPE).newInstance(5000L, handler, bVar, 50));
Log.i("DefaultRenderersFactory", "Loaded LibvpxVideoRenderer.");
} catch (ClassNotFoundException unused) {
i14 = i12;
i12 = i14;
try {
Constructor<?> constructor = Class.forName("com.google.android.exoplayer2.ext.av1.Libgav1VideoRenderer").getConstructor(Long.TYPE, Handler.class, g2.m.class, Integer.TYPE);
Object[] objArr = new Object[4];
objArr[0] = 5000L;
objArr[1] = handler;
try {
objArr[2] = bVar;
objArr[3] = 50;
arrayList.add(i12, (h0) constructor.newInstance(objArr));
Log.i("DefaultRenderersFactory", "Loaded Libgav1VideoRenderer.");
} catch (ClassNotFoundException unused2) {
i = jVar.f12000b;
n0.e[] eVarArr = new n0.e[0];
n0.c cVar3 = n0.c.f12915c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (f2.d0.f9489a < 17) {
}
z10 = false;
if (z10) {
}
if (registerReceiver == null) {
}
cVar2 = n0.c.f12915c;
arrayList.add(new n0.s(context2, dVar3, handler, bVar, new n0.q(cVar2, eVarArr)));
if (i == 0) {
}
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar = new q(h0VarArr, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
i = jVar.f12000b;
n0.e[] eVarArr2 = new n0.e[0];
n0.c cVar32 = n0.c.f12915c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (f2.d0.f9489a < 17) {
}
z10 = false;
if (z10) {
}
if (registerReceiver == null) {
}
cVar2 = n0.c.f12915c;
arrayList.add(new n0.s(context2, dVar3, handler, bVar, new n0.q(cVar2, eVarArr2)));
if (i == 0) {
}
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr2 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr2;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar2 = new q(h0VarArr2, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar2;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar2;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 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, g2.m.class, Integer.TYPE);
Object[] objArr2 = new Object[4];
objArr2[0] = 5000L;
objArr2[1] = handler;
objArr2[2] = bVar;
objArr2[3] = 50;
arrayList.add(i12, (h0) constructor2.newInstance(objArr2));
Log.i("DefaultRenderersFactory", "Loaded Libgav1VideoRenderer.");
} catch (ClassNotFoundException unused4) {
}
}
i = jVar.f12000b;
n0.e[] eVarArr22 = new n0.e[0];
n0.c cVar322 = n0.c.f12915c;
registerReceiver = context2.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG"));
if (f2.d0.f9489a < 17 && "Amazon".equals(f2.d0.f9491c)) {
z10 = true;
} else {
z10 = false;
}
if (z10) {
i2 = 0;
if (Settings.Global.getInt(context2.getContentResolver(), "external_surround_sound_enabled", 0) == 1) {
cVar2 = n0.c.f12916d;
arrayList.add(new n0.s(context2, dVar3, handler, bVar, new n0.q(cVar2, eVarArr22)));
if (i == 0) {
int size2 = arrayList.size();
size2 = i == 2 ? size2 - 1 : size2;
try {
try {
i10 = size2 + 1;
} catch (ClassNotFoundException unused5) {
}
try {
try {
arrayList.add(size2, (h0) Class.forName("com.google.android.exoplayer2.ext.opus.LibopusAudioRenderer").getConstructor(Handler.class, n0.j.class, n0.e[].class).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded LibopusAudioRenderer.");
} catch (ClassNotFoundException unused6) {
size2 = i10;
i10 = size2;
i11 = i10 + 1;
arrayList.add(i10, (h0) Class.forName("com.google.android.exoplayer2.ext.flac.LibflacAudioRenderer").getConstructor(Handler.class, n0.j.class, n0.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] = n0.j.class;
clsArr[2] = n0.e[].class;
arrayList.add(i11, (h0) cls.getConstructor(clsArr).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr22 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr22;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar22 = new q(h0VarArr22, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar22;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar22;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 instanceof com.google.android.exoplayer2.drm.b)) {
}
} catch (Exception e12) {
throw new RuntimeException("Error instantiating FFmpeg extension", e12);
}
}
i11 = i10 + 1;
try {
arrayList.add(i10, (h0) Class.forName("com.google.android.exoplayer2.ext.flac.LibflacAudioRenderer").getConstructor(Handler.class, n0.j.class, n0.e[].class).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded LibflacAudioRenderer.");
} catch (ClassNotFoundException unused7) {
i10 = i11;
i11 = i10;
Class<?> cls2 = Class.forName("com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer");
Class<?>[] clsArr2 = new Class[3];
clsArr2[0] = Handler.class;
clsArr2[1] = n0.j.class;
clsArr2[2] = n0.e[].class;
arrayList.add(i11, (h0) cls2.getConstructor(clsArr2).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr222 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr222;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar222 = new q(h0VarArr222, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar222;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar222;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 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] = n0.j.class;
clsArr22[2] = n0.e[].class;
arrayList.add(i11, (h0) cls22.getConstructor(clsArr22).newInstance(handler, bVar, eVarArr22));
Log.i("DefaultRenderersFactory", "Loaded FfmpegAudioRenderer.");
} catch (ClassNotFoundException unused9) {
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr2222 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr2222;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar2222 = new q(h0VarArr2222, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar2222;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar2222;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 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 r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr22222 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr22222;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar22222 = new q(h0VarArr22222, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar22222;
if (aVar.f12641d == null && !aVar.f12640c.f12645a.isEmpty()) {
z11 = false;
} else {
z11 = true;
}
f2.a.e(z11);
aVar.f12641d = qVar22222;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 instanceof com.google.android.exoplayer2.drm.b)) {
this.f12020n = new l0.a(context, this.f12011d, this.f12012e);
this.f12021o = new c(context, this.f12011d, this.f12012e);
this.f12022p = new m0(context);
return;
}
throw null;
}
} else {
i2 = 0;
}
if (registerReceiver == null && registerReceiver.getIntExtra("android.media.extra.AUDIO_PLUG_STATE", i2) != 0) {
cVar2 = new n0.c(registerReceiver.getIntArrayExtra("android.media.extra.ENCODINGS"), registerReceiver.getIntExtra("android.media.extra.MAX_CHANNEL_COUNT", 8));
} else {
cVar2 = n0.c.f12915c;
}
arrayList.add(new n0.s(context2, dVar3, handler, bVar, new n0.q(cVar2, eVarArr22)));
if (i == 0) {
}
arrayList.add(new r1.l(bVar, handler.getLooper()));
arrayList.add(new com.google.android.exoplayer2.metadata.a(bVar, handler.getLooper()));
arrayList.add(new h2.b());
h0[] h0VarArr222222 = (h0[]) arrayList.toArray(new h0[0]);
this.f12009b = h0VarArr222222;
this.f12029x = 1.0f;
this.f12028w = 0;
this.f12031z = Collections.emptyList();
q qVar222222 = new q(h0VarArr222222, dVar, xVar, dVar2, cVar, looper);
this.f12010c = qVar222222;
if (aVar.f12641d == null) {
}
z11 = true;
f2.a.e(z11);
aVar.f12641d = qVar222222;
p(aVar);
p(this.f12012e);
this.f12016j.add(aVar);
this.f12013f.add(aVar);
this.f12017k.add(aVar);
this.f12014g.add(aVar);
this.i.add(aVar);
dVar2.d(this.f12011d, aVar);
if (!(dVar3 instanceof com.google.android.exoplayer2.drm.b)) {
}
}
@Override
public final long A() {
S();
return this.f12010c.A();
}
@Override
public final a2.c B() {
S();
return this.f12010c.B();
}
@Override
public final void C(f0.a aVar) {
S();
this.f12010c.C(aVar);
}
@Override
public final int D(int i) {
S();
return this.f12010c.D(i);
}
public final void G(int i, int i2) {
if (i != this.f12026u || i2 != this.f12027v) {
this.f12026u = i;
this.f12027v = i2;
Iterator<g2.i> it2 = this.f12013f.iterator();
while (it2.hasNext()) {
it2.next().c(i, i2);
}
}
}
public final void H() {
String str;
S();
l0.a aVar = this.f12020n;
a.RunnableC0175a runnableC0175a = aVar.f11911b;
Context context = aVar.f11910a;
if (aVar.f11912c) {
context.unregisterReceiver(runnableC0175a);
aVar.f11912c = false;
}
this.f12021o.a();
this.f12022p.getClass();
q qVar = this.f12010c;
qVar.getClass();
StringBuilder sb2 = new StringBuilder("Release ");
sb2.append(Integer.toHexString(System.identityHashCode(qVar)));
sb2.append(" [ExoPlayerLib/2.11.3] [");
sb2.append(f2.d0.f9493e);
sb2.append("] [");
HashSet<String> hashSet = u.f12143a;
synchronized (u.class) {
str = u.f12144b;
}
sb2.append(str);
sb2.append("]");
Log.i("ExoPlayerImpl", sb2.toString());
qVar.f12076f.r();
qVar.f12075e.removeCallbacksAndMessages(null);
qVar.f12090v = qVar.H(false, false, false, 1);
I();
Surface surface = this.q;
if (surface != null) {
if (this.f12023r) {
surface.release();
}
this.q = null;
}
j1.m mVar = this.f12030y;
if (mVar != null) {
mVar.j(this.f12019m);
this.f12030y = null;
}
this.f12018l.c(this.f12019m);
this.f12031z = Collections.emptyList();
}
public final void I() {
TextureView textureView = this.f12025t;
b bVar = this.f12012e;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != bVar) {
Log.w("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
} else {
this.f12025t.setSurfaceTextureListener(null);
}
this.f12025t = null;
}
SurfaceHolder surfaceHolder = this.f12024s;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(bVar);
this.f12024s = null;
}
}
public final void J() {
float f10 = this.f12029x * this.f12021o.f11933e;
for (h0 h0Var : this.f12009b) {
if (h0Var.getTrackType() == 1) {
g0 G = this.f12010c.G(h0Var);
G.d(2);
G.c(Float.valueOf(f10));
G.b();
}
}
}
public final void K(@Nullable d0 d0Var) {
S();
q qVar = this.f12010c;
if (d0Var == null) {
qVar.getClass();
d0Var = d0.f11952e;
}
if (!qVar.f12088t.equals(d0Var)) {
qVar.f12087s++;
qVar.f12088t = d0Var;
qVar.f12076f.f12118g.a(4, d0Var).sendToTarget();
qVar.J(new h3.i(d0Var));
}
}
public final void L(@Nullable g2.e eVar) {
for (h0 h0Var : this.f12009b) {
if (h0Var.getTrackType() == 2) {
g0 G = this.f12010c.G(h0Var);
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.f12024s = surfaceHolder;
if (surfaceHolder == null) {
O(null, false);
G(0, 0);
return;
}
surfaceHolder.addCallback(this.f12012e);
Surface surface = surfaceHolder.getSurface();
if (surface != null && surface.isValid()) {
O(surface, false);
Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
G(surfaceFrame.width(), surfaceFrame.height());
} else {
O(null, false);
G(0, 0);
}
}
public final void O(@Nullable Surface surface, boolean z10) {
boolean z11;
ArrayList arrayList = new ArrayList();
for (h0 h0Var : this.f12009b) {
if (h0Var.getTrackType() == 2) {
g0 G = this.f12010c.G(h0Var);
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()) {
g0 g0Var = (g0) it2.next();
synchronized (g0Var) {
f2.a.e(g0Var.f11978f);
if (g0Var.f11977e.getLooper().getThread() != Thread.currentThread()) {
z11 = true;
} else {
z11 = false;
}
f2.a.e(z11);
while (!g0Var.f11979g) {
g0Var.wait();
}
}
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
if (this.f12023r) {
this.q.release();
}
}
this.q = surface;
this.f12023r = z10;
}
public final void P(@Nullable TextureView textureView) {
SurfaceTexture surfaceTexture;
S();
I();
if (textureView != null) {
S();
L(null);
}
this.f12025t = textureView;
if (textureView == null) {
O(null, true);
G(0, 0);
return;
}
if (textureView.getSurfaceTextureListener() != null) {
Log.w("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.f12012e);
if (textureView.isAvailable()) {
surfaceTexture = textureView.getSurfaceTexture();
} else {
surfaceTexture = null;
}
if (surfaceTexture == null) {
O(null, true);
G(0, 0);
} else {
O(new Surface(surfaceTexture), true);
G(textureView.getWidth(), textureView.getHeight());
}
}
public final void Q() {
S();
q qVar = this.f12010c;
c0 H = qVar.H(false, false, false, 1);
qVar.f12085p++;
qVar.f12076f.f12118g.f9582a.obtainMessage(6, 0, 0).sendToTarget();
qVar.M(H, false, 4, 1, false);
j1.m mVar = this.f12030y;
if (mVar != null) {
m0.a aVar = this.f12019m;
mVar.j(aVar);
aVar.i();
}
this.f12021o.a();
this.f12031z = Collections.emptyList();
}
public final void R(int i, boolean z10) {
boolean z11;
int i2 = 0;
if (z10 && i != -1) {
z11 = true;
} else {
z11 = false;
}
if (z11 && i != 1) {
i2 = 1;
}
this.f12010c.K(i2, z11);
}
public final void S() {
IllegalStateException illegalStateException;
if (Looper.myLooper() != y()) {
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.f12010c.a();
}
@Override
public final long b() {
S();
return this.f12010c.b();
}
@Override
public final d0 c() {
S();
return this.f12010c.f12088t;
}
@Override
public final void d(int i, long j10) {
S();
m0.a aVar = this.f12019m;
a.b bVar = aVar.f12640c;
if (!bVar.f12652h) {
b.a g10 = aVar.g();
bVar.f12652h = true;
Iterator<m0.b> it2 = aVar.f12638a.iterator();
while (it2.hasNext()) {
it2.next().onSeekStarted(g10);
}
}
this.f12010c.d(i, j10);
}
@Override
public final boolean e() {
S();
return this.f12010c.f12081l;
}
@Override
public final void f(boolean z10) {
S();
this.f12010c.f(z10);
}
@Override
@Nullable
public final k g() {
S();
return this.f12010c.f12090v.f11942f;
}
@Override
public final long getCurrentPosition() {
S();
return this.f12010c.getCurrentPosition();
}
@Override
public final long getDuration() {
S();
return this.f12010c.getDuration();
}
@Override
public final int i() {
S();
return this.f12010c.i();
}
@Override
public final int j() {
S();
return this.f12010c.j();
}
@Override
public final void k(boolean z10) {
int i;
S();
int q = q();
c cVar = this.f12021o;
cVar.getClass();
if (!z10) {
cVar.a();
} else {
i = 1;
if (q != 1) {
cVar.b();
}
R(i, z10);
}
i = -1;
R(i, z10);
}
@Override
public final long m() {
S();
return this.f12010c.m();
}
@Override
public final long o() {
S();
return this.f12010c.o();
}
@Override
public final void p(f0.a aVar) {
S();
this.f12010c.p(aVar);
}
@Override
public final int q() {
S();
return this.f12010c.f12090v.f11941e;
}
@Override
public final int r() {
S();
return this.f12010c.r();
}
@Override
public final void s(int i) {
S();
this.f12010c.s(i);
}
@Override
public final int u() {
S();
return this.f12010c.f12082m;
}
@Override
public final TrackGroupArray v() {
S();
return this.f12010c.f12090v.f11944h;
}
@Override
public final int w() {
S();
return this.f12010c.f12083n;
}
@Override
public final l0 x() {
S();
return this.f12010c.f12090v.f11937a;
}
@Override
public final Looper y() {
return this.f12010c.y();
}
@Override
public final boolean z() {
S();
return this.f12010c.f12084o;
}
@Override
@Nullable
public final f0.b E() {
return this;
}
@Override
@Nullable
public final f0.c l() {
return this;
}
}