Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0a22225 authored by Rajneesh Chowdury's avatar Rajneesh Chowdury Committed by Android (Google) Code Review
Browse files

Merge "Fix for 4142219 Don't hard code platform-specific limitations (Jni/ Java)"

parents ace0be25 3ced0441
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -139,6 +139,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.
     */
@@ -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
+101 −106
Original line number Diff line number Diff line
@@ -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 {

@@ -1619,6 +1527,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.
@@ -2111,6 +2047,25 @@ class MediaArtistNativeHelper {
        return mVideoEditor.getAspectRatio();
    }

    /**
     * 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
     *
@@ -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;
+101 −73
Original line number Diff line number Diff line
@@ -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
     */
    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
    };

     *  The H264 profile, the values are same as the one in OMX_Video.h
     */
    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
     */
+20 −8
Original line number Diff line number Diff line
@@ -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;
@@ -660,6 +665,13 @@ public class MediaVideoItem extends MediaItem {
        return mVideoProfile;
    }

    /**
     * @return The video profile
     */
    public int getVideoLevel() {
        return mVideoLevel;
    }

    /**
     * @return The video bitrate
     */
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading