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