Loading include/media/MediaProfiles.h +45 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ enum camcorder_quality { CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1006, }; /** *Set CIF as default maximum import and export resolution of video editor. *The maximum import and export resolutions are platform specific, *which should be defined in media_profiles.xml. */ enum videoeditor_capability { VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, }; enum video_decoder { VIDEO_DECODER_WMV, }; Loading Loading @@ -116,6 +128,17 @@ public: */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; /** * Returns the value for the given param name for the video editor cap * param or -1 if error. * Supported param name are: * videoeditor.input.width.max - max input video frame width * videoeditor.input.height.max - max input video frame height * videoeditor.output.width.max - max output video frame width * videoeditor.output.height.max - max output video frame height */ int getVideoEditorCapParamByName(const char *name) const; /** * Returns the audio encoders supported. */ Loading Loading @@ -164,7 +187,7 @@ private: MediaProfiles& operator=(const MediaProfiles&); // Don't call me MediaProfiles(const MediaProfiles&); // Don't call me MediaProfiles() {} // Dummy default constructor MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor ~MediaProfiles(); // Don't delete me struct VideoCodec { Loading Loading @@ -310,6 +333,22 @@ private: Vector<int> mLevels; }; struct VideoEditorCap { VideoEditorCap(int inFrameWidth, int inFrameHeight, int outFrameWidth, int outFrameHeight) : mMaxInputFrameWidth(inFrameWidth), mMaxInputFrameHeight(inFrameHeight), mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameHeight(outFrameHeight) {} ~VideoEditorCap() {} int mMaxInputFrameWidth; int mMaxInputFrameHeight; int mMaxOutputFrameWidth; int mMaxOutputFrameHeight; }; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; void initRequiredProfileRefs(const Vector<int>& cameraIds); int getRequiredProfileRefIndex(int cameraId); Loading @@ -321,6 +360,7 @@ private: static void logAudioEncoderCap(const AudioEncoderCap& cap); static void logVideoDecoderCap(const VideoDecoderCap& cap); static void logAudioDecoderCap(const AudioDecoderCap& cap); static void logVideoEditorCap(const VideoEditorCap& cap); // If the xml configuration file does exist, use the settings // from the xml Loading @@ -332,6 +372,8 @@ private: static VideoDecoderCap* createVideoDecoderCap(const char **atts); static VideoEncoderCap* createVideoEncoderCap(const char **atts); static AudioEncoderCap* createAudioEncoderCap(const char **atts); static VideoEditorCap* createVideoEditorCap( const char **atts, MediaProfiles *profiles); static CamcorderProfile* createCamcorderProfile( int cameraId, const char **atts, Vector<int>& cameraIds); Loading Loading @@ -375,6 +417,7 @@ private: static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles); static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles); static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); static void createDefaultVideoEditorCap(MediaProfiles *profiles); static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); Loading Loading @@ -431,6 +474,7 @@ private: RequiredProfiles *mRequiredProfileRefs; Vector<int> mCameraIds; VideoEditorCap* mVideoEditorCap; }; }; // namespace android Loading media/java/android/media/videoeditor/MediaArtistNativeHelper.java +7 −2 Original line number Diff line number Diff line Loading @@ -912,11 +912,14 @@ class MediaArtistNativeHelper { /** 720p 1280 X 720 */ public static final int V720p = 10; /** 1080 x 720 */ /** W720p 1080 x 720 */ public static final int W720p = 11; /** 1080 960 x 720 */ /** S720p 960 x 720 */ public static final int S720p = 12; /** 1080p 1920 x 1080 */ public static final int V1080p = 13; } /** Loading Loading @@ -3548,6 +3551,8 @@ class MediaArtistNativeHelper { retValue = VideoFrameSize.WVGA16x9; else if (height == MediaProperties.HEIGHT_720) retValue = VideoFrameSize.V720p; else if (height == MediaProperties.HEIGHT_1080) retValue = VideoFrameSize.V1080p; break; case MediaProperties.ASPECT_RATIO_4_3: if (height == MediaProperties.HEIGHT_480) Loading media/java/android/media/videoeditor/MediaImageItem.java +56 −61 Original line number Diff line number Diff line Loading @@ -503,53 +503,77 @@ public class MediaImageItem extends MediaItem { return adjustedOverlays; } /** * This function sets the Ken Burn effect generated clip * name. * This function get the proper width by given aspect ratio * and height. * * @param generatedFilePath The name of the generated clip * @param aspectRatio Given aspect ratio * @param height Given height */ @Override void setGeneratedImageClip(String generatedFilePath) { super.setGeneratedImageClip(generatedFilePath); private int getWidthByAspectRatioAndHeight(int aspectRatio, int height) { int width = 0; // set the Kenburns clip width and height mGeneratedClipHeight = getScaledHeight(); switch (mVideoEditor.getAspectRatio()) { switch (aspectRatio) { case MediaProperties.ASPECT_RATIO_3_2: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 720; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1080; if (height == MediaProperties.HEIGHT_480) width = 720; else if (height == MediaProperties.HEIGHT_720) width = 1080; break; case MediaProperties.ASPECT_RATIO_16_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_360) mGeneratedClipWidth = 640; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 854; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1280; if (height == MediaProperties.HEIGHT_360) width = 640; else if (height == MediaProperties.HEIGHT_480) width = 854; else if (height == MediaProperties.HEIGHT_720) width = 1280; else if (height == MediaProperties.HEIGHT_1080) width = 1920; break; case MediaProperties.ASPECT_RATIO_4_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 640; if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 960; if (height == MediaProperties.HEIGHT_480) width = 640; if (height == MediaProperties.HEIGHT_720) width = 960; break; case MediaProperties.ASPECT_RATIO_5_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 800; if (height == MediaProperties.HEIGHT_480) width = 800; break; case MediaProperties.ASPECT_RATIO_11_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_144) mGeneratedClipWidth = 176; if (height == MediaProperties.HEIGHT_144) width = 176; break; default : { throw new IllegalArgumentException( "Illegal arguments for aspectRatio"); } } return width; } /** * This function sets the Ken Burn effect generated clip * name. * * @param generatedFilePath The name of the generated clip */ @Override void setGeneratedImageClip(String generatedFilePath) { super.setGeneratedImageClip(generatedFilePath); // set the Kenburns clip width and height mGeneratedClipHeight = getScaledHeight(); mGeneratedClipWidth = getWidthByAspectRatioAndHeight( mVideoEditor.getAspectRatio(), mGeneratedClipHeight); } /** * @return The name of the image clip * generated with ken burns effect. Loading Loading @@ -841,37 +865,8 @@ public class MediaImageItem extends MediaItem { clipSettings.fileType = FileType.THREE_GPP; mGeneratedClipHeight = getScaledHeight(); switch (mVideoEditor.getAspectRatio()) { case MediaProperties.ASPECT_RATIO_3_2: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 720; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1080; break; case MediaProperties.ASPECT_RATIO_16_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_360) mGeneratedClipWidth = 640; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 854; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1280; break; case MediaProperties.ASPECT_RATIO_4_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 640; if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 960; break; case MediaProperties.ASPECT_RATIO_5_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 800; break; case MediaProperties.ASPECT_RATIO_11_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_144) mGeneratedClipWidth = 176; break; } mGeneratedClipWidth = getWidthByAspectRatioAndHeight( mVideoEditor.getAspectRatio(), mGeneratedClipHeight); } else { if (getGeneratedImageClip() == null) { clipSettings.clipPath = getDecodedImageFileName(); Loading media/java/android/media/videoeditor/MediaProperties.java +30 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,9 @@ package android.media.videoeditor; import android.media.videoeditor.VideoEditorProfile; import android.util.Pair; import java.lang.System; /** * This class defines all properties of a media file such as supported height, * aspect ratio, bitrate for export function. Loading @@ -33,7 +34,7 @@ public class MediaProperties { public static final int HEIGHT_360 = 360; public static final int HEIGHT_480 = 480; public static final int HEIGHT_720 = 720; public static final int HEIGHT_1088 = 1088; public static final int HEIGHT_1080 = 1080; /** * Supported aspect ratios Loading Loading @@ -63,8 +64,7 @@ public class MediaProperties { private static final Pair<Integer, Integer>[] ASPECT_RATIO_3_2_RESOLUTIONS = new Pair[] { new Pair<Integer, Integer>(720, HEIGHT_480), //*tmpLSA*/ new Pair<Integer, Integer>(1080, HEIGHT_720) /*tmpLSA*/ new Pair<Integer, Integer>(1088, HEIGHT_720) new Pair<Integer, Integer>(1080, HEIGHT_720) }; @SuppressWarnings({"unchecked"}) Loading Loading @@ -92,6 +92,7 @@ public class MediaProperties { new Pair[] { new Pair<Integer, Integer>(848, HEIGHT_480), new Pair<Integer, Integer>(1280, HEIGHT_720), new Pair<Integer, Integer>(1920, HEIGHT_1080), }; /** Loading Loading @@ -345,7 +346,31 @@ public class MediaProperties { } } return resolutions; /** Check the platform specific maximum export resolution */ VideoEditorProfile veProfile = VideoEditorProfile.get(); if (veProfile == null) { throw new RuntimeException("Can't get the video editor profile"); } final int maxWidth = veProfile.maxOutputVideoFrameWidth; final int maxHeight = veProfile.maxOutputVideoFrameHeight; Pair<Integer, Integer>[] tmpResolutions = new Pair[resolutions.length]; int numSupportedResolution = 0; int i = 0; /** Get supported resolution list */ for (i = 0; i < resolutions.length; i++) { if ((resolutions[i].first <= maxWidth) && (resolutions[i].second <= maxHeight)) { tmpResolutions[numSupportedResolution] = resolutions[i]; numSupportedResolution++; } } final Pair<Integer, Integer>[] supportedResolutions = new Pair[numSupportedResolution]; System.arraycopy(tmpResolutions, 0, supportedResolutions, 0, numSupportedResolution); return supportedResolutions; } /** Loading media/java/android/media/videoeditor/MediaVideoItem.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import java.lang.ref.SoftReference; import android.graphics.Bitmap; import android.media.videoeditor.MediaArtistNativeHelper.ClipSettings; import android.media.videoeditor.MediaArtistNativeHelper.Properties; import android.media.videoeditor.VideoEditorProfile; import android.view.Surface; import android.view.SurfaceHolder; Loading Loading @@ -118,6 +119,21 @@ public class MediaVideoItem extends MediaItem { throw new IllegalArgumentException(e.getMessage() + " : " + filename); } /** Check the platform specific maximum import resolution */ VideoEditorProfile veProfile = VideoEditorProfile.get(); if (veProfile == null) { throw new RuntimeException("Can't get the video editor profile"); } final int maxInputWidth = veProfile.maxInputVideoFrameWidth; final int maxInputHeight = veProfile.maxInputVideoFrameHeight; if ((properties.width > maxInputWidth) || (properties.height > maxInputHeight)) { throw new IllegalArgumentException( "Unsupported import resolution. Supported maximum width:" + maxInputWidth + " height:" + maxInputHeight + ", current width:" + properties.width + " height:" + properties.height); } switch (mMANativeHelper.getFileType(properties.fileType)) { case MediaProperties.FILE_3GP: case MediaProperties.FILE_MP4: Loading Loading
include/media/MediaProfiles.h +45 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ enum camcorder_quality { CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1006, }; /** *Set CIF as default maximum import and export resolution of video editor. *The maximum import and export resolutions are platform specific, *which should be defined in media_profiles.xml. */ enum videoeditor_capability { VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, }; enum video_decoder { VIDEO_DECODER_WMV, }; Loading Loading @@ -116,6 +128,17 @@ public: */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; /** * Returns the value for the given param name for the video editor cap * param or -1 if error. * Supported param name are: * videoeditor.input.width.max - max input video frame width * videoeditor.input.height.max - max input video frame height * videoeditor.output.width.max - max output video frame width * videoeditor.output.height.max - max output video frame height */ int getVideoEditorCapParamByName(const char *name) const; /** * Returns the audio encoders supported. */ Loading Loading @@ -164,7 +187,7 @@ private: MediaProfiles& operator=(const MediaProfiles&); // Don't call me MediaProfiles(const MediaProfiles&); // Don't call me MediaProfiles() {} // Dummy default constructor MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor ~MediaProfiles(); // Don't delete me struct VideoCodec { Loading Loading @@ -310,6 +333,22 @@ private: Vector<int> mLevels; }; struct VideoEditorCap { VideoEditorCap(int inFrameWidth, int inFrameHeight, int outFrameWidth, int outFrameHeight) : mMaxInputFrameWidth(inFrameWidth), mMaxInputFrameHeight(inFrameHeight), mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameHeight(outFrameHeight) {} ~VideoEditorCap() {} int mMaxInputFrameWidth; int mMaxInputFrameHeight; int mMaxOutputFrameWidth; int mMaxOutputFrameHeight; }; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; void initRequiredProfileRefs(const Vector<int>& cameraIds); int getRequiredProfileRefIndex(int cameraId); Loading @@ -321,6 +360,7 @@ private: static void logAudioEncoderCap(const AudioEncoderCap& cap); static void logVideoDecoderCap(const VideoDecoderCap& cap); static void logAudioDecoderCap(const AudioDecoderCap& cap); static void logVideoEditorCap(const VideoEditorCap& cap); // If the xml configuration file does exist, use the settings // from the xml Loading @@ -332,6 +372,8 @@ private: static VideoDecoderCap* createVideoDecoderCap(const char **atts); static VideoEncoderCap* createVideoEncoderCap(const char **atts); static AudioEncoderCap* createAudioEncoderCap(const char **atts); static VideoEditorCap* createVideoEditorCap( const char **atts, MediaProfiles *profiles); static CamcorderProfile* createCamcorderProfile( int cameraId, const char **atts, Vector<int>& cameraIds); Loading Loading @@ -375,6 +417,7 @@ private: static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles); static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles); static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); static void createDefaultVideoEditorCap(MediaProfiles *profiles); static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); Loading Loading @@ -431,6 +474,7 @@ private: RequiredProfiles *mRequiredProfileRefs; Vector<int> mCameraIds; VideoEditorCap* mVideoEditorCap; }; }; // namespace android Loading
media/java/android/media/videoeditor/MediaArtistNativeHelper.java +7 −2 Original line number Diff line number Diff line Loading @@ -912,11 +912,14 @@ class MediaArtistNativeHelper { /** 720p 1280 X 720 */ public static final int V720p = 10; /** 1080 x 720 */ /** W720p 1080 x 720 */ public static final int W720p = 11; /** 1080 960 x 720 */ /** S720p 960 x 720 */ public static final int S720p = 12; /** 1080p 1920 x 1080 */ public static final int V1080p = 13; } /** Loading Loading @@ -3548,6 +3551,8 @@ class MediaArtistNativeHelper { retValue = VideoFrameSize.WVGA16x9; else if (height == MediaProperties.HEIGHT_720) retValue = VideoFrameSize.V720p; else if (height == MediaProperties.HEIGHT_1080) retValue = VideoFrameSize.V1080p; break; case MediaProperties.ASPECT_RATIO_4_3: if (height == MediaProperties.HEIGHT_480) Loading
media/java/android/media/videoeditor/MediaImageItem.java +56 −61 Original line number Diff line number Diff line Loading @@ -503,53 +503,77 @@ public class MediaImageItem extends MediaItem { return adjustedOverlays; } /** * This function sets the Ken Burn effect generated clip * name. * This function get the proper width by given aspect ratio * and height. * * @param generatedFilePath The name of the generated clip * @param aspectRatio Given aspect ratio * @param height Given height */ @Override void setGeneratedImageClip(String generatedFilePath) { super.setGeneratedImageClip(generatedFilePath); private int getWidthByAspectRatioAndHeight(int aspectRatio, int height) { int width = 0; // set the Kenburns clip width and height mGeneratedClipHeight = getScaledHeight(); switch (mVideoEditor.getAspectRatio()) { switch (aspectRatio) { case MediaProperties.ASPECT_RATIO_3_2: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 720; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1080; if (height == MediaProperties.HEIGHT_480) width = 720; else if (height == MediaProperties.HEIGHT_720) width = 1080; break; case MediaProperties.ASPECT_RATIO_16_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_360) mGeneratedClipWidth = 640; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 854; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1280; if (height == MediaProperties.HEIGHT_360) width = 640; else if (height == MediaProperties.HEIGHT_480) width = 854; else if (height == MediaProperties.HEIGHT_720) width = 1280; else if (height == MediaProperties.HEIGHT_1080) width = 1920; break; case MediaProperties.ASPECT_RATIO_4_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 640; if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 960; if (height == MediaProperties.HEIGHT_480) width = 640; if (height == MediaProperties.HEIGHT_720) width = 960; break; case MediaProperties.ASPECT_RATIO_5_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 800; if (height == MediaProperties.HEIGHT_480) width = 800; break; case MediaProperties.ASPECT_RATIO_11_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_144) mGeneratedClipWidth = 176; if (height == MediaProperties.HEIGHT_144) width = 176; break; default : { throw new IllegalArgumentException( "Illegal arguments for aspectRatio"); } } return width; } /** * This function sets the Ken Burn effect generated clip * name. * * @param generatedFilePath The name of the generated clip */ @Override void setGeneratedImageClip(String generatedFilePath) { super.setGeneratedImageClip(generatedFilePath); // set the Kenburns clip width and height mGeneratedClipHeight = getScaledHeight(); mGeneratedClipWidth = getWidthByAspectRatioAndHeight( mVideoEditor.getAspectRatio(), mGeneratedClipHeight); } /** * @return The name of the image clip * generated with ken burns effect. Loading Loading @@ -841,37 +865,8 @@ public class MediaImageItem extends MediaItem { clipSettings.fileType = FileType.THREE_GPP; mGeneratedClipHeight = getScaledHeight(); switch (mVideoEditor.getAspectRatio()) { case MediaProperties.ASPECT_RATIO_3_2: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 720; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1080; break; case MediaProperties.ASPECT_RATIO_16_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_360) mGeneratedClipWidth = 640; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 854; else if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 1280; break; case MediaProperties.ASPECT_RATIO_4_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 640; if (mGeneratedClipHeight == MediaProperties.HEIGHT_720) mGeneratedClipWidth = 960; break; case MediaProperties.ASPECT_RATIO_5_3: if (mGeneratedClipHeight == MediaProperties.HEIGHT_480) mGeneratedClipWidth = 800; break; case MediaProperties.ASPECT_RATIO_11_9: if (mGeneratedClipHeight == MediaProperties.HEIGHT_144) mGeneratedClipWidth = 176; break; } mGeneratedClipWidth = getWidthByAspectRatioAndHeight( mVideoEditor.getAspectRatio(), mGeneratedClipHeight); } else { if (getGeneratedImageClip() == null) { clipSettings.clipPath = getDecodedImageFileName(); Loading
media/java/android/media/videoeditor/MediaProperties.java +30 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,9 @@ package android.media.videoeditor; import android.media.videoeditor.VideoEditorProfile; import android.util.Pair; import java.lang.System; /** * This class defines all properties of a media file such as supported height, * aspect ratio, bitrate for export function. Loading @@ -33,7 +34,7 @@ public class MediaProperties { public static final int HEIGHT_360 = 360; public static final int HEIGHT_480 = 480; public static final int HEIGHT_720 = 720; public static final int HEIGHT_1088 = 1088; public static final int HEIGHT_1080 = 1080; /** * Supported aspect ratios Loading Loading @@ -63,8 +64,7 @@ public class MediaProperties { private static final Pair<Integer, Integer>[] ASPECT_RATIO_3_2_RESOLUTIONS = new Pair[] { new Pair<Integer, Integer>(720, HEIGHT_480), //*tmpLSA*/ new Pair<Integer, Integer>(1080, HEIGHT_720) /*tmpLSA*/ new Pair<Integer, Integer>(1088, HEIGHT_720) new Pair<Integer, Integer>(1080, HEIGHT_720) }; @SuppressWarnings({"unchecked"}) Loading Loading @@ -92,6 +92,7 @@ public class MediaProperties { new Pair[] { new Pair<Integer, Integer>(848, HEIGHT_480), new Pair<Integer, Integer>(1280, HEIGHT_720), new Pair<Integer, Integer>(1920, HEIGHT_1080), }; /** Loading Loading @@ -345,7 +346,31 @@ public class MediaProperties { } } return resolutions; /** Check the platform specific maximum export resolution */ VideoEditorProfile veProfile = VideoEditorProfile.get(); if (veProfile == null) { throw new RuntimeException("Can't get the video editor profile"); } final int maxWidth = veProfile.maxOutputVideoFrameWidth; final int maxHeight = veProfile.maxOutputVideoFrameHeight; Pair<Integer, Integer>[] tmpResolutions = new Pair[resolutions.length]; int numSupportedResolution = 0; int i = 0; /** Get supported resolution list */ for (i = 0; i < resolutions.length; i++) { if ((resolutions[i].first <= maxWidth) && (resolutions[i].second <= maxHeight)) { tmpResolutions[numSupportedResolution] = resolutions[i]; numSupportedResolution++; } } final Pair<Integer, Integer>[] supportedResolutions = new Pair[numSupportedResolution]; System.arraycopy(tmpResolutions, 0, supportedResolutions, 0, numSupportedResolution); return supportedResolutions; } /** Loading
media/java/android/media/videoeditor/MediaVideoItem.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import java.lang.ref.SoftReference; import android.graphics.Bitmap; import android.media.videoeditor.MediaArtistNativeHelper.ClipSettings; import android.media.videoeditor.MediaArtistNativeHelper.Properties; import android.media.videoeditor.VideoEditorProfile; import android.view.Surface; import android.view.SurfaceHolder; Loading Loading @@ -118,6 +119,21 @@ public class MediaVideoItem extends MediaItem { throw new IllegalArgumentException(e.getMessage() + " : " + filename); } /** Check the platform specific maximum import resolution */ VideoEditorProfile veProfile = VideoEditorProfile.get(); if (veProfile == null) { throw new RuntimeException("Can't get the video editor profile"); } final int maxInputWidth = veProfile.maxInputVideoFrameWidth; final int maxInputHeight = veProfile.maxInputVideoFrameHeight; if ((properties.width > maxInputWidth) || (properties.height > maxInputHeight)) { throw new IllegalArgumentException( "Unsupported import resolution. Supported maximum width:" + maxInputWidth + " height:" + maxInputHeight + ", current width:" + properties.width + " height:" + properties.height); } switch (mMANativeHelper.getFileType(properties.fileType)) { case MediaProperties.FILE_3GP: case MediaProperties.FILE_MP4: Loading