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. */
|
/** 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. */
|
||||||
|
@ -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 {
|
|||||||
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 {
|
|||||||
* @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,
|
||||||
|
@ -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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 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 {
|
|||||||
/** 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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 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 {
|
|||||||
/** 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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 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 {
|
|||||||
/** 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 {
|
|||||||
* 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 {
|
|||||||
*/
|
*/
|
||||||
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,
|
||||||
|
@ -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;
|
|||||||
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;
|
||||||
|
@ -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 {
|
|||||||
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 {
|
|||||||
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,
|
||||||
|
@ -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 {
|
|||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user