diff --git a/apex/media/framework/api/current.txt b/apex/media/framework/api/current.txt index 9cec748e7b8e1..0cc8e52f64116 100644 --- a/apex/media/framework/api/current.txt +++ b/apex/media/framework/api/current.txt @@ -67,6 +67,11 @@ package android.media { field public static final String PARSER_NAME_TS = "android.media.mediaparser.TsParser"; field public static final String PARSER_NAME_UNKNOWN = "android.media.mediaparser.UNKNOWN"; field public static final String PARSER_NAME_WAV = "android.media.mediaparser.WavParser"; + field public static final int SAMPLE_FLAG_DECODE_ONLY = -2147483648; // 0x80000000 + field public static final int SAMPLE_FLAG_ENCRYPTED = 1073741824; // 0x40000000 + field public static final int SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA = 268435456; // 0x10000000 + field public static final int SAMPLE_FLAG_KEY_FRAME = 1; // 0x1 + field public static final int SAMPLE_FLAG_LAST_SAMPLE = 536870912; // 0x20000000 } public static interface MediaParser.InputReader { diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java index 943baaebe2f04..edf25ae36ec9b 100644 --- a/apex/media/framework/java/android/media/MediaParser.java +++ b/apex/media/framework/java/android/media/MediaParser.java @@ -16,6 +16,7 @@ package android.media; import android.annotation.CheckResult; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringDef; @@ -391,8 +392,7 @@ public final class MediaParser { * * @param trackIndex The index of the track to which the sample corresponds. * @param timeMicros The media timestamp associated with the sample, in microseconds. - * @param flags Flags associated with the sample. See {@link MediaCodec - * MediaCodec.BUFFER_FLAG_*}. + * @param flags Flags associated with the sample. See the {@code SAMPLE_FLAG_*} constants. * @param size The size of the sample data, in bytes. * @param offset The number of bytes that have been consumed by {@code * onSampleDataFound(int, MediaParser.InputReader)} for the specified track, since the @@ -405,7 +405,7 @@ public final class MediaParser { void onSampleCompleted( int trackIndex, long timeMicros, - int flags, + @SampleFlags int flags, int size, int offset, @Nullable CryptoInfo cryptoInfo); @@ -449,6 +449,31 @@ public final class MediaParser { } } + // Sample flags. + + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef( + flag = true, + value = { + SAMPLE_FLAG_KEY_FRAME, + SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA, + SAMPLE_FLAG_LAST_SAMPLE, + SAMPLE_FLAG_ENCRYPTED, + SAMPLE_FLAG_DECODE_ONLY + }) + public @interface SampleFlags {} + /** Indicates that the sample holds a synchronization sample. */ + public static final int SAMPLE_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME; + /** Indicates that the sample has supplemental data. */ + public static final int SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA = 1 << 28; + /** Indicates that the sample is known to contain the last media sample of the stream. */ + public static final int SAMPLE_FLAG_LAST_SAMPLE = 1 << 29; + /** Indicates that the sample is (at least partially) encrypted. */ + public static final int SAMPLE_FLAG_ENCRYPTED = 1 << 30; + /** Indicates that the sample should be decoded but not rendered. */ + public static final int SAMPLE_FLAG_DECODE_ONLY = 1 << 31; + // Parser implementation names. /** @hide */ diff --git a/api/current.txt b/api/current.txt index 40347c79a11b4..1e24d62b00641 100644 --- a/api/current.txt +++ b/api/current.txt @@ -26434,6 +26434,11 @@ package android.media { field public static final String PARSER_NAME_TS = "android.media.mediaparser.TsParser"; field public static final String PARSER_NAME_UNKNOWN = "android.media.mediaparser.UNKNOWN"; field public static final String PARSER_NAME_WAV = "android.media.mediaparser.WavParser"; + field public static final int SAMPLE_FLAG_DECODE_ONLY = -2147483648; // 0x80000000 + field public static final int SAMPLE_FLAG_ENCRYPTED = 1073741824; // 0x40000000 + field public static final int SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA = 268435456; // 0x10000000 + field public static final int SAMPLE_FLAG_KEY_FRAME = 1; // 0x1 + field public static final int SAMPLE_FLAG_LAST_SAMPLE = 536870912; // 0x20000000 } public static interface MediaParser.InputReader {