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
22779596
authored
May 18, 2021
by
aquilescanta
Committed by
Oliver Woodman
May 19, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add an IntDef for DATA_TYPE_* constants
PiperOrigin-RevId: 374418502
parent
6c06b4ef
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
20 deletions
library/common/src/main/java/com/google/android/exoplayer2/C.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/ProgressiveMediaPeriod.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/DataChunk.java
library/common/src/main/java/com/google/android/exoplayer2/C.java
View file @
22779596
...
@@ -557,6 +557,28 @@ public final class C {
...
@@ -557,6 +557,28 @@ public final class C {
/** A return value for methods where a format was read. */
/** A return value for methods where a format was read. */
public
static
final
int
RESULT_FORMAT_READ
=
-
5
;
public
static
final
int
RESULT_FORMAT_READ
=
-
5
;
/**
* Represents a type of data. May be one of {@link #DATA_TYPE_UNKNOWN}, {@link #DATA_TYPE_MEDIA},
* {@link #DATA_TYPE_MEDIA_INITIALIZATION}, {@link #DATA_TYPE_DRM}, {@link #DATA_TYPE_MANIFEST},
* {@link #DATA_TYPE_TIME_SYNCHRONIZATION}, {@link #DATA_TYPE_AD}, or {@link
* #DATA_TYPE_MEDIA_PROGRESSIVE_LIVE}. May also be an app-defined value (see {@link
* #DATA_TYPE_CUSTOM_BASE}).
*/
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
(
open
=
true
,
value
=
{
DATA_TYPE_UNKNOWN
,
DATA_TYPE_MEDIA
,
DATA_TYPE_MEDIA_INITIALIZATION
,
DATA_TYPE_DRM
,
DATA_TYPE_MANIFEST
,
DATA_TYPE_TIME_SYNCHRONIZATION
,
DATA_TYPE_AD
,
DATA_TYPE_MEDIA_PROGRESSIVE_LIVE
})
public
@interface
DataType
{}
/** A data type constant for data of unknown or unspecified type. */
/** A data type constant for data of unknown or unspecified type. */
public
static
final
int
DATA_TYPE_UNKNOWN
=
0
;
public
static
final
int
DATA_TYPE_UNKNOWN
=
0
;
/** A data type constant for media, typically containing media samples. */
/** A data type constant for media, typically containing media samples. */
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaLoadData.java
View file @
22779596
...
@@ -17,13 +17,14 @@ package com.google.android.exoplayer2.source;
...
@@ -17,13 +17,14 @@ package com.google.android.exoplayer2.source;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
/** Descriptor for data being loaded or selected by a {@link MediaSource}. */
/** Descriptor for data being loaded or selected by a {@link MediaSource}. */
public
final
class
MediaLoadData
{
public
final
class
MediaLoadData
{
/**
One of the {@link C} {@code DATA_TYPE_*} constants defining the type of data
. */
/**
The {@link DataType data type}
. */
public
final
int
dataType
;
@DataType
public
final
int
dataType
;
/**
/**
* One of the {@link C} {@code TRACK_TYPE_*} constants if the data corresponds to media of a
* One of the {@link C} {@code TRACK_TYPE_*} constants if the data corresponds to media of a
* specific type. {@link C#TRACK_TYPE_UNKNOWN} otherwise.
* specific type. {@link C#TRACK_TYPE_UNKNOWN} otherwise.
...
@@ -56,7 +57,7 @@ public final class MediaLoadData {
...
@@ -56,7 +57,7 @@ public final class MediaLoadData {
public
final
long
mediaEndTimeMs
;
public
final
long
mediaEndTimeMs
;
/** Creates an instance with the given {@link #dataType}. */
/** Creates an instance with the given {@link #dataType}. */
public
MediaLoadData
(
int
dataType
)
{
public
MediaLoadData
(
@DataType
int
dataType
)
{
this
(
this
(
dataType
,
dataType
,
/* trackType= */
C
.
TRACK_TYPE_UNKNOWN
,
/* trackType= */
C
.
TRACK_TYPE_UNKNOWN
,
...
@@ -79,7 +80,7 @@ public final class MediaLoadData {
...
@@ -79,7 +80,7 @@ public final class MediaLoadData {
* @param mediaEndTimeMs See {@link #mediaEndTimeMs}.
* @param mediaEndTimeMs See {@link #mediaEndTimeMs}.
*/
*/
public
MediaLoadData
(
public
MediaLoadData
(
int
dataType
,
@DataType
int
dataType
,
int
trackType
,
int
trackType
,
@Nullable
Format
trackFormat
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceEventListener.java
View file @
22779596
...
@@ -21,6 +21,7 @@ import android.os.Handler;
...
@@ -21,6 +21,7 @@ import android.os.Handler;
import
androidx.annotation.CheckResult
;
import
androidx.annotation.CheckResult
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.source.MediaSource.MediaPeriodId
;
import
com.google.android.exoplayer2.source.MediaSource.MediaPeriodId
;
...
@@ -212,7 +213,7 @@ public interface MediaSourceEventListener {
...
@@ -212,7 +213,7 @@ public interface MediaSourceEventListener {
}
}
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadStarted
(
LoadEventInfo
loadEventInfo
,
int
dataType
)
{
public
void
loadStarted
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
)
{
loadStarted
(
loadStarted
(
loadEventInfo
,
loadEventInfo
,
dataType
,
dataType
,
...
@@ -227,7 +228,7 @@ public interface MediaSourceEventListener {
...
@@ -227,7 +228,7 @@ public interface MediaSourceEventListener {
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadStarted
(
public
void
loadStarted
(
LoadEventInfo
loadEventInfo
,
LoadEventInfo
loadEventInfo
,
int
dataType
,
@DataType
int
dataType
,
int
trackType
,
int
trackType
,
@Nullable
Format
trackFormat
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
...
@@ -257,7 +258,7 @@ public interface MediaSourceEventListener {
...
@@ -257,7 +258,7 @@ public interface MediaSourceEventListener {
}
}
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadCompleted
(
LoadEventInfo
loadEventInfo
,
int
dataType
)
{
public
void
loadCompleted
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
)
{
loadCompleted
(
loadCompleted
(
loadEventInfo
,
loadEventInfo
,
dataType
,
dataType
,
...
@@ -272,7 +273,7 @@ public interface MediaSourceEventListener {
...
@@ -272,7 +273,7 @@ public interface MediaSourceEventListener {
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadCompleted
(
public
void
loadCompleted
(
LoadEventInfo
loadEventInfo
,
LoadEventInfo
loadEventInfo
,
int
dataType
,
@DataType
int
dataType
,
int
trackType
,
int
trackType
,
@Nullable
Format
trackFormat
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
...
@@ -303,7 +304,7 @@ public interface MediaSourceEventListener {
...
@@ -303,7 +304,7 @@ public interface MediaSourceEventListener {
}
}
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadCanceled
(
LoadEventInfo
loadEventInfo
,
int
dataType
)
{
public
void
loadCanceled
(
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
)
{
loadCanceled
(
loadCanceled
(
loadEventInfo
,
loadEventInfo
,
dataType
,
dataType
,
...
@@ -318,7 +319,7 @@ public interface MediaSourceEventListener {
...
@@ -318,7 +319,7 @@ public interface MediaSourceEventListener {
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
public
void
loadCanceled
(
public
void
loadCanceled
(
LoadEventInfo
loadEventInfo
,
LoadEventInfo
loadEventInfo
,
int
dataType
,
@DataType
int
dataType
,
int
trackType
,
int
trackType
,
@Nullable
Format
trackFormat
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
...
@@ -353,7 +354,10 @@ public interface MediaSourceEventListener {
...
@@ -353,7 +354,10 @@ public interface MediaSourceEventListener {
* boolean)}.
* boolean)}.
*/
*/
public
void
loadError
(
public
void
loadError
(
LoadEventInfo
loadEventInfo
,
int
dataType
,
IOException
error
,
boolean
wasCanceled
)
{
LoadEventInfo
loadEventInfo
,
@DataType
int
dataType
,
IOException
error
,
boolean
wasCanceled
)
{
loadError
(
loadError
(
loadEventInfo
,
loadEventInfo
,
dataType
,
dataType
,
...
@@ -373,7 +377,7 @@ public interface MediaSourceEventListener {
...
@@ -373,7 +377,7 @@ public interface MediaSourceEventListener {
*/
*/
public
void
loadError
(
public
void
loadError
(
LoadEventInfo
loadEventInfo
,
LoadEventInfo
loadEventInfo
,
int
dataType
,
@DataType
int
dataType
,
int
trackType
,
int
trackType
,
@Nullable
Format
trackFormat
,
@Nullable
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java
View file @
22779596
...
@@ -22,6 +22,7 @@ import android.net.Uri;
...
@@ -22,6 +22,7 @@ import android.net.Uri;
import
android.os.Handler
;
import
android.os.Handler
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.FormatHolder
;
import
com.google.android.exoplayer2.FormatHolder
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.ParserException
;
...
@@ -127,7 +128,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -127,7 +128,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
@MonotonicNonNull
SeekMap
seekMap
;
private
@MonotonicNonNull
SeekMap
seekMap
;
private
long
durationUs
;
private
long
durationUs
;
private
boolean
isLive
;
private
boolean
isLive
;
private
int
dataType
;
@DataType
private
int
dataType
;
private
boolean
seenFirstTrackSelection
;
private
boolean
seenFirstTrackSelection
;
private
boolean
notifyDiscontinuity
;
private
boolean
notifyDiscontinuity
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/Chunk.java
View file @
22779596
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.source.chunk;
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.source.chunk;
import
android.net.Uri
;
import
android.net.Uri
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.source.LoadEventInfo
;
import
com.google.android.exoplayer2.source.LoadEventInfo
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSource
;
...
@@ -38,11 +39,8 @@ public abstract class Chunk implements Loadable {
...
@@ -38,11 +39,8 @@ public abstract class Chunk implements Loadable {
public
final
long
loadTaskId
;
public
final
long
loadTaskId
;
/** The {@link DataSpec} that defines the data to be loaded. */
/** The {@link DataSpec} that defines the data to be loaded. */
public
final
DataSpec
dataSpec
;
public
final
DataSpec
dataSpec
;
/**
/** The {@link DataType data type} of the chunk. For reporting only. */
* The type of the chunk. One of the {@code DATA_TYPE_*} constants defined in {@link C}. For
@DataType
public
final
int
type
;
* reporting only.
*/
public
final
int
type
;
/** The format of the track to which this chunk belongs. */
/** The format of the track to which this chunk belongs. */
public
final
Format
trackFormat
;
public
final
Format
trackFormat
;
/**
/**
...
@@ -82,7 +80,7 @@ public abstract class Chunk implements Loadable {
...
@@ -82,7 +80,7 @@ public abstract class Chunk implements Loadable {
public
Chunk
(
public
Chunk
(
DataSource
dataSource
,
DataSource
dataSource
,
DataSpec
dataSpec
,
DataSpec
dataSpec
,
int
type
,
@DataType
int
type
,
Format
trackFormat
,
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
@Nullable
Object
trackSelectionData
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/DataChunk.java
View file @
22779596
...
@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source.chunk;
...
@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source.chunk;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C.DataType
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
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
;
...
@@ -48,7 +49,7 @@ public abstract class DataChunk extends Chunk {
...
@@ -48,7 +49,7 @@ public abstract class DataChunk extends Chunk {
public
DataChunk
(
public
DataChunk
(
DataSource
dataSource
,
DataSource
dataSource
,
DataSpec
dataSpec
,
DataSpec
dataSpec
,
int
type
,
@DataType
int
type
,
Format
trackFormat
,
Format
trackFormat
,
int
trackSelectionReason
,
int
trackSelectionReason
,
@Nullable
Object
trackSelectionData
,
@Nullable
Object
trackSelectionData
,
...
...
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