diff --git a/api/current.txt b/api/current.txt
index faf88e520aa7f..1e356478126fb 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12601,6 +12601,7 @@ package android.media {
ctor public MediaFormat();
method public final boolean containsKey(java.lang.String);
method public static final android.media.MediaFormat createAudioFormat(java.lang.String, int, int);
+ method public static final android.media.MediaFormat createSubtitleFormat(java.lang.String, java.lang.String);
method public static final android.media.MediaFormat createVideoFormat(java.lang.String, int, int);
method public final java.nio.ByteBuffer getByteBuffer(java.lang.String);
method public final float getFloat(java.lang.String);
@@ -12623,6 +12624,7 @@ package android.media {
field public static final java.lang.String KEY_HEIGHT = "height";
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_INPUT_SIZE = "max-input-size";
field public static final java.lang.String KEY_MIME = "mime";
field public static final java.lang.String KEY_SAMPLE_RATE = "sample-rate";
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index 3fbaf69576fef..278d6616da488 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -26,7 +26,7 @@ import java.util.Map;
*
* The format of the media data is specified as string/value pairs.
*
- * Keys common to all formats, all keys not marked optional are mandatory:
+ * Keys common to all audio/video formats, all keys not marked optional are mandatory:
*
*
* | Name | Value Type | Description |
@@ -57,6 +57,11 @@ import java.util.Map;
* | {@link #KEY_FLAC_COMPRESSION_LEVEL} | Integer | encoder-only, optional, if content is FLAC audio, specifies the desired compression level. |
*
*
+ * Subtitle formats have the following keys:
+ *
+ * | {@link #KEY_MIME} | String | The type of the format. |
+ * | {@link #KEY_LANGUAGE} | String | The language of the content. |
+ *
*/
public final class MediaFormat {
private Map mMap;
@@ -67,6 +72,12 @@ public final class MediaFormat {
*/
public static final String KEY_MIME = "mime";
+ /**
+ * A key describing the language of the content.
+ * The associated value is a string.
+ */
+ public static final String KEY_LANGUAGE = "language";
+
/**
* A key describing the sample rate of an audio format.
* The associated value is an integer
@@ -276,6 +287,23 @@ public final class MediaFormat {
return format;
}
+ /**
+ * Creates a minimal subtitle format.
+ * @param mime The mime type of the content.
+ * @param language The language of the content. Specify "und" if language
+ * information is only included in the content (similarly, if there
+ * are multiple language tracks in the content.)
+ */
+ public static final MediaFormat createSubtitleFormat(
+ String mime,
+ String language) {
+ MediaFormat format = new MediaFormat();
+ format.setString(KEY_MIME, mime);
+ format.setString(KEY_LANGUAGE, language);
+
+ return format;
+ }
+
/**
* Creates a minimal video format.
* @param mime The mime type of the content.