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