From 9a4575c31411524f5037f78666cdb648a07a5682 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Thu, 9 May 2013 12:20:34 -0700 Subject: [PATCH] MediaFormat.java: Add KEY_MAX_WIDTH and KEY_MAX_HEIGHT KEY_MAX_WIDTH and KEY_MAX_HEIGHT are optional video decoder format keys. Specify both to request seamless resolution- change support from video decoders that support this feature. You can check this via CodecCapabilities.isFeatureSupported. The codecs use the MAX_WIDTH/HEIGHT values as hints for the range of resolutions that needs to be supported. Note, however, that some codecs may require more memory just by _preparing_ for larger maximum resolutions, whether or not that resolution is actually used. Change-Id: I00fe986ef894fec4bb39bceed081da0e88725d59 Signed-off-by: Lajos Molnar Related-to-bug: 7093648 --- api/current.txt | 2 ++ media/java/android/media/MediaFormat.java | 24 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/api/current.txt b/api/current.txt index 8366333257cf4..de53dcfba6826 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12713,7 +12713,9 @@ package android.media { field public static final java.lang.String KEY_IS_ADTS = "is-adts"; field public static final java.lang.String KEY_I_FRAME_INTERVAL = "i-frame-interval"; field public static final java.lang.String KEY_LANGUAGE = "language"; + field public static final java.lang.String KEY_MAX_HEIGHT = "max-height"; field public static final java.lang.String KEY_MAX_INPUT_SIZE = "max-input-size"; + field public static final java.lang.String KEY_MAX_WIDTH = "max-width"; field public static final java.lang.String KEY_MIME = "mime"; field public static final java.lang.String KEY_PUSH_BLANK_BUFFERS_ON_STOP = "push-blank-buffers-on-shutdown"; field public static final java.lang.String KEY_REPEAT_PREVIOUS_FRAME_AFTER = "repeat-previous-frame-after"; diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index 949a42c070556..01658c505497e 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -44,9 +44,19 @@ import java.util.Map; * for encoders, readable in the output format of decoders * {@link #KEY_FRAME_RATE}Integer or Floatencoder-only * {@link #KEY_I_FRAME_INTERVAL}Integerencoder-only + * {@link #KEY_MAX_WIDTH}Integerdecoder-only, optional, max-resolution width + * {@link #KEY_MAX_HEIGHT}Integerdecoder-only, optional, max-resolution height * {@link #KEY_REPEAT_PREVIOUS_FRAME_AFTER}Longvideo encoder in surface-mode only * {@link #KEY_PUSH_BLANK_BUFFERS_ON_STOP}Integer(1)video decoder rendering to a surface only * + * Specify both {@link #KEY_MAX_WIDTH} and {@link #KEY_MAX_HEIGHT} to enable + * adaptive playback (seamless resolution change) for a video decoder that + * supports it ({@link MediaCodecInfo.CodecCapabilities#FEATURE_AdaptivePlayback}). + * The values are used as hints for the codec: they are the maximum expected + * resolution to prepare for. Depending on codec support, preparing for larger + * maximum resolution may require more memory even if that resolution is never + * reached. These fields have no effect for codecs that do not support adaptive + * playback.

* * Audio formats have the following keys: * @@ -104,6 +114,20 @@ public final class MediaFormat { */ public static final String KEY_HEIGHT = "height"; + /** + * A key describing the maximum expected width of the content in a video + * decoder format, in case there are resolution changes in the video content. + * The associated value is an integer + */ + public static final String KEY_MAX_WIDTH = "max-width"; + + /** + * A key describing the maximum expected height of the content in a video + * decoder format, in case there are resolution changes in the video content. + * The associated value is an integer + */ + public static final String KEY_MAX_HEIGHT = "max-height"; + /** A key describing the maximum size in bytes of a buffer of data * described by this MediaFormat. * The associated value is an integer