package androidx.media3.exoplayer.source; import android.content.Context; import android.net.Uri; import androidx.media3.common.AdViewProvider; import androidx.media3.common.Format; import androidx.media3.common.MediaItem; import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Log; import androidx.media3.common.util.Util; import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DataSpec; import androidx.media3.datasource.DefaultDataSource; import androidx.media3.exoplayer.drm.DrmSessionManagerProvider; import androidx.media3.exoplayer.source.MediaSource; import androidx.media3.exoplayer.source.ProgressiveMediaSource; import androidx.media3.exoplayer.source.SingleSampleMediaSource; import androidx.media3.exoplayer.source.ads.AdsLoader; import androidx.media3.exoplayer.source.ads.AdsMediaSource; import androidx.media3.exoplayer.text.SubtitleDecoderFactory; import androidx.media3.exoplayer.upstream.CmcdConfiguration; import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; import androidx.media3.extractor.DefaultExtractorsFactory; import androidx.media3.extractor.Extractor; import androidx.media3.extractor.ExtractorInput; import androidx.media3.extractor.ExtractorOutput; import androidx.media3.extractor.ExtractorsFactory; import androidx.media3.extractor.PositionHolder; import androidx.media3.extractor.SeekMap; import androidx.media3.extractor.TrackOutput; import androidx.media3.extractor.text.SubtitleExtractor; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.primitives.Ints; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; /* loaded from: classes2.dex */ public final class DefaultMediaSourceFactory implements MediaSourceFactory { private static final String TAG = "DMediaSourceFactory"; private AdViewProvider adViewProvider; private AdsLoader.Provider adsLoaderProvider; private DataSource.Factory dataSourceFactory; private final DelegateFactoryLoader delegateFactoryLoader; private long liveMaxOffsetMs; private float liveMaxSpeed; private long liveMinOffsetMs; private float liveMinSpeed; private long liveTargetOffsetMs; private LoadErrorHandlingPolicy loadErrorHandlingPolicy; private MediaSource.Factory serverSideAdInsertionMediaSourceFactory; private boolean useProgressiveMediaSourceForSubtitles; @Deprecated /* loaded from: classes2.dex */ public interface AdsLoaderProvider extends AdsLoader.Provider { } public DefaultMediaSourceFactory clearLocalAdInsertionComponents() { this.adsLoaderProvider = null; this.adViewProvider = null; return this; } public DefaultMediaSourceFactory experimentalUseProgressiveMediaSourceForSubtitles(boolean z) { this.useProgressiveMediaSourceForSubtitles = z; return this; } @Deprecated public DefaultMediaSourceFactory setAdViewProvider(AdViewProvider adViewProvider) { this.adViewProvider = adViewProvider; return this; } @Deprecated public DefaultMediaSourceFactory setAdsLoaderProvider(AdsLoader.Provider provider) { this.adsLoaderProvider = provider; return this; } public DefaultMediaSourceFactory setLiveMaxOffsetMs(long j) { this.liveMaxOffsetMs = j; return this; } public DefaultMediaSourceFactory setLiveMaxSpeed(float f) { this.liveMaxSpeed = f; return this; } public DefaultMediaSourceFactory setLiveMinOffsetMs(long j) { this.liveMinOffsetMs = j; return this; } public DefaultMediaSourceFactory setLiveMinSpeed(float f) { this.liveMinSpeed = f; return this; } public DefaultMediaSourceFactory setLiveTargetOffsetMs(long j) { this.liveTargetOffsetMs = j; return this; } public DefaultMediaSourceFactory setServerSideAdInsertionMediaSourceFactory(MediaSource.Factory factory) { this.serverSideAdInsertionMediaSourceFactory = factory; return this; } public DefaultMediaSourceFactory(Context context) { this(new DefaultDataSource.Factory(context)); } public DefaultMediaSourceFactory(Context context, ExtractorsFactory extractorsFactory) { this(new DefaultDataSource.Factory(context), extractorsFactory); } public DefaultMediaSourceFactory(DataSource.Factory factory) { this(factory, new DefaultExtractorsFactory()); } public DefaultMediaSourceFactory(DataSource.Factory factory, ExtractorsFactory extractorsFactory) { this.dataSourceFactory = factory; DelegateFactoryLoader delegateFactoryLoader = new DelegateFactoryLoader(extractorsFactory); this.delegateFactoryLoader = delegateFactoryLoader; delegateFactoryLoader.setDataSourceFactory(factory); this.liveTargetOffsetMs = -9223372036854775807L; this.liveMinOffsetMs = -9223372036854775807L; this.liveMaxOffsetMs = -9223372036854775807L; this.liveMinSpeed = -3.4028235E38f; this.liveMaxSpeed = -3.4028235E38f; } public DefaultMediaSourceFactory setLocalAdInsertionComponents(AdsLoader.Provider provider, AdViewProvider adViewProvider) { this.adsLoaderProvider = (AdsLoader.Provider) Assertions.checkNotNull(provider); this.adViewProvider = (AdViewProvider) Assertions.checkNotNull(adViewProvider); return this; } public DefaultMediaSourceFactory setDataSourceFactory(DataSource.Factory factory) { this.dataSourceFactory = factory; this.delegateFactoryLoader.setDataSourceFactory(factory); return this; } @Override // androidx.media3.exoplayer.source.MediaSource.Factory public DefaultMediaSourceFactory setCmcdConfigurationFactory(CmcdConfiguration.Factory factory) { this.delegateFactoryLoader.setCmcdConfigurationFactory((CmcdConfiguration.Factory) Assertions.checkNotNull(factory)); return this; } @Override // androidx.media3.exoplayer.source.MediaSource.Factory public DefaultMediaSourceFactory setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) { this.delegateFactoryLoader.setDrmSessionManagerProvider((DrmSessionManagerProvider) Assertions.checkNotNull(drmSessionManagerProvider, "MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior.")); return this; } @Override // androidx.media3.exoplayer.source.MediaSource.Factory public DefaultMediaSourceFactory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { this.loadErrorHandlingPolicy = (LoadErrorHandlingPolicy) Assertions.checkNotNull(loadErrorHandlingPolicy, "MediaSource.Factory#setLoadErrorHandlingPolicy no longer handles null by instantiating a new DefaultLoadErrorHandlingPolicy. Explicitly construct and pass an instance in order to retain the old behavior."); this.delegateFactoryLoader.setLoadErrorHandlingPolicy(loadErrorHandlingPolicy); return this; } @Override // androidx.media3.exoplayer.source.MediaSource.Factory public int[] getSupportedTypes() { return this.delegateFactoryLoader.getSupportedTypes(); } @Override // androidx.media3.exoplayer.source.MediaSource.Factory public MediaSource createMediaSource(MediaItem mediaItem) { Assertions.checkNotNull(mediaItem.localConfiguration); String scheme = mediaItem.localConfiguration.uri.getScheme(); if (scheme != null && scheme.equals("ssai")) { return ((MediaSource.Factory) Assertions.checkNotNull(this.serverSideAdInsertionMediaSourceFactory)).createMediaSource(mediaItem); } int inferContentTypeForUriAndMimeType = Util.inferContentTypeForUriAndMimeType(mediaItem.localConfiguration.uri, mediaItem.localConfiguration.mimeType); MediaSource.Factory mediaSourceFactory = this.delegateFactoryLoader.getMediaSourceFactory(inferContentTypeForUriAndMimeType); Assertions.checkStateNotNull(mediaSourceFactory, "No suitable media source factory found for content type: " + inferContentTypeForUriAndMimeType); MediaItem.LiveConfiguration.Builder buildUpon = mediaItem.liveConfiguration.buildUpon(); if (mediaItem.liveConfiguration.targetOffsetMs == -9223372036854775807L) { buildUpon.setTargetOffsetMs(this.liveTargetOffsetMs); } if (mediaItem.liveConfiguration.minPlaybackSpeed == -3.4028235E38f) { buildUpon.setMinPlaybackSpeed(this.liveMinSpeed); } if (mediaItem.liveConfiguration.maxPlaybackSpeed == -3.4028235E38f) { buildUpon.setMaxPlaybackSpeed(this.liveMaxSpeed); } if (mediaItem.liveConfiguration.minOffsetMs == -9223372036854775807L) { buildUpon.setMinOffsetMs(this.liveMinOffsetMs); } if (mediaItem.liveConfiguration.maxOffsetMs == -9223372036854775807L) { buildUpon.setMaxOffsetMs(this.liveMaxOffsetMs); } MediaItem.LiveConfiguration build = buildUpon.build(); if (!build.equals(mediaItem.liveConfiguration)) { mediaItem = mediaItem.buildUpon().setLiveConfiguration(build).build(); } MediaSource createMediaSource = mediaSourceFactory.createMediaSource(mediaItem); ImmutableList immutableList = ((MediaItem.LocalConfiguration) Util.castNonNull(mediaItem.localConfiguration)).subtitleConfigurations; if (!immutableList.isEmpty()) { MediaSource[] mediaSourceArr = new MediaSource[immutableList.size() + 1]; mediaSourceArr[0] = createMediaSource; for (int i = 0; i < immutableList.size(); i++) { if (this.useProgressiveMediaSourceForSubtitles) { final Format build2 = new Format.Builder().setSampleMimeType(immutableList.get(i).mimeType).setLanguage(immutableList.get(i).language).setSelectionFlags(immutableList.get(i).selectionFlags).setRoleFlags(immutableList.get(i).roleFlags).setLabel(immutableList.get(i).label).setId(immutableList.get(i).id).build(); ProgressiveMediaSource.Factory factory = new ProgressiveMediaSource.Factory(this.dataSourceFactory, new ExtractorsFactory() { // from class: androidx.media3.exoplayer.source.DefaultMediaSourceFactory$$ExternalSyntheticLambda0 @Override // androidx.media3.extractor.ExtractorsFactory public final Extractor[] createExtractors() { return DefaultMediaSourceFactory.lambda$createMediaSource$0(Format.this); } }); LoadErrorHandlingPolicy loadErrorHandlingPolicy = this.loadErrorHandlingPolicy; if (loadErrorHandlingPolicy != null) { factory.setLoadErrorHandlingPolicy(loadErrorHandlingPolicy); } mediaSourceArr[i + 1] = factory.createMediaSource(MediaItem.fromUri(immutableList.get(i).uri.toString())); } else { SingleSampleMediaSource.Factory factory2 = new SingleSampleMediaSource.Factory(this.dataSourceFactory); LoadErrorHandlingPolicy loadErrorHandlingPolicy2 = this.loadErrorHandlingPolicy; if (loadErrorHandlingPolicy2 != null) { factory2.setLoadErrorHandlingPolicy(loadErrorHandlingPolicy2); } mediaSourceArr[i + 1] = factory2.createMediaSource(immutableList.get(i), -9223372036854775807L); } } createMediaSource = new MergingMediaSource(mediaSourceArr); } return maybeWrapWithAdsMediaSource(mediaItem, maybeClipMediaSource(mediaItem, createMediaSource)); } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ Extractor[] lambda$createMediaSource$0(Format format) { Extractor unknownSubtitlesExtractor; Extractor[] extractorArr = new Extractor[1]; if (SubtitleDecoderFactory.DEFAULT.supportsFormat(format)) { unknownSubtitlesExtractor = new SubtitleExtractor(SubtitleDecoderFactory.DEFAULT.createDecoder(format), format); } else { unknownSubtitlesExtractor = new UnknownSubtitlesExtractor(format); } extractorArr[0] = unknownSubtitlesExtractor; return extractorArr; } private static MediaSource maybeClipMediaSource(MediaItem mediaItem, MediaSource mediaSource) { return (mediaItem.clippingConfiguration.startPositionMs == 0 && mediaItem.clippingConfiguration.endPositionMs == Long.MIN_VALUE && !mediaItem.clippingConfiguration.relativeToDefaultPosition) ? mediaSource : new ClippingMediaSource(mediaSource, Util.msToUs(mediaItem.clippingConfiguration.startPositionMs), Util.msToUs(mediaItem.clippingConfiguration.endPositionMs), !mediaItem.clippingConfiguration.startsAtKeyFrame, mediaItem.clippingConfiguration.relativeToLiveWindow, mediaItem.clippingConfiguration.relativeToDefaultPosition); } private MediaSource maybeWrapWithAdsMediaSource(MediaItem mediaItem, MediaSource mediaSource) { Object of; Assertions.checkNotNull(mediaItem.localConfiguration); MediaItem.AdsConfiguration adsConfiguration = mediaItem.localConfiguration.adsConfiguration; if (adsConfiguration == null) { return mediaSource; } AdsLoader.Provider provider = this.adsLoaderProvider; AdViewProvider adViewProvider = this.adViewProvider; if (provider == null || adViewProvider == null) { Log.w(TAG, "Playing media without ads. Configure ad support by calling setAdsLoaderProvider and setAdViewProvider."); return mediaSource; } AdsLoader adsLoader = provider.getAdsLoader(adsConfiguration); if (adsLoader == null) { Log.w(TAG, "Playing media without ads, as no AdsLoader was provided."); return mediaSource; } DataSpec dataSpec = new DataSpec(adsConfiguration.adTagUri); if (adsConfiguration.adsId != null) { of = adsConfiguration.adsId; } else { of = ImmutableList.of((Uri) mediaItem.mediaId, mediaItem.localConfiguration.uri, adsConfiguration.adTagUri); } return new AdsMediaSource(mediaSource, dataSpec, of, this, adsLoader, adViewProvider); } /* JADX INFO: Access modifiers changed from: private */ /* loaded from: classes2.dex */ public static final class DelegateFactoryLoader { private CmcdConfiguration.Factory cmcdConfigurationFactory; private DataSource.Factory dataSourceFactory; private DrmSessionManagerProvider drmSessionManagerProvider; private final ExtractorsFactory extractorsFactory; private LoadErrorHandlingPolicy loadErrorHandlingPolicy; private final Map> mediaSourceFactorySuppliers = new HashMap(); private final Set supportedTypes = new HashSet(); private final Map mediaSourceFactories = new HashMap(); public DelegateFactoryLoader(ExtractorsFactory extractorsFactory) { this.extractorsFactory = extractorsFactory; } public int[] getSupportedTypes() { ensureAllSuppliersAreLoaded(); return Ints.toArray(this.supportedTypes); } public MediaSource.Factory getMediaSourceFactory(int i) { MediaSource.Factory factory = this.mediaSourceFactories.get(Integer.valueOf(i)); if (factory != null) { return factory; } Supplier maybeLoadSupplier = maybeLoadSupplier(i); if (maybeLoadSupplier == null) { return null; } MediaSource.Factory factory2 = maybeLoadSupplier.get(); CmcdConfiguration.Factory factory3 = this.cmcdConfigurationFactory; if (factory3 != null) { factory2.setCmcdConfigurationFactory(factory3); } DrmSessionManagerProvider drmSessionManagerProvider = this.drmSessionManagerProvider; if (drmSessionManagerProvider != null) { factory2.setDrmSessionManagerProvider(drmSessionManagerProvider); } LoadErrorHandlingPolicy loadErrorHandlingPolicy = this.loadErrorHandlingPolicy; if (loadErrorHandlingPolicy != null) { factory2.setLoadErrorHandlingPolicy(loadErrorHandlingPolicy); } this.mediaSourceFactories.put(Integer.valueOf(i), factory2); return factory2; } public void setDataSourceFactory(DataSource.Factory factory) { if (factory != this.dataSourceFactory) { this.dataSourceFactory = factory; this.mediaSourceFactorySuppliers.clear(); this.mediaSourceFactories.clear(); } } public void setCmcdConfigurationFactory(CmcdConfiguration.Factory factory) { this.cmcdConfigurationFactory = factory; Iterator it = this.mediaSourceFactories.values().iterator(); while (it.hasNext()) { it.next().setCmcdConfigurationFactory(factory); } } public void setDrmSessionManagerProvider(DrmSessionManagerProvider drmSessionManagerProvider) { this.drmSessionManagerProvider = drmSessionManagerProvider; Iterator it = this.mediaSourceFactories.values().iterator(); while (it.hasNext()) { it.next().setDrmSessionManagerProvider(drmSessionManagerProvider); } } public void setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; Iterator it = this.mediaSourceFactories.values().iterator(); while (it.hasNext()) { it.next().setLoadErrorHandlingPolicy(loadErrorHandlingPolicy); } } private void ensureAllSuppliersAreLoaded() { maybeLoadSupplier(0); maybeLoadSupplier(1); maybeLoadSupplier(2); maybeLoadSupplier(3); maybeLoadSupplier(4); } /* JADX WARN: Removed duplicated region for block: B:21:0x008b */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private com.google.common.base.Supplier maybeLoadSupplier(int r5) { /* r4 = this; java.util.Map> r0 = r4.mediaSourceFactorySuppliers java.lang.Integer r1 = java.lang.Integer.valueOf(r5) boolean r0 = r0.containsKey(r1) if (r0 == 0) goto L19 java.util.Map> r4 = r4.mediaSourceFactorySuppliers java.lang.Integer r5 = java.lang.Integer.valueOf(r5) java.lang.Object r4 = r4.get(r5) com.google.common.base.Supplier r4 = (com.google.common.base.Supplier) r4 return r4 L19: androidx.media3.datasource.DataSource$Factory r0 = r4.dataSourceFactory java.lang.Object r0 = androidx.media3.common.util.Assertions.checkNotNull(r0) androidx.media3.datasource.DataSource$Factory r0 = (androidx.media3.datasource.DataSource.Factory) r0 r1 = 0 if (r5 == 0) goto L6e r2 = 1 if (r5 == r2) goto L5c r2 = 2 if (r5 == r2) goto L4a r2 = 3 if (r5 == r2) goto L38 r2 = 4 if (r5 == r2) goto L31 goto L80 L31: androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda4 r2 = new androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda4 // Catch: java.lang.ClassNotFoundException -> L80 r2.() // Catch: java.lang.ClassNotFoundException -> L80 L36: r1 = r2 goto L80 L38: java.lang.String r0 = "androidx.media3.exoplayer.rtsp.RtspMediaSource$Factory" java.lang.Class r0 = java.lang.Class.forName(r0) // Catch: java.lang.ClassNotFoundException -> L80 java.lang.Class r2 = androidx.media3.exoplayer.source.MediaSource.Factory.class java.lang.Class r0 = r0.asSubclass(r2) // Catch: java.lang.ClassNotFoundException -> L80 androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda3 r2 = new androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda3 // Catch: java.lang.ClassNotFoundException -> L80 r2.() // Catch: java.lang.ClassNotFoundException -> L80 goto L36 L4a: java.lang.String r2 = "androidx.media3.exoplayer.hls.HlsMediaSource$Factory" java.lang.Class r2 = java.lang.Class.forName(r2) // Catch: java.lang.ClassNotFoundException -> L80 java.lang.Class r3 = androidx.media3.exoplayer.source.MediaSource.Factory.class java.lang.Class r2 = r2.asSubclass(r3) // Catch: java.lang.ClassNotFoundException -> L80 androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda2 r3 = new androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda2 // Catch: java.lang.ClassNotFoundException -> L80 r3.() // Catch: java.lang.ClassNotFoundException -> L80 goto L7f L5c: java.lang.String r2 = "androidx.media3.exoplayer.smoothstreaming.SsMediaSource$Factory" java.lang.Class r2 = java.lang.Class.forName(r2) // Catch: java.lang.ClassNotFoundException -> L80 java.lang.Class r3 = androidx.media3.exoplayer.source.MediaSource.Factory.class java.lang.Class r2 = r2.asSubclass(r3) // Catch: java.lang.ClassNotFoundException -> L80 androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda1 r3 = new androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda1 // Catch: java.lang.ClassNotFoundException -> L80 r3.() // Catch: java.lang.ClassNotFoundException -> L80 goto L7f L6e: java.lang.String r2 = "androidx.media3.exoplayer.dash.DashMediaSource$Factory" java.lang.Class r2 = java.lang.Class.forName(r2) // Catch: java.lang.ClassNotFoundException -> L80 java.lang.Class r3 = androidx.media3.exoplayer.source.MediaSource.Factory.class java.lang.Class r2 = r2.asSubclass(r3) // Catch: java.lang.ClassNotFoundException -> L80 androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda0 r3 = new androidx.media3.exoplayer.source.DefaultMediaSourceFactory$DelegateFactoryLoader$$ExternalSyntheticLambda0 // Catch: java.lang.ClassNotFoundException -> L80 r3.() // Catch: java.lang.ClassNotFoundException -> L80 L7f: r1 = r3 L80: java.util.Map> r0 = r4.mediaSourceFactorySuppliers java.lang.Integer r2 = java.lang.Integer.valueOf(r5) r0.put(r2, r1) if (r1 == 0) goto L94 java.util.Set r4 = r4.supportedTypes java.lang.Integer r5 = java.lang.Integer.valueOf(r5) r4.add(r5) L94: return r1 */ throw new UnsupportedOperationException("Method not decompiled: androidx.media3.exoplayer.source.DefaultMediaSourceFactory.DelegateFactoryLoader.maybeLoadSupplier(int):com.google.common.base.Supplier"); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: lambda$maybeLoadSupplier$4$androidx-media3-exoplayer-source-DefaultMediaSourceFactory$DelegateFactoryLoader, reason: not valid java name */ public /* synthetic */ MediaSource.Factory m5258x6773ea8f(DataSource.Factory factory) { return new ProgressiveMediaSource.Factory(factory, this.extractorsFactory); } } /* JADX INFO: Access modifiers changed from: private */ /* loaded from: classes2.dex */ public static final class UnknownSubtitlesExtractor implements Extractor { private final Format format; @Override // androidx.media3.extractor.Extractor public void release() { } @Override // androidx.media3.extractor.Extractor public void seek(long j, long j2) { } @Override // androidx.media3.extractor.Extractor public boolean sniff(ExtractorInput extractorInput) { return true; } public UnknownSubtitlesExtractor(Format format) { this.format = format; } @Override // androidx.media3.extractor.Extractor public void init(ExtractorOutput extractorOutput) { TrackOutput track = extractorOutput.track(0, 3); extractorOutput.seekMap(new SeekMap.Unseekable(-9223372036854775807L)); extractorOutput.endTracks(); track.format(this.format.buildUpon().setSampleMimeType("text/x-unknown").setCodecs(this.format.sampleMimeType).build()); } @Override // androidx.media3.extractor.Extractor public int read(ExtractorInput extractorInput, PositionHolder positionHolder) throws IOException { return extractorInput.skip(Integer.MAX_VALUE) == -1 ? -1 : 0; } } /* JADX INFO: Access modifiers changed from: private */ public static MediaSource.Factory newInstance(Class cls, DataSource.Factory factory) { try { return cls.getConstructor(DataSource.Factory.class).newInstance(factory); } catch (Exception e) { throw new IllegalStateException(e); } } /* JADX INFO: Access modifiers changed from: private */ public static MediaSource.Factory newInstance(Class cls) { try { return cls.getConstructor(new Class[0]).newInstance(new Object[0]); } catch (Exception e) { throw new IllegalStateException(e); } } }