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

Commit 0a25bd5b authored by Rajneesh Chowdury's avatar Rajneesh Chowdury
Browse files

Fix for 4142219 Don't hard code platform-specific limitations.

Also fixes 5118207 add other video codec support for video editor export.

For importing video clips, Video Editor engine will query StageFright codecs
for supported codecs, profiles and levels.
For Export, the profile and level are configured in media_profiles.xml

Change-Id: I85c8bb8b87cfcf0f1351ecb8c4f369a8902e7a09
parent f80b3138
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -130,21 +130,20 @@ typedef enum
    M4DECODER_kOptionID_EnableYuvWithEffect =
        M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x09),

    /**
     * Get the supported video decoders and capabilities */
    M4DECODER_kOptionID_VideoDecodersAndCapabilities =
        M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x10),

    /* common to MPEG4 decoders */
    /**
     * Get the DecoderConfigInfo */
    M4DECODER_MPEG4_kOptionID_DecoderConfigInfo = M4OSA_OPTION_ID_CREATE(M4_READ,\
                                                         M4DECODER_MPEG4, 0x01),

    /* only for H.264 decoder. */
    /**
    Get AVC profile and level.
    */
    M4DECODER_kOptionID_AVCProfileAndLevel = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_AVC, 0x01),

    /* last decoded cts */
    M4DECODER_kOptionID_AVCLastDecodedFrameCTS = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_AVC,\
                                                                             0x02)
                                                                             0x01)
/* Last decoded cts */

} M4DECODER_OptionID;
@@ -223,6 +222,26 @@ typedef enum

} M4DECODER_VideoType ;

typedef struct {
    M4OSA_UInt32 mProfile;
    M4OSA_UInt32 mLevel;
} VideoProfileLevel;

typedef struct {
    VideoProfileLevel *profileLevel;
    M4OSA_UInt32 profileNumber;
} VideoComponentCapabilities;

typedef struct {
    M4_StreamType codec;
    VideoComponentCapabilities *component;
    M4OSA_UInt32 componentNumber;
} VideoDecoder;

typedef struct {
    VideoDecoder *decoder;
    M4OSA_UInt32 decoderNumber;
} M4DECODER_VideoDecoders;
/**
 ************************************************************************
 * @brief    creates an instance of the decoder
+4 −1
Original line number Diff line number Diff line
@@ -266,7 +266,8 @@ typedef struct
    M4ENCODER_FrameRate        FrameRate;            /**< Framerate, see enum  */
    M4ENCODER_Format        Format;                /**< Video compression format, H263, MPEG4,
                                                         MJPEG ...  */

    M4OSA_Int32            videoProfile; /** video profile */
    M4OSA_Int32            videoLevel;   /** video level */
} M4ENCODER_Params;

/**
@@ -292,6 +293,8 @@ typedef struct
    M4ENCODER_FrameRate        FrameRate;
    /**< Video compression format: H263 or MPEG4 */
    M4ENCODER_Format        Format;
    M4OSA_Int32            videoProfile; /** output video profile */
    M4OSA_Int32            videoLevel;   /** output video level */
    M4OSA_UInt32            uiHorizontalSearchRange; /**< Set to 0 will use default value (15) */
    M4OSA_UInt32            uiVerticalSearchRange;   /**< Set to 0 will use default value (15) */
    /**< Set to 0 will use default value (0x7FFF i.e. let engine decide when to put an I) */
