2021-07-24 02:37:17 +00:00
package c.i.a.c ;
import android.content.Context ;
import android.content.Intent ;
import android.content.IntentFilter ;
import android.graphics.Rect ;
import android.graphics.SurfaceTexture ;
import android.media.AudioManager ;
import android.media.AudioTrack ;
import android.os.Handler ;
import android.os.Looper ;
import android.provider.Settings ;
import android.telephony.TelephonyManager ;
import android.text.TextUtils ;
import android.util.Log ;
import android.view.Surface ;
import android.view.SurfaceHolder ;
import android.view.SurfaceView ;
import android.view.TextureView ;
import androidx.annotation.Nullable ;
import c.i.a.c.a2.f ;
import c.i.a.c.c2.e ;
import c.i.a.c.d0 ;
import c.i.a.c.d2.a0 ;
import c.i.a.c.e0 ;
import c.i.a.c.e2.k ;
import c.i.a.c.f2.l ;
import c.i.a.c.g1 ;
import c.i.a.c.h2.d ;
import c.i.a.c.h2.m ;
import c.i.a.c.i2.f0 ;
import c.i.a.c.i2.g ;
import c.i.a.c.i2.o ;
import c.i.a.c.j2.r ;
import c.i.a.c.j2.s ;
import c.i.a.c.j2.v ;
import c.i.a.c.j2.w ;
import c.i.a.c.q1 ;
import c.i.a.c.u1.c1 ;
import c.i.a.c.u1.d1 ;
import c.i.a.c.u1.w0 ;
import c.i.a.c.v1.n ;
import c.i.a.c.v1.p ;
import c.i.a.c.v1.q ;
import c.i.a.c.v1.y ;
import c.i.b.b.q0 ;
import c.i.b.b.u ;
import com.airbnb.lottie.parser.AnimatableValueParser ;
import com.google.android.exoplayer2.ExoPlaybackException ;
import com.google.android.exoplayer2.ExoTimeoutException ;
import com.google.android.exoplayer2.Format ;
import com.google.android.exoplayer2.audio.AudioProcessor ;
import com.google.android.exoplayer2.audio.DefaultAudioSink ;
import com.google.android.exoplayer2.metadata.Metadata ;
import com.google.android.exoplayer2.source.TrackGroupArray ;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.HashMap ;
import java.util.Iterator ;
import java.util.List ;
import java.util.Locale ;
import java.util.Objects ;
import java.util.UUID ;
import java.util.concurrent.CopyOnWriteArraySet ;
import java.util.concurrent.TimeoutException ;
/* compiled from: SimpleExoPlayer */
public class p1 extends f0 implements g1 , g1 . d , g1 . c {
public n A ;
public float B ;
public boolean C = false ;
public List < c . i . a . c . e2 . c > D ;
@Nullable
public s E ;
@Nullable
public c . i . a . c . j2 . x . a F ;
public boolean G ;
public boolean H ;
public boolean I ;
public c . i . a . c . y1 . a J ;
public final k1 [ ] b ;
/* renamed from: c reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public final Context f937c ;
2021-07-24 02:37:17 +00:00
public final o0 d ;
public final c e ;
public final CopyOnWriteArraySet < v > f ;
public final CopyOnWriteArraySet < p > g ;
public final CopyOnWriteArraySet < k > h ;
public final CopyOnWriteArraySet < e > i ;
public final CopyOnWriteArraySet < c . i . a . c . y1 . b > j ;
public final c1 k ;
public final d0 l ;
public final e0 m ;
public final q1 n ;
public final s1 o ;
public final t1 p ;
public final long q ;
@Nullable
public AudioTrack r ;
@Nullable
/* renamed from: s reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public Surface f938s ;
2021-07-24 02:37:17 +00:00
public boolean t ;
public int u ;
@Nullable
public SurfaceHolder v ;
@Nullable
public TextureView w ;
/* renamed from: x reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public int f939x ;
2021-07-24 02:37:17 +00:00
/* renamed from: y reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public int f940y ;
2021-07-24 02:37:17 +00:00
/* renamed from: z reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public int f941z ;
2021-07-24 02:37:17 +00:00
/* compiled from: SimpleExoPlayer */
public static final class b {
public final Context a ;
public final n1 b ;
/* renamed from: c reason: collision with root package name */
2021-07-28 07:39:21 +00:00
public g f942c ;
2021-07-24 02:37:17 +00:00
public l d ;
public a0 e ;
public u0 f ;
public d g ;
public c1 h ;
public Looper i ;
public n j ;
public int k ;
public boolean l ;
public o1 m ;
public t0 n ;
public long o ;
public long p ;
public boolean q ;
/* JADX WARNING: Removed duplicated region for block: B:23:0x008c */
/* JADX WARNING: Removed duplicated region for block: B:26:0x0097 */
public b ( Context context ) {
c . i . a . c . h2 . n nVar ;
String str ;
u < Object > uVar ;
TelephonyManager telephonyManager ;
n0 n0Var = new n0 ( context ) ;
f fVar = new f ( ) ;
DefaultTrackSelector defaultTrackSelector = new DefaultTrackSelector ( context ) ;
c . i . a . c . d2 . n nVar2 = new c . i . a . c . d2 . n ( context , fVar ) ;
l0 l0Var = new l0 ( new m ( true , 65536 ) , 50000 , 50000 , 2500 , 5000 , - 1 , false , 0 , false ) ;
c . i . b . b . v < String , Integer > vVar = c . i . a . c . h2 . n . a ;
synchronized ( c . i . a . c . h2 . n . class ) {
if ( c . i . a . c . h2 . n . g = = null ) {
Context applicationContext = context = = null ? null : context . getApplicationContext ( ) ;
int i = f0 . a ;
if ( ! ( context = = null | | ( telephonyManager = ( TelephonyManager ) context . getSystemService ( " phone " ) ) = = null ) ) {
str = telephonyManager . getNetworkCountryIso ( ) ;
if ( ! TextUtils . isEmpty ( str ) ) {
if ( str ! = null ) {
str = str . toUpperCase ( Locale . US ) ;
}
uVar = ( u ) c . i . a . c . h2 . n . a . l . get ( str ) ;
if ( uVar = = null ) {
c . i . b . b . a < Object > aVar = u . j ;
uVar = q0 . k ;
}
uVar = uVar . isEmpty ( ) ? u . u ( 2 , 2 , 2 , 2 , 2 ) : uVar ;
HashMap hashMap = new HashMap ( 6 ) ;
hashMap . put ( 0 , 1000000L ) ;
u < Long > uVar2 = c . i . a . c . h2 . n . b ;
hashMap . put ( 2 , uVar2 . get ( ( ( Integer ) uVar . get ( 0 ) ) . intValue ( ) ) ) ;
2021-07-28 07:39:21 +00:00
hashMap . put ( 3 , c . i . a . c . h2 . n . f885c . get ( ( ( Integer ) uVar . get ( 1 ) ) . intValue ( ) ) ) ;
2021-07-24 02:37:17 +00:00
hashMap . put ( 4 , c . i . a . c . h2 . n . d . get ( ( ( Integer ) uVar . get ( 2 ) ) . intValue ( ) ) ) ;
hashMap . put ( 5 , c . i . a . c . h2 . n . e . get ( ( ( Integer ) uVar . get ( 3 ) ) . intValue ( ) ) ) ;
hashMap . put ( 9 , c . i . a . c . h2 . n . f . get ( ( ( Integer ) uVar . get ( 4 ) ) . intValue ( ) ) ) ;
hashMap . put ( 7 , uVar2 . get ( ( ( Integer ) uVar . get ( 0 ) ) . intValue ( ) ) ) ;
c . i . a . c . h2 . n . g = new c . i . a . c . h2 . n ( applicationContext , hashMap , 2000 , g . a , true ) ;
}
}
str = Locale . getDefault ( ) . getCountry ( ) ;
if ( str ! = null ) {
str = str . toUpperCase ( Locale . US ) ;
}
uVar = ( u ) c . i . a . c . h2 . n . a . l . get ( str ) ;
if ( uVar = = null ) {
}
if ( uVar . isEmpty ( ) ) {
}
HashMap hashMap = new HashMap ( 6 ) ;
hashMap . put ( 0 , 1000000L ) ;
u < Long > uVar2 = c . i . a . c . h2 . n . b ;
hashMap . put ( 2 , uVar2 . get ( ( ( Integer ) uVar . get ( 0 ) ) . intValue ( ) ) ) ;
2021-07-28 07:39:21 +00:00
hashMap . put ( 3 , c . i . a . c . h2 . n . f885c . get ( ( ( Integer ) uVar . get ( 1 ) ) . intValue ( ) ) ) ;
2021-07-24 02:37:17 +00:00
hashMap . put ( 4 , c . i . a . c . h2 . n . d . get ( ( ( Integer ) uVar . get ( 2 ) ) . intValue ( ) ) ) ;
hashMap . put ( 5 , c . i . a . c . h2 . n . e . get ( ( ( Integer ) uVar . get ( 3 ) ) . intValue ( ) ) ) ;
hashMap . put ( 9 , c . i . a . c . h2 . n . f . get ( ( ( Integer ) uVar . get ( 4 ) ) . intValue ( ) ) ) ;
hashMap . put ( 7 , uVar2 . get ( ( ( Integer ) uVar . get ( 0 ) ) . intValue ( ) ) ) ;
c . i . a . c . h2 . n . g = new c . i . a . c . h2 . n ( applicationContext , hashMap , 2000 , g . a , true ) ;
}
nVar = c . i . a . c . h2 . n . g ;
}
g gVar = g . a ;
c1 c1Var = new c1 ( gVar ) ;
this . a = context ;
this . b = n0Var ;
this . d = defaultTrackSelector ;
this . e = nVar2 ;
this . f = l0Var ;
this . g = nVar ;
this . h = c1Var ;
this . i = f0 . o ( ) ;
this . j = n . a ;
this . k = 1 ;
this . l = true ;
this . m = o1 . b ;
this . n = new k0 ( 0 . 97f , 1 . 03f , 1000 , 1 . 0E - 7f , h0 . a ( 20 ) , h0 . a ( 500 ) , 0 . 999f , null ) ;
2021-07-28 07:39:21 +00:00
this . f942c = gVar ;
2021-07-24 02:37:17 +00:00
this . o = 500 ;
this . p = 2000 ;
}
}
/* compiled from: SimpleExoPlayer */
public final class c implements w , q , k , e , SurfaceHolder . Callback , TextureView . SurfaceTextureListener , e0 . b , d0 . b , q1 . b , g1 . a {
public c ( a aVar ) {
}
@Override // c.i.a.c.v1.q
public void A ( Format format , @Nullable c . i . a . c . x1 . e eVar ) {
Objects . requireNonNull ( p1 . this ) ;
p1 . this . k . A ( format , eVar ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void C ( r1 r1Var , Object obj , int i ) {
f1 . t ( this , r1Var , obj , i ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void D ( int i ) {
f1 . o ( this , i ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void E ( v0 v0Var , int i ) {
f1 . g ( this , v0Var , i ) ;
}
@Override // c.i.a.c.v1.q
public void G ( boolean z2 ) {
p1 p1Var = p1 . this ;
if ( p1Var . C ! = z2 ) {
p1Var . C = z2 ;
p1Var . k . G ( z2 ) ;
Iterator < p > it = p1Var . g . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . b ( ) ;
}
}
}
@Override // c.i.a.c.v1.q
public void H ( Exception exc ) {
p1 . this . k . H ( exc ) ;
}
@Override // c.i.a.c.j2.w
public void I ( c . i . a . c . x1 . d dVar ) {
Objects . requireNonNull ( p1 . this ) ;
p1 . this . k . I ( dVar ) ;
}
@Override // c.i.a.c.j2.w
public void J ( Format format , @Nullable c . i . a . c . x1 . e eVar ) {
Objects . requireNonNull ( p1 . this ) ;
p1 . this . k . J ( format , eVar ) ;
}
@Override // c.i.a.c.v1.q
public void K ( long j ) {
p1 . this . k . K ( j ) ;
}
@Override // c.i.a.c.g1.a
public void M ( boolean z2 , int i ) {
p1 . b ( p1 . this ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void O ( TrackGroupArray trackGroupArray , c . i . a . c . f2 . k kVar ) {
f1 . u ( this , trackGroupArray , kVar ) ;
}
@Override // c.i.a.c.j2.w
public void P ( c . i . a . c . x1 . d dVar ) {
p1 . this . k . P ( dVar ) ;
Objects . requireNonNull ( p1 . this ) ;
Objects . requireNonNull ( p1 . this ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void Q ( d1 d1Var ) {
f1 . i ( this , d1Var ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void S ( boolean z2 ) {
f1 . b ( this , z2 ) ;
}
@Override // c.i.a.c.v1.q
public void T ( int i , long j , long j2 ) {
p1 . this . k . T ( i , j , j2 ) ;
}
@Override // c.i.a.c.j2.w
public void V ( long j , int i ) {
p1 . this . k . V ( j , i ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void X ( boolean z2 ) {
f1 . e ( this , z2 ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void a ( ) {
f1 . p ( this ) ;
}
@Override // c.i.a.c.j2.w
public void b ( int i , int i2 , int i3 , float f ) {
p1 . this . k . b ( i , i2 , i3 , f ) ;
Iterator < v > it = p1 . this . f . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . b ( i , i2 , i3 , f ) ;
}
}
@Override // c.i.a.c.v1.q
public void c ( c . i . a . c . x1 . d dVar ) {
p1 . this . k . c ( dVar ) ;
Objects . requireNonNull ( p1 . this ) ;
Objects . requireNonNull ( p1 . this ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void d ( int i ) {
f1 . k ( this , i ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void e ( boolean z2 ) {
f1 . f ( this , z2 ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void f ( int i ) {
f1 . n ( this , i ) ;
}
@Override // c.i.a.c.j2.w
public void g ( String str ) {
p1 . this . k . g ( str ) ;
}
@Override // c.i.a.c.v1.q
public void h ( c . i . a . c . x1 . d dVar ) {
Objects . requireNonNull ( p1 . this ) ;
p1 . this . k . h ( dVar ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void i ( List list ) {
f1 . r ( this , list ) ;
}
@Override // c.i.a.c.j2.w
public void j ( String str , long j , long j2 ) {
p1 . this . k . j ( str , j , j2 ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void k ( ExoPlaybackException exoPlaybackException ) {
f1 . l ( this , exoPlaybackException ) ;
}
@Override // c.i.a.c.c2.e
public void l ( Metadata metadata ) {
c1 c1Var = p1 . this . k ;
d1 . a Y = c1Var . Y ( ) ;
c . i . a . c . u1 . d dVar = new c . i . a . c . u1 . d ( Y , metadata ) ;
c1Var . m . put ( 1007 , Y ) ;
o < d1 , d1 . b > oVar = c1Var . n ;
oVar . b ( 1007 , dVar ) ;
oVar . a ( ) ;
Iterator < e > it = p1 . this . i . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . l ( metadata ) ;
}
}
@Override // c.i.a.c.e2.k
public void m ( List < c . i . a . c . e2 . c > list ) {
p1 p1Var = p1 . this ;
p1Var . D = list ;
Iterator < k > it = p1Var . h . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . m ( list ) ;
}
}
@Override // c.i.a.c.g1.a
public void n ( boolean z2 ) {
Objects . requireNonNull ( p1 . this ) ;
}
@Override // android.view.TextureView.SurfaceTextureListener
public void onSurfaceTextureAvailable ( SurfaceTexture surfaceTexture , int i , int i2 ) {
p1 . this . V ( new Surface ( surfaceTexture ) , true ) ;
p1 . this . P ( i , i2 ) ;
}
@Override // android.view.TextureView.SurfaceTextureListener
public boolean onSurfaceTextureDestroyed ( SurfaceTexture surfaceTexture ) {
p1 . this . V ( null , true ) ;
p1 . this . P ( 0 , 0 ) ;
return true ;
}
@Override // android.view.TextureView.SurfaceTextureListener
public void onSurfaceTextureSizeChanged ( SurfaceTexture surfaceTexture , int i , int i2 ) {
p1 . this . P ( i , i2 ) ;
}
@Override // android.view.TextureView.SurfaceTextureListener
public void onSurfaceTextureUpdated ( SurfaceTexture surfaceTexture ) {
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void p ( r1 r1Var , int i ) {
f1 . s ( this , r1Var , i ) ;
}
@Override // c.i.a.c.g1.a
public void r ( int i ) {
p1 . b ( p1 . this ) ;
}
@Override // c.i.a.c.j2.w
public void s ( Surface surface ) {
p1 . this . k . s ( surface ) ;
p1 p1Var = p1 . this ;
2021-07-28 07:39:21 +00:00
if ( p1Var . f938s = = surface ) {
2021-07-24 02:37:17 +00:00
Iterator < v > it = p1Var . f . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . c ( ) ;
}
}
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceChanged ( SurfaceHolder surfaceHolder , int i , int i2 , int i3 ) {
p1 . this . P ( i2 , i3 ) ;
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceCreated ( SurfaceHolder surfaceHolder ) {
p1 . this . V ( surfaceHolder . getSurface ( ) , false ) ;
}
@Override // android.view.SurfaceHolder.Callback
public void surfaceDestroyed ( SurfaceHolder surfaceHolder ) {
p1 . this . V ( null , false ) ;
p1 . this . P ( 0 , 0 ) ;
}
@Override // c.i.a.c.v1.q
public void t ( String str ) {
p1 . this . k . t ( str ) ;
}
@Override // c.i.a.c.v1.q
public void u ( String str , long j , long j2 ) {
p1 . this . k . u ( str , j , j2 ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void v ( boolean z2 ) {
f1 . q ( this , z2 ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void w ( g1 g1Var , g1 . b bVar ) {
f1 . a ( this , g1Var , bVar ) ;
}
@Override // c.i.a.c.j2.w
public void x ( int i , long j ) {
p1 . this . k . x ( i , j ) ;
}
@Override // c.i.a.c.g1.a
public void y ( boolean z2 ) {
p1 . b ( p1 . this ) ;
}
@Override // c.i.a.c.g1.a
public /* synthetic */ void z ( boolean z2 , int i ) {
f1 . m ( this , z2 , i ) ;
}
}
/* JADX WARNING: Removed duplicated region for block: B:19:0x0145 */
/* JADX WARNING: Removed duplicated region for block: B:28:0x017a */
/* JADX WARNING: Removed duplicated region for block: B:35:0x01f7 */
/* JADX WARNING: Removed duplicated region for block: B:36:0x0202 */
/* JADX WARNING: Removed duplicated region for block: B:39:0x0219 */
public p1 ( b bVar ) {
boolean z2 ;
e0 e0Var ;
int i ;
q1 q1Var ;
int t ;
Context applicationContext = bVar . a . getApplicationContext ( ) ;
2021-07-28 07:39:21 +00:00
this . f937c = applicationContext ;
2021-07-24 02:37:17 +00:00
c1 c1Var = bVar . h ;
this . k = c1Var ;
this . A = bVar . j ;
this . u = bVar . k ;
this . q = bVar . p ;
c cVar = new c ( null ) ;
this . e = cVar ;
this . f = new CopyOnWriteArraySet < > ( ) ;
this . g = new CopyOnWriteArraySet < > ( ) ;
this . h = new CopyOnWriteArraySet < > ( ) ;
this . i = new CopyOnWriteArraySet < > ( ) ;
this . j = new CopyOnWriteArraySet < > ( ) ;
Handler handler = new Handler ( bVar . i ) ;
n0 n0Var = ( n0 ) bVar . b ;
Objects . requireNonNull ( n0Var ) ;
ArrayList arrayList = new ArrayList ( ) ;
c . i . a . c . j2 . n nVar = new c . i . a . c . j2 . n ( n0Var . a , n0Var . b , 5000 , false , handler , cVar , 50 ) ;
nVar . H0 = false ;
nVar . I0 = false ;
nVar . J0 = false ;
arrayList . add ( nVar ) ;
Context context = n0Var . a ;
c . i . a . c . v1 . o oVar = c . i . a . c . v1 . o . a ;
Intent registerReceiver = context . registerReceiver ( null , new IntentFilter ( " android.media.action.HDMI_AUDIO_PLUG " ) ) ;
int i2 = f0 . a ;
if ( i2 > = 17 ) {
2021-07-28 07:39:21 +00:00
String str = f0 . f904c ;
2021-07-24 02:37:17 +00:00
if ( " Amazon " . equals ( str ) | | " Xiaomi " . equals ( str ) ) {
z2 = true ;
y yVar = new y ( n0Var . a , n0Var . b , false , handler , cVar , new DefaultAudioSink ( ( z2 | | Settings . Global . getInt ( context . getContentResolver ( ) , " external_surround_sound_enabled " , 0 ) ! = 1 ) ? ( registerReceiver ! = null | | registerReceiver . getIntExtra ( " android.media.extra.AUDIO_PLUG_STATE " , 0 ) = = 0 ) ? c . i . a . c . v1 . o . a : new c . i . a . c . v1 . o ( registerReceiver . getIntArrayExtra ( " android.media.extra.ENCODINGS " ) , registerReceiver . getIntExtra ( " android.media.extra.MAX_CHANNEL_COUNT " , 8 ) ) : c . i . a . c . v1 . o . b , new DefaultAudioSink . d ( new AudioProcessor [ 0 ] ) , false , false , false ) ) ;
yVar . H0 = false ;
yVar . I0 = false ;
yVar . J0 = false ;
arrayList . add ( yVar ) ;
arrayList . add ( new c . i . a . c . e2 . l ( cVar , handler . getLooper ( ) ) ) ;
arrayList . add ( new c . i . a . c . c2 . f ( cVar , handler . getLooper ( ) ) ) ;
arrayList . add ( new c . i . a . c . j2 . x . b ( ) ) ;
k1 [ ] k1VarArr = ( k1 [ ] ) arrayList . toArray ( new k1 [ 0 ] ) ;
this . b = k1VarArr ;
this . B = 1 . 0f ;
if ( i2 > = 21 ) {
AudioTrack audioTrack = this . r ;
if ( ! ( audioTrack = = null | | audioTrack . getAudioSessionId ( ) = = 0 ) ) {
this . r . release ( ) ;
this . r = null ;
}
if ( this . r = = null ) {
this . r = new AudioTrack ( 3 , 4000 , 4 , 2 , 2 , 0 , 0 ) ;
}
2021-07-28 07:39:21 +00:00
this . f941z = this . r . getAudioSessionId ( ) ;
2021-07-24 02:37:17 +00:00
} else {
UUID uuid = h0 . a ;
AudioManager audioManager = ( AudioManager ) applicationContext . getSystemService ( " audio " ) ;
2021-07-28 07:39:21 +00:00
this . f941z = audioManager = = null ? - 1 : audioManager . generateAudioSessionId ( ) ;
2021-07-24 02:37:17 +00:00
}
this . D = Collections . emptyList ( ) ;
this . G = true ;
2021-07-28 07:39:21 +00:00
o0 o0Var = new o0 ( k1VarArr , bVar . d , bVar . e , bVar . f , bVar . g , c1Var , bVar . l , bVar . m , bVar . n , bVar . o , false , bVar . f942c , bVar . i , this ) ;
2021-07-24 02:37:17 +00:00
this . d = o0Var ;
o0Var . l ( cVar ) ;
d0 d0Var = new d0 ( bVar . a , handler , cVar ) ;
this . l = d0Var ;
d0Var . a ( false ) ;
e0Var = new e0 ( bVar . a , handler , cVar ) ;
this . m = e0Var ;
if ( f0 . a ( e0Var . d , null ) ) {
e0Var . d = null ;
e0Var . f = 0 ;
i = 1 ;
AnimatableValueParser . n ( true , " Automatic handling of audio focus is only available for USAGE_MEDIA and USAGE_GAME. " ) ;
} else {
i = 1 ;
}
q1Var = new q1 ( bVar . a , handler , cVar ) ;
this . n = q1Var ;
t = f0 . t ( this . A . d ) ;
if ( q1Var . f ! = t ) {
q1Var . f = t ;
q1Var . c ( ) ;
2021-07-28 07:39:21 +00:00
c cVar2 = ( c ) q1Var . f951c ;
2021-07-24 02:37:17 +00:00
c . i . a . c . y1 . a N = N ( p1 . this . n ) ;
if ( ! N . equals ( p1 . this . J ) ) {
p1 p1Var = p1 . this ;
p1Var . J = N ;
Iterator < c . i . a . c . y1 . b > it = p1Var . j . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . b ( ) ;
}
}
}
s1 s1Var = new s1 ( bVar . a ) ;
this . o = s1Var ;
2021-07-28 07:39:21 +00:00
s1Var . f955c = false ;
2021-07-24 02:37:17 +00:00
s1Var . a ( ) ;
t1 t1Var = new t1 ( bVar . a ) ;
this . p = t1Var ;
2021-07-28 07:39:21 +00:00
t1Var . f956c = false ;
2021-07-24 02:37:17 +00:00
t1Var . a ( ) ;
this . J = N ( this . n ) ;
2021-07-28 07:39:21 +00:00
R ( i , 102 , Integer . valueOf ( this . f941z ) ) ;
R ( 2 , 102 , Integer . valueOf ( this . f941z ) ) ;
2021-07-24 02:37:17 +00:00
R ( i , 3 , this . A ) ;
R ( 2 , 4 , Integer . valueOf ( this . u ) ) ;
R ( i , 101 , Boolean . valueOf ( this . C ) ) ;
}
}
z2 = false ;
y yVar = new y ( n0Var . a , n0Var . b , false , handler , cVar , new DefaultAudioSink ( ( z2 | | Settings . Global . getInt ( context . getContentResolver ( ) , " external_surround_sound_enabled " , 0 ) ! = 1 ) ? ( registerReceiver ! = null | | registerReceiver . getIntExtra ( " android.media.extra.AUDIO_PLUG_STATE " , 0 ) = = 0 ) ? c . i . a . c . v1 . o . a : new c . i . a . c . v1 . o ( registerReceiver . getIntArrayExtra ( " android.media.extra.ENCODINGS " ) , registerReceiver . getIntExtra ( " android.media.extra.MAX_CHANNEL_COUNT " , 8 ) ) : c . i . a . c . v1 . o . b , new DefaultAudioSink . d ( new AudioProcessor [ 0 ] ) , false , false , false ) ) ;
yVar . H0 = false ;
yVar . I0 = false ;
yVar . J0 = false ;
arrayList . add ( yVar ) ;
arrayList . add ( new c . i . a . c . e2 . l ( cVar , handler . getLooper ( ) ) ) ;
arrayList . add ( new c . i . a . c . c2 . f ( cVar , handler . getLooper ( ) ) ) ;
arrayList . add ( new c . i . a . c . j2 . x . b ( ) ) ;
k1 [ ] k1VarArr = ( k1 [ ] ) arrayList . toArray ( new k1 [ 0 ] ) ;
this . b = k1VarArr ;
this . B = 1 . 0f ;
if ( i2 > = 21 ) {
}
this . D = Collections . emptyList ( ) ;
this . G = true ;
2021-07-28 07:39:21 +00:00
o0 o0Var = new o0 ( k1VarArr , bVar . d , bVar . e , bVar . f , bVar . g , c1Var , bVar . l , bVar . m , bVar . n , bVar . o , false , bVar . f942c , bVar . i , this ) ;
2021-07-24 02:37:17 +00:00
this . d = o0Var ;
o0Var . l ( cVar ) ;
d0 d0Var = new d0 ( bVar . a , handler , cVar ) ;
this . l = d0Var ;
d0Var . a ( false ) ;
e0Var = new e0 ( bVar . a , handler , cVar ) ;
this . m = e0Var ;
if ( f0 . a ( e0Var . d , null ) ) {
}
q1Var = new q1 ( bVar . a , handler , cVar ) ;
this . n = q1Var ;
t = f0 . t ( this . A . d ) ;
if ( q1Var . f ! = t ) {
}
s1 s1Var = new s1 ( bVar . a ) ;
this . o = s1Var ;
2021-07-28 07:39:21 +00:00
s1Var . f955c = false ;
2021-07-24 02:37:17 +00:00
s1Var . a ( ) ;
t1 t1Var = new t1 ( bVar . a ) ;
this . p = t1Var ;
2021-07-28 07:39:21 +00:00
t1Var . f956c = false ;
2021-07-24 02:37:17 +00:00
t1Var . a ( ) ;
this . J = N ( this . n ) ;
2021-07-28 07:39:21 +00:00
R ( i , 102 , Integer . valueOf ( this . f941z ) ) ;
R ( 2 , 102 , Integer . valueOf ( this . f941z ) ) ;
2021-07-24 02:37:17 +00:00
R ( i , 3 , this . A ) ;
R ( 2 , 4 , Integer . valueOf ( this . u ) ) ;
R ( i , 101 , Boolean . valueOf ( this . C ) ) ;
}
public static c . i . a . c . y1 . a N ( q1 q1Var ) {
Objects . requireNonNull ( q1Var ) ;
return new c . i . a . c . y1 . a ( 0 , f0 . a > = 28 ? q1Var . d . getStreamMinVolume ( q1Var . f ) : 0 , q1Var . d . getStreamMaxVolume ( q1Var . f ) ) ;
}
public static int O ( boolean z2 , int i ) {
return ( ! z2 | | i = = 1 ) ? 1 : 2 ;
}
public static void b ( p1 p1Var ) {
int u = p1Var . u ( ) ;
boolean z2 = true ;
if ( u ! = 1 ) {
if ( u = = 2 | | u = = 3 ) {
p1Var . Z ( ) ;
2021-07-28 07:39:21 +00:00
boolean z3 = p1Var . d . f933x . p ;
2021-07-24 02:37:17 +00:00
s1 s1Var = p1Var . o ;
if ( ! p1Var . g ( ) | | z3 ) {
z2 = false ;
}
s1Var . d = z2 ;
s1Var . a ( ) ;
t1 t1Var = p1Var . p ;
t1Var . d = p1Var . g ( ) ;
t1Var . a ( ) ;
return ;
} else if ( u ! = 4 ) {
throw new IllegalStateException ( ) ;
}
}
s1 s1Var2 = p1Var . o ;
s1Var2 . d = false ;
s1Var2 . a ( ) ;
t1 t1Var2 = p1Var . p ;
t1Var2 . d = false ;
t1Var2 . a ( ) ;
}
@Override // c.i.a.c.g1
public TrackGroupArray A ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . h ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public int B ( ) {
Z ( ) ;
return this . d . q ;
}
@Override // c.i.a.c.g1
public long C ( ) {
Z ( ) ;
return this . d . C ( ) ;
}
@Override // c.i.a.c.g1
public r1 D ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . b ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public Looper E ( ) {
return this . d . n ;
}
@Override // c.i.a.c.g1
public boolean F ( ) {
Z ( ) ;
return this . d . r ;
}
@Override // c.i.a.c.g1
public long G ( ) {
Z ( ) ;
return this . d . G ( ) ;
}
@Override // c.i.a.c.g1
public c . i . a . c . f2 . k H ( ) {
Z ( ) ;
return this . d . H ( ) ;
}
@Override // c.i.a.c.g1
public int I ( int i ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f931c [ i ] . x ( ) ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public long J ( ) {
Z ( ) ;
return this . d . J ( ) ;
}
@Override // c.i.a.c.g1
@Nullable
public g1 . c K ( ) {
return this ;
}
public void L ( @Nullable Surface surface ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
if ( surface ! = null & & surface = = this . f938s ) {
2021-07-24 02:37:17 +00:00
Z ( ) ;
Q ( ) ;
V ( null , false ) ;
P ( 0 , 0 ) ;
}
}
public void M ( @Nullable SurfaceView surfaceView ) {
Z ( ) ;
if ( ! ( surfaceView instanceof c . i . a . c . j2 . p ) ) {
SurfaceHolder holder = surfaceView = = null ? null : surfaceView . getHolder ( ) ;
Z ( ) ;
if ( holder ! = null & & holder = = this . v ) {
U ( null ) ;
}
} else if ( surfaceView . getHolder ( ) = = this . v ) {
S ( null ) ;
this . v = null ;
}
}
public final void P ( int i , int i2 ) {
2021-07-28 07:39:21 +00:00
if ( i ! = this . f939x | | i2 ! = this . f940y ) {
this . f939x = i ;
this . f940y = i2 ;
2021-07-24 02:37:17 +00:00
c1 c1Var = this . k ;
d1 . a d02 = c1Var . d0 ( ) ;
c . i . a . c . u1 . n nVar = new c . i . a . c . u1 . n ( d02 , i , i2 ) ;
c1Var . m . put ( 1029 , d02 ) ;
o < d1 , d1 . b > oVar = c1Var . n ;
oVar . b ( 1029 , nVar ) ;
oVar . a ( ) ;
Iterator < v > it = this . f . iterator ( ) ;
while ( it . hasNext ( ) ) {
it . next ( ) . g ( i , i2 ) ;
}
}
}
public final void Q ( ) {
TextureView textureView = this . w ;
if ( textureView ! = null ) {
if ( textureView . getSurfaceTextureListener ( ) ! = this . e ) {
Log . w ( " SimpleExoPlayer " , " SurfaceTextureListener already unset or replaced. " ) ;
} else {
this . w . setSurfaceTextureListener ( null ) ;
}
this . w = null ;
}
SurfaceHolder surfaceHolder = this . v ;
if ( surfaceHolder ! = null ) {
surfaceHolder . removeCallback ( this . e ) ;
this . v = null ;
}
}
public final void R ( int i , int i2 , @Nullable Object obj ) {
k1 [ ] k1VarArr = this . b ;
for ( k1 k1Var : k1VarArr ) {
if ( k1Var . x ( ) = = i ) {
h1 b2 = this . d . b ( k1Var ) ;
AnimatableValueParser . D ( ! b2 . i ) ;
b2 . e = i2 ;
AnimatableValueParser . D ( ! b2 . i ) ;
b2 . f = obj ;
b2 . d ( ) ;
}
}
}
public final void S ( @Nullable r rVar ) {
R ( 2 , 8 , rVar ) ;
}
public void T ( @Nullable Surface surface ) {
Z ( ) ;
Q ( ) ;
if ( surface ! = null ) {
S ( null ) ;
}
int i = 0 ;
V ( surface , false ) ;
if ( surface ! = null ) {
i = - 1 ;
}
P ( i , i ) ;
}
public void U ( @Nullable SurfaceHolder surfaceHolder ) {
Z ( ) ;
Q ( ) ;
if ( surfaceHolder ! = null ) {
S ( null ) ;
}
this . v = surfaceHolder ;
if ( surfaceHolder = = null ) {
V ( null , false ) ;
P ( 0 , 0 ) ;
return ;
}
surfaceHolder . addCallback ( this . e ) ;
Surface surface = surfaceHolder . getSurface ( ) ;
if ( surface = = null | | ! surface . isValid ( ) ) {
V ( null , false ) ;
P ( 0 , 0 ) ;
return ;
}
V ( surface , false ) ;
Rect surfaceFrame = surfaceHolder . getSurfaceFrame ( ) ;
P ( surfaceFrame . width ( ) , surfaceFrame . height ( ) ) ;
}
public final void V ( @Nullable Surface surface , boolean z2 ) {
ArrayList arrayList = new ArrayList ( ) ;
k1 [ ] k1VarArr = this . b ;
for ( k1 k1Var : k1VarArr ) {
if ( k1Var . x ( ) = = 2 ) {
h1 b2 = this . d . b ( k1Var ) ;
AnimatableValueParser . D ( ! b2 . i ) ;
b2 . e = 1 ;
AnimatableValueParser . D ( true ^ b2 . i ) ;
b2 . f = surface ;
b2 . d ( ) ;
arrayList . add ( b2 ) ;
}
}
2021-07-28 07:39:21 +00:00
Surface surface2 = this . f938s ;
2021-07-24 02:37:17 +00:00
if ( ! ( surface2 = = null | | surface2 = = surface ) ) {
try {
Iterator it = arrayList . iterator ( ) ;
while ( it . hasNext ( ) ) {
( ( h1 ) it . next ( ) ) . a ( this . q ) ;
}
} catch ( InterruptedException unused ) {
Thread . currentThread ( ) . interrupt ( ) ;
} catch ( TimeoutException unused2 ) {
o0 o0Var = this . d ;
ExoPlaybackException b3 = ExoPlaybackException . b ( new ExoTimeoutException ( 3 ) ) ;
2021-07-28 07:39:21 +00:00
c1 c1Var = o0Var . f933x ;
c1 a2 = c1Var . a ( c1Var . f773c ) ;
a2 . q = a2 . f774s ;
2021-07-24 02:37:17 +00:00
a2 . r = 0 ;
c1 e = a2 . g ( 1 ) . e ( b3 ) ;
2021-07-28 07:39:21 +00:00
o0Var . f932s + + ;
2021-07-24 02:37:17 +00:00
o0Var . g . o . a ( 6 ) . sendToTarget ( ) ;
o0Var . S ( e , false , 4 , 0 , 1 , false ) ;
}
if ( this . t ) {
2021-07-28 07:39:21 +00:00
this . f938s . release ( ) ;
2021-07-24 02:37:17 +00:00
}
}
2021-07-28 07:39:21 +00:00
this . f938s = surface ;
2021-07-24 02:37:17 +00:00
this . t = z2 ;
}
public void W ( @Nullable SurfaceView surfaceView ) {
Z ( ) ;
SurfaceHolder surfaceHolder = null ;
if ( surfaceView instanceof c . i . a . c . j2 . p ) {
r videoDecoderOutputBufferRenderer = ( ( c . i . a . c . j2 . p ) surfaceView ) . getVideoDecoderOutputBufferRenderer ( ) ;
Z ( ) ;
Q ( ) ;
V ( null , false ) ;
P ( 0 , 0 ) ;
this . v = surfaceView . getHolder ( ) ;
S ( videoDecoderOutputBufferRenderer ) ;
return ;
}
if ( surfaceView ! = null ) {
surfaceHolder = surfaceView . getHolder ( ) ;
}
U ( surfaceHolder ) ;
}
public void X ( @Nullable TextureView textureView ) {
Z ( ) ;
Q ( ) ;
if ( textureView ! = null ) {
S ( null ) ;
}
this . w = textureView ;
if ( textureView = = null ) {
V ( null , true ) ;
P ( 0 , 0 ) ;
return ;
}
if ( textureView . getSurfaceTextureListener ( ) ! = null ) {
Log . w ( " SimpleExoPlayer " , " Replacing existing SurfaceTextureListener. " ) ;
}
textureView . setSurfaceTextureListener ( this . e ) ;
SurfaceTexture surfaceTexture = textureView . isAvailable ( ) ? textureView . getSurfaceTexture ( ) : null ;
if ( surfaceTexture = = null ) {
V ( null , true ) ;
P ( 0 , 0 ) ;
return ;
}
V ( new Surface ( surfaceTexture ) , true ) ;
P ( textureView . getWidth ( ) , textureView . getHeight ( ) ) ;
}
public final void Y ( boolean z2 , int i , int i2 ) {
int i3 = 0 ;
boolean z3 = z2 & & i ! = - 1 ;
if ( z3 & & i ! = 1 ) {
i3 = 1 ;
}
this . d . R ( z3 , i3 , i2 ) ;
}
public final void Z ( ) {
if ( Looper . myLooper ( ) = = this . d . n ) {
return ;
}
if ( ! this . G ) {
c . i . a . c . i2 . p . c ( " SimpleExoPlayer " , " Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread " , this . H ? null : new IllegalStateException ( ) ) ;
this . H = true ;
return ;
}
throw new IllegalStateException ( " Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread " ) ;
}
@Override // c.i.a.c.g1
public void a ( ) {
Z ( ) ;
boolean g = g ( ) ;
int d = this . m . d ( g , 2 ) ;
Y ( g , d , O ( g , d ) ) ;
this . d . a ( ) ;
}
@Override // c.i.a.c.g1
public d1 c ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . n ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public boolean d ( ) {
Z ( ) ;
return this . d . d ( ) ;
}
@Override // c.i.a.c.g1
public long e ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return h0 . b ( this . d . f933x . r ) ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public void f ( int i , long j ) {
Z ( ) ;
c1 c1Var = this . k ;
if ( ! c1Var . p ) {
d1 . a Y = c1Var . Y ( ) ;
c1Var . p = true ;
w0 w0Var = new w0 ( Y ) ;
c1Var . m . put ( - 1 , Y ) ;
o < d1 , d1 . b > oVar = c1Var . n ;
oVar . b ( - 1 , w0Var ) ;
oVar . a ( ) ;
}
this . d . f ( i , j ) ;
}
@Override // c.i.a.c.g1
public boolean g ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . l ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public void h ( boolean z2 ) {
Z ( ) ;
this . d . h ( z2 ) ;
}
@Override // c.i.a.c.g1
public List < Metadata > i ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . j ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public int j ( ) {
Z ( ) ;
return this . d . j ( ) ;
}
@Override // c.i.a.c.g1
public void l ( g1 . a aVar ) {
Objects . requireNonNull ( aVar ) ;
this . d . l ( aVar ) ;
}
@Override // c.i.a.c.g1
public int m ( ) {
Z ( ) ;
return this . d . m ( ) ;
}
@Override // c.i.a.c.g1
public void n ( g1 . a aVar ) {
this . d . n ( aVar ) ;
}
@Override // c.i.a.c.g1
public int o ( ) {
Z ( ) ;
return this . d . o ( ) ;
}
@Override // c.i.a.c.g1
@Nullable
public ExoPlaybackException p ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . f ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public void q ( boolean z2 ) {
Z ( ) ;
int d = this . m . d ( z2 , u ( ) ) ;
Y ( z2 , d , O ( z2 , d ) ) ;
}
@Override // c.i.a.c.g1
@Nullable
public g1 . d r ( ) {
return this ;
}
@Override // c.i.a.c.g1
public long s ( ) {
Z ( ) ;
return this . d . s ( ) ;
}
@Override // c.i.a.c.g1
public int u ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . e ;
2021-07-24 02:37:17 +00:00
}
@Override // c.i.a.c.g1
public int w ( ) {
Z ( ) ;
return this . d . w ( ) ;
}
@Override // c.i.a.c.g1
public void x ( int i ) {
Z ( ) ;
this . d . x ( i ) ;
}
@Override // c.i.a.c.g1
public int z ( ) {
Z ( ) ;
2021-07-28 07:39:21 +00:00
return this . d . f933x . m ;
2021-07-24 02:37:17 +00:00
}
}