M4VSS3GPP_InternalTypes.h revision 694816d7291f17364502ac5d3319684a0b180860
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 ****************************************************************************** 20 * @file M4VSS3GPP_InternalTypes.h 21 * @brief This file contains all enum and types not visible to the external world. 22 * @note 23 ****************************************************************************** 24*/ 25 26 27#ifndef __M4VSS3GPP_INTERNALTYPES_H__ 28#define __M4VSS3GPP_INTERNALTYPES_H__ 29 30#define M4VSS_VERSION_MAJOR 3 31#define M4VSS_VERSION_MINOR 2 32#define M4VSS_VERSION_REVISION 5 33 34#include "NXPSW_CompilerSwitches.h" 35 36/** 37 * VSS public API and types */ 38#include "M4VSS3GPP_API.h" 39 40/** 41 * Internally used modules */ 42#include "M4READER_Common.h" /**< Reader common interface */ 43#include "M4WRITER_common.h" /**< Writer common interface */ 44#include "M4DECODER_Common.h" /**< Decoder common interface */ 45#include "M4ENCODER_common.h" /**< Encoder common interface */ 46#include "M4VIFI_FiltersAPI.h" /**< Image planes definition */ 47#include "M4READER_3gpCom.h" /**< Read 3GPP file */ 48#include "M4AD_Common.h" /**< Decoder audio */ 49#include "M4ENCODER_AudioCommon.h" /**< Encode audio */ 50 51 52#include "SSRC.h" /**< SSRC */ 53#include "From2iToMono_16.h" /**< Stereo to Mono */ 54#include "MonoTo2I_16.h" /**< Mono to Stereo */ 55 56#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS 57#include "M4VD_HW_API.h" 58#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ 59 60#ifdef __cplusplus 61extern "C" { 62#endif 63 64#define WINDOW_SIZE 10 65/** 66 ****************************************************************************** 67 * enum M4VSS3GPP_EditState 68 * @brief Main state machine of the VSS 3GPP edit operation. 69 ****************************************************************************** 70*/ 71 72typedef enum 73{ 74 M4VSS3GPP_kEditState_CREATED = 0, /**< M4VSS3GPP_editInit has been called */ 75 M4VSS3GPP_kEditState_VIDEO = 1, /**< Processing video track */ 76 M4VSS3GPP_kEditState_AUDIO = 2, /**< Processing audio track */ 77 M4VSS3GPP_kEditState_MP3 = 3, /**< Processing MP3 audio track */ 78 M4VSS3GPP_kEditState_MP3_JUMP = 4, /**< Processing a jump in a MP3 audio track */ 79 M4VSS3GPP_kEditState_FINISHED = 5, /**< Processing done, VSS 3GPP can be closed */ 80 M4VSS3GPP_kEditState_CLOSED = 6 /**< Output file has been closed, 81 VSS 3GPP can be destroyed */ 82} 83M4VSS3GPP_EditState; 84 85typedef enum 86{ 87 /**< Doing Read/Write operation. This operation will have no processing 88 * on input frames. Only time stamp manipulations in output file. */ 89 M4VSS3GPP_kEditVideoState_READ_WRITE = 10, 90 /**< Decode encode to create an I frame. This is done for a single frame 91 * to create a new reference frame. */ 92 M4VSS3GPP_kEditVideoState_BEGIN_CUT = 11, 93 /**< Doing Read->Decode->Filter->Encode->Write operation on the input file 94 * to create the output file. */ 95 M4VSS3GPP_kEditVideoState_DECODE_ENCODE = 12, 96 /**< Applied when Transition is active and blending of two videos is 97 * required. */ 98 M4VSS3GPP_kEditVideoState_TRANSITION = 13, 99 /**< Special Read/Write mode used after BEGIN_CUT state. The frame 100 * is already coded as I frame in BEGIN_CUT state; so skip it. */ 101 M4VSS3GPP_kEditVideoState_AFTER_CUT = 14 102} 103M4VSS3GPP_EditVideoState; 104 105typedef enum 106{ 107 M4VSS3GPP_kEditAudioState_READ_WRITE = 20, /**< Doing Read/Write operation 108 (no decoding/encoding) */ 109 M4VSS3GPP_kEditAudioState_DECODE_ENCODE = 21, /**< Doing Read-Decode/Filter/ 110 Encode-Write operation */ 111 M4VSS3GPP_kEditAudioState_TRANSITION = 22 /**< Transition; blending of two audio */ 112} 113M4VSS3GPP_EditAudioState; 114 115 116/** 117 ****************************************************************************** 118 * enum M4VSS3GPP_ClipStatus 119 * @brief Status of the clip. 120 ****************************************************************************** 121*/ 122typedef enum 123{ 124 M4VSS3GPP_kClipStatus_READ = 0, /**< The clip is currently ready for reading */ 125 M4VSS3GPP_kClipStatus_DECODE = 1, /**< The clip is currently ready for decoding */ 126 M4VSS3GPP_kClipStatus_DECODE_UP_TO = 2 /**< The clip is currently in splitted 127 decodeUpTo() processing */ 128} 129M4VSS3GPP_ClipStatus; 130 131 132/** 133 ****************************************************************************** 134 * enum M4VSS3GPP_ClipCurrentEffect 135 * @brief Current effect applied to the clip. 136 ****************************************************************************** 137*/ 138typedef enum 139{ 140 M4VSS3GPP_kClipCurrentEffect_NONE = 0, /**< None */ 141 M4VSS3GPP_kClipCurrentEffect_BEGIN = 1, /**< Begin effect currently applied */ 142 M4VSS3GPP_kClipCurrentEffect_END = 2 /**< End effect currently applied */ 143} 144M4VSS3GPP_ClipCurrentEffect; 145 146 147/** 148 ****************************************************************************** 149 * enum M4VSS3GPP_AudioMixingState 150 * @brief Main state machine of the VSS audio mixing operation. 151 ****************************************************************************** 152*/ 153typedef enum 154{ 155 M4VSS3GPP_kAudioMixingState_VIDEO = 0, /**< Video is being processed */ 156 M4VSS3GPP_kAudioMixingState_AUDIO_FIRST_SEGMENT, /**< Audio is being processed */ 157 M4VSS3GPP_kAudioMixingState_AUDIO_SECOND_SEGMENT, /**< Audio is being processed */ 158 M4VSS3GPP_kAudioMixingState_AUDIO_THIRD_SEGMENT, /**< Audio is being processed */ 159 M4VSS3GPP_kAudioMixingState_FINISHED /**< Processing finished, user must now 160 call M4VSS3GPP_audioMixingCleanUp*/ 161} 162M4VSS3GPP_AudioMixingState; 163 164 165/** 166 ****************************************************************************** 167 * enum M4VSS3GPP_ExtractPictureState 168 * @brief Main state machine of the VSS picture extraction. 169 ****************************************************************************** 170*/ 171typedef enum 172{ 173 M4VSS3GPP_kExtractPictureState_OPENED = 0, /**< Video clip is opened and ready to be read 174 until the RAP before the picture to extract */ 175 M4VSS3GPP_kExtractPictureState_PROCESS = 1, /**< Video is decoded from the previous RAP 176 to the picture to extract */ 177 M4VSS3GPP_kExtractPictureState_EXTRACTED= 2 /**< Video AU has been decoded, user must now 178 call M4VSS3GPP_extractPictureCleanUp */ 179} 180M4VSS3GPP_ExtractPictureState; 181 182 183/** 184 ****************************************************************************** 185 * @brief Codecs registration same as in VPS and VES, so less mapping 186 * is required toward VSS api types 187 ****************************************************************************** 188*/ 189typedef struct 190{ 191 M4WRITER_GlobalInterface* pGlobalFcts; /**< open, close, setoption,etc... functions */ 192 M4WRITER_DataInterface* pDataFcts; /**< data manipulation functions */ 193} M4VSS3GPP_WriterInterface; 194/** 195 ****************************************************************************** 196 * struct AAC_DEC_STREAM_PROPS 197 * @brief AAC Stream properties 198 * @Note aNoChan and aSampFreq are used for parsing even the user parameters 199 * are different. User parameters will be input for the output behaviour 200 * of the decoder whereas for parsing bitstream properties are used. 201 ****************************************************************************** 202 */ 203typedef struct { 204 M4OSA_Int32 aAudioObjectType; /**< Audio object type of the stream - in fact 205 the type found in the Access Unit parsed */ 206 M4OSA_Int32 aNumChan; /**< number of channels (=1(mono) or =2(stereo)) 207 as indicated by input bitstream*/ 208 M4OSA_Int32 aSampFreq; /**< sampling frequency in Hz */ 209 M4OSA_Int32 aExtensionSampFreq; /**< extended sampling frequency in Hz, = 0 is 210 no extended frequency */ 211 M4OSA_Int32 aSBRPresent; /**< presence=1/absence=0 of SBR */ 212 M4OSA_Int32 aPSPresent; /**< presence=1/absence=0 of PS */ 213 M4OSA_Int32 aMaxPCMSamplesPerCh; /**< max number of PCM samples per channel */ 214} AAC_DEC_STREAM_PROPS; 215 216 217/** 218 ****************************************************************************** 219 * enum M4VSS3GPP_MediaAndCodecCtxt 220 * @brief Filesystem and codec registration function pointers 221 ****************************************************************************** 222*/ 223typedef struct { 224 /** 225 * Media and Codec registration */ 226 /**< Table of M4VES_WriterInterface structures for avalaible Writers list */ 227 M4VSS3GPP_WriterInterface WriterInterface[M4WRITER_kType_NB]; 228 /**< open, close, setoption,etc... functions of the used writer*/ 229 M4WRITER_GlobalInterface* pWriterGlobalFcts; 230 /**< data manipulation functions of the used writer */ 231 M4WRITER_DataInterface* pWriterDataFcts; 232 233 /**< Table of M4ENCODER_GlobalInterface structures for avalaible encoders list */ 234 M4ENCODER_GlobalInterface* pVideoEncoderInterface[M4ENCODER_kVideo_NB]; 235 /**< Functions of the used encoder */ 236 M4ENCODER_GlobalInterface* pVideoEncoderGlobalFcts; 237 238 M4OSA_Void* pVideoEncoderExternalAPITable[M4ENCODER_kVideo_NB]; 239 M4OSA_Void* pCurrentVideoEncoderExternalAPI; 240 M4OSA_Void* pVideoEncoderUserDataTable[M4ENCODER_kVideo_NB]; 241 M4OSA_Void* pCurrentVideoEncoderUserData; 242 243 /**< Table of M4ENCODER_AudioGlobalInterface structures for avalaible encoders list */ 244 M4ENCODER_AudioGlobalInterface* pAudioEncoderInterface[M4ENCODER_kAudio_NB]; 245 /**< Table of internal/external flags for avalaible encoders list */ 246 M4OSA_Bool pAudioEncoderFlag[M4ENCODER_kAudio_NB]; 247 /**< Functions of the used encoder */ 248 M4ENCODER_AudioGlobalInterface* pAudioEncoderGlobalFcts; 249 250 M4READER_GlobalInterface* m_pReaderGlobalItTable[M4READER_kMediaType_NB]; 251 M4READER_DataInterface* m_pReaderDataItTable[M4READER_kMediaType_NB]; 252 M4READER_GlobalInterface* m_pReader; 253 M4READER_DataInterface* m_pReaderDataIt; 254 M4OSA_UInt8 m_uiNbRegisteredReaders; 255 256 M4DECODER_VideoInterface* m_pVideoDecoder; 257 M4DECODER_VideoInterface* m_pVideoDecoderItTable[M4DECODER_kVideoType_NB]; 258 M4OSA_UInt8 m_uiNbRegisteredVideoDec; 259#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS 260 M4OSA_Void* m_pCurrentVideoDecoderUserData; 261 M4OSA_Void* m_pVideoDecoderUserDataTable[M4DECODER_kVideoType_NB]; 262#endif 263 264 M4AD_Interface* m_pAudioDecoder; 265 M4AD_Interface* m_pAudioDecoderItTable[M4AD_kType_NB]; 266 /**< store indices of external decoders */ 267 M4OSA_Bool m_pAudioDecoderFlagTable[M4AD_kType_NB]; 268 269 M4OSA_Void* pAudioEncoderUserDataTable[M4ENCODER_kAudio_NB]; 270 M4OSA_Void* pCurrentAudioEncoderUserData; 271 272 M4OSA_Void* pAudioDecoderUserDataTable[M4AD_kType_NB]; 273 M4OSA_Void* pCurrentAudioDecoderUserData; 274 275#ifdef M4VSS_SUPPORT_OMX_CODECS 276 /* boolean to tell whether registered external OMX codecs should be freed during cleanup 277 or new codec registration*/ 278 M4OSA_Bool bAllowFreeingOMXCodecInterface; 279#endif 280 281 282} M4VSS3GPP_MediaAndCodecCtxt; 283 284 285/** 286 ****************************************************************************** 287 * structure M4VSS3GPP_ClipContext 288 * @brief This structure contains informations related to one 3GPP clip (private) 289 * @note This structure is used to store the context related to one clip 290 ****************************************************************************** 291*/ 292typedef struct 293{ 294 M4VSS3GPP_ClipSettings* pSettings; /**< Pointer to the clip settings 295 (not possessed) */ 296 297 M4VSS3GPP_ClipStatus Vstatus; /**< Video status of the clip reading */ 298 M4VSS3GPP_ClipStatus Astatus; /**< Audio status of the clip reading */ 299 300 M4OSA_Int32 iVoffset; /**< [Milliseconds] Offset between the 301 clip and the output video stream 302 (begin cut taken into account) */ 303 M4OSA_Int32 iAoffset; /**< [Timescale] Offset between the clip 304 and the output audio stream (begin 305 cut taken into account) */ 306 307 /** 308 * 3GPP reader Stuff */ 309 M4OSA_FileReadPointer* pFileReadPtrFct; 310 M4OSA_Context pReaderContext; /**< Context of the 3GPP reader module */ 311 M4_VideoStreamHandler* pVideoStream; /**< Description of the read video stream */ 312 M4_AudioStreamHandler* pAudioStream; /**< Description of the read audio stream */ 313 M4_AccessUnit VideoAU; /**< Read video access unit (we do not use a 314 pointer to allocate later, because 315 most of the time we will need it) */ 316 M4_AccessUnit AudioAU; /**< Read audio access unit (we do not use a 317 pointer to allocate later, because most 318 of the time we will need it) */ 319 M4OSA_Bool bVideoAuAvailable; /**< Tell if a video AU is available 320 (previously read) */ 321 /**< Boolean only used to fix the BZZ bug... */ 322 M4OSA_Bool bFirstAuWritten; 323 324 /** 325 * Video decoder stuff */ 326 M4OSA_Context pViDecCtxt; /**< Video decoder context */ 327 M4OSA_Int32 iVideoDecCts; /**< [Milliseconds] For video decodeUpTo(), 328 the actual reached cts */ 329 M4OSA_Int32 iVideoRenderCts; /**< [Milliseconds] For video render(), 330 the actual reached cts */ 331 M4OSA_Bool isRenderDup; /**< To handle duplicate frame rendering in 332 case of external decoding */ 333 M4VIFI_ImagePlane* lastDecodedPlane; /**< Last decoded plane */ 334 335 /** 336 * MPEG4 time info stuff at clip level */ 337 M4OSA_Bool bMpeg4GovState; /**< Namely, update or initialization */ 338 M4OSA_UInt32 uiMpeg4PrevGovValueGet; /**< Previous Gov value read (in second) */ 339 M4OSA_UInt32 uiMpeg4PrevGovValueSet; /**< Previous Gov value write (in second) */ 340 341 /** 342 * Time-line stuff */ 343 /**< [Milliseconds] CTS at which the video clip actually starts */ 344 M4OSA_Int32 iActualVideoBeginCut; 345 /**< [Milliseconds] CTS at which the audio clip actually starts */ 346 M4OSA_Int32 iActualAudioBeginCut; 347 /**< [Milliseconds] Time at which the clip must end */ 348 M4OSA_Int32 iEndTime; 349 350 /** 351 * Audio decoder stuff */ 352 M4OSA_Context pAudioDecCtxt; /**< Context of the AMR decoder */ 353 M4AD_Buffer AudioDecBufferIn; /**< Input structure for the audio decoder */ 354 M4AD_Buffer AudioDecBufferOut; /**< Buffer for the decoded PCM data */ 355 AAC_DEC_STREAM_PROPS AacProperties; /**< Structure for new api to get AAC 356 properties */ 357 358 /** 359 * Audio AU to Frame split stuff */ 360 M4OSA_Bool bAudioFrameAvailable; /**< True if an audio frame is available */ 361 M4OSA_MemAddr8 pAudioFramePtr; /**< Pointer to the Audio frame */ 362 M4OSA_UInt32 uiAudioFrameSize; /**< Size of the audio frame available */ 363 M4OSA_Int32 iAudioFrameCts; /**< [Timescale] CTS of the audio frame 364 available */ 365 366 /** 367 * Silence frame stuff */ 368 /**< Size to reserve to store a pcm full of zeros compatible with master clip stream type */ 369 M4OSA_UInt32 uiSilencePcmSize; 370 /**< Pointer to silence frame data compatible with master clip stream type */ 371 M4OSA_UInt8* pSilenceFrameData; 372 /**< Size of silence frame data compatible with master clip stream type */ 373 M4OSA_UInt32 uiSilenceFrameSize; 374 /**< [Timescale] Duration of silence frame data compatible with master clip stream type */ 375 M4OSA_Int32 iSilenceFrameDuration; 376 M4OSA_Double scale_audio; /**< frequency / 1000.0 */ 377 378 /** 379 * Interfaces of the used modules */ 380 /**< Filesystem and shell reader, decoder functions */ 381 M4VSS3GPP_MediaAndCodecCtxt ShellAPI; 382} M4VSS3GPP_ClipContext; 383 384 385/** 386 ****************************************************************************** 387 * enum anonymous enum 388 * @brief enum to keep track of the encoder state 389 ****************************************************************************** 390*/ 391enum 392{ 393 M4VSS3GPP_kNoEncoder, 394 M4VSS3GPP_kEncoderClosed, 395 M4VSS3GPP_kEncoderStopped, 396 M4VSS3GPP_kEncoderRunning 397}; 398 399/** 400 ****************************************************************************** 401 * structure M4VSS3GPP_AudioVideoContext 402 * @brief This structure defines the audio video context (private) 403 * @note This structure is used for all audio/video, encoding/writing operations. 404 ****************************************************************************** 405*/ 406typedef struct 407{ 408 /** 409 * Timing Stuff */ 410 // Decorrelate input and output encoding timestamp to handle encoder prefetch 411 /**< [Milliseconds] Duration of the output file, used for progress computation */ 412 M4OSA_Double dInputVidCts; 413 /**< [Milliseconds] Current CTS of the video output stream */ 414 M4OSA_Double dOutputVidCts; 415/**< [Milliseconds] Current CTS of the audio output stream */ 416 M4OSA_Double dATo; 417 /**< [Milliseconds] Duration of the output file, used for progress computation */ 418 M4OSA_Int32 iOutputDuration; 419 420 /** 421 * Output Video Stream Stuff */ 422 M4SYS_StreamType VideoStreamType; /**< Output video codec */ 423 M4OSA_UInt32 uiVideoBitrate; /**< Average video bitrate of the output file, 424 computed from input bitrates, durations, 425 transitions and cuts */ 426 M4OSA_UInt32 uiVideoWidth; /**< Output image width */ 427 M4OSA_UInt32 uiVideoHeight; /**< Output image height */ 428 M4OSA_UInt32 uiVideoTimeScale; /**< Time scale to use for the encoding 429 of the transition (if MPEG-4) */ 430 M4OSA_Bool bVideoDataPartitioning; /**< Data partitioning to use for the 431 encoding of the transition 432 (if MPEG-4) */ 433 M4OSA_MemAddr8 pVideoOutputDsi; /**< Decoder Specific Info of the output 434 MPEG-4 track */ 435 M4OSA_UInt16 uiVideoOutputDsiSize; /**< Size of the Decoder Specific Info 436 of the output MPEG-4 track */ 437 M4OSA_Bool bActivateEmp; /**< Encode in Mpeg4 format with 438 limitations for EMP */ 439 440 /** 441 * Output Audio Stream Stuff */ 442 M4SYS_StreamType AudioStreamType; /**< Type of the output audio stream */ 443 M4OSA_UInt32 uiNbChannels; /**< Number of channels in the output 444 stream (1=mono, 2=stereo) */ 445 M4OSA_UInt32 uiAudioBitrate; /**< Audio average bitrate (in bps) */ 446 M4OSA_UInt32 uiSamplingFrequency; /**< Sampling audio frequency (8000 for 447 amr, 16000 or more for aac) */ 448 M4OSA_MemAddr8 pAudioOutputDsi; /**< Decoder Specific Info of the 449 output audio track */ 450 M4OSA_UInt16 uiAudioOutputDsiSize; /**< Size of the Decoder Specific Info 451 of the output audio track */ 452 453 /** 454 * Audio Encoder stuff */ 455 M4OSA_Context pAudioEncCtxt; /**< Context of the audio encoder */ 456 M4ENCODER_AudioDecSpecificInfo pAudioEncDSI; /**< Decoder specific info built by the 457 encoder */ 458 M4ENCODER_AudioParams AudioEncParams; /**< Config of the audio encoder */ 459 460 /** 461 * Silence frame stuff */ 462 M4OSA_UInt32 uiSilencePcmSize; /**< Size to reserve to store a pcm full 463 of zeros compatible with master clip 464 stream type */ 465 M4OSA_UInt8* pSilenceFrameData; /**< Pointer to silence frame data 466 compatible with master clip 467 stream type */ 468 M4OSA_UInt32 uiSilenceFrameSize; /**< Size of silence frame data compatible 469 with master clip stream type */ 470 M4OSA_Int32 iSilenceFrameDuration; /**< [Timescale] Duration of silence frame 471 data compatible with master clip 472 stream type */ 473 M4OSA_Double scale_audio; /**< frequency / 1000.0 */ 474 475 /** 476 * Video Encoder stuff */ 477 M4ENCODER_Context pEncContext; /**< Context of the encoder */ 478 M4WRITER_DataInterface OurWriterDataInterface; /**< Our own implementation of the 479 writer interface, to give to 480 the encoder shell */ 481 M4OSA_MemAddr32 pDummyAuBuffer; /**< Buffer given to the encoder for 482 it to write AUs we don't want 483 in the output */ 484 M4OSA_Int32 iMpeg4GovOffset; /**< Clip GOV offset in ms between 485 video and system time */ 486 M4OSA_ERR VppError; /**< Error for VPP are masked by Video 487 Encoder, so we must remember it */ 488 M4OSA_UInt32 encoderState; 489 490 /** 491 * Writer stuff */ 492 M4WRITER_Context p3gpWriterContext; /**< Context of the 3GPP writer module */ 493 M4SYS_StreamDescription WriterVideoStream; /**< Description of the written 494 video stream */ 495 M4SYS_StreamDescription WriterAudioStream; /**< Description of the written 496 audio stream */ 497 M4WRITER_StreamVideoInfos WriterVideoStreamInfo; /**< Video properties of the written 498 video stream */ 499 M4WRITER_StreamAudioInfos WriterAudioStreamInfo; /**< Audio properties of the written 500 audio stream */ 501 M4SYS_AccessUnit WriterVideoAU; /**< Written video access unit */ 502 M4SYS_AccessUnit WriterAudioAU; /**< Written audio access unit */ 503 M4OSA_UInt32 uiVideoMaxAuSize; /**< Max AU size set to the writer 504 for the video */ 505 M4OSA_UInt32 uiAudioMaxAuSize; /**< Max AU size set to the writer 506 for the audio */ 507 M4OSA_UInt32 uiOutputAverageVideoBitrate; /**< Average video bitrate of the 508 output file, computed from 509 input bitrates, durations, 510 transitions and cuts */ 511 512} M4VSS3GPP_EncodeWriteContext; 513 514 515/** 516 ****************************************************************************** 517 * structure M4VSS3GPP_InternalEditContext 518 * @brief This structure defines the edit VSS context (private) 519 * @note This structure is used for all VSS edit operations to store the context 520 ****************************************************************************** 521*/ 522typedef struct 523{ 524 /** 525 * VSS 3GPP main variables */ 526 M4VSS3GPP_EditState State; /**< VSS internal state */ 527 M4VSS3GPP_EditVideoState Vstate; 528 M4VSS3GPP_EditAudioState Astate; 529 530 /** 531 * User Settings (copied, thus owned by VSS3GPP) */ 532 M4OSA_UInt8 uiClipNumber; /**< Number of element of the clip 533 list pClipList. */ 534 M4VSS3GPP_ClipSettings *pClipList; /**< List of the input clips settings 535 Array of uiClipNumber clip settings */ 536 M4VSS3GPP_TransitionSettings *pTransitionList; /**< List of the transition settings. 537 Array of uiClipNumber-1 transition settings */ 538 M4VSS3GPP_EffectSettings *pEffectsList; /**< List of the effects settings. 539 Array of nbEffects RC */ 540 M4OSA_UInt8 *pActiveEffectsList; /**< List of the active effects 541 settings. Array of nbEffects RC */ 542 M4OSA_UInt8 nbEffects; /**< Numbers of effects RC */ 543 M4OSA_UInt8 nbActiveEffects; /**< Numbers of active effects RC */ 544 545 /** 546 * Input Stuff */ 547 M4OSA_UInt8 uiCurrentClip; /**< Index of the current clip 1 in 548 the input clip list */ 549 M4VSS3GPP_ClipContext* pC1; /**< Context of the current clip 1 */ 550 M4VSS3GPP_ClipContext* pC2; /**< Context of the current clip 2 */ 551 552 /** 553 * Decoder stuff */ 554 M4OSA_Double dOutputFrameDuration; /**< [Milliseconds] directly related to 555 output frame rate */ 556 M4VIFI_ImagePlane yuv1[3]; /**< First temporary YUV420 image plane */ 557 M4VIFI_ImagePlane yuv2[3]; /**< Second temporary YUV420 image plane */ 558 M4VIFI_ImagePlane yuv3[3]; /**< Third temporary YUV420 image plane RC */ 559 M4VIFI_ImagePlane yuv4[3]; /**< Fourth temporary YUV420 image plane RC */ 560 561 /** 562 * Effect stuff */ 563 M4OSA_Bool bClip1AtBeginCut; /**< [Milliseconds] The clip1 is at 564 its begin cut */ 565 M4OSA_Int8 iClip1ActiveEffect; /**< The index of the active effect 566 on Clip1 (<0 means none) 567 (used for video and audio but 568 not simultaneously) */ 569 M4OSA_Int8 iClip2ActiveEffect; /**< The index of the active effect 570 on Clip2 (<0 means none) 571 (used for video and audio but 572 not simultaneously) */ 573 M4OSA_Bool bTransitionEffect; /**< True if the transition effect 574 must be applied at the current 575 time */ 576 577 /** 578 * Encoding and Writing operations */ 579 M4OSA_Bool bSupportSilence; /**< Flag to know if the output stream can 580 support silence (even if not editable, 581 for example AAC+, but not EVRC) */ 582 M4VSS3GPP_EncodeWriteContext ewc; /**< Audio and video encode/write stuff */ 583 M4OSA_Bool bIsMMS; /**< Boolean used to know if we are 584 processing a file with an output 585 size constraint */ 586 M4OSA_UInt32 uiMMSVideoBitrate; /**< If in MMS mode, 587 targeted video bitrate */ 588 M4VIDEOEDITING_VideoFramerate MMSvideoFramerate; /**< If in MMS mode, 589 targeted video framerate */ 590 591 /** 592 * Filesystem functions */ 593 M4OSA_FileReadPointer* pOsaFileReadPtr; /**< OSAL file read functions, 594 to be provided by user */ 595 M4OSA_FileWriterPointer* pOsaFileWritPtr; /**< OSAL file write functions, 596 to be provided by user */ 597 598 /** 599 * Interfaces of the used modules */ 600 M4VSS3GPP_MediaAndCodecCtxt ShellAPI; /**< Filesystem and shell reader, 601 decoder functions */ 602#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS 603 struct 604 { 605 M4VD_Interface* pDecoderInterface; 606 M4OSA_Void* pUserData; 607 M4OSA_Bool registered; 608 } registeredExternalDecs[M4VD_kVideoType_NB]; 609#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ 610 611#ifdef M4VSS_SUPPORT_OMX_CODECS 612 M4OSA_Context m_codecInterface[M4VSS3GPP_kCodecType_NB]; 613 M4OSA_Context pOMXUserData; 614#endif 615 M4OSA_Bool bIssecondClip; 616 M4OSA_UInt8 *pActiveEffectsList1; /**< List of the active effects settings. Array of nbEffects RC */ 617 M4OSA_UInt8 nbActiveEffects1; /**< Numbers of active effects RC */ 618 M4OSA_Bool m_bClipExternalHasStarted; /**< Flag to indicate that an 619 external effect is active */ 620 M4OSA_Int32 iInOutTimeOffset; 621 M4OSA_Bool bEncodeTillEoF; 622} M4VSS3GPP_InternalEditContext; 623 624 625/** 626 ****************************************************************************** 627 * structure M4VSS3GPP_InternalAudioMixingContext 628 * @brief This structure defines the audio mixing VSS 3GPP context (private) 629 * @note This structure is used for all VSS 3GPP audio mixing operations to store 630 * the context 631 ****************************************************************************** 632*/ 633typedef struct 634{ 635 /** 636 * VSS main variables */ 637 M4VSS3GPP_AudioMixingState State; /**< VSS audio mixing internal state */ 638 639 /** 640 * Internal copy of the input settings */ 641 M4OSA_Int32 iAddCts; /**< [Milliseconds] Time, in milliseconds, 642 at which the added audio track is 643 inserted */ 644 M4OSA_UInt32 uiBeginLoop; /**< Describes in milli-second the 645 start time of the loop */ 646 M4OSA_UInt32 uiEndLoop; /**< Describes in milli-second the end 647 time of the loop (0 means no loop) */ 648 M4OSA_Bool bRemoveOriginal; /**< If true, the original audio track 649 is not taken into account */ 650 651 /** 652 * Input audio/video file */ 653 M4VSS3GPP_ClipSettings InputClipSettings; /**< Structure internally used to 654 manage the input 3GPP settings */ 655 M4VSS3GPP_ClipContext* pInputClipCtxt; /**< Context of the input 3GPP clip */ 656 657 /** 658 * Added audio file stuff */ 659 M4VSS3GPP_ClipSettings AddedClipSettings; /**< Structure internally used to 660 manage the added settings */ 661 M4VSS3GPP_ClipContext* pAddedClipCtxt; /**< Context of the added 3GPP clip */ 662 663 /** 664 * Audio stuff */ 665 M4OSA_Float fOrigFactor; /**< Factor to apply to the original 666 audio track for the mixing */ 667 M4OSA_Float fAddedFactor; /**< Factor to apply to the added 668 audio track for the mixing */ 669 M4OSA_Bool bSupportSilence; /**< Flag to know if the output stream can 670 support silence (even if not editable, 671 for example AAC+, but not EVRC) */ 672 M4OSA_Bool bHasAudio; /**< Flag to know if we have to delete 673 audio track */ 674 M4OSA_Bool bAudioMixingIsNeeded; /**< Flag to know if we have to do mixing */ 675 676 /** 677 * Encoding and Writing operations */ 678 M4VSS3GPP_EncodeWriteContext ewc; /**< Audio and video encode/write stuff */ 679 680 /** 681 * Filesystem functions */ 682 M4OSA_FileReadPointer* pOsaFileReadPtr; /**< OSAL file read functions, 683 to be provided by user */ 684 M4OSA_FileWriterPointer* pOsaFileWritPtr; /**< OSAL file write functions, 685 to be provided by user */ 686 687 /** 688 * Interfaces of the used modules */ 689 M4VSS3GPP_MediaAndCodecCtxt ShellAPI; /**< Filesystem and shell reader, 690 decoder functions */ 691 692 /** 693 * Sample Rate Convertor (SSRC) stuff (needed in case of mixing with != ASF/nb of channels) */ 694 M4OSA_Bool b_SSRCneeded; /**< If true, SSRC is needed 695 (!= ASF or nb of channels) */ 696 M4OSA_UInt8 ChannelConversion; /**< 1=Conversion from Mono to Stereo 697 2=Stereo to Mono, 0=no conversion */ 698 SSRC_Instance_t SsrcInstance; /**< Context of the Ssrc */ 699 SSRC_Scratch_t* SsrcScratch; /**< Working memory of the Ssrc */ 700 short iSsrcNbSamplIn; /**< Number of sample the Ssrc needs as input */ 701 short iSsrcNbSamplOut; /**< Number of sample the Ssrc outputs */ 702 M4OSA_MemAddr8 pSsrcBufferIn; /**< Input of the SSRC */ 703 M4OSA_MemAddr8 pSsrcBufferOut; /**< Output of the SSRC */ 704 M4OSA_MemAddr8 pPosInSsrcBufferIn; /**< Position into the SSRC in buffer */ 705 M4OSA_MemAddr8 pPosInSsrcBufferOut;/**< Position into the SSRC out buffer */ 706 M4OSA_MemAddr8 pTempBuffer; /**< Temporary buffer */ 707 M4OSA_MemAddr8 pPosInTempBuffer; /**< Position in temporary buffer */ 708 M4OSA_UInt32 minimumBufferIn; /**< Minimum amount of decoded data to be 709 processed by SSRC and channel 710 convertor */ 711 M4OSA_Bool b_DuckingNeedeed; 712 M4OSA_Int32 InDucking_threshold; /**< Threshold value at which background 713 music shall duck */ 714 M4OSA_Float InDucking_lowVolume; /**< lower the background track to this 715 factor and increase the primary 716 track to inverse of this factor */ 717 M4OSA_Float lowVolume; 718 M4OSA_Int32 audioVolumeArray[WINDOW_SIZE]; // store peak audio vol. level 719 // for duration for WINDOW_SIZE 720 M4OSA_Int32 audVolArrIndex; 721 M4OSA_Float duckingFactor ; /**< multiply by this factor to bring 722 FADE IN/FADE OUT effect */ 723 M4OSA_Float fBTVolLevel; 724 M4OSA_Float fPTVolLevel; 725 M4OSA_Bool bDoDucking; 726 M4OSA_Bool bLoop; 727 M4OSA_Bool bNoLooping; 728 M4OSA_Context pLVAudioResampler; 729 M4OSA_Bool bjumpflag; 730 731} M4VSS3GPP_InternalAudioMixingContext; 732 733 734/** 735 ****************************************************************************** 736 * structure M4VSS3GPP_InternalExtractPictureContext 737 * @brief This structure defines the extract picture VSS context (private) 738 * @note This structure is used for all VSS picture extractions to store the context 739 ****************************************************************************** 740*/ 741typedef struct 742{ 743 /** 744 * VSS main variables */ 745 M4VSS3GPP_ExtractPictureState State; /**< VSS extract pictureinternal state */ 746 747 /** 748 * Input files */ 749 M4VSS3GPP_ClipSettings ClipSettings; /**< Structure internally used to 750 manage the input 3FPP settings */ 751 M4VSS3GPP_ClipContext* pInputClipCtxt; /**< Context of the input 3GPP clip */ 752 753 /** 754 * Settings */ 755 M4OSA_Int32 iExtractCts; /**< [Milliseconds] Cts of the AU 756 to be extracted */ 757 758 /** 759 * Video stuff */ 760 M4VIFI_ImagePlane decPlanes[3]; /**< Decoded YUV420 picture plane */ 761 M4OSA_UInt32 uiVideoWidth; /**< Decoded image width */ 762 M4OSA_UInt32 uiVideoHeight; /**< Decoded image height */ 763 764 /* 765 * Decoder info */ 766 M4OSA_Int32 iDecCts; /**< [Milliseconds] Decoded AU Cts */ 767 M4OSA_Bool bJumpFlag; /**< 1 if a jump has been made */ 768 M4OSA_Int32 iDeltaTime; /**< [Milliseconds] Time between previous RAP and 769 picture to extract */ 770 M4OSA_Int32 iGap; /**< [Milliseconds] Time between jump AU and 771 extraction time */ 772 M4OSA_UInt32 uiStep; /**< [Milliseconds] Progress bar time increment */ 773 774 /** 775 * Filesystem functions */ 776 /**< OSAL file read functions, to be provided by user */ 777 M4OSA_FileReadPointer* pOsaFileReadPtr; 778 /**< OSAL file write functions, to be provided by user */ 779 M4OSA_FileWriterPointer* pOsaFileWritPtr; 780 781 M4OSA_Bool bClipOpened; 782} M4VSS3GPP_InternalExtractPictureContext; 783 784 785#ifdef __cplusplus 786} 787#endif 788 789#endif /* __M4VSS3GPP_INTERNALTYPES_H__ */ 790 791