mirror of
https://github.com/androidx/media.git
synced 2025-05-10 09:12:16 +08:00
Define DATA_TYPE constants in C.
Things like manifests are loaded not in the context of a Chunk, but we want to eventually be reporting all loading events. So it makes senes to define data types at a global level. Also added {@code} in a few places for consistency. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124549737
This commit is contained in:
parent
1afe480a30
commit
ca9bd5e8e4
@ -152,6 +152,37 @@ public interface C {
|
||||
*/
|
||||
int RESULT_MAX_LENGTH_EXCEEDED = -2;
|
||||
|
||||
/**
|
||||
* A data type constant for data of unknown or unspecified type.
|
||||
*/
|
||||
int DATA_TYPE_UNKNOWN = 0;
|
||||
|
||||
/**
|
||||
* A data type constant for media, typically containing media samples.
|
||||
*/
|
||||
int DATA_TYPE_MEDIA = 1;
|
||||
|
||||
/**
|
||||
* A data type constant for media, typically containing only initialization data.
|
||||
*/
|
||||
int DATA_TYPE_MEDIA_INITIALIZATION = 2;
|
||||
|
||||
/**
|
||||
* A data type constant for drm or encryption related data.
|
||||
*/
|
||||
int DATA_TYPE_DRM = 3;
|
||||
|
||||
/**
|
||||
* A data type constant for a manifest file.
|
||||
*/
|
||||
int DATA_TYPE_MANIFEST = 4;
|
||||
|
||||
/**
|
||||
* Applications or extensions may define custom {@code DATA_TYPE_*} constants greater than or
|
||||
* equal to this value.
|
||||
*/
|
||||
int DATA_TYPE_CUSTOM_BASE = 10000;
|
||||
|
||||
/**
|
||||
* A type constant for tracks of unknown type.
|
||||
*/
|
||||
@ -258,7 +289,8 @@ public interface C {
|
||||
int MSG_SET_PLAYBACK_PARAMS = 3;
|
||||
|
||||
/**
|
||||
* A minimum value for custom {@link TrackRenderer} message types.
|
||||
* Applications or extensions may define custom {@code MSG_*} constants greater than or equal to
|
||||
* this value.
|
||||
*/
|
||||
int MSG_CUSTOM_BASE = 10000;
|
||||
|
||||
|
@ -159,7 +159,7 @@ public final class SimpleExoPlayer implements ExoPlayer {
|
||||
*
|
||||
* @see TrackRenderer#getTrackType()
|
||||
* @param index The index of the renderer.
|
||||
* @return One of the TRACK_TYPE_* constants defined in {@link C}.
|
||||
* @return One of the {@code TRACK_TYPE_*} constants defined in {@link C}.
|
||||
*/
|
||||
public int getRendererType(int index) {
|
||||
return renderers[index].getTrackType();
|
||||
|
@ -142,7 +142,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
||||
/**
|
||||
* Returns the current state of the renderer.
|
||||
*
|
||||
* @return The current state (one of the STATE_* constants).
|
||||
* @return The current state (one of the {@code STATE_*} constants).
|
||||
*/
|
||||
protected final int getState() {
|
||||
return state;
|
||||
@ -346,7 +346,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
||||
* {@link C#TRACK_TYPE_VIDEO}, an audio renderer will return {@link C#TRACK_TYPE_AUDIO}, a text
|
||||
* renderer will return {@link C#TRACK_TYPE_TEXT}, and so on.
|
||||
*
|
||||
* @return One of the TRACK_TYPE_* constants defined in {@link C}.
|
||||
* @return One of the {@code TRACK_TYPE_*} constants defined in {@link C}.
|
||||
*/
|
||||
public abstract int getTrackType();
|
||||
|
||||
|
@ -52,7 +52,7 @@ public abstract class TrackSelectionPolicy {
|
||||
* @param rendererTrackGroupArrays An array of {@link TrackGroupArray}s where each entry
|
||||
* corresponds to the {@link TrackRenderer} of equal index in {@code renderers}.
|
||||
* @param rendererFormatSupports Maps every available track to a specific level of support as
|
||||
* defined by the {@link TrackRenderer} FORMAT_* constants.
|
||||
* defined by the {@link TrackRenderer} {@code FORMAT_*} constants.
|
||||
* @throws ExoPlaybackException If an error occurs while selecting the tracks.
|
||||
*/
|
||||
/* package */ abstract TrackSelection[] selectTracks(TrackRenderer[] renderers,
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.chunk;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.Format;
|
||||
import com.google.android.exoplayer.upstream.DataSource;
|
||||
import com.google.android.exoplayer.upstream.DataSpec;
|
||||
@ -27,31 +28,6 @@ import com.google.android.exoplayer.util.Assertions;
|
||||
*/
|
||||
public abstract class Chunk implements Loadable {
|
||||
|
||||
/**
|
||||
* Value of {@link #type} for chunks containing unspecified data.
|
||||
*/
|
||||
public static final int TYPE_UNSPECIFIED = 0;
|
||||
/**
|
||||
* Value of {@link #type} for chunks containing media data.
|
||||
*/
|
||||
public static final int TYPE_MEDIA = 1;
|
||||
/**
|
||||
* Value of {@link #type} for chunks containing media initialization data.
|
||||
*/
|
||||
public static final int TYPE_MEDIA_INITIALIZATION = 2;
|
||||
/**
|
||||
* Value of {@link #type} for chunks containing drm related data.
|
||||
*/
|
||||
public static final int TYPE_DRM = 3;
|
||||
/**
|
||||
* Value of {@link #type} for chunks containing manifest or playlist data.
|
||||
*/
|
||||
public static final int TYPE_MANIFEST = 4;
|
||||
/**
|
||||
* Implementations may define custom {@link #type} codes greater than or equal to this value.
|
||||
*/
|
||||
public static final int TYPE_CUSTOM_BASE = 10000;
|
||||
|
||||
/**
|
||||
* Value of {@link #trigger} for a load whose reason is unspecified.
|
||||
*/
|
||||
@ -78,7 +54,8 @@ public abstract class Chunk implements Loadable {
|
||||
public static final int TRIGGER_CUSTOM_BASE = 10000;
|
||||
|
||||
/**
|
||||
* The type of the chunk. For reporting only.
|
||||
* The type of the chunk. One of the {@code DATA_TYPE_*} constants defined in {@link C}. For
|
||||
* reporting only.
|
||||
*/
|
||||
public final int type;
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.chunk;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.Format;
|
||||
import com.google.android.exoplayer.chunk.ChunkExtractorWrapper.SingleTrackMetadataOutput;
|
||||
import com.google.android.exoplayer.extractor.DefaultExtractorInput;
|
||||
@ -57,7 +58,7 @@ public final class InitializationChunk extends Chunk implements SingleTrackMetad
|
||||
*/
|
||||
public InitializationChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format,
|
||||
ChunkExtractorWrapper extractorWrapper) {
|
||||
super(dataSource, dataSpec, Chunk.TYPE_MEDIA_INITIALIZATION, trigger, format);
|
||||
super(dataSource, dataSpec, C.DATA_TYPE_MEDIA_INITIALIZATION, trigger, format);
|
||||
this.extractorWrapper = extractorWrapper;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.chunk;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.Format;
|
||||
import com.google.android.exoplayer.upstream.DataSource;
|
||||
import com.google.android.exoplayer.upstream.DataSpec;
|
||||
@ -49,7 +50,7 @@ public abstract class MediaChunk extends Chunk {
|
||||
*/
|
||||
public MediaChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format,
|
||||
long startTimeUs, long endTimeUs, int chunkIndex) {
|
||||
super(dataSource, dataSpec, Chunk.TYPE_MEDIA, trigger, format);
|
||||
super(dataSource, dataSpec, C.DATA_TYPE_MEDIA, trigger, format);
|
||||
Assertions.checkNotNull(format);
|
||||
this.startTimeUs = startTimeUs;
|
||||
this.endTimeUs = endTimeUs;
|
||||
|
@ -558,7 +558,7 @@ public class HlsChunkSource {
|
||||
public MediaPlaylistChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
byte[] scratchSpace, HlsPlaylistParser playlistParser, int variantIndex,
|
||||
Uri playlistUri) {
|
||||
super(dataSource, dataSpec, Chunk.TYPE_MANIFEST, Chunk.TRIGGER_UNSPECIFIED, format,
|
||||
super(dataSource, dataSpec, C.DATA_TYPE_MANIFEST, Chunk.TRIGGER_UNSPECIFIED, format,
|
||||
scratchSpace);
|
||||
this.variantIndex = variantIndex;
|
||||
this.playlistParser = playlistParser;
|
||||
@ -585,7 +585,7 @@ public class HlsChunkSource {
|
||||
|
||||
public EncryptionKeyChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
byte[] scratchSpace, String iv) {
|
||||
super(dataSource, dataSpec, Chunk.TYPE_DRM, Chunk.TRIGGER_UNSPECIFIED, format,
|
||||
super(dataSource, dataSpec, C.DATA_TYPE_DRM, Chunk.TRIGGER_UNSPECIFIED, format,
|
||||
scratchSpace);
|
||||
this.iv = iv;
|
||||
}
|
||||
|
@ -729,7 +729,8 @@ public final class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a {@link C} TRACK_TYPE_* constant to its corresponding DEFAULT_*_BUFFER_SIZE value.
|
||||
* Maps a {@link C} {@code TRACK_TYPE_*} constant to the corresponding {@link C}
|
||||
* {@code DEFAULT_*_BUFFER_SIZE} constant.
|
||||
*
|
||||
* @param trackType The track type.
|
||||
* @return The corresponding default buffer size in bytes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user