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
8a359bb1
authored
Dec 03, 2018
by
GiuseppePiscopo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(MediaSource): client code can get the tag of a MediaSource
parent
ffbb0da8
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
87 additions
and
0 deletions
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/LoopingMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.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
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java
extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsMediaSource.java
View file @
8a359bb1
...
...
@@ -101,6 +101,12 @@ public final class ImaAdsMediaSource extends BaseMediaSource implements SourceIn
}
@Override
@Nullable
public
Object
getTag
()
{
return
adsMediaSource
.
getTag
();
}
@Override
public
void
releaseSourceInternal
()
{
adsMediaSource
.
releaseSource
(
/* listener= */
this
);
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ClippingMediaSource.java
View file @
8a359bb1
...
...
@@ -225,6 +225,12 @@ public final class ClippingMediaSource extends CompositeMediaSource<Void> {
}
@Override
@Nullable
public
Object
getTag
()
{
return
mediaSource
.
getTag
();
}
@Override
public
void
releaseSourceInternal
()
{
super
.
releaseSourceInternal
();
clippingError
=
null
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java
View file @
8a359bb1
...
...
@@ -509,6 +509,12 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
}
@Override
@Nullable
public
Object
getTag
()
{
return
null
;
}
@Override
public
final
void
releaseSourceInternal
()
{
super
.
releaseSourceInternal
();
mediaSourceHolders
.
clear
();
...
...
@@ -1070,6 +1076,12 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
}
@Override
@Nullable
public
Object
getTag
()
{
return
null
;
}
@Override
protected
void
releaseSourceInternal
()
{
// Do nothing.
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
View file @
8a359bb1
...
...
@@ -396,6 +396,12 @@ public final class ExtractorMediaSource extends BaseMediaSource
}
@Override
@Nullable
public
Object
getTag
()
{
return
tag
;
}
@Override
public
void
releaseSourceInternal
()
{
// Do nothing.
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/LoopingMediaSource.java
View file @
8a359bb1
...
...
@@ -96,6 +96,12 @@ public final class LoopingMediaSource extends CompositeMediaSource<Void> {
}
@Override
@Nullable
public
Object
getTag
()
{
return
childSource
.
getTag
();
}
@Override
protected
void
onChildSourceInfoRefreshed
(
Void
id
,
MediaSource
mediaSource
,
Timeline
timeline
,
@Nullable
Object
manifest
)
{
Timeline
loopingTimeline
=
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSource.java
View file @
8a359bb1
...
...
@@ -276,6 +276,11 @@ public interface MediaSource {
void
releasePeriod
(
MediaPeriod
mediaPeriod
);
/**
* Returns the tag set on media source, or null when none was set.
*/
Object
getTag
();
/**
* Removes a listener for timeline and/or manifest updates and releases the source if no longer
* required.
*
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java
View file @
8a359bb1
...
...
@@ -138,6 +138,12 @@ public final class MergingMediaSource extends CompositeMediaSource<Integer> {
}
@Override
@Nullable
public
Object
getTag
()
{
return
mediaSources
.
length
>
0
?
mediaSources
[
0
].
getTag
()
:
null
;
}
@Override
public
void
releaseSourceInternal
()
{
super
.
releaseSourceInternal
();
Arrays
.
fill
(
timelines
,
null
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
View file @
8a359bb1
...
...
@@ -185,6 +185,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
boolean
treatLoadErrorsAsEndOfStream
;
private
final
Timeline
timeline
;
private
final
@Nullable
Object
tag
;
private
@Nullable
TransferListener
transferListener
;
...
...
@@ -287,6 +288,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
this
.
durationUs
=
durationUs
;
this
.
loadErrorHandlingPolicy
=
loadErrorHandlingPolicy
;
this
.
treatLoadErrorsAsEndOfStream
=
treatLoadErrorsAsEndOfStream
;
this
.
tag
=
tag
;
dataSpec
=
new
DataSpec
(
uri
,
DataSpec
.
FLAG_ALLOW_GZIP
|
DataSpec
.
FLAG_ALLOW_CACHING_UNKNOWN_LENGTH
);
timeline
=
...
...
@@ -328,6 +330,12 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
}
@Override
@Nullable
public
Object
getTag
()
{
return
tag
;
}
@Override
public
void
releaseSourceInternal
()
{
// Do nothing.
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ads/AdsMediaSource.java
View file @
8a359bb1
...
...
@@ -388,6 +388,12 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
}
@Override
@Nullable
public
Object
getTag
()
{
return
contentMediaSource
.
getTag
();
}
@Override
public
void
releaseSourceInternal
()
{
super
.
releaseSourceInternal
();
componentListener
.
release
();
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
View file @
8a359bb1
...
...
@@ -659,6 +659,12 @@ public final class DashMediaSource extends BaseMediaSource {
}
@Override
@Nullable
public
Object
getTag
()
{
return
tag
;
}
@Override
public
void
releaseSourceInternal
()
{
manifestLoadPending
=
false
;
dataSource
=
null
;
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java
View file @
8a359bb1
...
...
@@ -426,6 +426,12 @@ public final class HlsMediaSource extends BaseMediaSource
}
@Override
@Nullable
public
Object
getTag
()
{
return
tag
;
}
@Override
public
void
releaseSourceInternal
()
{
playlistTracker
.
stop
();
}
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java
View file @
8a359bb1
...
...
@@ -550,6 +550,12 @@ public final class SsMediaSource extends BaseMediaSource
}
@Override
@Nullable
public
Object
getTag
()
{
return
tag
;
}
@Override
public
void
releaseSourceInternal
()
{
manifest
=
sideloadedManifest
?
manifest
:
null
;
manifestDataSource
=
null
;
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaSource.java
View file @
8a359bb1
...
...
@@ -134,6 +134,14 @@ public class FakeMediaSource extends BaseMediaSource {
}
@Override
@Nullable
public
Object
getTag
()
{
boolean
hasTimeline
=
timeline
!=
null
&&
!
timeline
.
isEmpty
();
return
hasTimeline
?
timeline
.
getWindow
(
0
,
new
Timeline
.
Window
()).
tag
:
null
;
}
@Override
public
void
releaseSourceInternal
()
{
assertThat
(
preparedSource
).
isTrue
();
assertThat
(
releasedSource
).
isFalse
();
...
...
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