summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt1
-rw-r--r--media/java/android/media/MediaFormat.java65
2 files changed, 53 insertions, 13 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index fb0cff5fe53a..e9e58432f0eb 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -22427,6 +22427,7 @@ package android.media {
field public static final String MIMETYPE_AUDIO_SCRAMBLED = "audio/scrambled";
field public static final String MIMETYPE_AUDIO_VORBIS = "audio/vorbis";
field public static final String MIMETYPE_IMAGE_ANDROID_HEIC = "image/vnd.android.heic";
+ field public static final String MIMETYPE_IMAGE_AVIF = "image/avif";
field public static final String MIMETYPE_TEXT_CEA_608 = "text/cea-608";
field public static final String MIMETYPE_TEXT_CEA_708 = "text/cea-708";
field public static final String MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index be9862bf1137..49b314d8481d 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -242,13 +242,14 @@ public final class MediaFormat {
* To decode such an image, {@link MediaCodec} decoder for
* {@link #MIMETYPE_VIDEO_HEVC} shall be used. The client needs to form
* the correct {@link #MediaFormat} based on additional information in
- * the track format, and send it to {@link MediaCodec#configure}.
+ * the track format (shown in the next paragraph), and send it to
+ * {@link MediaCodec#configure}.
*
* The track's MediaFormat will come with {@link #KEY_WIDTH} and
* {@link #KEY_HEIGHT} keys, which describes the width and height
* of the image. If the image doesn't contain grid (i.e. none of
* {@link #KEY_TILE_WIDTH}, {@link #KEY_TILE_HEIGHT},
- * {@link #KEY_GRID_ROWS}, {@link #KEY_GRID_COLUMNS} are present}), the
+ * {@link #KEY_GRID_ROWS}, {@link #KEY_GRID_COLUMNS} are present), the
* track will contain a single sample of coded data for the entire image,
* and the image width and height should be used to set up the decoder.
*
@@ -266,6 +267,36 @@ public final class MediaFormat {
public static final String MIMETYPE_IMAGE_ANDROID_HEIC = "image/vnd.android.heic";
/**
+ * MIME type for AVIF still image data encoded in AV1.
+ *
+ * To decode such an image, {@link MediaCodec} decoder for
+ * {@link #MIMETYPE_VIDEO_AV1} shall be used. The client needs to form
+ * the correct {@link #MediaFormat} based on additional information in
+ * the track format (shown in the next paragraph), and send it to
+ * {@link MediaCodec#configure}.
+ *
+ * The track's MediaFormat will come with {@link #KEY_WIDTH} and
+ * {@link #KEY_HEIGHT} keys, which describes the width and height
+ * of the image. If the image doesn't contain grid (i.e. none of
+ * {@link #KEY_TILE_WIDTH}, {@link #KEY_TILE_HEIGHT},
+ * {@link #KEY_GRID_ROWS}, {@link #KEY_GRID_COLUMNS} are present), the
+ * track will contain a single sample of coded data for the entire image,
+ * and the image width and height should be used to set up the decoder.
+ *
+ * If the image does come with grid, each sample from the track will
+ * contain one tile in the grid, of which the size is described by
+ * {@link #KEY_TILE_WIDTH} and {@link #KEY_TILE_HEIGHT}. This size
+ * (instead of {@link #KEY_WIDTH} and {@link #KEY_HEIGHT}) should be
+ * used to set up the decoder. The track contains {@link #KEY_GRID_ROWS}
+ * by {@link #KEY_GRID_COLUMNS} samples in row-major, top-row first,
+ * left-to-right order. The output image should be reconstructed by
+ * first tiling the decoding results of the tiles in the correct order,
+ * then trimming (before rotation is applied) on the bottom and right
+ * side, if the tiled area is larger than the image width and height.
+ */
+ public static final String MIMETYPE_IMAGE_AVIF = "image/avif";
+
+ /**
* MIME type for WebVTT subtitle data.
*/
public static final String MIMETYPE_TEXT_VTT = "text/vtt";
@@ -485,9 +516,11 @@ public final class MediaFormat {
/**
* A key describing the width (in pixels) of each tile of the content in a
- * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track. The associated value is an integer.
+ * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} track.
+ * The associated value is an integer.
*
- * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} on decoding instructions of such tracks.
+ * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} on decoding
+ * instructions of such tracks.
*
* @see #KEY_TILE_HEIGHT
* @see #KEY_GRID_ROWS
@@ -497,9 +530,11 @@ public final class MediaFormat {
/**
* A key describing the height (in pixels) of each tile of the content in a
- * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track. The associated value is an integer.
+ * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} track.
+ * The associated value is an integer.
*
- * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} on decoding instructions of such tracks.
+ * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} on decoding
+ * instructions of such tracks.
*
* @see #KEY_TILE_WIDTH
* @see #KEY_GRID_ROWS
@@ -509,9 +544,11 @@ public final class MediaFormat {
/**
* A key describing the number of grid rows in the content in a
- * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track. The associated value is an integer.
+ * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} track.
+ * The associated value is an integer.
*
- * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} on decoding instructions of such tracks.
+ * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} on decoding
+ * instructions of such tracks.
*
* @see #KEY_TILE_WIDTH
* @see #KEY_TILE_HEIGHT
@@ -521,9 +558,11 @@ public final class MediaFormat {
/**
* A key describing the number of grid columns in the content in a
- * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track. The associated value is an integer.
+ * {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} track.
+ * The associated value is an integer.
*
- * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} on decoding instructions of such tracks.
+ * Refer to {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} on decoding
+ * instructions of such tracks.
*
* @see #KEY_TILE_WIDTH
* @see #KEY_TILE_HEIGHT
@@ -1350,9 +1389,9 @@ public final class MediaFormat {
* selected in the absence of a specific user choice.
* This is currently used in two scenarios:
* 1) for subtitle tracks, when the user selected 'Default' for the captioning locale.
- * 2) for a {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track, indicating the image is the
- * primary item in the file.
-
+ * 2) for a {@link #MIMETYPE_IMAGE_ANDROID_HEIC} / {@link #MIMETYPE_IMAGE_AVIF} track,
+ * indicating the image is the primary item in the file.
+ *
* The associated value is an integer, where non-0 means TRUE. This is an optional
* field; if not specified, DEFAULT is considered to be FALSE.
*/