Merge "MediaFormat: added subtitle format" into klp-dev

This commit is contained in:
Lajos Molnar
2013-08-16 19:15:24 +00:00
committed by Android (Google) Code Review
2 changed files with 31 additions and 1 deletions

View File

@ -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";

View File

@ -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, <b>all keys not marked optional are mandatory</b>:
* Keys common to all audio/video formats, <b>all keys not marked optional are mandatory</b>:
*
* <table>
* <tr><th>Name</th><th>Value Type</th><th>Description</th></tr>
@ -57,6 +57,11 @@ import java.util.Map;
* <tr><td>{@link #KEY_FLAC_COMPRESSION_LEVEL}</td><td>Integer</td><td><b>encoder-only</b>, optional, if content is FLAC audio, specifies the desired compression level.</td></tr>
* </table>
*
* Subtitle formats have the following keys:
* <table>
* <tr><td>{@link #KEY_MIME}</td><td>String</td><td>The type of the format.</td></tr>
* <tr><td>{@link #KEY_LANGUAGE}</td><td>String</td><td>The language of the content.</td></tr>
* </table>
*/
public final class MediaFormat {
private Map<String, Object> 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.