+11 −5
Original line number Diff line number Diff line
@@ -29,13 +29,19 @@ extern "C" {
(useful for video editing) without having to instanciate a decoder, which can be useful precisely
if HW decoders are a possibility. */

M4OSA_ERR M4DECODER_EXTERNAL_ParseVideoDSI(M4OSA_UInt8* pVol, M4OSA_Int32 aVolSize,
M4OSA_ERR M4DECODER_EXTERNAL_ParseVideoDSI(
                      M4OSA_UInt8* pVol, M4OSA_Int32 aVolSize,
                      M4DECODER_MPEG4_DecoderConfigInfo* pDci,
                      M4DECODER_VideoSize* pVideoSize);

M4OSA_ERR M4DECODER_EXTERNAL_ParseAVCDSI(M4OSA_UInt8* pDSI, M4OSA_Int32 DSISize,
                                            M4DECODER_AVCProfileLevel *profile);
M4OSA_ERR getAVCProfileAndLevel(M4OSA_UInt8* pDSI, M4OSA_Int32 DSISize,
                      M4OSA_Int32 *pProfile, M4OSA_Int32 *pLevel);

M4OSA_ERR getH263ProfileAndLevel(M4OSA_UInt8* pDSI, M4OSA_Int32 DSISize,
                      M4OSA_Int32 *pProfile, M4OSA_Int32 *pLevel);

M4OSA_ERR getMPEG4ProfileAndLevel(M4OSA_UInt8 profileAndLevel,
                      M4OSA_Int32 *pProfile, M4OSA_Int32 *pLevel);

#ifdef __cplusplus
}
+11 −59
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ extern "C" {
#define M4VIDEOEDITING_VERSION_MINOR    1
#define M4VIDEOEDITING_VERSION_REVISION    0

#define M4VIDEOEDITING_VIDEO_UNKNOWN_PROFILE 0x7fffffff
#define M4VIDEOEDITING_VIDEO_UNKNOWN_LEVEL 0x7fffffff

/**
 ******************************************************************************
@@ -73,11 +75,8 @@ typedef enum
{
    M4VIDEOEDITING_kNoneVideo = 0, /**< Video not present */
    M4VIDEOEDITING_kH263 = 1, /**< H263 video */
    M4VIDEOEDITING_kMPEG4                = 2,    /**< MPEG-4 video */
    M4VIDEOEDITING_kMPEG4_EMP            = 3,    /**< MPEG-4 video with support for EMP
                                                    (hsr=15, vsr=15, err=0, Iperiod=15,
                                                     NO_M4V, NO_AC_PRED) */
    M4VIDEOEDITING_kH264                = 4,    /**< H264 video */
    M4VIDEOEDITING_kH264 = 2,    /**< H264 video */
    M4VIDEOEDITING_kMPEG4 = 3, /**< MPEG-4 video */
    M4VIDEOEDITING_kNullVideo = 254,  /**< Do not care video type, use NULL encoder */
    M4VIDEOEDITING_kUnsupportedVideo = 255    /**< Unsupported video stream type */
} M4VIDEOEDITING_VideoFormat;
@@ -102,51 +101,6 @@ typedef enum {
    M4VIDEOEDITING_kUnsupportedAudio    = 255    /**< Unsupported audio stream type */
} M4VIDEOEDITING_AudioFormat;


/**
 ******************************************************************************
 * enum        M4VIDEOEDITING_VideoProfileAndLevel
 * @brief    This enum defines the video profile and level for MPEG-4 and H263 streams.
 ******************************************************************************
*/
typedef enum
{
    /* H.263 Profiles and levels */
    M4VIDEOEDITING_kH263_Profile_0_Level_10        = 0,
    M4VIDEOEDITING_kH263_Profile_0_Level_20        = 1,
    M4VIDEOEDITING_kH263_Profile_0_Level_30        = 2,
    M4VIDEOEDITING_kH263_Profile_0_Level_40        = 3,
    M4VIDEOEDITING_kH263_Profile_0_Level_45        = 4,
    /* MPEG-4 Profiles and levels */
    M4VIDEOEDITING_kMPEG4_SP_Level_0               = 50,
    M4VIDEOEDITING_kMPEG4_SP_Level_0b              = 51,
    M4VIDEOEDITING_kMPEG4_SP_Level_1               = 52,
    M4VIDEOEDITING_kMPEG4_SP_Level_2               = 53,
    M4VIDEOEDITING_kMPEG4_SP_Level_3               = 54,
    M4VIDEOEDITING_kMPEG4_SP_Level_4a              = 55,
    M4VIDEOEDITING_kMPEG4_SP_Level_5               = 56,
    /* AVC Profiles and levels */
    M4VIDEOEDITING_kH264_Profile_0_Level_1         = 150,
    M4VIDEOEDITING_kH264_Profile_0_Level_1b        = 151,
    M4VIDEOEDITING_kH264_Profile_0_Level_1_1       = 152,
    M4VIDEOEDITING_kH264_Profile_0_Level_1_2       = 153,
    M4VIDEOEDITING_kH264_Profile_0_Level_1_3       = 154,
    M4VIDEOEDITING_kH264_Profile_0_Level_2         = 155,
    M4VIDEOEDITING_kH264_Profile_0_Level_2_1       = 156,
    M4VIDEOEDITING_kH264_Profile_0_Level_2_2       = 157,
    M4VIDEOEDITING_kH264_Profile_0_Level_3         = 158,
    M4VIDEOEDITING_kH264_Profile_0_Level_3_1       = 159,
    M4VIDEOEDITING_kH264_Profile_0_Level_3_2       = 160,
    M4VIDEOEDITING_kH264_Profile_0_Level_4         = 161,
    M4VIDEOEDITING_kH264_Profile_0_Level_4_1       = 162,
    M4VIDEOEDITING_kH264_Profile_0_Level_4_2       = 163,
    M4VIDEOEDITING_kH264_Profile_0_Level_5         = 164,
    M4VIDEOEDITING_kH264_Profile_0_Level_5_1       = 165,
    /* Unsupported profile and level */
    M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range = 255
} M4VIDEOEDITING_VideoProfileAndLevel;


/**
 ******************************************************************************
 * enum        M4VIDEOEDITING_VideoFrameSize
@@ -328,11 +282,9 @@ typedef struct {
    M4OSA_UInt32                        uiVideoTimeScale;    /**< Video time scale */
    M4OSA_Float                         fAverageFrameRate;   /**< Average frame rate of the video
                                                                  stream */
    M4VIDEOEDITING_VideoProfileAndLevel    ProfileAndLevel;     /**< Supported MPEG4 and H263
                                                                     profiles and levels */
    M4OSA_UInt8                         uiH263level;         /**< H263 level (from core decoder)*/
    M4OSA_UInt8                         uiVideoProfile;      /**< H263 or MPEG-4 profile
                                                                (from core decoder) */
    M4OSA_Int32 uiVideoLevel;   /**< video level*/
    M4OSA_Int32 uiVideoProfile; /**< video profile */

    M4OSA_Bool                          bMPEG4dataPartition; /**< MPEG-4 uses data partitioning */
    M4OSA_Bool                          bMPEG4rvlc;          /**< MPEG-4 uses RVLC tool */
    M4OSA_Bool                          bMPEG4resynchMarker; /**< MPEG-4 stream uses Resynch
+2 −0
Original line number Diff line number Diff line
@@ -145,6 +145,8 @@ typedef struct
    M4OSA_Void*                     pTemporaryFile;
    /**< Number of input YUV frames to encode */
    M4OSA_UInt32                    NbVideoFrames;
    M4OSA_Int32   videoProfile;
    M4OSA_Int32   videoLevel;
} M4PTO3GPP_Params;

/**
Loading