Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3efe3205
authored
May 21, 2019
by
olly
Committed by
Toni
May 23, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove deprecated DataSource constructors
PiperOrigin-RevId: 249276112
parent
52888ab5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
7 additions
and
281 deletions
extensions/rtmp/src/main/java/com/google/android/exoplayer2/ext/rtmp/RtmpDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/FileDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/UdpDataSource.java
extensions/rtmp/src/main/java/com/google/android/exoplayer2/ext/rtmp/RtmpDataSource.java
View file @
3efe3205
...
@@ -18,13 +18,11 @@ package com.google.android.exoplayer2.ext.rtmp;
...
@@ -18,13 +18,11 @@ package com.google.android.exoplayer2.ext.rtmp;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Util
.
castNonNull
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Util
.
castNonNull
;
import
android.net.Uri
;
import
android.net.Uri
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.upstream.BaseDataSource
;
import
com.google.android.exoplayer2.upstream.BaseDataSource
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.TransferListener
;
import
java.io.IOException
;
import
java.io.IOException
;
import
net.butterflytv.rtmp_client.RtmpClient
;
import
net.butterflytv.rtmp_client.RtmpClient
;
import
net.butterflytv.rtmp_client.RtmpClient.RtmpIOException
;
import
net.butterflytv.rtmp_client.RtmpClient.RtmpIOException
;
...
@@ -43,18 +41,6 @@ public final class RtmpDataSource extends BaseDataSource {
...
@@ -43,18 +41,6 @@ public final class RtmpDataSource extends BaseDataSource {
super
(
/* isNetwork= */
true
);
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
RtmpIOException
{
public
long
open
(
DataSpec
dataSpec
)
throws
RtmpIOException
{
transferInitializing
(
dataSpec
);
transferInitializing
(
dataSpec
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/AssetDataSource.java
View file @
3efe3205
...
@@ -51,20 +51,6 @@ public final class AssetDataSource extends BaseDataSource {
...
@@ -51,20 +51,6 @@ public final class AssetDataSource extends BaseDataSource {
this
.
assetManager
=
context
.
getAssets
();
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
AssetDataSourceException
{
public
long
open
(
DataSpec
dataSpec
)
throws
AssetDataSourceException
{
try
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java
View file @
3efe3205
...
@@ -57,20 +57,6 @@ public final class ContentDataSource extends BaseDataSource {
...
@@ -57,20 +57,6 @@ public final class ContentDataSource extends BaseDataSource {
this
.
resolver
=
context
.
getContentResolver
();
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
ContentDataSourceException
{
public
long
open
(
DataSpec
dataSpec
)
throws
ContentDataSourceException
{
try
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
View file @
3efe3205
...
@@ -43,9 +43,9 @@ import java.util.Map;
...
@@ -43,9 +43,9 @@ import java.util.Map;
* explicit dependency on ExoPlayer's RTMP extension.
* explicit dependency on ExoPlayer's RTMP extension.
* <li>data: For parsing data inlined in the URI as defined in RFC 2397.
* <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),
* <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,
* if constructed using {@link #DefaultDataSource(Context,
String, boolean)}, or any other
*
boolean)}, or any other
schemes supported by a base data source if constructed using {@link
* schemes supported by a base data source if constructed using {@link
* #DefaultDataSource(Context,
TransferListener,
DataSource)}.
* #DefaultDataSource(Context, DataSource)}.
* </ul>
* </ul>
*/
*/
public
final
class
DefaultDataSource
implements
DataSource
{
public
final
class
DefaultDataSource
implements
DataSource
{
...
@@ -131,85 +131,6 @@ public final class DefaultDataSource implements DataSource {
...
@@ -131,85 +131,6 @@ public final class DefaultDataSource implements DataSource {
transferListeners
=
new
ArrayList
<>();
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
@Override
public
void
addTransferListener
(
TransferListener
transferListener
)
{
public
void
addTransferListener
(
TransferListener
transferListener
)
{
baseDataSource
.
addTransferListener
(
transferListener
);
baseDataSource
.
addTransferListener
(
transferListener
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSourceFactory.java
View file @
3efe3205
...
@@ -51,7 +51,7 @@ public final class DefaultDataSourceFactory implements Factory {
...
@@ -51,7 +51,7 @@ public final class DefaultDataSourceFactory implements Factory {
* @param context A context.
* @param context A context.
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
* for {@link DefaultDataSource}.
* for {@link DefaultDataSource}.
* @see DefaultDataSource#DefaultDataSource(Context,
TransferListener,
DataSource)
* @see DefaultDataSource#DefaultDataSource(Context, DataSource)
*/
*/
public
DefaultDataSourceFactory
(
Context
context
,
DataSource
.
Factory
baseDataSourceFactory
)
{
public
DefaultDataSourceFactory
(
Context
context
,
DataSource
.
Factory
baseDataSourceFactory
)
{
this
(
context
,
/* listener= */
null
,
baseDataSourceFactory
);
this
(
context
,
/* listener= */
null
,
baseDataSourceFactory
);
...
@@ -62,7 +62,7 @@ public final class DefaultDataSourceFactory implements Factory {
...
@@ -62,7 +62,7 @@ public final class DefaultDataSourceFactory implements Factory {
* @param listener An optional listener.
* @param listener An optional listener.
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
* @param baseDataSourceFactory A {@link Factory} to be used to create a base {@link DataSource}
* for {@link DefaultDataSource}.
* for {@link DefaultDataSource}.
* @see DefaultDataSource#DefaultDataSource(Context,
TransferListener,
DataSource)
* @see DefaultDataSource#DefaultDataSource(Context, DataSource)
*/
*/
public
DefaultDataSourceFactory
(
public
DefaultDataSourceFactory
(
Context
context
,
Context
context
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java
View file @
3efe3205
...
@@ -47,8 +47,8 @@ import java.util.regex.Pattern;
...
@@ -47,8 +47,8 @@ import java.util.regex.Pattern;
*
*
* <p>By default this implementation will not follow cross-protocol redirects (i.e. redirects from
* <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
* HTTP to HTTPS or vice versa). Cross-protocol redirects can be enabled by using the {@link
* #DefaultHttpDataSource(String, Predicate,
TransferListener, int, int, boolean,
* #DefaultHttpDataSource(String, Predicate,
int, int, boolean, RequestProperties)} constructor and
*
RequestProperties)} constructor and
passing {@code true} as the second last argument.
* passing {@code true} as the second last argument.
*/
*/
public
class
DefaultHttpDataSource
extends
BaseDataSource
implements
HttpDataSource
{
public
class
DefaultHttpDataSource
extends
BaseDataSource
implements
HttpDataSource
{
...
@@ -164,89 +164,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
...
@@ -164,89 +164,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
this
.
defaultRequestProperties
=
defaultRequestProperties
;
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
@Override
public
@Nullable
Uri
getUri
()
{
public
@Nullable
Uri
getUri
()
{
return
connection
==
null
?
null
:
Uri
.
parse
(
connection
.
getURL
().
toString
());
return
connection
==
null
?
null
:
Uri
.
parse
(
connection
.
getURL
().
toString
());
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/FileDataSource.java
View file @
3efe3205
...
@@ -45,18 +45,6 @@ public final class FileDataSource extends BaseDataSource {
...
@@ -45,18 +45,6 @@ public final class FileDataSource extends BaseDataSource {
super
(
/* isNetwork= */
false
);
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
FileDataSourceException
{
public
long
open
(
DataSpec
dataSpec
)
throws
FileDataSourceException
{
try
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java
View file @
3efe3205
...
@@ -78,20 +78,6 @@ public final class RawResourceDataSource extends BaseDataSource {
...
@@ -78,20 +78,6 @@ public final class RawResourceDataSource extends BaseDataSource {
this
.
resources
=
context
.
getResources
();
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
RawResourceDataSourceException
{
public
long
open
(
DataSpec
dataSpec
)
throws
RawResourceDataSourceException
{
try
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/UdpDataSource.java
View file @
3efe3205
...
@@ -88,50 +88,6 @@ public final class UdpDataSource extends BaseDataSource {
...
@@ -88,50 +88,6 @@ public final class UdpDataSource extends BaseDataSource {
packet
=
new
DatagramPacket
(
packetBuffer
,
0
,
maxPacketSize
);
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
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
UdpDataSourceException
{
public
long
open
(
DataSpec
dataSpec
)
throws
UdpDataSourceException
{
uri
=
dataSpec
.
uri
;
uri
=
dataSpec
.
uri
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment