Loading media/java/android/media/videoeditor/MediaImageItem.java +20 −0 Original line number Diff line number Diff line Loading @@ -116,10 +116,30 @@ public class MediaImageItem extends MediaItem { } /** * This method will adjust the duration of bounding transitions if the * current duration of the transactions become greater than the maximum * allowable duration. * * @param durationMs The duration of the image in the storyboard timeline */ public void setDuration(long durationMs) { mDurationMs = durationMs; // Check if the duration of transitions need to be adjusted if (mBeginTransition != null) { final long maxDurationMs = mBeginTransition.getMaximumDuration(); if (mBeginTransition.getDuration() > maxDurationMs) { mBeginTransition.setDuration(maxDurationMs); } } if (mEndTransition != null) { final long maxDurationMs = mEndTransition.getMaximumDuration(); if (mEndTransition.getDuration() > maxDurationMs) { mEndTransition.setDuration(maxDurationMs); } } // TODO: Validate/modify the start and the end time of effects and overlays } Loading media/java/android/media/videoeditor/MediaItem.java +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public abstract class MediaItem { } /** * @return The of the media item * @return The id of the media item */ public String getId() { return mUniqueId; Loading media/java/android/media/videoeditor/MediaVideoItem.java +24 −4 Original line number Diff line number Diff line Loading @@ -245,7 +245,10 @@ public class MediaVideoItem extends MediaItem { } /** * Sets the start and end marks for trimming a video media item * Sets the start and end marks for trimming a video media item. * This method will adjust the duration of bounding transitions if the * current duration of the transactions become greater than the maximum * allowable duration. * * @param beginMs Start time in milliseconds. Set to 0 to extract from the * beginning Loading @@ -265,18 +268,35 @@ public class MediaVideoItem extends MediaItem { } if (beginMs != mBeginBoundaryTimeMs) { mBeginBoundaryTimeMs = beginMs; if (mBeginTransition != null) { mBeginTransition.invalidate(); } } if (endMs == mEndBoundaryTimeMs) { mEndBoundaryTimeMs = endMs; if (endMs != mEndBoundaryTimeMs) { if (mEndTransition != null) { mEndTransition.invalidate(); } } mBeginBoundaryTimeMs = beginMs; mEndBoundaryTimeMs = endMs; // Check if the duration of transitions need to be adjusted if (mBeginTransition != null) { final long maxDurationMs = mBeginTransition.getMaximumDuration(); if (mBeginTransition.getDuration() > maxDurationMs) { mBeginTransition.setDuration(maxDurationMs); } } if (mEndTransition != null) { final long maxDurationMs = mEndTransition.getMaximumDuration(); if (mEndTransition.getDuration() > maxDurationMs) { mEndTransition.setDuration(maxDurationMs); } } // TODO: Validate/modify the start and the end time of effects and overlays } Loading media/java/android/media/videoeditor/Transition.java +21 −0 Original line number Diff line number Diff line Loading @@ -124,7 +124,12 @@ public abstract class Transition { * @param durationMs the duration of the transition in milliseconds */ public void setDuration(long durationMs) { if (durationMs > getMaximumDuration()) { throw new IllegalArgumentException("The duration is too large"); } mDurationMs = durationMs; invalidate(); } /** Loading @@ -134,6 +139,22 @@ public abstract class Transition { return mDurationMs; } /** * The duration of a transition cannot be greater than half of the minimum * duration of the bounding media items. * * @return The maximum duration of this transition */ public long getMaximumDuration() { if (mAfterMediaItem == null) { return mBeforeMediaItem.getDuration() / 2; } else if (mBeforeMediaItem == null) { return mAfterMediaItem.getDuration() / 2; } else { return (Math.min(mAfterMediaItem.getDuration(), mBeforeMediaItem.getDuration()) / 2); } } /** * @return The behavior */ Loading Loading
media/java/android/media/videoeditor/MediaImageItem.java +20 −0 Original line number Diff line number Diff line Loading @@ -116,10 +116,30 @@ public class MediaImageItem extends MediaItem { } /** * This method will adjust the duration of bounding transitions if the * current duration of the transactions become greater than the maximum * allowable duration. * * @param durationMs The duration of the image in the storyboard timeline */ public void setDuration(long durationMs) { mDurationMs = durationMs; // Check if the duration of transitions need to be adjusted if (mBeginTransition != null) { final long maxDurationMs = mBeginTransition.getMaximumDuration(); if (mBeginTransition.getDuration() > maxDurationMs) { mBeginTransition.setDuration(maxDurationMs); } } if (mEndTransition != null) { final long maxDurationMs = mEndTransition.getMaximumDuration(); if (mEndTransition.getDuration() > maxDurationMs) { mEndTransition.setDuration(maxDurationMs); } } // TODO: Validate/modify the start and the end time of effects and overlays } Loading
media/java/android/media/videoeditor/MediaItem.java +1 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public abstract class MediaItem { } /** * @return The of the media item * @return The id of the media item */ public String getId() { return mUniqueId; Loading
media/java/android/media/videoeditor/MediaVideoItem.java +24 −4 Original line number Diff line number Diff line Loading @@ -245,7 +245,10 @@ public class MediaVideoItem extends MediaItem { } /** * Sets the start and end marks for trimming a video media item * Sets the start and end marks for trimming a video media item. * This method will adjust the duration of bounding transitions if the * current duration of the transactions become greater than the maximum * allowable duration. * * @param beginMs Start time in milliseconds. Set to 0 to extract from the * beginning Loading @@ -265,18 +268,35 @@ public class MediaVideoItem extends MediaItem { } if (beginMs != mBeginBoundaryTimeMs) { mBeginBoundaryTimeMs = beginMs; if (mBeginTransition != null) { mBeginTransition.invalidate(); } } if (endMs == mEndBoundaryTimeMs) { mEndBoundaryTimeMs = endMs; if (endMs != mEndBoundaryTimeMs) { if (mEndTransition != null) { mEndTransition.invalidate(); } } mBeginBoundaryTimeMs = beginMs; mEndBoundaryTimeMs = endMs; // Check if the duration of transitions need to be adjusted if (mBeginTransition != null) { final long maxDurationMs = mBeginTransition.getMaximumDuration(); if (mBeginTransition.getDuration() > maxDurationMs) { mBeginTransition.setDuration(maxDurationMs); } } if (mEndTransition != null) { final long maxDurationMs = mEndTransition.getMaximumDuration(); if (mEndTransition.getDuration() > maxDurationMs) { mEndTransition.setDuration(maxDurationMs); } } // TODO: Validate/modify the start and the end time of effects and overlays } Loading
media/java/android/media/videoeditor/Transition.java +21 −0 Original line number Diff line number Diff line Loading @@ -124,7 +124,12 @@ public abstract class Transition { * @param durationMs the duration of the transition in milliseconds */ public void setDuration(long durationMs) { if (durationMs > getMaximumDuration()) { throw new IllegalArgumentException("The duration is too large"); } mDurationMs = durationMs; invalidate(); } /** Loading @@ -134,6 +139,22 @@ public abstract class Transition { return mDurationMs; } /** * The duration of a transition cannot be greater than half of the minimum * duration of the bounding media items. * * @return The maximum duration of this transition */ public long getMaximumDuration() { if (mAfterMediaItem == null) { return mBeforeMediaItem.getDuration() / 2; } else if (mBeforeMediaItem == null) { return mAfterMediaItem.getDuration() / 2; } else { return (Math.min(mAfterMediaItem.getDuration(), mBeforeMediaItem.getDuration()) / 2); } } /** * @return The behavior */ Loading