Add an IntDef for DATA_TYPE_* constants
PiperOrigin-RevId: 374418502
This commit is contained in:
parent
6c06b4efd1
commit
227795964b
@ -557,6 +557,28 @@ public final class C {
|
||||
/** A return value for methods where a format was read. */
|
||||
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. */
|
||||
public static final int DATA_TYPE_UNKNOWN = 0;
|
||||
/** A data type constant for media, typically containing media samples. */
|
||||
|
@ -17,13 +17,14 @@ 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.Format;
|
||||
|
||||
/** Descriptor for data being loaded or selected by a {@link MediaSource}. */
|
||||
public final class MediaLoadData {
|
||||
|
||||
/** One of the {@link C} {@code DATA_TYPE_*} constants defining the type of data. */
|
||||
public final int dataType;
|
||||
/** The {@link DataType data type}. */
|
||||
@DataType public final int dataType;
|
||||
/**
|
||||
* 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.
|
||||
@ -56,7 +57,7 @@ public final class MediaLoadData {
|
||||
public final long mediaEndTimeMs;
|
||||
|
||||
/** Creates an instance with the given {@link #dataType}. */
|
||||
public MediaLoadData(int dataType) {
|
||||
public MediaLoadData(@DataType int dataType) {
|
||||
this(
|
||||
dataType,
|
||||
/* trackType= */ C.TRACK_TYPE_UNKNOWN,
|
||||
@ -79,7 +80,7 @@ public final class MediaLoadData {
|
||||
* @param mediaEndTimeMs See {@link #mediaEndTimeMs}.
|
||||
*/
|
||||
public MediaLoadData(
|
||||
int dataType,
|
||||
@DataType int dataType,
|
||||
int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
|
@ -21,6 +21,7 @@ import android.os.Handler;
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.C.DataType;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||
@ -212,7 +213,7 @@ public interface MediaSourceEventListener {
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadStarted(LoadEventInfo loadEventInfo, int dataType) {
|
||||
public void loadStarted(LoadEventInfo loadEventInfo, @DataType int dataType) {
|
||||
loadStarted(
|
||||
loadEventInfo,
|
||||
dataType,
|
||||
@ -227,7 +228,7 @@ public interface MediaSourceEventListener {
|
||||
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadStarted(
|
||||
LoadEventInfo loadEventInfo,
|
||||
int dataType,
|
||||
@DataType int dataType,
|
||||
int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
@ -257,7 +258,7 @@ public interface MediaSourceEventListener {
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadCompleted(LoadEventInfo loadEventInfo, int dataType) {
|
||||
public void loadCompleted(LoadEventInfo loadEventInfo, @DataType int dataType) {
|
||||
loadCompleted(
|
||||
loadEventInfo,
|
||||
dataType,
|
||||
@ -272,7 +273,7 @@ public interface MediaSourceEventListener {
|
||||
/** Dispatches {@link #onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadCompleted(
|
||||
LoadEventInfo loadEventInfo,
|
||||
int dataType,
|
||||
@DataType int dataType,
|
||||
int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
@ -303,7 +304,7 @@ public interface MediaSourceEventListener {
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadCanceled(LoadEventInfo loadEventInfo, int dataType) {
|
||||
public void loadCanceled(LoadEventInfo loadEventInfo, @DataType int dataType) {
|
||||
loadCanceled(
|
||||
loadEventInfo,
|
||||
dataType,
|
||||
@ -318,7 +319,7 @@ public interface MediaSourceEventListener {
|
||||
/** Dispatches {@link #onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData)}. */
|
||||
public void loadCanceled(
|
||||
LoadEventInfo loadEventInfo,
|
||||
int dataType,
|
||||
@DataType int dataType,
|
||||
int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
@ -353,7 +354,10 @@ public interface MediaSourceEventListener {
|
||||
* boolean)}.
|
||||
*/
|
||||
public void loadError(
|
||||
LoadEventInfo loadEventInfo, int dataType, IOException error, boolean wasCanceled) {
|
||||
LoadEventInfo loadEventInfo,
|
||||
@DataType int dataType,
|
||||
IOException error,
|
||||
boolean wasCanceled) {
|
||||
loadError(
|
||||
loadEventInfo,
|
||||
dataType,
|
||||
@ -373,7 +377,7 @@ public interface MediaSourceEventListener {
|
||||
*/
|
||||
public void loadError(
|
||||
LoadEventInfo loadEventInfo,
|
||||
int dataType,
|
||||
@DataType int dataType,
|
||||
int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
|
@ -22,6 +22,7 @@ import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.C.DataType;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.FormatHolder;
|
||||
import com.google.android.exoplayer2.ParserException;
|
||||
@ -127,7 +128,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private @MonotonicNonNull SeekMap seekMap;
|
||||
private long durationUs;
|
||||
private boolean isLive;
|
||||
private int dataType;
|
||||
@DataType private int dataType;
|
||||
|
||||
private boolean seenFirstTrackSelection;
|
||||
private boolean notifyDiscontinuity;
|
||||
|
@ -18,6 +18,7 @@ package com.google.android.exoplayer2.source.chunk;
|
||||
import android.net.Uri;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.C.DataType;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.source.LoadEventInfo;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
@ -38,11 +39,8 @@ public abstract class Chunk implements Loadable {
|
||||
public final long loadTaskId;
|
||||
/** The {@link DataSpec} that defines the data to be loaded. */
|
||||
public final DataSpec dataSpec;
|
||||
/**
|
||||
* The type of the chunk. One of the {@code DATA_TYPE_*} constants defined in {@link C}. For
|
||||
* reporting only.
|
||||
*/
|
||||
public final int type;
|
||||
/** The {@link DataType data type} of the chunk. For reporting only. */
|
||||
@DataType public final int type;
|
||||
/** The format of the track to which this chunk belongs. */
|
||||
public final Format trackFormat;
|
||||
/**
|
||||
@ -82,7 +80,7 @@ public abstract class Chunk implements Loadable {
|
||||
public Chunk(
|
||||
DataSource dataSource,
|
||||
DataSpec dataSpec,
|
||||
int type,
|
||||
@DataType int type,
|
||||
Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
@Nullable Object trackSelectionData,
|
||||
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source.chunk;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.C.DataType;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
@ -48,7 +49,7 @@ public abstract class DataChunk extends Chunk {
|
||||
public DataChunk(
|
||||
DataSource dataSource,
|
||||
DataSpec dataSpec,
|
||||
int type,
|
||||
@DataType int type,
|
||||
Format trackFormat,
|
||||
int trackSelectionReason,
|
||||
@Nullable Object trackSelectionData,
|
||||
|
Loading…
x
Reference in New Issue
Block a user