media: expose audio sample format in MediaFormat
Bug: 27172163
Change-Id: I0ae4c0299839612893bb8a43e7016e49487e1a51
diff --git a/api/current.txt b/api/current.txt
index 5d28d2c..e8558cd 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -20971,6 +20971,7 @@
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_OPERATING_RATE = "operating-rate";
+ field public static final java.lang.String KEY_PCM_ENCODING = "pcm-encoding";
field public static final java.lang.String KEY_PRIORITY = "priority";
field public static final java.lang.String KEY_PROFILE = "profile";
field public static final java.lang.String KEY_PUSH_BLANK_BUFFERS_ON_STOP = "push-blank-buffers-on-shutdown";
diff --git a/api/system-current.txt b/api/system-current.txt
index a2943ff..929afa7 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -22470,6 +22470,7 @@
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_OPERATING_RATE = "operating-rate";
+ field public static final java.lang.String KEY_PCM_ENCODING = "pcm-encoding";
field public static final java.lang.String KEY_PRIORITY = "priority";
field public static final java.lang.String KEY_PROFILE = "profile";
field public static final java.lang.String KEY_PUSH_BLANK_BUFFERS_ON_STOP = "push-blank-buffers-on-shutdown";
diff --git a/api/test-current.txt b/api/test-current.txt
index d42c18c..b5e5e9e 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -20980,6 +20980,7 @@
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_OPERATING_RATE = "operating-rate";
+ field public static final java.lang.String KEY_PCM_ENCODING = "pcm-encoding";
field public static final java.lang.String KEY_PRIORITY = "priority";
field public static final java.lang.String KEY_PROFILE = "profile";
field public static final java.lang.String KEY_PUSH_BLANK_BUFFERS_ON_STOP = "push-blank-buffers-on-shutdown";
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index d06da97..646ab4e 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -65,6 +65,7 @@
* <tr><th>Name</th><th>Value Type</th><th>Description</th></tr>
* <tr><td>{@link #KEY_CHANNEL_COUNT}</td><td>Integer</td><td></td></tr>
* <tr><td>{@link #KEY_SAMPLE_RATE}</td><td>Integer</td><td></td></tr>
+ * <tr><td>{@link #KEY_PCM_ENCODING}</td><td>Integer</td><td>optional</td></tr>
* <tr><td>{@link #KEY_IS_ADTS}</td><td>Integer</td><td>optional, if <em>decoding</em> AAC audio content, setting this key to 1 indicates that each audio frame is prefixed by the ADTS header.</td></tr>
* <tr><td>{@link #KEY_AAC_PROFILE}</td><td>Integer</td><td><b>encoder-only</b>, optional, if content is AAC audio, specifies the desired profile.</td></tr>
* <tr><td>{@link #KEY_AAC_SBR_MODE}</td><td>Integer</td><td><b>encoder-only</b>, optional, if content is AAC audio, specifies the desired SBR mode.</td></tr>
@@ -197,6 +198,26 @@
public static final String KEY_FRAME_RATE = "frame-rate";
/**
+ * A key describing the raw audio sample encoding/format.
+ *
+ * <p>The associated value is an integer, using one of the
+ * {@link AudioFormat}.ENCODING_PCM_ values.</p>
+ *
+ * <p>This is an optional key for audio decoders and encoders specifying the
+ * desired raw audio sample format during {@link MediaCodec#configure
+ * MediaCodec.configure(…)} call. Use {@link MediaCodec#getInputFormat
+ * MediaCodec.getInput}/{@link MediaCodec#getOutputFormat OutputFormat(…)}
+ * to confirm the actual format. For the PCM decoder this key specifies both
+ * input and output sample encodings.</p>
+ *
+ * <p>This key is also used by {@link MediaExtractor} to specify the sample
+ * format of audio data, if it is specified.</p>
+ *
+ * <p>If this key is missing, the raw audio sample format is signed 16-bit short.</p>
+ */
+ public static final String KEY_PCM_ENCODING = "pcm-encoding";
+
+ /**
* A key describing the capture rate of a video format in frames/sec.
* <p>
* When capture rate is different than the frame rate, it means that the
@@ -564,7 +585,7 @@
public static final String KEY_IS_TIMED_TEXT = "is-timed-text";
// The following color aspect values must be in sync with the ones in HardwareAPI.h.
- /*
+ /**
* An optional key describing the color primaries, white point and
* luminance factors for video content.
*