Merge "Define MediaFormat crop-related constants" into tm-dev
This commit is contained in:
@@ -22240,6 +22240,10 @@ package android.media {
|
|||||||
field public static final String KEY_COLOR_TRANSFER_REQUEST = "color-transfer-request";
|
field public static final String KEY_COLOR_TRANSFER_REQUEST = "color-transfer-request";
|
||||||
field public static final String KEY_COMPLEXITY = "complexity";
|
field public static final String KEY_COMPLEXITY = "complexity";
|
||||||
field public static final String KEY_CREATE_INPUT_SURFACE_SUSPENDED = "create-input-buffers-suspended";
|
field public static final String KEY_CREATE_INPUT_SURFACE_SUSPENDED = "create-input-buffers-suspended";
|
||||||
|
field public static final String KEY_CROP_BOTTOM = "crop-bottom";
|
||||||
|
field public static final String KEY_CROP_LEFT = "crop-left";
|
||||||
|
field public static final String KEY_CROP_RIGHT = "crop-right";
|
||||||
|
field public static final String KEY_CROP_TOP = "crop-top";
|
||||||
field public static final String KEY_DURATION = "durationUs";
|
field public static final String KEY_DURATION = "durationUs";
|
||||||
field public static final String KEY_ENCODER_DELAY = "encoder-delay";
|
field public static final String KEY_ENCODER_DELAY = "encoder-delay";
|
||||||
field public static final String KEY_ENCODER_PADDING = "encoder-padding";
|
field public static final String KEY_ENCODER_PADDING = "encoder-padding";
|
||||||
|
|||||||
@@ -223,19 +223,19 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{@code "crop-left"}</td>
|
<td>{@link MediaFormat#KEY_CROP_LEFT}</td>
|
||||||
<td>Integer</td>
|
<td>Integer</td>
|
||||||
<td>The left-coordinate (x) of the crop rectangle</td>
|
<td>The left-coordinate (x) of the crop rectangle</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td>{@code "crop-top"}</td>
|
<td>{@link MediaFormat#KEY_CROP_TOP}</td>
|
||||||
<td>Integer</td>
|
<td>Integer</td>
|
||||||
<td>The top-coordinate (y) of the crop rectangle</td>
|
<td>The top-coordinate (y) of the crop rectangle</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td>{@code "crop-right"}</td>
|
<td>{@link MediaFormat#KEY_CROP_RIGHT}</td>
|
||||||
<td>Integer</td>
|
<td>Integer</td>
|
||||||
<td>The right-coordinate (x) <strong>MINUS 1</strong> of the crop rectangle</td>
|
<td>The right-coordinate (x) <strong>MINUS 1</strong> of the crop rectangle</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td>{@code "crop-bottom"}</td>
|
<td>{@link MediaFormat#KEY_CROP_BOTTOM}</td>
|
||||||
<td>Integer</td>
|
<td>Integer</td>
|
||||||
<td>The bottom-coordinate (y) <strong>MINUS 1</strong> of the crop rectangle</td>
|
<td>The bottom-coordinate (y) <strong>MINUS 1</strong> of the crop rectangle</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
@@ -251,12 +251,16 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
<pre class=prettyprint>
|
<pre class=prettyprint>
|
||||||
MediaFormat format = decoder.getOutputFormat(…);
|
MediaFormat format = decoder.getOutputFormat(…);
|
||||||
int width = format.getInteger(MediaFormat.KEY_WIDTH);
|
int width = format.getInteger(MediaFormat.KEY_WIDTH);
|
||||||
if (format.containsKey("crop-left") && format.containsKey("crop-right")) {
|
if (format.containsKey(MediaFormat.KEY_CROP_LEFT)
|
||||||
width = format.getInteger("crop-right") + 1 - format.getInteger("crop-left");
|
&& format.containsKey(MediaFormat.KEY_CROP_RIGHT)) {
|
||||||
|
width = format.getInteger(MediaFormat.KEY_CROP_RIGHT) + 1
|
||||||
|
- format.getInteger(MediaFormat.KEY_CROP_LEFT);
|
||||||
}
|
}
|
||||||
int height = format.getInteger(MediaFormat.KEY_HEIGHT);
|
int height = format.getInteger(MediaFormat.KEY_HEIGHT);
|
||||||
if (format.containsKey("crop-top") && format.containsKey("crop-bottom")) {
|
if (format.containsKey(MediaFormat.KEY_CROP_TOP)
|
||||||
height = format.getInteger("crop-bottom") + 1 - format.getInteger("crop-top");
|
&& format.containsKey(MediaFormat.KEY_CROP_BOTTOM)) {
|
||||||
|
height = format.getInteger(MediaFormat.KEY_CROP_BOTTOM) + 1
|
||||||
|
- format.getInteger(MediaFormat.KEY_CROP_TOP);
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
<p class=note>
|
<p class=note>
|
||||||
|
|||||||
@@ -358,6 +358,42 @@ public final class MediaFormat {
|
|||||||
*/
|
*/
|
||||||
public static final String KEY_HEIGHT = "height";
|
public static final String KEY_HEIGHT = "height";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A key describing the bottom-coordinate (y) of the crop rectangle.
|
||||||
|
* This is the bottom-most row included in the crop frame,
|
||||||
|
* where row indices start at 0.
|
||||||
|
* Additional information on the crop rectangle semantics can be found at
|
||||||
|
* {@link android.media.MediaCodec}.
|
||||||
|
*/
|
||||||
|
public static final String KEY_CROP_BOTTOM = "crop-bottom";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A key describing the left-coordinate (x) of the crop rectangle.
|
||||||
|
* This is the left-most column included in the crop frame,
|
||||||
|
* where column indices start at 0.
|
||||||
|
* Additional information on the crop rectangle semantics can be found at
|
||||||
|
* {@link android.media.MediaCodec}.
|
||||||
|
*/
|
||||||
|
public static final String KEY_CROP_LEFT = "crop-left";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A key describing the right-coordinate (x) of the crop rectangle.
|
||||||
|
* This is the right-most column included in the crop frame,
|
||||||
|
* where column indices start at 0.
|
||||||
|
* Additional information on the crop rectangle semantics can be found at
|
||||||
|
* {@link android.media.MediaCodec}.
|
||||||
|
*/
|
||||||
|
public static final String KEY_CROP_RIGHT = "crop-right";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A key describing the top-coordinate (y) of the crop rectangle.
|
||||||
|
* This is the top-most row included in the crop frame,
|
||||||
|
* where row indices start at 0.
|
||||||
|
* Additional information on the crop rectangle semantics can be found at
|
||||||
|
* {@link android.media.MediaCodec}.
|
||||||
|
*/
|
||||||
|
public static final String KEY_CROP_TOP = "crop-top";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A key describing the maximum expected width of the content in a video
|
* 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.
|
* decoder format, in case there are resolution changes in the video content.
|
||||||
|
|||||||
Reference in New Issue
Block a user