M4_VideoEditingCommon.h revision 6e779fda8a4f6258f9b910290b2f296d18fb2585
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16/** 17 ****************************************************************************** 18 * @file M4_VideoEditingCommon.h 19 * @brief Video Editing (VSS3GPP, MCS, PTO3GPP) common definitions 20 * @note 21 ****************************************************************************** 22*/ 23 24#ifndef __M4_VIDEOEDITINGCOMMON_H__ 25#define __M4_VIDEOEDITINGCOMMON_H__ 26 27#ifdef __cplusplus 28extern "C" { 29#endif 30 31/** 32 * Version */ 33/* CHANGE_VERSION_HERE */ 34#define M4VIDEOEDITING_VERSION_MAJOR 3 35#define M4VIDEOEDITING_VERSION_MINOR 1 36#define M4VIDEOEDITING_VERSION_REVISION 0 37 38 39/** 40 ****************************************************************************** 41 * enum M4VIDEOEDITING_FileType 42 * @brief This enum defines the file format type to be used 43 ****************************************************************************** 44*/ 45typedef enum { 46 M4VIDEOEDITING_kFileType_3GPP = 0, /**< 3GPP file media type : input & output */ 47 M4VIDEOEDITING_kFileType_MP4 = 1, /**< MP4 file media type : input */ 48 M4VIDEOEDITING_kFileType_AMR = 2, /**< AMR file media type : input & output */ 49 M4VIDEOEDITING_kFileType_MP3 = 3, /**< MP3 file media type : input */ 50 M4VIDEOEDITING_kFileType_PCM = 4, /**< PCM RAW file media type : input RC */ 51 M4VIDEOEDITING_kFileType_JPG = 5, /**< STILL PICTURE FEATURE: JPG file media 52 type : input AND OUTPUT */ 53 M4VIDEOEDITING_kFileType_BMP = 6, /**< STILL PICTURE FEATURE: BMP file media 54 type : input only */ 55 M4VIDEOEDITING_kFileType_GIF = 7, /**< STILL PICTURE FEATURE: GIF file media 56 type : input only */ 57 M4VIDEOEDITING_kFileType_PNG = 8, /**< STILL PICTURE FEATURE: PNG file media 58 type : input only */ 59 M4VIDEOEDITING_kFileType_ARGB8888 = 9, /**< STILL PICTURE FEATURE: ARGB8888 file 60 media type : input only */ 61 M4VIDEOEDITING_kFileType_M4V = 10, /**< M4V file media type : input only */ 62 M4VIDEOEDITING_kFileType_Unsupported = 255 /**< Unsupported file media type */ 63} M4VIDEOEDITING_FileType; 64 65 66/** 67 ****************************************************************************** 68 * enum M4VIDEOEDITING_VideoFormat 69 * @brief This enum defines the avalaible video compression formats. 70 ****************************************************************************** 71*/ 72typedef enum 73{ 74 M4VIDEOEDITING_kNoneVideo = 0, /**< Video not present */ 75 M4VIDEOEDITING_kH263 = 1, /**< H263 video */ 76 M4VIDEOEDITING_kMPEG4 = 2, /**< MPEG-4 video */ 77 M4VIDEOEDITING_kMPEG4_EMP = 3, /**< MPEG-4 video with support for EMP 78 (hsr=15, vsr=15, err=0, Iperiod=15, 79 NO_M4V, NO_AC_PRED) */ 80 M4VIDEOEDITING_kH264 = 4, /**< H264 video */ 81 M4VIDEOEDITING_kNullVideo = 254, /**< Do not care video type, use NULL encoder */ 82 M4VIDEOEDITING_kUnsupportedVideo = 255 /**< Unsupported video stream type */ 83} M4VIDEOEDITING_VideoFormat; 84 85/** 86 ****************************************************************************** 87 * enum M4VIDEOEDITING_AudioFormat 88 * @brief This enum defines the avalaible audio format. 89 * @note HE_AAC, HE_AAC_v2 and MP3 can not be used for the output audio format 90 ****************************************************************************** 91*/ 92typedef enum { 93 M4VIDEOEDITING_kNoneAudio = 0, /**< Audio not present */ 94 M4VIDEOEDITING_kAMR_NB = 1, /**< AMR Narrow Band audio */ 95 M4VIDEOEDITING_kAAC = 2, /**< AAC audio */ 96 M4VIDEOEDITING_kAACplus = 3, /**< AAC+ audio */ 97 M4VIDEOEDITING_keAACplus = 4, /**< Enhanced AAC+ audio */ 98 M4VIDEOEDITING_kMP3 = 5, /**< MP3 audio */ 99 M4VIDEOEDITING_kEVRC = 6, /**< EVRC audio */ 100 M4VIDEOEDITING_kPCM = 7, /**< PCM audio */ 101 M4VIDEOEDITING_kNullAudio = 254, /**< Do not care audio type, use NULL encoder */ 102 M4VIDEOEDITING_kUnsupportedAudio = 255 /**< Unsupported audio stream type */ 103} M4VIDEOEDITING_AudioFormat; 104 105 106/** 107 ****************************************************************************** 108 * enum M4VIDEOEDITING_VideoProfileAndLevel 109 * @brief This enum defines the video profile and level for MPEG-4 and H263 streams. 110 ****************************************************************************** 111*/ 112typedef enum 113{ 114 /* H.263 Profiles and levels */ 115 M4VIDEOEDITING_kH263_Profile_0_Level_10 = 0, 116 M4VIDEOEDITING_kH263_Profile_0_Level_20 = 1, 117 M4VIDEOEDITING_kH263_Profile_0_Level_30 = 2, 118 M4VIDEOEDITING_kH263_Profile_0_Level_40 = 3, 119 M4VIDEOEDITING_kH263_Profile_0_Level_45 = 4, 120 /* MPEG-4 Profiles and levels */ 121 M4VIDEOEDITING_kMPEG4_SP_Level_0 = 50, 122 M4VIDEOEDITING_kMPEG4_SP_Level_0b = 51, 123 M4VIDEOEDITING_kMPEG4_SP_Level_1 = 52, 124 M4VIDEOEDITING_kMPEG4_SP_Level_2 = 53, 125 M4VIDEOEDITING_kMPEG4_SP_Level_3 = 54, 126 M4VIDEOEDITING_kMPEG4_SP_Level_4a = 55, 127 M4VIDEOEDITING_kMPEG4_SP_Level_5 = 56, 128 /* AVC Profiles and levels */ 129 M4VIDEOEDITING_kH264_Profile_0_Level_1 = 150, 130 M4VIDEOEDITING_kH264_Profile_0_Level_1b = 151, 131 M4VIDEOEDITING_kH264_Profile_0_Level_1_1 = 152, 132 M4VIDEOEDITING_kH264_Profile_0_Level_1_2 = 153, 133 M4VIDEOEDITING_kH264_Profile_0_Level_1_3 = 154, 134 M4VIDEOEDITING_kH264_Profile_0_Level_2 = 155, 135 M4VIDEOEDITING_kH264_Profile_0_Level_2_1 = 156, 136 M4VIDEOEDITING_kH264_Profile_0_Level_2_2 = 157, 137 M4VIDEOEDITING_kH264_Profile_0_Level_3 = 158, 138 M4VIDEOEDITING_kH264_Profile_0_Level_3_1 = 159, 139 M4VIDEOEDITING_kH264_Profile_0_Level_3_2 = 160, 140 M4VIDEOEDITING_kH264_Profile_0_Level_4 = 161, 141 M4VIDEOEDITING_kH264_Profile_0_Level_4_1 = 162, 142 M4VIDEOEDITING_kH264_Profile_0_Level_4_2 = 163, 143 M4VIDEOEDITING_kH264_Profile_0_Level_5 = 164, 144 M4VIDEOEDITING_kH264_Profile_0_Level_5_1 = 165, 145 /* Unsupported profile and level */ 146 M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range = 255 147} M4VIDEOEDITING_VideoProfileAndLevel; 148 149 150/** 151 ****************************************************************************** 152 * enum M4VIDEOEDITING_VideoFrameSize 153 * @brief This enum defines the available output frame sizes. 154 ****************************************************************************** 155*/ 156typedef enum 157{ 158 M4VIDEOEDITING_kSQCIF=0, /**< SQCIF 128x96 */ 159 M4VIDEOEDITING_kQQVGA, /**< QQVGA 160x120 */ 160 M4VIDEOEDITING_kQCIF, /**< QCIF 176x144 */ 161 M4VIDEOEDITING_kQVGA, /**< QVGA 320x240 */ 162 M4VIDEOEDITING_kCIF, /**< CIF 352x288 */ 163 M4VIDEOEDITING_kVGA, /**< VGA 640x480 */ 164/* +PR LV5807 */ 165 M4VIDEOEDITING_kWVGA, /**< WVGA 800x480 */ 166 M4VIDEOEDITING_kNTSC, /**< NTSC 720x480 */ 167/* -PR LV5807 */ 168 169/* +CR Google */ 170 M4VIDEOEDITING_k640_360, /**< 640x360 */ 171 M4VIDEOEDITING_k854_480, /**< 854x480 */ 172 M4VIDEOEDITING_k1280_720, /**< 720p 1280x720 */ 173 M4VIDEOEDITING_k1080_720, /**< 720p 1080x720 */ 174 M4VIDEOEDITING_k960_720, /**< 720p 960x720 */ 175 M4VIDEOEDITING_k1920_1080 /**<1080p 1920x1080*/ 176/* -CR Google */ 177 178} M4VIDEOEDITING_VideoFrameSize; 179 180 181/** 182 ****************************************************************************** 183 * enum M4VIDEOEDITING_Videoframerate 184 * @brief This enum defines the available video framerates. 185 ****************************************************************************** 186*/ 187typedef enum 188{ 189 M4VIDEOEDITING_k5_FPS = 0, 190 M4VIDEOEDITING_k7_5_FPS, 191 M4VIDEOEDITING_k10_FPS, 192 M4VIDEOEDITING_k12_5_FPS, 193 M4VIDEOEDITING_k15_FPS, 194 M4VIDEOEDITING_k20_FPS, 195 M4VIDEOEDITING_k25_FPS, 196 M4VIDEOEDITING_k30_FPS 197} M4VIDEOEDITING_VideoFramerate; 198 199 200/** 201 ****************************************************************************** 202 * enum M4VIDEOEDITING_AudioSamplingFrequency 203 * @brief This enum defines the available output audio sampling frequencies 204 * @note 8 kHz is the only supported frequency for AMR-NB output 205 * @note 16 kHz is the only supported frequency for AAC output 206 * @note The recommended practice is to use the Default value when setting the encoding parameters 207 ****************************************************************************** 208*/ 209typedef enum { 210 M4VIDEOEDITING_kDefault_ASF = 0, /**< Default Audio Sampling Frequency for selected 211 Audio output format */ 212 M4VIDEOEDITING_k8000_ASF = 8000, /**< Note: Default audio Sampling Frequency for 213 AMR-NB output */ 214 M4VIDEOEDITING_k11025_ASF = 11025, 215 M4VIDEOEDITING_k12000_ASF = 12000, 216 M4VIDEOEDITING_k16000_ASF = 16000, /**< Note: Default audio Sampling Frequency 217 for AAC output */ 218 M4VIDEOEDITING_k22050_ASF = 22050, 219 M4VIDEOEDITING_k24000_ASF = 24000, 220 M4VIDEOEDITING_k32000_ASF = 32000, 221 M4VIDEOEDITING_k44100_ASF = 44100, 222 M4VIDEOEDITING_k48000_ASF = 48000 223 224} M4VIDEOEDITING_AudioSamplingFrequency; 225 226 227/** 228 ****************************************************************************** 229 * enum M4VIDEOEDITING_Bitrate 230 * @brief This enum defines the available audio or video bitrates. 231 ****************************************************************************** 232*/ 233typedef enum 234{ 235 M4VIDEOEDITING_kVARIABLE_KBPS = -1, /* no regulation */ 236 M4VIDEOEDITING_kUndefinedBitrate = 0, /* undefined */ 237 M4VIDEOEDITING_k8_KBPS = 8000, 238 M4VIDEOEDITING_k9_2_KBPS = 9200, /* evrc only */ 239 M4VIDEOEDITING_k12_2_KBPS = 12200, /* amr only */ 240 M4VIDEOEDITING_k16_KBPS = 16000, 241 M4VIDEOEDITING_k24_KBPS = 24000, 242 M4VIDEOEDITING_k32_KBPS = 32000, 243 M4VIDEOEDITING_k40_KBPS = 40000, 244 M4VIDEOEDITING_k48_KBPS = 48000, 245 M4VIDEOEDITING_k56_KBPS = 56000, 246 M4VIDEOEDITING_k64_KBPS = 64000, 247 M4VIDEOEDITING_k80_KBPS = 80000, 248 M4VIDEOEDITING_k96_KBPS = 96000, 249 M4VIDEOEDITING_k112_KBPS = 112000, 250 M4VIDEOEDITING_k128_KBPS = 128000, 251 M4VIDEOEDITING_k160_KBPS = 160000, 252 M4VIDEOEDITING_k192_KBPS = 192000, 253 M4VIDEOEDITING_k224_KBPS = 224000, 254 M4VIDEOEDITING_k256_KBPS = 256000, 255 M4VIDEOEDITING_k288_KBPS = 288000, 256 M4VIDEOEDITING_k320_KBPS = 320000, 257 M4VIDEOEDITING_k384_KBPS = 384000, 258 M4VIDEOEDITING_k512_KBPS = 512000, 259 M4VIDEOEDITING_k800_KBPS = 800000, 260/*+ New Encoder bitrates */ 261 M4VIDEOEDITING_k2_MBPS = 2000000, 262 M4VIDEOEDITING_k5_MBPS = 5000000, 263 M4VIDEOEDITING_k8_MBPS = 8000000, 264/*- New Encoder bitrates */ 265} M4VIDEOEDITING_Bitrate; 266 267 268/** 269 ****************************************************************************** 270 * structure M4VIDEOEDITING_FtypBox 271 * @brief Information to build the 'ftyp' atom 272 ****************************************************************************** 273*/ 274#define M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS 10 275typedef struct 276{ 277 /* All brand fields are actually char[4] stored in big-endian integer format */ 278 279 M4OSA_UInt32 major_brand; /* generally '3gp4' */ 280 M4OSA_UInt32 minor_version; /* generally '0000' or 'x.x ' */ 281 M4OSA_UInt32 nbCompatibleBrands; /* number of compatible brands */ 282 M4OSA_UInt32 compatible_brands[M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS]; /* array of 283 max compatible brands */ 284 285} M4VIDEOEDITING_FtypBox; 286 287/* Some useful brands */ 288#define M4VIDEOEDITING_BRAND_0000 0x00000000 289#define M4VIDEOEDITING_BRAND_3G2A 0x33673261 290#define M4VIDEOEDITING_BRAND_3GP4 0x33677034 291#define M4VIDEOEDITING_BRAND_3GP5 0x33677035 292#define M4VIDEOEDITING_BRAND_3GP6 0x33677036 293#define M4VIDEOEDITING_BRAND_AVC1 0x61766331 294#define M4VIDEOEDITING_BRAND_EMP 0x656D7020 295#define M4VIDEOEDITING_BRAND_ISOM 0x69736F6D 296#define M4VIDEOEDITING_BRAND_MP41 0x6D703431 297#define M4VIDEOEDITING_BRAND_MP42 0x6D703432 298#define M4VIDEOEDITING_BRAND_VFJ1 0x76666A31 299 300/** 301 ****************************************************************************** 302 * enum M4VIDEOEDITING_ClipProperties 303 * @brief This structure gathers the information related to an input file 304 ****************************************************************************** 305*/ 306typedef struct { 307 308 /** 309 * Common */ 310 M4OSA_Bool bAnalysed; /**< Flag to know if the file has 311 been already analysed or not */ 312 M4OSA_UInt8 Version[3]; /**< Version of the libraries used to 313 perform the clip analysis */ 314 M4OSA_UInt32 uiClipDuration; /**< Clip duration (in ms) */ 315 M4VIDEOEDITING_FileType FileType; /**< .3gp, .amr, .mp3 */ 316 M4VIDEOEDITING_FtypBox ftyp; /**< 3gp 'ftyp' atom, major_brand = 317 0 if not used */ 318 319 /** 320 * Video */ 321 M4VIDEOEDITING_VideoFormat VideoStreamType; /**< Format of the video stream */ 322 M4OSA_UInt32 uiClipVideoDuration; /**< Video track duration (in ms) */ 323 M4OSA_UInt32 uiVideoBitrate; /**< Video average bitrate (in bps)*/ 324 M4OSA_UInt32 uiVideoMaxAuSize; /**< Maximum Access Unit size of the 325 video stream */ 326 M4OSA_UInt32 uiVideoWidth; /**< Video frame width */ 327 M4OSA_UInt32 uiVideoHeight; /**< Video frame height */ 328 M4OSA_UInt32 uiVideoTimeScale; /**< Video time scale */ 329 M4OSA_Float fAverageFrameRate; /**< Average frame rate of the video 330 stream */ 331 M4VIDEOEDITING_VideoProfileAndLevel ProfileAndLevel; /**< Supported MPEG4 and H263 332 profiles and levels */ 333 M4OSA_UInt8 uiH263level; /**< H263 level (from core decoder)*/ 334 M4OSA_UInt8 uiVideoProfile; /**< H263 or MPEG-4 profile 335 (from core decoder) */ 336 M4OSA_Bool bMPEG4dataPartition; /**< MPEG-4 uses data partitioning */ 337 M4OSA_Bool bMPEG4rvlc; /**< MPEG-4 uses RVLC tool */ 338 M4OSA_Bool bMPEG4resynchMarker; /**< MPEG-4 stream uses Resynch 339 Marker */ 340 341 /** 342 * Audio */ 343 M4VIDEOEDITING_AudioFormat AudioStreamType; /**< Format of the audio stream */ 344 M4OSA_UInt32 uiClipAudioDuration; /**< Audio track duration (in ms) */ 345 M4OSA_UInt32 uiAudioBitrate; /**< Audio average bitrate (in bps) */ 346 M4OSA_UInt32 uiAudioMaxAuSize; /**< Maximum Access Unit size of the 347 audio stream */ 348 M4OSA_UInt32 uiNbChannels; /**< Number of channels 349 (1=mono, 2=stereo) */ 350 M4OSA_UInt32 uiSamplingFrequency; /**< Sampling audio frequency 351 (8000 for amr, 16000 or more for aac) */ 352 M4OSA_UInt32 uiExtendedSamplingFrequency; /**< Extended frequency for 353 AAC+, eAAC+ streams */ 354 M4OSA_UInt32 uiDecodedPcmSize; /**< Size of the decoded PCM data */ 355 356 /** 357 * Video editing compatibility chart */ 358 M4OSA_Bool bVideoIsEditable; /**< Video stream can be decoded and 359 re-encoded */ 360 M4OSA_Bool bAudioIsEditable; /**< Audio stream can be decoded and 361 re-encoded */ 362 M4OSA_Bool bVideoIsCompatibleWithMasterClip; /**< Video properties match reference 363 clip properties */ 364 M4OSA_Bool bAudioIsCompatibleWithMasterClip; /**< Audio properties match reference 365 clip properties */ 366 367 /** 368 * Still Picture */ 369 M4OSA_UInt32 uiStillPicWidth; /**< Image width */ 370 M4OSA_UInt32 uiStillPicHeight; /**< Image height */ 371 M4OSA_UInt32 uiClipAudioVolumePercentage; 372 M4OSA_Bool bSetImageData; 373 374} M4VIDEOEDITING_ClipProperties; 375 376 377#ifdef __cplusplus 378 } 379#endif 380 381#endif /* __M4_VIDEOEDITINGCOMMON_H__ */ 382 383