M4VSS3GPP_InternalFunctions.h revision 0a389ab70db304fb840e33f33781ecc0503eae3c
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_InternalFunctions.h
21 * @brief    This file contains all function prototypes not visible to the external world.
22 * @note
23 ******************************************************************************
24*/
25
26
27#ifndef __M4VSS3GPP_INTERNALFUNCTIONS_H__
28#define __M4VSS3GPP_INTERNALFUNCTIONS_H__
29
30#include "NXPSW_CompilerSwitches.h"
31/**
32 *    VSS public API and types */
33#include "M4VSS3GPP_API.h"
34
35/**
36 *    VSS private types */
37#include "M4VSS3GPP_InternalTypes.h"
38
39
40#include "M4READER_Common.h" /**< for M4_AccessUnit definition */
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/* All errors are fatal in the VSS */
47#define M4ERR_CHECK_RETURN(err) if(M4NO_ERROR!=err) return err;
48
49/**
50 ******************************************************************************
51 * M4OSA_ERR M4VSS3GPP_intEditStepVideo()
52 * @brief    One step of video processing
53 * @param   pC    (IN/OUT) Internal edit context
54  ******************************************************************************
55*/
56M4OSA_ERR M4VSS3GPP_intEditStepVideo(M4VSS3GPP_InternalEditContext *pC);
57
58/**
59 ******************************************************************************
60 * M4OSA_ERR M4VSS3GPP_intEditStepAudio()
61 * @brief    One step of audio processing
62 * @param   pC    (IN/OUT) Internal edit context
63  ******************************************************************************
64*/
65M4OSA_ERR M4VSS3GPP_intEditStepAudio(M4VSS3GPP_InternalEditContext *pC);
66
67/**
68 ******************************************************************************
69 * M4OSA_ERR M4VSS3GPP_intEditStepMP3()
70 * @brief    One step of audio processing for the MP3 clip
71 * @param   pC    (IN/OUT) Internal edit context
72  ******************************************************************************
73*/
74M4OSA_ERR M4VSS3GPP_intEditStepMP3(M4VSS3GPP_InternalEditContext *pC);
75
76/**
77 ******************************************************************************
78 * M4OSA_ERR M4VSS3GPP_intOpenClip()
79 * @brief    Open next clip
80 * @param   pC            (IN/OUT) Internal edit context
81 ******************************************************************************
82*/
83M4OSA_ERR M4VSS3GPP_intOpenClip(M4VSS3GPP_InternalEditContext *pC, M4VSS3GPP_ClipContext **hClip,
84                                 M4VSS3GPP_ClipSettings *pClipSettings);
85
86/**
87 ******************************************************************************
88 * M4OSA_ERR M4VSS3GPP_intDestroyVideoEncoder()
89 * @brief    Destroy the video encoder
90 * @note
91  ******************************************************************************
92*/
93M4OSA_ERR M4VSS3GPP_intDestroyVideoEncoder(M4VSS3GPP_InternalEditContext *pC);
94
95/**
96 ******************************************************************************
97 * M4OSA_ERR M4VSS3GPP_intCreateVideoEncoder()
98 * @brief    Creates the video encoder
99 * @note
100  ******************************************************************************
101*/
102M4OSA_ERR  M4VSS3GPP_intCreateVideoEncoder(M4VSS3GPP_InternalEditContext *pC);
103
104/**
105 ******************************************************************************
106 * M4OSA_ERR M4VSS3GPP_intReachedEndOfVideo()
107 * @brief    Do what to do when the end of a clip video track is reached
108 * @note    If there is audio on the current clip, process it, else switch to the next clip
109 * @param   pC            (IN/OUT) Internal edit context
110 ******************************************************************************
111*/
112M4OSA_ERR M4VSS3GPP_intReachedEndOfVideo(M4VSS3GPP_InternalEditContext *pC);
113
114/**
115 ******************************************************************************
116 * M4OSA_ERR M4VSS3GPP_intReachedEndOfAudio()
117 * @brief    Do what to do when the end of a clip audio track is reached
118 * @param   pC            (IN/OUT) Internal edit context
119 ******************************************************************************
120*/
121M4OSA_ERR M4VSS3GPP_intReachedEndOfAudio(M4VSS3GPP_InternalEditContext *pC);
122
123/**
124 ******************************************************************************
125 * M4OSA_ERR M4VSS3GPP_intCheckClipCompatibleWithVssEditing()
126 * @brief    Check if the clip is compatible with VSS editing
127 * @note
128 * @param   pClipCtxt            (IN) internal clip context
129 * @param    pClipProperties     (OUT) Pointer to a valid ClipProperties structure.
130 * @return    M4NO_ERROR:            No error
131 ******************************************************************************
132*/
133M4OSA_ERR M4VSS3GPP_intCheckClipCompatibleWithVssEditing(M4VIDEOEDITING_ClipProperties \
134                                                            *pClipProperties);
135
136/**
137 ******************************************************************************
138 * M4OSA_ERR M4VSS3GPP_intClipOpen()
139 * @brief    Open a clip. Creates a clip context.
140 * @note
141 * @param   hClipCtxt            (OUT) Return the internal clip context
142 * @param   pClipSettings        (IN) Edit settings of this clip. The module will keep a
143 *                                        reference to this pointer
144 * @param    pFileReadPtrFct        (IN) Pointer to OSAL file reader functions
145 * @param    bSkipAudioTrack        (IN) If true, do not open the audio
146 * @param    bFastOpenMode        (IN) If true, use the fast mode of the 3gpp reader
147 *                                            (only the first AU is read)
148 * @return    M4NO_ERROR:                No error
149 * @return    M4ERR_ALLOC:            There is no more available memory
150 ******************************************************************************
151*/
152M4OSA_ERR M4VSS3GPP_intClipInit (
153    M4VSS3GPP_ClipContext **hClipCtxt,
154    M4OSA_FileReadPointer *pFileReadPtrFct
155);
156
157M4OSA_ERR M4VSS3GPP_intClipOpen (
158    M4VSS3GPP_ClipContext *pClipCtxt,
159    M4VSS3GPP_ClipSettings *pClipSettings,
160    M4OSA_Bool bSkipAudioTrack,
161    M4OSA_Bool bFastOpenMode,
162    M4OSA_Bool bAvoidOpeningVideoDec
163);
164
165
166/**
167 ******************************************************************************
168 * M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack()
169 * @brief    Delete the audio track. Clip will be like if it had no audio track
170 * @note
171 * @param   pClipCtxt            (IN) Internal clip context
172 ******************************************************************************
173*/
174M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack(M4VSS3GPP_ClipContext *pClipCtxt);
175
176/**
177 ******************************************************************************
178 * M4OSA_ERR M4VSS3GPP_intClipDecodeVideoUpToCurrentTime()
179 * @brief    Jump to the previous RAP and decode up to the current video time
180 * @param   pClipCtxt    (IN) Internal clip context
181 * @param   iCts        (IN) Target CTS
182 ******************************************************************************
183*/
184M4OSA_ERR M4VSS3GPP_intClipDecodeVideoUpToCts(M4VSS3GPP_ClipContext* pClipCtxt, M4OSA_Int32 iCts);
185
186/**
187 ******************************************************************************
188 * M4OSA_ERR M4VSS3GPP_intClipReadNextAudioFrame()
189 * @brief    Read one AU frame in the clip
190 * @note
191 * @param   pClipCtxt            (IN) Internal clip context
192 * @return    M4NO_ERROR:            No error
193 ******************************************************************************
194*/
195M4OSA_ERR M4VSS3GPP_intClipReadNextAudioFrame(M4VSS3GPP_ClipContext *pClipCtxt);
196
197/**
198 ******************************************************************************
199 * M4OSA_ERR M4VSS3GPP_intClipDecodeCurrentAudioFrame()
200 * @brief    Decode the current AUDIO frame.
201 * @note
202 * @param   pClipCtxt        (IN) internal clip context
203 * @return    M4NO_ERROR:            No error
204 ******************************************************************************
205*/
206M4OSA_ERR M4VSS3GPP_intClipDecodeCurrentAudioFrame(M4VSS3GPP_ClipContext *pClipCtxt);
207
208/**
209 ******************************************************************************
210 * M4OSA_ERR M4VSS3GPP_intClipJumpAudioAt()
211 * @brief    Jump in the audio track of the clip.
212 * @note
213 * @param   pClipCtxt            (IN) internal clip context
214 * @param   pJumpCts            (IN/OUT) in:target CTS, out: reached CTS
215 * @return    M4NO_ERROR:            No error
216 ******************************************************************************
217*/
218M4OSA_ERR M4VSS3GPP_intClipJumpAudioAt(M4VSS3GPP_ClipContext *pClipCtxt, M4OSA_Int32 *pJumpCts);
219
220/**
221 ******************************************************************************
222 * M4OSA_ERR M4VSS3GPP_intClipClose()
223 * @brief    Close a clip. Destroy the context.
224 * @note
225 * @param   pClipCtxt            (IN) Internal clip context
226 * @return    M4NO_ERROR:            No error
227 ******************************************************************************
228*/
229M4OSA_ERR M4VSS3GPP_intClipClose(M4VSS3GPP_ClipContext *pClipCtxt);
230
231M4OSA_ERR M4VSS3GPP_intClipCleanUp(M4VSS3GPP_ClipContext *pClipCtxt);
232
233/**
234 ******************************************************************************
235 * M4OSA_ERR M4VSS3GPP_intEditJumpMP3()
236 * @brief    One step of jumping processing for the MP3 clip.
237 * @note    On one step, the jump of several AU is done
238 * @param   pC    (IN/OUT) Internal edit context
239  ******************************************************************************
240*/
241M4OSA_ERR M4VSS3GPP_intEditJumpMP3(M4VSS3GPP_InternalEditContext *pC);
242
243/**
244 ******************************************************************************
245 * M4OSA_ERR   M4VSS3GPP_registerWriter()
246 * @brief    This function will register a specific file format writer.
247 * @note    According to the Mediatype, this function will store in the internal context
248 *             the writer context.
249 * @param    pContext:    (IN) Execution context.
250 * @return    M4NO_ERROR: there is no error
251 * @return    M4ERR_PARAMETER    pContext,pWtrGlobalInterface or pWtrDataInterface is
252 *                                 M4OSA_NULL (debug only), or invalid MediaType
253 ******************************************************************************
254*/
255M4OSA_ERR   M4VSS3GPP_registerWriter(M4VSS3GPP_MediaAndCodecCtxt *pC,
256                                     M4WRITER_OutputFileType MediaType,
257                                     M4WRITER_GlobalInterface* pWtrGlobalInterface,
258                                     M4WRITER_DataInterface* pWtrDataInterface);
259
260/**
261 ******************************************************************************
262 * M4OSA_ERR   M4VSS3GPP_registerEncoder()
263 * @brief    This function will register a specific video encoder.
264 * @note    According to the Mediatype, this function will store in the internal context
265 *            the encoder context.
266 * @param    pContext:    (IN) Execution context.
267 * @return    M4NO_ERROR: there is no error
268 * @return    M4ERR_PARAMETER    pContext or pEncGlobalInterface is M4OSA_NULL (debug only),
269 *                                 or invalid MediaType
270 ******************************************************************************
271*/
272M4OSA_ERR   M4VSS3GPP_registerVideoEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
273                                           M4ENCODER_Format MediaType,
274                                           M4ENCODER_GlobalInterface *pEncGlobalInterface);
275
276/**
277 ******************************************************************************
278 * M4OSA_ERR   M4VSS3GPP_registerAudioEncoder()
279 * @brief    This function will register a specific audio encoder.
280 * @note    According to the Mediatype, this function will store in the internal context
281 *             the encoder context.
282 * @param    pContext:                (IN) Execution context.
283 * @param    mediaType:                (IN) The media type.
284 * @param    pEncGlobalInterface:    (OUT) the encoder interface functions.
285 * @return    M4NO_ERROR: there is no error
286 * @return    M4ERR_PARAMETER: pContext or pEncGlobalInterface is M4OSA_NULL (debug only)
287 ******************************************************************************
288*/
289M4OSA_ERR   M4VSS3GPP_registerAudioEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
290                                             M4ENCODER_AudioFormat MediaType,
291                                             M4ENCODER_AudioGlobalInterface *pEncGlobalInterface);
292
293/**
294 ************************************************************************
295 * M4OSA_ERR   M4VSS3GPP_registerReader()
296 * @brief    Register reader.
297 * @param    pContext            (IN/OUT) VSS context.
298 * @return    M4NO_ERROR:            No error
299 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
300 ************************************************************************
301*/
302M4OSA_ERR   M4VSS3GPP_registerReader(M4VSS3GPP_MediaAndCodecCtxt *pC,
303                                     M4READER_MediaType mediaType,
304                                     M4READER_GlobalInterface *pRdrGlobalInterface,
305                                     M4READER_DataInterface *pRdrDataInterface);
306
307/**
308 ************************************************************************
309 * M4OSA_ERR   M4VSS3GPP_registerVideoDecoder()
310 * @brief    Register video decoder
311 * @param    pContext                (IN/OUT) VSS context.
312 * @param    decoderType            (IN) Decoder type
313 * @param    pDecoderInterface    (IN) Decoder interface.
314 * @return    M4NO_ERROR:            No error
315 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only), or the decoder type
316 *                                    is invalid
317 ************************************************************************
318*/
319M4OSA_ERR   M4VSS3GPP_registerVideoDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
320                                            M4DECODER_VideoType decoderType,
321                                            M4DECODER_VideoInterface *pDecoderInterface);
322
323/**
324 ************************************************************************
325 * M4OSA_ERR   M4VSS3GPP_registerAudioDecoder()
326 * @brief    Register audio decoder
327 * @note    This function is used internaly by the VSS to register audio decoders,
328 * @param    context                (IN/OUT) VSS context.
329 * @param    decoderType            (IN) Audio decoder type
330 * @param    pDecoderInterface    (IN) Audio decoder interface.
331 * @return    M4NO_ERROR:            No error
332 * @return    M4ERR_PARAMETER:    A parameter is null, or the decoder type is invalid
333 *                                 (in DEBUG only)
334 ************************************************************************
335*/
336M4OSA_ERR   M4VSS3GPP_registerAudioDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
337                                           M4AD_Type decoderType,
338                                           M4AD_Interface *pDecoderInterface);
339
340/**
341 ************************************************************************
342 * M4OSA_ERR   M4VSS3GPP_unRegisterAllWriters()
343 * @brief    Unregister writer
344 * @param    pContext            (IN/OUT) VSS context.
345 * @return    M4NO_ERROR:            No error
346 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
347 ************************************************************************
348*/
349M4OSA_ERR   M4VSS3GPP_unRegisterAllWriters(M4VSS3GPP_MediaAndCodecCtxt *pC);
350
351/**
352 ************************************************************************
353 * M4OSA_ERR   M4VSS3GPP_unRegisterAllEncoders()
354 * @brief    Unregister the encoders
355 * @param    pContext            (IN/OUT) VSS context.
356 * @return    M4NO_ERROR:            No error
357 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
358 ************************************************************************
359*/
360M4OSA_ERR   M4VSS3GPP_unRegisterAllEncoders(M4VSS3GPP_MediaAndCodecCtxt *pC);
361
362/**
363 ************************************************************************
364 * M4OSA_ERR   M4VSS3GPP_unRegisterAllReaders()
365 * @brief    Unregister reader
366 * @param    pContext            (IN/OUT) VSS context.
367 * @return    M4NO_ERROR:            No error
368 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
369 ************************************************************************
370*/
371M4OSA_ERR   M4VSS3GPP_unRegisterAllReaders(M4VSS3GPP_MediaAndCodecCtxt *pC);
372
373/**
374 ************************************************************************
375 * M4OSA_ERR   M4VSS3GPP_unRegisterAllDecoders()
376 * @brief    Unregister the decoders
377 * @param    pContext            (IN/OUT) VSS context.
378 * @return    M4NO_ERROR:            No error
379 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
380 ************************************************************************
381*/
382M4OSA_ERR   M4VSS3GPP_unRegisterAllDecoders(M4VSS3GPP_MediaAndCodecCtxt *pC);
383
384/**
385 ************************************************************************
386 * M4OSA_ERR   M4VSS3GPP_setCurrentWriter()
387 * @brief    Set current writer
388 * @param    pContext            (IN/OUT) VSS context.
389 * @param    mediaType            (IN) Media type.
390 * @return    M4NO_ERROR:            No error
391 * @return    M4ERR_PARAMETER:                    A parameter is null (in DEBUG only)
392 * @return    M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED:    Media type not supported
393 ************************************************************************
394*/
395M4OSA_ERR   M4VSS3GPP_setCurrentWriter(M4VSS3GPP_MediaAndCodecCtxt *pC,
396                                        M4VIDEOEDITING_FileType mediaType);
397
398/**
399 ************************************************************************
400 * M4OSA_ERR   M4VSS3GPP_setCurrentVideoEncoder()
401 * @brief    Set a video encoder
402 * @param    pContext            (IN/OUT) VSS context.
403 * @param    MediaType           (IN) Encoder type
404 * @return    M4NO_ERROR:            No error
405 * @return    M4ERR_PARAMETER:                    A parameter is null (in DEBUG only)
406 * @return    M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED:    Media type not supported
407 ************************************************************************
408*/
409M4OSA_ERR   M4VSS3GPP_setCurrentVideoEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
410                                                M4SYS_StreamType mediaType);
411
412/**
413 ************************************************************************
414 * M4OSA_ERR   M4VSS3GPP_setCurrentAudioEncoder()
415 * @brief    Set an audio encoder
416 * @param    context            (IN/OUT) VSS context.
417 * @param    MediaType        (IN) Encoder type
418 * @return    M4NO_ERROR:            No error
419 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
420 ************************************************************************
421*/
422M4OSA_ERR   M4VSS3GPP_setCurrentAudioEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
423                                             M4SYS_StreamType mediaType);
424
425/**
426 ************************************************************************
427 * M4OSA_ERR   M4VSS3GPP_setCurrentReader()
428 * @brief    Set current reader
429 * @param    pContext            (IN/OUT) VSS context.
430 * @param    mediaType            (IN) Media type.
431 * @return    M4NO_ERROR:            No error
432 * @return    M4ERR_PARAMETER:                    A parameter is null (in DEBUG only)
433 * @return    M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED:    Media type not supported
434 ************************************************************************
435*/
436M4OSA_ERR   M4VSS3GPP_setCurrentReader(M4VSS3GPP_MediaAndCodecCtxt *pC,
437                                         M4VIDEOEDITING_FileType mediaType);
438
439/**
440 ************************************************************************
441 * M4OSA_ERR   M4VSS3GPP_setCurrentVideoDecoder()
442 * @brief    Set a video decoder
443 * @param    pContext            (IN/OUT) VSS context.
444 * @param    decoderType        (IN) Decoder type
445 * @return    M4NO_ERROR:            No error
446 * @return    M4ERR_PARAMETER:                    A parameter is null (in DEBUG only)
447 * @return    M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED:    Media type not supported
448 ************************************************************************
449*/
450M4OSA_ERR   M4VSS3GPP_setCurrentVideoDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
451                                             M4_StreamType mediaType);
452
453/**
454 ************************************************************************
455 * M4OSA_ERR   M4VSS3GPP_setCurrentAudioDecoder()
456 * @brief    Set an audio decoder
457 * @param    context            (IN/OUT) VSS context.
458 * @param    decoderType        (IN) Decoder type
459 * @return    M4NO_ERROR:            No error
460 * @return    M4ERR_PARAMETER:    A parameter is null (in DEBUG only)
461 ************************************************************************
462*/
463M4OSA_ERR   M4VSS3GPP_setCurrentAudioDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC,
464                                             M4_StreamType mediaType);
465
466/**
467 ************************************************************************
468 * M4OSA_ERR   M4VSS3GPP_clearInterfaceTables()
469 * @brief    Clear encoders, decoders, reader and writers interfaces tables
470 * @param    pContext            (IN/OUT) VSS context.
471 * @return    M4NO_ERROR:            No error
472 * @return    M4ERR_PARAMETER:    The context is null
473 ************************************************************************
474*/
475M4OSA_ERR   M4VSS3GPP_clearInterfaceTables(M4VSS3GPP_MediaAndCodecCtxt *pC);
476
477/**
478 ******************************************************************************
479 * M4OSA_ERR M4VSS3GPP_SubscribeMediaAndCodec()
480 * @brief    This function registers the reader, decoders, writers and encoders
481 *          in the VSS.
482 * @note
483 * @param    pContext:    (IN) Execution context.
484 * @return    M4NO_ERROR: there is no error
485 * @return    M4ERR_PARAMETER    pContext is NULL
486 ******************************************************************************
487*/
488M4OSA_ERR M4VSS3GPP_subscribeMediaAndCodec(M4VSS3GPP_MediaAndCodecCtxt *pContext);
489
490/**
491 ******************************************************************************
492 * M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_AMRNB()
493 * @brief   Return the length, in bytes, of the AMR Narrow-Band frame contained in the given buffer
494 * @note
495 * @param   pAudioFrame   (IN) AMRNB frame
496 * @return  M4NO_ERROR: No error
497 ******************************************************************************
498*/
499M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_AMRNB(M4OSA_MemAddr8 pAudioFrame);
500
501/**
502 ******************************************************************************
503 * M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_EVRC()
504 * @brief   Return the length, in bytes, of the EVRC frame contained in the given buffer
505 * @note
506 *     0 1 2 3
507 *    +-+-+-+-+
508 *    |fr type|              RFC 3558
509 *    +-+-+-+-+
510 *
511 * Frame Type: 4 bits
512 *    The frame type indicates the type of the corresponding codec data
513 *    frame in the RTP packet.
514 *
515 * For EVRC and SMV codecs, the frame type values and size of the
516 * associated codec data frame are described in the table below:
517 *
518 * Value   Rate      Total codec data frame size (in octets)
519 * ---------------------------------------------------------
520 *   0     Blank      0    (0 bit)
521 *   1     1/8        2    (16 bits)
522 *   2     1/4        5    (40 bits; not valid for EVRC)
523 *   3     1/2       10    (80 bits)
524 *   4     1         22    (171 bits; 5 padded at end with zeros)
525 *   5     Erasure    0    (SHOULD NOT be transmitted by sender)
526 *
527 * @param   pCpAudioFrame   (IN) EVRC frame
528 * @return  M4NO_ERROR: No error
529 ******************************************************************************
530*/
531M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_EVRC(M4OSA_MemAddr8 pAudioFrame);
532
533/**
534 ******************************************************************************
535 * M4OSA_ERR M4VSS3GPP_intBuildAnalysis()
536 * @brief    Get video and audio properties from the clip streams
537 * @note    This function must return fatal errors only (errors that should not happen in the
538 *             final integrated product).
539 * @param   pClipCtxt            (IN) internal clip context
540 * @param    pClipProperties        (OUT) Pointer to a valid ClipProperties structure.
541 * @return    M4NO_ERROR:            No error
542 ******************************************************************************
543*/
544M4OSA_ERR M4VSS3GPP_intBuildAnalysis(M4VSS3GPP_ClipContext *pClipCtxt,
545                                     M4VIDEOEDITING_ClipProperties *pClipProperties);
546
547/**
548 ******************************************************************************
549 * M4OSA_ERR M4VSS3GPP_intCreateAudioEncoder()
550 * @brief    Reset the audio encoder (Create it if needed)
551 * @note
552  ******************************************************************************
553*/
554M4OSA_ERR  M4VSS3GPP_intCreateAudioEncoder(M4VSS3GPP_EncodeWriteContext *pC_ewc,
555                                             M4VSS3GPP_MediaAndCodecCtxt *pC_ShellAPI,
556                                             M4OSA_UInt32 uiAudioBitrate);
557
558/**
559 ******************************************************************************
560 * M4OSA_ERR M4VSS3GPP_intCreate3GPPOutputFile()
561 * @brief    Creates and prepare the output MP3 file
562 * @note    Creates the writer, Creates the output file, Adds the streams, Readies the
563 *            writing process
564 * @param   pC    (IN/OUT) Internal edit context
565 ******************************************************************************
566*/
567M4OSA_ERR M4VSS3GPP_intCreate3GPPOutputFile(M4VSS3GPP_EncodeWriteContext *pC_ewc,
568                                            M4VSS3GPP_MediaAndCodecCtxt *pC_ShellAPI,
569                                            M4OSA_FileWriterPointer *pOsaFileWritPtr,
570                                            M4OSA_Void* pOutputFile,
571                                            M4OSA_FileReadPointer *pOsaFileReadPtr,
572                                            M4OSA_Void* pTempFile,
573                                            M4OSA_UInt32 maxOutputFileSize);
574
575/**
576 ******************************************************************************
577 * M4OSA_ERR M4VSS3GPP_intAudioMixingCompatibility()
578 * @brief    This function allows checking if two clips are compatible with each other for
579 *             VSS 3GPP audio mixing feature.
580 * @note
581 * @param    pC                            (IN) Context of the audio mixer
582 * @param    pInputClipProperties        (IN) Clip analysis of the first clip
583 * @param    pAddedClipProperties        (IN) Clip analysis of the second clip
584 * @return    M4NO_ERROR:            No error
585 * @return    M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION
586 * @return  M4VSS3GPP_ERR_INPUT_CLIP_IS_NOT_A_3GPP
587 * @return  M4NO_ERROR
588 ******************************************************************************
589*/
590M4OSA_ERR M4VSS3GPP_intAudioMixingCompatibility(M4VSS3GPP_InternalAudioMixingContext *pC,
591                                                 M4VIDEOEDITING_ClipProperties \
592                                                 *pInputClipProperties,
593                                                 M4VIDEOEDITING_ClipProperties  \
594                                                 *pAddedClipProperties);
595
596/**
597 ******************************************************************************
598 * M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack()
599 * @brief    Delete the audio track. Clip will be like if it had no audio track
600 * @note
601 * @param   pClipCtxt            (IN) Internal clip context
602 ******************************************************************************
603*/
604M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack(M4VSS3GPP_ClipContext *pClipCtxt);
605
606/******************************************************************************
607 * M4OSA_ERR M4VSS3GPP_intStartAU()
608 * @brief    StartAU writer-like interface used for the VSS 3GPP only
609 * @note
610 * @param    pContext: (IN) It is the VSS 3GPP context in our case
611 * @param    streamID: (IN) Id of the stream to which the Access Unit is related.
612 * @param    pAU:      (IN/OUT) Access Unit to be prepared.
613 * @return    M4NO_ERROR: there is no error
614 ******************************************************************************
615*/
616M4OSA_ERR  M4VSS3GPP_intStartAU(M4WRITER_Context pContext, M4SYS_StreamID streamID,
617                                 M4SYS_AccessUnit* pAU);
618
619/******************************************************************************
620 * M4OSA_ERR M4VSS3GPP_intProcessAU()
621 * @brief    ProcessAU writer-like interface used for the VSS 3GPP only
622 * @note
623 * @param    pContext: (IN) It is the VSS 3GPP context in our case
624 * @param    streamID: (IN) Id of the stream to which the Access Unit is related.
625 * @param    pAU:      (IN/OUT) Access Unit to be written
626 * @return    M4NO_ERROR: there is no error
627 ******************************************************************************
628*/
629M4OSA_ERR  M4VSS3GPP_intProcessAU(M4WRITER_Context pContext, M4SYS_StreamID streamID,
630                                     M4SYS_AccessUnit* pAU);
631
632/**
633 ******************************************************************************
634 * M4OSA_ERR M4VSS3GPP_intVPP()
635 * @brief    We implement our own VideoPreProcessing function
636 * @note    It is called by the video encoder
637 * @param    pContext    (IN) VPP context, which actually is the VSS 3GPP context in our case
638 * @param    pPlaneIn    (IN)
639 * @param    pPlaneOut    (IN/OUT) Pointer to an array of 3 planes that will contain the
640 *                             output YUV420 image
641 * @return    M4NO_ERROR:    No error
642 ******************************************************************************
643*/
644M4OSA_ERR  M4VSS3GPP_intVPP(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn,
645                             M4VIFI_ImagePlane* pPlaneOut);
646
647#ifdef __cplusplus
648}
649#endif
650
651#endif /* __M4VSS3GPP_INTERNALFUNCTIONS_H__ */
652
653