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
5183eaaf
authored
Sep 07, 2021
by
samrobinson
Committed by
Ian Baker
Sep 07, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add open @IntDef for track selection reasons.
#exofixit PiperOrigin-RevId: 395217458
parent
7129d84e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
58 additions
and
34 deletions
library/common/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
library/core/src/main/java/com/google/android/exoplayer2/source/MediaLoadData.java
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BaseMediaChunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/DataChunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/InitializationChunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/MediaChunk.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/SingleSampleMediaChunk.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaChunk.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaChunk.java
library/common/src/main/java/com/google/android/exoplayer2/C.java
View file @
5183eaaf
...
...
@@ -696,6 +696,24 @@ public final class C {
*/
public
static
final
int
TRACK_TYPE_CUSTOM_BASE
=
10000
;
/**
* Represents a reason for selection. May be one of {@link #SELECTION_REASON_UNKNOWN}, {@link
* #SELECTION_REASON_INITIAL}, {@link #SELECTION_REASON_MANUAL}, {@link
* #SELECTION_REASON_ADAPTIVE} or {@link #SELECTION_REASON_TRICK_PLAY}. May also be an app-defined
* value (see {@link #SELECTION_REASON_CUSTOM_BASE}).
*/
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
(
open
=
true
,
value
=
{
SELECTION_REASON_UNKNOWN
,
SELECTION_REASON_INITIAL
,
SELECTION_REASON_MANUAL
,
SELECTION_REASON_ADAPTIVE
,
SELECTION_REASON_TRICK_PLAY
})
public
@interface
SelectionReason
{}
/** A selection reason constant for selections whose reasons are unknown or unspecified. */
public
static
final
int
SELECTION_REASON_UNKNOWN
=
0
;
/** A selection reason constant for an initial track selection. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
View file @
5183eaaf
...
...
@@ -1096,6 +1096,7 @@ public final class DownloadHelper {
}
@Override
@C
.
SelectionReason
public
int
getSelectionReason
()
{
return
C
.
SELECTION_REASON_UNKNOWN
;
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaLoadData.java
View file @
5183eaaf
...
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.source;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.C.SelectionReason
;
import
com.google.android.exoplayer2.C.TrackType
;
import
com.google.android.exoplayer2.Format
;
...
...
@@ -37,8 +38,8 @@ public final class MediaLoadData {
*/
@Nullable
public
final
Format
trackFormat
;
/**
* One of the {@link
C} {@code SELECTION_REASON_*} constants if the data belongs to a track.
*
{@link
C#SELECTION_REASON_UNKNOWN} otherwise.
* One of the {@link
SelectionReason selection reasons} if the data belongs to a track. {@link
* C#SELECTION_REASON_UNKNOWN} otherwise.
*/
public
final
int
trackSelectionReason
;
/**
...
...
@@ -82,9 +83,9 @@ public final class MediaLoadData {
*/
public
MediaLoadData
(
@DataType
int
dataType
,
int
trackType
,
@TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaStartTimeMs
,
long
mediaEndTimeMs
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java
View file @
5183eaaf
...
...
@@ -229,9 +229,9 @@ public interface MediaSourceEventListener {
public
void
loadStarted
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
,
int
trackType
,
@C
.
TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaStartTimeUs
,
long
mediaEndTimeUs
)
{
...
...
@@ -274,9 +274,9 @@ public interface MediaSourceEventListener {
public
void
loadCompleted
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
,
int
trackType
,
@C
.
TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaStartTimeUs
,
long
mediaEndTimeUs
)
{
...
...
@@ -320,9 +320,9 @@ public interface MediaSourceEventListener {
public
void
loadCanceled
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
,
int
trackType
,
@C
.
TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaStartTimeUs
,
long
mediaEndTimeUs
)
{
...
...
@@ -378,9 +378,9 @@ public interface MediaSourceEventListener {
public
void
loadError
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
,
int
trackType
,
@C
.
TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaStartTimeUs
,
long
mediaEndTimeUs
,
...
...
@@ -445,9 +445,9 @@ public interface MediaSourceEventListener {
/** Dispatches {@link #onDownstreamFormatChanged(int, MediaPeriodId, MediaLoadData)}. */
public
void
downstreamFormatChanged
(
int
trackType
,
@C
.
TrackType
int
trackType
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
mediaTimeUs
)
{
downstreamFormatChanged
(
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/BaseMediaChunk.java
View file @
5183eaaf
...
...
@@ -58,7 +58,7 @@ public abstract class BaseMediaChunk extends MediaChunk {
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java
View file @
5183eaaf
...
...
@@ -44,11 +44,11 @@ public abstract class Chunk implements Loadable {
/** The format of the track to which this chunk belongs. */
public
final
Format
trackFormat
;
/**
* One of the {@link C
} {@code SELECTION_REASON_*} constants if the chunk belongs to a track.
*
{@link C#SELECTION_REASON_UNKNOWN} if the chunk does not belong to a track, or if the selecti
on
*
reason
is unknown.
* One of the {@link C
.SelectionReason selection reasons} if the chunk belongs to a track. {@link
*
C#SELECTION_REASON_UNKNOWN} if the chunk does not belong to a track, or if the selection reas
on
* is unknown.
*/
public
final
int
trackSelectionReason
;
@C
.
SelectionReason
public
final
int
trackSelectionReason
;
/**
* Optional data associated with the selection of the track to which this chunk belongs. Null if
* the chunk does not belong to a track, or if there is no associated track selection data.
...
...
@@ -82,7 +82,7 @@ public abstract class Chunk implements Loadable {
DataSpec
dataSpec
,
@DataType
int
type
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ContainerMediaChunk.java
View file @
5183eaaf
...
...
@@ -61,7 +61,7 @@ public class ContainerMediaChunk extends BaseMediaChunk {
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/DataChunk.java
View file @
5183eaaf
...
...
@@ -51,7 +51,7 @@ public abstract class DataChunk extends Chunk {
DataSpec
dataSpec
,
@DataType
int
type
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
@Nullable
byte
[]
data
)
{
super
(
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/InitializationChunk.java
View file @
5183eaaf
...
...
@@ -51,7 +51,7 @@ public final class InitializationChunk extends Chunk {
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
ChunkExtractor
chunkExtractor
)
{
super
(
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/MediaChunk.java
View file @
5183eaaf
...
...
@@ -42,7 +42,7 @@ public abstract class MediaChunk extends Chunk {
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/SingleSampleMediaChunk.java
View file @
5183eaaf
...
...
@@ -52,7 +52,7 @@ public final class SingleSampleMediaChunk extends BaseMediaChunk {
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
,
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DefaultDashChunkSource.java
View file @
5183eaaf
...
...
@@ -609,7 +609,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
RepresentationHolder
representationHolder
,
DataSource
dataSource
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
Object
trackSelectionData
,
@Nullable
RangedUri
initializationUri
,
RangedUri
indexUri
)
{
...
...
@@ -644,9 +644,9 @@ public class DefaultDashChunkSource implements DashChunkSource {
protected
Chunk
newMediaChunk
(
RepresentationHolder
representationHolder
,
DataSource
dataSource
,
int
trackType
,
@C
.
TrackType
int
trackType
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
Object
trackSelectionData
,
long
firstSegmentNum
,
int
maxSegmentCount
,
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
View file @
5183eaaf
...
...
@@ -875,7 +875,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
DataSource
dataSource
,
DataSpec
dataSpec
,
Format
trackFormat
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
byte
[]
scratchSpace
)
{
super
(
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaChunk.java
View file @
5183eaaf
...
...
@@ -84,7 +84,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
HlsChunkSource
.
SegmentBaseHolder
segmentBaseHolder
,
Uri
playlistUrl
,
@Nullable
List
<
Format
>
muxedCaptionFormats
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
boolean
isMasterTimestampSource
,
TimestampAdjusterProvider
timestampAdjusterProvider
,
...
...
@@ -280,7 +280,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
boolean
initSegmentEncrypted
,
Uri
playlistUrl
,
@Nullable
List
<
Format
>
muxedCaptionFormats
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
long
startTimeUs
,
long
endTimeUs
,
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/DefaultSsChunkSource.java
View file @
5183eaaf
...
...
@@ -318,7 +318,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
long
chunkStartTimeUs
,
long
chunkEndTimeUs
,
long
chunkSeekTimeUs
,
int
trackSelectionReason
,
@C
.
SelectionReason
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
ChunkExtractor
chunkExtractor
)
{
DataSpec
dataSpec
=
new
DataSpec
(
uri
);
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeMediaChunk.java
View file @
5183eaaf
...
...
@@ -46,9 +46,13 @@ public final class FakeMediaChunk extends MediaChunk {
* @param trackFormat The {@link Format}.
* @param startTimeUs The start time of the media, in microseconds.
* @param endTimeUs The end time of the media, in microseconds.
* @param selectionReason
The reason for selecting this format
.
* @param selectionReason
One of the {@link C.SelectionReason selection reasons}
.
*/
public
FakeMediaChunk
(
Format
trackFormat
,
long
startTimeUs
,
long
endTimeUs
,
int
selectionReason
)
{
public
FakeMediaChunk
(
Format
trackFormat
,
long
startTimeUs
,
long
endTimeUs
,
@C
.
SelectionReason
int
selectionReason
)
{
super
(
DATA_SOURCE
,
new
DataSpec
(
Uri
.
EMPTY
),
...
...
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