summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajneesh Chowdury <rajneeshc@google.com>2011-08-12 16:43:37 -0700
committerRajneesh Chowdury <rajneeshc@google.com>2011-08-19 14:34:47 -0700
commit3ced044154945f9d60983032278e00fe28f4ab1b (patch)
tree84dc5de0042328edd75dc1a24982e7f3af9f92c9
parent16296180984756e631611005179f42865af35621 (diff)
downloadframeworks_base-3ced044154945f9d60983032278e00fe28f4ab1b.zip
frameworks_base-3ced044154945f9d60983032278e00fe28f4ab1b.tar.gz
frameworks_base-3ced044154945f9d60983032278e00fe28f4ab1b.tar.bz2
Fix for 4142219 Don't hard code platform-specific limitations (Jni/ Java)
Also fixes 5118207 add other video codec support for video editor export. Change-Id: If72427173bd8ff684af07ba00f4425c1deef29c6
-rw-r--r--include/media/MediaProfiles.h26
-rw-r--r--media/java/android/media/videoeditor/MediaArtistNativeHelper.java207
-rwxr-xr-xmedia/java/android/media/videoeditor/MediaProperties.java174
-rwxr-xr-xmedia/java/android/media/videoeditor/MediaVideoItem.java28
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditor.java2
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditorImpl.java98
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditorProfile.java48
-rw-r--r--media/jni/android_media_MediaProfiles.cpp40
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorClasses.cpp122
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorClasses.h38
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp169
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorPropertiesMain.cpp19
-rw-r--r--media/libmedia/MediaProfiles.cpp59
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java105
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java16
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java9
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java15
17 files changed, 759 insertions, 416 deletions
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
index 69d5001..4b023d1 100644
--- a/include/media/MediaProfiles.h
+++ b/include/media/MediaProfiles.h
@@ -140,6 +140,19 @@ public:
int getVideoEditorCapParamByName(const char *name) const;
/**
+ * Returns the value for the given param name for the video editor export codec format
+ * param or -1 if error.
+ * Supported param name are:
+ * videoeditor.export.profile - export video profile
+ * videoeditor.export.level - export video level
+ * Supported param codec are:
+ * 1 for h263
+ * 2 for h264
+ * 3 for mpeg4
+ */
+ int getVideoEditorExportParamByName(const char *name, int codec) const;
+
+ /**
* Returns the audio encoders supported.
*/
Vector<audio_encoder> getAudioEncoders() const;
@@ -332,7 +345,14 @@ private:
int mCameraId;
Vector<int> mLevels;
};
-
+ struct ExportVideoProfile {
+ ExportVideoProfile(int codec, int profile, int level)
+ :mCodec(codec),mProfile(profile),mLevel(level) {}
+ ~ExportVideoProfile() {}
+ int mCodec;
+ int mProfile;
+ int mLevel;
+ };
struct VideoEditorCap {
VideoEditorCap(int inFrameWidth, int inFrameHeight,
int outFrameWidth, int outFrameHeight)
@@ -374,6 +394,7 @@ private:
static AudioEncoderCap* createAudioEncoderCap(const char **atts);
static VideoEditorCap* createVideoEditorCap(
const char **atts, MediaProfiles *profiles);
+ static ExportVideoProfile* createExportVideoProfile(const char **atts);
static CamcorderProfile* createCamcorderProfile(
int cameraId, const char **atts, Vector<int>& cameraIds);
@@ -418,6 +439,8 @@ private:
static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
static void createDefaultVideoEditorCap(MediaProfiles *profiles);
+ static void createDefaultExportVideoProfiles(MediaProfiles *profiles);
+
static VideoEncoderCap* createDefaultH263VideoEncoderCap();
static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
static AudioEncoderCap* createDefaultAmrNBEncoderCap();
@@ -475,6 +498,7 @@ private:
RequiredProfiles *mRequiredProfileRefs;
Vector<int> mCameraIds;
VideoEditorCap* mVideoEditorCap;
+ Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
};
}; // namespace android
diff --git a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
index 8caa04c..b7d129d 100644
--- a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
+++ b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
@@ -79,7 +79,8 @@ class MediaArtistNativeHelper {
private boolean mRegenerateAudio = true;
private String mExportFilename = null;
-
+ private int mExportVideoCodec = 0;
+ private int mExportAudioCodec = 0;
private int mProgressToApp;
private String mRenderPreviewOverlayFile;
@@ -765,17 +766,14 @@ class MediaArtistNativeHelper {
/** No video present in output clip. Used to generate audio only clip */
public static final int NO_VIDEO = 0;
- /** H263 baseline format. */
+ /** H263 video format. */
public static final int H263 = 1;
- /** MPEG4 video Simple Profile format. */
- public static final int MPEG4 = 2;
-
- /** MPEG4 video Simple Profile format with support for EMP. */
- public static final int MPEG4_EMP = 3;
-
/** H264 video */
- public static final int H264 = 4;
+ public static final int H264 = 2;
+
+ /** MPEG4 video format. */
+ public static final int MPEG4 = 3;
/** No transcoding. Output video format is same as input video format */
public static final int NULL_VIDEO = 254;
@@ -784,96 +782,6 @@ class MediaArtistNativeHelper {
public static final int UNSUPPORTED = 255;
}
- /** Defines video profiles and levels. */
- public final class VideoProfile {
- /** H263, Profile 0, Level 10. */
- public static final int H263_PROFILE_0_LEVEL_10 = MediaProperties.H263_PROFILE_0_LEVEL_10;
-
- /** H263, Profile 0, Level 20. */
- public static final int H263_PROFILE_0_LEVEL_20 = MediaProperties.H263_PROFILE_0_LEVEL_20;
-
- /** H263, Profile 0, Level 30. */
- public static final int H263_PROFILE_0_LEVEL_30 = MediaProperties.H263_PROFILE_0_LEVEL_30;
-
- /** H263, Profile 0, Level 40. */
- public static final int H263_PROFILE_0_LEVEL_40 = MediaProperties.H263_PROFILE_0_LEVEL_40;
-
- /** H263, Profile 0, Level 45. */
- public static final int H263_PROFILE_0_LEVEL_45 = MediaProperties.H263_PROFILE_0_LEVEL_45;
-
- /** MPEG4, Simple Profile, Level 0. */
- public static final int MPEG4_SP_LEVEL_0 = MediaProperties.MPEG4_SP_LEVEL_0;
-
- /** MPEG4, Simple Profile, Level 0B. */
- public static final int MPEG4_SP_LEVEL_0B = MediaProperties.MPEG4_SP_LEVEL_0B;
-
- /** MPEG4, Simple Profile, Level 1. */
- public static final int MPEG4_SP_LEVEL_1 = MediaProperties.MPEG4_SP_LEVEL_1;
-
- /** MPEG4, Simple Profile, Level 2. */
- public static final int MPEG4_SP_LEVEL_2 = MediaProperties.MPEG4_SP_LEVEL_2;
-
- /** MPEG4, Simple Profile, Level 3. */
- public static final int MPEG4_SP_LEVEL_3 = MediaProperties.MPEG4_SP_LEVEL_3;
-
- /** MPEG4, Simple Profile, Level 4A. */
- public static final int MPEG4_SP_LEVEL_4A = MediaProperties.MPEG4_SP_LEVEL_4A;
-
- /** MPEG4, Simple Profile, Level 0. */
- public static final int MPEG4_SP_LEVEL_5 = MediaProperties.MPEG4_SP_LEVEL_5;
-
- /** H264, Profile 0, Level 1. */
- public static final int H264_PROFILE_0_LEVEL_1 = MediaProperties.H264_PROFILE_0_LEVEL_1;
-
- /** H264, Profile 0, Level 1b. */
- public static final int H264_PROFILE_0_LEVEL_1b = MediaProperties.H264_PROFILE_0_LEVEL_1B;
-
- /** H264, Profile 0, Level 1.1 */
- public static final int H264_PROFILE_0_LEVEL_1_1 = MediaProperties.H264_PROFILE_0_LEVEL_1_1;
-
- /** H264, Profile 0, Level 1.2 */
- public static final int H264_PROFILE_0_LEVEL_1_2 = MediaProperties.H264_PROFILE_0_LEVEL_1_2;
-
- /** H264, Profile 0, Level 1.3 */
- public static final int H264_PROFILE_0_LEVEL_1_3 = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
-
- /** H264, Profile 0, Level 2. */
- public static final int H264_PROFILE_0_LEVEL_2 = MediaProperties.H264_PROFILE_0_LEVEL_2;
-
- /** H264, Profile 0, Level 2.1 */
- public static final int H264_PROFILE_0_LEVEL_2_1 = MediaProperties.H264_PROFILE_0_LEVEL_2_1;
-
- /** H264, Profile 0, Level 2.2 */
- public static final int H264_PROFILE_0_LEVEL_2_2 = MediaProperties.H264_PROFILE_0_LEVEL_2_2;
-
- /** H264, Profile 0, Level 3. */
- public static final int H264_PROFILE_0_LEVEL_3 = MediaProperties.H264_PROFILE_0_LEVEL_3;
-
- /** H264, Profile 0, Level 3.1 */
- public static final int H264_PROFILE_0_LEVEL_3_1 = MediaProperties.H264_PROFILE_0_LEVEL_3_1;
-
- /** H264, Profile 0, Level 3.2 */
- public static final int H264_PROFILE_0_LEVEL_3_2 = MediaProperties.H264_PROFILE_0_LEVEL_3_2;
-
- /** H264, Profile 0, Level 4. */
- public static final int H264_PROFILE_0_LEVEL_4 = MediaProperties.H264_PROFILE_0_LEVEL_4;
-
- /** H264, Profile 0, Level 4.1 */
- public static final int H264_PROFILE_0_LEVEL_4_1 = MediaProperties.H264_PROFILE_0_LEVEL_4_1;
-
- /** H264, Profile 0, Level 4.2 */
- public static final int H264_PROFILE_0_LEVEL_4_2 = MediaProperties.H264_PROFILE_0_LEVEL_4_2;
-
- /** H264, Profile 0, Level 5. */
- public static final int H264_PROFILE_0_LEVEL_5 = MediaProperties.H264_PROFILE_0_LEVEL_5;
-
- /** H264, Profile 0, Level 5.1 */
- public static final int H264_PROFILE_0_LEVEL_5_1 = MediaProperties.H264_PROFILE_0_LEVEL_5_1;
-
- /** Profile out of range. */
- public static final int OUT_OF_RANGE = MediaProperties.UNSUPPORTED_PROFILE_LEVEL;
- }
-
/** Defines video frame sizes. */
public final class VideoFrameSize {
@@ -1620,6 +1528,16 @@ class MediaArtistNativeHelper {
public int videoFormat;
/**
+ * Profile of the video stream in the output clip.
+ */
+ public int videoProfile;
+
+ /**
+ * Level of the video stream in the output clip.
+ */
+ public int videoLevel;
+
+ /**
* Format of the audio stream in the output clip. See
* {@link AudioFormat AudioFormat} for valid values.
*/
@@ -1723,10 +1641,28 @@ class MediaArtistNativeHelper {
public float averageFrameRate;
/**
- * Profile and level of the video in the media.
+ * Profile of the video in the media.
+ */
+
+ public int profile;
+
+ /**
+ * Level of the video in the media.
+ */
+
+ public int level;
+
+ /**
+ * Is Video Profile supported.
*/
- public int profileAndLevel;
+ public boolean profileSupported;
+
+ /**
+ * Is Video Level supported.
+ */
+
+ public boolean levelSupported;
/**
* Audio format.
@@ -2112,6 +2048,25 @@ class MediaArtistNativeHelper {
}
/**
+ * Sets the export audio codec
+ *
+ * @param export audio codec
+ *
+ */
+ void setAudioCodec(int codec) {
+ mExportAudioCodec = codec;
+ }
+ /**
+ * Sets the export video codec
+ *
+ * @param export video codec
+ *
+ */
+ void setVideoCodec(int codec) {
+ mExportVideoCodec = codec;
+ }
+
+ /**
* Sets the audio regenerate flag
*
* @param flag The boolean to set the audio regenerate flag
@@ -2320,7 +2275,8 @@ class MediaArtistNativeHelper {
int err = 0;
EditSettings editSettings = null;
String EffectClipPath = null;
-
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
editSettings = new EditSettings();
editSettings.clipSettingsArray = new ClipSettings[1];
@@ -2338,6 +2294,11 @@ class MediaArtistNativeHelper {
tmpFile.delete();
}
+ outVideoProfile = VideoEditorProfile.getExportProfile(VideoFormat.H264);
+ outVideoLevel = VideoEditorProfile.getExportLevel(VideoFormat.H264);
+ editSettings.videoProfile = outVideoProfile;
+ editSettings.videoLevel= outVideoLevel;
+
if (lMediaItem instanceof MediaVideoItem) {
MediaVideoItem m = (MediaVideoItem)lMediaItem;
@@ -2399,6 +2360,8 @@ class MediaArtistNativeHelper {
String generateKenBurnsClip(EditSettings e, MediaImageItem m) {
String output = null;
int err = 0;
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
e.backgroundMusicSettings = null;
e.transitionSettingsArray = null;
@@ -2410,6 +2373,11 @@ class MediaArtistNativeHelper {
tmpFile.delete();
}
+ outVideoProfile = VideoEditorProfile.getExportProfile(VideoFormat.H264);
+ outVideoLevel = VideoEditorProfile.getExportLevel(VideoFormat.H264);
+ e.videoProfile = outVideoProfile;
+ e.videoLevel = outVideoLevel;
+
e.outputFile = output;
e.audioBitrate = Bitrate.BR_64_KBPS;
e.audioChannels = 2;
@@ -2496,8 +2464,15 @@ class MediaArtistNativeHelper {
MediaItem m1, MediaItem m2,Transition t) {
String outputFilename = null;
int err = 0;
-
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
outputFilename = String.format(mProjectPath + "/" + uniqueId + ".3gp");
+
+ outVideoProfile = VideoEditorProfile.getExportProfile(VideoFormat.H264);
+ outVideoLevel = VideoEditorProfile.getExportLevel(VideoFormat.H264);
+ e.videoProfile = outVideoProfile;
+ e.videoLevel = outVideoLevel;
+
e.outputFile = outputFilename;
e.audioBitrate = Bitrate.BR_64_KBPS;
e.audioChannels = 2;
@@ -3275,7 +3250,7 @@ class MediaArtistNativeHelper {
retValue = MediaProperties.VCODEC_H263;
break;
case VideoFormat.H264:
- retValue = MediaProperties.VCODEC_H264BP;
+ retValue = MediaProperties.VCODEC_H264;
break;
case VideoFormat.MPEG4:
retValue = MediaProperties.VCODEC_MPEG4;
@@ -3602,6 +3577,24 @@ class MediaArtistNativeHelper {
mExportFilename = filePath;
previewStoryBoard(mediaItemsList, mediaTransitionList, mediaBGMList,null);
mExportProgressListener = listener;
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
+
+ /** 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 maxOutputHeight = veProfile.maxOutputVideoFrameHeight;
+ final int maxOutputWidth = veProfile.maxOutputVideoFrameWidth;
+ if (height > maxOutputHeight) {
+ throw new IllegalArgumentException(
+ "Unsupported export resolution. Supported maximum width:" +
+ maxOutputWidth + " height:" + maxOutputHeight +
+ " current height:" + height);
+ }
+ outVideoProfile = VideoEditorProfile.getExportProfile(mExportVideoCodec);
+ outVideoLevel = VideoEditorProfile.getExportLevel(mExportVideoCodec);
mProgressToApp = 0;
@@ -3655,8 +3648,10 @@ class MediaArtistNativeHelper {
int aspectRatio = mVideoEditor.getAspectRatio();
mPreviewEditSettings.videoFrameSize = findVideoResolution(aspectRatio, height);
- mPreviewEditSettings.videoFormat = VideoFormat.H264;
- mPreviewEditSettings.audioFormat = AudioFormat.AAC;
+ mPreviewEditSettings.videoFormat = mExportVideoCodec;
+ mPreviewEditSettings.audioFormat = mExportAudioCodec;
+ mPreviewEditSettings.videoProfile = outVideoProfile;
+ mPreviewEditSettings.videoLevel = outVideoLevel;
mPreviewEditSettings.audioSamplingFreq = AudioSamplingFrequency.FREQ_32000;
mPreviewEditSettings.maxFileSize = 0;
mPreviewEditSettings.audioChannels = 2;
diff --git a/media/java/android/media/videoeditor/MediaProperties.java b/media/java/android/media/videoeditor/MediaProperties.java
index ff13e5d..fd034ab 100755
--- a/media/java/android/media/videoeditor/MediaProperties.java
+++ b/media/java/android/media/videoeditor/MediaProperties.java
@@ -135,89 +135,118 @@ public class MediaProperties {
* Video codec types
*/
public static final int VCODEC_H263 = 1;
- public static final int VCODEC_MPEG4 = 2;
- // 3 Value is used for MPEG4_EMP
- public static final int VCODEC_H264BP = 4;
- public static final int VCODEC_H264MP = 5; // Unsupported
+ public static final int VCODEC_H264 = 2;
+ public static final int VCODEC_MPEG4 = 3;
/**
* The array of supported video codecs
*/
private static final int[] SUPPORTED_VCODECS = new int[] {
- VCODEC_H264BP,
+ VCODEC_H264,
VCODEC_H263,
VCODEC_MPEG4,
};
- /* H.263 Profiles and levels */
- public static final int H263_PROFILE_0_LEVEL_10 = 0;
- public static final int H263_PROFILE_0_LEVEL_20 = 1;
- public static final int H263_PROFILE_0_LEVEL_30 = 2;
- public static final int H263_PROFILE_0_LEVEL_40 = 3;
- public static final int H263_PROFILE_0_LEVEL_45 = 4;
- /* MPEG-4 Profiles and levels */
- public static final int MPEG4_SP_LEVEL_0 = 50;
- public static final int MPEG4_SP_LEVEL_0B = 51;
- public static final int MPEG4_SP_LEVEL_1 = 52;
- public static final int MPEG4_SP_LEVEL_2 = 53;
- public static final int MPEG4_SP_LEVEL_3 = 54;
- public static final int MPEG4_SP_LEVEL_4A = 55;
- public static final int MPEG4_SP_LEVEL_5 = 56;
- /* AVC Profiles and levels */
- public static final int H264_PROFILE_0_LEVEL_1 = 150;
- public static final int H264_PROFILE_0_LEVEL_1B = 151;
- public static final int H264_PROFILE_0_LEVEL_1_1 = 152;
- public static final int H264_PROFILE_0_LEVEL_1_2 = 153;
- public static final int H264_PROFILE_0_LEVEL_1_3 = 154;
- public static final int H264_PROFILE_0_LEVEL_2 = 155;
- public static final int H264_PROFILE_0_LEVEL_2_1 = 156;
- public static final int H264_PROFILE_0_LEVEL_2_2 = 157;
- public static final int H264_PROFILE_0_LEVEL_3 = 158;
- public static final int H264_PROFILE_0_LEVEL_3_1 = 159;
- public static final int H264_PROFILE_0_LEVEL_3_2 = 160;
- public static final int H264_PROFILE_0_LEVEL_4 = 161;
- public static final int H264_PROFILE_0_LEVEL_4_1 = 162;
- public static final int H264_PROFILE_0_LEVEL_4_2 = 163;
- public static final int H264_PROFILE_0_LEVEL_5 = 164;
- public static final int H264_PROFILE_0_LEVEL_5_1 = 165;
- /* Unsupported profile and level */
- public static final int UNSUPPORTED_PROFILE_LEVEL = 255;
-
/**
- * The array of supported video codec Profile and Levels
+ * The H264 profile, the values are same as the one in OMX_Video.h
*/
- private static final int[] SUPPORTED_VCODEC_PROFILE_LEVELS = new int[] {
- H263_PROFILE_0_LEVEL_10,
- H263_PROFILE_0_LEVEL_20,
- H263_PROFILE_0_LEVEL_30,
- H263_PROFILE_0_LEVEL_40,
- H263_PROFILE_0_LEVEL_45,
- MPEG4_SP_LEVEL_0,
- MPEG4_SP_LEVEL_0B,
- MPEG4_SP_LEVEL_1,
- MPEG4_SP_LEVEL_2,
- MPEG4_SP_LEVEL_3,
- MPEG4_SP_LEVEL_4A,
- MPEG4_SP_LEVEL_5,
- H264_PROFILE_0_LEVEL_1,
- H264_PROFILE_0_LEVEL_1B,
- H264_PROFILE_0_LEVEL_1_1,
- H264_PROFILE_0_LEVEL_1_2,
- H264_PROFILE_0_LEVEL_1_3,
- H264_PROFILE_0_LEVEL_2,
- H264_PROFILE_0_LEVEL_2_1,
- H264_PROFILE_0_LEVEL_2_2,
- H264_PROFILE_0_LEVEL_3,
- H264_PROFILE_0_LEVEL_3_1,
- H264_PROFILE_0_LEVEL_3_2,
- H264_PROFILE_0_LEVEL_4,
- H264_PROFILE_0_LEVEL_4_1,
- H264_PROFILE_0_LEVEL_4_2,
- H264_PROFILE_0_LEVEL_5,
- H264_PROFILE_0_LEVEL_5_1,
- UNSUPPORTED_PROFILE_LEVEL
- };
-
+ public final class H264Profile {
+ public static final int H264ProfileBaseline = 0x01; /**< Baseline profile */
+ public static final int H264ProfileMain = 0x02; /**< Main profile */
+ public static final int H264ProfileExtended = 0x04; /**< Extended profile */
+ public static final int H264ProfileHigh = 0x08; /**< High profile */
+ public static final int H264ProfileHigh10 = 0x10; /**< High 10 profile */
+ public static final int H264ProfileHigh422 = 0x20; /**< High 4:2:2 profile */
+ public static final int H264ProfileHigh444 = 0x40; /**< High 4:4:4 profile */
+ public static final int H264ProfileUnknown = 0x7FFFFFFF;
+ }
+ /**
+ * The H264 level, the values are same as the one in OMX_Video.h
+ */
+ public final class H264Level {
+ public static final int H264Level1 = 0x01; /**< Level 1 */
+ public static final int H264Level1b = 0x02; /**< Level 1b */
+ public static final int H264Level11 = 0x04; /**< Level 1.1 */
+ public static final int H264Level12 = 0x08; /**< Level 1.2 */
+ public static final int H264Level13 = 0x10; /**< Level 1.3 */
+ public static final int H264Level2 = 0x20; /**< Level 2 */
+ public static final int H264Level21 = 0x40; /**< Level 2.1 */
+ public static final int H264Level22 = 0x80; /**< Level 2.2 */
+ public static final int H264Level3 = 0x100; /**< Level 3 */
+ public static final int H264Level31 = 0x200; /**< Level 3.1 */
+ public static final int H264Level32 = 0x400; /**< Level 3.2 */
+ public static final int H264Level4 = 0x800; /**< Level 4 */
+ public static final int H264Level41 = 0x1000; /**< Level 4.1 */
+ public static final int H264Level42 = 0x2000; /**< Level 4.2 */
+ public static final int H264Level5 = 0x4000; /**< Level 5 */
+ public static final int H264Level51 = 0x8000; /**< Level 5.1 */
+ public static final int H264LevelUnknown = 0x7FFFFFFF;
+ }
+ /**
+ * The H263 profile, the values are same as the one in OMX_Video.h
+ */
+ public final class H263Profile {
+ public static final int H263ProfileBaseline = 0x01;
+ public static final int H263ProfileH320Coding = 0x02;
+ public static final int H263ProfileBackwardCompatible = 0x04;
+ public static final int H263ProfileISWV2 = 0x08;
+ public static final int H263ProfileISWV3 = 0x10;
+ public static final int H263ProfileHighCompression = 0x20;
+ public static final int H263ProfileInternet = 0x40;
+ public static final int H263ProfileInterlace = 0x80;
+ public static final int H263ProfileHighLatency = 0x100;
+ public static final int H263ProfileUnknown = 0x7FFFFFFF;
+ }
+ /**
+ * The H263 level, the values are same as the one in OMX_Video.h
+ */
+ public final class H263Level {
+ public static final int H263Level10 = 0x01;
+ public static final int H263Level20 = 0x02;
+ public static final int H263Level30 = 0x04;
+ public static final int H263Level40 = 0x08;
+ public static final int H263Level45 = 0x10;
+ public static final int H263Level50 = 0x20;
+ public static final int H263Level60 = 0x40;
+ public static final int H263Level70 = 0x80;
+ public static final int H263LevelUnknown = 0x7FFFFFFF;
+ }
+ /**
+ * The mpeg4 profile, the values are same as the one in OMX_Video.h
+ */
+ public final class MPEG4Profile {
+ public static final int MPEG4ProfileSimple = 0x01;
+ public static final int MPEG4ProfileSimpleScalable = 0x02;
+ public static final int MPEG4ProfileCore = 0x04;
+ public static final int MPEG4ProfileMain = 0x08;
+ public static final int MPEG4ProfileNbit = 0x10;
+ public static final int MPEG4ProfileScalableTexture = 0x20;
+ public static final int MPEG4ProfileSimpleFace = 0x40;
+ public static final int MPEG4ProfileSimpleFBA = 0x80;
+ public static final int MPEG4ProfileBasicAnimated = 0x100;
+ public static final int MPEG4ProfileHybrid = 0x200;
+ public static final int MPEG4ProfileAdvancedRealTime = 0x400;
+ public static final int MPEG4ProfileCoreScalable = 0x800;
+ public static final int MPEG4ProfileAdvancedCoding = 0x1000;
+ public static final int MPEG4ProfileAdvancedCore = 0x2000;
+ public static final int MPEG4ProfileAdvancedScalable = 0x4000;
+ public static final int MPEG4ProfileAdvancedSimple = 0x8000;
+ public static final int MPEG4ProfileUnknown = 0x7FFFFFFF;
+ }
+ /**
+ * The mpeg4 level, the values are same as the one in OMX_Video.h
+ */
+ public final class MPEG4Level {
+ public static final int MPEG4Level0 = 0x01; /**< Level 0 */
+ public static final int MPEG4Level0b = 0x02; /**< Level 0b */
+ public static final int MPEG4Level1 = 0x04; /**< Level 1 */
+ public static final int MPEG4Level2 = 0x08; /**< Level 2 */
+ public static final int MPEG4Level3 = 0x10; /**< Level 3 */
+ public static final int MPEG4Level4 = 0x20; /**< Level 4 */
+ public static final int MPEG4Level4a = 0x40; /**< Level 4a */
+ public static final int MPEG4Level5 = 0x80; /**< Level 5 */
+ public static final int MPEG4LevelUnknown = 0x7FFFFFFF;
+ }
/**
* Audio codec types
*/
@@ -241,7 +270,6 @@ public class MediaProperties {
ACODEC_AMRWB
};
-
/**
* Samples per frame for each audio codec
*/
diff --git a/media/java/android/media/videoeditor/MediaVideoItem.java b/media/java/android/media/videoeditor/MediaVideoItem.java
index 0ac354b..fea751b 100755
--- a/media/java/android/media/videoeditor/MediaVideoItem.java
+++ b/media/java/android/media/videoeditor/MediaVideoItem.java
@@ -42,6 +42,7 @@ public class MediaVideoItem extends MediaItem {
private final int mFileType;
private final int mVideoType;
private final int mVideoProfile;
+ private final int mVideoLevel;
private final int mVideoBitrate;
private final long mDurationMs;
private final int mAudioBitrate;
@@ -134,6 +135,15 @@ public class MediaVideoItem extends MediaItem {
", current width:" + properties.width +
" height:" + properties.height);
}
+ /** Check the platform specific maximum video profile and level */
+ if (!properties.profileSupported) {
+ throw new IllegalArgumentException(
+ "Unsupported video profile " + properties.profile);
+ }
+ if (!properties.levelSupported) {
+ throw new IllegalArgumentException(
+ "Unsupported video level " + properties.level);
+ }
switch (mMANativeHelper.getFileType(properties.fileType)) {
case MediaProperties.FILE_3GP:
case MediaProperties.FILE_MP4:
@@ -146,8 +156,7 @@ public class MediaVideoItem extends MediaItem {
switch (mMANativeHelper.getVideoCodecType(properties.videoFormat)) {
case MediaProperties.VCODEC_H263:
- case MediaProperties.VCODEC_H264BP:
- case MediaProperties.VCODEC_H264MP:
+ case MediaProperties.VCODEC_H264:
case MediaProperties.VCODEC_MPEG4:
break;
@@ -155,18 +164,14 @@ public class MediaVideoItem extends MediaItem {
throw new IllegalArgumentException("Unsupported Video Codec Format in Input File");
}
- /* Check if the profile is unsupported. */
- if (properties.profileAndLevel == MediaProperties.UNDEFINED_VIDEO_PROFILE) {
- throw new IllegalArgumentException("Unsupported Video Codec Profile in Input File");
- }
-
mWidth = properties.width;
mHeight = properties.height;
mAspectRatio = mMANativeHelper.getAspectRatio(properties.width,
properties.height);
mFileType = mMANativeHelper.getFileType(properties.fileType);
mVideoType = mMANativeHelper.getVideoCodecType(properties.videoFormat);
- mVideoProfile = properties.profileAndLevel;
+ mVideoProfile = properties.profile;
+ mVideoLevel = properties.level;
mDurationMs = properties.videoDuration;
mVideoBitrate = properties.videoBitrate;
mAudioBitrate = properties.audioBitrate;
@@ -661,6 +666,13 @@ public class MediaVideoItem extends MediaItem {
}
/**
+ * @return The video profile
+ */
+ public int getVideoLevel() {
+ return mVideoLevel;
+ }
+
+ /**
* @return The video bitrate
*/
public int getVideoBitrate() {
diff --git a/media/java/android/media/videoeditor/VideoEditor.java b/media/java/android/media/videoeditor/VideoEditor.java
index 720e8022..424e436 100755
--- a/media/java/android/media/videoeditor/VideoEditor.java
+++ b/media/java/android/media/videoeditor/VideoEditor.java
@@ -396,7 +396,7 @@ public interface VideoEditor {
* supported for export purposes.
* @param videoCodec The video codec to be used for the export. The video
* codec values are defined in the MediaProperties class (e.g.
- * VCODEC_H264BP). Note that not all video codec types are
+ * VCODEC_H264). Note that not all video codec types are
* supported for export purposes.
* @param listener The listener for progress notifications. Use null if
* export progress notifications are not needed.
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index ea7fe63..f18dd88 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -339,42 +339,8 @@ public class VideoEditorImpl implements VideoEditor {
int audioCodec, int videoCodec,
ExportProgressListener listener)
throws IOException {
-
- switch (audioCodec) {
- case MediaProperties.ACODEC_AAC_LC:
- break;
- case MediaProperties.ACODEC_AMRNB:
- break;
-
- default: {
- String message = "Unsupported audio codec type " + audioCodec;
- throw new IllegalArgumentException(message);
- }
- }
-
- switch (videoCodec) {
- case MediaProperties.VCODEC_H263:
- break;
- case MediaProperties.VCODEC_H264BP:
- break;
- case MediaProperties.VCODEC_MPEG4:
- break;
-
- default: {
- String message = "Unsupported video codec type " + videoCodec;
- throw new IllegalArgumentException(message);
- }
- }
-
- export(filename, height, bitrate, listener);
- }
-
- /*
- * {@inheritDoc}
- */
- public void export(String filename, int height, int bitrate,
- ExportProgressListener listener)
- throws IOException {
+ int audcodec = 0;
+ int vidcodec = 0;
if (filename == null) {
throw new IllegalArgumentException("export: filename is null");
}
@@ -388,20 +354,6 @@ public class VideoEditorImpl implements VideoEditor {
throw new IllegalStateException("No MediaItems added");
}
- /** 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 maxOutputHeight = veProfile.maxOutputVideoFrameHeight;
- final int maxOutputWidth = veProfile.maxOutputVideoFrameWidth;
- if (height > maxOutputHeight) {
- throw new IllegalArgumentException(
- "Unsupported export resolution. Supported maximum width:" +
- maxOutputWidth + " height:" + maxOutputHeight +
- " current height:" + height);
- }
-
switch (height) {
case MediaProperties.HEIGHT_144:
break;
@@ -461,6 +413,36 @@ public class VideoEditorImpl implements VideoEditor {
if (MAX_SUPPORTED_FILE_SIZE <= fileSize) {
throw new IllegalStateException("Export Size is more than 2GB");
}
+ switch (audioCodec) {
+ case MediaProperties.ACODEC_AAC_LC:
+ audcodec = MediaArtistNativeHelper.AudioFormat.AAC;
+ break;
+ case MediaProperties.ACODEC_AMRNB:
+ audcodec = MediaArtistNativeHelper.AudioFormat.AMR_NB;
+ break;
+
+ default: {
+ String message = "Unsupported audio codec type " + audioCodec;
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ switch (videoCodec) {
+ case MediaProperties.VCODEC_H263:
+ vidcodec = MediaArtistNativeHelper.VideoFormat.H263;
+ break;
+ case MediaProperties.VCODEC_H264:
+ vidcodec = MediaArtistNativeHelper.VideoFormat.H264;
+ break;
+ case MediaProperties.VCODEC_MPEG4:
+ vidcodec = MediaArtistNativeHelper.VideoFormat.MPEG4;
+ break;
+
+ default: {
+ String message = "Unsupported video codec type " + videoCodec;
+ throw new IllegalArgumentException(message);
+ }
+ }
boolean semAcquireDone = false;
try {
@@ -470,7 +452,8 @@ public class VideoEditorImpl implements VideoEditor {
if (mMANativeHelper == null) {
throw new IllegalStateException("The video editor is not initialized");
}
-
+ mMANativeHelper.setAudioCodec(audcodec);
+ mMANativeHelper.setVideoCodec(vidcodec);
mMANativeHelper.export(filename, mProjectPath, height,bitrate,
mMediaItems, mTransitions, mAudioTracks, listener);
} catch (InterruptedException ex) {
@@ -485,6 +468,19 @@ public class VideoEditorImpl implements VideoEditor {
/*
* {@inheritDoc}
*/
+ public void export(String filename, int height, int bitrate,
+ ExportProgressListener listener)
+ throws IOException {
+ int defaultAudiocodec = MediaArtistNativeHelper.AudioFormat.AAC;
+ int defaultVideocodec = MediaArtistNativeHelper.VideoFormat.H264;
+
+ export(filename, height, bitrate, defaultAudiocodec,
+ defaultVideocodec, listener);
+ }
+
+ /*
+ * {@inheritDoc}
+ */
public void generatePreview(MediaProcessingProgressListener listener) {
boolean semAcquireDone = false;
try {
diff --git a/media/java/android/media/videoeditor/VideoEditorProfile.java b/media/java/android/media/videoeditor/VideoEditorProfile.java
index 7d9fc8f..ecdcdfb 100755
--- a/media/java/android/media/videoeditor/VideoEditorProfile.java
+++ b/media/java/android/media/videoeditor/VideoEditorProfile.java
@@ -31,6 +31,10 @@ package android.media.videoeditor;
*/
public class VideoEditorProfile
{
+ static {
+ System.loadLibrary("media_jni");
+ native_init();
+ }
/**
* The max input video frame width
*/
@@ -58,9 +62,42 @@ public class VideoEditorProfile
return native_get_videoeditor_profile();
}
- static {
- System.loadLibrary("media_jni");
- native_init();
+ /**
+ * Returns the supported profile by given video codec
+ */
+ public static int getExportProfile(int vidCodec) {
+ int profile = -1;
+
+ switch (vidCodec) {
+ case MediaProperties.VCODEC_H263:
+ case MediaProperties.VCODEC_H264:
+ case MediaProperties.VCODEC_MPEG4:
+ profile = native_get_videoeditor_export_profile(vidCodec);
+ break;
+ default :
+ throw new IllegalArgumentException("Unsupported video codec" + vidCodec);
+ }
+
+ return profile;
+ }
+
+ /**
+ * Returns the supported level by given video codec
+ */
+ public static int getExportLevel(int vidCodec) {
+ int level = -1;
+
+ switch (vidCodec) {
+ case MediaProperties.VCODEC_H263:
+ case MediaProperties.VCODEC_H264:
+ case MediaProperties.VCODEC_MPEG4:
+ level = native_get_videoeditor_export_profile(vidCodec);
+ break;
+ default :
+ throw new IllegalArgumentException("Unsupported video codec" + vidCodec);
+ }
+
+ return level;
}
// Private constructor called by JNI
@@ -78,5 +115,8 @@ public class VideoEditorProfile
// Methods implemented by JNI
private static native final void native_init();
private static native final VideoEditorProfile
- native_get_videoeditor_profile();
+ native_get_videoeditor_profile();
+ private static native final int native_get_videoeditor_export_profile(int codec);
+ private static native final int native_get_videoeditor_export_level(int level);
+
}
diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp
index 2b8dfe4..e5e688c 100644
--- a/media/jni/android_media_MediaProfiles.cpp
+++ b/media/jni/android_media_MediaProfiles.cpp
@@ -324,7 +324,37 @@ android_media_MediaProfiles_native_get_videoeditor_profile(JNIEnv *env, jobject
maxOutputFrameWidth,
maxOutputFrameHeight);
}
+static jint
+android_media_MediaProfiles_native_get_videoeditor_export_profile(
+ JNIEnv *env, jobject thiz, jint codec)
+{
+ LOGV("android_media_MediaProfiles_native_get_export_profile index ");
+ int profile =0;
+ profile = sProfiles->getVideoEditorExportParamByName("videoeditor.export.profile", codec);
+ // Check the values retrieved
+ if (profile == -1) {
+ jniThrowException(env, "java/lang/RuntimeException",\
+ "Error retrieving videoeditor export profile params");
+ return -1;
+ }
+ return static_cast<jint>(profile);
+}
+static jint
+android_media_MediaProfiles_native_get_videoeditor_export_level(
+ JNIEnv *env, jobject thiz, jint codec)
+{
+ LOGV("android_media_MediaProfiles_native_get_export_level");
+ int level =0;
+ level = sProfiles->getVideoEditorExportParamByName("videoeditor.export.level", codec);
+ // Check the values retrieved
+ if (level == -1) {
+ jniThrowException(env, "java/lang/RuntimeException",\
+ "Error retrieving videoeditor export level params");
+ return -1;
+ }
+ return static_cast<jint>(level);
+}
static JNINativeMethod gMethodsForEncoderCapabilitiesClass[] = {
{"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
{"native_get_num_file_formats", "()I", (void *)android_media_MediaProfiles_native_get_num_file_formats},
@@ -363,16 +393,18 @@ static JNINativeMethod gMethodsForCameraProfileClass[] = {
};
static JNINativeMethod gMethodsForVideoEditorProfileClass[] = {
- {"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
- {"native_get_videoeditor_profile", "()Landroid/media/videoeditor/VideoEditorProfile;",
- (void *)android_media_MediaProfiles_native_get_videoeditor_profile},
+ {"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
+ {"native_get_videoeditor_profile", "()Landroid/media/videoeditor/VideoEditorProfile;", (void *)android_media_MediaProfiles_native_get_videoeditor_profile},
+ {"native_get_videoeditor_export_profile", "(I)I", (void *)android_media_MediaProfiles_native_get_videoeditor_export_profile},
+ {"native_get_videoeditor_export_level", "(I)I", (void *)android_media_MediaProfiles_native_get_videoeditor_export_level},
};
static const char* const kEncoderCapabilitiesClassPathName = "android/media/EncoderCapabilities";
static const char* const kDecoderCapabilitiesClassPathName = "android/media/DecoderCapabilities";
static const char* const kCamcorderProfileClassPathName = "android/media/CamcorderProfile";
static const char* const kCameraProfileClassPathName = "android/media/CameraProfile";
-static const char* const kVideoEditorProfileClassPathName = "android/media/videoeditor/VideoEditorProfile";
+static const char* const kVideoEditorProfileClassPathName =
+ "android/media/videoeditor/VideoEditorProfile";
// This function only registers the native methods, and is called from
// JNI_OnLoad in android_media_MediaPlayer.cpp
diff --git a/media/jni/mediaeditor/VideoEditorClasses.cpp b/media/jni/mediaeditor/VideoEditorClasses.cpp
index 4c0e731..69735ca 100755
--- a/media/jni/mediaeditor/VideoEditorClasses.cpp
+++ b/media/jni/mediaeditor/VideoEditorClasses.cpp
@@ -402,7 +402,6 @@ VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFormat)
VIDEOEDIT_JAVA_CONSTANT_INIT("NO_VIDEO", M4VIDEOEDITING_kNoneVideo),
VIDEOEDIT_JAVA_CONSTANT_INIT("H263", M4VIDEOEDITING_kH263),
VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4", M4VIDEOEDITING_kMPEG4),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_EMP", M4VIDEOEDITING_kMPEG4_EMP),
VIDEOEDIT_JAVA_CONSTANT_INIT("H264", M4VIDEOEDITING_kH264),
VIDEOEDIT_JAVA_CONSTANT_INIT("NULL_VIDEO", M4VIDEOEDITING_kNullVideo),
VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", M4VIDEOEDITING_kUnsupportedVideo),
@@ -448,73 +447,6 @@ VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFrameSize)
VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFrameSize, VIDEO_FRAME_SIZE_CLASS_NAME,
M4OSA_NULL, M4OSA_NULL)
-
-VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoProfile)
-{
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0", \
- M4VIDEOEDITING_kMPEG4_SP_Level_0),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0B", \
- M4VIDEOEDITING_kMPEG4_SP_Level_0b),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_1", \
- M4VIDEOEDITING_kMPEG4_SP_Level_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_2", \
- M4VIDEOEDITING_kMPEG4_SP_Level_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_3", \
- M4VIDEOEDITING_kMPEG4_SP_Level_3),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_4A", \
- M4VIDEOEDITING_kMPEG4_SP_Level_4a),
- VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_5", \
- M4VIDEOEDITING_kMPEG4_SP_Level_5),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_10",\
- M4VIDEOEDITING_kH263_Profile_0_Level_10),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_20",\
- M4VIDEOEDITING_kH263_Profile_0_Level_20),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_30",\
- M4VIDEOEDITING_kH263_Profile_0_Level_30),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_40",\
- M4VIDEOEDITING_kH263_Profile_0_Level_40),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_45",\
- M4VIDEOEDITING_kH263_Profile_0_Level_45),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1", \
- M4VIDEOEDITING_kH264_Profile_0_Level_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1b",\
- M4VIDEOEDITING_kH264_Profile_0_Level_1b),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_1",\
- M4VIDEOEDITING_kH264_Profile_0_Level_1_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_2",\
- M4VIDEOEDITING_kH264_Profile_0_Level_1_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_3",\
- M4VIDEOEDITING_kH264_Profile_0_Level_1_3),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2", \
- M4VIDEOEDITING_kH264_Profile_0_Level_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_1",\
- M4VIDEOEDITING_kH264_Profile_0_Level_2_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_2",\
- M4VIDEOEDITING_kH264_Profile_0_Level_2_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3", \
- M4VIDEOEDITING_kH264_Profile_0_Level_3),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_1",\
- M4VIDEOEDITING_kH264_Profile_0_Level_3_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_2",\
- M4VIDEOEDITING_kH264_Profile_0_Level_3_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4", \
- M4VIDEOEDITING_kH264_Profile_0_Level_4),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_1",\
- M4VIDEOEDITING_kH264_Profile_0_Level_4_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_2",\
- M4VIDEOEDITING_kH264_Profile_0_Level_4_2),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5", \
- M4VIDEOEDITING_kH264_Profile_0_Level_5),
- VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5_1",\
- M4VIDEOEDITING_kH264_Profile_0_Level_5_1),
- VIDEOEDIT_JAVA_CONSTANT_INIT("OUT_OF_RANGE", \
- M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range)
-};
-
-VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoProfile, VIDEO_PROFILE_CLASS_NAME, M4OSA_NULL,
- M4OSA_NULL)
-
-
VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoTransition)
{
VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kVideoTransitionType_None),
@@ -550,7 +482,10 @@ VIDEOEDIT_JAVA_DEFINE_FIELDS(Properties)
VIDEOEDIT_JAVA_FIELD_INIT("width", "I"),
VIDEOEDIT_JAVA_FIELD_INIT("height", "I"),
VIDEOEDIT_JAVA_FIELD_INIT("averageFrameRate", "F"),
- VIDEOEDIT_JAVA_FIELD_INIT("profileAndLevel", "I"),
+ VIDEOEDIT_JAVA_FIELD_INIT("profile", "I"),
+ VIDEOEDIT_JAVA_FIELD_INIT("level", "I"),
+ VIDEOEDIT_JAVA_FIELD_INIT("profileSupported", "Z"),
+ VIDEOEDIT_JAVA_FIELD_INIT("levelSupported", "Z"),
VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I"),
VIDEOEDIT_JAVA_FIELD_INIT("audioDuration", "I"),
VIDEOEDIT_JAVA_FIELD_INIT("audioBitrate", "I"),
@@ -620,6 +555,8 @@ VIDEOEDIT_JAVA_DEFINE_FIELDS(EditSettings)
VIDEOEDIT_JAVA_FIELD_INIT("outputFile", "Ljava/lang/String;" ),
VIDEOEDIT_JAVA_FIELD_INIT("videoFrameSize", "I" ),
VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I" ),
+ VIDEOEDIT_JAVA_FIELD_INIT("videoProfile", "I" ),
+ VIDEOEDIT_JAVA_FIELD_INIT("videoLevel", "I" ),
VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I" ),
VIDEOEDIT_JAVA_FIELD_INIT("audioSamplingFreq", "I" ),
VIDEOEDIT_JAVA_FIELD_INIT("maxFileSize", "I" ),
@@ -846,7 +783,6 @@ videoEditClasses_init(
videoEditJava_initVideoFormatConstants(pResult, pEnv);
videoEditJava_initVideoFrameRateConstants(pResult, pEnv);
videoEditJava_initVideoFrameSizeConstants(pResult, pEnv);
- videoEditJava_initVideoProfileConstants(pResult, pEnv);
videoEditJava_initVideoTransitionConstants(pResult, pEnv);
// Initialize the fields.
@@ -881,7 +817,6 @@ videoEditPropClass_init(
videoEditJava_initErrorConstants(pResult, pEnv);
videoEditJava_initFileTypeConstants(pResult, pEnv);
videoEditJava_initVideoFormatConstants(pResult, pEnv);
- videoEditJava_initVideoProfileConstants(pResult, pEnv);
// Initialize the fields.
videoEditJava_initPropertiesFields(pResult, pEnv);
@@ -1251,15 +1186,6 @@ videoEditClasses_logClipProperties(
"%*c fAverageFrameRate: %.3f", indentation, ' ',
pProperties->fAverageFrameRate);
VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
- "%*c ProfileAndLevel: %s", indentation, ' ',
- videoEditJava_getVideoProfileString(pProperties->ProfileAndLevel));
- VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
- "%*c uiH263level: %d", indentation, ' ',
- pProperties->uiH263level);
- VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
- "%*c uiVideoProfile: %d", indentation, ' ',
- pProperties->uiVideoProfile);
- VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
"%*c bMPEG4dataPartition: %s", indentation, ' ',
pProperties->bMPEG4dataPartition ? "true" : "false");
VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
@@ -1650,9 +1576,21 @@ videoEditPropClass_createProperties(
// Set the averageFrameRate field.
pEnv->SetFloatField(object, fieldIds.averageFrameRate, pProperties->fAverageFrameRate);
- // Set the profileAndLevel field.
- pEnv->SetIntField(object, fieldIds.profileAndLevel,
- videoEditJava_getVideoProfileCToJava(pProperties->ProfileAndLevel));
+ // Set the profile field.
+ pEnv->SetIntField(object, fieldIds.profile,
+ pProperties->uiVideoProfile);
+
+ // Set the level field.
+ pEnv->SetIntField(object, fieldIds.level,
+ pProperties->uiVideoLevel);
+
+ // Set whether profile supported
+ pEnv->SetBooleanField(object, fieldIds.profileSupported,
+ pProperties->bProfileSupported);
+
+ // Set whether level supported
+ pEnv->SetBooleanField(object, fieldIds.levelSupported,
+ pProperties->bLevelSupported);
// Set the audioFormat field.
pEnv->SetIntField(object, fieldIds.audioFormat,
@@ -2062,6 +2000,14 @@ videoEditClasses_getEditSettings(
pSettings->xVSS.outputVideoBitrate = (M4OSA_UInt32)pEnv->GetIntField(object,
fieldIds.videoBitrate);
+ // Set the output video profile.
+ pSettings->xVSS.outputVideoProfile = (M4OSA_UInt32)pEnv->GetIntField(object,
+ fieldIds.videoProfile);
+
+ // Set the output video level.
+ pSettings->xVSS.outputVideoLevel = (M4OSA_UInt32)pEnv->GetIntField(object,
+ fieldIds.videoLevel);
+
// Set the output audio bitrate.
pSettings->xVSS.outputAudioBitrate = (M4OSA_UInt32)pEnv->GetIntField(object,
fieldIds.audioBitrate);
@@ -2256,6 +2202,12 @@ videoEditClasses_logEditSettings(
"%*c outputVideoFormat: %s", indentation, ' ',
videoEditJava_getVideoFormatString(pSettings->xVSS.outputVideoFormat));
VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
+ "%*c outputVideoProfile: %u", indentation, ' ',
+ videoEditJava_getVideoFormatString(pSettings->xVSS.outputVideoProfile));
+ VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
+ "%*c outputVideoLevel: %u", indentation, ' ',
+ videoEditJava_getVideoFormatString(pSettings->xVSS.outputVideoLevel));
+ VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
"%*c outputAudioFormat: %s", indentation, ' ',
videoEditJava_getAudioFormatString(pSettings->xVSS.outputAudioFormat));
VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
@@ -2984,10 +2936,6 @@ videoEditPropClass_logProperties(
pProperties->fAverageFrameRate);
VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
- "%*c ProfileAndLevel: %s", indentation, ' ',
- videoEditJava_getVideoProfileString(pProperties->ProfileAndLevel));
-
- VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
"%*c AudioStreamType: %s", indentation, ' ',
videoEditJava_getAudioFormatString(pProperties->AudioStreamType));
diff --git a/media/jni/mediaeditor/VideoEditorClasses.h b/media/jni/mediaeditor/VideoEditorClasses.h
index 045f229..3c10b1d 100755
--- a/media/jni/mediaeditor/VideoEditorClasses.h
+++ b/media/jni/mediaeditor/VideoEditorClasses.h
@@ -128,20 +128,23 @@ typedef struct
* Structure to hold media properties from native layer
*/
typedef struct {
- M4OSA_UInt32 uiClipDuration;
- VideoEditClasses_FileType FileType;
- M4VIDEOEDITING_VideoFormat VideoStreamType;
- M4OSA_UInt32 uiClipVideoDuration;
- M4OSA_UInt32 uiVideoBitrate;
- M4OSA_UInt32 uiVideoWidth;
- M4OSA_UInt32 uiVideoHeight;
- M4OSA_Float fAverageFrameRate;
- M4VIDEOEDITING_VideoProfileAndLevel ProfileAndLevel;
- M4VIDEOEDITING_AudioFormat AudioStreamType;
- M4OSA_UInt32 uiClipAudioDuration;
- M4OSA_UInt32 uiAudioBitrate;
- M4OSA_UInt32 uiNbChannels;
- M4OSA_UInt32 uiSamplingFrequency;
+ M4OSA_UInt32 uiClipDuration;
+ VideoEditClasses_FileType FileType;
+ M4VIDEOEDITING_VideoFormat VideoStreamType;
+ M4OSA_UInt32 uiClipVideoDuration;
+ M4OSA_UInt32 uiVideoBitrate;
+ M4OSA_UInt32 uiVideoWidth;
+ M4OSA_UInt32 uiVideoHeight;
+ M4OSA_Float fAverageFrameRate;
+ M4OSA_UInt32 uiVideoProfile; /**< H263 or MPEG-4 or H264 profile(from core decoder) */
+ M4OSA_UInt32 uiVideoLevel; /**< H263 or MPEG-4 or H264 level*/
+ M4OSA_Bool bProfileSupported;
+ M4OSA_Bool bLevelSupported;
+ M4VIDEOEDITING_AudioFormat AudioStreamType;
+ M4OSA_UInt32 uiClipAudioDuration;
+ M4OSA_UInt32 uiAudioBitrate;
+ M4OSA_UInt32 uiNbChannels;
+ M4OSA_UInt32 uiSamplingFrequency;
} VideoEditPropClass_Properties;
typedef struct
@@ -154,7 +157,10 @@ typedef struct
jfieldID width;
jfieldID height;
jfieldID averageFrameRate;
- jfieldID profileAndLevel;
+ jfieldID profile;
+ jfieldID level;
+ jfieldID profileSupported;
+ jfieldID levelSupported;
jfieldID audioFormat;
jfieldID audioDuration;
jfieldID audioBitrate;
@@ -192,6 +198,8 @@ typedef struct
jfieldID outputFile;
jfieldID videoFrameSize;
jfieldID videoFormat;
+ jfieldID videoProfile;
+ jfieldID videoLevel;
jfieldID audioFormat;
jfieldID audioSamplingFreq;
jfieldID maxFileSize;
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 6ee15b4..b737e5d 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#define LOG_NDEBUG 1
+#define LOG_TAG "VideoEditorMain"
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
@@ -103,6 +104,7 @@ typedef struct
bool mIsUpdateOverlay;
char *mOverlayFileName;
int mOverlayRenderingMode;
+ M4DECODER_VideoDecoders* decoders;
} ManualEditContext;
extern "C" M4OSA_ERR M4MCS_open_normalMode(
@@ -484,6 +486,82 @@ static void jniPreviewProgressCallback (void* cookie, M4OSA_UInt32 msgType,
pContext->pVM->DetachCurrentThread();
}
+static M4OSA_ERR checkClipVideoProfileAndLevel(M4DECODER_VideoDecoders *pDecoders,
+ M4OSA_Int32 format, M4OSA_UInt32 profile, M4OSA_UInt32 level){
+
+ M4OSA_Int32 codec = 0;
+ M4OSA_Bool foundCodec = M4OSA_FALSE;
+ M4OSA_ERR result = M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_PROFILE;
+ M4OSA_Bool foundProfile = M4OSA_FALSE;
+ LOGV("checkClipVideoProfileAndLevel format %d profile;%d level:0x%x",
+ format, profile, level);
+
+ switch (format) {
+ case M4VIDEOEDITING_kH263:
+ codec = M4DA_StreamTypeVideoH263;
+ break;
+ case M4VIDEOEDITING_kH264:
+ codec = M4DA_StreamTypeVideoMpeg4Avc;
+ break;
+ case M4VIDEOEDITING_kMPEG4:
+ codec = M4DA_StreamTypeVideoMpeg4;
+ break;
+ case M4VIDEOEDITING_kNoneVideo:
+ case M4VIDEOEDITING_kNullVideo:
+ case M4VIDEOEDITING_kUnsupportedVideo:
+ // For these case we do not check the profile and level
+ return M4NO_ERROR;
+ default :
+ LOGE("checkClipVideoProfileAndLevel unsupport Video format %ld", format);
+ break;
+ }
+
+ if (pDecoders != M4OSA_NULL && pDecoders->decoderNumber > 0) {
+ VideoDecoder *pVideoDecoder = pDecoders->decoder;
+ for(size_t k =0; k < pDecoders->decoderNumber; k++) {
+ if (pVideoDecoder != M4OSA_NULL) {
+ if (pVideoDecoder->codec == codec) {
+ foundCodec = M4OSA_TRUE;
+ break;
+ }
+ }
+ pVideoDecoder++;
+ }
+
+ if (foundCodec) {
+ VideoComponentCapabilities* pComponent = pVideoDecoder->component;
+ for (size_t i = 0; i < pVideoDecoder->componentNumber; i++) {
+ if (pComponent != M4OSA_NULL) {
+ VideoProfileLevel *pProfileLevel = pComponent->profileLevel;
+ for (size_t j =0; j < pComponent->profileNumber; j++) {
+ // Check the profile and level
+ if (pProfileLevel != M4OSA_NULL) {
+ if (profile == pProfileLevel->mProfile) {
+ foundProfile = M4OSA_TRUE;
+
+ if (level <= pProfileLevel->mLevel) {
+ return M4NO_ERROR;
+ }
+ } else {
+ foundProfile = M4OSA_FALSE;
+ }
+ }
+ pProfileLevel++;
+ }
+ }
+ pComponent++;
+ }
+ }
+ }
+
+ if (foundProfile) {
+ result = M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_LEVEL;
+ } else {
+ result = M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_PROFILE;
+ }
+
+ return result;
+}
static int videoEditor_stopPreview(JNIEnv* pEnv,
jobject thiz)
{
@@ -1244,6 +1322,8 @@ M4OSA_ERR videoEditor_generateAudio(JNIEnv* pEnv,ManualEditContext* pContext,
// Set the video format.
pOutputParams->OutputVideoFormat =
(M4VIDEOEDITING_VideoFormat)M4VIDEOEDITING_kNoneVideo;//M4VIDEOEDITING_kNoneVideo;
+ pOutputParams->outputVideoProfile = 1;
+ pOutputParams->outputVideoLevel = 1;
// Set the frame size.
pOutputParams->OutputVideoFrameSize
= (M4VIDEOEDITING_VideoFrameSize)M4VIDEOEDITING_kQCIF;
@@ -1797,7 +1877,8 @@ videoEditor_populateSettings(
}
fid = pEnv->GetFieldID(audioSettingClazz,"bRemoveOriginal","Z");
- pContext->mAudioSettings->bRemoveOriginal = pEnv->GetBooleanField(audioSettingObject,fid);
+ pContext->mAudioSettings->bRemoveOriginal =
+ pEnv->GetBooleanField(audioSettingObject,fid);
M4OSA_TRACE1_1("bRemoveOriginal = %d",pContext->mAudioSettings->bRemoveOriginal);
fid = pEnv->GetFieldID(audioSettingClazz,"channels","I");
@@ -2090,8 +2171,44 @@ videoEditor_getProperties(
jstring file)
{
jobject object = M4OSA_NULL;
+ jclass clazz = pEnv->FindClass(PROPERTIES_CLASS_NAME);
+ jfieldID fid;
+ bool needToBeLoaded = true;
+ ManualEditContext* pContext = M4OSA_NULL;
+ M4OSA_ERR result = M4NO_ERROR;
+ int profile = 0;
+ int level = 0;
+ int videoFormat = 0;
+
+ // Get the context.
+ pContext = (ManualEditContext*)videoEditClasses_getContext(&needToBeLoaded, pEnv, thiz);
+
+ videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+ (M4OSA_NULL == clazz),
+ "not initialized");
+
object = videoEditProp_getProperties(pEnv,thiz,file);
+ if (object != M4OSA_NULL) {
+ fid = pEnv->GetFieldID(clazz,"profile","I");
+ profile = pEnv->GetIntField(object,fid);
+ fid = pEnv->GetFieldID(clazz,"level","I");
+ level = pEnv->GetIntField(object,fid);
+ fid = pEnv->GetFieldID(clazz,"videoFormat","I");
+ videoFormat = pEnv->GetIntField(object,fid);
+
+ result = checkClipVideoProfileAndLevel(pContext->decoders, videoFormat, profile, level);
+
+ fid = pEnv->GetFieldID(clazz,"profileSupported","Z");
+ if (M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_PROFILE == result) {
+ pEnv->SetBooleanField(object,fid,false);
+ }
+
+ fid = pEnv->GetFieldID(clazz,"levelSupported","Z");
+ if (M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_LEVEL == result) {
+ pEnv->SetBooleanField(object,fid,false);
+ }
+ }
return object;
}
@@ -2505,6 +2622,7 @@ videoEditor_init(
free(tmpString);
pContext->mIsUpdateOverlay = false;
pContext->mOverlayFileName = NULL;
+ pContext->decoders = NULL;
}
// Check if the initialization succeeded
@@ -2550,6 +2668,12 @@ videoEditor_init(
// Check if the library could be initialized.
videoEditJava_checkAndThrowRuntimeException(&initialized, pEnv,
(M4NO_ERROR != result), result);
+
+ // Get platform video decoder capablities.
+ result = M4xVSS_getVideoDecoderCapabilities(&pContext->decoders);
+
+ videoEditJava_checkAndThrowRuntimeException(&initialized, pEnv,
+ (M4NO_ERROR != result), result);
}
if(initialized)
@@ -3097,6 +3221,47 @@ videoEditor_release(
free(pContext->mAudioSettings);
pContext->mAudioSettings = M4OSA_NULL;
}
+ // Free video Decoders capabilities
+ if (pContext->decoders != M4OSA_NULL) {
+ VideoDecoder *pDecoder = NULL;
+ VideoComponentCapabilities *pComponents = NULL;
+ int32_t decoderNumber = pContext->decoders->decoderNumber;
+ if (pContext->decoders->decoder != NULL &&
+ decoderNumber > 0) {
+ pDecoder = pContext->decoders->decoder;
+ for (int32_t k = 0; k < decoderNumber; k++) {
+ // free each component
+ LOGV("decoder index :%d",k);
+ if (pDecoder != NULL &&
+ pDecoder->component != NULL &&
+ pDecoder->componentNumber > 0) {
+ LOGV("component number %d",pDecoder->componentNumber);
+ int32_t componentNumber =
+ pDecoder->componentNumber;
+
+ pComponents = pDecoder->component;
+ for (int32_t i = 0; i< componentNumber; i++) {
+ LOGV("component index :%d",i);
+ if (pComponents != NULL &&
+ pComponents->profileLevel != NULL) {
+ free(pComponents->profileLevel);
+ pComponents->profileLevel = NULL;
+ }
+ pComponents++;
+ }
+ free(pDecoder->component);
+ pDecoder->component = NULL;
+ }
+
+ pDecoder++;
+ }
+ free(pContext->decoders->decoder);
+ pContext->decoders->decoder = NULL;
+ }
+ free(pContext->decoders);
+ pContext->decoders = NULL;
+ }
+
videoEditor_freeContext(pEnv, &pContext);
}
}
diff --git a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
index 93fe702..2ca3a08 100755
--- a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
@@ -248,7 +248,11 @@ jobject videoEditProp_getProperties(
pProperties->uiVideoWidth = pClipProperties->uiVideoWidth;
pProperties->uiVideoHeight = pClipProperties->uiVideoHeight;
pProperties->fAverageFrameRate = pClipProperties->fAverageFrameRate;
- pProperties->ProfileAndLevel = pClipProperties->ProfileAndLevel;
+ pProperties->uiVideoProfile = pClipProperties->uiVideoProfile;
+ pProperties->uiVideoLevel = pClipProperties->uiVideoLevel;
+ // Set profile and level support to TRUE, pending check
+ pProperties->bProfileSupported = M4OSA_TRUE;
+ pProperties->bLevelSupported = M4OSA_TRUE;
pProperties->AudioStreamType = pClipProperties->AudioStreamType;
pProperties->uiClipAudioDuration = pClipProperties->uiClipAudioDuration;
pProperties->uiAudioBitrate = pClipProperties->uiAudioBitrate;
@@ -272,7 +276,8 @@ jobject videoEditProp_getProperties(
pProperties->uiVideoWidth = width;
pProperties->uiVideoHeight = height;
pProperties->fAverageFrameRate = 0.0f;
- pProperties->ProfileAndLevel = M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range;
+ pProperties->uiVideoProfile = M4VIDEOEDITING_VIDEO_UNKNOWN_PROFILE;
+ pProperties->uiVideoLevel = M4VIDEOEDITING_VIDEO_UNKNOWN_LEVEL;
pProperties->AudioStreamType = M4VIDEOEDITING_kNoneAudio;
pProperties->uiClipAudioDuration = 0;
pProperties->uiAudioBitrate = 0;
@@ -291,11 +296,13 @@ jobject videoEditProp_getProperties(
}
}
- // Create a properties object.
- videoEditPropClass_createProperties(&gotten, pEnv, pProperties, &properties);
+ if (M4NO_ERROR == result) {
+ // Create a properties object.
+ videoEditPropClass_createProperties(&gotten, pEnv, pProperties, &properties);
- // Log the properties.
- VIDEOEDIT_PROP_LOG_PROPERTIES(pProperties);
+ // Log the properties.
+ VIDEOEDIT_PROP_LOG_PROPERTIES(pProperties);
+ }
// Free the properties.
videoEditOsal_free(pProperties);
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index f0f07a2..5a8bc60 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -26,6 +26,7 @@
#include <expat.h>
#include <media/MediaProfiles.h>
#include <media/stagefright/MediaDebug.h>
+#include <media/stagefright/openmax/OMX_Video.h>
namespace android {
@@ -377,7 +378,24 @@ void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts)
LOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs);
}
+/*static*/ MediaProfiles::ExportVideoProfile*
+MediaProfiles::createExportVideoProfile(const char **atts)
+{
+ CHECK(!strcmp("name", atts[0]) &&
+ !strcmp("profile", atts[2]) &&
+ !strcmp("level", atts[4]));
+
+ const size_t nMappings =
+ sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]);
+ const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]);
+ CHECK(codec != -1);
+
+ MediaProfiles::ExportVideoProfile *profile =
+ new MediaProfiles::ExportVideoProfile(
+ codec, atoi(atts[3]), atoi(atts[5]));
+ return profile;
+}
/*static*/ MediaProfiles::VideoEditorCap*
MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles)
{
@@ -428,6 +446,8 @@ MediaProfiles::startElementHandler(void *userData, const char *name, const char
profiles->addImageEncodingQualityLevel(profiles->mCurrentCameraId, atts);
} else if (strcmp("VideoEditorCap", name) == 0) {
createVideoEditorCap(atts, profiles);
+ } else if (strcmp("ExportVideoProfile", name) == 0) {
+ profiles->mVideoEditorExportProfiles.add(createExportVideoProfile(atts));
}
}
@@ -830,6 +850,20 @@ MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles)
VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH,
VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT);
}
+/*static*/ void
+MediaProfiles::createDefaultExportVideoProfiles(MediaProfiles *profiles)
+{
+ // Create default video export profiles
+ profiles->mVideoEditorExportProfiles.add(
+ new ExportVideoProfile(VIDEO_ENCODER_H263,
+ OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10));
+ profiles->mVideoEditorExportProfiles.add(
+ new ExportVideoProfile(VIDEO_ENCODER_MPEG_4_SP,
+ OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1));
+ profiles->mVideoEditorExportProfiles.add(
+ new ExportVideoProfile(VIDEO_ENCODER_H264,
+ OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13));
+}
/*static*/ MediaProfiles*
MediaProfiles::createDefaultInstance()
@@ -843,6 +877,7 @@ MediaProfiles::createDefaultInstance()
createDefaultEncoderOutputFileFormats(profiles);
createDefaultImageEncodingQualityLevels(profiles);
createDefaultVideoEditorCap(profiles);
+ createDefaultExportVideoProfiles(profiles);
return profiles;
}
@@ -940,7 +975,31 @@ int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder co
LOGE("The given video encoder param name %s is not found", name);
return -1;
}
+int MediaProfiles::getVideoEditorExportParamByName(
+ const char *name, int codec) const
+{
+ LOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
+ ExportVideoProfile *exportProfile = NULL;
+ int index = -1;
+ for (size_t i =0; i < mVideoEditorExportProfiles.size(); i++) {
+ exportProfile = mVideoEditorExportProfiles[i];
+ if (exportProfile->mCodec == codec) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ LOGE("The given video decoder %d is not found", codec);
+ return -1;
+ }
+ if (!strcmp("videoeditor.export.profile", name))
+ return exportProfile->mProfile;
+ if (!strcmp("videoeditor.export.level", name))
+ return exportProfile->mLevel;
+ LOGE("The given video editor export param name %s is not found", name);
+ return -1;
+}
int MediaProfiles::getVideoEditorCapParamByName(const char *name) const
{
LOGV("getVideoEditorCapParamByName: %s", name);
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
index 4d517db..0ad6760 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
@@ -71,7 +71,7 @@ public class MediaPropertiesTest extends
protected void validateVideoProperties(int aspectRatio, int fileType,
int videoCodecType, int duration, int videoBitrate, int fps,
- int videoProfile, int width, int height, int audioCodecType,
+ int videoProfile, int videoLevel, int width, int height, int audioCodecType,
int audioSamplingFrequency, int audioChannel, int audioBitrate,
MediaVideoItem mvi) throws Exception {
assertEquals("Aspect Ratio Mismatch", aspectRatio, mvi.getAspectRatio());
@@ -82,6 +82,8 @@ public class MediaPropertiesTest extends
duration, mvi.getDuration(), 10));
assertEquals("Video Profile " + mvi.getVideoProfile(), videoProfile,
mvi.getVideoProfile());
+ assertEquals("Video Level " + mvi.getVideoLevel(), videoLevel,
+ mvi.getVideoLevel());
assertEquals("Video height " + mvi.getHeight(), height, mvi.getHeight());
assertEquals("Video width " + mvi.getWidth(), width, mvi.getWidth());
/** Check FPS with 10% range */
@@ -143,7 +145,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 16000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.MPEG4_SP_LEVEL_1;
+ final int videoProfile = MediaProperties.MPEG4Profile.MPEG4ProfileSimple;
+ final int videoLevel = MediaProperties.MPEG4Level.MPEG4Level1;
final int width = 854;
final int height = MediaProperties.HEIGHT_480;
@@ -152,7 +155,7 @@ public class MediaPropertiesTest extends
MediaItem.RENDERING_MODE_BLACK_BORDER);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -175,7 +178,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AMRNB;
final int audioSamplingFrequency = 8000;
final int audioChannel = 1;
- final int videoProfile = MediaProperties.MPEG4_SP_LEVEL_1;
+ final int videoProfile = MediaProperties.MPEG4Profile.MPEG4ProfileSimple;
+ final int videoLevel = MediaProperties.MPEG4Level.MPEG4Level1;
final int width = 800;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -184,7 +188,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -206,7 +210,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 48000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.MPEG4_SP_LEVEL_1;
+ final int videoProfile = MediaProperties.MPEG4Profile.MPEG4ProfileSimple;
+ final int videoLevel = MediaProperties.MPEG4Level.MPEG4Level1;
final int width = 720;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -215,7 +220,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -237,7 +242,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 48000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.MPEG4_SP_LEVEL_1;
+ final int videoProfile = MediaProperties.MPEG4Profile.MPEG4ProfileSimple;
+ final int videoLevel = MediaProperties.MPEG4Level.MPEG4Level1;
final int width = 640;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -246,7 +252,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -268,7 +274,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AMRNB;
final int audioSamplingFrequency = 8000;
final int audioChannel = 1;
- final int videoProfile = MediaProperties.MPEG4_SP_LEVEL_1;
+ final int videoProfile = MediaProperties.MPEG4Profile.MPEG4ProfileSimple;
+ final int videoLevel = MediaProperties.MPEG4Level.MPEG4Level1;
final int width = 176;
final int height = MediaProperties.HEIGHT_144;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -277,7 +284,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -299,7 +306,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 16000;
final int audioChannel = 1;
- final int videoProfile = MediaProperties.H263_PROFILE_0_LEVEL_10;
+ final int videoProfile = MediaProperties.H263Profile.H263ProfileBaseline;
+ final int videoLevel = MediaProperties.H263Level.H263Level10;
final int width = 176;
final int height = MediaProperties.HEIGHT_144;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -307,7 +315,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -321,7 +329,7 @@ public class MediaPropertiesTest extends
+ "H264_BP_640x480_15fps_1200Kbps_AACLC_48KHz_64kps_m_0_27.3gp";
final int aspectRatio = MediaProperties.ASPECT_RATIO_4_3;
final int fileType = MediaProperties.FILE_3GP;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77600;
final int videoBitrate = 745000;
final int audioBitrate = 64000;
@@ -329,7 +337,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 48000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 640;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -337,7 +346,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -351,7 +360,7 @@ public class MediaPropertiesTest extends
+ "H264_BP_720x480_25fps_256kbps_AMRNB_8khz_12.2kbps_m_0_26.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 26880;
final int videoBitrate = 244000;
final int audioBitrate = 12200;
@@ -359,7 +368,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AMRNB;
final int audioSamplingFrequency = 8000;
final int audioChannel = 1;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 720;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -368,7 +378,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -382,7 +392,7 @@ public class MediaPropertiesTest extends
"H264_BP_800x480_15fps_512kbps_AACLC_24KHz_38Kbps_s_1_17.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_5_3;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77466;
final int videoBitrate = 528000;
final int audioBitrate = 38000;
@@ -390,7 +400,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 24000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 800;
final int height = MediaProperties.HEIGHT_480;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -399,7 +410,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -413,7 +424,7 @@ public class MediaPropertiesTest extends
+ "H264_BP_1280x720_15fps_512kbps_AACLC_16khz_48kbps_s_1_17.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_16_9;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77600;
final int videoBitrate = 606000;
final int audioBitrate = 48000;
@@ -421,7 +432,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 16000;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 1280;
final int height = MediaProperties.HEIGHT_720;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -430,7 +442,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -444,7 +456,7 @@ public class MediaPropertiesTest extends
+ "H264_BP_1080x720_30fps_12Mbps_AACLC_44.1khz_64kbps_s_1_17.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77500;
final int videoBitrate = 1190000;
final int audioBitrate = 64000;
@@ -452,7 +464,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
final int audioSamplingFrequency = 44100;
final int audioChannel = 2;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 1080;
final int height = MediaProperties.HEIGHT_720;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -461,7 +474,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
@@ -491,7 +504,7 @@ public class MediaPropertiesTest extends
}
/**
- *To test media properties for H.264 Main/Advanced profile. (unsupported profile input)
+ *To test media properties for H.264 Main/Advanced profile.
*/
// TODO : Remove TC_MP_013
@LargeTest
@@ -499,19 +512,28 @@ public class MediaPropertiesTest extends
final String videoItemFilename = INPUT_FILE_PATH
+ "H264_MP_960x720_25fps_800kbps_AACLC_48Khz_192Kbps_s_1_17.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_4_3;
- //final int videoCodecType = MediaProperties.VCODEC_H264BP;
- final int videoCodecType = MediaProperties.VCODEC_H264MP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
+ final int fileType = MediaProperties.FILE_MP4;
+ final int duration = 77500;
+ final int videoBitrate = 800000;
+ final int audioBitrate = 192000;
+ final int fps = 25;
+ final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
+ final int audioSamplingFrequency = 48000;
+ final int audioChannel = 2;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileMain;
+ final int videoLevel = MediaProperties.H264Level.H264Level31;
+ final int width = 960;
+ final int height = MediaProperties.HEIGHT_720;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
- boolean flagForException = false;
- try {
final MediaVideoItem mvi = mVideoEditorHelper.createMediaItem
(mVideoEditor, "m1", videoItemFilename, renderingMode);
- assertEquals("VideoCodec Mismatch", videoCodecType, mvi.getVideoType());
- }catch (IllegalArgumentException e){
- flagForException = true;
- }
- assertTrue("Unsupported Main Profile", flagForException);
+
+ validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
+ audioSamplingFrequency, audioChannel, audioBitrate, mvi);
+
}
/**
@@ -544,7 +566,7 @@ public class MediaPropertiesTest extends
"H264_BP_1080x720_30fps_800kbps_1_17.mp4";
final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77366;
final int videoBitrate = 859000;
final int audioBitrate = 0;
@@ -552,7 +574,8 @@ public class MediaPropertiesTest extends
final int audioCodecType = -1;
final int audioSamplingFrequency = 0;
final int audioChannel = 0;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 1080;
final int height = MediaProperties.HEIGHT_720;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
@@ -561,7 +584,7 @@ public class MediaPropertiesTest extends
(mVideoEditor, "m1", videoItemFilename, renderingMode);
validateVideoProperties(aspectRatio, fileType, videoCodecType, duration,
- videoBitrate, fps, videoProfile, width, height, audioCodecType,
+ videoBitrate, fps, videoProfile, videoLevel, width, height, audioCodecType,
audioSamplingFrequency, audioChannel, audioBitrate, mvi);
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
index 74d4766..e1b337d 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
@@ -166,7 +166,7 @@ public class VideoEditorExportTest extends
+ mediaImageItem6.getDuration();
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, storyBoardDuration,
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -294,7 +294,7 @@ public class VideoEditorExportTest extends
+ mediaImageItem6.getDuration();
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, storyBoardDuration,
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -352,7 +352,7 @@ public class VideoEditorExportTest extends
}
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, mediaImageItem.getDuration(),
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -412,7 +412,7 @@ public class VideoEditorExportTest extends
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, (mediaVideoItem.getTimelineDuration() +
mediaImageItem.getDuration()),
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -531,7 +531,7 @@ public class VideoEditorExportTest extends
+ mediaItem6.getTimelineDuration() - transition5And6.getDuration();
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, storyBoardDuration,
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -693,7 +693,7 @@ public class VideoEditorExportTest extends
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_144, 0, storyBoardDuration,
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -730,7 +730,7 @@ public class VideoEditorExportTest extends
}
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0, mediaItem1.getDuration(),
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
@@ -814,7 +814,7 @@ public class VideoEditorExportTest extends
mVideoEditorHelper.validateExport(mVideoEditor, outFilename,
MediaProperties.HEIGHT_720, 0,
(mediaVideoItem.getDuration()+ mediaVideoItem1.getDuration()),
- MediaProperties.VCODEC_H264BP, MediaProperties.ACODEC_AAC_LC);
+ MediaProperties.VCODEC_H264, MediaProperties.ACODEC_AAC_LC);
mVideoEditorHelper.checkDeleteExistingFile(outFilename);
}
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java
index 7eb6d22..3d0be4f 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java
@@ -366,7 +366,7 @@ public class VideoEditorPerformance extends
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final int outHeight = MediaProperties.HEIGHT_480;
final int outBitrate = MediaProperties.BITRATE_256K;
- final int outVcodec = MediaProperties.VCODEC_H264BP;
+ final int outVcodec = MediaProperties.VCODEC_H264;
final String[] loggingInfo = new String[1];
final String outFilename = mVideoEditorHelper
.createRandomFile(mVideoEditor.getPath() + "/") + ".3gp";
@@ -639,11 +639,12 @@ public class VideoEditorPerformance extends
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final int aspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int fileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int duration = 77366;
final int videoBitrate = 3169971;
final int fps = 30;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int width = 1080;
final int height = MediaProperties.HEIGHT_720;
int timeTaken = 0;
@@ -665,6 +666,8 @@ public class VideoEditorPerformance extends
duration, mediaVideoItem.getDuration());
assertEquals("Video Profile ",
videoProfile, mediaVideoItem.getVideoProfile());
+ assertEquals("Video Level ",
+ videoLevel, mediaVideoItem.getVideoLevel());
assertEquals("Video height ",
height, mediaVideoItem.getHeight());
assertEquals("Video width ",
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
index 94ffb8e..4d30784 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java
@@ -665,9 +665,10 @@ public class VideoEditorStressTest
int i = 0;
final int videoAspectRatio = MediaProperties.ASPECT_RATIO_3_2;
final int videoFileType = MediaProperties.FILE_MP4;
- final int videoCodecType = MediaProperties.VCODEC_H264BP;
+ final int videoCodecType = MediaProperties.VCODEC_H264;
final int videoDuration = 77366;
- final int videoProfile = MediaProperties.H264_PROFILE_0_LEVEL_1_3;
+ final int videoProfile = MediaProperties.H264Profile.H264ProfileBaseline;
+ final int videoLevel = MediaProperties.H264Level.H264Level13;
final int videoHeight = MediaProperties.HEIGHT_720;
final int videoWidth = 1080;
@@ -698,6 +699,8 @@ public class VideoEditorStressTest
videoDuration, mediaItem1.getDuration());
assertEquals("Video Profile ",
videoProfile, mediaItem1.getVideoProfile());
+ assertEquals("Video Level ",
+ videoLevel, mediaItem1.getVideoLevel());
assertEquals("Video height ",
videoHeight, mediaItem1.getHeight());
assertEquals("Video width ",
@@ -939,9 +942,9 @@ public class VideoEditorStressTest
for ( i = 0; i < 50; i++) {
if(i%4 ==0){
- final int aspectRatio = MediaProperties.ASPECT_RATIO_4_3;
+ final int aspectRatio = MediaProperties.ASPECT_RATIO_11_9;
mVideoEditor.setAspectRatio(aspectRatio);
- mVideoEditor.export(outFilename, MediaProperties.HEIGHT_480,
+ mVideoEditor.export(outFilename, MediaProperties.HEIGHT_288,
MediaProperties.BITRATE_256K,MediaProperties.ACODEC_AAC_LC,
MediaProperties.VCODEC_H263,
new ExportProgressListener() {
@@ -967,7 +970,7 @@ public class VideoEditorStressTest
mVideoEditor.setAspectRatio(aspectRatio);
mVideoEditor.export(outFilename, MediaProperties.HEIGHT_144,
MediaProperties.BITRATE_512K,MediaProperties.ACODEC_AAC_LC,
- MediaProperties.VCODEC_H264BP,
+ MediaProperties.VCODEC_H264,
new ExportProgressListener() {
public void onProgress(VideoEditor ve, String outFileName,
int progress) {
@@ -979,7 +982,7 @@ public class VideoEditorStressTest
mVideoEditor.setAspectRatio(aspectRatio);
mVideoEditor.export(outFilename, MediaProperties.HEIGHT_480,
MediaProperties.BITRATE_800K,MediaProperties.ACODEC_AAC_LC,
- MediaProperties.VCODEC_H264BP,
+ MediaProperties.VCODEC_H264,
new ExportProgressListener() {
public void onProgress(VideoEditor ve, String outFileName,
int progress) {