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