Merge "Remove unused and hidden setVideoEncoderLevel() from MediaRecorder.java"
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index b6da308..b5e85a0 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -498,6 +498,7 @@
handleSinkPlayingStateChange(device, BluetoothA2dp.STATE_NOT_PLAYING,
BluetoothA2dp.STATE_PLAYING);
} else {
+ mPlayingA2dpDevice = null;
int prevState = mAudioDevices.get(device);
handleSinkStateChange(device, prevState, state);
}
@@ -512,7 +513,6 @@
mSinkCount--;
} else if (state == BluetoothA2dp.STATE_CONNECTED) {
mSinkCount ++;
- mPlayingA2dpDevice = null;
}
mAudioDevices.put(device, state);
diff --git a/media/java/android/media/videoeditor/MediaImageItem.java b/media/java/android/media/videoeditor/MediaImageItem.java
index df3c5fb..d2f3694 100755
--- a/media/java/android/media/videoeditor/MediaImageItem.java
+++ b/media/java/android/media/videoeditor/MediaImageItem.java
@@ -163,7 +163,9 @@
public void setDuration(long durationMs) {
mDurationMs = durationMs;
- adjustElementsDuration();
+ adjustTransitions();
+ adjustOverlays();
+ adjustEffects();
}
/*
diff --git a/media/java/android/media/videoeditor/MediaItem.java b/media/java/android/media/videoeditor/MediaItem.java
index d9c38af..40d3619 100755
--- a/media/java/android/media/videoeditor/MediaItem.java
+++ b/media/java/android/media/videoeditor/MediaItem.java
@@ -40,13 +40,21 @@
* clip are rendered black.
*/
public static final int RENDERING_MODE_BLACK_BORDER = 0;
+
/**
* When using the RENDERING_MODE_STRETCH rendering mode video frames are
* stretched horizontally or vertically to match the current aspect ratio of
- * the movie.
+ * the video editor.
*/
public static final int RENDERING_MODE_STRETCH = 1;
+ /**
+ * When using the RENDERING_MODE_CROPPING rendering mode video frames are
+ * scaled horizontally or vertically by preserving the original aspect
+ * ratio of the media item.
+ */
+ public static final int RENDERING_MODE_CROPPING = 2;
+
// The unique id of the MediaItem
private final String mUniqueId;
@@ -476,10 +484,9 @@
}
/**
- * Adjust the duration of effects, overlays and transitions.
- * This method will be called after a media item duration is changed.
+ * Adjust the duration transitions.
*/
- protected void adjustElementsDuration() {
+ protected void adjustTransitions() {
// Check if the duration of transitions need to be adjusted
if (mBeginTransition != null) {
final long maxDurationMs = mBeginTransition.getMaximumDuration();
@@ -494,31 +501,12 @@
mEndTransition.setDuration(maxDurationMs);
}
}
+ }
- final List<Overlay> overlays = getAllOverlays();
- for (Overlay overlay : overlays) {
- // Adjust the start time if necessary
- final long overlayStartTimeMs;
- if (overlay.getStartTime() > getTimelineDuration()) {
- overlayStartTimeMs = 0;
- } else {
- overlayStartTimeMs = overlay.getStartTime();
- }
-
- // Adjust the duration if necessary
- final long overlayDurationMs;
- if (overlayStartTimeMs + overlay.getDuration() > getTimelineDuration()) {
- overlayDurationMs = getTimelineDuration() - overlayStartTimeMs;
- } else {
- overlayDurationMs = overlay.getDuration();
- }
-
- if (overlayStartTimeMs != overlay.getStartTime() ||
- overlayDurationMs != overlay.getDuration()) {
- overlay.setStartTimeAndDuration(overlayStartTimeMs, overlayDurationMs);
- }
- }
-
+ /**
+ * Adjust the start time and/or duration of effects.
+ */
+ protected void adjustEffects() {
final List<Effect> effects = getAllEffects();
for (Effect effect : effects) {
// Adjust the start time if necessary
@@ -543,4 +531,33 @@
}
}
}
+
+ /**
+ * Adjust the start time and/or duration of overlays.
+ */
+ protected void adjustOverlays() {
+ final List<Overlay> overlays = getAllOverlays();
+ for (Overlay overlay : overlays) {
+ // Adjust the start time if necessary
+ final long overlayStartTimeMs;
+ if (overlay.getStartTime() > getTimelineDuration()) {
+ overlayStartTimeMs = 0;
+ } else {
+ overlayStartTimeMs = overlay.getStartTime();
+ }
+
+ // Adjust the duration if necessary
+ final long overlayDurationMs;
+ if (overlayStartTimeMs + overlay.getDuration() > getTimelineDuration()) {
+ overlayDurationMs = getTimelineDuration() - overlayStartTimeMs;
+ } else {
+ overlayDurationMs = overlay.getDuration();
+ }
+
+ if (overlayStartTimeMs != overlay.getStartTime() ||
+ overlayDurationMs != overlay.getDuration()) {
+ overlay.setStartTimeAndDuration(overlayStartTimeMs, overlayDurationMs);
+ }
+ }
+ }
}
diff --git a/media/java/android/media/videoeditor/MediaVideoItem.java b/media/java/android/media/videoeditor/MediaVideoItem.java
index f71f4f4..341bf8e 100755
--- a/media/java/android/media/videoeditor/MediaVideoItem.java
+++ b/media/java/android/media/videoeditor/MediaVideoItem.java
@@ -155,7 +155,11 @@
mBeginBoundaryTimeMs = beginMs;
mEndBoundaryTimeMs = endMs;
- adjustElementsDuration();
+ adjustTransitions();
+
+ // Note that the start and duration of any effects and overlays are
+ // not adjusted nor are they automatically removed if they fall
+ // outside the new boundaries.
}
/**