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;
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)
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);
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();
RequiredProfiles *mRequiredProfileRefs;
Vector<int> mCameraIds;
VideoEditorCap* mVideoEditorCap;
+ Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
};
}; // namespace android
private boolean mRegenerateAudio = true;
private String mExportFilename = null;
-
+ private int mExportVideoCodec = 0;
+ private int mExportAudioCodec = 0;
private int mProgressToApp;
private String mRenderPreviewOverlayFile;
/** 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;
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 {
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.
*/
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.
}
/**
+ * 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
int err = 0;
EditSettings editSettings = null;
String EffectClipPath = null;
-
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
editSettings = new EditSettings();
editSettings.clipSettingsArray = new ClipSettings[1];
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;
String generateKenBurnsClip(EditSettings e, MediaImageItem m) {
String output = null;
int err = 0;
+ int outVideoProfile = 0;
+ int outVideoLevel = 0;
e.backgroundMusicSettings = null;
e.transitionSettingsArray = null;
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;
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;
retValue = MediaProperties.VCODEC_H263;
break;
case VideoFormat.H264:
- retValue = MediaProperties.VCODEC_H264BP;
+ retValue = MediaProperties.VCODEC_H264;
break;
case VideoFormat.MPEG4:
retValue = MediaProperties.VCODEC_MPEG4;
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;
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;
* 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
*/
ACODEC_AMRWB
};
-
/**
* Samples per frame for each audio codec
*/
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;
", 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:
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;
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;
}
/**
+ * @return The video profile
+ */
+ public int getVideoLevel() {
+ return mVideoLevel;
+ }
+
+ /**
* @return The video bitrate
*/
public int getVideoBitrate() {
* 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.
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");
}
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;
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 {
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) {
/*
* {@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 {
*/
public class VideoEditorProfile
{
+ static {
+ System.loadLibrary("media_jni");
+ native_init();
+ }
/**
* The max input video frame width
*/
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
// 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);
+
}
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},
};
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
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),
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),
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"),
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" ),
videoEditJava_initVideoFormatConstants(pResult, pEnv);
videoEditJava_initVideoFrameRateConstants(pResult, pEnv);
videoEditJava_initVideoFrameSizeConstants(pResult, pEnv);
- videoEditJava_initVideoProfileConstants(pResult, pEnv);
videoEditJava_initVideoTransitionConstants(pResult, pEnv);
// Initialize the fields.
videoEditJava_initErrorConstants(pResult, pEnv);
videoEditJava_initFileTypeConstants(pResult, pEnv);
videoEditJava_initVideoFormatConstants(pResult, pEnv);
- videoEditJava_initVideoProfileConstants(pResult, pEnv);
// Initialize the fields.
videoEditJava_initPropertiesFields(pResult, pEnv);
"%*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",
// 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,
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);
"%*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",
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));
* 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
jfieldID width;
jfieldID height;
jfieldID averageFrameRate;
- jfieldID profileAndLevel;
+ jfieldID profile;
+ jfieldID level;
+ jfieldID profileSupported;
+ jfieldID levelSupported;
jfieldID audioFormat;
jfieldID audioDuration;
jfieldID audioBitrate;
jfieldID outputFile;
jfieldID videoFrameSize;
jfieldID videoFormat;
+ jfieldID videoProfile;
+ jfieldID videoLevel;
jfieldID audioFormat;
jfieldID audioSamplingFreq;
jfieldID maxFileSize;
* 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>
bool mIsUpdateOverlay;
char *mOverlayFileName;
int mOverlayRenderingMode;
+ M4DECODER_VideoDecoders* decoders;
} ManualEditContext;
extern "C" M4OSA_ERR M4MCS_open_normalMode(
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)
{
// 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;
}
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");
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;
}
free(tmpString);
pContext->mIsUpdateOverlay = false;
pContext->mOverlayFileName = NULL;
+ pContext->decoders = NULL;
}
// Check if the initialization succeeded
// 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)
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);
}
}
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;
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;
}
}
- // 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);
#include <expat.h>
#include <media/MediaProfiles.h>
#include <media/stagefright/MediaDebug.h>
+#include <media/stagefright/openmax/OMX_Video.h>
namespace android {
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)
{
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));
}
}
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()
createDefaultEncoderOutputFileFormats(profiles);
createDefaultImageEncodingQualityLevels(profiles);
createDefaultVideoEditorCap(profiles);
+ createDefaultExportVideoProfiles(profiles);
return profiles;
}
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);
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());
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 */
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;
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);
}
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;
(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);
}
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;
(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);
}
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;
(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);
}
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;
(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);
}
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;
(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);
}
+ "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;
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;
(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);
}
+ "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;
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;
(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);
}
"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;
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;
(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);
}
+ "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;
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;
(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);
}
+ "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;
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;
(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);
}
}
/**
- *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
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);
+
}
/**
"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;
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;
(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);
}
+ 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);
}
+ 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);
}
}
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);
}
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);
}
+ 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);
}
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);
}
}
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);
}
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);
}
}
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";
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;
duration, mediaVideoItem.getDuration());
assertEquals("Video Profile ",
videoProfile, mediaVideoItem.getVideoProfile());
+ assertEquals("Video Level ",
+ videoLevel, mediaVideoItem.getVideoLevel());
assertEquals("Video height ",
height, mediaVideoItem.getHeight());
assertEquals("Video width ",
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;
videoDuration, mediaItem1.getDuration());
assertEquals("Video Profile ",
videoProfile, mediaItem1.getVideoProfile());
+ assertEquals("Video Level ",
+ videoLevel, mediaItem1.getVideoLevel());
assertEquals("Video height ",
videoHeight, mediaItem1.getHeight());
assertEquals("Video width ",
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() {
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) {
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) {