From 69886ab003aa05fb74b28fd269bb0b0c1796256e Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Wed, 20 Jan 2021 19:58:10 -0800 Subject: [PATCH] Common keys for video QP manipulation Definitions for managing Video encoding Quantization Parameter (QP). Providing a standardized key instead of various vendor-specific keys. Bug: 161486623 Test: build, b/179554934 for functionality Change-Id: I8f1976cff55e119a2b42332de3d7ae690dc9e1fa (cherry picked from commit de66953c0ae83c3a65e3c142e9dd8b0f145e040a) --- core/api/current.txt | 8 +++ media/java/android/media/MediaFormat.java | 68 +++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 6b27567323d43..78c7f939d5560 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -22150,6 +22150,14 @@ package android.media { field public static final String KEY_TILE_HEIGHT = "tile-height"; field public static final String KEY_TILE_WIDTH = "tile-width"; field public static final String KEY_TRACK_ID = "track-id"; + field public static final String KEY_VIDEO_QP_B_MAX = "video-qp-b-max"; + field public static final String KEY_VIDEO_QP_B_MIN = "video-qp-b-min"; + field public static final String KEY_VIDEO_QP_I_MAX = "video-qp-i-max"; + field public static final String KEY_VIDEO_QP_I_MIN = "video-qp-i-min"; + field public static final String KEY_VIDEO_QP_MAX = "video-qp-max"; + field public static final String KEY_VIDEO_QP_MIN = "video-qp-min"; + field public static final String KEY_VIDEO_QP_P_MAX = "video-qp-p-max"; + field public static final String KEY_VIDEO_QP_P_MIN = "video-qp-p-min"; field public static final String KEY_WIDTH = "width"; field public static final String MIMETYPE_AUDIO_AAC = "audio/mp4a-latm"; field public static final String MIMETYPE_AUDIO_AC3 = "audio/ac3"; diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index 67f1660fff782..f8a642a68dd74 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -979,6 +979,74 @@ public final class MediaFormat { */ public static final String KEY_BITRATE_MODE = "bitrate-mode"; + /** + * A key describing the maximum Quantization Parameter allowed for encoding video. + * This key applies to all three video frame types (I, P, and B). This value fills + * in for any of the frame-specific #KEY_VIDEO_QP_I_MAX, #KEY_VIDEO_QP_P_MAX, or + * #KEY_VIDEO_QP_B_MAX keys that are not specified + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_MAX = "video-qp-max"; + + /** + * A key describing the maximum Quantization Parameter allowed for encoding video. + * This key applies to all three video frame types (I, P, and B). This value fills + * in for any of the frame-specific #KEY_VIDEO_QP_I_MIN, #KEY_VIDEO_QP_P_MIN, or + * #KEY_VIDEO_QP_B_MIN keys that are not specified + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_MIN = "video-qp-min"; + + /** + * A key describing the maximum Quantization Parameter allowed for encoding video. + * This value applies to video I-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_I_MAX = "video-qp-i-max"; + + /** + * A key describing the minimum Quantization Parameter allowed for encoding video. + * This value applies to video I-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_I_MIN = "video-qp-i-min"; + + /** + * A key describing the maximum Quantization Parameter allowed for encoding video. + * This value applies to video P-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_P_MAX = "video-qp-p-max"; + + /** + * A key describing the minimum Quantization Parameter allowed for encoding video. + * This value applies to video P-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_P_MIN = "video-qp-p-min"; + + /** + * A key describing the maximum Quantization Parameter allowed for encoding video. + * This value applies to video B-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_B_MAX = "video-qp-b-max"; + + /** + * A key describing the minimum Quantization Parameter allowed for encoding video. + * This value applies to video B-frames. + * + * The associated value is an integer. + */ + public static final String KEY_VIDEO_QP_B_MIN = "video-qp-b-min"; + /** * A key describing the audio session ID of the AudioTrack associated * to a tunneled video codec.