mirror of
https://github.com/samsonjs/media.git
synced 2026-04-03 10:55:48 +00:00
Remove deprecated DataSource constructors
PiperOrigin-RevId: 249276112
This commit is contained in:
parent
52888ab55b
commit
3efe320535
9 changed files with 7 additions and 281 deletions
|
|
@ -18,13 +18,11 @@ package com.google.android.exoplayer2.ext.rtmp;
|
|||
import static com.google.android.exoplayer2.util.Util.castNonNull;
|
||||
|
||||
import android.net.Uri;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.upstream.BaseDataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||
import java.io.IOException;
|
||||
import net.butterflytv.rtmp_client.RtmpClient;
|
||||
import net.butterflytv.rtmp_client.RtmpClient.RtmpIOException;
|
||||
|
|
@ -43,18 +41,6 @@ public final class RtmpDataSource extends BaseDataSource {
|
|||
super(/* isNetwork= */ true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #RtmpDataSource()} and {@link #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public RtmpDataSource(@Nullable TransferListener listener) {
|
||||
this();
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws RtmpIOException {
|
||||
transferInitializing(dataSpec);
|
||||
|
|
|
|||
|
|
@ -51,20 +51,6 @@ public final class AssetDataSource extends BaseDataSource {
|
|||
this.assetManager = context.getAssets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #AssetDataSource(Context)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public AssetDataSource(Context context, @Nullable TransferListener listener) {
|
||||
this(context);
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws AssetDataSourceException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -57,20 +57,6 @@ public final class ContentDataSource extends BaseDataSource {
|
|||
this.resolver = context.getContentResolver();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #ContentDataSource(Context)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public ContentDataSource(Context context, @Nullable TransferListener listener) {
|
||||
this(context);
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws ContentDataSourceException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ import java.util.Map;
|
|||
* explicit dependency on ExoPlayer's RTMP extension.
|
||||
* <li>data: For parsing data inlined in the URI as defined in RFC 2397.
|
||||
* <li>http(s): For fetching data over HTTP and HTTPS (e.g. https://www.something.com/media.mp4),
|
||||
* if constructed using {@link #DefaultDataSource(Context, TransferListener, String,
|
||||
* boolean)}, or any other schemes supported by a base data source if constructed using {@link
|
||||
* #DefaultDataSource(Context, TransferListener, DataSource)}.
|
||||
* if constructed using {@link #DefaultDataSource(Context, String, boolean)}, or any other
|
||||
* schemes supported by a base data source if constructed using {@link
|
||||
* #DefaultDataSource(Context, DataSource)}.
|
||||
* </ul>
|
||||
*/
|
||||
public final class DefaultDataSource implements DataSource {
|
||||
|
|
@ -131,85 +131,6 @@ public final class DefaultDataSource implements DataSource {
|
|||
transferListeners = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance, optionally configured to follow cross-protocol redirects.
|
||||
*
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @param userAgent The User-Agent to use when requesting remote data.
|
||||
* @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
|
||||
* to HTTPS and vice versa) are enabled when fetching remote data.
|
||||
* @deprecated Use {@link #DefaultDataSource(Context, String, boolean)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public DefaultDataSource(
|
||||
Context context,
|
||||
@Nullable TransferListener listener,
|
||||
String userAgent,
|
||||
boolean allowCrossProtocolRedirects) {
|
||||
this(context, listener, userAgent, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
|
||||
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance, optionally configured to follow cross-protocol redirects.
|
||||
*
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @param userAgent The User-Agent to use when requesting remote data.
|
||||
* @param connectTimeoutMillis The connection timeout that should be used when requesting remote
|
||||
* data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
|
||||
* @param readTimeoutMillis The read timeout that should be used when requesting remote data, in
|
||||
* milliseconds. A timeout of zero is interpreted as an infinite timeout.
|
||||
* @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
|
||||
* to HTTPS and vice versa) are enabled when fetching remote data.
|
||||
* @deprecated Use {@link #DefaultDataSource(Context, String, int, int, boolean)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public DefaultDataSource(
|
||||
Context context,
|
||||
@Nullable TransferListener listener,
|
||||
String userAgent,
|
||||
int connectTimeoutMillis,
|
||||
int readTimeoutMillis,
|
||||
boolean allowCrossProtocolRedirects) {
|
||||
this(
|
||||
context,
|
||||
listener,
|
||||
new DefaultHttpDataSource(
|
||||
userAgent,
|
||||
/* contentTypePredicate= */ null,
|
||||
listener,
|
||||
connectTimeoutMillis,
|
||||
readTimeoutMillis,
|
||||
allowCrossProtocolRedirects,
|
||||
/* defaultRequestProperties= */ null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance that delegates to a provided {@link DataSource} for URI schemes other
|
||||
* than file, asset and content.
|
||||
*
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @param baseDataSource A {@link DataSource} to use for URI schemes other than file, asset and
|
||||
* content. This {@link DataSource} should normally support at least http(s).
|
||||
* @deprecated Use {@link #DefaultDataSource(Context, DataSource)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultDataSource(
|
||||
Context context, @Nullable TransferListener listener, DataSource baseDataSource) {
|
||||
this(context, baseDataSource);
|
||||
if (listener != null) {
|
||||
transferListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTransferListener(TransferListener transferListener) {
|
||||
baseDataSource.addTransferListener(transferListener);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public final class DefaultDataSourceFactory implements Factory {
|
|||
* @param context A context.
|
||||
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
|
||||
* for {@link DefaultDataSource}.
|
||||
* @see DefaultDataSource#DefaultDataSource(Context, TransferListener, DataSource)
|
||||
* @see DefaultDataSource#DefaultDataSource(Context, DataSource)
|
||||
*/
|
||||
public DefaultDataSourceFactory(Context context, DataSource.Factory baseDataSourceFactory) {
|
||||
this(context, /* listener= */ null, baseDataSourceFactory);
|
||||
|
|
@ -62,7 +62,7 @@ public final class DefaultDataSourceFactory implements Factory {
|
|||
* @param listener An optional listener.
|
||||
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
|
||||
* for {@link DefaultDataSource}.
|
||||
* @see DefaultDataSource#DefaultDataSource(Context, TransferListener, DataSource)
|
||||
* @see DefaultDataSource#DefaultDataSource(Context, DataSource)
|
||||
*/
|
||||
public DefaultDataSourceFactory(
|
||||
Context context,
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ import java.util.regex.Pattern;
|
|||
*
|
||||
* <p>By default this implementation will not follow cross-protocol redirects (i.e. redirects from
|
||||
* HTTP to HTTPS or vice versa). Cross-protocol redirects can be enabled by using the {@link
|
||||
* #DefaultHttpDataSource(String, Predicate, TransferListener, int, int, boolean,
|
||||
* RequestProperties)} constructor and passing {@code true} as the second last argument.
|
||||
* #DefaultHttpDataSource(String, Predicate, int, int, boolean, RequestProperties)} constructor and
|
||||
* passing {@code true} as the second last argument.
|
||||
*/
|
||||
public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSource {
|
||||
|
||||
|
|
@ -164,89 +164,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
|||
this.defaultRequestProperties = defaultRequestProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userAgent The User-Agent string that should be used.
|
||||
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
|
||||
* predicate then a {@link HttpDataSource.InvalidContentTypeException} is thrown from {@link
|
||||
* #open(DataSpec)}.
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #DefaultHttpDataSource(String, Predicate)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public DefaultHttpDataSource(
|
||||
String userAgent,
|
||||
@Nullable Predicate<String> contentTypePredicate,
|
||||
@Nullable TransferListener listener) {
|
||||
this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS,
|
||||
DEFAULT_READ_TIMEOUT_MILLIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userAgent The User-Agent string that should be used.
|
||||
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
|
||||
* predicate then a {@link HttpDataSource.InvalidContentTypeException} is thrown from {@link
|
||||
* #open(DataSpec)}.
|
||||
* @param listener An optional listener.
|
||||
* @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
|
||||
* interpreted as an infinite timeout.
|
||||
* @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
|
||||
* an infinite timeout.
|
||||
* @deprecated Use {@link #DefaultHttpDataSource(String, Predicate, int, int)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public DefaultHttpDataSource(
|
||||
String userAgent,
|
||||
@Nullable Predicate<String> contentTypePredicate,
|
||||
@Nullable TransferListener listener,
|
||||
int connectTimeoutMillis,
|
||||
int readTimeoutMillis) {
|
||||
this(userAgent, contentTypePredicate, listener, connectTimeoutMillis, readTimeoutMillis, false,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userAgent The User-Agent string that should be used.
|
||||
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
|
||||
* predicate then a {@link HttpDataSource.InvalidContentTypeException} is thrown from {@link
|
||||
* #open(DataSpec)}.
|
||||
* @param listener An optional listener.
|
||||
* @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
|
||||
* interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
|
||||
* default value.
|
||||
* @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
|
||||
* an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
|
||||
* @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
|
||||
* to HTTPS and vice versa) are enabled.
|
||||
* @param defaultRequestProperties The default request properties to be sent to the server as HTTP
|
||||
* headers or {@code null} if not required.
|
||||
* @deprecated Use {@link #DefaultHttpDataSource(String, Predicate, int, int, boolean,
|
||||
* RequestProperties)} and {@link #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public DefaultHttpDataSource(
|
||||
String userAgent,
|
||||
@Nullable Predicate<String> contentTypePredicate,
|
||||
@Nullable TransferListener listener,
|
||||
int connectTimeoutMillis,
|
||||
int readTimeoutMillis,
|
||||
boolean allowCrossProtocolRedirects,
|
||||
@Nullable RequestProperties defaultRequestProperties) {
|
||||
this(
|
||||
userAgent,
|
||||
contentTypePredicate,
|
||||
connectTimeoutMillis,
|
||||
readTimeoutMillis,
|
||||
allowCrossProtocolRedirects,
|
||||
defaultRequestProperties);
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Uri getUri() {
|
||||
return connection == null ? null : Uri.parse(connection.getURL().toString());
|
||||
|
|
|
|||
|
|
@ -45,18 +45,6 @@ public final class FileDataSource extends BaseDataSource {
|
|||
super(/* isNetwork= */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #FileDataSource()} and {@link #addTransferListener(TransferListener)}
|
||||
*/
|
||||
@Deprecated
|
||||
public FileDataSource(@Nullable TransferListener listener) {
|
||||
this();
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws FileDataSourceException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -78,20 +78,6 @@ public final class RawResourceDataSource extends BaseDataSource {
|
|||
this.resources = context.getResources();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context A context.
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #RawResourceDataSource(Context)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public RawResourceDataSource(Context context, @Nullable TransferListener listener) {
|
||||
this(context);
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws RawResourceDataSourceException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -88,50 +88,6 @@ public final class UdpDataSource extends BaseDataSource {
|
|||
packet = new DatagramPacket(packetBuffer, 0, maxPacketSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
*
|
||||
* @param listener An optional listener.
|
||||
* @deprecated Use {@link #UdpDataSource()} and {@link #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public UdpDataSource(@Nullable TransferListener listener) {
|
||||
this(listener, DEFAULT_MAX_PACKET_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
*
|
||||
* @param listener An optional listener.
|
||||
* @param maxPacketSize The maximum datagram packet size, in bytes.
|
||||
* @deprecated Use {@link #UdpDataSource(int)} and {@link #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public UdpDataSource(@Nullable TransferListener listener, int maxPacketSize) {
|
||||
this(listener, maxPacketSize, DEFAULT_SOCKET_TIMEOUT_MILLIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
*
|
||||
* @param listener An optional listener.
|
||||
* @param maxPacketSize The maximum datagram packet size, in bytes.
|
||||
* @param socketTimeoutMillis The socket timeout in milliseconds. A timeout of zero is interpreted
|
||||
* as an infinite timeout.
|
||||
* @deprecated Use {@link #UdpDataSource(int, int)} and {@link
|
||||
* #addTransferListener(TransferListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public UdpDataSource(
|
||||
@Nullable TransferListener listener, int maxPacketSize, int socketTimeoutMillis) {
|
||||
this(maxPacketSize, socketTimeoutMillis);
|
||||
if (listener != null) {
|
||||
addTransferListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws UdpDataSourceException {
|
||||
uri = dataSpec.uri;
|
||||
|
|
|
|||
Loading…
Reference in a new issue