diff options
author | Dharmaray Kundargi <dharmaray@google.com> | 2011-01-16 15:59:43 -0800 |
---|---|---|
committer | Dharmaray Kundargi <dharmaray@google.com> | 2011-01-17 09:59:01 -0800 |
commit | 7c9d8018755adf1857571125ba1b3598c96ea506 (patch) | |
tree | 6f97c14846692c0a7580c3a6019f7c91c669ffcf /libvideoeditor/vss/inc | |
parent | 5358e878396e1c451e9f9ef07237c2e6ab662d49 (diff) | |
download | frameworks_av-7c9d8018755adf1857571125ba1b3598c96ea506.zip frameworks_av-7c9d8018755adf1857571125ba1b3598c96ea506.tar.gz frameworks_av-7c9d8018755adf1857571125ba1b3598c96ea506.tar.bz2 |
Removed unwanted line in M4READER_Amr.h
vss core files upload on honeycomb
Change-Id: I61206ae2398ce8ac544c6fb01a76fe8917bce75b
Diffstat (limited to 'libvideoeditor/vss/inc')
-rwxr-xr-x | libvideoeditor/vss/inc/M4EXIFC_CommonAPI.h | 119 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4PTO3GPP_API.h | 263 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4PTO3GPP_ErrorCodes.h | 105 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4PTO3GPP_InternalTypes.h | 231 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_API.h | 961 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_ErrorCodes.h | 276 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_Extended_API.h | 300 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_InternalConfig.h | 157 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_InternalFunctions.h | 663 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h | 779 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4xVSS_API.h | 633 | ||||
-rwxr-xr-x | libvideoeditor/vss/inc/M4xVSS_Internal.h | 610 |
12 files changed, 5097 insertions, 0 deletions
diff --git a/libvideoeditor/vss/inc/M4EXIFC_CommonAPI.h b/libvideoeditor/vss/inc/M4EXIFC_CommonAPI.h new file mode 100755 index 0000000..ae21d95 --- /dev/null +++ b/libvideoeditor/vss/inc/M4EXIFC_CommonAPI.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + ****************************************************************************** + * @file M4EXIFC_CommonAPI.h + * @brief EXIF common data header + * @note The types, structures and macros defined in this file allow reading + * and writing EXIF JPEG images compliant spec EXIF 2.2 + ****************************************************************************** +*/ + + +#ifndef __M4_EXIF_COMMON_API_H__ +#define __M4_EXIF_COMMON_API_H__ + +#include "M4TOOL_VersionInfo.h" +#include "M4Common_types.h" +#include "M4OSA_Debug.h" +#include "M4OSA_Error.h" +#include "M4OSA_Types.h" +#include "M4OSA_Memory.h" +#include "M4OSA_CoreID.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + ************************************************************************ + * type M4EXIFC_Context + ************************************************************************ +*/ +typedef M4OSA_Void* M4EXIFC_Context; + +/** + ****************************************************************************** + * Errors & Warnings + ****************************************************************************** +*/ + +#define M4EXIFC_NO_ERR 0x00000000 /**< invalid parameter */ +#define M4EXIFC_ERR_PARAMETER 0x00000001 /**< invalid parameter */ +#define M4EXIFC_ERR_ALLOC 0x00000002 /**< allocation error */ +#define M4EXIFC_ERR_BAD_CONTEXT 0x00000003 /**< invalid context */ +#define M4EXIFC_ERR_NOT_COMPLIANT 0x00000004 /**< the image in buffer is not + JPEG compliant */ +#define M4EXIFC_ERR_NO_APP_FOUND 0x00000005 /**< the JPEG image does not contain any APP1 + Exif 2.2 compliant */ +#define M4EXIFC_WAR_NO_THUMBNAIL 0x00000006 /**< the Exif part does not contain any + thumbnail */ +#define M4EXIFC_ERR_APP_TRUNCATED 0x00000007 /**< The APP1 section in input buffer is + not complete */ + + +/** + ****************************************************************************** + * structure M4EXIFC_BasicTags + * @brief This structure stores the basic tags values. + * @note This Exif reader focuses on a set of "Entry Tags". + * This structure contains the corresponding "Entry Values" of these tags. + * M4EXIFC_Char* fields of structure are Null terminated Strings. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Int32 width; /**< image width in pixels */ + M4OSA_Int32 height; /**< image height in pixels */ + M4OSA_Char *creationDateTime; /**< date and time original image was generated */ + M4OSA_Char *lastChangeDateTime; /**< file change date and time */ + M4OSA_Char *description; /**< image title */ + M4OSA_Char *make; /**< manufacturer of image input equipment */ + M4OSA_Char *model; /**< model of image input equipment */ + M4OSA_Char *software; /**< software used */ + M4OSA_Char *artist; /**< person who created the image */ + M4OSA_Char *copyright; /**< copyright holder */ + M4COMMON_Orientation orientation; /**< orientation of image */ + M4OSA_Int32 thumbnailSize; /**< size of the thumbnail */ + M4OSA_UInt8 *thumbnailImg; /**< pointer to the thumbnail in main image buffer*/ + M4OSA_Char *latitudeRef; /**< latitude reference */ + M4COMMON_Location latitude; /**< latitude */ + M4OSA_Char *longitudeRef; /**< longitude reference */ + M4COMMON_Location longitude; /**< longitude */ + +} M4EXIFC_BasicTags; + + +/** + ****************************************************************************** + * M4OSA_ERR M4EXIFC_getVersion (M4_VersionInfo *pVersion) + * @brief get the version numbers of the exif library. + * @note This function retrieves the version numbers in a structure. + * @param pVersion: (OUT) the structure containing version numbers + * @return M4NO_ERROR: there is no error + * @return M4EXIFC_ERR_PARAMETER: (Debug only) the parameter is M4EXIFC_NULL. + ****************************************************************************** +*/ +M4OSA_ERR M4EXIFC_getVersion (M4_VersionInfo *pVersion); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus*/ +#endif /* __M4_EXIF_COMMON_API_H__ */ + diff --git a/libvideoeditor/vss/inc/M4PTO3GPP_API.h b/libvideoeditor/vss/inc/M4PTO3GPP_API.h new file mode 100755 index 0000000..86c6b93 --- /dev/null +++ b/libvideoeditor/vss/inc/M4PTO3GPP_API.h @@ -0,0 +1,263 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + ****************************************************************************** + * @file M4PTO3GPP_API.h + * @brief The Pictures to 3GPP Converter. + * @note M4PTO3GPP produces 3GPP compliant audio/video files + * from an AMR NB audio file and raw pictures into a MPEG-4/h263 3GPP file. + ****************************************************************************** + */ + +#ifndef __M4PTO3GPP_API_H__ +#define __M4PTO3GPP_API_H__ + +/** + * OSAL basic types and errors */ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + +/** + * OSAL types for file access */ +#include "M4OSA_FileReader.h" +#include "M4OSA_FileWriter.h" + +/** + * Definition of M4_VersionInfo */ +#include "M4TOOL_VersionInfo.h" + +/** + * Definitions of M4VIFI_ImagePlane */ +#include "M4VIFI_FiltersAPI.h" + +#include "M4VE_API.h" + +/** + * Common definitions of video editing components */ +#include "M4_VideoEditingCommon.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Public type of the M4PTO3GPP context */ +typedef M4OSA_Void* M4PTO3GPP_Context; + + +/** + ****************************************************************************** + * enum M4PTO3GPP_ReplaceAudioMode + * @brief This enumeration defines the way the audio is managed if it is shorter than the video + ****************************************************************************** + */ +typedef enum +{ + M4PTO3GPP_kAudioPaddingMode_None = 0, /**< Audio track is kept shorter than the video track*/ + M4PTO3GPP_kAudioPaddingMode_Silence, /**< If audio is shorter, silence is added at the end*/ + M4PTO3GPP_kAudioPaddingMode_Loop /**< If audio is shorter, loop back to the beginning + when the whole track has been processed */ +} M4PTO3GPP_AudioPaddingMode; + + +/** + ****************************************************************************** + * struct M4PTO3GPP_OutputFileMaxSize + * @brief Defines the maximum size of the 3GPP file produced by the PTO3GPP + ****************************************************************************** + */ +typedef enum +{ + M4PTO3GPP_k50_KB, /**< Output 3GPP file size is limited to 50 Kbytes */ + M4PTO3GPP_k75_KB, /**< Output 3GPP file size is limited to 75 Kbytes */ + M4PTO3GPP_k100_KB, /**< Output 3GPP file size is limited to 100 Kbytes */ + M4PTO3GPP_k150_KB, /**< Output 3GPP file size is limited to 150 Kbytes */ + M4PTO3GPP_k200_KB, /**< Output 3GPP file size is limited to 200 Kbytes */ + M4PTO3GPP_k300_KB, /**< Output 3GPP file size is limited to 300 Kbytes */ + M4PTO3GPP_k400_KB, /**< Output 3GPP file size is limited to 400 Kbytes */ + M4PTO3GPP_k500_KB, /**< Output 3GPP file size is limited to 500 Kbytes */ + M4PTO3GPP_kUNLIMITED=-1 /**< Output 3GPP file size is not limited */ +} M4PTO3GPP_OutputFileMaxSize; + +/** + ****************************************************************************** + * M4OSA_ERR (M4PTO3GPP_PictureCallbackFct) (M4OSA_Void* pPictureCtxt, + * M4VIFI_ImagePlane* pImagePlanes, M4OSA_Double* pPictureDuration); + * @brief The integrator must implement a function following this prototype. + * Its goal is to feed the PTO3GPP with YUV420 pictures. + * + * @note This function is given to the PTO3GPP in the M4PTO3GPP_Params structure + * @param pContext (IN) The integrator own context + * @param pImagePlanes(IN/OUT) Pointer to an array of three valid image planes + * @param pPictureDuration(OUT) Duration of the returned picture + * + * @return M4NO_ERROR: No error + * @return M4PTO3GPP_WAR_LAST_PICTURE: The returned image is the last one + * @return M4ERR_PARAMETER: At least one of the function parameters is null (bebug only) + ****************************************************************************** + */ +typedef M4OSA_ERR (M4PTO3GPP_PictureCallbackFct) (M4OSA_Void* pPictureCtxt, + M4VIFI_ImagePlane* pImagePlanes, + M4OSA_Double* pPictureDuration); + + +/** + ****************************************************************************** + * struct M4PTO3GPP_Params + * @brief M4PTO3GPP parameters definition + ****************************************************************************** + */ +typedef struct +{ + /**< Output video compression format, H263 or MPEG4 */ + M4VIDEOEDITING_VideoFormat OutputVideoFormat; + /**< Output frame size : SQCIF to VGA*/ + M4VIDEOEDITING_VideoFrameSize OutputVideoFrameSize; + /**< Targeted Output bit-rate, see enum*/ + M4VIDEOEDITING_Bitrate OutputVideoBitrate; + /**< Maximum size of the output 3GPP file, see enum */ + M4PTO3GPP_OutputFileMaxSize OutputFileMaxSize; + /**< Callback function to be called by the PTO3GPP to get the input pictures*/ + M4PTO3GPP_PictureCallbackFct* pPictureCallbackFct; + /**< Context to be given as third argument of the picture callback function call*/ + M4OSA_Void* pPictureCallbackCtxt; + /**< File descriptor of the input audio track file */ + M4OSA_Void* pInputAudioTrackFile; + /**< Format of the audio file */ + M4VIDEOEDITING_FileType AudioFileFormat; + /**< Type of processing to apply when audio is shorter than video*/ + M4PTO3GPP_AudioPaddingMode AudioPaddingMode; + /**< File descriptor of the output 3GPP file */ + M4OSA_Void* pOutput3gppFile; + /**< File descriptor of the temporary file to store metadata ("moov.bin") */ + M4OSA_Void* pTemporaryFile; + /**< Number of input YUV frames to encode */ + M4OSA_UInt32 NbVideoFrames; +} M4PTO3GPP_Params; + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_GetVersion(M4_VersionInfo* pVersionInfo); + * @brief Get the M4PTO3GPP version. + * @note Can be called anytime. Do not need any context. + * @param pVersionInfo (OUT) Pointer to a version info structure + * @return M4NO_ERROR: No error + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_GetVersion(M4_VersionInfo* pVersionInfo); + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_Init(M4PTO3GPP_Context* pContext); + * @brief Initializes the M4PTO3GPP (allocates an execution context). + * @note + * @param pContext (OUT) Pointer on the M4PTO3GPP context to allocate + * @param pFileReadPtrFct (IN) Pointer to OSAL file reader functions + * @param pFileWritePtrFct (IN) Pointer to OSAL file writer functions + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL + * @return M4ERR_ALLOC: The context structure could not be allocated + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_Init(M4PTO3GPP_Context* pContext, M4OSA_FileReadPointer* pFileReadPtrFct, + M4OSA_FileWriterPointer* pFileWritePtrFct); + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_Open(M4PTO3GPP_Context pContext, M4PTO3GPP_Params* pParams); + * @brief Set the M4PTO3GPP input and output files. + * @note It opens the input file, but the output file may not be created yet. + * @param pContext (IN) M4PTO3GPP context + * @param pParams (IN) Pointer to the parameters for the PTO3GPP. + * @note The pointed structure can be de-allocated after this function returns because + * it is internally copied by the PTO3GPP + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: M4PTO3GPP is not in an appropriate state + * for this function to be called + * @return M4ERR_ALLOC: There is no more available memory + * @return ERR_PTO3GPP_INVALID_VIDEO_FRAME_SIZE_FOR_H263 The output video frame + * size parameter is incompatible with H263 encoding + * @return ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_FORMAT + * The output video format parameter is undefined + * @return ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_BITRATE + * The output video bit-rate parameter is undefined + * @return ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_FRAME_SIZE + * The output video frame size parameter is undefined + * @return ERR_PTO3GPP_UNDEFINED_OUTPUT_FILE_SIZE + * The output file size parameter is undefined + * @return ERR_PTO3GPP_UNDEFINED_AUDIO_PADDING + * The output audio padding parameter is undefined + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_Open(M4PTO3GPP_Context pContext, M4PTO3GPP_Params* pParams); + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_Step(M4PTO3GPP_Context pContext); + * @brief Perform one step of trancoding. + * @note + * @param pContext (IN) M4PTO3GPP context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL + * @return M4ERR_STATE: M4PTO3GPP is not in an appropriate state + * for this function to be called + * @return M4PTO3GPP_WAR_END_OF_PROCESSING: Encoding completed + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_Step(M4PTO3GPP_Context pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_Close(M4PTO3GPP_Context pContext); + * @brief Finish the M4PTO3GPP transcoding. + * @note The output 3GPP file is ready to be played after this call + * @param pContext (IN) M4PTO3GPP context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL + * @return M4ERR_STATE: M4PTO3GPP is not in an appropriate state + * for this function to be called + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_Close(M4PTO3GPP_Context pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_CleanUp(M4PTO3GPP_Context pContext); + * @brief Free all resources used by the M4PTO3GPP. + * @note The context is no more valid after this call + * @param pContext (IN) M4PTO3GPP context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_CleanUp(M4PTO3GPP_Context pContext); + + +M4OSA_ERR M4PTO3GPP_RegisterExternalVideoEncoder(M4PTO3GPP_Context pContext, + M4VE_EncoderType encoderType, + M4VE_Interface* pEncoderInterface, + M4OSA_Void* pUserData); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4PTO3GPP_API_H__ */ + diff --git a/libvideoeditor/vss/inc/M4PTO3GPP_ErrorCodes.h b/libvideoeditor/vss/inc/M4PTO3GPP_ErrorCodes.h new file mode 100755 index 0000000..555a7d3 --- /dev/null +++ b/libvideoeditor/vss/inc/M4PTO3GPP_ErrorCodes.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + ****************************************************************************** + * @file M4PTO3GPP_ErrorCodes.h + * @brief Picture to 3gpp Service error definitions. + * @note + ****************************************************************************** + */ + +#ifndef __M4PTO3GPP_ErrorCodes_H__ +#define __M4PTO3GPP_ErrorCodes_H__ + +/** + * OSAL basic types and errors */ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + +/** + * OSAL core ID definitions */ +#include "M4OSA_CoreID.h" + + +/** + * The output video format parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0001 ) +/** + * The output video frame size parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_FRAME_SIZE \ + M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0002 ) +/** + * The output video bit-rate parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_OUTPUT_VIDEO_BITRATE \ + M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0003 ) +/** + * The output video frame size parameter is incompatible with H263 encoding */ +#define ERR_PTO3GPP_INVALID_VIDEO_FRAME_SIZE_FOR_H263 \ + M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0004 ) +/** + * The file size is undefined */ +#define ERR_PTO3GPP_INVALID_FILE_SIZE M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0005 ) +/** + * The input audio file contains a track format not handled by PTO3GPP */ +#define ERR_PTO3GPP_UNHANDLED_AUDIO_TRACK_INPUT_FILE \ + M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0006 ) +/** + * The output video format parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_OUTPUT_AUDIO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0007 ) + +/** + * The AMR decoder initialization failed */ +#define ERR_PTO3GPP_AMR_DECODER_INIT_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0020 ) +/** + * The AMR decoder failed */ +#define ERR_PTO3GPP_AMR_DECODE_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0021 ) +/** + * The AMR decoder cleanup failed */ +#define ERR_PTO3GPP_AMR_DECODER_DESTROY_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0022 ) + +/** + * The video encoder initialization failed */ +#define ERR_PTO3GPP_VIDEO_ENCODER_INIT_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0023 ) +/** + * The video encoder decoding failed */ +#define ERR_PTO3GPP_VIDEO_ENCODE_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0024 ) +/** + * The video encoder cleanup failed */ +#define ERR_PTO3GPP_VIDEO_ENCODER_DESTROY_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0025 ) + +/** + * The output file size parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_OUTPUT_FILE_SIZE M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0026 ) + +/** + * The Encoding is completed */ +#define M4PTO3GPP_WAR_END_OF_PROCESSING M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0027 ) + +/** + * The Encoding is completed */ +#define M4PTO3GPP_WAR_LAST_PICTURE M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0028 ) + +/** + * The output audio padding parameter is undefined */ +#define ERR_PTO3GPP_UNDEFINED_AUDIO_PADDING M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x0029 ) + +/** + * The video encoder encountered an Acces Unit error: very probably a file write error */ +#define ERR_PTO3GPP_ENCODER_ACCES_UNIT_ERROR M4OSA_ERR_CREATE( M4_ERR, M4PTO3GPP, 0x002A ) + +#endif /* __M4PTO3GPP_ErrorCodes_H__ */ + diff --git a/libvideoeditor/vss/inc/M4PTO3GPP_InternalTypes.h b/libvideoeditor/vss/inc/M4PTO3GPP_InternalTypes.h new file mode 100755 index 0000000..a858cb2 --- /dev/null +++ b/libvideoeditor/vss/inc/M4PTO3GPP_InternalTypes.h @@ -0,0 +1,231 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + ****************************************************************************** + * @file M4PTO3GPP_InternalTypes.h + * @brief Picture to 3gpp Service internal definitions + * @note This file contains all enum and types not visible to the external world. + ****************************************************************************** + */ + + +#ifndef __M4PTO3GPP_INTERNALTYPES_H__ +#define __M4PTO3GPP_INTERNALTYPES_H__ + +#define M4PTO3GPP_VERSION_MAJOR 3 +#define M4PTO3GPP_VERSION_MINOR 0 +#define M4PTO3GPP_VERSION_REVISION 6 + +/** + * M4PTO3GPP public API and types */ +#include "M4PTO3GPP_API.h" +#include "M4_Utils.h" + +/** + * Internally used modules */ + +#include "M4WRITER_common.h" /* Write 3GPP file */ +#include "M4READER_Common.h" /* Read AMR file */ +#include "M4ENCODER_common.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + ****************************************************************************** + * enum M4PTO3GPP_States + * @brief Main state machine of the M4PTO3GPP. + ****************************************************************************** + */ +typedef enum +{ + M4PTO3GPP_kState_CREATED = 0, /**< M4PTO3GPP_Init has been called */ + M4PTO3GPP_kState_OPENED = 1, /**< M4PTO3GPP_Open has been called */ + M4PTO3GPP_kState_READY = 2, /**< Step can be called */ + M4PTO3GPP_kState_FINISHED = 3, /**< Transcoding is finished */ + M4PTO3GPP_kState_CLOSED = 4 /**< Output file has been created */ +} +M4PTO3GPP_States; + +/** + ****************************************************************************** + * enum M4PTO3GPP_StreamState + * @brief State of a media stream encoding (audio or video). + ****************************************************************************** + */ +typedef enum +{ + M4PTO3GPP_kStreamState_NOSTREAM = 0, /**< No stream present */ + M4PTO3GPP_kStreamState_STARTED = 1, /**< The stream encoding is in progress */ + M4PTO3GPP_kStreamState_FINISHED = 2 /**< The stream has finished encoding */ +} +M4PTO3GPP_StreamState; + +/* + * Definition of max AU size */ +#define M4PTO3GPP_VIDEO_MIN_COMPRESSION_RATIO 0.8F /**< Max AU size will be 0.8 times the + YUV4:2:0 frame size */ +#define M4PTO3GPP_VIDEO_AU_SIZE_TO_CHUNCK_SIZE_RATIO 1.2F /**< Max chunk size will be 1.2 times + the max AU size */ +#define M4PTO3GPP_AUDIO_MAX_AU_SIZE 1000 /**< AAC max AU size seems to be + about 850 bytes */ +#define M4PTO3GPP_AUDIO_MAX_CHUNK_SIZE 5000 + +/** + ****************************************************************************** + * enum anonymous enum + * @brief enum to keep track of the encoder state + ****************************************************************************** + */ +enum +{ + M4PTO3GPP_kNoEncoder, + M4PTO3GPP_kEncoderClosed, + M4PTO3GPP_kEncoderStopped, + M4PTO3GPP_kEncoderRunning +}; + +/** + ****************************************************************************** + * structure M4PTO3GPP_InternalContext + * @brief This structure defines the M4PTO3GPP context (private) + * @note This structure is used for all M4PTO3GPP calls to store the context + ****************************************************************************** + */ +typedef struct +{ + /** + * M4PTO3GPP main variables */ + M4PTO3GPP_States m_State; /**< M4PTO3GPP internal state */ + M4PTO3GPP_Params m_Params; /**< M4PTO3GPP parameters, set by the user */ + M4PTO3GPP_StreamState m_VideoState; /**< State of the video encoding */ + M4PTO3GPP_StreamState m_AudioState; /**< State of the audio encoding */ + + /** + * OSAL file read/write functions */ + M4OSA_FileReadPointer* pOsalFileRead; /**< OSAL file read functions, + to be provided by user */ + M4OSA_FileWriterPointer* pOsalFileWrite; /**< OSAL file write functions, + to be provided by user */ + + /** + * Reader stuff */ + M4_AccessUnit* m_pReaderAudioAU; /**< Read audio access unit */ + M4_AudioStreamHandler* m_pReaderAudioStream;/**< Description of the read audio stream */ + + /** + * Writer stuff */ + M4SYS_AccessUnit m_WriterVideoAU; /**< Written video access unit */ + M4SYS_AccessUnit m_WriterAudioAU; /**< Written audio access unit */ + M4ENCODER_Header* m_pEncoderHeader; /**< Sequence header returned by the + encoder at encoder create (if any) */ + M4SYS_StreamDescription* m_pWriterVideoStream; /**< Description of the written + video stream */ + M4SYS_StreamDescription* m_pWriterAudioStream; /**< Description of the written + audio stream */ + M4WRITER_StreamVideoInfos* m_pWriterVideoStreamInfo; /**< Video properties of the written + video stream */ + M4WRITER_StreamAudioInfos* m_pWriterAudioStreamInfo; /**< Audio properties of the written + audio stream */ + + /** + * Contexts of the used modules */ + M4OSA_Void* m_pAudioReaderContext; /**< Context of the audio reader module*/ + M4OSA_Void* m_p3gpWriterContext; /**< Context of the 3GP writer module */ + M4OSA_Void* m_pMp4EncoderContext; /**< Mp4 encoder context */ + M4OSA_UInt32 m_eEncoderState; + + /** + * Reader Interfaces */ + M4READER_GlobalInterface* m_pReaderGlobInt; /**< Reader common interface, global part */ + M4READER_DataInterface* m_pReaderDataInt; /**< Reader common interface, data part */ + + /** + * Writer Interfaces */ + M4WRITER_GlobalInterface* m_pWriterGlobInt; /**< Writer common interface, global part */ + M4WRITER_DataInterface* m_pWriterDataInt; /**< Writer common interface, data part */ + + /** + * Encoder Interfaces */ + M4ENCODER_GlobalInterface* m_pEncoderInt; /**< Encoder common interface */ + M4OSA_Void* m_pEncoderExternalAPI; + M4OSA_Void* m_pEncoderUserData; + + /** + * */ + M4VIFI_ImagePlane* pSavedPlane; + M4OSA_UInt32 uiSavedDuration; + + /** + * Video rate control stuff */ + M4_MediaTime m_dLastVideoRegulCts; /**< Last time (CTS) the video bitrate + regulation has been called */ + M4_MediaTime m_mtCts; /**< Current video cts */ + M4_MediaTime m_mtNextCts; /**< Next video CTS to transcode */ + M4_MediaTime m_mtAudioCts; /**< Current audio cts */ + M4_MediaTime m_AudioOffSet; /**< Audio Offset to add to the cts in loop mode*/ + M4_MediaTime m_PrevAudioCts; /**< Previous audio cts for AAC looping */ + M4_MediaTime m_DeltaAudioCts; /**< Delta audio cts for AAC looping */ + M4OSA_UInt32 m_CurrentFileSize; /**< Current Output file size */ + M4OSA_UInt32 m_MaxFileSize; /**< Max Output file size */ + M4OSA_Bool m_IsLastPicture; /**< A boolean that signals to the encoder that + this is the last frame to be encoded*/ + M4OSA_Bool m_bLastInternalCallBack; + M4OSA_UInt32 m_NbCurrentFrame; /**< Index of the current YUV frame encoded */ + + /** + * Audio padding mode */ + M4OSA_Bool m_bAudioPaddingSilence; /**< A boolean that signals that audio + AU will be padded by silence */ + + struct + { + M4VE_Interface* pEncoderInterface; + M4OSA_Void* pUserData; + M4OSA_Bool registered; + } registeredExternalEncs[M4VE_kEncoderType_NB]; +} M4PTO3GPP_InternalContext; + + + +/** + ****************************************************************************** + * M4OSA_ERR M4PTO3GPP_applyVPP(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + * M4VIFI_ImagePlane* pPlaneOut) + * @brief Call an external callback to get the picture to encode + * @note It is called by the video encoder + * @param pContext (IN) VPP context, which actually is the M4PTO3GPP + * internal context in our case + * @param pPlaneIn (IN) Contains the image + * @param pPlaneOut (IN/OUT) Pointer to an array of 3 planes that will contain the + * output YUV420 image read with the m_pPictureCallbackFct + * @return M4NO_ERROR: No error + * @return Any error returned by an underlaying module + ****************************************************************************** + */ +M4OSA_ERR M4PTO3GPP_applyVPP(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + M4VIFI_ImagePlane* pPlaneOut); + + +#ifdef __cplusplus +} +#endif + +#endif /* __M4PTO3GPP_INTERNALTYPES_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_API.h b/libvideoeditor/vss/inc/M4VSS3GPP_API.h new file mode 100755 index 0000000..f6f8daa --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_API.h @@ -0,0 +1,961 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __M4VSS3GPP_API_H__ +#define __M4VSS3GPP_API_H__ + +/** + ****************************************************************************** + * @file M4VSS3GPP_API.h + * @brief Video Studio Service 3GPP public API. + * @note VSS allows editing 3GPP files. + * It is a straightforward and fully synchronous API. + ****************************************************************************** + */ + +/** + * OSAL basic types and errors */ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + +/** + * OSAL types for file access */ +#include "M4OSA_FileReader.h" +#include "M4OSA_FileWriter.h" + +/** + * Definition of M4_VersionInfo */ +#include "M4TOOL_VersionInfo.h" + +/** + * Image planes definition */ +#include "M4VIFI_FiltersAPI.h" + +/** + * Common definitions of video editing components */ +#include "M4_VideoEditingCommon.h" + + +#include "M4VD_HW_API.h" +#include "M4VE_API.h" + +#include "M4ENCODER_AudioCommon.h" +#include "M4AD_Common.h" +#include "M4DA_Types.h" + +/** + * Extended API (xVSS) */ +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES +#include "M4VSS3GPP_Extended_API.h" +#endif + +//#include "M4VD_HW_API.h" +//#include "M4VE_API.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + + +/** + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + * + * Edition Feature + * + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + */ + +/** + * Public type of the VSS edit context */ +typedef M4OSA_Void* M4VSS3GPP_EditContext; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_VideoEffectType + * @brief This enumeration defines the video effect types of the VSS3GPP + ****************************************************************************** + */ +typedef enum +{ + M4VSS3GPP_kVideoEffectType_None = 0, /**< No video effect */ + M4VSS3GPP_kVideoEffectType_FadeFromBlack = 8, /**< Intended for begin effect */ + M4VSS3GPP_kVideoEffectType_CurtainOpening = 9, /**< Intended for begin effect */ + M4VSS3GPP_kVideoEffectType_FadeToBlack = 16, /**< Intended for end effect */ + M4VSS3GPP_kVideoEffectType_CurtainClosing = 17, /**< Intended for end effect */ + M4VSS3GPP_kVideoEffectType_External = 256 /**< External effect function is used */ + /* reserved 256 + n */ /**< External effect number n */ + +} M4VSS3GPP_VideoEffectType; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_AudioEffectType + * @brief This enumeration defines the audio effect types of the VSS3GPP + ****************************************************************************** + */ +typedef enum +{ + M4VSS3GPP_kAudioEffectType_None = 0, + M4VSS3GPP_kAudioEffectType_FadeIn = 8, /**< Intended for begin effect */ + M4VSS3GPP_kAudioEffectType_FadeOut = 16 /**< Intended for end effect */ + +} M4VSS3GPP_AudioEffectType; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_VideoTransitionType + * @brief This enumeration defines the video effect that can be applied during a transition. + ****************************************************************************** + */ +typedef enum +{ + M4VSS3GPP_kVideoTransitionType_None = 0, + M4VSS3GPP_kVideoTransitionType_CrossFade = 1, + M4VSS3GPP_kVideoTransitionType_External = 256 + /* reserved 256 + n */ /**< External transition number n */ + +} M4VSS3GPP_VideoTransitionType; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_AudioTransitionType + * @brief This enumeration defines the audio effect that can be applied during a transition. + ****************************************************************************** + */ +typedef enum +{ + M4VSS3GPP_kAudioTransitionType_None = 0, + M4VSS3GPP_kAudioTransitionType_CrossFade + +} M4VSS3GPP_AudioTransitionType; + + +/** + ****************************************************************************** + * struct M4VSS3GPP_ExternalProgress + * @brief This structure contains information provided to the external Effect + * and Transition functions + * @note The uiProgress value should be enough for most cases + ****************************************************************************** + */ +typedef struct +{ + /**< Progress of the Effect or the Transition, from 0 to 1000 (one thousand) */ + M4OSA_UInt32 uiProgress; + /**< Index of the current clip (first clip in case of a Transition), from 0 to N */ + //M4OSA_UInt8 uiCurrentClip; + /**< Current time, in milliseconds, in the current clip time-line */ + M4OSA_UInt32 uiClipTime; + /**< Current time, in milliseconds, in the output clip time-line */ + M4OSA_UInt32 uiOutputTime; + M4OSA_Bool bIsLast; + +} M4VSS3GPP_ExternalProgress; + + +/** + ************************************************************************ + * enum M4VSS3GPP_codecType + * @brief This enum defines the codec types used to create interfaces + * @note This enum is used internally by the VSS3GPP services to identify + * a currently supported codec interface. Each codec is + * registered with one of this type associated. + * When a codec instance is needed, this type is used to + * identify and retrieve its interface. + * This can be extended for other codecs. + ************************************************************************ + */ +typedef enum +{ + /* Video Decoder Types */ + M4VSS3GPP_kVideoDecMPEG4 = 0, + M4VSS3GPP_kVideoDecH264, + + /* Video Encoder Types */ + M4VSS3GPP_kVideoEncMPEG4, + M4VSS3GPP_kVideoEncH263, + M4VSS3GPP_kVideoEncH264, + + /* Audio Decoder Types */ + M4VSS3GPP_kAudioDecAMRNB, + M4VSS3GPP_kAudioDecAAC, + M4VSS3GPP_kAudioDecMP3, + + /* Audio Encoder Types */ + M4VSS3GPP_kAudioEncAMRNB, + M4VSS3GPP_kAudioEncAAC, + + /* number of codecs, keep it as last enum entry, before invlaid type */ + M4VSS3GPP_kCodecType_NB, + /* invalid codec type */ + M4VSS3GPP_kCodecTypeInvalid = 255 + +} M4VSS3GPP_codecType; + + +/** + ****************************************************************************** + * prototype M4VSS3GPP_editVideoEffectFct + * @brief Begin and End video effect functions implemented by the integrator + * must match this prototype. + * @note The function is provided with the original image of the clip. + * It must apply the video effect to build the output image. + * The progress of the effect is given, on a scale from 0 to 1000. + * When the effect function is called, all the image plane structures + * and buffers are valid and owned by the VSS 3GPP. + * + * @param pFunctionContext (IN) The function context, previously set by the integrator + * @param pInputPlanes (IN) Input YUV420 image: pointer to an array of three valid + image planes (Y, U and V) + * @param pOutputPlanes (IN/OUT) Output (filtered) YUV420 image: pointer to an array + of three valid image planes (Y, U and V) + * @param pProgress (IN) Set of information about the video transition progress. + * @param uiExternalEffectId (IN) Which effect function should be used (for external effects) + * + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + ****************************************************************************** + */ +typedef M4OSA_ERR (*M4VSS3GPP_editVideoEffectFct) +( + M4OSA_Void *pFunctionContext, + M4VIFI_ImagePlane *pInputPlanes, + M4VIFI_ImagePlane *pOutputPlanes, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiExternalEffectId +); + + +/** + ****************************************************************************** + * prototype M4VSS3GPP_editVideoTransitionFct + * @brief External transition functions implemented by the integrator + * must match this prototype. + * @note The function is provided with the image of the first clip and + * the image of the second clip. It must build the output image + * from the two input images. + * The progress of the transition is given, on a scale from 0 to 1000. + * When the external function is called, all the image plane + * structures and buffers are valid and owned by the VSS 3GPP. + * + * @param pFunctionContext (IN) The function context, previously set by the integrator + * @param pClip1InputPlanes (IN) First input YUV420 image: pointer to an array of three + valid image planes (Y, U and V) + * @param pClip2InputPlanes (IN) Second input YUV420 image: pointer to an array of three + valid image planes (Y, U and V) + * @param pOutputPlanes (IN/OUT) Output (filtered) YUV420 image: pointer to an array + of three valid image planes (Y, U and V) + * @param pProgress (IN) Set of information about the video effect progress. + * @param uiExternalTransitionId (IN) Which transition function should be used + (for external transitions) + * + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + ****************************************************************************** + */ +typedef M4OSA_ERR (*M4VSS3GPP_editVideoTransitionFct) +( + M4OSA_Void *pFunctionContext, + M4VIFI_ImagePlane *pClip1InputPlanes, + M4VIFI_ImagePlane *pClip2InputPlanes, + M4VIFI_ImagePlane *pOutputPlanes, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiExternalTransitionId +); + + +/** + ****************************************************************************** + * struct M4VSS3GPP_EffectSettings + * @brief This structure defines an audio/video effect for the edition. + * @note Effect start time is relative to output clip. + ****************************************************************************** + */ +typedef struct +{ + M4OSA_UInt32 uiStartTime; /**< In ms */ + M4OSA_UInt32 uiDuration; /**< In ms */ + M4VSS3GPP_VideoEffectType VideoEffectType; /**< None, FadeIn, FadeOut, etc. */ + M4VSS3GPP_editVideoEffectFct ExtVideoEffectFct; /**< External effect function */ + M4OSA_Void *pExtVideoEffectFctCtxt;/**< Context given to the external + effect function */ + M4VSS3GPP_AudioEffectType AudioEffectType; /**< None, FadeIn, FadeOut */ + +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES + M4xVSS_EffectSettings xVSS; +#endif + +} M4VSS3GPP_EffectSettings; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_TransitionBehaviour + * @brief Transition behavior + ****************************************************************************** + */ +typedef enum +{ + M4VSS3GPP_TransitionBehaviour_SpeedUp = 0, + M4VSS3GPP_TransitionBehaviour_Linear, + M4VSS3GPP_TransitionBehaviour_SpeedDown, + M4VSS3GPP_TransitionBehaviour_SlowMiddle, + M4VSS3GPP_TransitionBehaviour_FastMiddle +} M4VSS3GPP_TransitionBehaviour; + + +/** + ****************************************************************************** + * struct M4VSS3GPP_TransitionSettings + * @brief This structure defines the transition to be applied when assembling two clips. + ****************************************************************************** + */ +typedef struct +{ + /**< Duration of the transition, in milliseconds (set to 0 to get no transition) */ + M4OSA_UInt32 uiTransitionDuration; + + /**< Type of the video transition */ + M4VSS3GPP_VideoTransitionType VideoTransitionType; + + /**< External transition video effect function */ + M4VSS3GPP_editVideoTransitionFct ExtVideoTransitionFct; + + /**< Context of the external transition video effect function */ + M4OSA_Void *pExtVideoTransitionFctCtxt; + M4VSS3GPP_AudioTransitionType AudioTransitionType; /**< Type of the audio transition */ + M4VSS3GPP_TransitionBehaviour TransitionBehaviour; /**<Transition behaviour*/ + +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES + M4xVSS_TransitionSettings xVSS; +#endif + +} M4VSS3GPP_TransitionSettings; + + +/** + ****************************************************************************** + * struct M4VSS3GPP_ClipSettings + * @brief This structure defines an input clip for the edition. + * @note It also contains the settings for the cut and begin/end effects applied to the clip. + ****************************************************************************** + */ +typedef struct +{ + M4OSA_Void *pFile; /**< Clip file descriptor */ + M4VIDEOEDITING_FileType FileType; /**< .3gp, .amr, .mp3 */ + M4OSA_UInt32 filePathSize; /**< Clip path size + (add because of UTF16 conversion)*/ + M4VIDEOEDITING_ClipProperties ClipProperties; /**< Clip analysis previously computed + with M4VSS3GPP_editAnalyseClip */ + M4OSA_UInt32 uiBeginCutTime; /**< Begin cut time, in milliseconds */ + M4OSA_UInt32 uiEndCutTime; /**< End cut time, in milliseconds */ + +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES + M4xVSS_ClipSettings xVSS; +#endif + +} M4VSS3GPP_ClipSettings; + + +/** + ****************************************************************************** + * struct M4VSS3GPP_EditSettings + * @brief This structure gathers all the information needed to define a complete + * edition operation + ****************************************************************************** + */ +typedef struct +{ + /**< Number of element of the clip list pClipList */ + M4OSA_UInt8 uiClipNumber; + /**< The properties of this clip will be used as a reference for compatibility checking */ + M4OSA_UInt8 uiMasterClip; + /**< List of the input clips settings. Pointer to an array of uiClipNumber + clip settings pointers */ + M4VSS3GPP_ClipSettings **pClipList; + /**< List of the transition settings. Pointer to an array of uiClipNumber-1 + transition settings pointers */ + M4VSS3GPP_TransitionSettings **pTransitionList; + M4VSS3GPP_EffectSettings *Effects; /**< List of effects */ + M4OSA_UInt8 nbEffects; /**< Number of effects in the above list */ + /**< Frame rate at which the modified video sections will be encoded */ + M4VIDEOEDITING_VideoFramerate videoFrameRate; + M4OSA_Void *pOutputFile; /**< Output 3GPP clip file descriptor */ + M4OSA_UInt32 uiOutputPathSize; /**< Output file path size*/ + /**< Temporary file to store metadata ("moov.bin") */ + M4OSA_Void *pTemporaryFile; + +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES + M4xVSS_EditSettings xVSS; +#endif + M4OSA_Float PTVolLevel; +} M4VSS3GPP_EditSettings; + + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editAnalyseClip() + * @brief This function allows checking if a clip is compatible with VSS 3GPP editing + * @note It also fills a ClipAnalysis structure, which can be used to check if two + * clips are compatible + * @param pClip (IN) File descriptor of the input 3GPP/MP3 clip file. + * @param pClipProperties (IN) Pointer to a valid ClipProperties structure. + * @param FileType (IN) Type of the input file (.3gp, .amr, .mp3) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4VSS3GPP_ERR_H263_PROFILE_NOT_SUPPORTED + * @return M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION + * @return M4VSS3GPP_ERR_AMR_EDITING_UNSUPPORTED + * @return M4VSS3GPP_ERR_EDITING_UNSUPPORTED_H263_PROFILE + * @return M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_PROFILE + * @return M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_RVLC + * @return M4VSS3GPP_ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT + * @return M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_VIDEO_STREAM_IN_FILE + * @return M4VSS3GPP_ERR_EDITING_UNSUPPORTED_AUDIO_FORMAT + * @return M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_STREAM_IN_FILE + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editAnalyseClip(M4OSA_Void *pClip, M4VIDEOEDITING_FileType FileType, + M4VIDEOEDITING_ClipProperties *pClipProperties, + M4OSA_FileReadPointer *pFileReadPtrFct); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editCheckClipCompatibility() + * @brief This function allows checking if two clips are compatible with each other + * for VSS 3GPP editing assembly feature. + * @note + * @param pClip1Properties (IN) Clip analysis of the first clip + * @param pClip2Properties (IN) Clip analysis of the second clip + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION + * @return M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_PLATFORM + * @return M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FORMAT + * @return M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FRAME_SIZE + * @return M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_TIME_SCALE + * @return M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_DATA_PARTITIONING + * @return M4VSS3GPP_ERR_UNSUPPORTED_MP3_ASSEMBLY + * @return M4VSS3GPP_ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editCheckClipCompatibility(M4VIDEOEDITING_ClipProperties *pClip1Properties, + M4VIDEOEDITING_ClipProperties *pClip2Properties); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editInit() + * @brief Initializes the VSS 3GPP edit operation (allocates an execution context). + * @note + * @param pContext (OUT) Pointer on the VSS 3GPP edit context to allocate + * @param pFileReadPtrFct (IN) Pointer to OSAL file reader functions + * @param pFileWritePtrFct (IN) Pointer to OSAL file writer functions + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: There is no more available memory + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editInit( + M4VSS3GPP_EditContext* pContext, + M4OSA_FileReadPointer* pFileReadPtrFct, + M4OSA_FileWriterPointer* pFileWritePtrFct ); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editCreateClipSettings() + * @brief Allows filling a clip settings structure with default values + * + * @note WARNING: pClipSettings->pFile will be allocated in this function. + * + * @param pClipSettings (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param pFile (IN) Clip file name + * @param filePathSize (IN) Size of the clip path (needed for UTF16 conversion) + * @param nbEffects (IN) Nb of effect settings to allocate + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editCreateClipSettings(M4VSS3GPP_ClipSettings *pClipSettings, + M4OSA_Void* pFile, M4OSA_UInt32 filePathSize, + M4OSA_UInt8 nbEffects); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editDuplicateClipSettings() + * @brief Duplicates a clip settings structure, performing allocations if required + * + * @param pClipSettingsDest (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param pClipSettingsOrig (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param bCopyEffects (IN) Flag to know if we have to duplicate effects (deprecated) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editDuplicateClipSettings(M4VSS3GPP_ClipSettings *pClipSettingsDest, + M4VSS3GPP_ClipSettings *pClipSettingsOrig, + M4OSA_Bool bCopyEffects); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editFreeClipSettings() + * @brief Free the pointers allocated in the ClipSetting structure (pFile, Effects). + * + * @param pClipSettings (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editFreeClipSettings(M4VSS3GPP_ClipSettings *pClipSettings); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editOpen() + * @brief Set the VSS 3GPP input and output files, and set the settings. + * @note + * @param pContext (IN) VSS 3GPP edit context + * @param pSettings (IN) Edit settings + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS is not in an appropriate state for this function to be called + * @return M4ERR_ALLOC: There is no more available memory + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editOpen(M4VSS3GPP_EditContext pContext, M4VSS3GPP_EditSettings *pSettings); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editStep() + * @brief Perform one step of editing. + * @note + * @param pContext (IN) VSS 3GPP edit context + * @param pProgress (OUT) Progress percentage (0 to 100) of the editing operation + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS 3GPP is not in an appropriate state for this function to + * be called + * @return M4VSS3GPP_WAR_EDITING_DONE:Edition is done, user should now call M4VSS3GPP_editClose() + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editStep(M4VSS3GPP_EditContext pContext, M4OSA_UInt8 *pProgress); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editClose() + * @brief Finish the VSS 3GPP edit operation. + * @note The output 3GPP file is ready to be played after this call + * @param pContext (IN) VSS 3GPP edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS 3GPP is not in an appropriate state for this function + * to be called + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editClose(M4VSS3GPP_EditContext pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editCleanUp() + * @brief Free all resources used by the VSS 3GPP edit operation. + * @note The context is no more valid after this call + * @param pContext (IN) VSS 3GPP edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editCleanUp(M4VSS3GPP_EditContext pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editRegisterExternalVideoDecoder(M4VSS3GPP_EditContext pContext, + * M4VD_VideoType decoderType, + * M4VD_Interface* pDecoderInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video decoder + * @note + * @param pContext (IN) VSS3GPP context + * @param decoderType (IN) Type of decoder (MPEG4 ...) + * @param pDecoderInterface (IN) Decoder interface + * @param pUserData (IN) Pointer on a user data to give to external decoder + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS3GPP is not in an appropriate state for this function + * to be called + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editRegisterExternalVideoDecoder(M4VSS3GPP_EditContext pContext, + M4VD_VideoType decoderType, + M4VD_Interface* pDecoderInterface, + M4OSA_Void* pUserData); + +/** + ****************************************************************************** + *M4OSA_ERR M4VSS3GPP_editRegisterExternalVideoEncoder(M4VSS3GPP_EditContext pContext, + * M4VE_EncoderType encoderType, + * M4VE_Interface* pEncoderInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video encoder + * @note + * @param pContext (IN) VSS3GPP context + * @param encoderType (IN) Type of encoder (MPEG4 ...) + * @param pEncoderInterface (IN) Encoder interface + * @param pUserData (IN) Pointer on a user data to give to external encoder + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS3GPP is not in an appropriate state for this function + * to be called + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_editRegisterExternalVideoEncoder(M4VSS3GPP_EditContext pContext, + M4VE_EncoderType encoderType, + M4VE_Interface* pEncoderInterface, + M4OSA_Void* pUserData); + + + +/** + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + * + * Audio Mixing Feature + * + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + */ +/** + * Public type of the VSS audio mixing context */ +typedef M4OSA_Void* M4VSS3GPP_AudioMixingContext; + + +/** + ****************************************************************************** + * struct M4VSS3GPP_AudioMixingSettings + * @brief This structure defines the settings of the audio mixing operation. + ****************************************************************************** + */ +typedef struct { + M4OSA_Void* pOriginalClipFile; /**< Input 3GPP clip file */ + M4OSA_Void* pAddedAudioTrackFile; /**< New audio track */ + M4VIDEOEDITING_FileType AddedAudioFileType; /**< File Format of the new audio file */ + M4OSA_UInt32 uiAddCts; /**< Time, in milliseconds, + at which the added audio track is inserted */ + M4OSA_UInt32 uiAddVolume; /**< Volume, in percentage, + of the added audio track */ + M4OSA_UInt32 uiBeginLoop; /**< Describes in milli-second the + start time of the loop */ + M4OSA_UInt32 uiEndLoop; /**< Describes in milli-second the end + time of the loop (0 means no loop) */ + M4OSA_Bool bRemoveOriginal; /**< If true, the original audio track + is not taken into account */ + M4OSA_Void* pOutputClipFile; /**< Output 3GPP clip file */ + M4OSA_Void* pTemporaryFile; /**< Temporary file to store metadata + ("moov.bin") */ + /**< The following parameters are optionnal. They are just used in case of MP3 replacement. */ + M4VIDEOEDITING_AudioSamplingFrequency outputASF; /**< Output sampling frequency */ + M4VIDEOEDITING_AudioFormat outputAudioFormat; /**< Output audio codec(AAC/AMR)*/ + M4VIDEOEDITING_Bitrate outputAudioBitrate; /**< Output audio bitrate */ + M4OSA_UInt8 outputNBChannels; /**< Output audio nb of channels */ + M4OSA_Bool b_DuckingNeedeed; + M4OSA_Int32 InDucking_threshold; + M4OSA_Float fBTVolLevel; + M4OSA_Float fPTVolLevel; + M4OSA_Float InDucking_lowVolume; + M4OSA_Bool bLoop; + M4OSA_UInt32 uiSamplingFrequency; + M4OSA_UInt32 uiNumChannels; +} M4VSS3GPP_AudioMixingSettings; + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_audioMixingInit(M4VSS3GPP_AudioMixingContext* pContext, + * M4VSS3GPP_AudioMixingSettings* pSettings) + * @brief Initializes the VSS audio mixing operation (allocates an execution context). + * @note + * @param pContext (OUT) Pointer on the VSS audio mixing context to allocate + * @param pSettings (IN) Pointer to valid audio mixing settings + * @param pFileReadPtrFct (IN) Pointer to OSAL file reader functions + * @param pFileWritePtrFct (IN) Pointer to OSAL file writer functions + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_ALLOC: There is no more available memory + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_audioMixingInit( + M4VSS3GPP_AudioMixingContext* pContext, + M4VSS3GPP_AudioMixingSettings* pSettings, + M4OSA_FileReadPointer* pFileReadPtrFct, + M4OSA_FileWriterPointer* pFileWritePtrFct ); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_audioMixingStep() + * @brief Perform one step of audio mixing. + * @note + * @param pContext (IN) VSS 3GPP audio mixing context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + * @param pProgress (OUT) Progress percentage (0 to 100) + of the finalization operation + * @return M4ERR_STATE: VSS is not in an appropriate state for + this function to be called + * @return M4VSS3GPP_WAR_END_OF_AUDIO_MIXING: Audio mixing is over, user should + now call M4VSS3GPP_audioMixingCleanUp() + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_audioMixingStep(M4VSS3GPP_AudioMixingContext pContext, + M4OSA_UInt8 *pProgress); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_audioMixingCleanUp() + * @brief Free all resources used by the VSS audio mixing operation. + * @note The context is no more valid after this call + * @param pContext (IN) VSS 3GPP audio mixing context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_audioMixingCleanUp(M4VSS3GPP_AudioMixingContext pContext); + + +/** + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + * + * Extract Picture Feature + * + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + */ +/** + * Public type of the VSS extract picture context */ +typedef M4OSA_Void* M4VSS3GPP_ExtractPictureContext; + +/** + ****************************************************************************** + * struct M4VSS3GPP_ExtractPictureSettings + * @brief This structure defines the settings of the extract picture audio operation. + ****************************************************************************** + */ +typedef struct { + M4OSA_Void* pInputClipFile; /**< Input 3GPP clip file */ + M4OSA_Int32 iExtractionTime; /**< frame time (in ms) to be extracted */ + M4OSA_Void* pOutputYuvPic; /**< Output YUV picture name */ +} M4VSS3GPP_ExtractPictureSettings; + + +/****************************************************************************** + * M4OSA_ERR M4VSS3GPP_extractPictureInit() + * @brief Initializes the VSS extract picture operation (allocates an execution context). + * @note + * @param pContext (OUT) Pointer on the VSS extract picture context to allocate + * @param pSettings (IN) Pointer to valid extract picture settings + * @param pWidth (OUT) video stream width + * @param pHeight (OUT) video stream height + * @param pFileReadPtrFct (IN) Pointer to OSAL file reader functions + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_ALLOC: There is no more available memory + * @return M4VSS3GPP_ERR_INVALID_CLIP1: The input clip is empty + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_extractPictureInit( + M4VSS3GPP_ExtractPictureContext* pContext, + M4VSS3GPP_ExtractPictureSettings* pSettings, + M4OSA_UInt32 *pWidth, + M4OSA_UInt32 *pHeight, + M4OSA_FileReadPointer* pFileReadPtrFct ); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_extractPictureStep() + * @brief Perform one step of picture extraction. + * @note + * @param pContext (IN) VSS extract picture context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + * @param pDecPlanes (OUT) Plane in wich the extracted picture is copied + * @param pProgress (OUT) Progress percentage (0 to 100) + of the picture extraction + * @return M4ERR_STATE: VSS is not in an appropriate state for this + function to be called + * @return VSS_WAR_END_OF_EXTRACT_PICTURE: Picture extraction is over, user should now + call M4VSS3GPP_extractPictureCleanUp() + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_extractPictureStep(M4VSS3GPP_ExtractPictureContext pContext, + M4VIFI_ImagePlane *pDecPlanes, M4OSA_UInt8 *pProgress); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_extractPictureCleanUp() + * @brief Free all resources used by the VSS picture extraction. + * @note The context is no more valid after this call + * @param pContext (IN) VSS extract picture context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only) + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_extractPictureCleanUp(M4VSS3GPP_ExtractPictureContext pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_extractPictureRegisterExternalVideoDecoder( + * M4VSS3GPP_ExtractPictureContext pContext, + * M4VD_VideoType decoderType, + * M4VD_Interface* pDecoderInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video decoder + * @note + * @param pContext (IN) Extract picture context + * @param decoderType (IN) Type of decoder (MPEG4 ...) + * @param pDecoderInterface (IN) Decoder interface + * @param pUserData (IN) Pointer on a user data to give to external decoder + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: Extract picture is not in an appropriate state for this + * function to be called + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_extractPictureRegisterExternalVideoDecoder(\ + M4VSS3GPP_ExtractPictureContext pContext, + M4VD_VideoType decoderType, + M4VD_Interface* pDecoderInterface, + M4OSA_Void* pUserData); + + + +/** + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + * + * Common features + * + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + */ + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_GetVersion() + * @brief Get the VSS version. + * @note Can be called anytime. Do not need any context. + * @param pVersionInfo (OUT) Pointer to a version info structure + * @return M4NO_ERROR: No error + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_GetVersion(M4_VersionInfo* pVersionInfo); + + +#ifdef WIN32 +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_GetErrorMessage() + * @brief Return a string describing the given error code + * @note The input string must be already allocated (and long enough!) + * @param err (IN) Error code to get the description from + * @param sMessage (IN/OUT) Allocated string in which the description will be copied + * @return M4NO_ERROR: Input error is from the VSS3GPP module + * @return M4ERR_PARAMETER:Input error is not from the VSS3GPP module + ****************************************************************************** + */ +M4OSA_ERR M4VSS3GPP_GetErrorMessage(M4OSA_ERR err, M4OSA_Char* sMessage); +#endif /**< WIN32 */ + + + + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editRegisterExternalCodec( + * M4VSS3GPP_EditContext pContext, + * M4VSS3GPP_codecType codecType, + * M4OSA_Context pCodecInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video/Audio codec with VSS3GPP + * @note This is much different from the other external codec registration API to + * cope up with specific requirement of OMX codec implementation. + * + * @param pContext (IN) VSS3GPP context + * @param codecType (IN) Type of codec (MPEG4 ...) + * @param pCodecInterface (IN) Codec interface + * @param pUserData (IN) Pointer on a user data to give to external codec + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS3GPP is not in an appropriate state for this function to be called + ****************************************************************************** + */ + M4OSA_ERR M4VSS3GPP_editRegisterExternalCodec(M4VSS3GPP_EditContext pContext, + M4VSS3GPP_codecType codecType, + M4OSA_Context pCodecInterface, + M4OSA_Void* pUserData); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_editSubscribeExternalCodecs(M4VSS3GPP_EditContext pContext) + * @brief Subscribes to previously registered external Video/Audio codec + * @note This is much different from the other external codec registration API to + * cope up with specific requirement of OMX codec implementation. + * + * @param pContext (IN) VSS3GPP context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS3GPP is not in an appropriate state for this function to be called + ****************************************************************************** + */ + M4OSA_ERR M4VSS3GPP_editSubscribeExternalCodecs(M4VSS3GPP_EditContext pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intSubscribeExternalCodecs(M4VSS3GPP_EditContext pContext, + * M4OSA_Context pShellCtxt) + * @brief Subscribes to previously registered external Video/Audio codec + * @note This is much different from the other external codec registration API to + * cope up with specific requirement of OMX codec implementation. + * + * @param pContext (IN) VSS3GPP context + * @param pShellContext (IN) Media Codec shell context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: VSS3GPP is not in an appropriate state for this function to be called + ****************************************************************************** + */ + M4OSA_ERR M4VSS3GPP_intSubscribeExternalCodecs(M4VSS3GPP_EditContext pContext, + M4OSA_Context pShellCtxt); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4VSS3GPP_API_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_ErrorCodes.h b/libvideoeditor/vss/inc/M4VSS3GPP_ErrorCodes.h new file mode 100755 index 0000000..3ad97a7 --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_ErrorCodes.h @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + ****************************************************************************** + * @file M4VSS3GPP_ErrorCodes.h + * @brief Video Studio Service 3GPP error definitions. + * @note + ****************************************************************************** + */ + +#ifndef __M4VSS3GPP_ErrorCodes_H__ +#define __M4VSS3GPP_ErrorCodes_H__ + +/** + * OSAL basic types and errors */ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + +/** + * OSAL core ID definitions */ +#include "M4OSA_CoreID.h" + + +/************************************************************************/ +/* Warning codes */ +/************************************************************************/ + +/** + * End of edition, user should now call M4VSS3GPP_editClose() */ +#define M4VSS3GPP_WAR_EDITING_DONE M4OSA_ERR_CREATE( M4_WAR, M4VSS3GPP, 0x0001) + +/** + * End of audio mixing, user should now call M4VSS3GPP_audioMixingCleanUp() */ +#define M4VSS3GPP_WAR_END_OF_AUDIO_MIXING M4OSA_ERR_CREATE( M4_WAR, M4VSS3GPP, 0x0010) + +/** + * End of extract picture, user should now call M4VSS3GPP_extractPictureCleanUp() */ +#define M4VSS3GPP_WAR_END_OF_EXTRACT_PICTURE M4OSA_ERR_CREATE( M4_WAR, M4VSS3GPP, 0x0020) +/* RC: to know when a file has been processed */ +#define M4VSS3GPP_WAR_SWITCH_CLIP M4OSA_ERR_CREATE( M4_WAR, M4VSS3GPP, 0x0030) + +/************************************************************************/ +/* Error codes */ +/************************************************************************/ + +/** + * Invalid file type */ +#define M4VSS3GPP_ERR_INVALID_FILE_TYPE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0001) +/** + * Invalid effect kind */ +#define M4VSS3GPP_ERR_INVALID_EFFECT_KIND M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0002) +/** + * Invalid effect type for video */ +#define M4VSS3GPP_ERR_INVALID_VIDEO_EFFECT_TYPE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0003) +/** + * Invalid effect type for audio */ +#define M4VSS3GPP_ERR_INVALID_AUDIO_EFFECT_TYPE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0004) +/** + * Invalid transition type for video */ +#define M4VSS3GPP_ERR_INVALID_VIDEO_TRANSITION_TYPE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0005) +/** + * Invalid transition type for audio */ +#define M4VSS3GPP_ERR_INVALID_AUDIO_TRANSITION_TYPE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0006) +/** + * Invalid video encoding frame rate */ +#define M4VSS3GPP_ERR_INVALID_VIDEO_ENCODING_FRAME_RATE \ + M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0007) + /** + * External effect function is used without being set */ +#define M4VSS3GPP_ERR_EXTERNAL_EFFECT_NULL M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0008) +/** + * External transition function is used without being set */ +#define M4VSS3GPP_ERR_EXTERNAL_TRANSITION_NULL M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0009) + +/** + * Begin cut time is larger than the clip duration */ +#define M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_DURATION M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0010) +/** + * Begin cut time is larger or equal than end cut */ +#define M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_END_CUT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0011) +/** + * Two consecutive transitions are overlapping on one clip */ +#define M4VSS3GPP_ERR_OVERLAPPING_TRANSITIONS M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0012) + +/** + * An input 3GPP file is invalid/corrupted */ +#define M4VSS3GPP_ERR_INVALID_3GPP_FILE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0016) +/** + * A file contains an unsupported video format */ +#define M4VSS3GPP_ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0017) +/** + * A file contains an unsupported audio format */ +#define M4VSS3GPP_ERR_UNSUPPORTED_INPUT_AUDIO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0018) + +/** + * A file format is not supported by the VSS */ +#define M4VSS3GPP_ERR_AMR_EDITING_UNSUPPORTED M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0019) + /** + * An input clip has an unexpectedly large Video AU */ +#define M4VSS3GPP_ERR_INPUT_VIDEO_AU_TOO_LARGE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x001A) +/** + * An input clip has an unexpectedly large Audio AU */ +#define M4VSS3GPP_ERR_INPUT_AUDIO_AU_TOO_LARGE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x001B) +/** + * An input clip has a corrupted Audio AMR AU */ +#define M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AU M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x001C) +/** + * The video encoder encountered an Acces Unit error: very probably a file write error */ +#define M4VSS3GPP_ERR_ENCODER_ACCES_UNIT_ERROR M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x001D) + + +/************************************************************************/ +/* Errors returned by M4VSS3GPP_editAnalyseClip() */ +/************************************************************************/ + +/** + * Unsupported video format for Video Editing */ +#define M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0020) +/** + * Unsupported H263 profile for Video Editing */ +#define M4VSS3GPP_ERR_EDITING_UNSUPPORTED_H263_PROFILE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0021) +/** + * Unsupported MPEG-4 profile for Video Editing */ +#define M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_PROFILE \ + M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0022) +/** + * Unsupported MPEG-4 RVLC tool for Video Editing */ +#define M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_RVLC M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0023) +/** + * Unsupported audio format for Video Editing */ +#define M4VSS3GPP_ERR_EDITING_UNSUPPORTED_AUDIO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0024) + /** + * File contains no supported stream */ +#define M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_STREAM_IN_FILE M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0025) +/** + * File contains no video stream or an unsupported video stream */ +#define M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_VIDEO_STREAM_IN_FILE M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0026) + + +/************************************************************************/ +/* Errors returned by M4VSS3GPP_editCheckClipCompatibility() */ +/************************************************************************/ + +/** + * At least one of the clip analysis has been generated by another version of the VSS 3GPP */ +#define M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0030) +/** + * Clips don't have the same video format (H263 or MPEG4) */ +#define M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FORMAT M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0031) +/** + * Clips don't have the same frame size */ +#define M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FRAME_SIZE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0032) +/** + * Clips don't have the same MPEG-4 time scale */ +#define M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_TIME_SCALE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0033) +/** + * Clips don't have the same use of MPEG-4 data partitioning */ +#define M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_DATA_PARTITIONING M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0034) +/** + * MP3 clips can't be assembled */ +#define M4VSS3GPP_ERR_UNSUPPORTED_MP3_ASSEMBLY M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0035) +/** + * Clips don't have the same audio stream type (ex: AMR != AAC) */ +#define M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_STREAM_TYPE M4OSA_ERR_CREATE( M4_WAR, M4VSS3GPP, 0x0036) +/** + * Clips don't have the same audio number of channels (ex: stereo != mono) */ +#define M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_NB_OF_CHANNELS M4OSA_ERR_CREATE( M4_WAR,\ + M4VSS3GPP, 0x0037) +/** + * Clips don't have the same sampling frequency (ex: 44100Hz != 16000Hz) */ +#define M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_SAMPLING_FREQUENCY M4OSA_ERR_CREATE( M4_WAR,\ + M4VSS3GPP, 0x0038) + +/************************************************************************/ +/* Audio mixing error codes */ +/************************************************************************/ + +/** + * The input 3GPP file does not contain any supported audio or video track */ +#define M4VSS3GPP_ERR_NO_SUPPORTED_STREAM_IN_FILE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0050) +/** + * The Volume of the added audio track (AddVolume) must be strictly superior than zero */ +#define M4VSS3GPP_ERR_ADDVOLUME_EQUALS_ZERO M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0051) +/** + * The time at which the audio track is added (AddCts) can't be superior than the + input video track duration */ +#define M4VSS3GPP_ERR_ADDCTS_HIGHER_THAN_VIDEO_DURATION M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0052) +/** + * The audio track file format setting is undefined */ +#define M4VSS3GPP_ERR_UNDEFINED_AUDIO_TRACK_FILE_FORMAT M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0053) +/** + * The added audio track stream has an unsupported format */ +#define M4VSS3GPP_ERR_UNSUPPORTED_ADDED_AUDIO_STREAM M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0054) +/** + * The audio mixing feature doesn't support EVRC, MP3 audio tracks */ +#define M4VSS3GPP_ERR_AUDIO_MIXING_UNSUPPORTED M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0055) +/** + * An added audio track limit the available features: uiAddCts must be 0 + and bRemoveOriginal must be M4OSA_TRUE */ +#define M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AUDIO_TRACK M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0056) +/** + * Input audio track is not AMR-NB nor AAC so it can't be mixed with output */ +#define M4VSS3GPP_ERR_AUDIO_CANNOT_BE_MIXED M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0057) +/** + * Input clip must be a 3gpp file */ +#define M4VSS3GPP_ERR_INPUT_CLIP_IS_NOT_A_3GPP M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0058) +/** + * Begin loop time is higher than end loop time or higher than added clip duration */ +#define M4VSS3GPP_ERR_BEGINLOOP_HIGHER_ENDLOOP M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0059) + + +/************************************************************************/ +/* Audio mixing and extract picture error code */ +/************************************************************************/ + +/** + * H263 Profile 3 level 10 is not supported */ +#define M4VSS3GPP_ERR_H263_PROFILE_NOT_SUPPORTED M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0060) +/** + * File contains no video stream or an unsupported video stream */ +#define M4VSS3GPP_ERR_NO_SUPPORTED_VIDEO_STREAM_IN_FILE M4OSA_ERR_CREATE( M4_ERR,\ + M4VSS3GPP, 0x0061) + + +/************************************************************************/ +/* Internal error and warning codes */ +/************************************************************************/ + +/** + * Internal state error */ +#define M4VSS3GPP_ERR_INTERNAL_STATE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0100) +/** + * Luminance filter effect error */ +#define M4VSS3GPP_ERR_LUMA_FILTER_ERROR M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0104) +/** + * Curtain filter effect error */ +#define M4VSS3GPP_ERR_CURTAIN_FILTER_ERROR M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0105) +/** + * Transition filter effect error */ +#define M4VSS3GPP_ERR_TRANSITION_FILTER_ERROR M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0106) +/** + * The audio decoder initialization failed */ +#define M4VSS3GPP_ERR_AUDIO_DECODER_INIT_FAILED M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0110) +/** + * The decoder produced an unattended amount of PCM */ +#define M4VSS3GPP_ERR_AUDIO_DECODED_PCM_SIZE_ISSUE M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0115) +/** + * Output file must be 3GPP or MP3 */ +#define M4VSS3GPP_ERR_OUTPUT_FILE_TYPE_ERROR M4OSA_ERR_CREATE( M4_ERR, M4VSS3GPP, 0x0117) + +#endif /* __M4VSS3GPP_ErrorCodes_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_Extended_API.h b/libvideoeditor/vss/inc/M4VSS3GPP_Extended_API.h new file mode 100755 index 0000000..faecb91 --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_Extended_API.h @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __M4VSS3GPP_EXTENDED_API_H__ +#define __M4VSS3GPP_EXTENDED_API_H__ + +/** + ****************************************************************************** + * @file M4VSS3GPP_Extended_API.h + * @brief API of xVSS + * @note + ****************************************************************************** +*/ + +#ifndef M4VSS_SUPPORT_EXTENDED_FEATURES +#error "*** the flag M4VSS_SUPPORT_EXTENDED_FEATURES should be activated in CompilerSwitches\ + for VideoStudio ***" +#endif + +/** + ****************************************************************************** + * prototype M4xVSS_getTextRgbBufferFct + * @brief External text to RGB buffer functions implemented by the integrator + * must match this prototype. + * @note The function is provided with the renderingData, the text buffer and + * its size. It must build the output RGB image plane containing the text. + * + * @param pRenderingData (IN) The data given by the user in M4xVSS_EffectSettings + * @param pTextBuffer (IN) Text buffer given by the user in M4xVSS_EffectSettings + * @param textBufferSize (IN) Text buffer size given by the user in M4xVSS_EffectSettings + * @param pOutputPlane (IN/OUT) Output RGB565 image + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + ****************************************************************************** +*/ +typedef M4OSA_ERR (*M4xVSS_getTextRgbBufferFct) +( + M4OSA_Void *pRenderingData, + M4OSA_Void *pTextBuffer, + M4OSA_UInt32 textBufferSize, + M4VIFI_ImagePlane **pOutputPlane +); + +/** + ****************************************************************************** + * struct M4xVSS_BGMSettings + * @brief This structure gathers all the information needed to add Background music to 3gp file + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Void *pFile; /**< Input file path */ + M4VIDEOEDITING_FileType FileType; /**< .3gp, .amr, .mp3 */ + M4OSA_UInt32 uiAddCts; /**< Time, in milliseconds, at which the added + audio track is inserted */ + M4OSA_UInt32 uiAddVolume; /**< Volume, in percentage, of the added audio track */ + M4OSA_UInt32 uiBeginLoop; /**< Describes in milli-second the start time + of the loop */ + M4OSA_UInt32 uiEndLoop; /**< Describes in milli-second the end time of the + loop (0 means no loop) */ + M4OSA_Bool b_DuckingNeedeed; + M4OSA_Int32 InDucking_threshold; /**< Threshold value at which background + music shall duck */ + M4OSA_Float lowVolume; /**< lower the background track to this factor + and increase the primary track to inverse of this factor */ + M4OSA_Bool bLoop; + M4OSA_UInt32 uiSamplingFrequency; + M4OSA_UInt32 uiNumChannels; +} M4xVSS_BGMSettings; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_VideoEffectType + * @brief This enumeration defines the video effect types of the VSS3GPP + ****************************************************************************** +*/ +typedef enum +{ + M4VSS3GPP_kRGB888 = 0, /**< RGB888 data type */ + M4VSS3GPP_kRGB565 = 1 /**< RGB565 data type */ + +} M4VSS3GPP_RGBType; + +/** + ****************************************************************************** + * struct M4xVSS_EffectSettings + * @brief This structure defines an audio/video effect for the edition. + ****************************************************************************** +*/ +typedef struct +{ + /**< In percent of the cut clip duration */ + M4OSA_UInt32 uiStartPercent; + /**< In percent of the ((clip duration) - (effect starttime)) */ + M4OSA_UInt32 uiDurationPercent; + /**< Framing file path (GIF/PNG file), used only if VideoEffectType == framing */ + M4OSA_Void *pFramingFilePath; + /**< Framing RGB565 buffer, used only if VideoEffectType == framing */ + M4VIFI_ImagePlane *pFramingBuffer; + /**<RGB Buffer type,used only if VideoEffectType == framing */ + M4VSS3GPP_RGBType rgbType; + /**< The top-left X coordinate in the output picture where the added frame will be displayed. + Used only if VideoEffectType == framing || VideoEffectType == text */ + M4OSA_UInt32 topleft_x; + /**< The top-left Y coordinate in the output picture where the added frame will be displayed. + Used only if VideoEffectType == framing || VideoEffectType == text */ + M4OSA_UInt32 topleft_y; + /**< Does framing image is resized to output video size. + Used only if VideoEffectType == framing */ + M4OSA_Bool bResize; + M4VIDEOEDITING_VideoFrameSize framingScaledSize; +/**< Size to which the the framing file needs to be resized */ + /**< Text buffer. Used only if VideoEffectType == text */ + M4OSA_Void* pTextBuffer; + /**< Text buffer size. Used only if VideoEffectType == text */ + M4OSA_UInt32 textBufferSize; + /**< Pointer containing specific data used by the font engine (size, color...) */ + M4OSA_Void* pRenderingData; + /**< Text plane width. Used only if VideoEffectType == text */ + M4OSA_UInt32 uiTextBufferWidth; + /**< Text plane height. Used only if VideoEffectType == text */ + M4OSA_UInt32 uiTextBufferHeight; + /**< Processing rate of the effect added when using the Fifties effect */ + M4OSA_UInt32 uiFiftiesOutFrameRate; + /**< RGB16 input color of the effect added when using the rgb16 color effect */ + M4OSA_UInt16 uiRgb16InputColor; + + M4OSA_UInt8 uialphaBlendingStart; /*Start percentage of Alpha blending*/ + M4OSA_UInt8 uialphaBlendingMiddle; /*Middle percentage of Alpha blending*/ + M4OSA_UInt8 uialphaBlendingEnd; /*End percentage of Alpha blending*/ + M4OSA_UInt8 uialphaBlendingFadeInTime; /*Duration, in percentage of + effect duration, of the FadeIn phase*/ + M4OSA_UInt8 uialphaBlendingFadeOutTime; /*Duration, in percentage of effect + duration, of the FadeOut phase*/ + M4OSA_UInt32 width; /*width of the ARGB8888 clip . + Used only if video effect is framming */ + M4OSA_UInt32 height; /*height of the ARGB8888 clip . + Used only if video effect is framming */ +} M4xVSS_EffectSettings; + +/** + ****************************************************************************** + * struct M4xVSS_AlphaMagicSettings + * @brief This structure defines the alpha magic transition settings + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Void* pAlphaFilePath; /**< Alpha file path (JPG file) */ + M4OSA_Int32 blendingPercent; /**< Blending Percentage between 0 and 100 */ + M4OSA_Bool isreverse; /**< direct effect or reverse */ + /*To support ARGB8888 : get the width and height */ + M4OSA_UInt32 width; + M4OSA_UInt32 height; +} M4xVSS_AlphaMagicSettings; + +/** + ****************************************************************************** + * enum M4xVSS_SlideTransition_Direction + * @brief Defines directions for the slide transition + ****************************************************************************** +*/ + +typedef enum { + M4xVSS_SlideTransition_RightOutLeftIn, + M4xVSS_SlideTransition_LeftOutRightIn, + M4xVSS_SlideTransition_TopOutBottomIn, + M4xVSS_SlideTransition_BottomOutTopIn +} M4xVSS_SlideTransition_Direction; + +/** + ****************************************************************************** + * struct M4xVSS_AlphaMagicSettings + * @brief This structure defines the slide transition settings + ****************************************************************************** +*/ + +typedef struct +{ + M4xVSS_SlideTransition_Direction direction; /* direction of the slide */ +} M4xVSS_SlideTransitionSettings; + +/** + ****************************************************************************** + * struct M4xVSS_TransitionSettings + * @brief This structure defines additional transition settings specific to + * xVSS, which are appended to the VSS3GPP transition settings + * structure. + ****************************************************************************** +*/ +typedef struct +{ + /* Anything xVSS-specific, but common to all transitions, would go here, + before the union. */ + union { + /**< AlphaMagic settings, used only if VideoTransitionType == + M4xVSS_kVideoTransitionType_AlphaMagic */ + M4xVSS_AlphaMagicSettings *pAlphaMagicSettings; + /* only in case of slide transition. */ + M4xVSS_SlideTransitionSettings *pSlideTransitionSettings; + } transitionSpecific; +} M4xVSS_TransitionSettings; + + +/** + ****************************************************************************** + * enum M4xVSS_MediaRendering + * @brief This enum defines different media rendering using exif orientation + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kResizing = 0, /*The picture is resized, the aspect ratio can be different + from the original one. All of the picture is rendered*/ + M4xVSS_kCropping, /*The picture is cropped, the aspect ratio is the same as + the original one. The picture is not rendered entirely*/ + M4xVSS_kBlackBorders /*Black borders are rendered in order to keep the original + aspect ratio. All the picture is rendered*/ + +} M4xVSS_MediaRendering; + + +/** + ****************************************************************************** + * struct M4xVSS_ClipSettings + * @brief This structure defines an input clip for the edition. + * @note It also contains the settings for the cut and begin/end effects applied to the clip. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_UInt32 uiBeginCutPercent; /**< Begin cut time, in percent of clip + duration (only for 3GPP clip !) */ + M4OSA_UInt32 uiEndCutPercent; /**< End cut time, in percent of clip + duration (only for 3GPP clip !) */ + M4OSA_UInt32 uiDuration; /**< Duration of the clip, if different + from 0, has priority on + uiEndCutTime or uiEndCutPercent */ + M4OSA_Bool isPanZoom; /**< RC: Boolean used to know if the + pan and zoom mode is enabled */ + M4OSA_UInt16 PanZoomXa; /**< RC */ + M4OSA_UInt16 PanZoomTopleftXa; /**< RC */ + M4OSA_UInt16 PanZoomTopleftYa; /**< RC */ + M4OSA_UInt16 PanZoomXb; /**< RC */ + M4OSA_UInt16 PanZoomTopleftXb; /**< RC */ + M4OSA_UInt16 PanZoomTopleftYb; /**< RC */ + M4xVSS_MediaRendering MediaRendering; /**< FB only used with JPEG: to crop, + resize, or render black borders*/ + +} M4xVSS_ClipSettings; + +/** + ****************************************************************************** + * struct M4xVSS_EditSettings + * @brief This structure gathers all the information needed to define a complete + * edition operation + ****************************************************************************** +*/ +typedef struct +{ + /**< Output video size */ + M4VIDEOEDITING_VideoFrameSize outputVideoSize; + /**< Output video format (MPEG4 / H263) */ + M4VIDEOEDITING_VideoFormat outputVideoFormat; + /**< Output audio format (AAC, AMRNB ...) */ + M4VIDEOEDITING_AudioFormat outputAudioFormat; + /**< Output audio sampling freq (8000Hz,...) */ + M4VIDEOEDITING_AudioSamplingFrequency outputAudioSamplFreq; + /**< Maximum output file size in BYTES (if set to 0, no limit */ + M4OSA_UInt32 outputFileSize; + /**< Is output audio must be Mono ? Valid only for AAC */ + M4OSA_Bool bAudioMono; + /**< Output video bitrate*/ + M4OSA_UInt32 outputVideoBitrate; + /**< Output audio bitrate*/ + M4OSA_UInt32 outputAudioBitrate; + /**< Background music track settings */ + M4xVSS_BGMSettings *pBGMtrack; + /**< Function pointer on text rendering engine, if not used, must be set to NULL !! */ + M4xVSS_getTextRgbBufferFct pTextRenderingFct; + +} M4xVSS_EditSettings; + +#endif /* __M4VSS3GPP_EXTENDED_API_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_InternalConfig.h b/libvideoeditor/vss/inc/M4VSS3GPP_InternalConfig.h new file mode 100755 index 0000000..3926427 --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_InternalConfig.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __M4VSS3GPP_INTERNALCONFIG_H__ +#define __M4VSS3GPP_INTERNALCONFIG_H__ + +/** + ****************************************************************************** + * @file M4VSS3GPP_InternalConfig.h + * @brief This file contains some magical and configuration parameters. + ****************************************************************************** +*/ + +/***********************/ +/* VideoEdition config */ +/***********************/ + +#define M4VSS3GPP_MINIMAL_TRANSITION_DURATION 100 /**< 100 milliseconds */ +#define M4VSS3GPP_NB_AU_PREFETCH 4 /**< prefect 4 AUs */ +#define M4VSS3GPP_NO_STSS_JUMP_POINT 40000 /**< If 3gp file does not contain + an STSS table (no rap frames), + jump backward 40 s maximum */ + +/*****************/ +/* Writer config */ +/*****************/ + +#define M4VSS3GPP_WRITER_AUDIO_STREAM_ID 1 +#define M4VSS3GPP_WRITER_VIDEO_STREAM_ID 2 + +/**< Max AU size will be 0.8 times the YUV4:2:0 frame size */ +#define M4VSS3GPP_VIDEO_MIN_COMPRESSION_RATIO 0.9F +/**< Max chunk size will be 1.2 times the max AU size */ +#define M4VSS3GPP_VIDEO_AU_SIZE_TO_CHUNCK_SIZE_RATIO 1.2F + +/** READ CAREFULLY IN CASE OF REPORTED RUNNING TROUBLES +The max AU size is used to pre-set max size of AU that can be written in the 3GP writer +For audio standard with variable AU size, there could be some encoding settings leading to AU size +exceeding this limit. +For AAC streams for instance the average AU size is given by: +av AU size = (av bitrate * 1024)/(sampling freq) +If VSS returns the message: +>> ERROR: audio AU size (XXXX) to copy larger than allocated one (YYYY) => abort +>> PLEASE CONTACT SUPPORT TO EXTEND MAX AU SIZE IN THE PRODUCT LIBRARY +Error is most likely to happen when mixing with audio full replacement + */ +/**< AAC max AU size - READ EXPLANATION ABOVE */ +#define M4VSS3GPP_AUDIO_MAX_AU_SIZE 2048 +/**< set to x4 max AU size per chunk */ +#define M4VSS3GPP_AUDIO_MAX_CHUNCK_SIZE 8192 + + +/***********************/ +/* H263 / MPEG4 config */ +/***********************/ + +#define M4VSS3GPP_EDIT_H263_MODULO_TIME 255 + +#ifdef BIG_ENDIAN +/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/ +#define M4VSS3GPP_EDIT_GOV_HEADER 0x000001b3 +#else +/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/ +#define M4VSS3GPP_EDIT_GOV_HEADER 0xb3010000 +#endif + +/**************/ +/* AMR config */ +/**************/ + +#define M4VSS3GPP_WRITTEN_AMR_TRACK_TIME_SCALE 8000 +#define M4VSS3GPP_AMR_DECODED_PCM_SAMPLE_NUMBER 160 /**< 20ms at 8000hz --> + 20x8=160 samples */ +#define M4VSS3GPP_AMR_DEFAULT_BITRATE 12200 /**< 12.2 kbps */ + +/**************/ +/* EVRC config */ +/**************/ + +#define M4VSS3GPP_EVRC_DEFAULT_BITRATE 9200 /**< 9.2 kbps */ + +/**************/ +/* MP3 config */ +/**************/ + +/** Macro to make a jump on the MP3 track on several steps + To avoid to block the system with an long MP3 jump, this process + is divided on several steps. + */ +#define M4VSS3GPP_MP3_JUMPED_AU_NUMBER_MAX 100 + +/** Macro to define the number of read AU to analyse the bitrate + So the process will read the first n AU of the MP3 stream to get + the average bitrate. n is defined by this define. + */ +#define M4VSS3GPP_MP3_AU_NUMBER_MAX 500 + +/*****************************/ +/* define AMR silence frames */ +/*****************************/ + +#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE 13 +#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_DURATION 160 + +#ifdef M4VSS3GPP_SILENCE_FRAMES +const M4OSA_UInt8 M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE] = +{ + 0x04, 0xFF, 0x18, 0xC7, 0xF0, 0x0D, 0x04, 0x33, + 0xFF, 0xE0, 0x00, 0x00, 0x00 +}; +#else +extern const M4OSA_UInt8 \ + M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE]; +#endif + +/*****************************/ +/* define AAC silence frames */ +/*****************************/ + +#define M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE 4 + +#ifdef M4VSS3GPP_SILENCE_FRAMES +const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE] = +{ + 0x00, 0xC8, 0x20, 0x07 +}; +#else +extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE]; +#endif + +#define M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE 6 + +#ifdef M4VSS3GPP_SILENCE_FRAMES +const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE] = +{ + 0x21, 0x10, 0x03, 0x20, 0x54, 0x1C +}; +#else +extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE]; +#endif + +#endif /* __M4VSS3GPP_INTERNALCONFIG_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_InternalFunctions.h b/libvideoeditor/vss/inc/M4VSS3GPP_InternalFunctions.h new file mode 100755 index 0000000..aeddd97 --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_InternalFunctions.h @@ -0,0 +1,663 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + ****************************************************************************** + * @file M4VSS3GPP_InternalFunctions.h + * @brief This file contains all function prototypes not visible to the external world. + * @note + ****************************************************************************** +*/ + + +#ifndef __M4VSS3GPP_INTERNALFUNCTIONS_H__ +#define __M4VSS3GPP_INTERNALFUNCTIONS_H__ + +#include "NXPSW_CompilerSwitches.h" +/** + * VSS public API and types */ +#include "M4VSS3GPP_API.h" + +/** + * VSS private types */ +#include "M4VSS3GPP_InternalTypes.h" + + +#include "M4READER_Common.h" /**< for M4_AccessUnit definition */ + +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS +#include "M4VD_HW_API.h" +#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* All errors are fatal in the VSS */ +#define M4ERR_CHECK_RETURN(err) if(M4NO_ERROR!=err) return err; + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intEditStepVideo() + * @brief One step of video processing + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intEditStepVideo(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intEditStepAudio() + * @brief One step of audio processing + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intEditStepAudio(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intEditStepMP3() + * @brief One step of audio processing for the MP3 clip + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intEditStepMP3(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intOpenClip() + * @brief Open next clip + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intOpenClip(M4VSS3GPP_InternalEditContext *pC, M4VSS3GPP_ClipContext **hClip, + M4VSS3GPP_ClipSettings *pClipSettings); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intDestroyVideoEncoder() + * @brief Destroy the video encoder + * @note + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intDestroyVideoEncoder(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intCreateVideoEncoder() + * @brief Creates the video encoder + * @note + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intCreateVideoEncoder(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intReachedEndOfVideo() + * @brief Do what to do when the end of a clip video track is reached + * @note If there is audio on the current clip, process it, else switch to the next clip + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intReachedEndOfVideo(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intReachedEndOfAudio() + * @brief Do what to do when the end of a clip audio track is reached + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intReachedEndOfAudio(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intCheckClipCompatibleWithVssEditing() + * @brief Check if the clip is compatible with VSS editing + * @note + * @param pClipCtxt (IN) internal clip context + * @param pClipProperties (OUT) Pointer to a valid ClipProperties structure. + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intCheckClipCompatibleWithVssEditing(M4VIDEOEDITING_ClipProperties \ + *pClipProperties); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipOpen() + * @brief Open a clip. Creates a clip context. + * @note + * @param hClipCtxt (OUT) Return the internal clip context + * @param pClipSettings (IN) Edit settings of this clip. The module will keep a + * reference to this pointer + * @param pFileReadPtrFct (IN) Pointer to OSAL file reader functions + * @param bSkipAudioTrack (IN) If true, do not open the audio + * @param bFastOpenMode (IN) If true, use the fast mode of the 3gpp reader + * (only the first AU is read) + * @return M4NO_ERROR: No error + * @return M4ERR_ALLOC: There is no more available memory + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipInit ( + M4VSS3GPP_ClipContext **hClipCtxt, + M4OSA_FileReadPointer *pFileReadPtrFct +); + +M4OSA_ERR M4VSS3GPP_intClipOpen ( + M4VSS3GPP_ClipContext *pClipCtxt, + M4VSS3GPP_ClipSettings *pClipSettings, + M4OSA_Bool bSkipAudioTrack, + M4OSA_Bool bFastOpenMode, + M4OSA_Bool bAvoidOpeningVideoDec +); + + +/** + ****************************************************************************** + * M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack() + * @brief Delete the audio track. Clip will be like if it had no audio track + * @note + * @param pClipCtxt (IN) Internal clip context + ****************************************************************************** +*/ +M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack(M4VSS3GPP_ClipContext *pClipCtxt); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipDecodeVideoUpToCurrentTime() + * @brief Jump to the previous RAP and decode up to the current video time + * @param pClipCtxt (IN) Internal clip context + * @param iCts (IN) Target CTS + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipDecodeVideoUpToCts(M4VSS3GPP_ClipContext* pClipCtxt, M4OSA_Int32 iCts); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipReadNextAudioFrame() + * @brief Read one AU frame in the clip + * @note + * @param pClipCtxt (IN) Internal clip context + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipReadNextAudioFrame(M4VSS3GPP_ClipContext *pClipCtxt); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipDecodeCurrentAudioFrame() + * @brief Decode the current AUDIO frame. + * @note + * @param pClipCtxt (IN) internal clip context + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipDecodeCurrentAudioFrame(M4VSS3GPP_ClipContext *pClipCtxt); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipJumpAudioAt() + * @brief Jump in the audio track of the clip. + * @note + * @param pClipCtxt (IN) internal clip context + * @param pJumpCts (IN/OUT) in:target CTS, out: reached CTS + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipJumpAudioAt(M4VSS3GPP_ClipContext *pClipCtxt, M4OSA_Int32 *pJumpCts); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intClipClose() + * @brief Close a clip. Destroy the context. + * @note + * @param pClipCtxt (IN) Internal clip context + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intClipClose(M4VSS3GPP_ClipContext *pClipCtxt); + +M4OSA_ERR M4VSS3GPP_intClipCleanUp(M4VSS3GPP_ClipContext *pClipCtxt); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intEditJumpMP3() + * @brief One step of jumping processing for the MP3 clip. + * @note On one step, the jump of several AU is done + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intEditJumpMP3(M4VSS3GPP_InternalEditContext *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_registerWriter() + * @brief This function will register a specific file format writer. + * @note According to the Mediatype, this function will store in the internal context + * the writer context. + * @param pContext: (IN) Execution context. + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER pContext,pWtrGlobalInterface or pWtrDataInterface is + * M4OSA_NULL (debug only), or invalid MediaType + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_registerWriter(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4WRITER_OutputFileType MediaType, + M4WRITER_GlobalInterface* pWtrGlobalInterface, + M4WRITER_DataInterface* pWtrDataInterface); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_registerEncoder() + * @brief This function will register a specific video encoder. + * @note According to the Mediatype, this function will store in the internal context + * the encoder context. + * @param pContext: (IN) Execution context. + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER pContext or pEncGlobalInterface is M4OSA_NULL (debug only), + * or invalid MediaType + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_registerVideoEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4ENCODER_Format MediaType, + M4ENCODER_GlobalInterface *pEncGlobalInterface); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_registerAudioEncoder() + * @brief This function will register a specific audio encoder. + * @note According to the Mediatype, this function will store in the internal context + * the encoder context. + * @param pContext: (IN) Execution context. + * @param mediaType: (IN) The media type. + * @param pEncGlobalInterface: (OUT) the encoder interface functions. + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER: pContext or pEncGlobalInterface is M4OSA_NULL (debug only) + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_registerAudioEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4ENCODER_AudioFormat MediaType, + M4ENCODER_AudioGlobalInterface *pEncGlobalInterface); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_registerReader() + * @brief Register reader. + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_registerReader(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4READER_MediaType mediaType, + M4READER_GlobalInterface *pRdrGlobalInterface, + M4READER_DataInterface *pRdrDataInterface); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_registerVideoDecoder() + * @brief Register video decoder + * @param pContext (IN/OUT) VSS context. + * @param decoderType (IN) Decoder type + * @param pDecoderInterface (IN) Decoder interface. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only), or the decoder type + * is invalid + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_registerVideoDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4DECODER_VideoType decoderType, + M4DECODER_VideoInterface *pDecoderInterface); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_registerAudioDecoder() + * @brief Register audio decoder + * @note This function is used internaly by the VSS to register audio decoders, + * @param context (IN/OUT) VSS context. + * @param decoderType (IN) Audio decoder type + * @param pDecoderInterface (IN) Audio decoder interface. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null, or the decoder type is invalid + * (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_registerAudioDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4AD_Type decoderType, + M4AD_Interface *pDecoderInterface); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_unRegisterAllWriters() + * @brief Unregister writer + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_unRegisterAllWriters(M4VSS3GPP_MediaAndCodecCtxt *pC); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_unRegisterAllEncoders() + * @brief Unregister the encoders + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_unRegisterAllEncoders(M4VSS3GPP_MediaAndCodecCtxt *pC); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_unRegisterAllReaders() + * @brief Unregister reader + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_unRegisterAllReaders(M4VSS3GPP_MediaAndCodecCtxt *pC); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_unRegisterAllDecoders() + * @brief Unregister the decoders + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_unRegisterAllDecoders(M4VSS3GPP_MediaAndCodecCtxt *pC); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentWriter() + * @brief Set current writer + * @param pContext (IN/OUT) VSS context. + * @param mediaType (IN) Media type. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + * @return M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED: Media type not supported + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentWriter(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4VIDEOEDITING_FileType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentVideoEncoder() + * @brief Set a video encoder + * @param pContext (IN/OUT) VSS context. + * @param MediaType (IN) Encoder type + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + * @return M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED: Media type not supported + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentVideoEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4SYS_StreamType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentAudioEncoder() + * @brief Set an audio encoder + * @param context (IN/OUT) VSS context. + * @param MediaType (IN) Encoder type + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentAudioEncoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4SYS_StreamType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentReader() + * @brief Set current reader + * @param pContext (IN/OUT) VSS context. + * @param mediaType (IN) Media type. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + * @return M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED: Media type not supported + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentReader(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4VIDEOEDITING_FileType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentVideoDecoder() + * @brief Set a video decoder + * @param pContext (IN/OUT) VSS context. + * @param decoderType (IN) Decoder type + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + * @return M4WAR_VSS_MEDIATYPE_NOT_SUPPORTED: Media type not supported + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentVideoDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4_StreamType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_setCurrentAudioDecoder() + * @brief Set an audio decoder + * @param context (IN/OUT) VSS context. + * @param decoderType (IN) Decoder type + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: A parameter is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_setCurrentAudioDecoder(M4VSS3GPP_MediaAndCodecCtxt *pC, + M4_StreamType mediaType); + +/** + ************************************************************************ + * M4OSA_ERR M4VSS3GPP_clearInterfaceTables() + * @brief Clear encoders, decoders, reader and writers interfaces tables + * @param pContext (IN/OUT) VSS context. + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: The context is null + ************************************************************************ +*/ +M4OSA_ERR M4VSS3GPP_clearInterfaceTables(M4VSS3GPP_MediaAndCodecCtxt *pC); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_SubscribeMediaAndCodec() + * @brief This function registers the reader, decoders, writers and encoders + * in the VSS. + * @note + * @param pContext: (IN) Execution context. + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER pContext is NULL + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_subscribeMediaAndCodec(M4VSS3GPP_MediaAndCodecCtxt *pContext); + +/** + ****************************************************************************** + * M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_AMRNB() + * @brief Return the length, in bytes, of the AMR Narrow-Band frame contained in the given buffer + * @note + * @param pAudioFrame (IN) AMRNB frame + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_AMRNB(M4OSA_MemAddr8 pAudioFrame); + +/** + ****************************************************************************** + * M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_EVRC() + * @brief Return the length, in bytes, of the EVRC frame contained in the given buffer + * @note + * 0 1 2 3 + * +-+-+-+-+ + * |fr type| RFC 3558 + * +-+-+-+-+ + * + * Frame Type: 4 bits + * The frame type indicates the type of the corresponding codec data + * frame in the RTP packet. + * + * For EVRC and SMV codecs, the frame type values and size of the + * associated codec data frame are described in the table below: + * + * Value Rate Total codec data frame size (in octets) + * --------------------------------------------------------- + * 0 Blank 0 (0 bit) + * 1 1/8 2 (16 bits) + * 2 1/4 5 (40 bits; not valid for EVRC) + * 3 1/2 10 (80 bits) + * 4 1 22 (171 bits; 5 padded at end with zeros) + * 5 Erasure 0 (SHOULD NOT be transmitted by sender) + * + * @param pCpAudioFrame (IN) EVRC frame + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_UInt32 M4VSS3GPP_intGetFrameSize_EVRC(M4OSA_MemAddr8 pAudioFrame); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intBuildAnalysis() + * @brief Get video and audio properties from the clip streams + * @note This function must return fatal errors only (errors that should not happen in the + * final integrated product). + * @param pClipCtxt (IN) internal clip context + * @param pClipProperties (OUT) Pointer to a valid ClipProperties structure. + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intBuildAnalysis(M4VSS3GPP_ClipContext *pClipCtxt, + M4VIDEOEDITING_ClipProperties *pClipProperties); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intCreateAudioEncoder() + * @brief Reset the audio encoder (Create it if needed) + * @note + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intCreateAudioEncoder(M4VSS3GPP_EncodeWriteContext *pC_ewc, + M4VSS3GPP_MediaAndCodecCtxt *pC_ShellAPI, + M4OSA_UInt32 uiAudioBitrate); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intCreate3GPPOutputFile() + * @brief Creates and prepare the output MP3 file + * @note Creates the writer, Creates the output file, Adds the streams, Readies the + * writing process + * @param pC (IN/OUT) Internal edit context + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intCreate3GPPOutputFile(M4VSS3GPP_EncodeWriteContext *pC_ewc, + M4VSS3GPP_MediaAndCodecCtxt *pC_ShellAPI, + M4OSA_FileWriterPointer *pOsaFileWritPtr, + M4OSA_Void* pOutputFile, + M4OSA_FileReadPointer *pOsaFileReadPtr, + M4OSA_Void* pTempFile, + M4OSA_UInt32 maxOutputFileSize); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intAudioMixingCompatibility() + * @brief This function allows checking if two clips are compatible with each other for + * VSS 3GPP audio mixing feature. + * @note + * @param pC (IN) Context of the audio mixer + * @param pInputClipProperties (IN) Clip analysis of the first clip + * @param pAddedClipProperties (IN) Clip analysis of the second clip + * @return M4NO_ERROR: No error + * @return M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION + * @return M4VSS3GPP_ERR_INPUT_CLIP_IS_NOT_A_3GPP + * @return M4NO_ERROR + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intAudioMixingCompatibility(M4VSS3GPP_InternalAudioMixingContext *pC, + M4VIDEOEDITING_ClipProperties \ + *pInputClipProperties, + M4VIDEOEDITING_ClipProperties \ + *pAddedClipProperties); + +/** + ****************************************************************************** + * M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack() + * @brief Delete the audio track. Clip will be like if it had no audio track + * @note + * @param pClipCtxt (IN) Internal clip context + ****************************************************************************** +*/ +M4OSA_Void M4VSS3GPP_intClipDeleteAudioTrack(M4VSS3GPP_ClipContext *pClipCtxt); + +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS +M4OSA_ERR M4VSS3GPP_intClipRegisterExternalVideoDecoder(M4VSS3GPP_ClipContext *pClipCtxt, + M4VD_VideoType decoderType, + M4VD_Interface* pDecoderInterface, + M4OSA_Void* pUserData); +#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ + +/****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intStartAU() + * @brief StartAU writer-like interface used for the VSS 3GPP only + * @note + * @param pContext: (IN) It is the VSS 3GPP context in our case + * @param streamID: (IN) Id of the stream to which the Access Unit is related. + * @param pAU: (IN/OUT) Access Unit to be prepared. + * @return M4NO_ERROR: there is no error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intStartAU(M4WRITER_Context pContext, M4SYS_StreamID streamID, + M4SYS_AccessUnit* pAU); + +/****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intProcessAU() + * @brief ProcessAU writer-like interface used for the VSS 3GPP only + * @note + * @param pContext: (IN) It is the VSS 3GPP context in our case + * @param streamID: (IN) Id of the stream to which the Access Unit is related. + * @param pAU: (IN/OUT) Access Unit to be written + * @return M4NO_ERROR: there is no error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intProcessAU(M4WRITER_Context pContext, M4SYS_StreamID streamID, + M4SYS_AccessUnit* pAU); + +/** + ****************************************************************************** + * M4OSA_ERR M4VSS3GPP_intVPP() + * @brief We implement our own VideoPreProcessing function + * @note It is called by the video encoder + * @param pContext (IN) VPP context, which actually is the VSS 3GPP context in our case + * @param pPlaneIn (IN) + * @param pPlaneOut (IN/OUT) Pointer to an array of 3 planes that will contain the + * output YUV420 image + * @return M4NO_ERROR: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_intVPP(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + M4VIFI_ImagePlane* pPlaneOut); + +#ifdef __cplusplus +} +#endif + +#endif /* __M4VSS3GPP_INTERNALFUNCTIONS_H__ */ + diff --git a/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h b/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h new file mode 100755 index 0000000..55513bc --- /dev/null +++ b/libvideoeditor/vss/inc/M4VSS3GPP_InternalTypes.h @@ -0,0 +1,779 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + ****************************************************************************** + * @file M4VSS3GPP_InternalTypes.h + * @brief This file contains all enum and types not visible to the external world. + * @note + ****************************************************************************** +*/ + + +#ifndef __M4VSS3GPP_INTERNALTYPES_H__ +#define __M4VSS3GPP_INTERNALTYPES_H__ + +#define M4VSS_VERSION_MAJOR 3 +#define M4VSS_VERSION_MINOR 2 +#define M4VSS_VERSION_REVISION 5 + +#include "NXPSW_CompilerSwitches.h" + +/** + * VSS public API and types */ +#include "M4VSS3GPP_API.h" + +/** + * Internally used modules */ +#include "M4READER_Common.h" /**< Reader common interface */ +#include "M4WRITER_common.h" /**< Writer common interface */ +#include "M4DECODER_Common.h" /**< Decoder common interface */ +#include "M4ENCODER_common.h" /**< Encoder common interface */ +#include "M4VIFI_FiltersAPI.h" /**< Image planes definition */ +#include "M4READER_3gpCom.h" /**< Read 3GPP file */ +#include "M4AD_Common.h" /**< Decoder audio */ +#include "M4ENCODER_AudioCommon.h" /**< Encode audio */ + + +#include "SSRC.h" /**< SSRC */ +#include "From2iToMono_16.h" /**< Stereo to Mono */ +#include "MonoTo2I_16.h" /**< Mono to Stereo */ + +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS +#include "M4VD_HW_API.h" +#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define WINDOW_SIZE 10 +/** + ****************************************************************************** + * enum M4VSS3GPP_EditState + * @brief Main state machine of the VSS 3GPP edit operation. + ****************************************************************************** +*/ + +typedef enum +{ + M4VSS3GPP_kEditState_CREATED = 0, /**< M4VSS3GPP_editInit has been called */ + M4VSS3GPP_kEditState_VIDEO = 1, /**< Processing video track */ + M4VSS3GPP_kEditState_AUDIO = 2, /**< Processing audio track */ + M4VSS3GPP_kEditState_MP3 = 3, /**< Processing MP3 audio track */ + M4VSS3GPP_kEditState_MP3_JUMP = 4, /**< Processing a jump in a MP3 audio track */ + M4VSS3GPP_kEditState_FINISHED = 5, /**< Processing done, VSS 3GPP can be closed */ + M4VSS3GPP_kEditState_CLOSED = 6 /**< Output file has been closed, + VSS 3GPP can be destroyed */ +} +M4VSS3GPP_EditState; + +typedef enum +{ + M4VSS3GPP_kEditVideoState_READ_WRITE = 10, /**< Doing Read/Write operation + (no decoding/encoding) */ + M4VSS3GPP_kEditVideoState_BEGIN_CUT = 11, /**< Decode encode to create an I frame */ + M4VSS3GPP_kEditVideoState_DECODE_ENCODE = 12, /**< Doing Read-Decode/Filter/ + Encode-Write operation */ + M4VSS3GPP_kEditVideoState_TRANSITION = 13, /**< Transition; blending of two videos */ + M4VSS3GPP_kEditVideoState_AFTER_CUT = 14 /**< Special Read/Write mode after a + begin cut (time frozen) */ +} +M4VSS3GPP_EditVideoState; + +typedef enum +{ + M4VSS3GPP_kEditAudioState_READ_WRITE = 20, /**< Doing Read/Write operation + (no decoding/encoding) */ + M4VSS3GPP_kEditAudioState_DECODE_ENCODE = 21, /**< Doing Read-Decode/Filter/ + Encode-Write operation */ + M4VSS3GPP_kEditAudioState_TRANSITION = 22 /**< Transition; blending of two audio */ +} +M4VSS3GPP_EditAudioState; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_ClipStatus + * @brief Status of the clip. + ****************************************************************************** +*/ +typedef enum +{ + M4VSS3GPP_kClipStatus_READ = 0, /**< The clip is currently ready for reading */ + M4VSS3GPP_kClipStatus_DECODE = 1, /**< The clip is currently ready for decoding */ + M4VSS3GPP_kClipStatus_DECODE_UP_TO = 2 /**< The clip is currently in splitted + decodeUpTo() processing */ +} +M4VSS3GPP_ClipStatus; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_ClipCurrentEffect + * @brief Current effect applied to the clip. + ****************************************************************************** +*/ +typedef enum +{ + M4VSS3GPP_kClipCurrentEffect_NONE = 0, /**< None */ + M4VSS3GPP_kClipCurrentEffect_BEGIN = 1, /**< Begin effect currently applied */ + M4VSS3GPP_kClipCurrentEffect_END = 2 /**< End effect currently applied */ +} +M4VSS3GPP_ClipCurrentEffect; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_AudioMixingState + * @brief Main state machine of the VSS audio mixing operation. + ****************************************************************************** +*/ +typedef enum +{ + M4VSS3GPP_kAudioMixingState_VIDEO = 0, /**< Video is being processed */ + M4VSS3GPP_kAudioMixingState_AUDIO_FIRST_SEGMENT, /**< Audio is being processed */ + M4VSS3GPP_kAudioMixingState_AUDIO_SECOND_SEGMENT, /**< Audio is being processed */ + M4VSS3GPP_kAudioMixingState_AUDIO_THIRD_SEGMENT, /**< Audio is being processed */ + M4VSS3GPP_kAudioMixingState_FINISHED /**< Processing finished, user must now + call M4VSS3GPP_audioMixingCleanUp*/ +} +M4VSS3GPP_AudioMixingState; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_ExtractPictureState + * @brief Main state machine of the VSS picture extraction. + ****************************************************************************** +*/ +typedef enum +{ + M4VSS3GPP_kExtractPictureState_OPENED = 0, /**< Video clip is opened and ready to be read + until the RAP before the picture to extract */ + M4VSS3GPP_kExtractPictureState_PROCESS = 1, /**< Video is decoded from the previous RAP + to the picture to extract */ + M4VSS3GPP_kExtractPictureState_EXTRACTED= 2 /**< Video AU has been decoded, user must now + call M4VSS3GPP_extractPictureCleanUp */ +} +M4VSS3GPP_ExtractPictureState; + + +/** + ****************************************************************************** + * @brief Codecs registration same as in VPS and VES, so less mapping + * is required toward VSS api types + ****************************************************************************** +*/ +typedef struct +{ + M4WRITER_GlobalInterface* pGlobalFcts; /**< open, close, setoption,etc... functions */ + M4WRITER_DataInterface* pDataFcts; /**< data manipulation functions */ +} M4VSS3GPP_WriterInterface; +/** + ****************************************************************************** + * struct AAC_DEC_STREAM_PROPS + * @brief AAC Stream properties + * @Note aNoChan and aSampFreq are used for parsing even the user parameters + * are different. User parameters will be input for the output behaviour + * of the decoder whereas for parsing bitstream properties are used. + ****************************************************************************** + */ +typedef struct { + M4OSA_Int32 aAudioObjectType; /**< Audio object type of the stream - in fact + the type found in the Access Unit parsed */ + M4OSA_Int32 aNumChan; /**< number of channels (=1(mono) or =2(stereo)) + as indicated by input bitstream*/ + M4OSA_Int32 aSampFreq; /**< sampling frequency in Hz */ + M4OSA_Int32 aExtensionSampFreq; /**< extended sampling frequency in Hz, = 0 is + no extended frequency */ + M4OSA_Int32 aSBRPresent; /**< presence=1/absence=0 of SBR */ + M4OSA_Int32 aPSPresent; /**< presence=1/absence=0 of PS */ + M4OSA_Int32 aMaxPCMSamplesPerCh; /**< max number of PCM samples per channel */ +} AAC_DEC_STREAM_PROPS; + + +/** + ****************************************************************************** + * enum M4VSS3GPP_MediaAndCodecCtxt + * @brief Filesystem and codec registration function pointers + ****************************************************************************** +*/ +typedef struct { + /** + * Media and Codec registration */ + /**< Table of M4VES_WriterInterface structures for avalaible Writers list */ + M4VSS3GPP_WriterInterface WriterInterface[M4WRITER_kType_NB]; + /**< open, close, setoption,etc... functions of the used writer*/ + M4WRITER_GlobalInterface* pWriterGlobalFcts; + /**< data manipulation functions of the used writer */ + M4WRITER_DataInterface* pWriterDataFcts; + + /**< Table of M4ENCODER_GlobalInterface structures for avalaible encoders list */ + M4ENCODER_GlobalInterface* pVideoEncoderInterface[M4ENCODER_kVideo_NB]; + /**< Functions of the used encoder */ + M4ENCODER_GlobalInterface* pVideoEncoderGlobalFcts; + + M4OSA_Void* pVideoEncoderExternalAPITable[M4ENCODER_kVideo_NB]; + M4OSA_Void* pCurrentVideoEncoderExternalAPI; + M4OSA_Void* pVideoEncoderUserDataTable[M4ENCODER_kVideo_NB]; + M4OSA_Void* pCurrentVideoEncoderUserData; + + /**< Table of M4ENCODER_AudioGlobalInterface structures for avalaible encoders list */ + M4ENCODER_AudioGlobalInterface* pAudioEncoderInterface[M4ENCODER_kAudio_NB]; + /**< Table of internal/external flags for avalaible encoders list */ + M4OSA_Bool pAudioEncoderFlag[M4ENCODER_kAudio_NB]; + /**< Functions of the used encoder */ + M4ENCODER_AudioGlobalInterface* pAudioEncoderGlobalFcts; + + M4READER_GlobalInterface* m_pReaderGlobalItTable[M4READER_kMediaType_NB]; + M4READER_DataInterface* m_pReaderDataItTable[M4READER_kMediaType_NB]; + M4READER_GlobalInterface* m_pReader; + M4READER_DataInterface* m_pReaderDataIt; + M4OSA_UInt8 m_uiNbRegisteredReaders; + + M4DECODER_VideoInterface* m_pVideoDecoder; + M4DECODER_VideoInterface* m_pVideoDecoderItTable[M4DECODER_kVideoType_NB]; + M4OSA_UInt8 m_uiNbRegisteredVideoDec; +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS + M4OSA_Void* m_pCurrentVideoDecoderUserData; + M4OSA_Void* m_pVideoDecoderUserDataTable[M4DECODER_kVideoType_NB]; +#endif + + M4AD_Interface* m_pAudioDecoder; + M4AD_Interface* m_pAudioDecoderItTable[M4AD_kType_NB]; + /**< store indices of external decoders */ + M4OSA_Bool m_pAudioDecoderFlagTable[M4AD_kType_NB]; + + M4OSA_Void* pAudioEncoderUserDataTable[M4ENCODER_kAudio_NB]; + M4OSA_Void* pCurrentAudioEncoderUserData; + + M4OSA_Void* pAudioDecoderUserDataTable[M4AD_kType_NB]; + M4OSA_Void* pCurrentAudioDecoderUserData; + +#ifdef M4VSS_SUPPORT_OMX_CODECS + /* boolean to tell whether registered external OMX codecs should be freed during cleanup + or new codec registration*/ + M4OSA_Bool bAllowFreeingOMXCodecInterface; +#endif + + +} M4VSS3GPP_MediaAndCodecCtxt; + + +/** + ****************************************************************************** + * structure M4VSS3GPP_ClipContext + * @brief This structure contains informations related to one 3GPP clip (private) + * @note This structure is used to store the context related to one clip + ****************************************************************************** +*/ +typedef struct +{ + M4VSS3GPP_ClipSettings* pSettings; /**< Pointer to the clip settings + (not possessed) */ + + M4VSS3GPP_ClipStatus Vstatus; /**< Video status of the clip reading */ + M4VSS3GPP_ClipStatus Astatus; /**< Audio status of the clip reading */ + + M4OSA_Int32 iVoffset; /**< [Milliseconds] Offset between the + clip and the output video stream + (begin cut taken into account) */ + M4OSA_Int32 iAoffset; /**< [Timescale] Offset between the clip + and the output audio stream (begin + cut taken into account) */ + + /** + * 3GPP reader Stuff */ + M4OSA_FileReadPointer* pFileReadPtrFct; + M4OSA_Context pReaderContext; /**< Context of the 3GPP reader module */ + M4_VideoStreamHandler* pVideoStream; /**< Description of the read video stream */ + M4_AudioStreamHandler* pAudioStream; /**< Description of the read audio stream */ + M4_AccessUnit VideoAU; /**< Read video access unit (we do not use a + pointer to allocate later, because + most of the time we will need it) */ + M4_AccessUnit AudioAU; /**< Read audio access unit (we do not use a + pointer to allocate later, because most + of the time we will need it) */ + M4OSA_Bool bVideoAuAvailable; /**< Tell if a video AU is available + (previously read) */ + /**< Boolean only used to fix the BZZ bug... */ + M4OSA_Bool bFirstAuWritten; + + /** + * Video decoder stuff */ + M4OSA_Context pViDecCtxt; /**< Video decoder context */ + M4OSA_Int32 iVideoDecCts; /**< [Milliseconds] For video decodeUpTo(), + the actual reached cts */ + M4OSA_Int32 iVideoRenderCts; /**< [Milliseconds] For video render(), + the actual reached cts */ + M4OSA_Bool isRenderDup; /**< To handle duplicate frame rendering in + case of external decoding */ + M4VIFI_ImagePlane* lastDecodedPlane; /**< Last decoded plane */ + + /** + * MPEG4 time info stuff at clip level */ + M4OSA_Bool bMpeg4GovState; /**< Namely, update or initialization */ + M4OSA_UInt32 uiMpeg4PrevGovValueGet; /**< Previous Gov value read (in second) */ + M4OSA_UInt32 uiMpeg4PrevGovValueSet; /**< Previous Gov value write (in second) */ + + /** + * Time-line stuff */ + /**< [Milliseconds] CTS at which the video clip actually starts */ + M4OSA_Int32 iActualVideoBeginCut; + /**< [Milliseconds] CTS at which the audio clip actually starts */ + M4OSA_Int32 iActualAudioBeginCut; + /**< [Milliseconds] Time at which the clip must end */ + M4OSA_Int32 iEndTime; + + /** + * Audio decoder stuff */ + M4OSA_Context pAudioDecCtxt; /**< Context of the AMR decoder */ + M4AD_Buffer AudioDecBufferIn; /**< Input structure for the audio decoder */ + M4AD_Buffer AudioDecBufferOut; /**< Buffer for the decoded PCM data */ + AAC_DEC_STREAM_PROPS AacProperties; /**< Structure for new api to get AAC + properties */ + + /** + * Audio AU to Frame split stuff */ + M4OSA_Bool bAudioFrameAvailable; /**< True if an audio frame is available */ + M4OSA_MemAddr8 pAudioFramePtr; /**< Pointer to the Audio frame */ + M4OSA_UInt32 uiAudioFrameSize; /**< Size of the audio frame available */ + M4OSA_Int32 iAudioFrameCts; /**< [Timescale] CTS of the audio frame + available */ + + /** + * Silence frame stuff */ + /**< Size to reserve to store a pcm full of zeros compatible with master clip stream type */ + M4OSA_UInt32 uiSilencePcmSize; + /**< Pointer to silence frame data compatible with master clip stream type */ + M4OSA_UInt8* pSilenceFrameData; + /**< Size of silence frame data compatible with master clip stream type */ + M4OSA_UInt32 uiSilenceFrameSize; + /**< [Timescale] Duration of silence frame data compatible with master clip stream type */ + M4OSA_Int32 iSilenceFrameDuration; + M4OSA_Double scale_audio; /**< frequency / 1000.0 */ + + /** + * Interfaces of the used modules */ + /**< Filesystem and shell reader, decoder functions */ + M4VSS3GPP_MediaAndCodecCtxt ShellAPI; +} M4VSS3GPP_ClipContext; + + +/** + ****************************************************************************** + * enum anonymous enum + * @brief enum to keep track of the encoder state + ****************************************************************************** +*/ +enum +{ + M4VSS3GPP_kNoEncoder, + M4VSS3GPP_kEncoderClosed, + M4VSS3GPP_kEncoderStopped, + M4VSS3GPP_kEncoderRunning +}; + +/** + ****************************************************************************** + * structure M4VSS3GPP_AudioVideoContext + * @brief This structure defines the audio video context (private) + * @note This structure is used for all audio/video, encoding/writing operations. + ****************************************************************************** +*/ +typedef struct +{ + /** + * Timing Stuff */ + // Decorrelate input and output encoding timestamp to handle encoder prefetch + /**< [Milliseconds] Duration of the output file, used for progress computation */ + M4OSA_Double dInputVidCts; + /**< [Milliseconds] Current CTS of the video output stream */ + M4OSA_Double dOutputVidCts; +/**< [Milliseconds] Current CTS of the audio output stream */ + M4OSA_Double dATo; + /**< [Milliseconds] Duration of the output file, used for progress computation */ + M4OSA_Int32 iOutputDuration; + + /** + * Output Video Stream Stuff */ + M4SYS_StreamType VideoStreamType; /**< Output video codec */ + M4OSA_UInt32 uiVideoBitrate; /**< Average video bitrate of the output file, + computed from input bitrates, durations, + transitions and cuts */ + M4OSA_UInt32 uiVideoWidth; /**< Output image width */ + M4OSA_UInt32 uiVideoHeight; /**< Output image height */ + M4OSA_UInt32 uiVideoTimeScale; /**< Time scale to use for the encoding + of the transition (if MPEG-4) */ + M4OSA_Bool bVideoDataPartitioning; /**< Data partitioning to use for the + encoding of the transition + (if MPEG-4) */ + M4OSA_MemAddr8 pVideoOutputDsi; /**< Decoder Specific Info of the output + MPEG-4 track */ + M4OSA_UInt16 uiVideoOutputDsiSize; /**< Size of the Decoder Specific Info + of the output MPEG-4 track */ + M4OSA_Bool bActivateEmp; /**< Encode in Mpeg4 format with + limitations for EMP */ + + /** + * Output Audio Stream Stuff */ + M4SYS_StreamType AudioStreamType; /**< Type of the output audio stream */ + M4OSA_UInt32 uiNbChannels; /**< Number of channels in the output + stream (1=mono, 2=stereo) */ + M4OSA_UInt32 uiAudioBitrate; /**< Audio average bitrate (in bps) */ + M4OSA_UInt32 uiSamplingFrequency; /**< Sampling audio frequency (8000 for + amr, 16000 or more for aac) */ + M4OSA_MemAddr8 pAudioOutputDsi; /**< Decoder Specific Info of the + output audio track */ + M4OSA_UInt16 uiAudioOutputDsiSize; /**< Size of the Decoder Specific Info + of the output audio track */ + + /** + * Audio Encoder stuff */ + M4OSA_Context pAudioEncCtxt; /**< Context of the audio encoder */ + M4ENCODER_AudioDecSpecificInfo pAudioEncDSI; /**< Decoder specific info built by the + encoder */ + M4ENCODER_AudioParams AudioEncParams; /**< Config of the audio encoder */ + + /** + * Silence frame stuff */ + M4OSA_UInt32 uiSilencePcmSize; /**< Size to reserve to store a pcm full + of zeros compatible with master clip + stream type */ + M4OSA_UInt8* pSilenceFrameData; /**< Pointer to silence frame data + compatible with master clip + stream type */ + M4OSA_UInt32 uiSilenceFrameSize; /**< Size of silence frame data compatible + with master clip stream type */ + M4OSA_Int32 iSilenceFrameDuration; /**< [Timescale] Duration of silence frame + data compatible with master clip + stream type */ + M4OSA_Double scale_audio; /**< frequency / 1000.0 */ + + /** + * Video Encoder stuff */ + M4ENCODER_Context pEncContext; /**< Context of the encoder */ + M4WRITER_DataInterface OurWriterDataInterface; /**< Our own implementation of the + writer interface, to give to + the encoder shell */ + M4OSA_MemAddr32 pDummyAuBuffer; /**< Buffer given to the encoder for + it to write AUs we don't want + in the output */ + M4OSA_Int32 iMpeg4GovOffset; /**< Clip GOV offset in ms between + video and system time */ + M4OSA_ERR VppError; /**< Error for VPP are masked by Video + Encoder, so we must remember it */ + M4OSA_UInt32 encoderState; + + /** + * Writer stuff */ + M4WRITER_Context p3gpWriterContext; /**< Context of the 3GPP writer module */ + M4SYS_StreamDescription WriterVideoStream; /**< Description of the written + video stream */ + M4SYS_StreamDescription WriterAudioStream; /**< Description of the written + audio stream */ + M4WRITER_StreamVideoInfos WriterVideoStreamInfo; /**< Video properties of the written + video stream */ + M4WRITER_StreamAudioInfos WriterAudioStreamInfo; /**< Audio properties of the written + audio stream */ + M4SYS_AccessUnit WriterVideoAU; /**< Written video access unit */ + M4SYS_AccessUnit WriterAudioAU; /**< Written audio access unit */ + M4OSA_UInt32 uiVideoMaxAuSize; /**< Max AU size set to the writer + for the video */ + M4OSA_UInt32 uiAudioMaxAuSize; /**< Max AU size set to the writer + for the audio */ + M4OSA_UInt32 uiOutputAverageVideoBitrate; /**< Average video bitrate of the + output file, computed from + input bitrates, durations, + transitions and cuts */ + +} M4VSS3GPP_EncodeWriteContext; + + +/** + ****************************************************************************** + * structure M4VSS3GPP_InternalEditContext + * @brief This structure defines the edit VSS context (private) + * @note This structure is used for all VSS edit operations to store the context + ****************************************************************************** +*/ +typedef struct +{ + /** + * VSS 3GPP main variables */ + M4VSS3GPP_EditState State; /**< VSS internal state */ + M4VSS3GPP_EditVideoState Vstate; + M4VSS3GPP_EditAudioState Astate; + + /** + * User Settings (copied, thus owned by VSS3GPP) */ + M4OSA_UInt8 uiClipNumber; /**< Number of element of the clip + list pClipList. */ + M4VSS3GPP_ClipSettings *pClipList; /**< List of the input clips settings + Array of uiClipNumber clip settings */ + M4VSS3GPP_TransitionSettings *pTransitionList; /**< List of the transition settings. + Array of uiClipNumber-1 transition settings */ + M4VSS3GPP_EffectSettings *pEffectsList; /**< List of the effects settings. + Array of nbEffects RC */ + M4OSA_UInt8 *pActiveEffectsList; /**< List of the active effects + settings. Array of nbEffects RC */ + M4OSA_UInt8 nbEffects; /**< Numbers of effects RC */ + M4OSA_UInt8 nbActiveEffects; /**< Numbers of active effects RC */ + + /** + * Input Stuff */ + M4OSA_UInt8 uiCurrentClip; /**< Index of the current clip 1 in + the input clip list */ + M4VSS3GPP_ClipContext* pC1; /**< Context of the current clip 1 */ + M4VSS3GPP_ClipContext* pC2; /**< Context of the current clip 2 */ + + /** + * Decoder stuff */ + M4OSA_Double dOutputFrameDuration; /**< [Milliseconds] directly related to + output frame rate */ + M4VIFI_ImagePlane yuv1[3]; /**< First temporary YUV420 image plane */ + M4VIFI_ImagePlane yuv2[3]; /**< Second temporary YUV420 image plane */ + M4VIFI_ImagePlane yuv3[3]; /**< Third temporary YUV420 image plane RC */ + M4VIFI_ImagePlane yuv4[3]; /**< Fourth temporary YUV420 image plane RC */ + + /** + * Effect stuff */ + M4OSA_Bool bClip1AtBeginCut; /**< [Milliseconds] The clip1 is at + its begin cut */ + M4OSA_Int8 iClip1ActiveEffect; /**< The index of the active effect + on Clip1 (<0 means none) + (used for video and audio but + not simultaneously) */ + M4OSA_Int8 iClip2ActiveEffect; /**< The index of the active effect + on Clip2 (<0 means none) + (used for video and audio but + not simultaneously) */ + M4OSA_Bool bTransitionEffect; /**< True if the transition effect + must be applied at the current + time */ + + /** + * Encoding and Writing operations */ + M4OSA_Bool bSupportSilence; /**< Flag to know if the output stream can + support silence (even if not editable, + for example AAC+, but not EVRC) */ + M4VSS3GPP_EncodeWriteContext ewc; /**< Audio and video encode/write stuff */ + M4OSA_Bool bIsMMS; /**< Boolean used to know if we are + processing a file with an output + size constraint */ + M4OSA_UInt32 uiMMSVideoBitrate; /**< If in MMS mode, + targeted video bitrate */ + M4VIDEOEDITING_VideoFramerate MMSvideoFramerate; /**< If in MMS mode, + targeted video framerate */ + + /** + * Filesystem functions */ + M4OSA_FileReadPointer* pOsaFileReadPtr; /**< OSAL file read functions, + to be provided by user */ + M4OSA_FileWriterPointer* pOsaFileWritPtr; /**< OSAL file write functions, + to be provided by user */ + + /** + * Interfaces of the used modules */ + M4VSS3GPP_MediaAndCodecCtxt ShellAPI; /**< Filesystem and shell reader, + decoder functions */ +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS + struct + { + M4VD_Interface* pDecoderInterface; + M4OSA_Void* pUserData; + M4OSA_Bool registered; + } registeredExternalDecs[M4VD_kVideoType_NB]; +#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ + +#ifdef M4VSS_SUPPORT_OMX_CODECS + M4OSA_Context m_codecInterface[M4VSS3GPP_kCodecType_NB]; + M4OSA_Context pOMXUserData; +#endif + M4OSA_Bool bIssecondClip; + M4OSA_UInt8 *pActiveEffectsList1; /**< List of the active effects settings. Array of nbEffects RC */ + M4OSA_UInt8 nbActiveEffects1; /**< Numbers of active effects RC */ +} M4VSS3GPP_InternalEditContext; + + +/** + ****************************************************************************** + * structure M4VSS3GPP_InternalAudioMixingContext + * @brief This structure defines the audio mixing VSS 3GPP context (private) + * @note This structure is used for all VSS 3GPP audio mixing operations to store + * the context + ****************************************************************************** +*/ +typedef struct +{ + /** + * VSS main variables */ + M4VSS3GPP_AudioMixingState State; /**< VSS audio mixing internal state */ + + /** + * Internal copy of the input settings */ + M4OSA_Int32 iAddCts; /**< [Milliseconds] Time, in milliseconds, + at which the added audio track is + inserted */ + M4OSA_UInt32 uiBeginLoop; /**< Describes in milli-second the + start time of the loop */ + M4OSA_UInt32 uiEndLoop; /**< Describes in milli-second the end + time of the loop (0 means no loop) */ + M4OSA_Bool bRemoveOriginal; /**< If true, the original audio track + is not taken into account */ + + /** + * Input audio/video file */ + M4VSS3GPP_ClipSettings InputClipSettings; /**< Structure internally used to + manage the input 3GPP settings */ + M4VSS3GPP_ClipContext* pInputClipCtxt; /**< Context of the input 3GPP clip */ + + /** + * Added audio file stuff */ + M4VSS3GPP_ClipSettings AddedClipSettings; /**< Structure internally used to + manage the added settings */ + M4VSS3GPP_ClipContext* pAddedClipCtxt; /**< Context of the added 3GPP clip */ + + /** + * Audio stuff */ + M4OSA_Float fOrigFactor; /**< Factor to apply to the original + audio track for the mixing */ + M4OSA_Float fAddedFactor; /**< Factor to apply to the added + audio track for the mixing */ + M4OSA_Bool bSupportSilence; /**< Flag to know if the output stream can + support silence (even if not editable, + for example AAC+, but not EVRC) */ + M4OSA_Bool bHasAudio; /**< Flag to know if we have to delete + audio track */ + M4OSA_Bool bAudioMixingIsNeeded; /**< Flag to know if we have to do mixing */ + + /** + * Encoding and Writing operations */ + M4VSS3GPP_EncodeWriteContext ewc; /**< Audio and video encode/write stuff */ + + /** + * Filesystem functions */ + M4OSA_FileReadPointer* pOsaFileReadPtr; /**< OSAL file read functions, + to be provided by user */ + M4OSA_FileWriterPointer* pOsaFileWritPtr; /**< OSAL file write functions, + to be provided by user */ + + /** + * Interfaces of the used modules */ + M4VSS3GPP_MediaAndCodecCtxt ShellAPI; /**< Filesystem and shell reader, + decoder functions */ + + /** + * Sample Rate Convertor (SSRC) stuff (needed in case of mixing with != ASF/nb of channels) */ + M4OSA_Bool b_SSRCneeded; /**< If true, SSRC is needed + (!= ASF or nb of channels) */ + M4OSA_UInt8 ChannelConversion; /**< 1=Conversion from Mono to Stereo + 2=Stereo to Mono, 0=no conversion */ + SSRC_Instance_t SsrcInstance; /**< Context of the Ssrc */ + SSRC_Scratch_t* SsrcScratch; /**< Working memory of the Ssrc */ + short iSsrcNbSamplIn; /**< Number of sample the Ssrc needs as input */ + short iSsrcNbSamplOut; /**< Number of sample the Ssrc outputs */ + M4OSA_MemAddr8 pSsrcBufferIn; /**< Input of the SSRC */ + M4OSA_MemAddr8 pSsrcBufferOut; /**< Output of the SSRC */ + M4OSA_MemAddr8 pPosInSsrcBufferIn; /**< Position into the SSRC in buffer */ + M4OSA_MemAddr8 pPosInSsrcBufferOut;/**< Position into the SSRC out buffer */ + M4OSA_MemAddr8 pTempBuffer; /**< Temporary buffer */ + M4OSA_MemAddr8 pPosInTempBuffer; /**< Position in temporary buffer */ + M4OSA_UInt32 minimumBufferIn; /**< Minimum amount of decoded data to be + processed by SSRC and channel + convertor */ + M4OSA_Bool b_DuckingNeedeed; + M4OSA_Int32 InDucking_threshold; /**< Threshold value at which background + music shall duck */ + M4OSA_Float InDucking_lowVolume; /**< lower the background track to this + factor and increase the primary + track to inverse of this factor */ + M4OSA_Float lowVolume; + M4OSA_Int32 audioVolumeArray[WINDOW_SIZE]; // store peak audio vol. level + // for duration for WINDOW_SIZE + M4OSA_Int32 audVolArrIndex; + M4OSA_Float duckingFactor ; /**< multiply by this factor to bring + FADE IN/FADE OUT effect */ + M4OSA_Float fBTVolLevel; + M4OSA_Float fPTVolLevel; + M4OSA_Bool bDoDucking; + M4OSA_Bool bLoop; + M4OSA_Bool bNoLooping; + M4OSA_Int32 pLVAudioResampler; + M4OSA_Bool bjumpflag; + +} M4VSS3GPP_InternalAudioMixingContext; + + +/** + ****************************************************************************** + * structure M4VSS3GPP_InternalExtractPictureContext + * @brief This structure defines the extract picture VSS context (private) + * @note This structure is used for all VSS picture extractions to store the context + ****************************************************************************** +*/ +typedef struct +{ + /** + * VSS main variables */ + M4VSS3GPP_ExtractPictureState State; /**< VSS extract pictureinternal state */ + + /** + * Input files */ + M4VSS3GPP_ClipSettings ClipSettings; /**< Structure internally used to + manage the input 3FPP settings */ + M4VSS3GPP_ClipContext* pInputClipCtxt; /**< Context of the input 3GPP clip */ + + /** + * Settings */ + M4OSA_Int32 iExtractCts; /**< [Milliseconds] Cts of the AU + to be extracted */ + + /** + * Video stuff */ + M4VIFI_ImagePlane decPlanes[3]; /**< Decoded YUV420 picture plane */ + M4OSA_UInt32 uiVideoWidth; /**< Decoded image width */ + M4OSA_UInt32 uiVideoHeight; /**< Decoded image height */ + + /* + * Decoder info */ + M4OSA_Int32 iDecCts; /**< [Milliseconds] Decoded AU Cts */ + M4OSA_Bool bJumpFlag; /**< 1 if a jump has been made */ + M4OSA_Int32 iDeltaTime; /**< [Milliseconds] Time between previous RAP and + picture to extract */ + M4OSA_Int32 iGap; /**< [Milliseconds] Time between jump AU and + extraction time */ + M4OSA_UInt32 uiStep; /**< [Milliseconds] Progress bar time increment */ + + /** + * Filesystem functions */ + /**< OSAL file read functions, to be provided by user */ + M4OSA_FileReadPointer* pOsaFileReadPtr; + /**< OSAL file write functions, to be provided by user */ + M4OSA_FileWriterPointer* pOsaFileWritPtr; + + M4OSA_Bool bClipOpened; +} M4VSS3GPP_InternalExtractPictureContext; + + +#ifdef __cplusplus +} +#endif + +#endif /* __M4VSS3GPP_INTERNALTYPES_H__ */ + diff --git a/libvideoeditor/vss/inc/M4xVSS_API.h b/libvideoeditor/vss/inc/M4xVSS_API.h new file mode 100755 index 0000000..d69a17c --- /dev/null +++ b/libvideoeditor/vss/inc/M4xVSS_API.h @@ -0,0 +1,633 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __M4XVSS_API_H__ +#define __M4XVSS_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif +/** + ****************************************************************************** + * @file M4xVSS_API.h + * @brief API of Video Studio 2.1 + * @note + ****************************************************************************** +*/ + +#define M4VSS_SUPPORT_EXTENDED_FEATURES + +#include "M4VSS3GPP_API.h" +#include "M4VSS3GPP_Extended_API.h" + +/* Errors codes */ + +/** + * End of analyzing => the user can call M4xVSS_PreviewStart or M4xVSS_SaveStart */ +#define M4VSS3GPP_WAR_ANALYZING_DONE M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0001) + +/** + * End of preview generating => the user can launch vps to see preview. Once preview is over, + the user must call M4xVSS_PreviewStop() to be able to save edited file, or to call another + M4xVSS_SendCommand() */ +#define M4VSS3GPP_WAR_PREVIEW_READY M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0002) + +/** + * End of saved file generation => the user must call M4xVSS_SaveStop() */ +#define M4VSS3GPP_WAR_SAVING_DONE M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0003) + +/** + * Transcoding is necessary to go further -> if the user does not want to continue, + he must call M4xVSS_sendCommand() */ +#define M4VSS3GPP_WAR_TRANSCODING_NECESSARY M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0004) + +/** + * In case of MMS, the output file size won't be reached */ +#define M4VSS3GPP_WAR_OUTPUTFILESIZE_EXCEED M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0005) + +/** + * JPG input file dimensions are too high */ +#define M4VSS3GPP_ERR_JPG_TOO_BIG M4OSA_ERR_CREATE( M4_ERR, M4VS, 0x0001) + +/** + * UTF Conversion, warning on the size of the temporary converted buffer*/ +#define M4xVSSWAR_BUFFER_OUT_TOO_SMALL M4OSA_ERR_CREATE( M4_WAR, M4VS, 0x0006) + +/** + * SWIKAR :Error whan NO_MORE_SPACE*/ +#define M4xVSSERR_NO_MORE_SPACE M4OSA_ERR_CREATE( M4_ERR, M4VS, 0x0007) + +/** + ****************************************************************************** + * enum M4xVSS_VideoEffectType + * @brief This enumeration defines the video effect types of the xVSS + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kVideoEffectType_BlackAndWhite = M4VSS3GPP_kVideoEffectType_External+1, /* 257 */ + M4xVSS_kVideoEffectType_Pink, /* 258 */ + M4xVSS_kVideoEffectType_Green, /* 259 */ + M4xVSS_kVideoEffectType_Sepia, /* 260 */ + M4xVSS_kVideoEffectType_Negative, /* 261 */ + M4xVSS_kVideoEffectType_Framing, /* 262 */ + M4xVSS_kVideoEffectType_Text, /* Text overlay */ /* 263 */ + M4xVSS_kVideoEffectType_ZoomIn, /* 264 */ + M4xVSS_kVideoEffectType_ZoomOut, /* 265 */ + M4xVSS_kVideoEffectType_Fifties, /*266 */ + M4xVSS_kVideoEffectType_ColorRGB16, /*267 */ + M4xVSS_kVideoEffectType_Gradient /*268*/ +} M4xVSS_VideoEffectType; + +/** + ****************************************************************************** + * enum M4xVSS_VideoTransitionType + * @brief This enumeration defines the video effect that can be applied during a transition. + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kVideoTransitionType_External = M4VSS3GPP_kVideoTransitionType_External, /*256*/ + M4xVSS_kVideoTransitionType_AlphaMagic, + M4xVSS_kVideoTransitionType_SlideTransition, + M4xVSS_kVideoTransitionType_FadeBlack + +} M4xVSS_VideoTransitionType; + +/** + ****************************************************************************** + * struct M4xVSS_PreviewSettings + * @brief This structure gathers all the information needed by the VPS for preview + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Void *p3gpPreviewFile; + M4OSA_Void *pPCMFile; + M4VIDEOEDITING_AudioSamplingFrequency outPCM_ASF; + M4OSA_Bool bAudioMono; + M4VSS3GPP_EffectSettings *Effects; + M4OSA_UInt8 nbEffects; + +} M4xVSS_PreviewSettings; + +/** + ****************************************************************************** + * prototype M4xVSS_toUTF8Fct + * @brief This prototype defines the function implemented by the integrator + * to convert a string encoded in any format to an UTF8 string. + * @note + * + * @param pBufferIn IN Buffer containing the string to convert to UTF8 + * @param pBufferOut IN Buffer containing the UTF8 converted string + * @param bufferOutSize IN/OUT IN: Size of the given output buffer + * OUT: Size of the converted buffer + * + ****************************************************************************** +*/ +typedef M4OSA_ERR (*M4xVSS_toUTF8Fct) +( + M4OSA_Void *pBufferIn, + M4OSA_UInt8 *pBufferOut, + M4OSA_UInt32 *bufferOutSize +); + + +/** + ****************************************************************************** + * prototype M4xVSS_fromUTF8Fct + * @brief This prototype defines the function implemented by the integrator + * to convert an UTF8 string to a string encoded in any format. + * @note + * + * @param pBufferIn IN Buffer containing the UTF8 string to convert + * to the desired format. + * @param pBufferOut IN Buffer containing the converted string + * @param bufferOutSize IN/OUT IN: Size of the given output buffer + * OUT: Size of the converted buffer + * + ****************************************************************************** +*/ +typedef M4OSA_ERR (*M4xVSS_fromUTF8Fct) +( + M4OSA_UInt8 *pBufferIn, + M4OSA_Void *pBufferOut, + M4OSA_UInt32 *bufferOutSize +); + + + + +/** + ****************************************************************************** + * struct M4xVSS_InitParams + * @brief This structure defines parameters for xVSS. + * @note + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_FileReadPointer* pFileReadPtr; + M4OSA_FileWriterPointer* pFileWritePtr; + M4OSA_Void* pTempPath; + /*Function pointer on an external text conversion function */ + M4xVSS_toUTF8Fct pConvToUTF8Fct; + /*Function pointer on an external text conversion function */ + M4xVSS_fromUTF8Fct pConvFromUTF8Fct; + + + +} M4xVSS_InitParams; + +/** + ****************************************************************************** + * prototype M4xVSS_Init + * @brief This function initializes the xVSS + * @note Initializes the xVSS edit operation (allocates an execution context). + * + * @param pContext (OUT) Pointer on the xVSS edit context to allocate + * @param params (IN) Parameters mandatory for xVSS + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: Memory allocation has failed + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_Init(M4OSA_Context* pContext, M4xVSS_InitParams* params); + +/** + ****************************************************************************** + * prototype M4xVSS_ReduceTranscode + * @brief This function changes the given editing structure in order to + * minimize the transcoding time. + * @note The xVSS analyses this structure, and if needed, changes the + * output parameters (Video codec, video size, audio codec, + * audio nb of channels) to minimize the transcoding time. + * + * @param pContext (OUT) Pointer on the xVSS edit context to allocate + * @param pSettings (IN) Edition settings (allocated by the user) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: Memory allocation has failed + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_ReduceTranscode(M4OSA_Context pContext, M4VSS3GPP_EditSettings* pSettings); + +/** + ****************************************************************************** + * prototype M4xVSS_SendCommand + * @brief This function gives to the xVSS an editing structure + * @note The xVSS analyses this structure, and prepare edition + * This function must be called after M4xVSS_Init, after + * M4xVSS_CloseCommand, or after M4xVSS_PreviewStop. + * After this function, the user must call M4xVSS_Step until + * it returns another error than M4NO_ERROR. + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param pSettings (IN) Edition settings (allocated by the user) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: Memory allocation has failed + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_SendCommand(M4OSA_Context pContext, M4VSS3GPP_EditSettings* pSettings); + +/** + ****************************************************************************** + * prototype M4xVSS_PreviewStart + * @brief This function prepare the preview + * @note The xVSS create 3GP preview file and fill pPreviewSettings with + * preview parameters. + * This function must be called once M4xVSS_Step has returned + * M4VSS3GPP_WAR_ANALYZING_DONE + * After this function, the user must call M4xVSS_Step until + * it returns another error than M4NO_ERROR. + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param pPreviewSettings (IN) Preview settings (allocated by the user) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: Memory allocation has failed + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_PreviewStart(M4OSA_Context pContext, M4xVSS_PreviewSettings* pPreviewSettings); + +/** + ****************************************************************************** + * prototype M4xVSS_PreviewStop + * @brief This function unallocate preview ressources and change xVSS + * internal state to allow saving or resend an editing command + * @note This function must be called once M4xVSS_Step has returned + * M4VSS3GPP_WAR_PREVIEW_READY + * + * @param pContext (IN) Pointer on the xVSS edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_PreviewStop(M4OSA_Context pContext); + +/** + ****************************************************************************** + * prototype M4xVSS_SaveStart + * @brief This function prepare the save + * @note The xVSS create 3GP edited final file + * This function must be called once M4xVSS_Step has returned + * M4VSS3GPP_WAR_ANALYZING_DONE + * After this function, the user must call M4xVSS_Step until + * it returns another error than M4NO_ERROR. + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param pFilePath (IN) If the user wants to provide a different + * output filename, else can be NULL (allocated by the user) + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_ALLOC: Memory allocation has failed + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_SaveStart(M4OSA_Context pContext, M4OSA_Void* pFilePath, + M4OSA_UInt32 filePathSize); + +/** + ****************************************************************************** + * prototype M4xVSS_SaveStop + * @brief This function unallocate save ressources and change xVSS + * internal state. + * @note This function must be called once M4xVSS_Step has returned + * M4VSS3GPP_WAR_SAVING_DONE + * + * @param pContext (IN) Pointer on the xVSS edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_SaveStop(M4OSA_Context pContext); + +/** + ****************************************************************************** + * prototype M4xVSS_Step + * @brief This function executes differents tasks, depending of xVSS + * internal state. + * @note This function: + * - analyses editing structure if called after M4xVSS_SendCommand + * - generates preview file if called after M4xVSS_PreviewStart + * - generates final edited file if called after M4xVSS_SaveStart + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param pContext (OUT) Progress indication from 0 to 100 + * @return M4NO_ERROR: No error, the user must call M4xVSS_Step again + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + * @return M4VSS3GPP_WAR_PREVIEW_READY: Preview file is generated + * @return M4VSS3GPP_WAR_SAVING_DONE: Final edited file is generated + * @return M4VSS3GPP_WAR_ANALYZING_DONE: Analyse is done + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_Step(M4OSA_Context pContext, M4OSA_UInt8 *pProgress); + +/** + ****************************************************************************** + * prototype M4xVSS_CloseCommand + * @brief This function deletes current editing profile, unallocate + * ressources and change xVSS internal state. + * @note After this function, the user can call a new M4xVSS_SendCommand + * + * @param pContext (IN) Pointer on the xVSS edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_CloseCommand(M4OSA_Context pContext); + +/** + ****************************************************************************** + * prototype M4xVSS_CleanUp + * @brief This function deletes all xVSS ressources + * @note This function must be called after M4xVSS_CloseCommand. + * + * @param pContext (IN) Pointer on the xVSS edit context + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_CleanUp(M4OSA_Context pContext); + +/** +****************************************************************************** + * M4OSA_ERR M4xVSS_RegisterExternalVideoDecoder(M4OSA_Context pContext, + * M4VD_VideoType decoderType, + * M4VD_Interface* pDecoderInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video decoder + * @note + * @param pContext (IN) xVSS context + * @param decoderType (IN) Type of decoder (MPEG4 ...) + * @param pDecoderInterface (IN) Decoder interface + * @param pUserData (IN) Pointer on a user data to give to external decoder + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: xVSS is not in an appropriate state for this function to be called +****************************************************************************** +*/ +M4OSA_ERR M4xVSS_RegisterExternalVideoDecoder(M4OSA_Context pContext, + M4VD_VideoType decoderType, + M4VD_Interface* pDecoderInterface, + M4OSA_Void* pUserData); + +/** +****************************************************************************** + * M4OSA_ERR M4xVSS_RegisterExternalVideoEncoder(M4OSA_Context pContext, + * M4VE_EncoderType encoderType, + * M4VE_Interface* pEncoderInterface, + * M4OSA_Void* pUserData) + * @brief Registers an external Video decoder + * @note + * @param pContext (IN) xVSS context + * @param encoderType (IN) Type of encoder (MPEG4 ...) + * @param pEncoderInterface (IN) Encoder interface + * @param pUserData (IN) Pointer on a user data to give to external encoder + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) + * @return M4ERR_STATE: xVSS is not in an appropriate state for this function to be called +****************************************************************************** +*/ +M4OSA_ERR M4xVSS_RegisterExternalVideoEncoder(M4OSA_Context pContext, + M4VE_EncoderType encoderType, + M4VE_Interface* pEncoderInterface, + M4OSA_Void* pUserData); + +/** + ****************************************************************************** + * prototype M4xVSS_GetVersion(M4_VersionInfo *pVersion) + * @brief This function get the version of the Video Studio 2.1 + * + * @param pVersion (IN) Pointer on the version info struct + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_GetVersion(M4_VersionInfo *pVersion); + +/** + ****************************************************************************** + * prototype M4VSS3GPP_externalVideoEffectColor(M4OSA_Void *pFunctionContext, + * M4VIFI_ImagePlane *PlaneIn, + * M4VIFI_ImagePlane *PlaneOut, + * M4VSS3GPP_ExternalProgress *pProgress, + * M4OSA_UInt32 uiEffectKind) + * + * @brief This function apply a color effect on an input YUV420 planar frame + * @note The prototype of this effect function is exposed because it needs to + * called by the VPS during the preview + * @param pFunctionContext(IN) Contains which color to apply (not very clean ...) + * @param PlaneIn (IN) Input YUV420 planar + * @param PlaneOut (IN/OUT) Output YUV420 planar + * @param pProgress (IN/OUT) Progress indication (0-100) + * @param uiEffectKind (IN) Unused + * + * @return M4VIFI_OK: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_externalVideoEffectColor +( + M4OSA_Void *pFunctionContext, + M4VIFI_ImagePlane *pInputPlanes, + M4VIFI_ImagePlane *pOutputPlanes, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiEffectKind +); + +/** + ****************************************************************************** + * prototype M4VSS3GPP_externalVideoEffectFraming(M4OSA_Void *pFunctionContext, + * M4VIFI_ImagePlane *PlaneIn, + * M4VIFI_ImagePlane *PlaneOut, + * M4VSS3GPP_ExternalProgress *pProgress, + * M4OSA_UInt32 uiEffectKind) + * + * @brief This function add a fixed or animated image on an input YUV420 planar frame + * @note The prototype of this effect function is exposed because it needs to + * called by the VPS during the preview + * @param pFunctionContext(IN) Contains which color to apply (not very clean ...) + * @param PlaneIn (IN) Input YUV420 planar + * @param PlaneOut (IN/OUT) Output YUV420 planar + * @param pProgress (IN/OUT) Progress indication (0-100) + * @param uiEffectKind (IN) Unused + * + * @return M4VIFI_OK: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming +( + M4OSA_Void *pFunctionContext, + M4VIFI_ImagePlane *pInputPlanes, + M4VIFI_ImagePlane *pOutputPlanes, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiEffectKind +); + +/** + ****************************************************************************** + * prototype M4VSS3GPP_externalVideoEffectFifties(M4OSA_Void *pFunctionContext, + * M4VIFI_ImagePlane *PlaneIn, + * M4VIFI_ImagePlane *PlaneOut, + * M4VSS3GPP_ExternalProgress *pProgress, + * M4OSA_UInt32 uiEffectKind) + * + * @brief This function make a video look as if it was taken in the fifties + * @note + * @param pUserData (IN) Context + * @param pPlaneIn (IN) Input YUV420 planar + * @param pPlaneOut (IN/OUT) Output YUV420 planar + * @param pProgress (IN/OUT) Progress indication (0-100) + * @param uiEffectKind (IN) Unused + * + * @return M4VIFI_OK: No error + * @return M4ERR_PARAMETER: pFiftiesData, pPlaneOut or pProgress are NULL (DEBUG only) + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_externalVideoEffectFifties +( + M4OSA_Void *pUserData, + M4VIFI_ImagePlane *pInputPlanes, + M4VIFI_ImagePlane *pPlaneOut, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiEffectKind +); + + +/** + ****************************************************************************** + * prototype M4VSS3GPP_externalVideoEffectZoom(M4OSA_Void *pFunctionContext, + * M4VIFI_ImagePlane *PlaneIn, + * M4VIFI_ImagePlane *PlaneOut, + * M4VSS3GPP_ExternalProgress *pProgress, + * M4OSA_UInt32 uiEffectKind) + * + * @brief This function add a fixed or animated image on an input YUV420 planar frame + * @note The prototype of this effect function is exposed because it needs to + * called by the VPS during the preview + * @param pFunctionContext(IN) Contains which zoom to apply (In/Out) + * @param PlaneIn (IN) Input YUV420 planar + * @param PlaneOut (IN/OUT) Output YUV420 planar + * @param pProgress (IN/OUT) Progress indication (0-100) + * @param uiEffectKind (IN) Unused + * + * @return M4VIFI_OK: No error + ****************************************************************************** +*/ +M4OSA_ERR M4VSS3GPP_externalVideoEffectZoom +( + M4OSA_Void *pFunctionContext, + M4VIFI_ImagePlane *pInputPlanes, + M4VIFI_ImagePlane *pOutputPlanes, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiEffectKind +); + +/** + ****************************************************************************** + * M4OSA_ERR M4xVSS_CreateClipSettings() + * @brief Allows filling a clip settings structure with default values + * + * @note WARNING: pClipSettings->Effects[ ] will be allocated in this function. + * pClipSettings->pFile will be allocated in this function. + * + * @param pClipSettings (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param pFile (IN) Clip file name + * @param filePathSize (IN) Size of the clip path (needed for the UTF16 conversion) + * @param nbEffects (IN) Nb of effect settings to allocate + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_CreateClipSettings(M4VSS3GPP_ClipSettings *pClipSettings, M4OSA_Void* pFile, + M4OSA_UInt32 filePathSize, M4OSA_UInt8 nbEffects); + +/** + ****************************************************************************** + * M4OSA_ERR M4xVSS_DuplicateClipSettings() + * @brief Duplicates a clip settings structure, performing allocations if required + * + * @param pClipSettingsDest (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param pClipSettingsOrig (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @param bCopyEffects (IN) Flag to know if we have to duplicate effects + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_DuplicateClipSettings(M4VSS3GPP_ClipSettings *pClipSettingsDest, + M4VSS3GPP_ClipSettings *pClipSettingsOrig, + M4OSA_Bool bCopyEffects); + +/** + ****************************************************************************** + * M4OSA_ERR M4xVSS_FreeClipSettings() + * @brief Free the pointers allocated in the ClipSetting structure (pFile, Effects). + * + * @param pClipSettings (IN) Pointer to a valid M4VSS3GPP_ClipSettings structure + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: pClipSettings is M4OSA_NULL (debug only) + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_FreeClipSettings(M4VSS3GPP_ClipSettings *pClipSettings); + +/** + ****************************************************************************** + * prototype M4OSA_ERR M4xVSS_getMCSContext(M4OSA_Context pContext, M4OSA_Context* mcsContext) + * @brief This function returns the MCS context within the xVSS internal context + * @note This function must be called only after VSS state has moved to analyzing state + * or beyond + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param mcsContext (OUT) Pointer to pointer of mcs context to return + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_getMCSContext(M4OSA_Context pContext, M4OSA_Context* mcsContext); + +/** + ****************************************************************************** + * prototype M4OSA_ERR M4xVSS_getVSS3GPPContext(M4OSA_Context pContext, + * M4OSA_Context* mcsContext) + * @brief This function returns the VSS3GPP context within the xVSS internal context + * @note This function must be called only after VSS state has moved to Generating + * preview or beyond + * + * @param pContext (IN) Pointer on the xVSS edit context + * @param vss3gppContext (OUT) Pointer to pointer of vss3gpp context to return + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL + * @return M4ERR_STATE: This function cannot not be called at this time + ****************************************************************************** +*/ +M4OSA_ERR M4xVSS_getVSS3GPPContext(M4OSA_Context pContext, M4OSA_Context* vss3gppContext); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __M4XVSS_API_H__ */ + diff --git a/libvideoeditor/vss/inc/M4xVSS_Internal.h b/libvideoeditor/vss/inc/M4xVSS_Internal.h new file mode 100755 index 0000000..c0490e6 --- /dev/null +++ b/libvideoeditor/vss/inc/M4xVSS_Internal.h @@ -0,0 +1,610 @@ +/* + * Copyright (C) 2004-2011 NXP Software + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __M4XVSS_INTERNAL_H__ +#define __M4XVSS_INTERNAL_H__ + +/** + ****************************************************************************** + * @file M4xVSS_Internal.h + * @brief Internal of Video Authoring. + * @note + ****************************************************************************** +*/ + +#include "NXPSW_CompilerSwitches.h" + +#include "M4MCS_API.h" +#include "M4MCS_ErrorCodes.h" + +#include "M4PTO3GPP_API.h" +#include "M4PTO3GPP_ErrorCodes.h" + +#include "M4AIR_API.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define M4_xVSS_MAJOR 1 +#define M4_xVSS_MINOR 5 +#define M4_xVSS_REVISION 5 + +/* The following defines describe the max dimensions of an input JPG */ +#define M4XVSS_MX_JPG_NB_OF_PIXELS 3926016 + +/*Size of the UTF temporary conversion buffer keep in the VA internal context and +allocate at the initialization*/ +#define UTF_CONVERSION_BUFFER_SIZE 2048 + +/** Determine absolute value of a. */ +#define M4xVSS_ABS(a) ( ( (a) < (0) ) ? (-(a)) : (a) ) + +/** Y,U,V values in case of black borders rendering */ +#define Y_PLANE_BORDER_VALUE 0x00 +#define U_PLANE_BORDER_VALUE 0x80 +#define V_PLANE_BORDER_VALUE 0x80 + +/** + ****************************************************************************** + * struct M4xVSS_EffectsAlphaBlending + * @brief Internal effects alpha blending parameters + * @note This structure contains all internal informations to create an alpha + * blending for the effects text and framing + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_UInt8 m_fadeInTime; /*Start percentage of Alpha blending*/ + M4OSA_UInt8 m_fadeOutTime; /*Middle percentage of Alpha blending*/ + M4OSA_UInt8 m_end; /*End percentage of Alpha blending*/ + M4OSA_UInt8 m_middle; /*Duration, in percentage of effect duration, + of the FadeIn phase*/ + M4OSA_UInt8 m_start; /*Duration, in percentage of effect duration, + of the FadeOut phase*/ + +} M4xVSS_internalEffectsAlphaBlending; + +/** + ****************************************************************************** + * THIS STRUCTURE MUST NOT BE MODIFIED + * struct M4xVSS_FramingStruct + * @brief It is used internally by xVSS for framing effect, and by VPS for previewing + ****************************************************************************** +*/ +typedef struct +{ + M4VIFI_ImagePlane *FramingRgb; /**< decoded BGR565 plane */ + M4VIFI_ImagePlane *FramingYuv; /**< converted YUV420 planar plane */ + M4OSA_Int32 duration; /**< Duration of the frame */ + M4OSA_Int32 previousClipTime; /**< Previous clip time, used by framing + filter for SAVING */ + M4OSA_Int32 previewOffsetClipTime; /**< Previous clip time, used by framing + filter for PREVIEW */ + M4OSA_Int32 previewClipTime; /**< Current clip time, used by framing + filter for PREVIEW */ + M4OSA_Void* pCurrent; /**< Current M4xVSS_FramingStruct used by + framing filter */ + M4OSA_Void* pNext; /**< Next M4xVSS_FramingStruct, if no more, + point on current M4xVSS_FramingStruct */ + M4OSA_UInt32 topleft_x; /**< The top-left X coordinate in the output + picture of the first decoded pixel */ + M4OSA_UInt32 topleft_y; /**< The top-left Y coordinate in the output + picture of the first decoded pixel */ + M4xVSS_internalEffectsAlphaBlending* alphaBlendingStruct; /* Alpha blending Struct */ +/*To support ARGB8888 : get the width and height in case of file ARGB888 used in framing + as video effect */ + M4OSA_UInt32 width; /*width of the ARGB8888 clip + .Used only if video effect is framming */ + M4OSA_UInt32 height; /*height of the ARGB8888 clip . + Used only if video effect is framming */ + +} M4xVSS_FramingStruct; + +#ifdef DECODE_GIF_ON_SAVING +/** + ****************************************************************************** + * THIS STRUCTURE MUST NOT BE MODIFIED + * struct M4xVSS_FramingContext + * @brief It is used internally by xVSS for framing effect, when the flag + DECODE_GIF_ON_SAVING is activated + ****************************************************************************** +*/ +typedef struct +{ + M4xVSS_FramingStruct* aFramingCtx; /**<Framing struct for the decoding + of the current frame of the gif*/ + M4xVSS_FramingStruct* aFramingCtx_last; /**<Framing struct for the decoding of + the previous frame of the gif*/ + M4OSA_FileReadPointer* pFileReadPtr; /**< Pointer on OSAL file read functions */ + M4OSA_FileWriterPointer* pFileWritePtr; /**< Pointer on OSAL file write functions */ + M4OSA_Void* pSPSContext; /**<SPS context for the GIF decoding*/ + //M4SPS_Stream inputStream; /**<GIF input stream buffer pointer*/ + M4OSA_Void* pEffectFilePath; /**<file path of the gif*/ + M4VIDEOEDITING_VideoFrameSize outputVideoSize; /**< Output video size RC */ + //M4SPS_DisposalMode disposal; /**<previous frame GIF disposal*/ + M4OSA_UInt16 b_animated; /**<Is the GIF animated?*/ + M4OSA_Bool bEffectResize; /**<Is the gif resize*/ + M4OSA_UInt32 topleft_x; /**< The top-left X coordinate in the + output picture of the first + decoded pixel */ + M4OSA_UInt32 topleft_y; /**< The top-left Y coordinate in the + output picture of the first + decoded pixel */ + M4OSA_UInt32 width; /**<GIF width, fill during the + initialization with the SPS*/ + M4OSA_UInt32 height; /**<GIF height, fill during the + initialization with the SPS*/ + M4OSA_UInt32 effectDuration; /**<Effect duration*/ + M4OSA_Int32 effectStartTime; /**<Effect start time*/ + M4OSA_UInt32 clipTime; /**<current output clip time for the + current frame*/ + M4OSA_UInt32 last_clipTime; /**<previous output clip time for the + previous frame*/ + M4OSA_UInt32 lastStepDuration; /**<Time interval between the previous + frame and the current frame*/ + M4OSA_Bool b_IsFileGif; /**<Is the framing using a gif file*/ + M4OSA_UInt32 last_width; /**<Last frame width*/ + M4OSA_UInt32 last_height; /**<Last frame height*/ + M4OSA_UInt32 last_topleft_x; /**<Last frame x topleft*/ + M4OSA_UInt32 last_topleft_y; /**<Last frame y topleft*/ + M4OSA_UInt32 current_gif_time; /**< Current time os the GIF in output + file time */ + M4OSA_Float frameDurationRatio; /**< Frame duration ratio */ + M4xVSS_internalEffectsAlphaBlending* alphaBlendingStruct;/*Alpha blending structure*/ +#ifdef DEBUG_GIF + M4OSA_UInt8 uiDebug_fileCounter;/**<for debug purpose, + count the frame of the gif*/ +#endif /*DEBUG_GIF*/ +}M4xVSS_FramingContext; +#endif /*DECODE_GIF_ON_SAVING*/ + +/** + ****************************************************************************** + * struct M4xVSS_Pto3GPP_params + * @brief Internal xVSS parameter for Pto3GPP module + * @note This structure is filled by M4xVSS_sendCommand function, + * @note and is used during M4xVSS_Step function to initialize Pto3GPP module + * @note All the JPG files to transform to 3GP are chained + ****************************************************************************** +*/ +typedef struct { + M4OSA_Char* pFileIn; + M4OSA_Char* pFileOut; + M4OSA_Char* pFileTemp; /**< temporary file used for + metadata writing, NULL is cstmem + writer not used */ + M4OSA_UInt32 duration; + M4VIDEOEDITING_FileType InputFileType; + M4OSA_Bool isCreated; /**< This boolean is used to know if + the output file is already + created or not */ + M4OSA_Bool isPanZoom; /**< RC: Boolean used to know if the + pan and zoom mode is enabled */ + M4OSA_UInt16 PanZoomXa; /**< RC */ + M4OSA_UInt16 PanZoomTopleftXa; /**< RC */ + M4OSA_UInt16 PanZoomTopleftYa; /**< RC */ + M4OSA_UInt16 PanZoomXb; /**< RC */ + M4OSA_UInt16 PanZoomTopleftXb; /**< RC */ + M4OSA_UInt16 PanZoomTopleftYb; /**< RC */ + M4xVSS_MediaRendering MediaRendering; /**< FB: to render or not picture + aspect ratio */ + M4VIDEOEDITING_VideoFramerate framerate; /**< RC */ + M4OSA_Void* pNext; /**< Address of next M4xVSS_Pto3GPP_params* + element */ + /*To support ARGB8888:width and height */ + M4OSA_UInt32 width; + M4OSA_UInt32 height; + +} M4xVSS_Pto3GPP_params; + +/** + ****************************************************************************** + * struct M4xVSS_fiftiesStruct + * @brief It is used internally by xVSS for fifties effect + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_UInt32 fiftiesEffectDuration; /**< Duration of the same effect in a video */ + M4OSA_Int32 previousClipTime; /**< Previous clip time, used by framing filter + for SAVING */ + M4OSA_UInt32 shiftRandomValue; /**< Vertical shift of the image */ + M4OSA_UInt32 stripeRandomValue; /**< Horizontal position of the stripe */ + +} M4xVSS_FiftiesStruct; + +/** + ****************************************************************************** + * struct M4xVSS_ColorRGB16 + * @brief It is used internally by xVSS for RGB16 color effect + ****************************************************************************** +*/ +typedef struct +{ + M4xVSS_VideoEffectType colorEffectType; /*Color type of effect*/ + M4OSA_UInt16 rgb16ColorData; /*RGB16 color only for the RGB16 color effect*/ +} M4xVSS_ColorStruct; + + +/** + ****************************************************************************** + * struct M4xVSS_PictureCallbackCtxt + * @brief The Callback Context parameters for Pto3GPP + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Char* m_FileIn; + M4OSA_UInt32 m_NbImage; + M4OSA_UInt32 m_ImageCounter; + M4OSA_Double m_timeDuration; + M4OSA_FileReadPointer* m_pFileReadPtr; + M4VIFI_ImagePlane* m_pDecodedPlane; /* Used for Pan and Zoom only */ + M4xVSS_Pto3GPP_params* m_pPto3GPPparams; + M4OSA_Context m_air_context; + M4xVSS_MediaRendering m_mediaRendering; + +} M4xVSS_PictureCallbackCtxt; + +/** + ****************************************************************************** + * enum M4xVSS_State + * @brief Internal State of the xVSS + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kStateInitialized = 0, + M4xVSS_kStateAnalyzing, + M4xVSS_kStateOpened, + //M4xVSS_kStateGeneratingPreview, + //M4xVSS_kStatePreview, + M4xVSS_kStateSaving, + M4xVSS_kStateSaved + +} M4xVSS_State; + +/** + ****************************************************************************** + * enum M4xVSS_editMicroState + * @brief Internal Micro state of the xVSS for previewing/saving states + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kMicroStateEditing = 0, + M4xVSS_kMicroStateAudioMixing + +} M4xVSS_editMicroState; + +/** + ****************************************************************************** + * enum M4xVSS_editMicroState + * @brief Internal Micro state of the xVSS for analyzing states + ****************************************************************************** +*/ +typedef enum +{ + M4xVSS_kMicroStateAnalysePto3GPP = 0, + M4xVSS_kMicroStateConvertPto3GPP, + M4xVSS_kMicroStateAnalyzeMCS, + M4xVSS_kMicroStateTranscodeMCS + +} M4xVSS_analyseMicroState; + + +/** + ****************************************************************************** + * struct M4xVSS_MCS_params + * @brief Internal xVSS parameter for MCS module + * @note This structure is filled by M4xVSS_sendCommand function, + * @note and is used during M4xVSS_Step function to initialize MCS module + * @note All the input files to transcode are chained + ****************************************************************************** +*/ +typedef struct { + M4OSA_Void* pFileIn; + M4OSA_Void* pFileOut; + /**< temporary file used for metadata writing, NULL is cstmem writer not used */ + M4OSA_Void* pFileTemp; + M4VIDEOEDITING_FileType InputFileType; + M4VIDEOEDITING_FileType OutputFileType; + M4VIDEOEDITING_VideoFormat OutputVideoFormat; + M4VIDEOEDITING_VideoFrameSize OutputVideoFrameSize; + M4VIDEOEDITING_VideoFramerate OutputVideoFrameRate; + M4VIDEOEDITING_AudioFormat OutputAudioFormat; + M4VIDEOEDITING_AudioSamplingFrequency OutputAudioSamplingFrequency; + M4OSA_Bool bAudioMono; + M4VIDEOEDITING_Bitrate OutputVideoBitrate; + M4VIDEOEDITING_Bitrate OutputAudioBitrate; +#ifdef TIMESCALE_BUG + M4OSA_UInt32 OutputVideoTimescale; +#endif + M4OSA_Bool isBGM; + /**< This boolean is used to know if the output file is already created or not */ + M4OSA_Bool isCreated; + /**< Address of next M4xVSS_MCS_params* element */ + M4OSA_Void* pNext; + + /*FB: transcoding per parts*/ + M4OSA_UInt32 BeginCutTime; /**< Beginning cut time in input file */ + M4OSA_UInt32 EndCutTime; /**< End cut time in input file */ + M4OSA_UInt32 OutputVideoTimescale; /*Output timescale*/ + + M4MCS_MediaRendering MediaRendering; /**< FB: to crop, resize, or render + black borders*/ + +} M4xVSS_MCS_params; + +/** + ****************************************************************************** + * struct M4xVSS_internal_AlphaMagicSettings + * @brief This structure defines the alpha magic transition settings + ****************************************************************************** +*/ +typedef struct { + M4VIFI_ImagePlane *pPlane; + M4OSA_Int32 blendingthreshold; /**< Blending Range */ + M4OSA_Bool isreverse; /**< direct effect or reverse */ + +} M4xVSS_internal_AlphaMagicSettings; + + +/** + ****************************************************************************** + * struct M4xVSS_internal_SlideTransitionSettings + * @brief This structure defines the internal slide transition settings + * @note This type happens to match the external transition settings + * structure (i.e. the one which is given by the application), but are + * conceptually different types, so that if (or rather when) some day + * translation needs to occur when loading the settings from the app, + * this separate type will already be ready. + ****************************************************************************** +*/ + +typedef M4xVSS_SlideTransitionSettings M4xVSS_internal_SlideTransitionSettings; + +/** + ****************************************************************************** + * struct M4xVSS_internalJpegChunkMode + * @brief This structure defines the parameters of the chunk callback to decode + * a JPEG by chunk mode. + ****************************************************************************** +*/ +#if 0 +typedef struct { + M4OSA_FileReadPointer* m_pFileReadPtr; + M4OSA_Context m_pJPEGFileIn; + M4OSA_Void* m_pFileIn; + M4SPS_Stream m_inputStream; + M4OSA_UInt32 m_total_read; + M4OSA_UInt32 m_fileSize; + +} M4xVSS_internalJpegChunkMode; +#endif + +/** + ****************************************************************************** + * struct M4xVSS_UTFConversionContext + * @brief Internal UTF conversion context + * @note This structure contains the UTF conversion informations + * needed by the xVSS to manage the different formats (UTF8/16/ASCII) + ****************************************************************************** +*/ +typedef struct +{ + /*Function pointer on an external text conversion function */ + M4xVSS_toUTF8Fct pConvToUTF8Fct; + /*Function pointer on an external text conversion function */ + M4xVSS_fromUTF8Fct pConvFromUTF8Fct; + /*Temporary buffer that contains the result of each conversion*/ + M4OSA_Void* pTempOutConversionBuffer; + /*Size of the previous buffer, the size is prederminated*/ + M4OSA_UInt32 m_TempOutConversionSize; +} M4xVSS_UTFConversionContext; + + + +/** + ****************************************************************************** + * struct M4xVSS_Context + * @brief Internal context of the xVSS + * @note This structure contains all internal informations needed by the xVSS + ****************************************************************************** +*/ +typedef struct { + /**< Pointer on OSAL file read functions */ + M4OSA_FileReadPointer* pFileReadPtr; + /**< Pointer on OSAL file write functions */ + M4OSA_FileWriterPointer* pFileWritePtr; + /**< Local copy of video editor settings */ + M4VSS3GPP_EditSettings* pSettings; + /**< Current Settings of video editor to use in step functions for preview/save */ + M4VSS3GPP_EditSettings* pCurrentEditSettings; + /**< Current context of video editor to use in step functions for preview/save */ + M4VSS3GPP_EditContext pCurrentEditContext; + /**< This is to know if a previous M4xVSS_sendCommand has already been called */ + M4OSA_UInt8 previousClipNumber; + /**< Audio mixing settings, needed to free it in M4xVSS_internalCloseAudioMixedFile function*/ + M4VSS3GPP_AudioMixingSettings* pAudioMixSettings; + /**< Audio mixing context */ + M4VSS3GPP_AudioMixingContext pAudioMixContext; + /**< File path for PCM output file: used for preview, given to user */ + M4OSA_Char* pcmPreviewFile; + /**< Duplication of output file pointer, to be able to use audio mixing */ + M4OSA_Char* pOutputFile; + /**< Duplication of temporary file pointer, to be able to use audio mixing */ + M4OSA_Char* pTemporaryFile; + /**< Micro state for Saving/Previewing state */ + M4xVSS_editMicroState editingStep; + /**< Micro state for Analyzing state */ + M4xVSS_analyseMicroState analyseStep; + /**< Nb of step for analysis or save/preview. Used to compute progression + of analysis or save/preview */ + M4OSA_UInt8 nbStepTotal; + /**< Current step number for analysis or save/preview */ + M4OSA_UInt8 currentStep; + /**< To be able to free pEffects during preview close */ + M4xVSS_PreviewSettings* pPreviewSettings; + /**< Temporary file path: all temporary files are created here */ + M4OSA_Char* pTempPath; + /**< Current state of xVSS */ + M4xVSS_State m_state; + /**< List of still pictures input to convert to 3GP with parameters */ + M4xVSS_Pto3GPP_params* pPTo3GPPparamsList; + /**< Current element of the above chained list beeing processd by the Pto3GPP */ + M4xVSS_Pto3GPP_params* pPTo3GPPcurrentParams; + /**< Current Pto3GPP context, needed to call Pto3GPP_step function in M4xVSS_step function */ + M4PTO3GPP_Context pM4PTO3GPP_Ctxt; + /**< Pointer on the callback function of the Pto3GPP module */ + M4xVSS_PictureCallbackCtxt* pCallBackCtxt; + /**< List of files to transcode with parameters */ + M4xVSS_MCS_params* pMCSparamsList; + /**< Current element of the above chained list beeing processd by the MCS */ + M4xVSS_MCS_params* pMCScurrentParams; + /**< Current MCS context, needed to call MCS_step function in M4xVSS_step function*/ + M4MCS_Context pMCS_Ctxt; + /**< Index to have unique temporary filename */ + M4OSA_UInt32 tempFileIndex; + /**< In case of MMS use case, targeted bitrate to reach output file size */ + M4OSA_UInt32 targetedBitrate; + /**< If the sendCommand fct is called twice or more, the first computed timescale + recorded here must be reused */ + M4OSA_UInt32 targetedTimescale; + + /*UTF Conversion support*/ + M4xVSS_UTFConversionContext UTFConversionContext; /*UTF conversion context structure*/ + +#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS + struct + { + M4VD_Interface* pDecoderInterface; + M4OSA_Void* pUserData; + M4OSA_Bool registered; + } registeredExternalDecs[M4VD_kVideoType_NB]; +#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ + struct + { + M4VE_Interface* pEncoderInterface; + M4OSA_Void* pUserData; + M4OSA_Bool registered; + } registeredExternalEncs[M4VE_kEncoderType_NB]; +} M4xVSS_Context; + +/** + * Internal function prototypes */ + +M4OSA_ERR M4xVSS_internalStartTranscoding(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalStopTranscoding(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalDecodeJPG(M4OSA_Void* pFileIn, M4OSA_FileReadPointer* pFileReadPtr, + M4VIFI_ImagePlane** pImagePlanes); + +M4OSA_ERR M4xVSS_internalConvertARGB8888toYUV420(M4OSA_Void* pFileIn, + M4OSA_FileReadPointer* pFileReadPtr, + M4VIFI_ImagePlane** pImagePlanes, + M4OSA_UInt32 width,M4OSA_UInt32 height); +M4OSA_ERR M4xVSS_internalDecodeAndResizeJPG(M4OSA_Void* pFileIn, + M4OSA_FileReadPointer* pFileReadPtr, + M4VIFI_ImagePlane* pImagePlanes); +M4OSA_ERR M4xVSS_internalConvertAndResizeARGB8888toYUV420(M4OSA_Void* pFileIn, + M4OSA_FileReadPointer* pFileReadPtr, + M4VIFI_ImagePlane* pImagePlanes, + M4OSA_UInt32 width,M4OSA_UInt32 height); + +M4OSA_ERR M4xVSS_internalStartConvertPictureTo3gp(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalStopConvertPictureTo3gp(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalConvertRGBtoYUV(M4xVSS_FramingStruct* framingCtx); + +#ifdef DECODE_GIF_ON_SAVING +M4OSA_ERR M4xVSS_internalDecodeGIF(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalDecodeGIF_Initialization(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalDecodeGIF_Cleaning(M4OSA_Context pContext); + +#else +M4OSA_ERR M4xVSS_internalDecodeGIF(M4OSA_Context pContext, M4VSS3GPP_EffectSettings* pEffect, + M4xVSS_FramingStruct* framingCtx); +#endif /*DECODE_GIF_ON_SAVING*/ + +M4OSA_ERR M4xVSS_internalConvertARGB888toYUV420_FrammingEffect(M4OSA_Context pContext, + M4VSS3GPP_EffectSettings* pEffect, + M4xVSS_FramingStruct* framingCtx, + M4VIDEOEDITING_VideoFrameSize \ + OutputVideoResolution); + +M4OSA_ERR M4xVSS_internalGenerateEditedFile(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalCloseEditedFile(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalGenerateAudioMixFile(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalCloseAudioMixedFile(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalFreePreview(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalFreeSaving(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_freeSettings(M4VSS3GPP_EditSettings* pSettings); + +M4OSA_ERR M4xVSS_freeCommand(M4OSA_Context pContext); + +M4OSA_ERR M4xVSS_internalGetProperties(M4OSA_Context pContext, M4OSA_Char* pFile, + M4VIDEOEDITING_ClipProperties *pFileProperties); + +M4OSA_ERR M4xVSS_AlphaMagic( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn1[3], + M4VIFI_ImagePlane PlaneIn2[3], M4VIFI_ImagePlane *PlaneOut, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiTransitionKind); + +M4OSA_ERR M4xVSS_AlphaMagicBlending( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn1[3], + M4VIFI_ImagePlane PlaneIn2[3], M4VIFI_ImagePlane *PlaneOut, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiTransitionKind); + +M4OSA_ERR M4xVSS_SlideTransition( M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn1[3], + M4VIFI_ImagePlane PlaneIn2[3], M4VIFI_ImagePlane *PlaneOut, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiTransitionKind); + +M4OSA_ERR M4xVSS_FadeBlackTransition(M4OSA_Void *userData, M4VIFI_ImagePlane PlaneIn1[3], + M4VIFI_ImagePlane PlaneIn2[3],M4VIFI_ImagePlane *PlaneOut, + M4VSS3GPP_ExternalProgress *pProgress, + M4OSA_UInt32 uiTransitionKind); + +M4OSA_ERR M4xVSS_internalGetTargetedTimeScale(M4OSA_Context pContext, + M4VSS3GPP_EditSettings* pSettings, + M4OSA_UInt32* pTargetedTimeScale); + +M4OSA_ERR M4xVSS_internalConvertToUTF8(M4OSA_Context pContext, M4OSA_Void* pBufferIn, + M4OSA_Void* pBufferOut, M4OSA_UInt32* convertedSize); + + +M4OSA_ERR M4xVSS_internalConvertFromUTF8(M4OSA_Context pContext, M4OSA_Void* pBufferIn, + M4OSA_Void* pBufferOut, M4OSA_UInt32* convertedSize); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __M4XVSS_INTERNAL_H__ */ + |