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
5324dc37
authored
Jun 11, 2020
by
olly
Committed by
Oliver Woodman
Jun 12, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Support passing custom manifest parsers to Downloaders
Issue: #5978 PiperOrigin-RevId: 315941765
parent
73283d49
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
4 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/SegmentDownloader.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloader.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloader.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloader.java
library/core/src/main/java/com/google/android/exoplayer2/offline/SegmentDownloader.java
View file @
5324dc37
...
@@ -82,7 +82,7 @@ public abstract class SegmentDownloader<M extends FilterableManifest<M>> impleme
...
@@ -82,7 +82,7 @@ public abstract class SegmentDownloader<M extends FilterableManifest<M>> impleme
/**
/**
* @param mediaItem The {@link MediaItem} to be downloaded.
* @param mediaItem The {@link MediaItem} to be downloaded.
* @param manifestParser A parser for
the manifest
.
* @param manifestParser A parser for
manifests belonging to the media to be downloaded
.
* @param cacheDataSourceFactory A {@link CacheDataSource.Factory} for the cache into which the
* @param cacheDataSourceFactory A {@link CacheDataSource.Factory} for the cache into which the
* download will be written.
* download will be written.
* @param executor An {@link Executor} used to make requests for the media being downloaded.
* @param executor An {@link Executor} used to make requests for the media being downloaded.
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloader.java
View file @
5324dc37
...
@@ -34,6 +34,7 @@ import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
...
@@ -34,6 +34,7 @@ import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
import
com.google.android.exoplayer2.source.dash.manifest.Representation
;
import
com.google.android.exoplayer2.source.dash.manifest.Representation
;
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.ParsingLoadable.Parser
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -115,7 +116,26 @@ public final class DashDownloader extends SegmentDownloader<DashManifest> {
...
@@ -115,7 +116,26 @@ public final class DashDownloader extends SegmentDownloader<DashManifest> {
*/
*/
public
DashDownloader
(
public
DashDownloader
(
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
mediaItem
,
new
DashManifestParser
(),
cacheDataSourceFactory
,
executor
);
this
(
mediaItem
,
new
DashManifestParser
(),
cacheDataSourceFactory
,
executor
);
}
/**
* Creates a new instance.
*
* @param mediaItem The {@link MediaItem} to be downloaded.
* @param manifestParser A parser for DASH manifests.
* @param cacheDataSourceFactory A {@link CacheDataSource.Factory} for the cache into which the
* download will be written.
* @param executor An {@link Executor} used to make requests for the media being downloaded.
* Providing an {@link Executor} that uses multiple threads will speed up the download by
* allowing parts of it to be executed in parallel.
*/
public
DashDownloader
(
MediaItem
mediaItem
,
Parser
<
DashManifest
>
manifestParser
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
mediaItem
,
manifestParser
,
cacheDataSourceFactory
,
executor
);
}
}
@Override
@Override
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloader.java
View file @
5324dc37
...
@@ -26,6 +26,7 @@ import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist;
...
@@ -26,6 +26,7 @@ import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist;
import
com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser
;
import
com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser
;
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.ParsingLoadable.Parser
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
com.google.android.exoplayer2.util.UriUtil
;
import
com.google.android.exoplayer2.util.UriUtil
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -110,7 +111,26 @@ public final class HlsDownloader extends SegmentDownloader<HlsPlaylist> {
...
@@ -110,7 +111,26 @@ public final class HlsDownloader extends SegmentDownloader<HlsPlaylist> {
*/
*/
public
HlsDownloader
(
public
HlsDownloader
(
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
mediaItem
,
new
HlsPlaylistParser
(),
cacheDataSourceFactory
,
executor
);
this
(
mediaItem
,
new
HlsPlaylistParser
(),
cacheDataSourceFactory
,
executor
);
}
/**
* Creates a new instance.
*
* @param mediaItem The {@link MediaItem} to be downloaded.
* @param manifestParser A parser for HLS playlists.
* @param cacheDataSourceFactory A {@link CacheDataSource.Factory} for the cache into which the
* download will be written.
* @param executor An {@link Executor} used to make requests for the media being downloaded.
* Providing an {@link Executor} that uses multiple threads will speed up the download by
* allowing parts of it to be executed in parallel.
*/
public
HlsDownloader
(
MediaItem
mediaItem
,
Parser
<
HlsPlaylist
>
manifestParser
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
mediaItem
,
manifestParser
,
cacheDataSourceFactory
,
executor
);
}
}
@Override
@Override
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloader.java
View file @
5324dc37
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifestP
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifestP
import
com.google.android.exoplayer2.source.smoothstreaming.manifest.SsUtil
;
import
com.google.android.exoplayer2.source.smoothstreaming.manifest.SsUtil
;
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.ParsingLoadable.Parser
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
com.google.android.exoplayer2.upstream.cache.CacheDataSource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -108,7 +109,7 @@ public final class SsDownloader extends SegmentDownloader<SsManifest> {
...
@@ -108,7 +109,7 @@ public final class SsDownloader extends SegmentDownloader<SsManifest> {
*/
*/
public
SsDownloader
(
public
SsDownloader
(
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
MediaItem
mediaItem
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
this
(
mediaItem
mediaItem
.
buildUpon
()
.
buildUpon
()
.
setUri
(
SsUtil
.
fixManifestUri
(
checkNotNull
(
mediaItem
.
playbackProperties
).
uri
))
.
setUri
(
SsUtil
.
fixManifestUri
(
checkNotNull
(
mediaItem
.
playbackProperties
).
uri
))
...
@@ -118,6 +119,25 @@ public final class SsDownloader extends SegmentDownloader<SsManifest> {
...
@@ -118,6 +119,25 @@ public final class SsDownloader extends SegmentDownloader<SsManifest> {
executor
);
executor
);
}
}
/**
* Creates a new instance.
*
* @param mediaItem The {@link MediaItem} to be downloaded.
* @param manifestParser A parser for SmoothStreaming manifests.
* @param cacheDataSourceFactory A {@link CacheDataSource.Factory} for the cache into which the
* download will be written.
* @param executor An {@link Executor} used to make requests for the media being downloaded.
* Providing an {@link Executor} that uses multiple threads will speed up the download by
* allowing parts of it to be executed in parallel.
*/
public
SsDownloader
(
MediaItem
mediaItem
,
Parser
<
SsManifest
>
manifestParser
,
CacheDataSource
.
Factory
cacheDataSourceFactory
,
Executor
executor
)
{
super
(
mediaItem
,
manifestParser
,
cacheDataSourceFactory
,
executor
);
}
@Override
@Override
protected
List
<
Segment
>
getSegments
(
protected
List
<
Segment
>
getSegments
(
DataSource
dataSource
,
SsManifest
manifest
,
boolean
allowIncompleteList
)
{
DataSource
dataSource
,
SsManifest
manifest
,
boolean
allowIncompleteList
)
{
...
...
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