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