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
87405cb1
authored
Mar 09, 2020
by
bachinger
Committed by
Oliver Woodman
Mar 10, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
remove DefaultMediaSourceFactory.Delegate
PiperOrigin-RevId: 299943596
parent
fdf35776
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
36 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaSource.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
View file @
87405cb1
...
@@ -94,21 +94,6 @@ import java.util.Map;
...
@@ -94,21 +94,6 @@ import java.util.Map;
public
final
class
DefaultMediaSourceFactory
implements
MediaSourceFactory
{
public
final
class
DefaultMediaSourceFactory
implements
MediaSourceFactory
{
/**
/**
* A media source factory to which calls to {@link #createMediaSource(MediaItem)} calls are
* delegated by the {@link DefaultMediaSourceFactory}.
*/
public
interface
Delegate
extends
MediaSourceFactory
{
/**
* Sets an optional {@link LoadErrorHandlingPolicy}.
*
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @return This factory, for convenience.
*/
MediaSourceFactory
setLoadErrorHandlingPolicy
(
@Nullable
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
);
}
/**
* Creates a new instance with the given {@link Context}.
* Creates a new instance with the given {@link Context}.
*
*
* <p>This is functionally equivalent with calling {@code #newInstance(Context,
* <p>This is functionally equivalent with calling {@code #newInstance(Context,
...
@@ -134,7 +119,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
...
@@ -134,7 +119,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
return
new
DefaultMediaSourceFactory
(
context
,
dataSourceFactory
);
return
new
DefaultMediaSourceFactory
(
context
,
dataSourceFactory
);
}
}
private
final
SparseArray
<
Delegate
>
mediaSourceFactories
;
private
final
SparseArray
<
MediaSourceFactory
>
mediaSourceFactories
;
@C
.
ContentType
private
final
int
[]
supportedTypes
;
@C
.
ContentType
private
final
int
[]
supportedTypes
;
private
final
String
userAgent
;
private
final
String
userAgent
;
...
@@ -287,42 +272,43 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
...
@@ -287,42 +272,43 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
return
drmCallback
;
return
drmCallback
;
}
}
private
static
SparseArray
<
Delegate
>
loadDelegates
(
DataSource
.
Factory
dataSourceFactory
)
{
private
static
SparseArray
<
MediaSourceFactory
>
loadDelegates
(
SparseArray
<
Delegate
>
delegates
=
new
SparseArray
<>();
DataSource
.
Factory
dataSourceFactory
)
{
SparseArray
<
MediaSourceFactory
>
factories
=
new
SparseArray
<>();
// LINT.IfChange
// LINT.IfChange
try
{
try
{
Class
<?
extends
DefaultMediaSourceFactory
.
Delegate
>
factoryClazz
=
Class
<?
extends
MediaSourceFactory
>
factoryClazz
=
Class
.
forName
(
"com.google.android.exoplayer2.source.dash.DashMediaSource$Factory"
)
Class
.
forName
(
"com.google.android.exoplayer2.source.dash.DashMediaSource$Factory"
)
.
asSubclass
(
DefaultMediaSourceFactory
.
Delegate
.
class
);
.
asSubclass
(
MediaSourceFactory
.
class
);
delegat
es
.
put
(
factori
es
.
put
(
C
.
TYPE_DASH
,
C
.
TYPE_DASH
,
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// Expected if the app was built without the dash module.
// Expected if the app was built without the dash module.
}
}
try
{
try
{
Class
<?
extends
DefaultMediaSourceFactory
.
Delegate
>
factoryClazz
=
Class
<?
extends
MediaSourceFactory
>
factoryClazz
=
Class
.
forName
(
Class
.
forName
(
"com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory"
)
"com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory"
)
.
asSubclass
(
DefaultMediaSourceFactory
.
Delegate
.
class
);
.
asSubclass
(
MediaSourceFactory
.
class
);
delegat
es
.
put
(
factori
es
.
put
(
C
.
TYPE_SS
,
C
.
TYPE_SS
,
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// Expected if the app was built without the smoothstreaming module.
// Expected if the app was built without the smoothstreaming module.
}
}
try
{
try
{
Class
<?
extends
DefaultMediaSourceFactory
.
Delegate
>
factoryClazz
=
Class
<?
extends
MediaSourceFactory
>
factoryClazz
=
Class
.
forName
(
"com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory"
)
Class
.
forName
(
"com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory"
)
.
asSubclass
(
DefaultMediaSourceFactory
.
Delegate
.
class
);
.
asSubclass
(
MediaSourceFactory
.
class
);
delegat
es
.
put
(
factori
es
.
put
(
C
.
TYPE_HLS
,
C
.
TYPE_HLS
,
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
factoryClazz
.
getConstructor
(
DataSource
.
Factory
.
class
).
newInstance
(
dataSourceFactory
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// Expected if the app was built without the hls module.
// Expected if the app was built without the hls module.
}
}
// LINT.ThenChange(../../../../../../../../proguard-rules.txt)
// LINT.ThenChange(../../../../../../../../proguard-rules.txt)
delegat
es
.
put
(
C
.
TYPE_OTHER
,
new
ProgressiveMediaSource
.
Factory
(
dataSourceFactory
));
factori
es
.
put
(
C
.
TYPE_OTHER
,
new
ProgressiveMediaSource
.
Factory
(
dataSourceFactory
));
return
delegat
es
;
return
factori
es
;
}
}
}
}
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
View file @
87405cb1
...
@@ -136,6 +136,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
...
@@ -136,6 +136,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
@Override
public
Factory
setLoadErrorHandlingPolicy
(
public
Factory
setLoadErrorHandlingPolicy
(
@Nullable
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
)
{
@Nullable
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
)
{
this
.
loadErrorHandlingPolicy
=
this
.
loadErrorHandlingPolicy
=
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceFactory.java
View file @
87405cb1
...
@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.MediaItem;
...
@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.MediaItem;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.offline.StreamKey
;
import
com.google.android.exoplayer2.offline.StreamKey
;
import
com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy
;
import
java.util.List
;
import
java.util.List
;
/** Factory for creating {@link MediaSource}s from URIs. */
/** Factory for creating {@link MediaSource}s from URIs. */
...
@@ -42,6 +43,15 @@ public interface MediaSourceFactory {
...
@@ -42,6 +43,15 @@ public interface MediaSourceFactory {
MediaSourceFactory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
);
MediaSourceFactory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
);
/**
/**
* Sets an optional {@link LoadErrorHandlingPolicy}.
*
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @return This factory, for convenience.
*/
MediaSourceFactory
setLoadErrorHandlingPolicy
(
@Nullable
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
);
/**
* Returns the {@link C.ContentType content types} supported by media sources created by this
* Returns the {@link C.ContentType content types} supported by media sources created by this
* factory.
* factory.
*/
*/
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaSource.java
View file @
87405cb1
...
@@ -47,7 +47,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
...
@@ -47,7 +47,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
implements
ProgressiveMediaPeriod
.
Listener
{
implements
ProgressiveMediaPeriod
.
Listener
{
/** Factory for {@link ProgressiveMediaSource}s. */
/** Factory for {@link ProgressiveMediaSource}s. */
public
static
final
class
Factory
implements
DefaultMediaSourceFactory
.
Delegate
{
public
static
final
class
Factory
implements
MediaSourceFactory
{
private
final
DataSource
.
Factory
dataSourceFactory
;
private
final
DataSource
.
Factory
dataSourceFactory
;
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
View file @
87405cb1
...
@@ -33,11 +33,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
...
@@ -33,11 +33,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultMediaSourceFactory
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceFactory
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerEmsgCallback
;
import
com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerEmsgCallback
;
import
com.google.android.exoplayer2.source.dash.manifest.AdaptationSet
;
import
com.google.android.exoplayer2.source.dash.manifest.AdaptationSet
;
...
@@ -79,7 +79,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -79,7 +79,7 @@ public final class DashMediaSource extends BaseMediaSource {
}
}
/** Factory for {@link DashMediaSource}s. */
/** Factory for {@link DashMediaSource}s. */
public
static
final
class
Factory
implements
DefaultMediaSourceFactory
.
Delegate
{
public
static
final
class
Factory
implements
MediaSourceFactory
{
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java
View file @
87405cb1
...
@@ -31,11 +31,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
...
@@ -31,11 +31,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultMediaSourceFactory
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceFactory
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.SinglePeriodTimeline
;
import
com.google.android.exoplayer2.source.SinglePeriodTimeline
;
import
com.google.android.exoplayer2.source.hls.playlist.DefaultHlsPlaylistParserFactory
;
import
com.google.android.exoplayer2.source.hls.playlist.DefaultHlsPlaylistParserFactory
;
...
@@ -87,7 +87,7 @@ public final class HlsMediaSource extends BaseMediaSource
...
@@ -87,7 +87,7 @@ public final class HlsMediaSource extends BaseMediaSource
public
static
final
int
METADATA_TYPE_EMSG
=
3
;
public
static
final
int
METADATA_TYPE_EMSG
=
3
;
/** Factory for {@link HlsMediaSource}s. */
/** Factory for {@link HlsMediaSource}s. */
public
static
final
class
Factory
implements
DefaultMediaSourceFactory
.
Delegate
{
public
static
final
class
Factory
implements
MediaSourceFactory
{
private
final
HlsDataSourceFactory
hlsDataSourceFactory
;
private
final
HlsDataSourceFactory
hlsDataSourceFactory
;
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java
View file @
87405cb1
...
@@ -30,11 +30,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
...
@@ -30,11 +30,11 @@ import com.google.android.exoplayer2.offline.StreamKey;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.BaseMediaSource
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultCompositeSequenceableLoaderFactory
;
import
com.google.android.exoplayer2.source.DefaultMediaSourceFactory
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.source.MediaSourceFactory
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.SequenceableLoader
;
import
com.google.android.exoplayer2.source.SinglePeriodTimeline
;
import
com.google.android.exoplayer2.source.SinglePeriodTimeline
;
import
com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest
;
import
com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest
;
...
@@ -66,7 +66,7 @@ public final class SsMediaSource extends BaseMediaSource
...
@@ -66,7 +66,7 @@ public final class SsMediaSource extends BaseMediaSource
}
}
/** Factory for {@link SsMediaSource}. */
/** Factory for {@link SsMediaSource}. */
public
static
final
class
Factory
implements
DefaultMediaSourceFactory
.
Delegate
{
public
static
final
class
Factory
implements
MediaSourceFactory
{
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
...
...
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