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 M4MCS_API.h 19 * @brief MCS internal types and structures definitions 20 * @note This header file is not public 21 ************************************************************************* 22 **/ 23 24 #ifndef __M4MCS_INTERNALTYPES_H__ 25 #define __M4MCS_INTERNALTYPES_H__ 26 27 /** 28 * MCS public API and types */ 29 #include "M4MCS_API.h" 30 #include "M4MCS_ErrorCodes.h" 31 32 #include "NXPSW_CompilerSwitches.h" 33 34 /** Determine absolute value of a. */ 35 #define M4MCS_ABS(a) ( ( (a) < (0) ) ? (-(a)) : (a) ) 36 37 38 #define Y_PLANE_BORDER_VALUE 0x00 39 #define U_PLANE_BORDER_VALUE 0x80 40 #define V_PLANE_BORDER_VALUE 0x80 41 42 43 /** 44 * Internally used modules */ 45 #include "M4READER_3gpCom.h" /**< Read 3GPP file */ 46 #include "M4DECODER_Common.h" /**< Decode video */ 47 #include "M4VIFI_FiltersAPI.h" /**< Video resize */ 48 #include "M4AD_Common.h" /**< Decoder audio */ 49 #include "SSRC.h" /**< SSRC */ 50 #include "From2iToMono_16.h" /**< Stereo to Mono */ 51 #include "MonoTo2I_16.h" /**< Mono to Stereo */ 52 #include "M4ENCODER_AudioCommon.h" /**< Encode audio */ 53 #include "M4WRITER_common.h" /**< Writer common interface */ 54 #include "M4ENCODER_common.h" 55 56 /** 57 * Instead of including AAC core properties, it is better to redefine the needed type 58 * AAC_DEC_STREAM_PROPS 59 * In case of external AAC decoder, it will be necessary to put this type as public 60 */ 61 62 /** 63 ****************************************************************************** 64 * struct AAC_DEC_STREAM_PROPS 65 * @brief AAC Stream properties 66 * @Note aNoChan and aSampFreq are used for parsing even the user parameters 67 * are different. User parameters will be input for the output behaviour 68 * of the decoder whereas for parsing bitstream properties are used. 69 ****************************************************************************** 70 */ 71 typedef struct { 72 M4OSA_Int32 aAudioObjectType; /**< Audio object type of the stream - in fact 73 the type found in the Access Unit parsed */ 74 M4OSA_Int32 aNumChan; /**< number of channels (=1(mono) or =2(stereo)) 75 as indicated by input bitstream*/ 76 M4OSA_Int32 aSampFreq; /**< sampling frequency in Hz */ 77 M4OSA_Int32 aExtensionSampFreq; /**< extended sampling frequency in Hz, = 0 is 78 no extended frequency */ 79 M4OSA_Int32 aSBRPresent; /**< presence=1/absence=0 of SBR */ 80 M4OSA_Int32 aPSPresent; /**< presence=1/absence=0 of PS */ 81 M4OSA_Int32 aMaxPCMSamplesPerCh; /**< max number of PCM samples per channel */ 82 } AAC_DEC_STREAM_PROPS; 83 84 /** 85 ****************************************************************************** 86 * @brief Codecs registration same as in VPS and VES, so less mapping 87 * is required toward MCS api types 88 ****************************************************************************** 89 */ 90 typedef struct 91 { 92 M4WRITER_GlobalInterface* pGlobalFcts; /**< open, close, setoption,etc... functions */ 93 M4WRITER_DataInterface* pDataFcts; /**< data manipulation functions */ 94 } M4MCS_WriterInterface; 95 96 /** 97 ****************************************************************************** 98 * enum M4MCS_States 99 * @brief Main state machine of the MCS. 100 ****************************************************************************** 101 */ 102 typedef enum 103 { 104 M4MCS_kState_CREATED, /**< M4MCS_init has been called */ 105 M4MCS_kState_OPENED, /**< M4MCS_open has been called */ 106 M4MCS_kState_SET, /**< All mandatory parameters have been set */ 107 M4MCS_kState_READY, /**< All optionnal parameters have been set */ 108 M4MCS_kState_BEGINVIDEOJUMP, /**< Must jump to the Iframe before the begin cut */ 109 M4MCS_kState_BEGINVIDEODECODE, /**< Must decode up to the begin cut */ 110 M4MCS_kState_PROCESSING, /**< Step can be called */ 111 M4MCS_kState_PAUSED, /**< Paused, Resume can be called */ 112 M4MCS_kState_FINISHED, /**< Transcoding is finished */ 113 M4MCS_kState_CLOSED /**< Output file has been created */ 114 } M4MCS_States; 115 116 /** 117 ****************************************************************************** 118 * enum M4MCS_StreamState 119 * @brief State of a media stream encoding (audio or video). 120 ****************************************************************************** 121 */ 122 typedef enum 123 { 124 M4MCS_kStreamState_NOSTREAM = 0, /**< No stream present */ 125 M4MCS_kStreamState_STARTED = 1, /**< The stream encoding is in progress */ 126 M4MCS_kStreamState_FINISHED = 2 /**< The stream has finished encoding */ 127 } M4MCS_StreamState; 128 129 130 /** 131 ****************************************************************************** 132 * enum anonymous enum 133 * @brief enum to keep track of the encoder state 134 ****************************************************************************** 135 */ 136 enum 137 { 138 M4MCS_kNoEncoder, 139 M4MCS_kEncoderClosed, 140 M4MCS_kEncoderStopped, 141 M4MCS_kEncoderRunning 142 }; 143 144 /** 145 ****************************************************************************** 146 * structure M4MCS_InternalContext 147 * @brief This structure defines the MCS context (private) 148 * @note This structure is used for all MCS calls to store the context 149 ****************************************************************************** 150 */ 151 typedef struct 152 { 153 M4OSA_UInt32 bitPos; 154 /* bit count of number of bits used so far */ 155 156 M4OSA_UInt8 *streamBuffer; 157 /* Bitstream Buffer */ 158 159 M4OSA_UInt32 byteCnt; 160 /* Number of Bytes written in Bitstream buffer*/ 161 162 M4OSA_UInt32 currBuff; 163 /* Current buffer holds, 4bytes of bitstream*/ 164 165 M4OSA_UInt8 prevByte; 166 /* Previous byte written in the buffer */ 167 168 M4OSA_UInt8 prevPrevByte; 169 /* Previous to previous byte written in the buffer */ 170 171 }NSWAVC_bitStream_t_MCS; 172 173 #define _MAXnum_slice_groups 8 174 #define _MAXnum_ref_frames_in_pic_order_cnt_cycle 256 175 176 typedef struct 177 { 178 M4OSA_UInt32 level_idc_index; 179 M4OSA_UInt32 MaxFrameNum; 180 M4OSA_UInt32 expectedDeltaPerPicOrderCntCycle; 181 M4OSA_Int32 MaxPicOrderCntLsb; 182 M4OSA_Int32 max_dec_frame_buffering; 183 184 /* (pic_order_cnt_type == 1) */ 185 M4OSA_Int32 offset_for_non_ref_pic; 186 M4OSA_Int32 offset_for_top_to_bottom_field; 187 M4OSA_Int32 frame_crop_left_offset; 188 M4OSA_Int32 frame_crop_right_offset; 189 M4OSA_Int32 frame_crop_top_offset; 190 M4OSA_Int32 frame_crop_bottom_offset; 191 M4OSA_Int32 offset_for_ref_frame[_MAXnum_ref_frames_in_pic_order_cnt_cycle]; 192 193 M4OSA_UInt16 PicWidthInMbs; 194 M4OSA_UInt16 FrameHeightInMbs; 195 M4OSA_UInt16 pic_width_in_mbs_minus1; 196 M4OSA_UInt16 pic_height_in_map_units_minus1; 197 198 #ifdef _CAP_FMO_ 199 M4OSA_UInt16 NumSliceGroupMapUnits; 200 M4OSA_UInt16 MaxPicSizeInMbs; 201 #endif /*_CAP_FMO_*/ 202 203 M4OSA_UInt8 profile_idc; 204 M4OSA_UInt8 reserved_zero_4bits; 205 M4OSA_UInt8 level_idc; 206 M4OSA_UInt8 seq_parameter_set_id; 207 M4OSA_UInt8 log2_max_frame_num_minus4; 208 M4OSA_UInt8 pic_order_cnt_type; 209 /* if(pic_order_cnt_type == 0) */ 210 M4OSA_UInt8 log2_max_pic_order_cnt_lsb_minus4; 211 212 M4OSA_UInt8 num_ref_frames_in_pic_order_cnt_cycle; 213 /* for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ ) */ 214 M4OSA_UInt8 num_ref_frames; 215 216 M4OSA_Bool constraint_set0_flag; 217 M4OSA_Bool constraint_set1_flag; 218 M4OSA_Bool constraint_set2_flag; 219 M4OSA_Bool constraint_set3_flag; 220 M4OSA_Bool delta_pic_order_always_zero_flag; 221 M4OSA_Bool gaps_in_frame_num_value_allowed_flag; 222 M4OSA_Bool frame_mbs_only_flag; 223 M4OSA_Bool mb_adaptive_frame_field_flag; 224 M4OSA_Bool direct_8x8_inference_flag; 225 M4OSA_Bool frame_cropping_flag; 226 M4OSA_Bool vui_parameters_present_flag; 227 M4OSA_Bool Active; 228 229 /* vui_seq_parameters_t vui_seq_parameters; */ 230 } ComSequenceParameterSet_t_MCS; 231 232 typedef struct 233 { 234 M4OSA_Int16 pic_init_qp_minus26; 235 M4OSA_Int16 pic_init_qs_minus26; 236 M4OSA_Int16 chroma_qp_index_offset; 237 238 //#ifdef _CAP_FMO_ 239 /* if( slice_group_map_type = = 0 ) */ 240 M4OSA_UInt16 run_length_minus1[_MAXnum_slice_groups]; 241 /* else if( slice_group_map_type = = 2 ) */ 242 M4OSA_UInt16 top_left[_MAXnum_slice_groups]; 243 M4OSA_UInt16 bottom_right[_MAXnum_slice_groups]; 244 /* else if( slice_group_map_type = = 6 ) */ 245 M4OSA_UInt16 pic_size_in_map_units_minus1; 246 M4OSA_UInt16 slice_group_change_rate_minus1; 247 248 M4OSA_UInt16 FirstMbInSliceGroup[_MAXnum_slice_groups]; 249 M4OSA_UInt16 LastMbInSliceGroup[_MAXnum_slice_groups]; 250 251 252 M4OSA_UInt8 *slice_group_id; 253 M4OSA_UInt8 *MapUnitToSliceGroupMap; 254 M4OSA_UInt8 *MbToSliceGroupMap; 255 M4OSA_UInt16 NumSliceGroupMapUnits; 256 257 M4OSA_UInt8 slice_group_map_type; 258 /* else if( slice_group_map_type = = 3 || 4 || 5 */ 259 M4OSA_Bool slice_group_change_direction_flag; 260 M4OSA_Bool map_initialized; 261 // #endif /*_CAP_FMO_*/ 262 263 M4OSA_UInt8 pic_parameter_set_id; 264 M4OSA_UInt8 seq_parameter_set_id; 265 M4OSA_UInt8 num_ref_idx_l0_active_minus1; 266 M4OSA_UInt8 num_ref_idx_l1_active_minus1; 267 M4OSA_UInt8 weighted_bipred_idc; 268 M4OSA_UInt8 num_slice_groups_minus1; 269 270 M4OSA_Bool entropy_coding_mode_flag; 271 /* if( pic_order_cnt_type < 2 ) in the sequence parameter set */ 272 M4OSA_Bool pic_order_present_flag; 273 M4OSA_Bool weighted_pred_flag; 274 M4OSA_Bool deblocking_filter_control_present_flag; 275 M4OSA_Bool constrained_intra_pred_flag; 276 M4OSA_Bool redundant_pic_cnt_present_flag; 277 M4OSA_Bool Active; 278 279 ComSequenceParameterSet_t_MCS *p_active_sps; 280 } ComPictureParameterSet_t_MCS; 281 282 typedef struct 283 { 284 M4OSA_UInt32 bitPos; /*!< bit position in buffer */ 285 M4OSA_UInt32 totalBits; /*!< bit position in file (total bits read so far) */ 286 287 M4OSA_UInt32 lastTotalBits; /*!< bit position in file of the last VOP */ 288 M4OSA_UInt32 numBitsInBuffer; /*!< number of bits in buffer */ 289 M4OSA_UInt32 readableBytesInBuffer; /*!< number of bytes that can be read in decoder buffer*/ 290 M4OSA_UInt32 maxBufferSize; /*!< max buffer size in bit units */ 291 M4OSA_UInt8 *Buffer; /*!< char buffer at reading from file */ 292 M4OSA_Int32 i8BitCnt; 293 M4OSA_UInt32 ui32TempBuff; 294 M4OSA_Int8*pui8BfrPtr; 295 M4OSA_UInt32 ui32LastTwoBytes; /*!< stores the last read two bytes */ 296 } ComBitStreamMCS_t; 297 298 299 typedef struct 300 { 301 302 M4OSA_Int32 prev_frame_num; 303 M4OSA_Int32 cur_frame_num; 304 M4OSA_Int32 prev_new_frame_num; 305 M4OSA_Int32 log2_max_frame_num_minus4; 306 M4OSA_Int32 is_done; 307 M4OSA_Int32 is_first; 308 M4OSA_Int32 frame_count; 309 M4OSA_Int32 frame_mod_count; 310 M4OSA_Int32 POC_lsb; 311 M4OSA_Int32 POC_lsb_mod; 312 313 314 M4OSA_UInt32 m_Num_Bytes_NALUnitLength; 315 316 M4OSA_UInt8* m_pDecoderSpecificInfo; /**< Pointer on specific information required 317 to create a decoder */ 318 M4OSA_UInt32 m_decoderSpecificInfoSize;/**< Size of the specific information pointer above*/ 319 320 M4OSA_UInt8* m_pEncoderSPS; 321 M4OSA_UInt32 m_encoderSPSSize; 322 323 M4OSA_UInt8* m_pEncoderPPS; 324 M4OSA_UInt32 m_encoderPPSSize; 325 326 M4OSA_UInt8* m_pFinalDSI; 327 M4OSA_UInt32 m_pFinalDSISize; 328 329 M4OSA_UInt32 m_encoder_SPS_Cnt; 330 ComSequenceParameterSet_t_MCS *p_clip_sps; 331 M4OSA_UInt32 m_encoder_PPS_Cnt; 332 ComPictureParameterSet_t_MCS *p_clip_pps; 333 334 ComSequenceParameterSet_t_MCS *p_encoder_sps; 335 ComPictureParameterSet_t_MCS *p_encoder_pps; 336 337 338 ComSequenceParameterSet_t_MCS encoder_sps; 339 ComPictureParameterSet_t_MCS encoder_pps; 340 ComSequenceParameterSet_t_MCS clip_sps; 341 342 /* Encoder SPS parameters */ 343 M4OSA_UInt32 enc_seq_parameter_set_id; 344 M4OSA_UInt32 enc_log2_max_frame_num_minus4; 345 M4OSA_UInt32 enc_pic_order_cnt_type; 346 M4OSA_UInt32 enc_log2_max_pic_order_cnt_lsb_minus4; /* applicable when POC type = 0 */ 347 M4OSA_UInt32 enc_delta_pic_order_always_zero_flag; 348 M4OSA_Int32 enc_offset_for_non_ref_pic; 349 M4OSA_Int32 enc_offset_for_top_to_bottom_field; 350 M4OSA_UInt32 enc_num_ref_frames_in_pic_order_cnt_cycle; /* range 0 to 255 */ 351 /* array of size num_ref_frames_in_pic_order_cnt_cycle */ 352 M4OSA_Int32 enc_offset_for_ref_frame[256]; 353 M4OSA_UInt32 enc_num_ref_frames; 354 M4OSA_UInt32 enc_gaps_in_frame_num_value_allowed_flag; 355 356 357 /* Input clip SPS parameters */ 358 M4OSA_UInt32 clip_seq_parameter_set_id; 359 M4OSA_UInt32 clip_log2_max_frame_num_minus4; 360 M4OSA_UInt32 clip_pic_order_cnt_type; 361 M4OSA_UInt32 clip_log2_max_pic_order_cnt_lsb_minus4; /* applicable when POC type = 0 */ 362 M4OSA_UInt32 clip_delta_pic_order_always_zero_flag; 363 M4OSA_Int32 clip_offset_for_non_ref_pic; 364 M4OSA_Int32 clip_offset_for_top_to_bottom_field; 365 M4OSA_UInt32 clip_num_ref_frames_in_pic_order_cnt_cycle; /* range 0 to 255 */ 366 /* array of size num_ref_frames_in_pic_order_cnt_cycle */ 367 M4OSA_Int32 clip_offset_for_ref_frame[256]; 368 M4OSA_UInt32 clip_num_ref_frames; 369 M4OSA_UInt32 clip_gaps_in_frame_num_value_allowed_flag; 370 371 M4OSA_UInt32 final_PPS_ID; 372 M4OSA_UInt32 final_SPS_ID; 373 NSWAVC_bitStream_t_MCS encbs; 374 375 } NSWAVC_MCS_t; 376 377 378 379 /** 380 ****************************************************************************** 381 * structure M4MCS_InternalContext 382 * @brief This structure defines the MCS context (private) 383 * @note This structure is used for all MCS calls to store the context 384 ****************************************************************************** 385 */ 386 typedef struct 387 { 388 /** 389 * MCS State and settings stuff */ 390 M4MCS_States State; /**< MCS internal state */ 391 M4MCS_StreamState VideoState;/**< State of the video encoding */ 392 M4MCS_StreamState AudioState;/**< State of the audio encoding */ 393 M4OSA_Bool noaudio;/**< Flag to know if we have to deal with audio transcoding */ 394 M4OSA_Bool novideo;/**< Flag to know if we have to deal with video transcoding */ 395 396 M4VIDEOEDITING_ClipProperties InputFileProperties;/**< Input audio/video stream properties */ 397 M4OSA_Void* pInputFile; /**< Remember input file pointer between fast 398 open and normal open */ 399 M4VIDEOEDITING_FileType InputFileType; /**< Remember input file type between fast 400 open and normal open */ 401 M4OSA_Bool bFileOpenedInFastMode; /**< Flag to know if a particular reader 402 supports fast open */ 403 M4OSA_UInt32 uiMaxMetadataSize; /**< Limitation on the max acceptable moov 404 size of a 3gpp file */ 405 406 M4ENCODER_Format EncodingVideoFormat; /**< Output video format, set by the user */ 407 M4ENCODER_FrameWidth EncodingWidth; /**< Output video width, set by the user */ 408 M4ENCODER_FrameHeight EncodingHeight; /**< Output video height, set by the user */ 409 M4ENCODER_FrameRate EncodingVideoFramerate; /**< Output video framerate, set by the user*/ 410 411 M4OSA_UInt32 uiBeginCutTime; /**< Begin cut time, in milliseconds */ 412 M4OSA_UInt32 uiEndCutTime; /**< Begin cut time, in milliseconds */ 413 M4OSA_UInt32 uiMaxFileSize; /**< Maximum output file size, in bytes */ 414 M4OSA_UInt32 uiAudioBitrate; /**< Targeted audio bitrate in bps */ 415 M4OSA_UInt32 uiVideoBitrate; /**< Targeted video bitrate in bps */ 416 417 M4OSA_UInt8 uiProgress; /**< Progress information saved at each step to be able to 418 return it in case of pause */ 419 420 /** 421 * Reader stuff */ 422 M4OSA_Context pReaderContext; /**< Context of the reader module */ 423 M4_VideoStreamHandler* pReaderVideoStream; /**< Description of the read video stream */ 424 M4_AudioStreamHandler* pReaderAudioStream; /**< Description of the read audio stream */ 425 M4OSA_Bool bUnsupportedVideoFound; /**< True if an unsupported video stream 426 type has been found */ 427 M4OSA_Bool bUnsupportedAudioFound; /**< True if an unsupported audio stream 428 type has been found */ 429 M4_AccessUnit ReaderVideoAU; /**< Read video access unit */ 430 M4_AccessUnit ReaderVideoAU1; /**< Read video access unit */ 431 M4_AccessUnit ReaderVideoAU2; /**< Read video access unit */ 432 M4_AccessUnit ReaderAudioAU; /**< Read audio access unit */ 433 M4_AccessUnit ReaderAudioAU1; /**< Read audio access unit */ 434 M4_AccessUnit ReaderAudioAU2; /**< Read audio access unit */ 435 M4OSA_MemAddr8 m_pDataAddress1; /**< Temporary buffer for Access Unit */ 436 M4OSA_MemAddr8 m_pDataAddress2; /**< Temporary buffer for Access Unit */ 437 M4OSA_MemAddr8 m_pDataVideoAddress1; /**< Temporary buffer for Access Unit */ 438 M4OSA_MemAddr8 m_pDataVideoAddress2; /**< Temporary buffer for Access Unit */ 439 M4OSA_UInt32 m_audioAUDuration; /**< Audio AU duration */ 440 M4OSA_Int32 iAudioCtsOffset; /**< Audio AU CTS offset due to begin cut */ 441 442 /** 443 * Video decoder stuff */ 444 M4OSA_Context pViDecCtxt; /**< Video decoder context */ 445 M4OSA_Double dViDecStartingCts; /**< Video CTS at which the decode/encode will start 446 (used for begin cut and pause/resume) */ 447 M4OSA_Double dViDecCurrentCts; /**< Video CTS to decode */ 448 M4OSA_Int32 iVideoBeginDecIncr; /**< CTS step for the begin cut decode (doesn't 449 need floating point precision) */ 450 M4OSA_Double dCtsIncrement; /**< Cts increment from one video frame to another*/ 451 M4OSA_Bool isRenderDup; /**< To handle duplicate frame rendering in case of 452 external decoding */ 453 M4VIFI_ImagePlane* lastDecodedPlane; /**< Last decoded plane */ 454 455 /** 456 * Video encoder stuff */ 457 M4OSA_Context pViEncCtxt; /**< Video encoder context */ 458 M4VIFI_ImagePlane* pPreResizeFrame; /**< The decoded image before resize 459 (allocated if resize needed only)*/ 460 M4OSA_UInt32 uiEncVideoBitrate; /**< Actual video bitrate for the video encoder */ 461 M4OSA_UInt32 outputVideoTimescale; 462 M4OSA_UInt32 encoderState; 463 464 /** 465 * Audio decoder stuff */ 466 M4OSA_Context pAudioDecCtxt; /**< Audio (AAC) decoder context */ 467 M4AD_Buffer AudioDecBufferIn; /**< Input structure for the audio decoder */ 468 M4AD_Buffer AudioDecBufferOut; /**< Output structure for the audio decoder */ 469 M4OSA_MemAddr8 pPosInDecBufferOut; /**< Position into the decoder buffer */ 470 AAC_DEC_STREAM_PROPS AacProperties; /**< Structure for new api to get AAC properties */ 471 472 /** 473 * Sample Rate Convertor (SSRC) stuff */ 474 SSRC_Instance_t SsrcInstance; /**< Context of the Ssrc */ 475 SSRC_Scratch_t* SsrcScratch; /**< Working memory of the Ssrc */ 476 short iSsrcNbSamplIn; /**< Number of sample the Ssrc needs as input */ 477 short iSsrcNbSamplOut; /**< Number of sample the Ssrc outputs */ 478 M4OSA_MemAddr8 pSsrcBufferIn; /**< Input of the SSRC */ 479 M4OSA_MemAddr8 pSsrcBufferOut; /**< Output of the SSRC */ 480 M4OSA_MemAddr8 pPosInSsrcBufferIn; /**< Position into the SSRC in buffer */ 481 M4OSA_MemAddr8 pPosInSsrcBufferOut;/**< Position into the SSRC out buffer */ 482 483 M4OSA_Context pLVAudioResampler; 484 485 486 /** 487 * audio encoder stuff */ 488 M4OSA_Context pAudioEncCtxt; /**< Context of the audio encoder */ 489 M4ENCODER_AudioDecSpecificInfo pAudioEncDSI; /**< Decoder specific info built by the encoder*/ 490 M4ENCODER_AudioParams AudioEncParams;/**< Config of the audio encoder */ 491 M4OSA_MemAddr8 pAudioEncoderBuffer; /**< Input of the encoder */ 492 M4OSA_MemAddr8 pPosInAudioEncoderBuffer; /**< Position into the encoder buffer */ 493 M4OSA_UInt32 audioEncoderGranularity; /**< Minimum number of pcm samples needed 494 to feed audio encoder */ 495 496 /** 497 * Writer stuff */ 498 M4OSA_Context pWriterContext; /**< Context of the writer module */ 499 M4OSA_Void* pOutputFile; /**< Output file to be created */ 500 M4OSA_Void* pTemporaryFile; /**< Temporary file to be created to store 501 metadata ("moov.bin") */ 502 M4SYS_StreamDescription WriterVideoStream; /**< Description of the written video stream */ 503 M4SYS_StreamDescription WriterAudioStream; /**< Description of the written audio stream */ 504 M4WRITER_StreamVideoInfos WriterVideoStreamInfo;/**< Video properties of the written video 505 stream */ 506 M4SYS_AccessUnit WriterVideoAU; /**< Written video access unit */ 507 M4SYS_AccessUnit WriterAudioAU; /**< Written audio access unit */ 508 M4OSA_UInt32 uiVideoAUCount; /**< Number of video AU written in output 509 file */ 510 M4OSA_UInt32 uiVideoMaxAuSize; /**< Max access unit size for the output 511 video stream */ 512 M4OSA_UInt32 uiVideoMaxChunckSize; /**< Max chunck size for the output video 513 stream */ 514 M4OSA_UInt32 uiAudioAUCount; /**< Number of audio AU written in output file */ 515 M4OSA_UInt32 uiAudioMaxAuSize; /**< Max access unit size for the output 516 audio stream */ 517 M4OSA_UInt32 uiAudioCts; /**< Audio AU cts (when audio is transcoded) */ 518 M4OSA_Bool b_isRawWriter; /**< Boolean to know if the raw writer is 519 registered or not */ 520 M4OSA_Context pOutputPCMfile; /**< Output PCM file if not NULL */ 521 522 /** 523 * Filesystem functions */ 524 M4OSA_FileReadPointer* pOsaFileReadPtr; /**< OSAL file read functions, 525 to be provided by user */ 526 M4OSA_FileWriterPointer* pOsaFileWritPtr; /**< OSAL file write functions, 527 to be provided by user */ 528 529 /** 530 * Media and Codec registration */ 531 /**< Table of M4VES_WriterInterface structures for avalaible Writers list */ 532 M4MCS_WriterInterface WriterInterface[M4WRITER_kType_NB]; 533 /**< open, close, setoption,etc... functions of the used writer*/ 534 M4WRITER_GlobalInterface* pWriterGlobalFcts; 535 /**< data manipulation functions of the used writer */ 536 M4WRITER_DataInterface* pWriterDataFcts; 537 /**< Table of M4ENCODER_GlobalInterface structures for avalaible encoders list */ 538 M4ENCODER_GlobalInterface* pVideoEncoderInterface[M4ENCODER_kVideo_NB]; 539 /**< Functions of the used encoder */ 540 M4ENCODER_GlobalInterface* pVideoEncoderGlobalFcts; 541 542 M4OSA_Void* pVideoEncoderExternalAPITable[M4ENCODER_kVideo_NB]; 543 M4OSA_Void* pCurrentVideoEncoderExternalAPI; 544 M4OSA_Void* pVideoEncoderUserDataTable[M4ENCODER_kVideo_NB]; 545 M4OSA_Void* pCurrentVideoEncoderUserData; 546 547 /**< Table of M4ENCODER_AudioGlobalInterface structures for avalaible encoders list */ 548 M4ENCODER_AudioGlobalInterface* pAudioEncoderInterface[M4ENCODER_kAudio_NB]; 549 /**< Table of internal/external flags for avalaible encoders list */ 550 M4OSA_Bool pAudioEncoderFlag[M4ENCODER_kAudio_NB]; 551 /**< Functions of the used encoder */ 552 M4ENCODER_AudioGlobalInterface* pAudioEncoderGlobalFcts; 553 M4OSA_Void* pAudioEncoderUserDataTable[M4ENCODER_kAudio_NB]; 554 M4OSA_Void* pCurrentAudioEncoderUserData; 555 556 M4READER_GlobalInterface* m_pReaderGlobalItTable[M4READER_kMediaType_NB]; 557 M4READER_DataInterface* m_pReaderDataItTable[M4READER_kMediaType_NB]; 558 M4READER_GlobalInterface* m_pReader; 559 M4READER_DataInterface* m_pReaderDataIt; 560 M4OSA_UInt8 m_uiNbRegisteredReaders; 561 562 M4DECODER_VideoInterface* m_pVideoDecoder; 563 M4DECODER_VideoInterface* m_pVideoDecoderItTable[M4DECODER_kVideoType_NB]; 564 #ifdef M4VSS_ENABLE_EXTERNAL_DECODERS 565 M4OSA_Void* m_pCurrentVideoDecoderUserData; 566 M4OSA_Void* m_pVideoDecoderUserDataTable[M4DECODER_kVideoType_NB]; 567 #endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ 568 M4OSA_UInt8 m_uiNbRegisteredVideoDec; 569 570 M4AD_Interface* m_pAudioDecoder; 571 M4AD_Interface* m_pAudioDecoderItTable[M4AD_kType_NB]; 572 M4OSA_Bool m_pAudioDecoderFlagTable[M4AD_kType_NB]; /**< store indices of external 573 decoders */ 574 M4OSA_Void* m_pAudioDecoderUserDataTable[M4AD_kType_NB]; 575 M4OSA_Void* m_pCurrentAudioDecoderUserData; 576 577 M4MCS_MediaRendering MediaRendering; /**< FB: to crop, resize, or render black borders*/ 578 M4OSA_Context m_air_context; 579 M4OSA_Bool bExtOMXAudDecoder; /* External OMX Audio decoder */ 580 581 /**< FlB 2009.03.04: Audio effects*/ 582 M4MCS_EffectSettings *pEffects; /**< List of effects */ 583 M4OSA_UInt8 nbEffects; /**< Number of effects in the above list */ 584 M4OSA_Int8 pActiveEffectNumber; /**< Effect ID to be applied, if -1, 585 no effect has to be applied currently*/ 586 587 #ifdef M4MCS_SUPPORT_STILL_PICTURE 588 M4OSA_Bool m_bIsStillPicture; /**< =TRUE if input file is a still picture 589 (JPEG, PNG, BMP, GIF)*/ 590 M4MCS_Context m_pStillPictureContext; /**< Context of the still picture part of MCS*/ 591 #endif /*M4MCS_SUPPORT_STILL_PICTURE*/ 592 NSWAVC_MCS_t *m_pInstance; 593 M4OSA_UInt8 *H264MCSTempBuffer; 594 M4OSA_UInt32 H264MCSTempBufferSize; 595 M4OSA_UInt32 H264MCSTempBufferDataSize; 596 M4OSA_Bool bH264Trim; 597 /* Flag when to get lastdecodedframeCTS */ 598 M4OSA_Bool bLastDecodedFrameCTS; 599 M4OSA_Int32 encodingVideoProfile; 600 M4OSA_Int32 encodingVideoLevel; 601 602 } M4MCS_InternalContext; 603 604 605 #endif /* __M4MCS_INTERNALTYPES_H__ */ 606 607