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
8540b726
authored
Sep 15, 2021
by
andrewlewis
Committed by
Christos Tsilopoulos
Sep 16, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add open @IntDef for track selection type
#exofixit PiperOrigin-RevId: 396780460
parent
aa8fe5df
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
16 deletions
library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelection.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/FixedTrackSelection.java
library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java
View file @
8540b726
...
...
@@ -15,9 +15,15 @@
*/
package
com
.
google
.
android
.
exoplayer2
.
trackselection
;
import
androidx.annotation.IntDef
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.source.TrackGroup
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* A track selection consisting of a static subset of selected tracks belonging to a {@link
...
...
@@ -27,6 +33,17 @@ import com.google.android.exoplayer2.source.TrackGroup;
*/
public
interface
TrackSelection
{
/**
* Represents a type track selection. Either {@link #TYPE_UNSET} or an app-defined value (see
* {@link #TYPE_CUSTOM_BASE}).
*/
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@Target
({
ElementType
.
TYPE_USE
})
@IntDef
(
open
=
true
,
value
=
{
TYPE_UNSET
})
@interface
Type
{}
/** An unspecified track selection type. */
int
TYPE_UNSET
=
0
;
/** The first value that can be used for application specific track selection types. */
...
...
@@ -40,6 +57,7 @@ public interface TrackSelection {
* starting from {@link #TYPE_CUSTOM_BASE} to ensure they don't conflict with any types that may
* be added to the library in the future.
*/
@Type
int
getType
();
/** Returns the {@link TrackGroup} to which the selected tracks belong. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelection.java
View file @
8540b726
...
...
@@ -273,7 +273,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
protected
AdaptiveTrackSelection
(
TrackGroup
group
,
int
[]
tracks
,
int
type
,
@Type
int
type
,
BandwidthMeter
bandwidthMeter
,
long
minDurationForQualityIncreaseMs
,
long
maxDurationForQualityDecreaseMs
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/BaseTrackSelection.java
View file @
8540b726
...
...
@@ -39,7 +39,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
protected
final
int
[]
tracks
;
/** The type of the selection. */
private
final
int
type
;
private
final
@Type
int
type
;
/** The {@link Format}s of the selected tracks, in order of decreasing bandwidth. */
private
final
Format
[]
formats
;
/** Selected track exclusion timestamps, in order of decreasing bandwidth. */
...
...
@@ -63,7 +63,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
* null or empty. May be in any order.
* @param type The type that will be returned from {@link TrackSelection#getType()}.
*/
public
BaseTrackSelection
(
TrackGroup
group
,
int
[]
tracks
,
int
type
)
{
public
BaseTrackSelection
(
TrackGroup
group
,
int
[]
tracks
,
@Type
int
type
)
{
Assertions
.
checkState
(
tracks
.
length
>
0
);
this
.
type
=
type
;
this
.
group
=
Assertions
.
checkNotNull
(
group
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelector.java
View file @
8540b726
...
...
@@ -1262,7 +1262,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
public
final
int
groupIndex
;
public
final
int
[]
tracks
;
public
final
int
length
;
public
final
int
type
;
public
final
@TrackSelection
.
Type
int
type
;
/**
* Constructs a {@code SelectionOverride} to override tracks of a group.
...
...
@@ -1281,7 +1281,7 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* @param tracks The overriding track indices within the track group.
* @param type The type that will be returned from {@link TrackSelection#getType()}.
*/
public
SelectionOverride
(
int
groupIndex
,
int
[]
tracks
,
int
type
)
{
public
SelectionOverride
(
int
groupIndex
,
int
[]
tracks
,
@TrackSelection
.
Type
int
type
)
{
this
.
groupIndex
=
groupIndex
;
this
.
tracks
=
Arrays
.
copyOf
(
tracks
,
tracks
.
length
);
this
.
length
=
tracks
.
length
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/ExoTrackSelection.java
View file @
8540b726
...
...
@@ -43,7 +43,7 @@ public interface ExoTrackSelection extends TrackSelection {
/** The indices of the selected tracks in {@link #group}. */
public
final
int
[]
tracks
;
/** The type that will be returned from {@link TrackSelection#getType()}. */
public
final
int
type
;
public
final
@Type
int
type
;
/**
* @param group The {@link TrackGroup}. Must not be null.
...
...
@@ -60,7 +60,7 @@ public interface ExoTrackSelection extends TrackSelection {
* null or empty. May be in any order.
* @param type The type that will be returned from {@link TrackSelection#getType()}.
*/
public
Definition
(
TrackGroup
group
,
int
[]
tracks
,
int
type
)
{
public
Definition
(
TrackGroup
group
,
int
[]
tracks
,
@Type
int
type
)
{
this
.
group
=
group
;
this
.
tracks
=
tracks
;
this
.
type
=
type
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/FixedTrackSelection.java
View file @
8540b726
...
...
@@ -41,13 +41,8 @@ public final class FixedTrackSelection extends BaseTrackSelection {
* @param track The index of the selected track within the {@link TrackGroup}.
* @param type The type that will be returned from {@link TrackSelection#getType()}.
*/
public
FixedTrackSelection
(
TrackGroup
group
,
int
track
,
int
type
)
{
this
(
group
,
/* track= */
track
,
/* type= */
type
,
/* reason= */
C
.
SELECTION_REASON_UNKNOWN
,
null
);
public
FixedTrackSelection
(
TrackGroup
group
,
int
track
,
@Type
int
type
)
{
this
(
group
,
track
,
type
,
C
.
SELECTION_REASON_UNKNOWN
,
/* data= */
null
);
}
/**
...
...
@@ -58,8 +53,8 @@ public final class FixedTrackSelection extends BaseTrackSelection {
* @param data Optional data associated with the track selection.
*/
public
FixedTrackSelection
(
TrackGroup
group
,
int
track
,
int
type
,
int
reason
,
@Nullable
Object
data
)
{
super
(
group
,
/* tracks= */
new
int
[]
{
track
},
/* type= */
type
);
TrackGroup
group
,
int
track
,
@Type
int
type
,
int
reason
,
@Nullable
Object
data
)
{
super
(
group
,
/* tracks= */
new
int
[]
{
track
},
type
);
this
.
reason
=
reason
;
this
.
data
=
data
;
}
...
...
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