Rabbit-R1/android (non root)/java/sources/androidx/media3/datasource/DefaultDataSourceFactory.java
2024-05-21 17:08:36 -04:00

46 lines
1.8 KiB
Java

package androidx.media3.datasource;
import android.content.Context;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultHttpDataSource;
@Deprecated
/* loaded from: classes2.dex */
public final class DefaultDataSourceFactory implements DataSource.Factory {
private final DataSource.Factory baseDataSourceFactory;
private final Context context;
private final TransferListener listener;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public DefaultDataSourceFactory(Context context) {
this(context, (String) null, (TransferListener) null);
}
public DefaultDataSourceFactory(Context context, String str) {
this(context, str, (TransferListener) null);
}
public DefaultDataSourceFactory(Context context, String str, TransferListener transferListener) {
this(context, transferListener, new DefaultHttpDataSource.Factory().setUserAgent(str));
}
public DefaultDataSourceFactory(Context context, DataSource.Factory factory) {
this(context, (TransferListener) null, factory);
}
public DefaultDataSourceFactory(Context context, TransferListener transferListener, DataSource.Factory factory) {
this.context = context.getApplicationContext();
this.listener = transferListener;
this.baseDataSourceFactory = factory;
}
@Override // androidx.media3.datasource.DataSource.Factory
public DefaultDataSource createDataSource() {
DefaultDataSource defaultDataSource = new DefaultDataSource(this.context, this.baseDataSourceFactory.createDataSource());
TransferListener transferListener = this.listener;
if (transferListener != null) {
defaultDataSource.addTransferListener(transferListener);
}
return defaultDataSource;
}
}