diff options
Diffstat (limited to 'libvideoeditor/vss/common')
44 files changed, 8851 insertions, 0 deletions
diff --git a/libvideoeditor/vss/common/inc/From2iToMono_16.h b/libvideoeditor/vss/common/inc/From2iToMono_16.h new file mode 100755 index 0000000..433bb78 --- /dev/null +++ b/libvideoeditor/vss/common/inc/From2iToMono_16.h @@ -0,0 +1,31 @@ +/* + * 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 _FROM2ITOMONO_16_H_ +#define _FROM2ITOMONO_16_H_ + + +void From2iToMono_16( const short *src, + short *dst, + short n); + +/**********************************************************************************/ + +#endif /* _FROM2ITOMONO_16_H_ */ + +/**********************************************************************************/ + diff --git a/libvideoeditor/vss/common/inc/LVM_Types.h b/libvideoeditor/vss/common/inc/LVM_Types.h new file mode 100755 index 0000000..a9eecef --- /dev/null +++ b/libvideoeditor/vss/common/inc/LVM_Types.h @@ -0,0 +1,181 @@ +/* + * 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 name: LVM_Types.h + +*****************************************************************************************/ + +/****************************************************************************************/ +/* */ +/* Header file defining the standard LifeVibes types for use in the application layer */ +/* interface of all LifeVibes modules */ +/* */ +/****************************************************************************************/ + +#ifndef LVM_TYPES_H +#define LVM_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/****************************************************************************************/ +/* */ +/* definitions */ +/* */ +/****************************************************************************************/ + +#define LVM_NULL 0 /* NULL pointer */ + +#define LVM_TRUE 1 /* Booleans */ +#define LVM_FALSE 0 + +#define LVM_MAXINT_8 127 /* Maximum positive integer size */ +#define LVM_MAXINT_16 32767 +#define LVM_MAXINT_32 2147483647 +#define LVM_MAXENUM 2147483647 + +#define LVM_MODULEID_MASK 0xFF00 /* Mask to extract the calling module ID + from callbackId */ +#define LVM_EVENTID_MASK 0x00FF /* Mask to extract the callback event from + callbackId */ + +/* Memory table*/ +#define LVM_MEMREGION_PERSISTENT_SLOW_DATA 0 /* Offset to the instance memory region */ +#define LVM_MEMREGION_PERSISTENT_FAST_DATA 1 /* Offset to the persistent data memory + region */ +#define LVM_MEMREGION_PERSISTENT_FAST_COEF 2 /* Offset to the persistent coefficient + memory region */ +#define LVM_MEMREGION_TEMPORARY_FAST 3 /* Offset to temporary memory region */ + + +/****************************************************************************************/ +/* */ +/* Basic types */ +/* */ +/****************************************************************************************/ + +typedef char LVM_CHAR; /* ASCII character */ + +typedef char LVM_INT8; /* Signed 8-bit word */ +typedef unsigned char LVM_UINT8; /* Unsigned 8-bit word */ + +typedef short LVM_INT16; /* Signed 16-bit word */ +typedef unsigned short LVM_UINT16; /* Unsigned 16-bit word */ + +typedef long LVM_INT32; /* Signed 32-bit word */ +typedef unsigned long LVM_UINT32; /* Unsigned 32-bit word */ + + +/****************************************************************************************/ +/* */ +/* Standard Enumerated types */ +/* */ +/****************************************************************************************/ + +/* Operating mode */ +typedef enum +{ + LVM_MODE_OFF = 0, + LVM_MODE_ON = 1, + LVM_MODE_DUMMY = LVM_MAXENUM +} LVM_Mode_en; + + +/* Format */ +typedef enum +{ + LVM_STEREO = 0, + LVM_MONOINSTEREO = 1, + LVM_MONO = 2, + LVM_SOURCE_DUMMY = LVM_MAXENUM +} LVM_Format_en; + + +/* Word length */ +typedef enum +{ + LVM_16_BIT = 0, + LVM_32_BIT = 1, + LVM_WORDLENGTH_DUMMY = LVM_MAXENUM +} LVM_WordLength_en; + + +/* LVM sampling rates */ +typedef enum +{ + LVM_FS_8000 = 0, + LVM_FS_11025 = 1, + LVM_FS_12000 = 2, + LVM_FS_16000 = 3, + LVM_FS_22050 = 4, + LVM_FS_24000 = 5, + LVM_FS_32000 = 6, + LVM_FS_44100 = 7, + LVM_FS_48000 = 8, + LVM_FS_INVALID = LVM_MAXENUM-1, + LVM_FS_DUMMY = LVM_MAXENUM +} LVM_Fs_en; + + +/* Memory Types */ +typedef enum +{ + LVM_PERSISTENT_SLOW_DATA = LVM_MEMREGION_PERSISTENT_SLOW_DATA, + LVM_PERSISTENT_FAST_DATA = LVM_MEMREGION_PERSISTENT_FAST_DATA, + LVM_PERSISTENT_FAST_COEF = LVM_MEMREGION_PERSISTENT_FAST_COEF, + LVM_TEMPORARY_FAST = LVM_MEMREGION_TEMPORARY_FAST, + LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM +} LVM_MemoryTypes_en; + + +/* Memory region definition */ +typedef struct +{ + LVM_UINT32 Size; /* Region size in bytes */ + LVM_MemoryTypes_en Type; /* Region type */ + void *pBaseAddress; /* Pointer to the region base address */ +} LVM_MemoryRegion_st; + + +/****************************************************************************************/ +/* */ +/* Standard Function Prototypes */ +/* */ +/****************************************************************************************/ +typedef LVM_INT32 (*LVM_Callback)(void *pCallbackData, /* Pointer to the callback + data structure */ + void *pGeneralPurpose, /* General purpose pointer + (e.g. to a data structure + needed in the callback) */ + LVM_INT16 GeneralPurpose ); /* General purpose variable + (e.g. to be used as callback ID) */ + + +/****************************************************************************************/ +/* */ +/* End of file */ +/* */ +/****************************************************************************************/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LVM_TYPES_H */ diff --git a/libvideoeditor/vss/common/inc/M4AD_Common.h b/libvideoeditor/vss/common/inc/M4AD_Common.h new file mode 100755 index 0000000..12314f3 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4AD_Common.h @@ -0,0 +1,284 @@ +/* + * 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. + */ +/** + ************************************************************************ + * @fil M4AD_Common.h + * @brief Audio Shell Decoder common interface declaration + * @note This file declares the common interfaces that audio decoder shells must implement + ************************************************************************ +*/ +#ifndef __M4AD_COMMON_H__ +#define __M4AD_COMMON_H__ + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_OptionID.h" +#include "M4OSA_CoreID.h" +#include "M4DA_Types.h" +#include "M4TOOL_VersionInfo.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef M4OSA_Void* M4AD_Context; + +/** + ************************************************************************ + * enum M4AD_OptionID + * @brief This enum defines the Audio decoder options. + * @note These options can be read from or written to a decoder via + * M4AD_getOption_fct/M4AD_setOption_fct + ************************************************************************ +*/ +typedef enum +{ + /** + * Set the flag of presence of protection */ + M4AD_kOptionID_ProtectionAbsent = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4DECODER_AUDIO, 0x01), + + /** + * Set the number of frames per bloc */ + M4AD_kOptionID_NbFramePerBloc = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4DECODER_AUDIO, 0x02), + + /** + * Set the AAC decoder user parameters */ + M4AD_kOptionID_UserParam = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4DECODER_AUDIO, 0x03), + + + /** + * Get the AAC steam type */ + M4AD_kOptionID_StreamType = M4OSA_OPTION_ID_CREATE(M4_READ , M4DECODER_AUDIO, 0x10), + + /** + * Get the number of used bytes in the latest decode + (used only when decoding AAC from ADIF file) */ + M4AD_kOptionID_UsedBytes = M4OSA_OPTION_ID_CREATE(M4_READ , M4DECODER_AUDIO, 0x11) + +} M4AD_OptionID; + + + +typedef enum +{ + M4_kUnknown = 0, /* Unknown stream type */ + M4_kAAC, /* M4_kAAC_MAIN or M4_kAAC_LC or M4_kAAC_SSR or M4_kAAC_LTP */ + M4_kAACplus, /* Decoder type is AAC plus */ + M4_keAACplus /* Decoder type is enhanced AAC plus */ +} M4_AACType; + +/** + ************************************************************************ + * enum M4AD_Type + * @brief This enum defines the audio types used to create decoders + * @note This enum is used internally by the VPS to identify a currently supported + * audio decoder interface. Each decoder is registered with one of this type associated. + * When a decoder instance is needed, this type is used to identify + * and retrieve its interface. + ************************************************************************ +*/ +typedef enum +{ + M4AD_kTypeAMRNB = 0, + M4AD_kTypeAMRWB, + M4AD_kTypeAAC, + M4AD_kTypeMP3, + M4AD_kTypePCM, + M4AD_kTypeBBMusicEngine, + M4AD_kTypeWMA, + M4AD_kTypeRMA, + M4AD_kTypeADPCM, + M4AD_kType_NB /* number of decoders, keep it as last enum entry */ + +} M4AD_Type ; + + + +/** + ************************************************************************ + * structure M4AD_Buffer + * @brief Structure to describe a buffer + ************************************************************************ +*/ +typedef struct +{ + M4OSA_MemAddr8 m_dataAddress; + M4OSA_UInt32 m_bufferSize; +} M4AD_Buffer; + +/** + ************************************************************************ + * @brief Creates an instance of the decoder + * @note Allocates the context + * + * @param pContext: (OUT) Context of the decoder + * @param pStreamHandler: (IN) Pointer to an audio stream description + * @param pUserData: (IN) Pointer to User data + * + * @return M4NO_ERROR there is no error + * @return M4ERR_STATE State automaton is not applied + * @return M4ERR_ALLOC a memory allocation has failed + * @return M4ERR_PARAMETER at least one parameter is not properly set (in DEBUG only) + ************************************************************************ +*/ + +typedef M4OSA_ERR (M4AD_create_fct)(M4AD_Context *pContext, + M4_AudioStreamHandler *pStreamHandler, void* pUserData); + + +/** + ************************************************************************ + * @brief Destroys the instance of the decoder + * @note After this call the context is invalid + * + * @param context: (IN) Context of the decoder + * + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER The context is invalid (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_destroy_fct) (M4AD_Context context); + +/** + ************************************************************************ + * @brief Decodes the given audio data + * @note Parses and decodes the next audio frame, from the given buffer. + * This function changes pInputBufferSize value according to the amount + * of data actually read. + * + * @param context: (IN) Context of the decoder + * @param inputBuffer: (IN/OUT)Input Data buffer. It contains at least one audio frame. + * The size of the buffer must be updated inside the + * function to reflect the size of the actually decoded data. + * (e.g. the first frame in pInputBuffer) + * @param decodedPCMBuffer: (OUT) Output PCM buffer (decoded data). + * @param jumping: (IN) M4OSA_TRUE if a jump was just done, M4OSA_FALSE otherwise. + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER at least one parameter is not properly set + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_step_fct) (M4AD_Context context, M4AD_Buffer *pInputBuffer, + M4AD_Buffer *pDecodedPCMBuffer, M4OSA_Bool jumping); + +/** + ************************************************************************ + * @brief Gets the decoder version + * @note The version is given in a M4_VersionInfo structure + * + * @param pValue: (OUT) Pointer to the version structure + * + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER The given pointer is null (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_getVersion_fct)(M4_VersionInfo* pVersionInfo); + + +/** + ************************************************************************ + * @brief This function creates the AAC core decoder according to + * the stream properties and to the options that may + * have been set using M4AD_setOption_fct + * @note Creates an instance of the AAC decoder + * @note This function is used especially by the AAC decoder + * + * @param pContext: (IN/OUT) Context of the decoder + * @param pStreamHandler: (IN) Pointer to an audio stream description + * + * @return M4NO_ERROR there is no error + * @return M4ERR_STATE State automaton is not applied + * @return M4ERR_ALLOC a memory allocation has failed + * @return M4ERR_PARAMETER at least one parameter is not properly set (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_start_fct) (M4AD_Context pContext); + +/** + ************************************************************************ + * @brief Reset the instance of the decoder + * + * @param context: (IN) Context of the decoder + * + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER The context is invalid (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_reset_fct) (M4AD_Context context); + + +/** + ************************************************************************ + * @brief set en option value of the audio decoder + * + * @param context: (IN) Context of the decoder + * @param optionId: (IN) indicates the option to set + * @param pValue: (IN) pointer to structure or value (allocated by user) + * where option is stored + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_BAD_OPTION_ID when the option ID is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_setOption_fct) (M4AD_Context context, + M4OSA_OptionID optionId, M4OSA_DataOption pValue); + +/** + ************************************************************************ + * @brief Get en option value of the audio decoder + * + * @param context: (IN) Context of the decoder + * @param optionId: (IN) indicates the option to set + * @param pValue: (OUT) pointer to structure or value (allocated by user) + * where option is stored + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_BAD_OPTION_ID when the option ID is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4AD_getOption_fct) (M4AD_Context context, M4OSA_OptionID optionId, + M4OSA_DataOption pValue); +/** + ************************************************************************ + * structure M4AD_Interface + * @brief This structure defines the generic audio decoder interface + * @note This structure stores the pointers to functions of one audio decoder type. + * The decoder type is one of the M4AD_Type + ************************************************************************ +*/ +typedef struct _M4AD_Interface +{ + + M4AD_create_fct* m_pFctCreateAudioDec; + M4AD_start_fct* m_pFctStartAudioDec; + M4AD_step_fct* m_pFctStepAudioDec; + M4AD_getVersion_fct* m_pFctGetVersionAudioDec; + M4AD_destroy_fct* m_pFctDestroyAudioDec; + M4AD_reset_fct* m_pFctResetAudioDec; + M4AD_setOption_fct* m_pFctSetOptionAudioDec; + M4AD_getOption_fct* m_pFctGetOptionAudioDec; + +} M4AD_Interface; + +#ifdef __cplusplus +} +#endif + +#endif /*__M4AD_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4AD_Null.h b/libvideoeditor/vss/common/inc/M4AD_Null.h new file mode 100755 index 0000000..d00d6d7 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4AD_Null.h @@ -0,0 +1,55 @@ +/* + * 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 M4AD_Null.h + * @brief Implementation of the decoder public interface that do nothing + * @note This file defines the getInterface function. +************************************************************************* +*/ +#ifndef __M4AD_NULL_H__ +#define __M4AD_NULL_H__ + +#include "M4AD_Common.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + ************************************************************************ + * @brief Retrieves the interface implemented by the decoder + * @param pDecoderType : pointer on an M4AD_Type (allocated by the caller) + * that will be filled with the decoder type supported by this decoder + * @param pDecoderInterface : address of a pointer that will be set to the interface implemented + * by this decoder. The interface is a structure allocated by the + * function and must be un-allocated by the caller. + * + * @return : M4NO_ERROR if OK + * M4ERR_ALLOC if allocation failed + ************************************************************************ +*/ +M4OSA_ERR M4AD_NULL_getInterface( M4AD_Type *pDecoderType, M4AD_Interface **pDecoderInterface); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4AD_NULL_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4AIR_API.h b/libvideoeditor/vss/common/inc/M4AIR_API.h new file mode 100755 index 0000000..954b77a --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4AIR_API.h @@ -0,0 +1,185 @@ +/* + * 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 M4AIR_API.h + * @brief Area of Interest Resizer API + * @note +************************************************************************* +*/ +#ifndef M4AIR_API_H +#define M4AIR_API_H + +/******************************* INCLUDES *******************************/ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_CoreID.h" +#include "M4OSA_Mutex.h" +#include "M4OSA_Memory.h" +#include "M4VIFI_FiltersAPI.h" +#include "M4Common_types.h" + +/************************ M4AIR TYPES DEFINITIONS ***********************/ + +/** + ****************************************************************************** + * enum M4AIR_InputFormatType + * @brief The following enumeration lists the different accepted format for the AIR. + * To be available, the associated compilation flag must be defined, else, + * the AIR will return an error (compilation flag : M4AIR_XXXXXX_FORMAT_SUPPORTED). + ****************************************************************************** +*/ +typedef enum +{ + M4AIR_kYUV420P, + M4AIR_kYUV420AP, + M4AIR_kJPG +}M4AIR_InputFormatType ; + + +/** + ****************************************************************************** + * struct M4AIR_Coordinates + * @brief The following structure is used to retrieve X and Y coordinates in a given picture. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_UInt32 m_x; /**< X coordinate */ + M4OSA_UInt32 m_y; /**< Y coordinate */ +}M4AIR_Coordinates; + + +/** + ****************************************************************************** + * struct M4AIR_Size + * @brief The following structure is used to retrieve the dimension of a given picture area. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_UInt32 m_width; /**< Width */ + M4OSA_UInt32 m_height; /**< Height */ +}M4AIR_Size; + + +/** + ****************************************************************************** + * struct M4AIR_Params + * @brief The following structure is used to retrieve the parameters needed to get a resized ROI (Region of interest). + ****************************************************************************** +*/ +typedef struct +{ + M4AIR_Coordinates m_inputCoord; /**< X and Y positionning in the input of the first interesting pixel (top-left) */ + M4AIR_Size m_inputSize; /**< Size of the interesting area inside input (width and height)*/ + M4AIR_Size m_outputSize; /**< Size of the output */ + M4OSA_Bool m_bOutputStripe; /**< Flag to know if we will have to provide output per stripe or not */ + M4COMMON_Orientation m_outputOrientation; /**< Desired orientation of the AIR output */ +}M4AIR_Params; + + + + +/*********************** M4AIR ERRORS DEFINITIONS **********************/ + +/* This error means that the requested video format is not supported. */ +#define M4ERR_AIR_FORMAT_NOT_SUPPORTED M4OSA_ERR_CREATE(M4_ERR,M4AIR,0x000001) + +/* This error means that the input or output size is incorrect */ +#define M4ERR_AIR_ILLEGAL_FRAME_SIZE M4OSA_ERR_CREATE(M4_ERR,M4AIR,0x000002) + + + +/********************** M4AIR PUBLIC API DEFINITIONS ********************/ +/** + ****************************************************************************** + * M4OSA_ERR M4AIR_create(M4OSA_Context* pContext,M4AIR_InputFormatType inputFormat); + * @brief This function initialize an instance of the AIR. + * @param pContext: (IN/OUT) Address of the context to create + * @param inputFormat: (IN) input format type. + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only). Invalid formatType + * @return M4ERR_ALLOC: No more memory is available + ****************************************************************************** +*/ +M4OSA_ERR M4AIR_create(M4OSA_Context* pContext,M4AIR_InputFormatType inputFormat); + + +/** + ****************************************************************************** + * M4OSA_ERR M4AIR_cleanUp(M4OSA_Context pContext) + * @brief This function destroys an instance of the AIR component + * @param pContext: (IN) Context identifying the instance to destroy + * @return M4NO_ERROR: there is no error + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only). + * @return M4ERR_STATE: Internal state is incompatible with this function call. + ****************************************************************************** +*/ +M4OSA_ERR M4AIR_cleanUp(M4OSA_Context pContext); + + +/** + ****************************************************************************** + * M4OSA_ERR M4AIR_configure(M4OSA_Context pContext, M4AIR_Params* pParams) + * @brief This function will configure the AIR. + * @note It will set the input and output coordinates and sizes, + * and indicates if we will proceed in stripe or not. + * In case a M4AIR_get in stripe mode was on going, it will cancel this previous + * processing and reset the get process. + * @param pContext: (IN) Context identifying the instance + * @param pParams->m_bOutputStripe:(IN) Stripe mode. + * @param pParams->m_inputCoord: (IN) X,Y coordinates of the first valid pixel in input. + * @param pParams->m_inputSize: (IN) input ROI size. + * @param pParams->m_outputSize: (IN) output size. + * @return M4NO_ERROR: there is no error + * @return M4ERR_ALLOC: No more memory space to add a new effect. + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only). + * @return M4ERR_AIR_FORMAT_NOT_SUPPORTED: the requested input format is not supported. + ****************************************************************************** +*/ +M4OSA_ERR M4AIR_configure(M4OSA_Context pContext, M4AIR_Params* pParams); + + +/** + ****************************************************************************** + * M4OSA_ERR M4AIR_get(M4OSA_Context pContext, M4VIFI_ImagePlane* pIn, M4VIFI_ImagePlane* pOut) + * @brief This function will provide the requested resized area of interest according to + * settings provided in M4AIR_configure. + * @note In case the input format type is JPEG, input plane(s) + * in pIn is not used. In normal mode, dimension specified in output plane(s) structure + * must be the same than the one specified in M4AIR_configure. In stripe mode, only + * the width will be the same, height will be taken as the stripe height (typically 16). + * In normal mode, this function is call once to get the full output picture. In stripe + * mode, it is called for each stripe till the whole picture has been retrieved,and + * the position of the output stripe in the output picture is internally incremented + * at each step. + * Any call to M4AIR_configure during stripe process will reset this one to the + * beginning of the output picture. + * @param pContext: (IN) Context identifying the instance + * @param pIn: (IN) Plane structure containing input Plane(s). + * @param pOut: (IN/OUT) Plane structure containing output Plane(s). + * @return M4NO_ERROR: there is no error + * @return M4ERR_ALLOC: No more memory space to add a new effect. + * @return M4ERR_PARAMETER: pContext is M4OSA_NULL (debug only). + ****************************************************************************** +*/ +M4OSA_ERR M4AIR_get(M4OSA_Context pContext, M4VIFI_ImagePlane* pIn, M4VIFI_ImagePlane* pOut); + + + +#endif /* M4AIR_API_H */ diff --git a/libvideoeditor/vss/common/inc/M4AMRR_CoreReader.h b/libvideoeditor/vss/common/inc/M4AMRR_CoreReader.h new file mode 100755 index 0000000..8f0ca62 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4AMRR_CoreReader.h @@ -0,0 +1,252 @@ +/* + * 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 M4AMRR_CoreReader.h + * @brief Implementation of AMR parser + * @note This file contains the API def. for AMR Parser. + ****************************************************************************** +*/ +#ifndef __M4AMR_COREREADER_H__ +#define __M4AMR_COREREADER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "M4OSA_Types.h" +#include "M4OSA_FileReader.h" +#include "M4SYS_Stream.h" +#include "M4SYS_AccessUnit.h" +#include "M4OSA_Time.h" +#include "M4TOOL_VersionInfo.h" + +/** + ****************************************************************************** + * AMR reader Errors & Warnings definition + ****************************************************************************** +*/ +#define M4ERR_AMR_INVALID_FRAME_TYPE M4OSA_ERR_CREATE(M4_ERR,M4AMR_READER, 0x000001) +#define M4ERR_AMR_NOT_COMPLIANT M4OSA_ERR_CREATE(M4_ERR,M4AMR_READER, 0x000002) + +/** + ****************************************************************************** + * enumeration M4AMRR_State + * @brief This enum defines the AMR reader states + * @note These states are used internaly, but can be retrieved from outside the reader. + ****************************************************************************** +*/ +typedef enum{ + M4AMRR_kOpening = 0x0100, + M4AMRR_kOpened = 0x0101, + M4AMRR_kReading = 0x0200, + M4AMRR_kReading_nextAU = 0x0201, + M4AMRR_kClosed = 0x300 +}M4AMRR_State; + +/** +******************************************************************************* +* M4OSA_ERR M4AMRR_openRead (M4OSA_Context* pContext, M4OSA_Void* pFileDescriptor, +* M4OSA_FileReaderPointer* pFileFunction); +* @brief M4AMRR_OpenRead parses the meta data of the AMR and allocates data structure +* @note This function opens the file and creates a context for AMR Parser. +* - sets context to null if error occured. +* @param pContext(OUT) : AMR Reader context allocated in the function +* @param pFileDesscriptor(IN): File descriptor of the input file +* @param pFileFunction(IN) : pointer to file function for file access +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : pContext and/or pFileDescriptor is NULL +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_FILE_NOT_FOUND : file cannot be found +* @returns M4AMRR_ERR_AMR_NOT_COMPLIANT : Tthe input is not a AMR file +* @returns M4OSA_FILE : See OSAL file Spec. for details. +******************************************************************************* +*/ +M4OSA_ERR M4AMRR_openRead (M4OSA_Context* pContext, M4OSA_Void* pFileDescriptor, + M4OSA_FileReadPointer* pFileFunction); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_getNextStream(M4OSA_Context Context, M4SYS_StreamDescription* pStreamDesc ); +* @brief Reads the next available stream in the file +* @note Get the stream description of the stream. +* - This function assumes that there is only one stream in AMR file. +* @param Context(IN/OUT) : AMR Reader context +* @param pStreamDesc(OUT): Description of the next read stream +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +* @returns M4AMRR_WAR_NO_MORE_STREAM : There are no more streams in the file. +****************************************************************************** +*/ + +M4OSA_ERR M4AMRR_getNextStream(M4OSA_Context Context, M4SYS_StreamDescription* pStreamDesc ); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_startReading(M4OSA_Context Context, M4SYS_StreamID* pStreamIDs ); +* @brief Prepares the AMR reading of the specified stream Ids +* @note This function changes the state of the reader reading. +* @param Context(IN/OUT) : AMR Reader context +* @param pStreamIDs(IN) : Array of stream Ids to be prepared. +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +* @returns M4ERR_BAD_STREAM_ID : Atleast one of the stream Id. does not exist. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_startReading(M4OSA_Context Context, M4SYS_StreamID* pStreamIDs ); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_nextAU(M4OSA_Context Context, M4SYS_StreamID StreamID, M4SYS_AccessUnit* pAu); +* @brief Reads the access unit into the providing stream +* @note This function allocates the memory to dataAddress filed and copied the data. +* -The Application should not free the dataAddress pointer. +* @param Context(IN/OUT) : AMR Reader context +* @param StreamID(IN) : Selects the stream +* @param pAu(IN/OUT) : Access Unit +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +* @returns M4ERR_BAD_STREAM_ID : Atleast one of the stream Id. does not exist. +* @returns M4WAR_NO_DATA_YET : there is no enough data on the stream for new access unit +* @returns M4WAR_END_OF_STREAM : There are no more access unit in the stream +* @returns M4AMRR_ERR_INVALID_FRAME_TYPE : current frame has no valid frame type. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_nextAU(M4OSA_Context Context, M4SYS_StreamID StreamID, M4SYS_AccessUnit* pAu); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_freeAU(M4OSA_Context Context, M4SYS_StreamID StreamID, M4SYS_AccessUnit* pAu); +* @brief Notify the ARM Reader that application will no longer use "AU" +* @note This function frees the memory pointed by pAu->dataAddress pointer +* -Changes the state of the reader back to reading. +* @param Context(IN/OUT) : AMR Reader context +* @param StreamID(IN) : Selects the stream +* @param pAu(IN) : Access Unit +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +* @returns M4ERR_BAD_STREAM_ID : Atleast one of the stream Id. does not exist. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_freeAU(M4OSA_Context Context, M4SYS_StreamID StreamID, M4SYS_AccessUnit* pAu); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_seek(M4OSA_Context Context, M4SYS_StreamID* pStreamID, M4OSA_Time time, +* M4SYS_seekAccessMode seekMode, M4OSA_Time* pObtainCTS); +* @brief The function seeks the targeted time in the give stream by streamId. +* @note Each frame is of 20 ms duration,, builds the seek table and points +* the file pointer to starting for the required AU. +* @param Context(IN/OUT) : AMR Reader context +* @param StreamID(IN) : Array of stream IDs. +* @param time(IN) : targeted time +* @param seekMode(IN) : Selects the seek mode +* @param pObtainCTS(OUT) : Returned time nearest to target. +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +* @returns M4ERR_BAD_STREAM_ID : Atleast one of the stream Id. does not exist. +* @returns M4WAR_INVALID_TIME : time cannot be reached. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_seek(M4OSA_Context Context, M4SYS_StreamID* pStreamID, M4OSA_Time time, + M4SYS_SeekAccessMode seekMode, M4OSA_Time* pObtainCTS); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_closeRead(M4OSA_Context Context); +* @brief AMR reader closes the file +* @param Context(IN?OUT) : AMR Reader context +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_ALLOC : Memory allocation failed +* @returns M4ERR_STATE : this function cannot be called in this state. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_closeRead(M4OSA_Context Context); + +/** +****************************************************************************** +* M4OSA_ERR M4AMRR_getState(M4OSA_Context Context, M4AMRR_State* pState, M4SYS_StreamID streamId); +* @brief Gets the current state of the AMR reader +* @param Context(IN/OUT) : AMR Reader context +* @param pState(OUT) : Core AMR reader state +* @param streamId(IN) : Selects the stream 0 for all +* +* @returns M4NO_ERROR : There is no error +* @returns M4ERR_PARAMETER : atleast one parament is NULL +* @returns M4ERR_BAD_CONTEXT : The provided context is not valid +* @returns M4ERR_BAD_STREAM_ID : Atleast one of the stream Id. does not exist. +****************************************************************************** +*/ +M4OSA_ERR M4AMRR_getState(M4OSA_Context Context, M4AMRR_State* pState, M4SYS_StreamID streamId); + + +/** + ****************************************************************************** + * M4OSA_ERR M4AMRR_getVersion (M4_VersionInfo *pVersion) + * @brief Gets the current version of the AMR reader + * @param version(OUT) : the structure that stores the version numbers + * + * @returns M4NO_ERROR : There is no error + * @returns M4ERR_PARAMETER : version is NULL + ****************************************************************************** +*/ +M4OSA_ERR M4AMRR_getVersion (M4_VersionInfo *pVersion); + +/** + ****************************************************************************** + * M4OSA_ERR M4AMRR_getmaxAUsize (M4OSA_Context Context, M4OSA_UInt32 *pMaxAuSize) + * @brief Computes the maximum access unit size of a stream + * + * @param Context (IN) Context of the reader + * @param pMaxAuSize (OUT) Maximum Access Unit size in the stream + * + * @return M4NO_ERROR: No error + * @return M4ERR_PARAMETER: One of the input pointer is M4OSA_NULL (Debug only) + ****************************************************************************** +*/ +M4OSA_ERR M4AMRR_getmaxAUsize(M4OSA_Context Context, M4OSA_UInt32 *pMaxAuSize); + + +#ifdef __cplusplus +} +#endif /* __cplusplus*/ +#endif /*__M4AMR_COREREADER_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4CLOCK.h b/libvideoeditor/vss/common/inc/M4CLOCK.h new file mode 100755 index 0000000..963b135 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4CLOCK.h @@ -0,0 +1,50 @@ +/* + * 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 M4CLOCK.h + * @brief Clock and sleep functions types + * +************************************************************************* +*/ +#ifndef __M4CLOCK_H__ +#define __M4CLOCK_H__ + +#include "M4OSA_Types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * Type of a function that returns time. + */ +typedef M4OSA_Double (*M4CLOCK_getTime_fct) ( M4OSA_Void* pContext ) ; + +/** + * Type of a function that suspends a task for a certain amount of time. + */ +typedef M4OSA_Void (*M4CLOCK_sleep_fct) ( M4OSA_Void* pContext,\ + M4OSA_UInt32 durationInMs ) ; + +#ifdef __cplusplus +} +#endif + +#endif /* __M4CLOCK_H__ */ + diff --git a/libvideoeditor/vss/common/inc/M4Common_types.h b/libvideoeditor/vss/common/inc/M4Common_types.h new file mode 100755 index 0000000..0ae59ee --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4Common_types.h @@ -0,0 +1,236 @@ +/* + * 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 M4Common_Types.h + * @brief defines common structures + * @note + * + ************************************************************************ +*/ +#ifndef M4COMMON_TYPES_H +#define M4COMMON_TYPES_H + +#include "M4OSA_Types.h" +#include "M4OSA_Memory.h" + +/** + ************************************************************************ + * structure M4COMMON_MetadataType + ************************************************************************ +*/ +typedef enum +{ + M4COMMON_kUnknownMetaDataType, + /* Local files */ + M4COMMON_kTagID3v1, /**< Metadata from TAG ID3 V1 */ + M4COMMON_kTagID3v2, /**< Metadata from TAG ID3 V2 */ + M4COMMON_kASFContentDesc, /**< Metadata from ASF content description */ + + M4COMMON_k3GppAssetMovieBox, /**< Metadata from a 3gpp file (movie box) */ + M4COMMON_k3GppAssetTrackBox, /**< Metadata from a 3gpp file (track box) */ + + /* Streaming */ + M4COMMON_kMetaDataSdpSession, /**< Metadata from an SDP file (Session level) */ + M4COMMON_kMetaDataSdpAudio, /**< Metadata from an SDP file (media audio level) */ + M4COMMON_kMetaDataSdpVideo, /**< Metadata from an SDP file (media video level) */ + + M4COMMON_kJpegExif /**< EXIF in JPEG */ +} M4COMMON_MetadataType; + +/** + ************************************************************************ + * enumeration M4VPS_EncodingFormat + * @brief Text encoding format + ************************************************************************ +*/ +typedef enum +{ + M4COMMON_kEncFormatUnknown = 0, /**< Unknown format */ + M4COMMON_kEncFormatASCII = 1, /**< ISO-8859-1. Terminated with $00 */ + M4COMMON_kEncFormatUTF8 = 2, /**< UTF-8 encoded Unicode . Terminated with $00 */ + M4COMMON_kEncFormatUTF16 = 3 /**< UTF-16 encoded Unicode. Terminated with $00 00 */ +} M4COMMON_EncodingFormat; + +/** + ************************************************************************ + * structure M4VPS_String + * @brief This structure defines string attribute + ************************************************************************ +*/ +typedef struct +{ + M4OSA_Void* m_pString; /**< Pointer to text */ + M4OSA_UInt32 m_uiSize; /**< Text size in bytes */ + M4COMMON_EncodingFormat m_EncodingFormat; /**< Text encoding format */ + +} M4COMMON_String; + +/** + ************************************************************************ + * structure M4COMMON_Buffer + * @brief This structure defines generic buffer attribute + ************************************************************************ +*/ +typedef struct +{ + M4OSA_MemAddr8 m_pBuffer; /**< Pointer to buffer */ + M4OSA_UInt32 m_size; /**< size of buffer in bytes */ +} M4COMMON_Buffer; + +typedef enum +{ + M4COMMON_kMimeType_NONE, + M4COMMON_kMimeType_JPG, + M4COMMON_kMimeType_PNG, + M4COMMON_kMimeType_BMP, /* bitmap, with header */ + M4COMMON_kMimeType_RGB24, /* raw RGB 24 bits */ + M4COMMON_kMimeType_RGB565, /* raw, RGB 16 bits */ + M4COMMON_kMimeType_YUV420, + M4COMMON_kMimeType_MPEG4_IFrame /* RC: to support PV art */ + +} M4COMMON_MimeType; + +/* picture type definition from id3v2 tag*/ +typedef enum +{ + M4COMMON_kPicType_Other = 0x00, + M4COMMON_kPicType_32_32_Icon = 0x01, + M4COMMON_kPicType_Other_Icon = 0x02, + M4COMMON_kPicType_FrontCover = 0x03, + M4COMMON_kPicType_BackCover = 0x04, + M4COMMON_kPicType_LeafletPage = 0x05, + M4COMMON_kPicType_Media = 0x06, + M4COMMON_kPicType_LeadArtist = 0x07, + M4COMMON_kPicType_Artist = 0x08, + M4COMMON_kPicType_Conductor = 0x09, + M4COMMON_kPicType_Orchestra = 0x0A, + M4COMMON_kPicType_Composer = 0x0B, + M4COMMON_kPicType_Lyricist = 0x0C, + M4COMMON_kPicType_RecordingLocation = 0x0D, + M4COMMON_kPicType_DuringRecording = 0x0E, + M4COMMON_kPicType_DuringPerformance = 0x0F, + M4COMMON_kPicType_MovieScreenCapture = 0x10, + M4COMMON_kPicType_BrightColouredFish = 0x11, + M4COMMON_kPicType_Illustration = 0x12, + M4COMMON_kPicType_ArtistLogo = 0x13, + M4COMMON_kPicType_StudioLogo = 0x14 +} M4COMMON_PictureType; + +/** + ****************************************************************************** + * enum M4COMMON_Orientation + * @brief This enum defines the possible orientation of a frame as described + * in the EXIF standard. + ****************************************************************************** +*/ +typedef enum +{ + M4COMMON_kOrientationUnknown = 0, + M4COMMON_kOrientationTopLeft, + M4COMMON_kOrientationTopRight, + M4COMMON_kOrientationBottomRight, + M4COMMON_kOrientationBottomLeft, + M4COMMON_kOrientationLeftTop, + M4COMMON_kOrientationRightTop, + M4COMMON_kOrientationRightBottom, + M4COMMON_kOrientationLeftBottom +}M4COMMON_Orientation ; + +/** + ****************************************************************************** + * structure M4EXIFC_Location + * @brief The Image GPS location (example : 48°52.21' ) + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Float degrees; + M4OSA_Float minsec; +} M4COMMON_Location; + +/** + ************************************************************************ + * structure M4COMMON_MetaDataAlbumArt + * @brief This structure defines fields of a album art + ************************************************************************ +*/ +typedef struct +{ + M4COMMON_MimeType m_mimeType; + M4OSA_UInt32 m_uiSize; + M4OSA_Void* m_pData; + + M4COMMON_String m_pDescription; + +} M4COMMON_MetaDataAlbumArt; + +/** + ************************************************************************ + * structure M4COMMON_MetaDataFields + * @brief This structure defines fields of metadata information + ************************************************************************ +*/ +typedef struct +{ + M4COMMON_MetadataType m_MetadataType; + + /* Meta data fields */ + M4COMMON_String m_pTitle; /**< Title for the media */ + M4COMMON_String m_pArtist; /**< Performer or artist */ + M4COMMON_String m_pAlbum; /**< Album title for the media */ + M4COMMON_String m_pAuthor; /**< Author of the media */ + M4COMMON_String m_pGenre; /**< Genre (category and style) of the media */ + M4COMMON_String m_pDescription; /**< Caption or description for the media */ + M4COMMON_String m_pCopyRights; /**< Notice about organization holding copyright + for the media file */ + M4COMMON_String m_pRecordingYear; /**< Recording year for the media */ + M4COMMON_String m_pRating; /**< Media rating */ + + M4COMMON_String m_pClassification; /**< Classification of the media */ + M4COMMON_String m_pKeyWords; /**< Media keywords */ + M4COMMON_String m_pLocation; /**< Location information */ + M4COMMON_String m_pUrl; /**< Reference of the resource */ + + M4OSA_UInt8 m_uiTrackNumber; /**< Track number for the media*/ + M4OSA_UInt32 m_uiDuration; /**< The track duration in milliseconds */ + + M4COMMON_MetaDataAlbumArt m_albumArt; /**< AlbumArt description */ + M4COMMON_String m_pMood; /**< Mood of the media */ + + /**< Modifs ACO 4/12/07 : add Exif specific infos */ + M4COMMON_String m_pCreationDateTime; /**< date and time original image was generated */ + M4COMMON_String m_pLastChangeDateTime; /**< file change date and time */ + M4COMMON_String m_pManufacturer; /**< manufacturer of image input equipment */ + M4COMMON_String m_pModel; /**< model of image input equipment */ + M4COMMON_String m_pSoftware; /**< software used */ + M4COMMON_Orientation m_Orientation; /**< Orientation of the picture */ + + /**< Modifs FS 29/08/08 : additionnal Exif infos */ + M4OSA_UInt32 m_width; /**< image width in pixels */ + M4OSA_UInt32 m_height; /**< image height in pixels */ + M4OSA_UInt32 m_thumbnailSize; /**< size of the thumbnail */ + M4COMMON_String m_pLatitudeRef; /**< Latitude reference */ + M4COMMON_Location m_latitude; /**< Latitude */ + M4COMMON_String m_pLongitudeRef; /**< Longitude reference */ + M4COMMON_Location m_longitude; /**< Longitude */ + +} M4COMMON_MetaDataFields; + + +#endif /*M4COMMON_TYPES_H*/ + diff --git a/libvideoeditor/vss/common/inc/M4DA_Types.h b/libvideoeditor/vss/common/inc/M4DA_Types.h new file mode 100755 index 0000000..d41f934 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4DA_Types.h @@ -0,0 +1,202 @@ +/* + * 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 M4DA_Types.h + * @brief Data access type definition + * @note This file implements media specific types + ************************************************************************ +*/ + +#ifndef __M4DA_TYPES_H__ +#define __M4DA_TYPES_H__ + +#include "NXPSW_CompilerSwitches.h" + +#include "M4OSA_Types.h" +#include "M4OSA_Memory.h" + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus*/ + +/** + ************************************************************************ + * enumeration M4_StreamType + * @brief Type used to describe a stream (audio or video data flow). + ************************************************************************ +*/ +typedef enum +{ + M4DA_StreamTypeUnknown = -1, /**< Unknow type */ + M4DA_StreamTypeVideoMpeg4 = 0, /**< MPEG-4 video */ + M4DA_StreamTypeVideoH263 = 1, /**< H263 video */ + M4DA_StreamTypeAudioAmrNarrowBand = 2, /**< Amr narrow band audio */ + M4DA_StreamTypeAudioAmrWideBand = 3, /**< Amr wide band audio */ + M4DA_StreamTypeAudioAac = 4, /**< AAC audio */ + M4DA_StreamTypeAudioMp3 = 5, /**< MP3 audio */ + M4DA_StreamTypeVideoMJpeg = 6, /**< MJPEG video */ + M4DA_StreamTypeAudioPcm = 7, /**< Wav audio */ + M4DA_StreamTypeAudioMidi = 8, /**< Midi audio */ + M4DA_StreamTypeVideoMpeg4Avc = 9, /**< MPEG-4 AVC video (h264) */ + M4DA_StreamTypeAudioAacADTS = 10, /**< AAC ADTS audio */ + M4DA_StreamTypeAudioAacADIF = 11, /**< AAC ADIF audio */ + M4DA_StreamTypeAudioWma = 12, /**< WMA audio */ + M4DA_StreamTypeVideoWmv = 13, /**< WMV video */ + M4DA_StreamTypeAudioReal = 14, /**< REAL audio */ + M4DA_StreamTypeVideoReal = 15, /**< REAL video */ + M4DA_StreamTypeAudioEvrc = 16, /**< Evrc audio */ + M4DA_StreamTypeTimedText = 20, /**< Timed Text */ + M4DA_StreamTypeAudioBba = 21, /**< Beat Brew audio fomat */ + M4DA_StreamTypeAudioSmaf = 22, /**< SMAF audio */ + M4DA_StreamTypeAudioImelody = 23, /**< IMELODY audio*/ + M4DA_StreamTypeAudioXmf = 24, /**< XMF audio */ + M4DA_StreamTypeAudioBpc = 25, /**< BPC audio */ + + /* ADPCM */ + M4DA_StreamTypeAudioADPcm = 26 /**< ADPCM */ + +} M4_StreamType; + +/** + ************************************************************************ + * structure M4_StreamHandler + * @brief Base structure to describe a stream. + ************************************************************************ +*/ +typedef struct +{ + M4_StreamType m_streamType; /**< Stream type */ + M4OSA_UInt32 m_streamId; /**< Stream Id (unique number definning + the stream) */ + M4OSA_Int64 m_duration; /**< Duration of the stream in milli + seconds */ + M4OSA_UInt32 m_averageBitRate; /**< Average bitrate in kb/s */ + M4OSA_UInt32 m_maxAUSize; /**< Maximum size of an Access Unit */ + M4OSA_UInt8* m_pDecoderSpecificInfo; /**< Pointer on specific information required + to create a decoder */ + M4OSA_UInt32 m_decoderSpecificInfoSize; /**< Size of the specific information + pointer above */ + void* m_pUserData; /**< Pointer on User Data + (initialized by the user) */ + M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ + M4OSA_Bool m_bStreamIsOK; /**< Flag to know if stream has no errors after + parsing is finished */ + M4OSA_UInt8* m_pH264DecoderSpecificInfo; /**< Pointer on specific information + required to create a decoder */ + M4OSA_UInt32 m_H264decoderSpecificInfoSize; /**< Size of the specific + information pointer above */ + // MPEG4 & AAC decoders require ESDS info + M4OSA_UInt8* m_pESDSInfo; /**< Pointer on MPEG4 or AAC ESDS box */ + M4OSA_UInt32 m_ESDSInfoSize; /**< Size of the MPEG4 or AAC ESDS box */ +} M4_StreamHandler; + +/** + ************************************************************************ + * structure M4_VideoStreamHandler + * @brief Extended structure to describe a video stream. + ************************************************************************ +*/ +typedef struct +{ + M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ + M4OSA_UInt32 m_videoWidth; /**< Width of the video in the stream */ + M4OSA_UInt32 m_videoHeight; /**< Height of the video in the stream */ + M4OSA_Float m_averageFrameRate; /**< Average frame rate of the video + in the stream */ + M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ +} M4_VideoStreamHandler; + +/** + ************************************************************************ + * structure M4_AudioStreamHandler + * @brief Extended structure to describe an audio stream. + ************************************************************************ +*/ +typedef struct +{ + M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ + M4OSA_UInt32 m_nbChannels; /**< Number of channels in the audio stream + (1-mono, 2-stereo) */ + M4OSA_UInt32 m_byteFrameLength; /**< Size of frame samples in bytes */ + M4OSA_UInt32 m_byteSampleSize; /**< Number of bytes per sample */ + M4OSA_UInt32 m_samplingFrequency; /**< Sample frequency in kHz */ + M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ +} M4_AudioStreamHandler; + +#ifdef M4VPS_SUPPORT_TTEXT + +/** + ************************************************************************ + * structure M4_TextStreamHandler + * @brief Extended structure to describe a text stream. + ************************************************************************ +*/ +typedef struct +{ + M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ + M4OSA_UInt32 m_trackWidth; /**< Width of the video in the stream */ + M4OSA_UInt32 m_trackHeight; /**< Height of the video in the stream */ + M4OSA_UInt32 m_trackXpos; /**< X position of the text track in video area */ + M4OSA_UInt32 m_trackYpos; /**< Y position of the text track in video area */ + M4OSA_UInt8 back_col_rgba[4]; /**< the background color in RGBA */ + M4OSA_UInt16 uiLenght; /**< the string lenght in bytes */ + M4OSA_UInt32 disp_flag; /**< the way text will be displayed */ + M4OSA_UInt8 horiz_justif; /**< the horizontal justification of the text */ + M4OSA_UInt8 verti_justif; /**< the vertical justification of the text */ + /* style */ + M4OSA_UInt16 styl_start_char; /**< the first character impacted by style */ + M4OSA_UInt16 styl_end_char; /**< the last character impacted by style */ + M4OSA_UInt16 fontID; /**< ID of the font */ + M4OSA_UInt8 face_style; /**< the text face-style: bold, italic, + underlined, plain(default) */ + M4OSA_UInt8 font_size; /**< size in pixel of font */ + M4OSA_UInt8 text_col_rgba[4]; /**< the text color in RGBA */ + /* box */ + M4OSA_UInt16 box_top; /**< the top position of text box in the track area */ + M4OSA_UInt16 box_left; /**< the left position of text box in the track area */ + M4OSA_UInt16 box_bottom; /**< the bottom position of text box in the track area */ + M4OSA_UInt16 box_right; /**< the right position of text box in the track area */ + M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ +} M4_TextStreamHandler; + +#endif /*M4VPS_SUPPORT_TTEXT*/ + +/** + ************************************************************************ + * structure M4_AccessUnit + * @brief Structure to describe an access unit. + ************************************************************************ +*/ +typedef struct +{ + M4OSA_UInt32 m_streamID; /**< Id of the stream to get an AU from */ + M4OSA_MemAddr8 m_dataAddress; /**< Pointer to a memory area with the encoded data */ + M4OSA_UInt32 m_size; /**< Size of the dataAdress area */ + M4OSA_Double m_CTS; /**< Composition Time Stamp for the Access Unit */ + M4OSA_Double m_DTS ; /**< Decoded Time Stamp for the Access Unit */ + M4OSA_UInt8 m_attribute; /**< RAP information & AU corrupted */ + M4OSA_UInt32 m_maxsize; /**< Maximum size of the AU */ + M4OSA_UInt32 m_structSize; /**< Structure size */ +} M4_AccessUnit; + +#ifdef __cplusplus +} +#endif /*__cplusplus*/ + +#endif /* __M4DA_TYPES_H__ */ + diff --git a/libvideoeditor/vss/common/inc/M4DECODER_Common.h b/libvideoeditor/vss/common/inc/M4DECODER_Common.h new file mode 100755 index 0000000..889efd5 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4DECODER_Common.h @@ -0,0 +1,350 @@ +/* + * 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 M4DECODER_Common.h + * @brief Shell Decoder common interface declaration + * @note This file declares the common interfaces that decoder shells must implement + * + ************************************************************************ +*/ +#ifndef __M4DECODER_COMMON_H__ +#define __M4DECODER_COMMON_H__ + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_OptionID.h" +#include "M4OSA_CoreID.h" + +#include "M4READER_Common.h" +#include "M4VIFI_FiltersAPI.h" + +#include "M4_Utils.h" + +/* ----- Errors and Warnings ----- */ + +/** + * Warning: there is no new decoded frame to render since the last rendering + */ +#define M4WAR_VIDEORENDERER_NO_NEW_FRAME M4OSA_ERR_CREATE(M4_WAR, M4DECODER_COMMON, 0x0001) +/** + * Warning: the deblocking filter is not implemented + */ +#define M4WAR_DEBLOCKING_FILTER_NOT_IMPLEMENTED M4OSA_ERR_CREATE(M4_WAR, M4DECODER_COMMON,\ + 0x000002) + + +/* Error: Stream H263 profiles (other than 0) are not supported */ +#define M4ERR_DECODER_H263_PROFILE_NOT_SUPPORTED M4OSA_ERR_CREATE(M4_ERR,\ + M4DECODER_MPEG4, 0x0001) +/* Error: Stream H263 not baseline not supported (Supported sizes are CIF, QCIF or SQCIF) */ +#define M4ERR_DECODER_H263_NOT_BASELINE M4OSA_ERR_CREATE(M4_ERR,\ + M4DECODER_MPEG4, 0x0002) + +/** + ************************************************************************ + * enum M4DECODER_AVCProfileLevel + * @brief This enum defines the AVC decoder profile and level for the current instance + * @note This options can be read from decoder via M4DECODER_getOption_fct + ************************************************************************ +*/ +typedef enum +{ + M4DECODER_AVC_kProfile_0_Level_1 = 0, + M4DECODER_AVC_kProfile_0_Level_1b, + M4DECODER_AVC_kProfile_0_Level_1_1, + M4DECODER_AVC_kProfile_0_Level_1_2, + M4DECODER_AVC_kProfile_0_Level_1_3, + M4DECODER_AVC_kProfile_0_Level_2, + M4DECODER_AVC_kProfile_0_Level_2_1, + M4DECODER_AVC_kProfile_0_Level_2_2, + M4DECODER_AVC_kProfile_0_Level_3, + M4DECODER_AVC_kProfile_0_Level_3_1, + M4DECODER_AVC_kProfile_0_Level_3_2, + M4DECODER_AVC_kProfile_0_Level_4, + M4DECODER_AVC_kProfile_0_Level_4_1, + M4DECODER_AVC_kProfile_0_Level_4_2, + M4DECODER_AVC_kProfile_0_Level_5, + M4DECODER_AVC_kProfile_0_Level_5_1, + M4DECODER_AVC_kProfile_and_Level_Out_Of_Range = 255 +} M4DECODER_AVCProfileLevel; + +/** + ************************************************************************ + * enum M4DECODER_OptionID + * @brief This enum defines the decoder options + * @note These options can be read from or written to a decoder via M4DECODER_getOption_fct + ************************************************************************ +*/ +typedef enum +{ + /** + Get the version of the core decoder + */ + M4DECODER_kOptionID_Version = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x01), + /** + Get the size of the currently decoded video + */ + M4DECODER_kOptionID_VideoSize = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x02), + /** + Set the conversion filter to use at rendering + */ + M4DECODER_kOptionID_OutputFilter = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x03), + /** + Activate the Deblocking filter + */ + M4DECODER_kOptionID_DeblockingFilter = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON, 0x04), + /** + Get nex rendered frame CTS + */ + M4DECODER_kOptionID_NextRenderedFrameCTS = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_COMMON,\ + 0x05), + + + /* common to MPEG4 decoders */ + /** + * Get the DecoderConfigInfo */ + M4DECODER_MPEG4_kOptionID_DecoderConfigInfo = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4DECODER_MPEG4, 0x01), + + /* only for H.264 decoder. */ + /** + Get AVC profile and level. + */ + M4DECODER_kOptionID_AVCProfileAndLevel = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_AVC, 0x01), + + /* last decoded cts */ + M4DECODER_kOptionID_AVCLastDecodedFrameCTS = M4OSA_OPTION_ID_CREATE(M4_READ, M4DECODER_AVC,\ + 0x02) +/* Last decoded cts */ + +} M4DECODER_OptionID; + + +/** + ************************************************************************ + * struct M4DECODER_MPEG4_DecoderConfigInfo + * @brief Contains info read from the MPEG-4 VideoObjectLayer. + ************************************************************************ +*/ +typedef struct +{ + M4OSA_UInt8 uiProfile; /**< profile and level as defined in the Visual + Object Sequence header, if present */ + M4OSA_UInt32 uiTimeScale; /**< time scale as parsed in VOL header */ + M4OSA_UInt8 uiUseOfResynchMarker; /**< Usage of resynchronization marker */ + M4OSA_Bool bDataPartition; /**< If 1 data partitioning is used. */ + M4OSA_Bool bUseOfRVLC; /**< Usage of RVLC for the stream */ + +} M4DECODER_MPEG4_DecoderConfigInfo; + + +/** + *********************************************************************** + * structure M4DECODER_VideoSize + * @brief This structure defines the video size (width and height) + * @note This structure is used to retrieve via the M4DECODER_getOption_fct + * function the size of the current decoded video + ************************************************************************ +*/ +typedef struct _M4DECODER_VideoSize +{ + M4OSA_UInt32 m_uiWidth; /**< video width in pixels */ + M4OSA_UInt32 m_uiHeight; /**< video height in pixels */ + +} M4DECODER_VideoSize; + +/** + ************************************************************************ + * structure M4DECODER_OutputFilter + * @brief This structure defines the conversion filter + * @note This structure is used to retrieve the filter function + * pointer and its user data via the function + * M4DECODER_getOption_fct with the option + * M4DECODER_kOptionID_OutputFilter + ************************************************************************ +*/ +typedef struct _M4DECODER_OutputFilter +{ + M4OSA_Void *m_pFilterFunction; /**< pointer to the filter function */ + M4OSA_Void *m_pFilterUserData; /**< user data of the filter */ + +} M4DECODER_OutputFilter; + +/** + ************************************************************************ + * enum M4DECODER_VideoType + * @brief This enum defines the video types used to create decoders + * @note This enum is used internally by the VPS to identify a currently supported + * video decoder interface. Each decoder is registered with one of this type associated. + * When a decoder instance is needed, this type is used to identify and + * and retrieve its interface. + ************************************************************************ +*/ +typedef enum +{ + M4DECODER_kVideoTypeMPEG4 = 0, + M4DECODER_kVideoTypeMJPEG, + M4DECODER_kVideoTypeAVC, + M4DECODER_kVideoTypeWMV, + M4DECODER_kVideoTypeREAL, + + M4DECODER_kVideoType_NB /* number of decoders, keep it as last enum entry */ + +} M4DECODER_VideoType ; + +/** + ************************************************************************ + * @brief creates an instance of the decoder + * @note allocates the context + * + * @param pContext: (OUT) Context of the decoder + * @param pStreamHandler: (IN) Pointer to a video stream description + * @param pSrcInterface: (IN) Pointer to the M4READER_DataInterface structure that must + * be used by the decoder to read data from the stream + * @param pAccessUnit (IN) Pointer to an access unit (allocated by the caller) + * where the decoded data are stored + * + * @return M4NO_ERROR there is no error + * @return M4ERR_STATE State automaton is not applied + * @return M4ERR_ALLOC a memory allocation has failed + * @return M4ERR_PARAMETER at least one parameter is not properly set (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_create_fct) (M4OSA_Context *pContext, + M4_StreamHandler *pStreamHandler, + M4READER_DataInterface *pSrcInterface, + M4_AccessUnit *pAccessUnit, + M4OSA_Void* pUserData); + +/** + ************************************************************************ + * @brief destroy the instance of the decoder + * @note after this call the context is invalid + * + * @param context: (IN) Context of the decoder + * + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER The context is invalid (in DEBUG only) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_destroy_fct) (M4OSA_Context context); + +/** + ************************************************************************ + * @brief get an option value from the decoder + * @note this function follows the set/get option mechanism described in OSAL 3.0 + * it allows the caller to retrieve a property value: + * -the version number of the decoder + * -the size (widthxheight) of the image + * + * @param context: (IN) Context of the decoder + * @param optionId: (IN) indicates the option to set + * @param pValue: (IN/OUT) pointer to structure or value (allocated by user) where + * option is stored + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER The context is invalid (in DEBUG only) + * @return M4ERR_BAD_OPTION_ID when the option ID is not a valid one + * @return M4ERR_STATE State automaton is not applied + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_getOption_fct)(M4OSA_Context context, M4OSA_OptionID optionId, + M4OSA_DataOption pValue); + +/** + ************************************************************************ + * @brief set an option value of the decoder + * @note this function follows the set/get option mechanism described in OSAL 3.0 + * it allows the caller to set a property value: + * -the conversion filter to use at rendering + * + * @param context: (IN) Context of the decoder + * @param optionId: (IN) Identifier indicating the option to set + * @param pValue: (IN) Pointer to structure or value (allocated by user) + * where option is stored + * @return M4NO_ERROR There is no error + * @return M4ERR_BAD_OPTION_ID The option ID is not a valid one + * @return M4ERR_STATE State automaton is not applied + * @return M4ERR_PARAMETER The option parameter is invalid + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_setOption_fct)(M4OSA_Context context, M4OSA_OptionID optionId, + M4OSA_DataOption pValue); + +/** + ************************************************************************ + * @brief Decode Access Units up to a target time + * @note Parse and decode the stream until it is possible to output a decoded image for which + * the composition time is equal or greater to the passed targeted time + * The data are read from the reader data interface + * + * @param context: (IN) Context of the decoder + * @param pTime: (IN/OUT) IN: Time to decode up to (in milli secondes) + * OUT:Time of the last decoded frame (in ms) + * @param bJump: (IN) 0 if no jump occured just before this call + * 1 if a a jump has just been made + * + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4WAR_NO_MORE_AU there is no more access unit to decode (end of stream) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_decode_fct) (M4OSA_Context context, M4_MediaTime* pTime, + M4OSA_Bool bJump); + +/** + ************************************************************************ + * @brief Renders the video at the specified time. + * @note + * @param context: (IN) Context of the decoder + * @param pTime: (IN/OUT) IN: Time to render to (in milli secondes) + * OUT:Time of the actually rendered frame (in ms) + * @param pOutputPlane:(OUT) Output plane filled with decoded data (converted) + * @param bForceRender:(IN) 1 if the image must be rendered even it has already been + * 0 if not (in which case the function can return + * M4WAR_VIDEORENDERER_NO_NEW_FRAME) + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER At least one parameter is not properly set + * @return M4ERR_STATE State automaton is not applied + * @return M4ERR_ALLOC There is no more available memory + * @return M4WAR_VIDEORENDERER_NO_NEW_FRAME If the frame to render has already been rendered + ************************************************************************ +*/ +typedef M4OSA_ERR (M4DECODER_render_fct) (M4OSA_Context context, M4_MediaTime* pTime, + M4VIFI_ImagePlane* pOutputPlane, + M4OSA_Bool bForceRender); + +/** + ************************************************************************ + * structure M4DECODER_VideoInterface + * @brief This structure defines the generic video decoder interface + * @note This structure stores the pointers to functions of one video decoder type. + * The decoder type is one of the M4DECODER_VideoType + ************************************************************************ +*/ +typedef struct _M4DECODER_VideoInterface +{ + M4DECODER_create_fct* m_pFctCreate; + M4DECODER_destroy_fct* m_pFctDestroy; + M4DECODER_getOption_fct* m_pFctGetOption; + M4DECODER_setOption_fct* m_pFctSetOption; + M4DECODER_decode_fct* m_pFctDecode; + M4DECODER_render_fct* m_pFctRender; +} M4DECODER_VideoInterface; + +#endif /*__M4DECODER_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4ENCODER_AudioCommon.h b/libvideoeditor/vss/common/inc/M4ENCODER_AudioCommon.h new file mode 100755 index 0000000..1386c8c --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4ENCODER_AudioCommon.h @@ -0,0 +1,254 @@ +/* + * 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 M4ENCODER_AudioCommon.h + * @brief VES audio encoders shell interface. + * @note This file defines the types internally used by the VES to abstract audio encoders + ****************************************************************************** +*/ +#ifndef __M4ENCODER_AUDIOCOMMON_H__ +#define __M4ENCODER_AUDIOCOMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "M4OSA_OptionID.h" /* for M4OSA_OPTION_ID_CREATE() */ + +#define M4ENCODER_AUDIO_NB_CHANNELS_MAX 2 +/* WARNING: this value must be equal to the number of samples grabbed */ +//#define M4ENCODER_AUDIO_PCM_SAMPLE_NUMBER 960 /* imposed by the AAC encoder. */ +#define M4ENCODER_AUDIO_PCM_SAMPLE_NUMBER 1024 /* imposed by the AAC encoder. */ + + +/** + ****************************************************************************** + * enumeration M4ENCODER_Audio_OptionID + * @brief This enum defines the core AAC shell encoder options + ****************************************************************************** +*/ +typedef enum +{ + /* Maximum generated AU size */ + M4ENCODER_Audio_maxAUsize = M4OSA_OPTION_ID_CREATE(M4_READ, M4ENCODER_AUDIO, 0x01) + +} M4ENCODER_Audio_OptionID; + + + /** + ****************************************************************************** + * enum M4ENCODER_SamplingFrequency + * @brief Thie enum defines the audio sampling frequency. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_k8000Hz = 8000, + M4ENCODER_k11025Hz = 11025, + M4ENCODER_k12000Hz = 12000, + M4ENCODER_k16000Hz = 16000, + M4ENCODER_k22050Hz = 22050, + M4ENCODER_k24000Hz = 24000, + M4ENCODER_k32000Hz = 32000, + M4ENCODER_k44100Hz = 44100, + M4ENCODER_k48000Hz = 48000 +} M4ENCODER_SamplingFrequency; + + +/** + ****************************************************************************** + * enum M4ENCODER_AudioFormat + * @brief This enum defines the audio compression formats. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kAMRNB = 0, + M4ENCODER_kAAC, + M4ENCODER_kAudioNULL, /**< No compression */ + M4ENCODER_kMP3, + M4ENCODER_kAudio_NB /* number of encoders, keep it as last enum entry */ + +} M4ENCODER_AudioFormat; + +/** + ****************************************************************************** + * enum M4ENCODER_ChannelNumber + * @brief Thie enum defines the number of audio channels. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kMono = 0, + M4ENCODER_kStereo, + M4ENCODER_kStereoNoInterleave +} M4ENCODER_ChannelNumber; + +/** + ****************************************************************************** + * enum M4ENCODER_AudioBitrate + * @brief Thie enum defines the avalaible bitrates. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kAudio_4_75_KBPS = 4750, + M4ENCODER_kAudio_5_15_KBPS = 5150, + M4ENCODER_kAudio_5_9_KBPS = 5900, + M4ENCODER_kAudio_6_7_KBPS = 6700, + M4ENCODER_kAudio_7_4_KBPS = 7400, + M4ENCODER_kAudio_7_95_KBPS = 7950, + M4ENCODER_kAudio_8_KBPS = 8000, + M4ENCODER_kAudio_10_2_KBPS = 10200, + M4ENCODER_kAudio_12_2_KBPS = 12200, + M4ENCODER_kAudio_16_KBPS = 16000, + M4ENCODER_kAudio_24_KBPS = 24000, + M4ENCODER_kAudio_32_KBPS = 32000, + M4ENCODER_kAudio_40_KBPS = 40000, + M4ENCODER_kAudio_48_KBPS = 48000, + M4ENCODER_kAudio_56_KBPS = 56000, + M4ENCODER_kAudio_64_KBPS = 64000, + M4ENCODER_kAudio_80_KBPS = 80000, + M4ENCODER_kAudio_96_KBPS = 96000, + M4ENCODER_kAudio_112_KBPS = 112000, + M4ENCODER_kAudio_128_KBPS = 128000, + M4ENCODER_kAudio_144_KBPS = 144000, + M4ENCODER_kAudio_160_KBPS = 160000, + M4ENCODER_kAudio_192_KBPS = 192000, + M4ENCODER_kAudio_224_KBPS = 224000, + M4ENCODER_kAudio_256_KBPS = 256000, + M4ENCODER_kAudio_320_KBPS = 320000 +} M4ENCODER_AudioBitrate; + + +/** + ****************************************************************************** + * enum M4ENCODER_AacRegulation + * @brief The current mode of the bitrate regulation. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kAacRegulNone = 0, /**< no bitrate regulation */ + M4ENCODER_kAacBitReservoir /**< better quality, but more CPU consumed */ +} M4ENCODER_AacRegulation; + +/** + ****************************************************************************** + * enum M4ENCODER_AmrSID + * @brief This enum defines the SID of the AMR encoder. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kAmrNoSID = 0 /**< no SID */ +} M4ENCODER_AmrSID; + +/** + ****************************************************************************** + * struct M4ENCODER_AacParams + * @brief This structure defines all the settings specific to the AAC encoder. + ****************************************************************************** +*/ +typedef struct +{ + M4ENCODER_AacRegulation Regulation; + M4OSA_Bool bHighSpeed; + M4OSA_Bool bTNS; + M4OSA_Bool bPNS; + M4OSA_Bool bIS; + M4OSA_Bool bMS; +} M4ENCODER_AacParams; + +/** + ****************************************************************************** + * struct M4ENCODER_AudioParams + * @brief This structure defines all the settings avalaible when encoding audio. + ****************************************************************************** +*/ +typedef struct s_M4ENCODER_AudioParams +{ + M4ENCODER_SamplingFrequency Frequency; /**< the sampling frequency */ + M4ENCODER_ChannelNumber ChannelNum; /**< the numbe of channels (mono, stereo, ..) */ + M4ENCODER_AudioBitrate Bitrate; /**< bitrate, see enum */ + M4ENCODER_AudioFormat Format; /**< audio compression format, AMR, AAC ... */ + union { + M4ENCODER_AacParams AacParam; + M4ENCODER_AmrSID AmrSID; + } SpecifParam; /**< the audio encoder specific parameters */ +} M4ENCODER_AudioParams; + +/** + ****************************************************************************** + * struct M4ENCODER_AudioDecSpecificInfo + * @brief This structure describes the decoder specific info buffer. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_MemAddr8 pInfo; /**< the buffer adress */ + M4OSA_UInt32 infoSize; /**< the buffer size in bytes */ +} M4ENCODER_AudioDecSpecificInfo; + +/** + ****************************************************************************** + * struct M4ENCODER_AudioBuffer + * @brief This structure defines the data buffer. + ****************************************************************************** +*/ +typedef struct +{ + /**< the table of buffers (unused buffers are set to NULL) */ + M4OSA_MemAddr8 pTableBuffer[M4ENCODER_AUDIO_NB_CHANNELS_MAX]; + /**< the table of the size of corresponding buffer at same index */ + M4OSA_UInt32 pTableBufferSize[M4ENCODER_AUDIO_NB_CHANNELS_MAX]; +} M4ENCODER_AudioBuffer; + +typedef M4OSA_ERR (M4AE_init) (M4OSA_Context* hContext, M4OSA_Void* pUserData); +typedef M4OSA_ERR (M4AE_cleanUp) (M4OSA_Context pContext); +typedef M4OSA_ERR (M4AE_open) (M4OSA_Context pContext, M4ENCODER_AudioParams *params, + M4ENCODER_AudioDecSpecificInfo *decSpecInfo, + M4OSA_Context grabberContext); +typedef M4OSA_ERR (M4AE_close) (M4OSA_Context pContext); +typedef M4OSA_ERR (M4AE_step) (M4OSA_Context pContext, M4ENCODER_AudioBuffer *inBuffer, + M4ENCODER_AudioBuffer *outBuffer); +typedef M4OSA_ERR (M4AE_getOption) (M4OSA_Context pContext, M4OSA_OptionID option, + M4OSA_DataOption *valuePtr); +/** + ****************************************************************************** + * struct M4ENCODER_AudioGlobalInterface + * @brief Defines all the functions required for an audio encoder shell. + ****************************************************************************** +*/ +typedef struct _M4ENCODER_AudioGlobalInterface +{ + M4AE_init* pFctInit; + M4AE_cleanUp* pFctCleanUp; + M4AE_open* pFctOpen; + M4AE_close* pFctClose; + M4AE_step* pFctStep; + M4AE_getOption* pFctGetOption; +} M4ENCODER_AudioGlobalInterface; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4ENCODER_AUDIOCOMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4ENCODER_common.h b/libvideoeditor/vss/common/inc/M4ENCODER_common.h new file mode 100755 index 0000000..75d1c31 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4ENCODER_common.h @@ -0,0 +1,468 @@ +/* + * 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 M4ENCODER_common.h + * @note This file defines the types internally used by the VES to abstract encoders + + ****************************************************************************** +*/ +#ifndef __M4ENCODER_COMMON_H__ +#define __M4ENCODER_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + * Video preprocessing common interface */ +#include "M4VPP_API.h" + +/** + * Writer common interface */ +#include "M4WRITER_common.h" + +/* IMAGE STAB */ +/* percentage of image suppressed (computed from the standard dimension).*/ +#define M4ENCODER_STAB_FILTER_CROP_PERCENTAGE 10 + /* WARNING: take the inferior even dimension, ex: 10% for QCIF output => 192x158 */ + +/** + ****************************************************************************** + * enum M4ENCODER_OpenMode + * @brief Definition of open mode for the encoder. + * @note DEFAULT : pointer to M4ENCODER_open() which use default parameters + * ADVANCED : pointer to M4ENCODER_open_advanced() which allow to customize + * various encoding parameters + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_OPEN_DEFAULT, + M4ENCODER_OPEN_ADVANCED +} M4ENCODER_OpenMode; + + /** + ****************************************************************************** + * enum M4ENCODER_FrameRate + * @brief Thie enum defines the encoded video framerates. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_k5_FPS, + M4ENCODER_k7_5_FPS, + M4ENCODER_k10_FPS, + M4ENCODER_k12_5_FPS, + M4ENCODER_k15_FPS, + M4ENCODER_k20_FPS, + M4ENCODER_k25_FPS, + M4ENCODER_k30_FPS, + M4ENCODER_kVARIABLE_FPS, /**< Variable video bitrate */ + M4ENCODER_kUSE_TIMESCALE /**< Advanced encoding, use timescale indication rather + than framerate */ +} M4ENCODER_FrameRate; + +/** + ****************************************************************************** + * enum M4ENCODER_InputFormat + * @brief Thie enum defines the video format of the grabbing. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kIYUV420=0, /**< YUV 4:2:0 planar (standard input for mpeg-4 video) */ + M4ENCODER_kIYUV422, /**< YUV422 planar */ + M4ENCODER_kIYUYV, /**< YUV422 interlaced, luma first */ + M4ENCODER_kIUYVY, /**< YUV422 interlaced, chroma first */ + M4ENCODER_kIJPEG, /**< JPEG compressed frames */ + M4ENCODER_kIRGB444, /**< RGB 12 bits 4:4:4 */ + M4ENCODER_kIRGB555, /**< RGB 15 bits 5:5:5 */ + M4ENCODER_kIRGB565, /**< RGB 16 bits 5:6:5 */ + M4ENCODER_kIRGB24, /**< RGB 24 bits 8:8:8 */ + M4ENCODER_kIRGB32, /**< RGB 32 bits */ + M4ENCODER_kIBGR444, /**< BGR 12 bits 4:4:4 */ + M4ENCODER_kIBGR555, /**< BGR 15 bits 5:5:5 */ + M4ENCODER_kIBGR565, /**< BGR 16 bits 5:6:5 */ + M4ENCODER_kIBGR24, /**< BGR 24 bits 8:8:8 */ + M4ENCODER_kIBGR32 /**< BGR 32 bits */ +} M4ENCODER_InputFormat; + +/** + ****************************************************************************** + * enum M4ENCODER_Format + * @brief Thie enum defines the video compression formats. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kMPEG4 = 0, + M4ENCODER_kH263, + M4ENCODER_kH264, + M4ENCODER_kJPEG, + M4ENCODER_kMJPEG, + M4ENCODER_kNULL, + M4ENCODER_kYUV420, /**< No compression */ + M4ENCODER_kYUV422, /**< No compression */ + + M4ENCODER_kVideo_NB /* number of decoders, keep it as last enum entry */ +} M4ENCODER_Format; + +/** + ****************************************************************************** + * enum M4ENCODER_FrameWidth + * @brief Thie enum defines the avalaible frame Width. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_SQCIF_Width = 128, /**< SQCIF 128x96 */ + M4ENCODER_QQVGA_Width = 160, /**< QQVGA 160x120 */ + M4ENCODER_QCIF_Width = 176, /**< QCIF 176x144 */ + M4ENCODER_QVGA_Width = 320, /**< QVGA 320x240 */ + M4ENCODER_CIF_Width = 352, /**< CIF 352x288 */ + M4ENCODER_VGA_Width = 640, /**< VGA 640x480 */ + M4ENCODER_SVGA_Width = 800, /**< SVGA 800x600 */ + M4ENCODER_XGA_Width = 1024, /**< XGA 1024x768 */ + M4ENCODER_XVGA_Width = 1280, /**< XVGA 1280x1024 */ +/* +PR LV5807 */ + M4ENCODER_WVGA_Width = 800, /**< WVGA 800 x 480 */ + M4ENCODER_NTSC_Width = 720, /**< NTSC 720 x 480 */ +/* -PR LV5807 */ + +/* +CR Google */ + M4ENCODER_640_360_Width = 640, /**< 640x360 */ + // StageFright encoders require %16 resolution + M4ENCODER_854_480_Width = 848, /**< 848x480 */ + M4ENCODER_HD1280_Width = 1280, /**< 720p 1280x720 */ + // StageFright encoders require %16 resolution + M4ENCODER_HD1080_Width = 1088, /**< 720p 1088x720 */ + M4ENCODER_HD960_Width = 960 /**< 720p 960x720 */ + +/* -CR Google */ + +} M4ENCODER_FrameWidth; + +/** + ****************************************************************************** + * enum M4ENCODER_FrameHeight + * @brief Thie enum defines the avalaible frame Height. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_SQCIF_Height = 96, /**< SQCIF 128x96 */ + M4ENCODER_QQVGA_Height = 120, /**< QQVGA 160x120 */ + M4ENCODER_QCIF_Height = 144, /**< QCIF 176x144 */ + M4ENCODER_QVGA_Height = 240, /**< QVGA 320x240 */ + M4ENCODER_CIF_Height = 288, /**< CIF 352x288 */ + M4ENCODER_VGA_Height = 480, /**< VGA 340x480 */ + M4ENCODER_SVGA_Height = 600, /**< SVGA 800x600 */ + M4ENCODER_XGA_Height = 768, /**< XGA 1024x768 */ + M4ENCODER_XVGA_Height = 1024, /**< XVGA 1280x1024 */ +/* +PR LV5807 */ + M4ENCODER_WVGA_Height = 480, /**< WVGA 800 x 480 */ + M4ENCODER_NTSC_Height = 480, /**< NTSC 720 x 480 */ +/* -PR LV5807 */ + +/* +CR Google */ + M4ENCODER_640_360_Height = 360, /**< 640x360 */ + M4ENCODER_854_480_Height = 480, /**< 854x480 */ + M4ENCODER_HD1280_Height = 720, /**< 720p 1280x720 */ + M4ENCODER_HD1080_Height = 720, /**< 720p 1080x720 */ + M4ENCODER_HD960_Height = 720 /**< 720p 960x720 */ + +/* -CR Google */ +} M4ENCODER_FrameHeight; + +/** + ****************************************************************************** + * enum M4ENCODER_Bitrate + * @brief Thie enum defines the avalaible bitrates. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_k28_KBPS = 28000, + M4ENCODER_k40_KBPS = 40000, + M4ENCODER_k64_KBPS = 64000, + M4ENCODER_k96_KBPS = 96000, + M4ENCODER_k128_KBPS = 128000, + M4ENCODER_k192_KBPS = 192000, + M4ENCODER_k256_KBPS = 256000, + M4ENCODER_k384_KBPS = 384000, + M4ENCODER_k512_KBPS = 512000, + M4ENCODER_k800_KBPS = 800000 + +} M4ENCODER_Bitrate; + +/* IMAGE STAB */ + +/** + ****************************************************************************** + * enum M4ENCODER_StabMode + * @brief The current mode of the stabilization filter. + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kStabOff = 0, /**< stabilization filter is disabled */ + M4ENCODER_kStabCentered, /**< stabilization filter is enabled. */ + /**< Video input and output must have the same dimensions. Output + image will have black borders */ + M4ENCODER_kStabGrabMore /**< stabilization filter is enabled. */ + /**< Video input dimensions must be bigger than output. The ratio + is indicated by M4ENCODER_STAB_FILTER_CROP_PERCENTAGE */ + +} M4ENCODER_StabMode; + +/** + ****************************************************************************** + * enum M4ENCODER_FrameMode + * @brief Values to drive the encoder behaviour (type of frames produced) + ****************************************************************************** +*/ +typedef enum +{ + M4ENCODER_kNormalFrame = 0, /**< let the encoder decide which type of frame to encode */ + M4ENCODER_kLastFrame = 1, /**< force encoder the flush all its buffers because it is + last frame */ + M4ENCODER_kIFrame = 2 /**< force encoder to generate an I frame */ + +} M4ENCODER_FrameMode; + +/** + ****************************************************************************** + * struct M4ENCODER_Params + * @brief This structure defines all the settings avalaible when encoding. + ****************************************************************************** +*/ +typedef struct +{ + /* Input */ + M4ENCODER_InputFormat InputFormat; /**< Input video format (grabbing) */ + M4ENCODER_FrameWidth InputFrameWidth; /**< Input Frame width (grabbing) */ + M4ENCODER_FrameHeight InputFrameHeight; /**< Input Frame height (grabbing) */ + + /* Output */ + M4ENCODER_FrameWidth FrameWidth; /**< Frame width */ + M4ENCODER_FrameHeight FrameHeight; /**< Frame height */ + M4ENCODER_Bitrate Bitrate; /**< Bitrate, see enum */ + M4ENCODER_FrameRate FrameRate; /**< Framerate, see enum */ + M4ENCODER_Format Format; /**< Video compression format, H263, MPEG4, + MJPEG ... */ + +} M4ENCODER_Params; + +/** + ****************************************************************************** + * struct M4ENCODER_AdvancedParams + * @brief This structure defines the advanced settings available for MPEG-4 encoding. + ****************************************************************************** +*/ +typedef struct +{ + /** + * Input parameters (grabber coupled with encoder): */ + M4ENCODER_InputFormat InputFormat; /**< Input video format */ + M4ENCODER_FrameWidth InputFrameWidth; /**< Input Frame width */ + M4ENCODER_FrameHeight InputFrameHeight; /**< Input Frame height */ + + /** + * Common settings for H263 and MPEG-4: */ + M4ENCODER_FrameWidth FrameWidth; /**< Frame width */ + M4ENCODER_FrameHeight FrameHeight; /**< Frame height */ + M4OSA_UInt32 Bitrate; /**< Free value for the bitrate */ + /**< Framerate (if set to M4ENCODER_kUSE_TIMESCALE use uiRateFactor & uiTimeScale instead) */ + M4ENCODER_FrameRate FrameRate; + /**< Video compression format: H263 or MPEG4 */ + M4ENCODER_Format Format; + M4OSA_UInt32 uiHorizontalSearchRange; /**< Set to 0 will use default value (15) */ + M4OSA_UInt32 uiVerticalSearchRange; /**< Set to 0 will use default value (15) */ + /**< Set to 0 will use default value (0x7FFF i.e. let engine decide when to put an I) */ + M4OSA_UInt32 uiStartingQuantizerValue; + /**< Enable if priority is quality, Disable if priority is framerate */ + M4OSA_Bool bInternalRegulation; + /**< Ratio between the encoder frame rate and the actual frame rate */ + M4OSA_UInt8 uiRateFactor; + /**< I frames periodicity, set to 0 will use default value */ + M4OSA_UInt32 uiIVopPeriod; + /**< Motion estimation [default=0 (all tools), disable=8 (no tool)] */ + M4OSA_UInt8 uiMotionEstimationTools; + + /** + * Settings for MPEG-4 only: */ + M4OSA_UInt32 uiTimeScale; /**< Free value for the timescale */ + M4OSA_Bool bErrorResilience; /**< Disabled by default */ + /**< Disabled by default (if enabled, bErrorResilience should be enabled too!) */ + M4OSA_Bool bDataPartitioning; + M4OSA_Bool bAcPrediction; /**< AC prediction [default=1, disable=0] */ + +} M4ENCODER_AdvancedParams; + +/** + ****************************************************************************** + * struct M4ENCODER_StillPictureParams + * @brief This structure defines all the settings avalaible when encoding still + * picture. + ****************************************************************************** +*/ +typedef struct +{ + M4ENCODER_FrameWidth FrameWidth; /**< Frame width */ + M4ENCODER_FrameHeight FrameHeight; /**< Frame height */ + M4OSA_UInt32 Quality; /**< Bitrate, see enum */ + M4ENCODER_Format InputFormat; /**< YUV 420 or 422 */ + M4ENCODER_Format Format; /**< Video compression format, H263, MPEG4, + MJPEG ... */ + M4OSA_Bool PreProcessNeeded; /**< Is the call to the VPP is necessary */ + M4OSA_Bool EncodingPerStripes; /**< Is encoding per stripes */ + +} M4ENCODER_StillPictureParams; + +/** + ****************************************************************************** + * struct M4ENCODER_Header + * @brief This structure defines the buffer where the sequence header is put. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_MemAddr8 pBuf; /**< Buffer for the header */ + M4OSA_UInt32 Size; /**< Size of the data */ + +} M4ENCODER_Header; + +/** + ****************************************************************************** + * enum M4ENCODER_OptionID + * @brief This enums defines all avalaible options. + ****************************************************************************** +*/ +typedef enum +{ + /**< set the fragment size, option value is M4OSA_UInt32 type */ + M4ENCODER_kOptionID_VideoFragmentSize = M4OSA_OPTION_ID_CREATE (M4_WRITE,\ + M4ENCODER_COMMON, 0x01), + + /**< set the stabilization filtering, option value is M4ENCODER_StabMode type */ + M4ENCODER_kOptionID_ImageStabilization = M4OSA_OPTION_ID_CREATE (M4_WRITE,\ + M4ENCODER_COMMON, 0x02), + + /**< prevent writting of any AU, option value is M4OSA_Bool type */ + M4ENCODER_kOptionID_InstantStop = M4OSA_OPTION_ID_CREATE (M4_WRITE,\ + M4ENCODER_COMMON, 0x03), + + /**< get the DSI (encoder header) generated by the encoder */ + M4ENCODER_kOptionID_EncoderHeader = M4OSA_OPTION_ID_CREATE (M4_READ ,\ + M4ENCODER_COMMON, 0x04), +/*+ CR LV6775 -H.264 Trimming */ + + M4ENCODER_kOptionID_SetH264ProcessNALUfctsPtr= M4OSA_OPTION_ID_CREATE (M4_READ ,\ + M4ENCODER_COMMON, 0x05), + M4ENCODER_kOptionID_H264ProcessNALUContext = M4OSA_OPTION_ID_CREATE (M4_READ ,\ + M4ENCODER_COMMON, 0x06) +/*-CR LV6775 -H.264 Trimming */ +} M4ENCODER_OptionID; + +/*+ CR LV6775 -H.264 Trimming */ +typedef M4OSA_ERR (H264MCS_ProcessEncodedNALU_fct)(M4OSA_Void*ainstance,M4OSA_UInt8* inbuff, + M4OSA_Int32 inbuf_size, + M4OSA_UInt8 *outbuff, M4OSA_Int32 *outbuf_size); +//*- CR LV6775 -H.264 Trimming */ + +typedef M4OSA_Void* M4ENCODER_Context; + +typedef M4OSA_ERR (M4ENCODER_init) ( + M4ENCODER_Context* pContext, + M4WRITER_DataInterface* pWriterDataInterface, + M4VPP_apply_fct* pVPPfct, + M4VPP_Context pVPPctxt, + M4OSA_Void* pExternalAPI, + M4OSA_Void* pUserData +); + +typedef M4OSA_ERR (M4ENCODER_open) ( + M4ENCODER_Context pContext, + M4SYS_AccessUnit* pAU, + M4OSA_Void* pParams /* Can be M4ENCODER_Params, M4ENCODER_AdvancedParams or + M4ENCODER_StillPictureParams */ +); + +typedef M4OSA_ERR (M4ENCODER_start) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_stop) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_pause) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_resume) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_close) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_cleanup) (M4ENCODER_Context pContext); +typedef M4OSA_ERR (M4ENCODER_regulBitRate) (M4ENCODER_Context pContext); + +typedef M4OSA_ERR (M4ENCODER_encode) ( + M4ENCODER_Context pContext, + M4VIFI_ImagePlane* pInPlane, + M4OSA_Double Cts, + M4ENCODER_FrameMode FrameMode +); + +typedef M4OSA_ERR (M4ENCODER_setOption) ( + M4ENCODER_Context pContext, + M4OSA_UInt32 optionID, + M4OSA_DataOption optionValue +); + +typedef M4OSA_ERR (M4ENCODER_getOption) ( + M4ENCODER_Context pContext, + M4OSA_UInt32 optionID, + M4OSA_DataOption optionValue +); + +/** + ****************************************************************************** + * struct M4ENCODER_GlobalInterface + * @brief Defines all the functions required for an encoder shell. + ****************************************************************************** +*/ + +typedef struct _M4ENCODER_GlobalInterface +{ + M4ENCODER_init* pFctInit; + M4ENCODER_open* pFctOpen; + + M4ENCODER_start* pFctStart; /* Grabber mode */ + M4ENCODER_stop* pFctStop; /* Grabber mode */ + + M4ENCODER_pause* pFctPause; /* Grabber mode */ + M4ENCODER_resume* pFctResume; /* Grabber mode */ + + M4ENCODER_close* pFctClose; + M4ENCODER_cleanup* pFctCleanup; + + M4ENCODER_regulBitRate* pFctRegulBitRate; + M4ENCODER_encode* pFctEncode; /* Standalone mode */ + + M4ENCODER_setOption* pFctSetOption; + M4ENCODER_getOption* pFctGetOption; +} M4ENCODER_GlobalInterface; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4ENCODER_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4MDP_API.h b/libvideoeditor/vss/common/inc/M4MDP_API.h new file mode 100755 index 0000000..1000cd8 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4MDP_API.h @@ -0,0 +1,430 @@ +/* + * 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 M4MDP_API.h + * @brief Parser of metadata + * +************************************************************************* +*/ + +#ifndef __M4MDP_API_H__ +#define __M4MDP_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MD4MDP_close M4MDP_close + +#include "M4READER_Common.h" +#include "M4TOOL_VersionInfo.h" +#include "M4OSA_FileReader.h" +#include "M4OSA_FileWriter.h" + +/*define the buffer size for content detection*/ +#define M4MDP_INPUT_BUFFER_SIZE 8192 + +/** + ************************************************************************ + * Public type of the M4MDP_osaFilePtrSt + ************************************************************************ +*/ +typedef struct +{ + M4OSA_FileReadPointer* m_pFileReaderFcts; + M4OSA_FileWriterPointer* m_pFileWriterFcts; +} M4MDP_osaFilePtrSt; + +/** + ************************************************************************ + * Public type of the MDP execution context + ************************************************************************ +*/ +typedef M4OSA_Void* M4MDP_Context; + +/** + ************************************************************************ + * Metadata Parser Errors & Warnings definition + ************************************************************************ +*/ +#define M4WAR_MDP_MEDIATYPE_NOT_DETECTED M4OSA_ERR_CREATE(M4_WAR, M4MDP, 0x000001) + +#define M4ERR_MDP_FATAL M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000000) +#define M4ERR_MDP_UNSUPPORTED_TAG_VERSION M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000001) +#define M4ERR_MDP_UNSUPPORTED_ENCODING_TYPE M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000002) +#define M4ERR_MDP_INIT_FAILED M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000003) +#define M4ERR_MDP_ASSET_PARSING_ERROR M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000004) +#define M4ERR_MDP_FILE_NOT_FOUND M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000005) +#define M4ERR_MDP_INVALID_PATH M4OSA_ERR_CREATE(M4_ERR, M4MDP, 0x000006) + +/** + ************************************************************************ + * Metadata parser FUNCTIONS + ************************************************************************ +*/ + +/** + ************************************************************************ + * @brief Getting the version of the metadata parser + * This function allows getting the version of the MDP library. + * + * @param pVersionInfo (OUT) Pointer on an allocated version info structure + * After M4MDP_getVersion() successfully returns, this + * structure is filled with the version numbers. + * The structure must be allocated and further de-allocated + * by the application. + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pVersionInfo is null (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getVersion(M4_VersionInfo* pVersionInfo); + + +/** + ************************************************************************ + * @brief Initializing the MDP + * This function initializes the MDP and allocates the MDP execution + * context and parses the metadata + * @note This function allocates the memory needed to store metadata in + * TAG ID3 V1&V2, ASF or 3gpp asset structure with the OSAL allocation + * function. + * This memory will be freed in M4MDP_cleanUp function + * + * @note This function is synchronous. + * + * @param pContext (OUT) Execution Context + * @param pFilePath (IN) Pointer to the multimedia file path + * @param pFileReaderFcts (IN) Pointer to a structure containing OSAL file reader + * functions pointers + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER At least, one parameter is null (in DEBUG only) + * @return M4ERR_ALLOC There is no more memory available + * @return M4WAR_READER_NO_METADATA The input file doesn't contain metadata + * @return M4ERR_UNSUPPORTED_MEDIA_TYPE The input file is not recognized + ************************************************************************ +*/ +M4OSA_ERR M4MDP_init(M4MDP_Context* pContext, M4OSA_Char* pFilePath, + M4OSA_FileReadPointer* pFileReaderFcts); + +/** + ************************************************************************ + * @brief This function frees the MDP execution context and all metadata + * structures already allocated by M4MDP_init + * + * @note This function is synchronous. + * + * @param pContext (IN) Execution Context + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext is NULL. (in DEBUG only) +************************************************************************ +*/ +M4OSA_ERR M4MDP_cleanUp(M4MDP_Context pContext); + +/** + ************************************************************************ + * @brief This function Initializes the meta data parser only once to check several files one + * after another. + * + * @note This function is synchronous. + * + * @param pContext (IN) Execution Context + * @param pFileReaderFcts (IN) Pointer to a structure containing OSAL file reader + * functions pointers +* + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext is NULL. (in DEBUG only) +************************************************************************ +*/ +M4OSA_ERR M4MDP_globalInit(M4MDP_Context* pContext, M4OSA_FileReadPointer* pFileReaderFcts); + +/** + ************************************************************************ + * @brief This function opens a file in the meta data parser + * + * @note This function is synchronous. + * + * @param pContext (IN) Execution Context + * @param pFilePath (IN) Pointer to the multimedia file path + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext is NULL. (in DEBUG only) +************************************************************************ +*/ +M4OSA_ERR M4MDP_open(M4MDP_Context* pContext, M4OSA_Char* pFilePath); + +/** + ************************************************************************ + * @brief This function closes a file in the meta data parser + * + * @note This function is synchronous. + * + * @param pContext (IN) Execution Context + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext is NULL. (in DEBUG only) +************************************************************************ +*/ +M4OSA_ERR M4MDP_close(M4MDP_Context* pContext); + + +/** + ************************************************************************ + * @brief The function allows the retrieval of all fields of the + * M4_MetaDataFields structure + * It basically sets M4_MetaDataFields structure fields pointers to + * the corresponding already retrieved metadata + * + * @note If metadata are retrieved from an MP3 or an AAC files, and both + * TAG ID3 V1 and V2 are present, then, priority is for metadata of TAG ID3 V2 + * + * @note This function is synchronous. + * @note This function is used specially by the music manager project + * + * @param pContext (IN) Execution Context + * @param pMetadata (OUT) Pointer to M4_MetaDataFields structure + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pMetadata is NULL. (in DEBUG only) + * @return M4WAR_READER_NO_METADATA The input file doesn't contain metadata + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getMetadata(M4MDP_Context pContext, M4_MetaDataFields* pMetadata); + +/** + ************************************************************************ + * @brief This function returns the audio and video media type + * + * @note This function is synchronous. + * @note This function is used specially by the music manager project + * + * @param pContext (IN) Execution Context + * @param pAudio (OUT) Audio media type pointer + * @param pVideo (OUT) Video media type pointer + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER At least one parameter is NULL. (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getStreamsType(M4MDP_Context pContext,M4_StreamType* pAudio,M4_StreamType* pVideo); + + +/** + ************************************************************************ + * @brief This function returns the mediaType + * + * @note This function is synchronous. + * @note This function is used specially by the music manager project + * + * @param pContext (IN) Execution Context + * @param pMediaType (OUT) MediaType pointer + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER At least one parameter is NULL. (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getMediaType(M4MDP_Context pContext,M4READER_MediaType* pMediaType); + +/****************************************************************************** +* @brief returns mediaType found in a file +* @note +* @param pFileDescriptor (IN) : pointer to file descriptor +* @param pFileFunction (IN) : pointer to file function +* @param pMediaType (OUT) : mediaType if found +* @return M4NO_ERROR / M4ERR_ALLOC +******************************************************************************/ +M4OSA_ERR M4MDP_getMediaTypeFromFile(M4OSA_Void *pFileDescriptor, + M4OSA_FileReadPointer *pFileFunction, + M4READER_MediaType *pMediaType); + +/****************************************************************************** +* @brief return media type by extension and content detections +* @note +* @param pFileDescriptor (IN) : pointer to file descriptor +* @param dataBuffer (IN) : memory buffer +* @param bufferSize (IN) : buffer size +* @param pMediaType (OUT) : mediaType if found +* @return M4NO_ERROR / M4ERR_ALLOC +******************************************************************************/ +M4OSA_ERR M4MDP_getMediaTypeFromExtensionAndContent(M4OSA_Void *pFileDescriptor, + M4OSA_UInt8 *dataBuffer, + M4OSA_UInt32 bufferSize, + M4READER_MediaType *pMediaType); + +/****************************************************************************** +* @brief return media type by content detection +* @note +* @param dataBuffer (IN) : memory buffer +* @param bufferSize (IN) : buffer size +* @param pMediaType (OUT) : mediaType if found +* @return M4NO_ERROR / M4ERR_ALLOC +******************************************************************************/ +M4OSA_ERR M4MDP_getMediaTypeFromContent(M4OSA_UInt8 *dataBuffer, M4OSA_UInt32 bufferSize, + M4READER_MediaType *pMediaType); + +/** + ************************************************************************ + * @brief The function parses the buffer pAsfBuffer, extracts metadata, + * allocates memory for pMetaData and fills in. + * + * @note pAsfBuffer owns the application (caller). + * The application free pAsfBuffer and pMetaData + * + * @note This function is synchronous. + * + * @param pAsfBuffer (IN) input buffer + * @param pMetaData (OUT) Pointer to the metadata structure + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pAsfBuffer is NULL. (in DEBUG only) + * @return M4ERR_ALLOC There is no more memory available + * @return M4WAR_READER_NO_METADATA The M4READER_Buffer doesn't contain metadata + * @return M4ERR_UNSUPPORTED_MEDIA_TYPE The input file is not recognized + ************************************************************************ +*/ +M4OSA_ERR M4MDP_parseASFContentDesc(M4READER_Buffer* pAsfBuffer, M4_MetaDataFields *pMetaData); + + +/** + ************************************************************************ + * @brief The function allocates memory for pMetaData and copies its + * pAssetFields fields + * + * @note The application which calls M4MDP_parse3GppAssetField MUST free pMetaData. + * + * @note This function is synchronous. + * + * @param pAssetFields (IN) Asset fields structure filled by the 3gpp reader + * @param pMetaData (OUT) Metadata structure to be filled in + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pAssetFields is NULL. (in DEBUG only) + * @return M4ERR_ALLOC There is no more memory available + * @return M4ERR_UNSUPPORTED_MEDIA_TYPE The input file is not recognized + ************************************************************************ +*/ +M4OSA_ERR M4MDP_parse3GppAssetField(M4_MetaDataFields* pAssetFields, M4_MetaDataFields *pMetaData); + + +/** + ************************************************************************ + * @brief The function allocates memory for pMetaData and copies its + * pExifFields fields + * + * @note The application which calls M4MDP_parseExifField MUST free pMetaData. + * + * @note This function is synchronous. + * + * @param pExifFields (IN) Exif fields structure filled by the exif reader + * @param pMetaData (OUT) Metadata structure to be filled in + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pAssetFields is NULL. (in DEBUG only) + * @return M4ERR_ALLOC There is no more memory available + * @return M4ERR_UNSUPPORTED_MEDIA_TYPE The input file is not recognized + ************************************************************************ +*/ +M4OSA_ERR M4MDP_parseExifField(M4_MetaDataFields *pExifFields, M4_MetaDataFields *pMetaData); + + +/** + ************************************************************************ + * @brief The function allocates and fills the pMetaDataStruct by parsing + * a buffer + * + * @note pMetaDataStruct owns the application (caller). + * It is the responsibility of the application (caller) to free it + * + * @note This function is synchronous. + * + * @param pBuffer (IN) input buffer + * @param mediaType (IN) media type of the buffer + * @param pMetaDataStruct (OUT) Pointer to an array of metadata + * @param pSize (OUT) pMetaDataStruct size + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pBuffer or pMetaDataStruct is NULL. + * (in DEBUG only) + * @return M4ERR_ALLOC There is no more memory available + * @return M4ERR_UNSUPPORTED_MEDIA_TYPE The media type is not supported + * @return M4WAR_READER_NO_METADATA No metadata detected + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getMetaDataFromBuffer(M4_MetadataBuffer* pBuffer, + M4READER_MediaType mediaType, + M4_MetaDataFields** pMetaDataStruct, + M4OSA_UInt32* pSize); + +/** + ************************************************************************ + * @brief The function initializes the metadata structure + * + * @param pMetadata (OUT) Pointer to M4_MetaDataFields structure + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pMetadata is NULL. (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_InitMetaDataFields(M4_MetaDataFields *pMetaDataTab); + +/** + ************************************************************************ + * @brief The function frees the metadata structure + * + * @param pMetadata (IN) Pointer to M4_MetaDataFields structure + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pMetadata is NULL. (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_FreeMetaDataFields(M4_MetaDataFields *pMetaDataTab); + +/****************************************************************************** +* @brief returns mediaType found in a file +* @note +* @param pContext (IN) : pointer to file descriptor +* @param pFileDescriptor (IN) : pointer to file descriptor +* @param pFileFunction (IN) : pointer to file function +* @param pMediaType (OUT) : mediaType if found +* @return M4NO_ERROR / M4ERR_ALLOC +******************************************************************************/ +M4OSA_ERR M4MDP_getMediaTypeFromFileExtended( M4MDP_Context pContext, + M4OSA_Void *pFileDescriptor, + M4OSA_FileReadPointer *pFileFunction, + M4READER_MediaType *pMediaType); + +/** + ************************************************************************ + * @brief The function to get file size + * + * @param pContext (IN) Pointer to M4MDP Context structure + * @param pSize (OUT)Pointer to file size + * + * @return M4NO_ERROR No error + * @return M4ERR_PARAMETER pContext or pMetadata is NULL. (in DEBUG only) + ************************************************************************ +*/ +M4OSA_ERR M4MDP_getMetaDataFileSize(M4MDP_Context pContext, M4OSA_UInt32 *pSize); + +#ifdef __cplusplus +} +#endif + +#endif /* __M4MDP_API_H__ */ diff --git a/libvideoeditor/vss/common/inc/M4OSA_CoreID.h b/libvideoeditor/vss/common/inc/M4OSA_CoreID.h new file mode 100755 index 0000000..425c8ec --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4OSA_CoreID.h @@ -0,0 +1,201 @@ +/* + * 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 M4OSA_CoreID.h + * @brief defines the uniques component identifiers used for memory management + * and optionID mechanism + * @note + * + ************************************************************************ +*/ +#ifndef __M4OSA_COREID_H__ +#define __M4OSA_COREID_H__ + +/* CoreId are defined on 14 bits */ +/* we start from 0x0100, lower values are reserved for osal core components */ + +/* reader shells*/ +#define M4READER_COMMON 0x0100 +#define M4READER_AVI 0x0101 +#define M4READER_AMR 0x0102 +#define M4READER_3GP 0x0103 +#define M4READER_NET 0x0104 +#define M4READER_3GP_HTTP 0x0105 +#define M4READER_MP3 0x0106 +#define M4READER_WAV 0x0107 +#define M4READER_MIDI 0x0108 +#define M4READER_ASF 0x0109 +#define M4READER_REAL 0x010A +#define M4READER_AAC 0x010B +#define M4READER_FLEX 0x010C +#define M4READER_BBA 0x010D +#define M4READER_SYNTHESIS_AUDIO 0x010E +#define M4READER_JPEG 0x010F + + +/* writer shells*/ +#define M4WRITER_COMMON 0x0110 +#define M4WRITER_AVI 0x0111 +#define M4WRITER_AMR 0x0112 +#define M4WRITER_3GP 0x0113 +#define M4WRITER_JPEG 0x0116 +#define M4WRITER_MP3 0x0117 + +/* decoder shells */ +#define M4DECODER_COMMON 0x0120 +#define M4DECODER_JPEG 0x0121 +#define M4DECODER_MPEG4 0x0122 +#define M4DECODER_AUDIO 0x0123 +#define M4DECODER_AVC 0x0124 +#define M4DECODER_MIDI 0x0125 +#define M4DECODER_WMA 0x0126 +#define M4DECODER_WMV 0x0127 +#define M4DECODER_RMV 0x0128 +#define M4DECODER_RMA 0x0129 +#define M4DECODER_AAC 0x012A +#define M4DECODER_BEATBREW 0x012B +#define M4DECODER_EXTERNAL 0x012C + +/* encoder shells */ +#define M4ENCODER_COMMON 0x0130 +#define M4ENCODER_JPEG 0x0131 +#define M4ENCODER_MPEG4 0x0132 +#define M4ENCODER_AUDIO 0x0133 +#define M4ENCODER_VID_NULL 0x0134 +#define M4ENCODER_MJPEG 0x0135 +#define M4ENCODER_MP3 0x0136 +#define M4ENCODER_H264 0x0137 +#define M4ENCODER_AAC 0x0138 +#define M4ENCODER_AMRNB 0x0139 +#define M4ENCODER_AUD_NULL 0x013A +#define M4ENCODER_EXTERNAL 0x013B + +/* cores */ +#define M4JPG_DECODER 0x0140 +#define M4JPG_ENCODER 0x0141 + +#define M4MP4_DECODER 0x0142 +#define M4MP4_ENCODER 0x0143 + +#define M4AVI_COMMON 0x0144 +#define M4AVI_READER 0x0145 +#define M4AVI_WRITER 0x0146 + +#define M4HTTP_ENGINE 0x0147 + +#define M4OSA_TMPFILE 0x0148 +#define M4TOOL_TIMER 0x0149 + +#define M4AMR_READER 0x014A + +#define M4MP3_READER 0x014B + +#define M4WAV_READER 0x014C +#define M4WAV_WRITER 0x014D +#define M4WAV_COMMON 0x014E + +#define M4ADTS_READER 0x014F +#define M4ADIF_READER 0x016A + +#define M4SPS 0x0150 +#define M4EXIF_DECODER 0x0151 +#define M4EXIF_ENCODER 0x0152 +#define M4GIF_DECODER 0x0153 +#define M4GIF_ENCODER 0x0154 +#define M4PNG_DECODER 0x0155 +#define M4PNG_ENCODER 0x0156 +#define M4WBMP_DECODER 0x0157 +#define M4WBMP_ENCODER 0x0158 + +#define M4AMR_WRITER 0x0159 /**< no room to put it along M4AMR_READER */ + + +#define M4AVC_DECODER 0x015A +#define M4AVC_ENCODER 0x015B + +#define M4ASF_READER 0x015C +#define M4WMDRM_AGENT 0x015D +#define M4MIDI_READER 0x0162 /**< no room before the presenters */ +#define M4RM_READER 0x163 +#define M4RMV_DECODER 0x164 +#define M4RMA_DECODER 0x165 + +#define M4TOOL_XML 0x0166 +#define M4TOOL_EFR 0x0167 /**< Decryption module for Video Artist */ +#define M4IAL_FTN 0x0168 /* FTN implementation of the IAL */ +#define M4FTN 0x0169 /* FTN library */ + +/* presenter */ +#define M4PRESENTER_AUDIO 0x0160 +#define M4PRESENTER_VIDEO 0x0161 + +/* high level interfaces (vps, etc..)*/ +#define M4VPS 0x0170 +#define M4VTS 0x0171 +#define M4VXS 0x0172 +#define M4CALLBACK 0x0173 +#define M4VES 0x0174 +#define M4PREPROCESS_VIDEO 0x0175 +#define M4GRAB_AUDIO 0x0176 +#define M4GRAB_VIDEO 0x0177 +#define M4VSSAVI 0x0178 +#define M4VSS3GPP 0x0179 +#define M4PTO3GPP 0x017A +#define M4PVX_PARSER 0x017B +#define M4VCS 0x017C +#define M4MCS 0x017D +#define M4MNMC 0x0180 /**< mnm controller */ +#define M4TTEXT_PARSER 0x0181 /**< timed text */ +#define M4MM 0x0182 /**< Music manager */ +#define M4MDP 0x0183 /**< Metadata parser */ +#define M4MMSQLCORE 0x0184 +#define M4VPSIL 0x0185 +#define M4FILEIL 0x0186 /* IL file Interface */ +#define M4MU 0x0187 +#define M4VEE 0x0188 /**< Video effect engine */ +#define M4VA 0x0189 /* VideoArtist */ +#define M4JTS 0x018A +#define M4JTSIL 0x018B +#define M4AIR 0x018C /**< AIR */ +#define M4SPE 0x018D /**< Still picture editor */ +#define M4VS 0x018E /**< Video Studio (xVSS) */ +#define M4VESIL 0x018F /**< VES il */ +#define M4ID3 0x0190 /**< ID3 Tag Module */ +#define M4SC 0x0191 /**< Media Scanner */ +#define M4TG 0x0192 /**< Thumbnail Generator*/ +#define M4TS 0x0193 /**< Thumbnail storage */ +#define M4MB 0x0194 /**< Media browser */ + +/* high level application (test or client app) */ +#define M4APPLI 0x0200 +#define M4VA_APPLI 0x0201 /**< Video Artist test application */ + +/* external components (HW video codecs, etc.) */ +#define M4VD_EXTERNAL 0x0300 +#define M4VE_EXTERNAL 0x0301 + + +/* priority to combine with module ids */ +#define M4HIGH_PRIORITY 0xC000 +#define M4MEDIUM_PRIORITY 0x8000 +#define M4LOW_PRIORITY 0x4000 +#define M4DEFAULT_PRIORITY 0x0000 + + +#endif /*__M4OSA_COREID_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4PCMR_CoreReader.h b/libvideoeditor/vss/common/inc/M4PCMR_CoreReader.h new file mode 100755 index 0000000..78fe910 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4PCMR_CoreReader.h @@ -0,0 +1,133 @@ +/* + * 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 M4WAV_WavReader.h + * @brief WAV Reader declarations + * @note This file implements functions of the WAV reader + ************************************************************************ +*/ + +#include "M4OSA_CoreID.h" +#include "M4OSA_Types.h" +#include "M4OSA_Memory.h" +#include "M4OSA_FileReader.h" +#include "M4SYS_AccessUnit.h" +#include "M4TOOL_VersionInfo.h" + + +#define M4PCMC_ERR_PCM_NOT_COMPLIANT M4OSA_ERR_CREATE(M4_ERR, M4WAV_COMMON,0x000001) +#define M4PCMC_ERR_PCM_NO_SPACE_AVAIL M4OSA_ERR_CREATE(M4_ERR, M4WAV_COMMON,0x000002) +#define M4PCMC_ERR_PCM_NOT_SUPPORTED M4OSA_ERR_CREATE(M4_ERR, M4WAV_COMMON,0x000003) + +#define M4PCMC_WAR_END_OF_STREAM M4OSA_ERR_CREATE(M4_WAR, M4WAV_COMMON ,0x000001) + +/** + ************************************************************************ + * structure M4WAVC_DecoderSpecificInfo + * @brief This structure defines the decoder Specific informations + * @note This structure is used by the WAV reader to store all + * decoder specific informations: + * - Sample Frequency + * - Average Bytes per second + * - Number of channels (1 or 2) + * - Number of bits per sample (8 or 16) + ************************************************************************ +*/ +typedef struct { + M4OSA_UInt32 SampleFrequency; + M4OSA_UInt32 AvgBytesPerSec; + M4OSA_UInt32 DataLength; + M4OSA_UInt16 nbChannels; + M4OSA_UInt16 BitsPerSample; +} M4PCMC_DecoderSpecificInfo; + +/** + ************************************************************************ + * enum M4WAVR_State + * @brief This enum defines the WAV Reader States + * @note The state automaton is documented separately + * consult the design specification for details + ************************************************************************ +*/ +typedef enum { + M4PCMR_kInit = 0x0000, + M4PCMR_kOpening = 0x0100, + M4PCMR_kOpening_streamRetrieved = 0x0101, + M4PCMR_kReading = 0x0200, + M4PCMR_kReading_nextAU = 0x0201, + M4PCMR_kClosed = 0x0300 +} M4PCMR_State; + +/** + ************************************************************************ + * enum M4WAVR_OptionID + * @brief This enum defines the WAV Reader options + * @note Only one option is available: + * - M4WAVR_kPCMblockSize: sets the size of the PCM block to read + * from WAV file + ************************************************************************ +*/ +typedef enum { + M4PCMR_kPCMblockSize = M4OSA_OPTION_ID_CREATE(M4_READ, M4WAV_READER, 0x01) +} M4PCMR_OptionID; + +/** + ************************************************************************ + * structure M4WAVR_Context + * @brief This structure defines the WAV Reader context + * @note This structure is used for all WAV Reader calls to store + * the context + ************************************************************************ +*/ +typedef struct { + M4OSA_MemAddr32 m_pDecoderSpecInfo;/**< Pointer to the decoder specific info + structure contained in pStreamDesc + (only used to free...) */ + M4OSA_FileReadPointer* m_pFileReadFunc;/**< The OSAL set of pointer to function for + file management */ + M4OSA_Context m_fileContext; /**< The context needed by OSAL to manage File */ + M4PCMC_DecoderSpecificInfo m_decoderConfig;/**< Specific configuration for decoder */ + M4PCMR_State m_state; /**< state of the wav reader */ + M4PCMR_State m_microState; /**< state of the read wav stream */ + M4OSA_UInt32 m_blockSize; /**< Size of the read block */ + M4OSA_UInt32 m_offset; /**< Offset of the PCM read (i.e m_offset of the + file without wav header) */ + M4OSA_MemAddr32 m_pAuBuffer; /**< Re-used buffer for AU content storage */ + M4OSA_FilePosition m_dataStartOffset;/**< offset of the pcm data beginning into + the file */ +} M4PCMR_Context; + +/************************************************************************* + * + * Prototypes of all WAV reader functions + * + ************************************************************************/ +M4OSA_ERR M4PCMR_openRead(M4OSA_Context* pContext, M4OSA_Void* pUrl, + M4OSA_FileReadPointer* pFileFunction); +M4OSA_ERR M4PCMR_getNextStream(M4OSA_Context context, M4SYS_StreamDescription* pStreamDesc); +M4OSA_ERR M4PCMR_startReading(M4OSA_Context context, M4SYS_StreamID* pStreamIDs); +M4OSA_ERR M4PCMR_nextAU(M4OSA_Context context, M4SYS_StreamID streamID, M4SYS_AccessUnit* pAU); +M4OSA_ERR M4PCMR_freeAU(M4OSA_Context context, M4SYS_StreamID streamID, M4SYS_AccessUnit* pAU); +M4OSA_ERR M4PCMR_seek(M4OSA_Context context, M4SYS_StreamID* pStreamID, M4OSA_Time time, + M4SYS_SeekAccessMode seekAccessMode, M4OSA_Time* pObtainCTS); +M4OSA_ERR M4PCMR_closeRead(M4OSA_Context context); +M4OSA_ERR M4PCMR_getOption(M4OSA_Context context, M4PCMR_OptionID optionID, + M4OSA_DataOption* pValue); +M4OSA_ERR M4PCMR_setOption(M4OSA_Context context, M4PCMR_OptionID optionID, + M4OSA_DataOption Value); +M4OSA_ERR M4PCMR_getVersion(M4_VersionInfo *pVersion); diff --git a/libvideoeditor/vss/common/inc/M4READER_3gpCom.h b/libvideoeditor/vss/common/inc/M4READER_3gpCom.h new file mode 100755 index 0000000..ab07d50 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4READER_3gpCom.h @@ -0,0 +1,194 @@ +/* + * 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 M4READER_3gpCom.h + * @brief Generic encapsulation of the core 3gp reader + * @note This file declares the generic shell interface retrieving function + * of the 3GP reader + ************************************************************************ +*/ + +#ifndef __M4READER_3GPCOM_H__ +#define __M4READER_3GPCOM_H__ + +#include "NXPSW_CompilerSwitches.h" + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4READER_Common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Error: Function M4READER_Com3GP_getNextStreamHandler must be called before. + */ +#define M4ERR_NO_VIDEO_STREAM_RETRIEVED_YET M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000001) + +/** + * Error: No video stream H263 in file. + */ +#define M4ERR_VIDEO_NOT_H263 M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000002) + +/** + * There has been a problem with the decoder configuration information, seems to be invalid */ +#define M4ERR_READER3GP_DECODER_CONFIG_ERROR M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000003) + +#define M4READER_COM3GP_MAXVIDEOSTREAM 5 +#define M4READER_COM3GP_MAXAUDIOSTREAM 5 +#define M4READER_COM3GP_MAXTEXTSTREAM 5 + +typedef struct +{ + M4OSA_Context m_pFFContext; /**< core file format context */ + + M4_StreamHandler* m_AudioStreams[M4READER_COM3GP_MAXAUDIOSTREAM]; + M4_StreamHandler* m_pAudioStream; /**< pointer to the current allocated audio + stream handler */ + + M4_StreamHandler* m_VideoStreams[M4READER_COM3GP_MAXVIDEOSTREAM]; + M4_StreamHandler* m_pVideoStream; /**< pointer to the current allocated video + stream handler */ + +#ifdef M4VPS_SUPPORT_TTEXT + M4_StreamHandler* m_TextStreams[M4READER_COM3GP_MAXTEXTSTREAM]; + M4_StreamHandler* m_pTextStream; /**< pointer to the current allocated text + stream handler */ +#endif /*M4VPS_SUPPORT_TTEXT*/ + +} M4READER_Com3GP_Context; + +/** + ************************************************************************ + * structure M4READER_3GP_Buffer (but nothing specific to 3GP, nor to a reader !) + * @brief This structure defines a buffer that can be used to exchange data (should be in OSAL) + ************************************************************************ +*/ +typedef struct +{ + M4OSA_UInt32 size; /**< the size in bytes of the buffer */ + M4OSA_MemAddr8 dataAddress; /**< the pointer to the buffer */ +} M4READER_3GP_Buffer; + +/** + ************************************************************************ + * enum M4READER_3GP_OptionID + * @brief This enum defines the reader options specific to the 3GP format. + * @note These options can be read from or written to a 3GP reader via M4READER_3GP_getOption. + ************************************************************************ +*/ +typedef enum +{ + /** + * Get the DecoderConfigInfo for H263, + * option value must be a pointer to M4READER_3GP_H263Properties allocated by caller */ + M4READER_3GP_kOptionID_H263Properties = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x01), + + /** + * Get the Purple Labs drm information */ + M4READER_3GP_kOptionID_PurpleLabsDrm = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x02), + + /** + * Set the Fast open mode (Only the first AU of each stream will be parsed -> less CPU, + less RAM). */ + M4READER_3GP_kOptionID_FastOpenMode = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x03), + + /** + * Set the Audio only mode (the video stream won't be opened) */ + M4READER_3GP_kOptionID_AudioOnly = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x04), + + /** + * Set the Video only mode (the audio stream won't be opened) */ + M4READER_3GP_kOptionID_VideoOnly = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x05), + + /** + * Get the next video CTS */ + M4READER_3GP_kOptionID_getNextVideoCTS = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x06) + +} M4READER_3GP_OptionID; + + +/** + ************************************************************************ + * struct M4READER_3GP_H263Properties + * @brief Contains info about H263 stream read from the 3GP file. + ************************************************************************ +*/ +typedef struct +{ + /**< the profile as defined in the Visual Object Sequence header, if present */ + M4OSA_UInt8 uiProfile; + /**< the level as defined in the Visual Object Sequence header, if present */ + M4OSA_UInt8 uiLevel; + +} M4READER_3GP_H263Properties; + +/** + ************************************************************************ + * @brief Get the next stream found in the 3gp file + * @note + * @param pContext: (IN) Context of the reader + * @param pMediaFamily: (OUT) Pointer to a user allocated M4READER_MediaFamily that will + * be filled with the media family of the found stream + * @param pStreamHandler: (OUT) Pointer to a stream handler that will be allocated and + * filled with the found stream description + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER At least one parameter is not properly set + * @return M4WAR_NO_MORE_STREAM No more available stream in the media (all streams found) + ************************************************************************ +*/ +M4OSA_ERR M4READER_Com3GP_getNextStreamHandler(M4OSA_Context context, + M4READER_MediaFamily *pMediaFamily, + M4_StreamHandler **pStreamHandler); + +/** + ************************************************************************ + * @brief Prepare the access unit (AU) + * @note An AU is the smallest possible amount of data to be decoded by a decoder. + * @param pContext: (IN) Context of the reader + * @param pStreamHandler (IN) The stream handler of the stream to make jump + * @param pAccessUnit (IN/OUT) Pointer to an access unit to fill with read data + * (the au structure is allocated by the user, and must + * be initialized by calling M4READER_fillAuStruct_fct + * after creation) + * @return M4NO_ERROR There is no error + * @return M4ERR_PARAMETER At least one parameter is not properly set + * @returns M4ERR_ALLOC Memory allocation failed + ************************************************************************ +*/ +M4OSA_ERR M4READER_Com3GP_fillAuStruct(M4OSA_Context context, M4_StreamHandler *pStreamHandler, + M4_AccessUnit *pAccessUnit); + +/** + ************************************************************************ + * @brief Cleans up the stream handler + * @param pContext: (IN/OUT) Context of the reader shell + * @param pStreamHandler: (IN/OUT) Stream handler + * @return M4ERR_PARAMETER: The context is null + * @return M4NO_ERROR: No error + ************************************************************************ +*/ +M4OSA_ERR M4READER_Com3GP_cleanUpHandler(M4_StreamHandler* pStreamHandler); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4READER_3GPCOM_H__ */ + diff --git a/libvideoeditor/vss/common/inc/M4READER_Amr.h b/libvideoeditor/vss/common/inc/M4READER_Amr.h new file mode 100755 index 0000000..630f657 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4READER_Amr.h @@ -0,0 +1,62 @@ +/* + * 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 M4READER_Amr.h + * @brief Generic encapsulation of the core amr reader + * @note This file declares the generic shell interface retrieving function + * of the AMR reader + ************************************************************************ +*/ +#ifndef __M4READER_AMR_H__ +#define __M4READER_AMR_H__ + +#include "M4READER_Common.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** +************************************************************************* +* @brief Retrieves the generic interfaces implemented by the reader +* +* @param pMediaType : Pointer on a M4READER_MediaType (allocated by the caller) +* that will be filled with the media type supported by this reader +* @param pRdrGlobalInterface : Address of a pointer that will be set to the global interface +* implemented by this reader. The interface is a structure allocated +* by the function and must be un-allocated by the caller. +* @param pRdrDataInterface : Address of a pointer that will be set to the data interface +* implemented by this reader. The interface is a structure allocated +* by the function and must be un-allocated by the caller. +* +* @returns : M4NO_ERROR if OK +* ERR_ALLOC if an allocation failed +* ERR_PARAMETER at least one parameter is not properly set (in DEBUG only) +************************************************************************* +*/ +M4OSA_ERR M4READER_AMR_getInterfaces(M4READER_MediaType *pMediaType, + M4READER_GlobalInterface **pRdrGlobalInterface, + M4READER_DataInterface **pRdrDataInterface); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4READER_AMR_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4READER_Common.h b/libvideoeditor/vss/common/inc/M4READER_Common.h new file mode 100755 index 0000000..cf310a5 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4READER_Common.h @@ -0,0 +1,718 @@ +/* + * 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 M4READER_Common.h + * @brief Shell Reader common interface declaration + * @note This file declares the common interfaces that reader shells must implement + * + ************************************************************************ +*/ +#ifndef __M4READER_COMMON_H__ +#define __M4READER_COMMON_H__ + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_FileReader.h" +#include "M4OSA_CoreID.h" +#include "M4DA_Types.h" +#include "M4Common_types.h" + +/* ERRORS */ +#define M4ERR_READER_UNKNOWN_STREAM_TYPE M4OSA_ERR_CREATE(M4_ERR, M4READER_COMMON, 0x0001) + +/* WARNINGS */ +#define M4WAR_READER_NO_METADATA M4OSA_ERR_CREATE(M4_WAR, M4READER_COMMON, 0x0001) +#define M4WAR_READER_INFORMATION_NOT_PRESENT M4OSA_ERR_CREATE(M4_WAR, M4READER_COMMON, 0x0002) + + +/** + ************************************************************************ + * enum M4READER_MediaType + * @brief This enum defines the Media types used to create media readers + * @note This enum is used internally by the VPS to identify a currently supported + * media reader interface. Each reader is registered with one of this type associated. + * When a reader instance is needed, this type is used to identify and + * and retrieve its interface. + ************************************************************************ +*/ +typedef enum +{ + M4READER_kMediaTypeUnknown = -1, /**< Unknown media type */ + M4READER_kMediaType3GPP = 0, /**< 3GPP file media type */ + M4READER_kMediaTypeAVI = 1, /**< AVI file media type */ + M4READER_kMediaTypeAMR = 2, /**< AMR file media type */ + M4READER_kMediaTypeMP3 = 3, /**< MP3 file media type */ + M4READER_kMediaTypeRTSP = 4, /**< RTSP network accessed media type */ + M4READER_kMediaType3GPPHTTP = 5, /**< Progressively downloaded 3GPP file media type */ + M4READER_kMediaTypePVHTTP = 6, /**< Packet Video HTTP proprietary type */ + M4READER_kMediaTypeWAV = 7, /**< WAV file media type */ + M4READER_kMediaType3GPEXTHTTP = 8, /**< An external progressively downloaded 3GPP file + media type */ + M4READER_kMediaTypeAAC = 9, /**< ADTS and ADIF AAC support */ + M4READER_kMediaTypeREAL = 10, /**< REAL Media type */ + M4READER_kMediaTypeASF = 11, /**< ASF Media type */ + M4READER_kMediaTypeFLEXTIME = 12, /**< FlexTime Media type */ + M4READER_kMediaTypeBBA = 13, /**< Beatbrew audio Media type */ + M4READER_kMediaTypeSYNTHAUDIO = 14, /**< Synthesis audio Media type */ + M4READER_kMediaTypePCM = 15, /**< PCM Media type */ + M4READER_kMediaTypeJPEG = 16, /**< JPEG Media type */ + M4READER_kMediaTypeGIF = 17, /**< GIF Media type */ + M4READER_kMediaTypeADIF = 18, /**< AAC-ADTS Media type */ + M4READER_kMediaTypeADTS = 19, /**< AAC-ADTS Media type */ + + M4READER_kMediaType_NB /* number of readers, keep it as last enum entry */ + +} M4READER_MediaType; + +/** + ************************************************************************ + * enum M4READER_MediaFamily + * @brief This enum defines the Media family of a stream + * @note This enum is used internally by the VPS to identify what kind of stream + * has been retrieved via getNextStream() function. + ************************************************************************ +*/ +typedef enum +{ + M4READER_kMediaFamilyUnknown = -1, + M4READER_kMediaFamilyVideo = 0, + M4READER_kMediaFamilyAudio = 1, + M4READER_kMediaFamilyText = 2 +} M4READER_MediaFamily; + + + +/** + ************************************************************************ + * enum M4READER_OptionID + * @brief This enum defines the reader options + * @note These options can be read from a reader via M4READER_getOption_fct + ************************************************************************ +*/ +typedef enum +{ + /** + Get the duration of the movie (in ms) + */ + M4READER_kOptionID_Duration = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0), + + /** + Get the version of the core reader + */ + M4READER_kOptionID_Version = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 1), + + /** + Get the copyright from the media (if present) + (currently implemented for 3GPP only: copyright get from the cprt atom in the udta if present) + */ + M4READER_kOptionID_Copyright= M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 2), + + + /** + Set the OSAL file reader functions to the reader (type of value: M4OSA_FileReadPointer*) + */ + M4READER_kOptionID_SetOsaFileReaderFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 3), + + /** + Set the OSAL file writer functions to the reader (type of value: M4OSA_FileWriterPointer*) + */ + M4READER_kOptionID_SetOsaFileWriterFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 4), + + /** + Set the OSAL file writer functions to the reader (type of value: M4OSA_NetFunction*) + */ + M4READER_kOptionID_SetOsaNetFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 5), + + /** + Creation time in sec. since midnight, Jan. 1, 1970 (type of value: M4OSA_UInt32*) + (available only for 3GPP content, including PGD) + */ + M4READER_kOptionID_CreationTime = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 6), + + /** + Bitrate in bps (type of value: M4OSA_Double*) + */ + M4READER_kOptionID_Bitrate = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 7), + + /** + Tag ID3v1 of MP3 source (type of value: M4MP3R_ID3Tag*) + */ + M4READER_kOptionID_Mp3Id3v1Tag = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 8), + + /** + Tag ID3v2 of MP3 source (type of value: M4MP3R_ID3Tag*) + */ + M4READER_kOptionID_Mp3Id3v2Tag = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 9), + + /** + Number of Access Unit in the Audio stream (type of value: M4OSA_UInt32*) + */ + M4READER_kOptionID_GetNumberOfAudioAu = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xA), + + /** + Number of frames per bloc + */ + M4READER_kOptionID_GetNbframePerBloc = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 0xB), + + /** + Flag for protection presence + */ + M4READER_kOptionID_GetProtectPresence = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 0xC), + + /** + Set DRM Context + */ + M4READER_kOptionID_SetDRMContext = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xD), + + /** + Get ASF Content Description Object + */ + M4READER_kOptionID_ContentDescription = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xE), + + /** + Get ASF Content Description Object + */ + M4READER_kOptionID_ExtendedContentDescription = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 0xF), + + /** + Get Asset 3gpp Fields + */ + M4READER_kOptionID_3gpAssetFields = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x10), + + /** + Set the max metadata size supported in the reader + Only relevant in 3gp parser till now, but can be used for other readers + */ + M4READER_kOptionID_MaxMetadataSize = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_COMMON, 0x11), + + M4READER_kOptionID_GetMetadata = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x12), + /** + Get 3gpp 'ftyp' atom + */ + M4READER_kOptionID_3gpFtypBox = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x13), + + + /* value is M4OSA_Bool* */ + /* return the drm protection status of the file*/ + M4READER_kOptionID_isProtected = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x14), + + /* value is a void* */ + /* return the aggregate rights of the file*/ + /* The buffer must be allocated by the application and must be big enough*/ + /* By default, the size for WMDRM is 76 bytes */ + M4READER_kOptionID_getAggregateRights = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x15), + /** + Get ASF Content Description Object + */ + M4READER_kOptionID_ExtendedContentEncryption = M4OSA_OPTION_ID_CREATE(M4_READ,\ + M4READER_COMMON, 0x16), + + /** + Number of Access Unit in the Video stream (type of value: M4OSA_UInt32*) + */ + M4READER_kOptionID_GetNumberOfVideoAu = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x17), + + /** + Chunk mode activation size in case of JPG reader */ + M4READER_kOptionID_JpegChunckSize = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x18), + + /** + Check if ASF file contains video */ + M4READER_kOptionID_hasVideo = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x19), + + /** + Set specific read mode for Random Access JPEG */ + M4READER_kOptionID_JpegRAMode = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_COMMON, 0x20), + + /** + Get Thumbnail buffer in case of JPG reader */ + M4READER_kOptionID_JpegThumbnail = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x21), + + /** + Get FPDATA buffer in case of JPG reader */ + M4READER_kOptionID_JpegFPData = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x22), + + /** + Get JPEG info (progressive, subsampling) */ + M4READER_kOptionID_JpegInfo= M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x23) + + +/*****************************************/ +} M4READER_OptionID; +/*****************************************/ + +/** + ************************************************************************ + * structure M4READER_CopyRight + * @brief This structure defines a copyRight description + * @note This structure is used to retrieve the copyRight of the media + * (if present) via the getOption() function + ************************************************************************ +*/ +typedef struct _M4READER_CopyRight +{ + /** + Pointer to copyright data (allocated by user) + */ + M4OSA_UInt8* m_pCopyRight; + + /** + Pointer to copyright size. The pCopyRightSize must + be Initialized with the size available in the pCopyRight buffer + */ + M4OSA_UInt32 m_uiCopyRightSize; + +} M4READER_CopyRight; + + + +/** + ************************************************************************ + * structure M4READER_StreamDataOption + * @brief This structure defines a generic stream data option + * @note It is used is used to set or get a stream specific data defined + * by a relevant reader option ID. + ************************************************************************ +*/ +typedef struct _M4READER_StreamDataOption +{ + M4_StreamHandler* m_pStreamHandler; /**< identifier of the stream */ + M4OSA_Void* m_pOptionValue; /**< value of the data option to get or to set */ + +} M4READER_StreamDataOption; + +/** + ************************************************************************ + * enumeration M4_EncodingFormat + * @brief Text encoding format + ************************************************************************ +*/ +// typedef enum +// { +// M4_kEncFormatUnknown = 0, /**< Unknown format */ +// M4_kEncFormatASCII = 1, /**< ISO-8859-1. Terminated with $00 */ +// M4_kEncFormatUTF8 = 2, /**< UTF-8 encoded Unicode . Terminated with $00 */ +// M4_kEncFormatUTF16 = 3 /**< UTF-16 encoded Unicode. Terminated with $00 00 */ +/*} M4_EncodingFormat;*/ + +/** + ************************************************************************ + * structure M4_StringAttributes + * @brief This structure defines string attribute + ************************************************************************ +*/ +// typedef struct +// { +// M4OSA_Void* m_pString; /**< Pointer to text */ +// M4OSA_UInt32 m_uiSize; /**< Size of text */ +// M4_EncodingFormat m_EncodingFormat; /**< Text encoding format */ +// } M4_StringAttributes; + + +/** + ************************************************************************ + * structure M4READER_Buffer + * @brief This structure defines a buffer in all readers + ************************************************************************ +*/ +typedef struct +{ + M4OSA_UInt8* m_pData; + M4OSA_UInt32 m_uiBufferSize; +} M4READER_Buffer; + +typedef struct +{ + M4OSA_UInt32 m_uiSessionId; + M4OSA_UInt32 m_uiMediaId; + M4OSA_UInt32 m_uiNbInstance; + M4OSA_Char** m_pInstance; +} M4_SdpAssetInstance; +/* +typedef enum +{ + M4READER_kUnknownFormat = 0, + M4READER_kTagID3V1, + M4READER_kTagID3V2, + M4READER_kASFContentDesc, + M4READER_k3GppAssetBoxFromUDTA, + M4READER_k3GppAssetBoxFromSDP, + M4READER_kJpegExif +} M4READER_MetaDataType;*/ + + +/** + ************************************************************************ + * structure M4_3gpAssetFields + * @brief This structure defines fields of a 3gpp asset information + ************************************************************************ +*/ +typedef struct +{ + M4COMMON_MetaDataFields m_metadata; + + M4OSA_UInt32 m_uiSessionID; /* For SDP */ + M4OSA_UInt32 m_uiMediaID; /* For SDP */ + + + /* Note: The two following fields were added for internal use + (For Music manager project..) !! */ + M4_StreamType m_VideoStreamType; /**< Video stream type */ + M4_StreamType m_AudioStreamType; /**< Audio stream type */ + +} M4_MetaDataFields; + + +#define M4_METADATA_STR_NB 22 /* one string in album art structure*/ + +typedef struct +{ + M4OSA_UInt32 m_uiNbBuffer; + M4_SdpAssetInstance* m_pAssetInfoInst; /* Set of 3gpp asset boxes */ + M4COMMON_MetaDataAlbumArt m_albumArt; /* RC: PV specific album art:added + here because this type is used by + union below in streaming */ + +} M4READER_netInfos; + + +typedef union +{ + M4READER_Buffer m_pTagID3Buffer[2]; /* Tag ID3 V1, V2 */ + struct + { + M4READER_Buffer m_pAsfDescContent; /* ASF description content buffer */ + M4READER_Buffer m_pAsfExtDescContent; /* ASF extended description content buffer */ + } m_asf; + M4_MetaDataFields m_pMetadataFields; /* Already parsed and filled 3gpp asset fields */ + M4READER_netInfos m_pAssetInfoInstance; /* Set of 3gpp asset boxes in the sdp file */ + +} M4_MetadataBuffer; + + + + +/*********** READER GLOBAL Interface ************************************/ + +/** + ************************************************************************ + * @brief create an instance of the reader + * @note create the context + * @param pContext: (OUT) pointer on a reader context + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_ALLOC a memory allocation has failed + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_create_fct) (M4OSA_Context* pContext); + +/** + ************************************************************************ + * @brief destroy the instance of the reader + * @note after this call the context is invalid + * @param context: (IN) Context of the reader + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER at least one parameter is not properly set + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_destroy_fct) (M4OSA_Context context); + + +/** + ************************************************************************ + * @brief open the reader and initializes its created instance + * @note this function, for the network reader, sends the DESCRIBE + * @param context: (IN) Context of the reader + * @param pFileDescriptor: (IN) Pointer to proprietary data identifying the media to open + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER the context is NULL + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_open_fct) (M4OSA_Context context, M4OSA_Void* pFileDescriptor); + + +/** + ************************************************************************ + * @brief close the reader + * @note + * @param context: (IN) Context of the reader + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER the context is NULL + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_close_fct) (M4OSA_Context context); + + + +/** + ************************************************************************ + * @brief Get the next stream found in the media + * @note + * @param context: (IN) Context of the reader + * @param pMediaFamily: (OUT) pointer to a user allocated M4READER_MediaFamily that will + * be filled with the media family of the found stream + * @param pStreamHandler: (OUT) pointer to a stream handler that will be allocated and + * filled with the found stream description + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4WAR_NO_MORE_STREAM no more available stream in the media (all streams found) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_getNextStream_fct) (M4OSA_Context context, + M4READER_MediaFamily *pMediaFamily, + M4_StreamHandler **pStreamHandler); + + +/** + ************************************************************************ + * @brief fill the access unit structure with initialization values + * @note + * @param context: (IN) Context of the reader + * @param pStreamHandler: (IN) pointer to the stream handler to which the access unit + * will be associated + * @param pAccessUnit: (IN/OUT) pointer to the access unit (allocated by the caller) + * to initialize + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_ALLOC there is no more memory available + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_fillAuStruct_fct) (M4OSA_Context context, + M4_StreamHandler *pStreamHandler, + M4_AccessUnit *pAccessUnit); + +/** + ************************************************************************ + * @brief starts the instance of the reader + * @note only needed for network until now... + * @param context: (IN) Context of the reader + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER the context is NULL + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_start_fct) (M4OSA_Context context); + +/** + ************************************************************************ + * @brief stop reading + * @note only needed for network until now... (makes a pause) + * @param context: (IN) Context of the reader + * @return M4NO_ERROR there is no error + * @return M4ERR_PARAMETER the context is NULL + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_stop_fct) (M4OSA_Context context); + + +/** + ************************************************************************ + * @brief get an option value from the reader + * @note this function follows the set/get option mechanism described in OSAL 3.0 + * it allows the caller to retrieve a property value: + * -the duration of the longest stream of the media + * -the version number of the reader + * + * @param context: (IN) Context of the reader + * @param optionId: (IN) indicates the option to get + * @param pValue: (OUT) pointer to structure or value (allocated by user) + * where option is stored + * + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_BAD_OPTION_ID when the option ID is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_getOption_fct) (M4OSA_Context context, M4OSA_OptionID optionId, + M4OSA_DataOption pValue); + + +/** + ************************************************************************ + * @brief set en option value of the readder + * @note this function follows the set/get option mechanism described in OSAL 3.0 + * it allows the caller to set a property value: + * - nothing for the moment + * + * @param context: (IN) Context of the reader + * @param optionId: (IN) indicates the option to set + * @param pValue: (IN) pointer to structure or value (allocated by user) where + * option is stored + * + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_BAD_OPTION_ID when the option ID is not a valid one + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_setOption_fct) (M4OSA_Context context, M4OSA_OptionID optionId, + M4OSA_DataOption pValue); + + +/** + ************************************************************************ + * @brief jump into the stream at the specified time + * @note + * @param context: (IN) Context of the reader + * @param pStreamHandler (IN) the stream handler of the stream to make jump + * @param pTime (IN/OUT) IN: the time to jump to (in ms) + * OUT: the time to which the stream really jumped + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_ALLOC there is no more memory available + * @return M4ERR_BAD_STREAM_ID the streamID does not exist + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_jump_fct) (M4OSA_Context context, + M4_StreamHandler *pStreamHandler, + M4OSA_Int32* pTime); + + +/** + ************************************************************************ + * @brief reset the stream, that is seek it to beginning and make it ready to be read + * @note + * @param context: (IN) Context of the reader + * @param pStreamHandler (IN) The stream handler of the stream to reset + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_ALLOC there is no more memory available + * @return M4ERR_BAD_STREAM_ID the streamID does not exist + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_reset_fct) (M4OSA_Context context, + M4_StreamHandler *pStreamHandler); + + +/** + ************************************************************************ + * @brief get the time of the closest RAP access unit before the given time + * @note + * @param context: (IN) Context of the reader + * @param pStreamHandler (IN) the stream handler of the stream to search + * @param pTime (IN/OUT) IN: the time to search from (in ms) + * OUT: the time (cts) of the preceding RAP AU. + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @return M4ERR_BAD_STREAM_ID the streamID does not exist + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_getPrevRapTime_fct) (M4OSA_Context context, + M4_StreamHandler *pStreamHandler, + M4OSA_Int32* pTime); + + +/** + ************************************************************************ + * structure M4READER_GlobalInterface + * @brief This structure defines the generic media reader GLOBAL interface + * @note This structure stores the pointers to functions concerning + * creation and control of one reader type. + * The reader type is one of the M4READER_MediaType + ************************************************************************ +*/ +typedef struct _M4READER_GlobalInterface +/*****************************************/ +{ + M4READER_create_fct* m_pFctCreate; + M4READER_destroy_fct* m_pFctDestroy; + M4READER_open_fct* m_pFctOpen; + M4READER_close_fct* m_pFctClose; + M4READER_getOption_fct* m_pFctGetOption; + M4READER_setOption_fct* m_pFctSetOption; + M4READER_getNextStream_fct* m_pFctGetNextStream; + M4READER_fillAuStruct_fct* m_pFctFillAuStruct; + M4READER_start_fct* m_pFctStart; + M4READER_stop_fct* m_pFctStop; + M4READER_jump_fct* m_pFctJump; + M4READER_reset_fct* m_pFctReset; + M4READER_getPrevRapTime_fct* m_pFctGetPrevRapTime; + +} M4READER_GlobalInterface; + + +/************* READER DATA Interface ************************************/ + + + +/** + ************************************************************************ + * @brief Gets an access unit (AU) from the stream handler source. + * @note An AU is the smallest possible amount of data to be decoded by a decoder (audio/video). + * + * @param context: (IN) Context of the reader + * @param pStreamHandler (IN) The stream handler of the stream to make jump + * @param pAccessUnit (IN/OUT) Pointer to an access unit to fill with read data + * (the au structure is allocated by the user, and must be + * initialized by calling M4READER_fillAuStruct_fct after + * creation) + * @return M4NO_ERROR there is no error + * @return M4ERR_BAD_CONTEXT provided context is not a valid one + * @return M4ERR_PARAMETER at least one parameter is not properly set + * @returns M4ERR_ALLOC memory allocation failed + * @returns M4ERR_BAD_STREAM_ID at least one of the stream Id. does not exist. + * @returns M4WAR_NO_DATA_YET there is no enough data on the stream for new + * access unit + * @returns M4WAR_NO_MORE_AU there are no more access unit in the stream + * (end of stream) + ************************************************************************ +*/ +typedef M4OSA_ERR (M4READER_getNextAu_fct)(M4OSA_Context context, + M4_StreamHandler *pStreamHandler, + M4_AccessUnit *pAccessUnit); + + +/** + ************************************************************************ + * structure M4READER_DataInterface + * @brief This structure defines the generic media reader DATA interface + * @note This structure stores the pointers to functions concerning + * data access for one reader type.(those functions are typically called from + * a decoder) The reader type is one of the M4READER_MediaType + ************************************************************************ +*/ +typedef struct _M4READER_DataInterface +{ + M4READER_getNextAu_fct* m_pFctGetNextAu; + + /** + stores the context created by the M4READER_create_fct() function + so it is accessible without decoder + */ + M4OSA_Context m_readerContext; +/*****************************************/ +} M4READER_DataInterface; +/*****************************************/ + + +#endif /*__M4READER_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4READER_Pcm.h b/libvideoeditor/vss/common/inc/M4READER_Pcm.h new file mode 100755 index 0000000..a600b34 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4READER_Pcm.h @@ -0,0 +1,60 @@ +/* + * 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 M4READER_Pcm.h + * @brief Generic encapsulation of the core wav reader + * @note This file declares the generic shell interface retrieving function + * of the wav reader +************************************************************************* +*/ +#ifndef __M4READER_PCM_H__ +#define __M4READER_PCM_H__ + +#include "M4READER_Common.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** +************************************************************************* +* @brief Retrieves the generic interfaces implemented by the reader +* +* @param pMediaType : Pointer on a M4READER_MediaType (allocated by the caller) +* that will be filled with the media type supported by this reader +* @param pRdrGlobalInterface : Address of a pointer that will be set to the global interface +* implemented by this reader. The interface is a structure allocated +* by the function and must be un-allocated by the caller. +* @param pRdrDataInterface : Address of a pointer that will be set to the data interface +* implemented by this reader. The interface is a structure allocated +* by the function and must be un-allocated by the caller. +* +* @returns : M4NO_ERROR if OK +* ERR_ALLOC if an allocation failed +* ERR_PARAMETER at least one parameter is not properly set (in DEBUG only) +************************************************************************* +*/ +M4OSA_ERR M4READER_PCM_getInterfaces(M4READER_MediaType *pMediaType, + M4READER_GlobalInterface **pRdrGlobalInterface, + M4READER_DataInterface **pRdrDataInterface); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4READER_PCM_H__*/ diff --git a/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h b/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h new file mode 100755 index 0000000..08f8002 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4SYS_AccessUnit.h @@ -0,0 +1,91 @@ +/* + * 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 M4SYS_AccessUnit.h + * @brief Access unit manipulation + * @note This file defines the access unit structure, + * and declares functions to manipulate it. + ************************************************************************ +*/ + +#ifndef M4SYS_ACCESSUNIT_H +#define M4SYS_ACCESSUNIT_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_Memory.h" +#include "M4OSA_Time.h" +#include "M4SYS_Stream.h" + +/** The attribute of a fragment*/ +typedef enum { + M4SYS_kFragAttrOk = 01, /**< The fragment is correct, there is no error + (size cannot be 0)*/ + M4SYS_kFragAttrCorrupted = 02, /**< The fragment is corrupted (there is at least a bit or byte + error somewhere in the fragment (size cannot be 0)*/ + M4SYS_kFragAttrLost = 03 /**< The fragment is lost, so the size must be 0.*/ +} M4SYS_FragAttr; + + +/** A Fragment is a piece of access unit. It can be decoded without decoding the others*/ +typedef struct { + M4OSA_MemAddr8 fragAddress; /**< The data pointer. All fragments of the same access unit + must be contiguous in memory*/ + M4OSA_UInt32 size; /**< The size of the fragment. It must be 0 if fragment is + flagged 'lost'*/ + M4SYS_FragAttr isCorrupted; /**< The attribute of this fragment*/ +} M4SYS_Frag; + +/**< The attribute of an access unit*/ +typedef M4OSA_UInt8 M4SYS_AU_Attr; + +#define AU_Corrupted 0x01 /**< At least one fragment of the access unit is flagged corrupted.*/ +#define AU_B_Frame 0x02 /**< The access unit is a B_frame*/ +#define AU_RAP 0x04 /**< The access unit is a random access point.*/ + + +/** An access unit is the smallest piece of data with timing information.*/ +typedef struct { + M4SYS_StreamDescription* stream ; + M4OSA_MemAddr32 dataAddress; /**< The data pointer. The size of this block + (allocated size) must be a 32-bits integer multiple*/ + M4OSA_UInt32 size; /**< The size in bytes of the dataAddress. The size may + not match a 32-bits word boundary.*/ + M4OSA_Time CTS; /**< The Composition Time Stamp*/ + M4OSA_Time DTS; /**< The Decoded Time Stamp*/ + M4SYS_AU_Attr attribute; /**< The attribute of the access unit*/ + M4OSA_UInt8 nbFrag; /**< The number of fragments. It can be 0 if there is + no fragment.*/ + M4SYS_Frag** frag; /**< An array of 'nbFrag' fragments. It stores the + fragments structure. The original definition + < of frag has been changed from M4SYS_Frag* frag[] + to M4SYS_Frag** frag since the support + < of such syntax is only a Microsoft extension of + the C compiler. */ +} M4SYS_AccessUnit; + +/* Error codes */ +#define M4ERR_AU_NO_MORE_FRAG M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000001) +#define M4ERR_AU_BUFFER_OVERFLOW M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000002) +#define M4ERR_AU_BAD_INDEX M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000003) +#define M4ERR_NOT_ENOUGH_FRAG M4OSA_ERR_CREATE(M4_ERR,M4SYS_CMAPI,0x000004) + + + +#endif /*M4SYS_ACCESSUNIT_H*/ + diff --git a/libvideoeditor/vss/common/inc/M4SYS_Stream.h b/libvideoeditor/vss/common/inc/M4SYS_Stream.h new file mode 100755 index 0000000..5ed9f82 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4SYS_Stream.h @@ -0,0 +1,186 @@ +/* + * 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 M4SYS_Stream.h + * @brief Stream manipulation + * @note This file defines the stream structure. + ************************************************************************ +*/ + +#ifndef M4SYS_STREAM_H +#define M4SYS_STREAM_H + +#include "M4OSA_Types.h" +#include "M4OSA_Memory.h" +#include "M4OSA_Time.h" + +typedef M4OSA_UInt32 M4SYS_StreamID; + +/** The streamType type provides a way to distinguish all streams (AAC, AMR, YUV420, MPEG-4 Video, + H263). Stream types can be sorted in 2 ways: +@arg Some of them are raw data, others are encoded +@arg Some of them are related to an audio media, a video media... +@n So a specific naming convention has been designed to allow a quick parsing of the streamType + value to return the above categories. StreamType is an un-signed integer on 16 bits. +@arg The first byte (MSB) defines the codec type. It can be either Audio,Video, Picture, + Text or Scene. +@arg The second byte (LSB) defines the sub-codecs type (ie YUV420, PCM_16 bits, AMR...). + Moreover if this value is greater than 0x80 the stream is a raw stream, else the stream + is an encoded one +@n 0x0000 is a forbidden value, it describes an unknown stream */ + +typedef enum { + M4SYS_kUnknown = 0x0000, + /* Stream type definition + 0xYYZZ : YY is the codec type (Audio, Video, Picture, Scene ...) + ZZ is the sub-codec type (AAC, AMR , ...) + if ZZ is greater than 0x80 it is a raw format*/ + + /* Audio ones : Range from [0x0100-0x01FF]*/ + M4SYS_kAudioUnknown = 0x0100, + M4SYS_kAAC = 0x0101, + M4SYS_kCELP = 0x0102, + M4SYS_kAMR = 0x0103, + M4SYS_kAMR_WB = 0x0104, + M4SYS_kMP3 = 0x0105, + M4SYS_kMIDI = 0x0106, + M4SYS_kWMA = 0x0107, + M4SYS_kREALAUDIO = 0x0108, + M4SYS_kEVRC = 0x0109, + M4SYS_kPCM_16bitsS = 0x0181, /* PCM 16 bits Signed */ + M4SYS_kPCM_16bitsU = 0x0182, /* PCM 16 bits Un-signed */ + M4SYS_kPCM_8bitsU = 0x0183, /* PCM 8 bits Un-signed */ +/* FixAA 2008/03/03 types: M4SYS_kPCM_16bitsS, M4SYS_kPCM_16bitsU and M4SYS_kPCM_8bitsU + are now only used by AudioMixer and ReaderAVI => An update is necessary in the future for use + type M4SYS_kPCM */ + M4SYS_kXMF = 0x0184, + M4SYS_kSMAF = 0x0185, + M4SYS_kIMEL = 0x0186, + M4SYS_kBBA = 0x0187, + M4SYS_kBPC = 0x0188, + M4SYS_kADPCM = 0x0189, /* ADPCM added */ + M4SYS_kPCM = 0x0190, /* stream type added: PCM; PR2569 fixAA */ + M4SYS_kAudioAll = 0x01FF, /* all audio streams */ + + /* Video ones : Range [0x0200-0x02FF]*/ + M4SYS_kVideoUnknown = 0x0200, + M4SYS_kMPEG_4 = 0x0201, + M4SYS_kH263 = 0x0202, + M4SYS_kH263pp = 0x0203, + M4SYS_kH264 = 0x0204, + M4SYS_kREALVIDEO = 0x0205, + M4SYS_kYUV420 = 0x0281, + M4SYS_kRGB32 = 0x0282, + M4SYS_kBGR32 = 0x0283, + M4SYS_kRGB24 = 0x0284, + M4SYS_kBGR24 = 0x0285, + M4SYS_kVideoAll = 0x02FF, /* all video streams */ + + /* Picture ones : Range [0x0300-0x03FF]*/ + M4SYS_kPictureUnknown = 0x0300, + M4SYS_kJPEG = 0x0301, + M4SYS_kGIF = 0x0302, + M4SYS_kBMP = 0x0383, + M4SYS_kStillAll = 0x03FF, /* all still picture streams */ + + /* Text ones : Range [0x0400-0x04FF]*/ + M4SYS_kTextUnknown = 0x0400, + M4SYS_kTimedText = 0x0401, + M4SYS_kUTF8 = 0x0481, + M4SYS_kUTF16 = 0x0482, + M4SYS_kUCS2 = 0x0483, + M4SYS_kTextAll = 0x04FF, /* all text streams */ + + /* Scene & Graphics ones : Range [0x0500-0x05FF]*/ + M4SYS_kSceneUnknown = 0x0500, + M4SYS_kSMIL = 0x0501, + M4SYS_kBIFS = 0x0502, + M4SYS_kSceneAll = 0x05FF, /* all scene streams */ + + /* hinted ones : Range [0x0600-0x06FF]*/ + M4SYS_kHintedUnknown = 0x0600, + M4SYS_kRTP = 0x0601, + M4SYS_kMPEG2_TS = 0x0602, + M4SYS_kHintedAll = 0x06FF, /* all packetized streams */ + + /* MPEG-4 system ones : Range [0x0700-0x07FF]*/ + M4SYS_kSysUnknown = 0x0700, + M4SYS_kODS = 0x0701, + M4SYS_kIPMP = 0x0702, + M4SYS_kOCI = 0x0703, + M4SYS_kSysAll = 0x07FF /* all system streams*/ +} M4SYS_StreamType ; + +typedef struct { + M4SYS_StreamID streamID ; + M4OSA_UInt32 value ; +} M4SYS_StreamIDValue ; + +typedef struct { + M4SYS_StreamID streamID ; + M4OSA_UInt32 size ; + M4OSA_MemAddr32 addr ; +} M4SYS_StreamIDmemAddr ; + +/** This strucure defines a set of properties associated to a stream*/ +typedef struct { + M4SYS_StreamID streamID; /**< The ID of the stream. It must be unique for a media + (ie in a MP4 file, two tracks can not have two times the same ID). + 0 is forbidden.*/ + M4SYS_StreamType streamType; /**< The stream type of the stream*/ + M4OSA_UInt8 profileLevel; /**< The profile & level of a stream. It is related to the + stream type & the definition comes from the standard bodies + (i.e. MPEG-4 Video & MPEG-4 Audio). Some values are + pre-defined: 0xFE=userPrivate 0xFF=no Profile & + Level specified*/ + M4OSA_UInt32 decoderSpecificInfoSize; /**< The decoder configuration. These bytes are + needed to initialise a decoder.*/ + M4OSA_MemAddr32 decoderSpecificInfo; /**< The size (in bytes) of the decoder specific info.*/ + M4OSA_UInt32 timeScale; /**< The time scale of the stream. It means that all timing + duration of this stream are computed in this timescale + (ie timeScale = 8000, means there are 8000 ticks in + one second)*/ + M4OSA_Time duration; /**< The stream duration of this stream. The time unit is the + time scale. The value can be set to M4SYS_UnknownTime if + the duration is not known.*/ + M4OSA_Int32 averageBitrate; /**< The average bitrate (in bit per second) of this stream. + The average bitrate is computed on the stream duration. + -1 value means either there is no average bitrate or no + average bitrate is provided.*/ + M4OSA_Int32 maxBitrate; /**< The maximum bitrate (in bit per second) of this stream. + The maximum bitrate is computed on a sliding window of 1 + second. -1 value means either there is no max. bitrate or + no max. bitrate is provided.*/ +} M4SYS_StreamDescription; + +typedef enum { + M4SYS_kPreviousRAP = 0x01 , + M4SYS_kNextRAP = 0x02 , + M4SYS_kClosestRAP = 0x03 , + M4SYS_kNoRAPprevious = 0x11 , + M4SYS_kNoRAPnext = 0x12 , + M4SYS_kNoRAPclosest = 0x13 , + M4SYS_kBeginning = 0x20 +} M4SYS_SeekAccessMode ; + +#endif /*M4SYS_STREAM_H*/ + + + diff --git a/libvideoeditor/vss/common/inc/M4TOOL_VersionInfo.h b/libvideoeditor/vss/common/inc/M4TOOL_VersionInfo.h new file mode 100755 index 0000000..2661016 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4TOOL_VersionInfo.h @@ -0,0 +1,49 @@ +/* + * 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 M4TOOL_VersionInfo.h + * @brief defines a common version information structure + * @note + * + ************************************************************************ +*/ +#ifndef __M4TOOL_VERSIONINFO_H__ +#define __M4TOOL_VERSIONINFO_H__ + +#include "M4OSA_Types.h" + +/** + * structure M4_VersionInfo + * @brief This structure describes version of core component + * @note This structure is typically used to retrieve version information + * of a component via getOption function + */ +typedef struct _M4_VersionInfo +{ + M4OSA_UInt32 m_major; /*major version of the component*/ + M4OSA_UInt32 m_minor; /*minor version of the component*/ + M4OSA_UInt32 m_revision; /*revision version of the component*/ + + /* Structure size */ + M4OSA_UInt32 m_structSize; + +} M4_VersionInfo; + + +#endif /*__M4TOOL_VERSIONINFO_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Interface.h b/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Interface.h new file mode 100755 index 0000000..170620c --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Interface.h @@ -0,0 +1,57 @@ +/* + * 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 __M4VD_EXTERNAL_INTERFACE_H__ +#define __M4VD_EXTERNAL_INTERFACE_H__ + +#include "M4DECODER_Common.h" + +#include "M4VD_HW_API.h"/* M4VD_Interface */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + M4VD_Interface* externalFuncs; + M4OSA_Void* externalUserData; +}* M4DECODER_EXTERNAL_UserDataType; + +/* ----- Interface retrieval ----- */ + +M4OSA_ERR M4DECODER_EXTERNAL_getInterface(M4DECODER_VideoInterface** pDecoderInterface); + +/* ----- DSI bitstream parser ----- */ + +/* This function is available to clients of the shell to allow them to analyse clips +(useful for video editing) without having to instanciate a decoder, which can be useful precisely +if HW decoders are a possibility. */ + +M4OSA_ERR M4DECODER_EXTERNAL_ParseVideoDSI(M4OSA_UInt8* pVol, M4OSA_Int32 aVolSize, + M4DECODER_MPEG4_DecoderConfigInfo* pDci, + M4DECODER_VideoSize* pVideoSize); + +M4OSA_ERR M4DECODER_EXTERNAL_ParseAVCDSI(M4OSA_UInt8* pDSI, M4OSA_Int32 DSISize, + M4DECODER_AVCProfileLevel *profile); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4VD_EXTERNAL_INTERFACE_H__ */ diff --git a/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Internal.h b/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Internal.h new file mode 100755 index 0000000..f2dacb2 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VD_EXTERNAL_Internal.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. + */ + +#ifndef __M4VD_EXTERNAL_INTERNAL_H__ +#define __M4VD_EXTERNAL_INTERNAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "NXPSW_CompilerSwitches.h" + +#ifndef M4DECODER_EXTERNAL_SYNC_EXT_DECODE +#include "M4OSA_Semaphore.h" +#endif /* not M4DECODER_EXTERNAL_SYNC_EXT_DECODE */ + +/*typedef enum +{ + M4VS_THREAD_IS_IDLE = 0, + M4VS_THREAD_IS_RUNNING = 1, + M4VS_THREAD_IS_STOPPING = 2 + +} M4VS_ThreadState_t;*/ + + +/* ----- internal VS context ----- */ + +typedef struct +{ + /* READER */ + /**< Reference to the reader data interface used to read access units */ + M4READER_DataInterface* m_pReader; + /**< Reference to the access unit used read and decode one frame (the AU could be passed by + the user instead of reading it from inside the decoder) */ + M4_AccessUnit* m_pNextAccessUnitToDecode; + /**< Flag to know if we decode just after a (read) jump */ + M4OSA_Bool m_bJump; + M4_MediaTime m_nextAUCts; /**< CTS of the AU above */ + + /* DECODER */ + + M4_MediaTime m_DecodeUpToCts; /**< Target Cts for the decode up to loop */ + M4_MediaTime m_CurrentDecodeCts; /**< Cts of the latest frame decoded */ + M4_MediaTime m_PreviousDecodeCts; /**< Cts of the previous frame decoded */ + M4OSA_UInt32 m_NbDecodedFrames; /**< Number of frames decoded in the decode + up to loop (can be 0) */ + M4OSA_ERR m_uiDecodeError; /**< Error or warning code (from the VD + reader or decoder) returned to the + shell */ + M4OSA_Bool m_bDataDecodePending; /**< There is some data to decode */ + M4OSA_Bool m_bIsWaitNextDecode; /**< Do we need to wait for the anticipated + decoding to finish ? */ + + /* RENDER */ + + M4_MediaTime m_TargetRenderCts; /**< Cts for the rendering step */ + M4_MediaTime m_CurrentRenderCts; /**< Cts of the latest frame decoded */ + M4OSA_ERR m_uiRenderError; /**< Error or warning code (from the + VD render) returned to the shell */ + M4OSA_Bool m_bForceRender; /**< Force rendering even if 0 frames + are decoded (i.e. already + previously decoded) */ + M4OSA_Bool m_bDataRenderPending; /**< There is some data to render */ + + /* STREAM PARAMS */ + + M4_VideoStreamHandler* m_pVideoStreamhandler; /**< reference to the video + stream description passed by + the user */ + M4VD_StreamInfo* m_pStreamInfo; + M4DECODER_VideoSize m_VideoSize; + M4DECODER_MPEG4_DecoderConfigInfo m_Dci; /**< Information collected from + DSI parsing */ + M4VIFI_ImagePlane* m_pOutputPlane; /**< Pointer to YUV output planes */ + + /* VD API */ + + M4VD_Interface* m_VD_Interface; /**< pointers to HW functions */ + M4VD_SignalingInterface m_VD_SignalingInterface; /**< pointers to Shell signaling + functions */ + M4VD_Context m_VD_Context; /**< pointer to the real hardware + context */ + + /* THREAD STUFF */ +#ifndef M4DECODER_EXTERNAL_SYNC_EXT_DECODE + M4OSA_Context m_SemSync; +#endif /* not M4DECODER_EXTERNAL_SYNC_EXT_DECODE */ +} M4VS_VideoDecoder_Context; + + +/* ----- bitstream parser ----- */ +/* +typedef struct +{ + M4OSA_UInt32 stream_byte; + M4OSA_UInt32 stream_index; + M4OSA_MemAddr8 in; + +} M4VS_Bitstream_ctxt; +*/ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4VD_EXTERNAL_INTERNAL_H__ */ diff --git a/libvideoeditor/vss/common/inc/M4VD_HW_API.h b/libvideoeditor/vss/common/inc/M4VD_HW_API.h new file mode 100755 index 0000000..ba33d14 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VD_HW_API.h @@ -0,0 +1,159 @@ +/* + * 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 __M4VD_HW_API_H__ +#define __M4VD_HW_API_H__ + +#include "M4OSA_Types.h" +#include "M4OSA_OptionID.h" +#include "M4OSA_CoreID.h" +#include "M4OSA_Error.h" +#include "M4OSA_Memory.h" /* M4OSA_MemAddrN */ + +#include "M4VIFI_FiltersAPI.h" + +/** + ************************************************************************ + * @file M4VD_HW_API.H + * @brief + * @note + ************************************************************************ +*/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ----- Hardware decoder errors and warnings ----- */ + +#define M4ERR_VD_FATAL M4OSA_ERR_CREATE(M4_ERR, M4VD_EXTERNAL, 0x0001) + + +/* ----- enum definitions ----- */ + +typedef enum +{ + M4VD_kOptionId_Dummy = 0 + +} M4VD_OptionID; + +typedef enum +{ + M4VD_kMpeg4VideoDec, + M4VD_kH263VideoDec, + M4VD_kH264VideoDec, + M4VD_kVideoType_NB /* must remain last */ +} M4VD_VideoType; + +typedef enum +{ + M4VD_kNone, + M4VD_kYUV420, + M4VD_kYUV422, + M4VD_kYUYV422, + M4VD_kRGB565, + M4VD_kBGR565 + +} M4VD_OutputFormat; + + +/* ----- structure definitions ----- */ + +typedef struct +{ + M4OSA_MemAddr32 pBuffer; /**< pointer to video buffer - 32 bits aligned */ + M4OSA_UInt32 bufferSize; /**< the size in bytes of the buffer */ + +} M4VD_VideoBuffer; + +typedef struct +{ + M4OSA_UInt32 aWidth; /**< Width of the Image */ + M4OSA_UInt32 aHeight; /**< Height of the Image */ + +} M4VD_ImageSize; + +typedef struct +{ + M4OSA_MemAddr8 pBuffer; /**< Pointer to the decoder configuration */ + M4OSA_UInt32 aSize; /**< Size of the buffer */ + +} M4VD_DecoderConfig; + +typedef struct +{ + M4VD_ImageSize anImageSize; /**<Size of the image*/ + M4VD_DecoderConfig decoderConfiguration; /**<configuration of the decoder*/ + +} M4VD_StreamInfo; + + +/* ----- callbacks prototypes ----- */ + +typedef M4OSA_ERR (M4VD_CB_signalDecoderOver_fct)( M4OSA_Void* signalTarget, + M4OSA_Double frameTime, M4OSA_ERR err); +typedef M4OSA_ERR (M4VD_CB_signalRenderOver_fct) ( M4OSA_Void* signalTarget, + M4OSA_Double frameTime, M4OSA_ERR err); + +typedef struct +{ + M4OSA_Void* m_pSignalTarget; + + /* decoder callbacks that need to be raised by HW decoder functions */ + M4VD_CB_signalDecoderOver_fct* m_pFctSignalDecoderOver; + M4VD_CB_signalRenderOver_fct* m_pFctSignalRenderOver; + +} M4VD_SignalingInterface; + + +/* ----- Hardware decoder functions set ----- */ + +typedef void* M4VD_Context; /* Video Decoder context (for M4VD_HW_xxxx functions) */ + + +/* common */ +typedef M4OSA_ERR (M4VD_init_fct) ( M4VD_Context*, M4VD_SignalingInterface* ); +typedef M4OSA_ERR (M4VD_setOption_fct) ( M4VD_Context, M4VD_OptionID, M4OSA_DataOption ); +typedef M4OSA_ERR (M4VD_getOption_fct) ( M4VD_Context, M4VD_OptionID, M4OSA_DataOption* ); +typedef M4OSA_ERR (M4VD_openDecoder_fct) ( M4VD_Context, M4VD_VideoType, M4VD_StreamInfo*, + M4VD_OutputFormat*, M4OSA_Void* ); +typedef M4OSA_ERR (M4VD_stepDecode_fct) ( M4VD_Context, M4VD_VideoBuffer*, M4OSA_Double ); +typedef M4OSA_ERR (M4VD_stepRender_fct) ( M4VD_Context, M4VIFI_ImagePlane*, M4OSA_Double ); +typedef M4OSA_ERR (M4VD_closeDecoder_fct)( M4VD_Context ); +typedef M4OSA_ERR (M4VD_cleanUp_fct) ( M4VD_Context ); +typedef M4OSA_ERR (M4VD_setOutputFilter_fct)( M4VD_Context, M4VIFI_PlanConverterFunctionType*, + M4OSA_Void*); + +typedef struct +{ + M4VD_init_fct* m_pFctInitVideoDecoder; + M4VD_setOption_fct* m_pFctSetOption; + M4VD_getOption_fct* m_pFctGetOption; + M4VD_openDecoder_fct* m_pFctOpenDecoder; + M4VD_stepDecode_fct* m_pFctStepDecode; + M4VD_stepRender_fct* m_pFctStepRender; + M4VD_closeDecoder_fct* m_pFctClose; + M4VD_cleanUp_fct* m_pFctCleanUp; + M4VD_setOutputFilter_fct* m_pFctSetOutputFilter; +} M4VD_Interface; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4VD_HW_API_H__ */ diff --git a/libvideoeditor/vss/common/inc/M4VD_Tools.h b/libvideoeditor/vss/common/inc/M4VD_Tools.h new file mode 100644 index 0000000..83e036a --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VD_Tools.h @@ -0,0 +1,48 @@ +/* + * 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 __M4VD_TOOLS_H__ +#define __M4VD_TOOLS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "NXPSW_CompilerSwitches.h" +#include "M4OSA_Memory.h" +#include "M4OSA_Types.h" +/* ----- bitstream parser ----- */ + +typedef struct +{ + M4OSA_UInt32 stream_byte; + M4OSA_UInt32 stream_index; + M4OSA_MemAddr8 in; + +} M4VS_Bitstream_ctxt; + +M4OSA_UInt32 M4VD_Tools_GetBitsFromMemory(M4VS_Bitstream_ctxt* parsingCtxt, + M4OSA_UInt32 nb_bits); +M4OSA_ERR M4VD_Tools_WriteBitsToMemory(M4OSA_UInt32 bitsToWrite, + M4OSA_MemAddr32 dest_bits, + M4OSA_UInt8 offset, M4OSA_UInt8 nb_bits); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __M4VD_TOOLS_H__ */ diff --git a/libvideoeditor/vss/common/inc/M4VE_API.h b/libvideoeditor/vss/common/inc/M4VE_API.h new file mode 100755 index 0000000..5c27003 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VE_API.h @@ -0,0 +1,824 @@ +/* + * 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 M4VE_API.h + * @note This file declares the generic shell interface retrieving function + * of any external encoder. +****************************************************************************** +*/ + +#ifndef __M4VE_API_H__ +#define __M4VE_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * OSAL types definition */ +#include "M4OSA_Types.h" +#include "M4OSA_Time.h" +#include "M4OSA_Memory.h" +#include "M4OSA_CoreID.h" +#include "M4OSA_OptionID.h" + +/** + * Include Video filters interface definition (for the M4VIFI_ImagePlane type) */ +#include "M4VIFI_FiltersAPI.h" + + +/** + ************************************************************************ + * VE Errors & Warnings definition + ************************************************************************ +*/ +#define M4ERR_VE_FATAL ((M4OSA_ERR)M4OSA_ERR_CREATE(M4_ERR, M4VE_EXTERNAL, 0x000000)) + + +/** + ********************************************************************************************* + * enum M4VE_EncoderMode + * @brief This enum defines in which mode the external encoder will be used + * ("Standalone encoder" or "Encoder + Grabber"). + ********************************************************************************************* + */ +typedef enum +{ + M4VE_kSEMode, /**< "Standalone Encoder" mode */ + M4VE_kEGMode /**< "Encoder + Grabber" mode */ +} M4VE_EncoderMode; + + +/** + ********************************************************************************************* + * enum M4VE_EncoderType + * @brief This enum defines the supported encoder types. + ********************************************************************************************* + */ +typedef enum +{ + M4VE_kMpeg4VideoEnc, /**< MPEG-4 */ + M4VE_kH263VideoEnc, /**< H263 */ + M4VE_kH264VideoEnc, /**< H264 */ + M4VE_kMJPEGEnc, /**< MJPEG */ + M4VE_kEncoderType_NB +} M4VE_EncoderType; + + +/** + ********************************************************************************************* + * struct M4VE_ImageSize + * @brief This structure defines video frame size (for both grabbing and encoding). + ********************************************************************************************* + */ +typedef struct +{ + M4OSA_UInt32 width; /**< Width of the Image */ + M4OSA_UInt32 height; /**< Height of the Image */ +} M4VE_ImageSize; + + +/** + ********************************************************************************************* + * enum M4VE_FormatConfig + * @brief This enum defines the frame format we have in input for the grabbing + * part of the external encoder. + ********************************************************************************************* +*/ +typedef enum +{ + M4VE_kYUV420=0, /**< YUV 4:2:0 planar (standard input for mpeg-4 video) */ + M4VE_kYUV422, /**< YUV422 planar */ + M4VE_kYUYV, /**< YUV422 interlaced, luma first */ + M4VE_kUYVY, /**< YUV422 interlaced, chroma first */ + M4VE_kJPEG, /**< JPEG compressed frames */ + M4VE_kRGB444, /**< RGB 12 bits 4:4:4 */ + M4VE_kRGB555, /**< RGB 15 bits 5:5:5 */ + M4VE_kRGB565, /**< RGB 16 bits 5:6:5 */ + M4VE_kRGB24, /**< RGB 24 bits 8:8:8 */ + M4VE_kRGB32, /**< RGB 32 bits */ + M4VE_kBGR444, /**< BGR 12 bits 4:4:4 */ + M4VE_kBGR555, /**< BGR 15 bits 5:5:5 */ + M4VE_kBGR565, /**< BGR 16 bits 5:6:5 */ + M4VE_kBGR24, /**< BGR 24 bits 8:8:8 */ + M4VE_kBGR32 /**< BGR 32 bits */ +} M4VE_FormatConfig; + + +/** + ********************************************************************************************* + * struct M4VE_Framerate + * @brief This structure defines the maximum framerate the encoder will have + * at input and will generate at output (in frames per second). + ********************************************************************************************* +*/ +typedef struct +{ + M4OSA_UInt32 framerateNum; /**< Framerate numerator */ + M4OSA_UInt32 framerateDen; /**< Framrate denominator */ +} M4VE_Framerate; +/**< For example, a framerate of 29.97 fps for H263 encoding will be expressed as: + FramerateNum = 30000 + FramerateDen = 1001 */ + + +/** + ********************************************************************************************* + * struct M4VE_GrabbingParameters + * @brief This structure defines the grabbing parameters set at open step. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_ImageSize size; /**< Size of grabbed frames */ + M4VE_FormatConfig format; /**< Format of the grabbed frames (YUV420, RGB565,etc.) */ +} M4VE_GrabbingParameters; + + +/** + ********************************************************************************************* + * struct M4VE_EncodingParameters + * @brief This structure defines the encoding parameters set at open step. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_EncoderType type; /**< coding type (H263/H264/MPEG-4)*/ + M4VE_ImageSize size; /**< Size of frames to encode */ + M4OSA_Bool bRateControlEnable; /**< Flag to enable/disable rate control */ + M4OSA_Bool bLowDelay; /**< force encoder in "low delay" mode */ + M4OSA_UInt32 bitrate; /**< Average targeted bitrate in bit per sec */ + M4VE_Framerate framerate; /**< Maximum input framerate */ + M4OSA_UInt32 timescale; /**< timescale of the video bitstream */ + M4OSA_Context pUserSettings; /**< Additionnal user settings passed by the + application to the service at Codec registration */ +} M4VE_EncodingParameters; + + +/** + ********************************************************************************************* + * struct M4VE_VideoBuffer + * @brief This structure defines the output buffer where the encoded data + * are stored by the encoder. + ********************************************************************************************* +*/ +typedef struct +{ + M4OSA_MemAddr32 pBuffer; /**< pointer to video buffer 32 bits aligned */ + M4OSA_UInt32 bufferSize; /**< the size in bytes of the buffer */ +} M4VE_VideoBuffer; + + +/** + ********************************************************************************************* + * struct M4VE_ParameterSet + * @brief Parameter set structure used for H264 headers. + ********************************************************************************************* +*/ +typedef struct +{ + M4OSA_UInt16 length; /**< Number of items*/ + M4OSA_UInt8* pParameterSetUnit; /**< Array of items*/ +} M4VE_ParameterSet; + + +/** + ********************************************************************************************* + * struct M4VE_H264HeaderBuffer + * @brief This structure defines the buffer where the stream header is stored + * by the encoder, in case of H264 + ********************************************************************************************* +*/ +typedef struct +{ + M4OSA_UInt8 NALUnitLength; /**< length in bytes of a NAL access Unit */ + M4OSA_UInt8 nOfSequenceParametersSets; /**< Number of sequence parameter sets*/ + M4OSA_UInt8 nOfPictureParametersSets; /**< Number of picture parameter sets*/ + M4VE_ParameterSet *pSequenceParameterSets; /**< Sequence parameter set array */ + M4VE_ParameterSet *pPictureParameterSets; /**< Picture parameter set array */ +} M4VE_H264HeaderBuffer; + + + +/** + ********************************************************************************************* + * struct M4VE_HeaderBuffer + * @brief This structure defines the buffer where the stream header is stored + * by the encoder. + ********************************************************************************************* +*/ +typedef struct +{ + union + { + M4VE_VideoBuffer header; /**< MPEG-4, H263, MJPEG */ + M4VE_H264HeaderBuffer H264Header; /**< H264 */ + }M4VE_SpecificHeader; +} M4VE_HeaderBuffer; + + +/** + ********************************************************************************************* + * enum M4VE_OptionID + * @brief This defines the supported options handled by the video encoder interface. + ********************************************************************************************* +*/ +typedef enum +{ + dummy=0 +} M4VE_OptionID; + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalOpenEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the external encoder is opened. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalOpenEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalHeaderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode, + * M4VE_HeaderBuffer *pBuffer); + * @brief This function signals to the service that the stream header is ready. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @param pBuffer : (IN) Stream header. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER pBuffer field is null or invalid. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalHeaderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode, + M4VE_HeaderBuffer *pBuffer); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalStartGrabberDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the grabbing part is started. + * This callback is unused in the "standalone encoder" mode. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalStartGrabberDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalStartEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the external encoder is started. + * This callback is unused in the "standalone encoder" mode. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalStartEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalEncodeDone)(M4OSA_Context pUserData, M4OSA_ERR errCode, + M4OSA_UInt32 cts, M4VE_VideoBuffer* pBuffer); + * @brief This function signals to the service that the encoding of a frame is done. + * The integrator must call this function when the encoding of the video + * frame is completed (for example in an interrupt callback). + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @param cts : (IN) Time of the encoded frame (from stepEncode). + * @param pBuffer : (IN) Encoded data Buffer. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER At least one parameter is null or invalid. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalEncodeDone)(M4OSA_Context pUserData, M4OSA_ERR errCode, + M4OSA_Time cts, M4VE_VideoBuffer* pBuffer); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalStopGrabberDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the grabbing part is stopped. + * This callback is unused in the "standalone encoder" mode. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalStopGrabberDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalStopEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the external encoder is stopped. + * This callback is unused in the "standalone encoder" mode. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalStopEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + +/** + ********************************************************************************************* + * M4OSA_Int32 (*M4VE_SignalCloseEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + * @brief This function signals to the service that the external encoder is closed. + * @note The external encoder returns one of the following codes in the errCode parameter: + * M4NO_ERROR There is no error + * M4ERR_VE_FATAL a fatal error occurred + * @param pUserData: (IN) User data provided by the service at init step. + * @param errCode : (IN) Error code returned to the service internal layers. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_VE_FATAL: a fatal error occurred. + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SignalCloseEncoderDone)(M4OSA_Context pUserData, M4OSA_ERR errCode); + + + + +/** + ********************************************************************************************* + * struct M4VE_GenericCallback + * @brief This structure is used to pass the generic callbacks, i.e. the ones that are used + * in both "Standalone Encoder" and "Encoder + Grabber" modes. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_SignalOpenEncoderDone pOpenEncoderDone; /**< Callback to use at open completion */ + M4VE_SignalHeaderDone pHeaderDone; /**< Callback to use when the stream + header is ready */ + M4VE_SignalEncodeDone pEncodeDone; /**< Callback to use for any frame + encoding completion */ + M4VE_SignalCloseEncoderDone pCloseEncoderDone;/**< Callback to use at close completion */ +} M4VE_GenericCallback; /**< Callbacks used in all encoder modes */ + +/** + ********************************************************************************************* + * struct M4VE_EGModeCallback + * @brief This structure is used to pass the callbacks used in the "Encoder + Grabber" mode + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_SignalStartGrabberDone pStartGrabberDone;/**< Callback to use at start + completion of the grabber part*/ + M4VE_SignalStartEncoderDone pStartEncoderDone;/**< Callback to use at start + completion of the encoder part*/ + M4VE_SignalStopGrabberDone pStopGrabberDone; /**< Callback to use at stop + completion of the grabber part*/ + M4VE_SignalStopEncoderDone pStopEncoderDone; /**< Callback to use at stop + completion of the encoder part*/ +} M4VE_EGModeCallback; /**< Callbacks used in "Encoder + Grabber" mode */ + +/** + ********************************************************************************************* + * struct M4VE_SEModeCallback + * @brief This structure is used to pass the callbacks used in the "Standalone Encoder" mode + * @note There's no specific callback for the standalone encoder mode, + * but we have to declare one + * @note for some compilers + ********************************************************************************************* +*/ +typedef M4OSA_Int32 (*M4VE_SEDummyCB) (M4OSA_Context pUserData, M4OSA_ERR errCode); + +typedef struct +{ + M4VE_SEDummyCB pDummySECB; /**< No specific callback for + Standalone encoder mode */ +} M4VE_SEModeCallback; /**< Callbacks used in "Standalone Encoder" mode */ + + +/** + ********************************************************************************************* + * struct M4VE_CallbackInterface + * @brief This structure is the container for the whole set of callback used by external encoder + ********************************************************************************************* +*/ + +typedef struct +{ + M4VE_GenericCallback genericCallback;/**< Callbacks used in all modes */ + union + { + M4VE_EGModeCallback EGModeCallback; /**< Callbacks used in "Encoder + Grabber" mode */ + M4VE_SEModeCallback SEModeCallback; /**< Callbacks used in "Standalone Encoder" mode */ + } M4VE_SpecificModeCallBack; + M4OSA_Context pUserData; /**< Internal user data to be retrieved in each + callbach above */ +} M4VE_CallbackInterface; + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_initEncoder_fct)(M4OSA_Context* pContext, + * M4VE_CallbackInterface* pCallbackInterface); + * @brief This function initializes the external video encoder API. + * @note This function typically allocates the user context that will be provided + * to the other functions as their first argument. The second argument is + * the callback interface given by the service. Encoder implementation is supposed + * to use these callbacks in response to each asynchronous API function. + * All these callbacks must be called with the pUserData field specified + * by the service inside the M4VE_CallbackInterface structure. + * @param pContext: (OUT) Execution context of the encoder. + * @param pCallbackInterface: (IN) Callback interface. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: At least one parameter is not correct (NULL or invalid). + * @return M4ERR_ALLOC: there is no more available memory. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_initEncoder_fct)(M4OSA_Context* pContext, + M4VE_CallbackInterface* pCallbackInterface); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_setOption_fct)(M4OSA_Context, M4VE_OptionID, M4OSA_DataOption); + * @brief This function is used to set an option in the video encoder interface. + * @note none + * @param pContext: (IN) Execution context of the encoder. + * @param optionId: (IN) Id of the option to set. + * @param pValue: (IN) Pointer of the option data to set. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: At least one parameter is not correct (NULL or invalid). + * @return M4ERR_BAD_OPTION_ID:The requested option Id is invalid. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_setOption_fct)(M4OSA_Context pContext, M4VE_OptionID optionId, + M4OSA_DataOption pValue); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_getOption_fct)(M4OSA_Context, M4VE_OptionID, M4OSA_DataOption*); + * @brief This function is used to retrieve an option in the video interface. + * @note none + * @param pContext: (IN) Execution context of the encoder. + * @param optionId: (IN) Id of the option to set. + * @param pValue: (OUT) Pointer to the location where the requested option will + * be stored. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: At least one parameter is not correct (NULL or invalid). + * @return M4ERR_BAD_OPTION_ID:The requested option Id is invalid. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_getOption_fct)(M4OSA_Context pContext, M4VE_OptionID optionId, + M4OSA_DataOption* pValue); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_openEncoder_fct)(M4OSA_Context pContext, + * M4VE_GrabbingParameters *pGrabbingParams, + * M4VE_EncodingParameters *pEncodingParams); + * @brief This function opens an instance of the video encoder. + * Both encoding and grabbing parameters are specified here. + * @note This function is asynchronous, thus the external encoder must call the corresponding + * M4VE_SignalOpenEncoderDone callback function when the opening step is internally + * completed. + * Please note that both grabber and encoder components are opened at this step in + * the "encoder + grabber" mode. In response to this open, the encoder must also return + * the stream header (including VOS, VO & VOL) using the M4VE_SignalHeaderDone callback + * function. Usually the service waits for this callback between the + * M4VE_SignalOpenEncoderDone + * callback and the M4VE_SignalCloseEncoderDone callback in order to handle it. + * @param pContext: (IN) Execution context of the encoder. + * @param pGrabbingParams: (IN) Grabbing parameters (can be optional, in this case is + * must be NULL). + * @param pEncodingParams: (IN) Encoding parameters. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: At least one parameter is not correct (NULL or invalid). + * @return M4ERR_ALLOC: there is no more available memory. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not be opened + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_openEncoder_fct)(M4OSA_Context pContext, + M4VE_GrabbingParameters *pGrabbingParams, + M4VE_EncodingParameters *pEncodingParams); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_forceIFrame_fct)(M4OSA_Context pContext); + * @brief This function is used by the service to signal the external encoder that an Intra + * refresh frame must be encoded. This function is used in both "Standalone Encoder" and + * "Encoder + grabber" modes and can be called at any time during the encoding session. + * @note For the "Encoder + Grabber" mode, this function can be called between the reception + * of the M4VE_SignalStartEncoderDone callback and the call to M4VE_stopEncoder_fct. + * For the "Standalone Encoder" mode, this function can be called between the reception + * of the M4VE_SignalOpenEncoderDone callback and the call to M4VE_closeEncoder_fct. + * The expected behavior is that the external encoder encodes an intra refresh frame + * for one of the frames coming next to the call of M4VE_forceIFrame_fct. + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not handle this call + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_forceIFrame_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_releaseOutputBuffer_fct)(M4OSA_Context pContext, M4VE_VideoBuffer *pBuffer); + * @brief This function is called by the service to signal that a particular output buffer, + * provided in the M4VE_SignalEncodeDone callback by the external encoder, is no more + * needed by the service and can be considered as free for any remaining data processing. + * @note none. + * @param pContext: (IN) Execution context of the encoder. + * @param pBuffer: (IN) Encoded data Buffer. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: At least one parameter is not correct (NULL or invalid). + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not acknowledge the buffer release for any + * other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_releaseOutputBuffer_fct)(M4OSA_Context pContext, + M4VE_VideoBuffer *pBuffer); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_closeEncoder_fct)(M4OSA_Context pContext); + * @brief This function closes the encoding session. + * @note This function is asynchronous, thus the external encoder must call the corresponding + * M4VE_SignalCloseEncoderDone callback function when the closing step is internally + * completed. + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext pointer is null or invalid. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not be closed for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_closeEncoder_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_cleanUpEncoder_fct)(M4OSA_Context pContext); + * @brief The function cleans up the encoder context. + * @note none + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext pointer is null or invalid. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not be closed for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_cleanUpEncoder_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_stepEncode_fct)(M4OSA_Context pContext,M4VIFI_ImagePlane *pInputPlane, + * M4OSA_Time cts); + * @brief The function gives a video frame to the external encoder in the "Standalone encoder" + * mode. The input buffer consists of a raw YUV420 planar frame, + * allocated by the service. + * The time (cts) is the composition time stamp of the frame to encode and is unique + * for each frame. This time is expressed in milliseconds. + * @note This function is asynchronous and its completion is signaled by the + * M4VE_SignalEncodeDone callback. It applies that the input buffer is maintained valid + * by the service till the call of this callback. The encoded data are retrieved in + * this callback function in a dedicated structure, allocated by the external encoder. + * The input buffer (YUV raw frame) is considered by the service as free for any + * remaining data processing after receiving the M4VE_SignalEncodeDone callback. + * @param pContext: (IN) Execution context of the encoder. + * @param pInputPlane: (IN) Input buffer where video frame is stored. + * @param cts: (IN) Composition time stamp in milliseconds. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_ALLOC: there is no more available memory. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: The encoder could not encode the frame for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_stepEncode_fct)(M4OSA_Context pContext,M4VIFI_ImagePlane *pInputPlane, + M4OSA_Time cts); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_startGrabber_fct)(M4OSA_Context pContext); + * @brief This function starts the grabber sub-component of the external encoder, in the + * "encoder + grabber" mode. This function is asynchronous, thus the external + * encoder must call the corresponding M4VE_SignalStartGrabberDone callback function + * when this start is internally effective. + * @note During this step, the service waits for the grabber to launch any video preview if + * needed. + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_ALLOC: there is no more available memory. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: the encoder could not be started for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_startGrabber_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_startEncoder_fct)(M4OSA_Context pContext); + * @brief This function starts the video encoder in the "encoder + grabber" mode. + * @note This function is asynchronous, thus the external encoder must call the corresponding + * M4VE_SignalStartEncoderDone callback function when this start is internally + * effective. + * After the completion of this asynchronous function, the service waits for the + * external encoder to periodically call the M4VE_SignalEncodeDone callback each time + * a new frame has been encoded. The external encoder must expect to have several + * M4VE_startEncoder_fct calls before being closed. See the description of + * M4VE_stopEncoder_fct function for the expected behaviour. + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_ALLOC: there is no more available memory. + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: the encoder could not be started for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_startEncoder_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR M4OSA_ERR (*M4VE_stopGrabber_fct)(M4OSA_Context pContext); + * @brief This function stops the video grabber in the "encoder + grabber" mode. + * @note This function is asynchronous, thus the external encoder must call the corresponding + * M4VE_SignalStopGrabberDone callback function when this stop is internally effective. + * During this step, the service waits for the grabber to stop the video preview + * if needed. + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_FATAL: the encoder could not be stopped for any other reason. + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_stopGrabber_fct)(M4OSA_Context pContext); + + +/** + ********************************************************************************************* + * M4OSA_ERR (*M4VE_stopEncoder_fct)(M4OSA_Context pContext); + * @brief This function stops the video encoder in the "encoder + grabber" mode. + * @note This function is asynchronous, thus the external encoder must call the corresponding + * M4VE_SignalStopEncoderDone callback function when this stop is internally effective. + * After the reception of this callback, the service considers that no new frame will be + * retrieved via the M4VE_SignalEncodeDone callback. + * The external encoder must expect to have a possible call to M4VE_startEncoder_fct + * after M4VE_stopEncoder_fct. In this case, the external encoder must consider that it + * has been paused/resumed. The expected behaviour is the following one: + * - The result from this two encoding sessions is a Standalone stream, no header is + * generated for this new session. The external encoder is free to encode a refresh + * frame (like I VOP) for this new session. + * - The time stamps of this new session must directly follow the time stamps of the + * previous one (ie: no time hole coming from the delay between the stop of the first + * session and the start of the new one). + * @param pContext: (IN) Execution context of the encoder. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext field is not valid + * @return M4ERR_STATE: This call is not allowed in the current encoder state. + * @return M4ERR_VE_ERR_FATAL: the encoder could not be stopped for any other reason + ********************************************************************************************* +*/ +typedef M4OSA_ERR (*M4VE_stopEncoder_fct)(M4OSA_Context pContext); + + + + + +/** + ********************************************************************************************* + * struct M4VE_GenericInterface + * @brief The M4VE_GenericInterface structure defines the set of functions used in + * both encoder modes. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_initEncoder_fct m_pFctInitEncoder; + M4VE_setOption_fct m_pFctSetOption; + M4VE_getOption_fct m_pFctGetOption; + M4VE_openEncoder_fct m_pFctOpenEncoder; + M4VE_forceIFrame_fct m_pFctForceIFrame; + M4VE_releaseOutputBuffer_fct m_pFctReleaseOutputBuffer; + M4VE_closeEncoder_fct m_pFctCloseEncoder; + M4VE_cleanUpEncoder_fct m_pFctCleanUpEncoder; +} M4VE_GenericInterface; /**< Functions used in both "Standalone Encoder" and + "Encoder + Grabber" modes */ + + +/** + ********************************************************************************************* + * struct M4VE_SEModeInterface + * @brief The M4VE_SEModeInterface structure defines the set of functions used in + * "Standalone Encoder" mode. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_stepEncode_fct m_pFctStepEncode; +} M4VE_SEModeInterface; /**< Functions used only in "Standalone Encoder" mode */ + + +/** + ********************************************************************************************* + * struct M4VE_EGModeInterface + * @brief The M4VE_EGModeInterface structure defines the set of functions used in + * "Encoder + Grabber" mode. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_startGrabber_fct m_pFctStartGrabber; + M4VE_startEncoder_fct m_pFctStartEncoder; + M4VE_stopGrabber_fct m_pFctStopGrabber; + M4VE_stopEncoder_fct m_pFctStopEncoder; +} M4VE_EGModeInterface; /**< Functions used only in "Encoder + Grabber" mode */ + + + +/** + ********************************************************************************************* + * struct M4VE_Interface + * @brief The M4VE_Interface structure stores pointers to the video encoder functions. + ********************************************************************************************* +*/ +typedef struct +{ + M4VE_GenericInterface genericInterface; /**< Functions used everytime */ + M4VE_EncoderMode encoderMode; /**< "Standalone Encoder" + or "Encoder + Grabber" */ + union + { + M4VE_SEModeInterface SEModeInterface; /**< Functions used only in + "Standalone Encoder" mode */ + M4VE_EGModeInterface EGModeInterface; /**< Functions used only in + "Encoder + Grabber" mode */ + }M4VE_SpecificInterface; +} M4VE_Interface; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /*__M4VE_API_H__*/ diff --git a/libvideoeditor/vss/common/inc/M4VFL_transition.h b/libvideoeditor/vss/common/inc/M4VFL_transition.h new file mode 100755 index 0000000..294de6f --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VFL_transition.h @@ -0,0 +1,139 @@ +/* + * 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 M4TRAN_transition.h + * @brief + * @note + ****************************************************************************** +*/ + +#ifndef __M4VFL_TRANSITION_H__ +#define __M4VFL_TRANSITION_H__ + +#ifdef __cplusplus +extern "C" { +#endif +typedef unsigned char UInt8; +typedef unsigned long UInt32; + +typedef struct S_M4ViComImagePlane +{ + UInt32 u_width; /* active width, in pixels */ + UInt32 u_height; /* active height, in lines */ + UInt32 u_topleft; /* index of 1st active pixel */ + UInt32 u_stride; /* line stride, in bytes */ + UInt8 *pac_data; /* buffer address */ +} M4ViComImagePlane; + +typedef struct S_M4VFL_modifLumParam +{ + unsigned short lum_factor; + unsigned short copy_chroma; +} M4VFL_ModifLumParam; + +typedef struct S_M4VFL_CurtainParam +{ + unsigned short nb_black_lines; + unsigned char top_is_black; +} M4VFL_CurtainParam; + +#define M4VIFI_OK 0 +#define M4VIFI_ILLEGAL_FRAME_HEIGHT 8 +#define M4VIFI_ILLEGAL_FRAME_WIDTH 9 + +unsigned char M4VFL_modifyLumaByStep(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + M4VFL_ModifLumParam *lum_param, void *user_data); + +unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + unsigned long lum_factor, void *user_data); + +unsigned char M4VFL_applyClosingCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + unsigned short curtain_factor, void *user_data); + +unsigned char M4VFL_applyOpeningCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + unsigned short curtain_factor, void *user_data); + +unsigned char M4VFL_applyFallingCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + unsigned short curtain_factor, void *user_data); + + +/** + ****************************************************************************** + * unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + * M4VFL_CurtainParam *curtain_factor, void *user_data) + * @brief This function applies a black curtain onto a YUV420 image. + * @note THis function writes black lines either at the top of the image or at + * the bottom of the image. The other lines are copied from the source image. + * First the number of black lines is compted and is rounded to an even integer. + * @param plane_in: (IN) pointer to the 3 image planes of the source image + * @param plane_out: (OUT) pointer to the 3 image planes of the destination image + * @param user_data: (IN) pointer to some user_data + * @param curtain_factor: (IN) structure with the parameters of the curtain (nb of black lines + * and if at the top/bottom of the image) + * @return 0: there is no error + ****************************************************************************** +*/ +unsigned char M4VFL_applyCurtain(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, + M4VFL_CurtainParam *curtain_factor, void *user_data); + + +/** + ************************************************************************************************* + * M4OSA_ERR M4VIFI_ImageBlendingonYUV420 (void *pUserData, + * M4VIFI_ImagePlane *pPlaneIn1, + * M4VIFI_ImagePlane *pPlaneIn2, + * M4VIFI_ImagePlane *pPlaneOut, + * M4VIFI_UInt32 Progress) + * @brief Blends two YUV 4:2:0 Planar images. + * @note Blends YUV420 planar images, + * Map the value of progress from (0 - 1000) to (0 - 1024) + * Set the range of blendingfactor, + * 1. from 0 to (Progress << 1) ;for Progress <= 512 + * 2. from (( Progress - 512)<< 1) to 1024 ;otherwise + * Set the increment of blendingfactor for each element in the image row by the factor, + * = (Range-1) / (image width-1) ;for width >= range + * = (Range) / (image width) ;otherwise + * Loop on each(= i) row of output Y plane (steps of 2) + * Loop on each(= j) column of output Y plane (steps of 2) + * Get four Y samples and one U & V sample from two input YUV4:2:0 images and + * Compute four Y sample and one U & V sample for output YUV4:2:0 image + * using the following, + * Out(i,j) = blendingfactor(i,j) * In1(i,j)+ (l - blendingfactor(i,j)) * In2(i,j) + * end loop column + * end loop row. + * @param pUserData: (IN) User Specific Parameter + * @param pPlaneIn1: (IN) Pointer to an array of image plane structures maintained for Y, U + * and V planes. + * @param pPlaneIn2: (IN) Pointer to an array of image plane structures maintained for Y, U + * and V planes. + * @param pPlaneOut: (OUT) Pointer to an array of image plane structures maintained for Y, U + * and V planes. + * @param Progress: (IN) Progress value (varies between 0 and 1000) + * @return M4VIFI_OK: No error + * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: Error in height + * @return M4VIFI_ILLEGAL_FRAME_WIDTH: Error in width + ***********************************************************************************************/ +unsigned char M4VIFI_ImageBlendingonYUV420 (void *pUserData, M4ViComImagePlane *pPlaneIn1, + M4ViComImagePlane *pPlaneIn2, + M4ViComImagePlane *pPlaneOut, UInt32 Progress); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __M4VFL_TRANSITION_H__ diff --git a/libvideoeditor/vss/common/inc/M4VIFI_Clip.h b/libvideoeditor/vss/common/inc/M4VIFI_Clip.h new file mode 100755 index 0000000..13997ac --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VIFI_Clip.h @@ -0,0 +1,36 @@ +/* + * 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 M4VIFI_Clip.h + * @brief Global Table definition + * @note This file defines the Clipping and Division table address + ****************************************************************************** +*/ + +#ifndef _M4VIFI_CLIP_H_ +#define _M4VIFI_CLIP_H_ + +/* Clipping matrix for RGB values */ +EXTERN CNST M4VIFI_UInt8 *M4VIFI_ClipTable_zero; +/* Division table for (65535/x); x = 0 to 512 */ +EXTERN CNST M4VIFI_UInt16 *M4VIFI_DivTable_zero; + +#endif /* _M4VIFI_CLIP_H_ */ + +/* End of file M4VIFI_Clip.h */ + diff --git a/libvideoeditor/vss/common/inc/M4VIFI_Defines.h b/libvideoeditor/vss/common/inc/M4VIFI_Defines.h new file mode 100755 index 0000000..d670791 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VIFI_Defines.h @@ -0,0 +1,155 @@ +/* + * 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 M4VIFI_Defines.h + * @brief Macro Definition + * @note This file defines all the macro used in the filter library + ****************************************************************************** +*/ + +#ifndef _M4VIFI_DEFINES_H_ +#define _M4VIFI_DEFINES_H_ + +/** + ***************************************************************************** + * Macros used for color transform RGB565 to YUV + ***************************************************************************** +*/ +#define CST_RGB_16_SIZE 2 +#define Y16(r, g, b) CLIP( ( ( (80593 * r)+(77855 * g)+(30728 * b)) >> 15)) +#define U16(r, g, b) CLIP(128+ ( ( -(45483 * r)-(43936 * g)+(134771 * b)) >> 15 )) +#define V16(r, g, b) CLIP(128+ ( ( (134771 * r)-(55532 * g)-(21917 * b)) >> 15 )) + + +/** + ***************************************************************************** + * Macros used for color transform YUV to RGB + * B = 1.164(Y - 16) + 2.018(U - 128) + * G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) + * R = 1.164(Y - 16) + 1.596(V - 128) + * Above Conversion Formula is implemented for fixed point operation + ***************************************************************************** +*/ + +#define CST_RGB_24_SIZE 3 + +#ifdef __RGB_V1__ +#define DEMATRIX(Rx,Gx,Bx,Yx37,Ux,Vx) \ + Rx = CLIP(((Yx37 + (Vx * 51) + 16) >> 5) - 223); \ + Gx = CLIP(((Yx37 - ((Ux+(Vx<<1)) * 13) +16) >> 5) + 135); \ + Bx = CLIP(((Yx37 + (Ux * 65) + 16) >> 5) - 277) +#else +#define DEMATRIX(Rx,Gx,Bx,Yx2568,Ux,Vx) \ + Rx = CLIP(((Yx2568 + (Vx * 0x3343) + (M4VIFI_Int32)0xffe40800) >> 13)); \ + Gx = CLIP(((Yx2568 - (Ux * 0x0c92) - (Vx * 0x1a1e) + (M4VIFI_Int32)0x00110180) >> 13)); \ + Bx = CLIP(((Yx2568 + (Ux * 0x40cf) + (M4VIFI_Int32)0xffdd4200) >> 13)); +#endif /* __RGB_V1__ */ + +/** + ***************************************************************************** + * Packing and Unpacking is different for little and big endian + * r, g, b, Rx, Gx, Bx are 8 bit color value + * a, data are 16 bit pixel value + ***************************************************************************** + */ + +/* Pack computations common for little endian and big endian modes */ +#define PACK_BGR24(rgb_ptr,Rx,Gx,Bx) {rgb_ptr[0] = (M4VIFI_UInt8)Bx; rgb_ptr[1] =\ + (M4VIFI_UInt8)Gx; rgb_ptr[2] = (M4VIFI_UInt8)Rx;} +#define PACK_RGB24(rgb_ptr,Rx,Gx,Bx) {rgb_ptr[0] = (M4VIFI_UInt8)Rx; rgb_ptr[1] =\ + (M4VIFI_UInt8)Gx; rgb_ptr[2] = (M4VIFI_UInt8)Bx;} + +#ifdef BIG_ENDIAN +#define PACK_RGB565(a, Rx, Gx, Bx) (((Rx >> 3) << (11 + (a)))\ + | ((Gx >> 2) << (5 + (a))) | ((Bx >> 3) << (a))) +#define PACK_BGR565(a, Rx, Gx, Bx) (((Bx >> 3) << (11 + (a)))\ + | ((Gx >> 2) << (5 + (a))) | ((Rx >> 3) << (a))) +#define GET_RGB565(r, g, b, data) {b = ((data) & 31); g =\ + ((data >> 5) & 63); r = ((data >> 11) & 31);} +#define GET_BGR565(b, g, r, data) \ + r = ((data) & 31); \ + g = ((data >> 5) & 63); \ + b = ((data >> 11) & 31 ); +#else /* LITTLE endian: 0x12345678 -> 78 56 34 12 */ +#define PACK_RGB565(a, Rx, Gx, Bx) (((Bx >> 3) << (8 + (a))) \ + | (((Gx >> 2)&0x7) << (13 + (a))) | ((Gx >> 5) << (a)) | ((Rx >> 3) << (3 + a))) +#define PACK_BGR565(a, Rx, Gx, Bx) (((Rx >> 3) << (11 + (a))) \ + | ((Gx >> 2) << (5 + (a))) | ((Bx >> 3) << (a))) +#define GET_RGB565(r, g, b, data) { b = (M4VIFI_UInt8)(((data) & 0x1F00) >> 8); g =\ + (M4VIFI_UInt8)((((data) & 0x7) << 3) | (((data) & 0xE000) >> 13)); r =\ + (M4VIFI_UInt8)(((data) & 0xF8) >> 3);} +#define GET_BGR565(b, g, r, data) \ + b = ((data) & 31); \ + g = ((data >> 5) & 63); \ + r = ((data >> 11) & 31 ); +#endif /* BIG_ENDIAN */ + + +#define CST_RGB_24_SIZE 3 +#define Y24(r,g,b) CLIP(( ( (19595 * r) + (38470 * g) + (9437 * b) ) >>16)) +#define U24(r,g,b) CLIP(128 + ( ( -(11059 * r) - (21709 * g) + (32768 * b)) >>16)) +#define V24(r,g,b) CLIP(128 + ( ( (32768 * r) - (27426 * g) - (5329 * b)) >>16)) +#define GET_RGB24(r,g,b,s,o) r = s[o]; g = s[o + 1]; b = s[o + 2]; + +/** + *********************************************************************************** + * Macro for clipping using the clipping matrix for RGB values + *********************************************************************************** +*/ +/** Clip function ensures values with range of 0 and 255 */ +#define CLIP(x) *(M4VIFI_ClipTable_zero + (x)) +#define CLIP_OVF 500 +#define CLIP_LUT_SIZE (256 + 2 * CLIP_OVF) +/** Division table for RGB565 to HLS conversion */ +#define DIVCLIP(x) *(M4VIFI_DivTable_zero + (x)) + +/** + ***************************************************************************** + * Endianness (default configuration is Little Endian) + ***************************************************************************** +*/ +#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) +/** Default endian setting */ +#define LITTLE_ENDIAN +#endif + +/** + ***************************************************************************** + * Other macros and define + ***************************************************************************** +*/ +/** YUV plane index */ +#define PLANES 3 +#define YPlane 0 +#define UPlane 1 +#define VPlane 2 + +/** Check for value is EVEN */ +#ifndef IS_EVEN +#define IS_EVEN(a) (!(a & 0x01)) +#endif + +/* Used for fixed point implementation */ +#ifndef MAX_SHORT +#define MAX_SHORT 0x10000 +#endif + +#endif /* _M4VIFI_DEFINES_H_ */ + +/* End of file M4VIFI_Defines.h */ + diff --git a/libvideoeditor/vss/common/inc/M4VIFI_FiltersAPI.h b/libvideoeditor/vss/common/inc/M4VIFI_FiltersAPI.h new file mode 100755 index 0000000..390c6e4 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VIFI_FiltersAPI.h @@ -0,0 +1,786 @@ +/* + * 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 M4VIFI_FiltersAPI.h + * @brief External API and Data definitions for the video filter library + * @note This file defines and declares data common to the video filter library: + * -# data types + * -# error codes + * -# external API's + * -# API level structure definition + ****************************************************************************** +*/ + +#ifndef _M4VIFI_FILTERSAPI_H_ + +#define _M4VIFI_FILTERSAPI_H_ + +#ifdef __cplusplus + +extern "C" { + +#endif /* __cplusplus */ + + /** + *********************************************************** + * Data types definition + *********************************************************** + */ + + typedef unsigned char M4VIFI_UInt8; + typedef char M4VIFI_Int8; + typedef unsigned short M4VIFI_UInt16; + typedef unsigned long M4VIFI_UInt32; + typedef short M4VIFI_Int16; + typedef long M4VIFI_Int32; + typedef float M4VIFI_Float; + typedef double M4VIFI_Double; + typedef unsigned char M4VIFI_ErrorCode; + +/** + *********************************************************** + * Error codes definition + *********************************************************** +*/ +#define M4VIFI_OK 0 +#define M4VIFI_INVALID_PARAM 7 +#define M4VIFI_ILLEGAL_FRAME_HEIGHT 8 +#define M4VIFI_ILLEGAL_FRAME_WIDTH 9 + +/** + *********************************************************** + * Other basic definitions + *********************************************************** +*/ +#define CNST const +#define EXTERN extern + +#ifndef NULL +#define NULL 0 + +#endif +#ifndef FALSE +#define FALSE 0 +#define TRUE !FALSE + +#endif + +/** + *********************************************************** + * Structures definition + *********************************************************** +*/ + +/** + ****************************************************************************** + * structure M4VIFI_ImagePlane + * @brief Texture (YUV) planes structure + * @note This structure details the image planes for the output textures: + * sizes (in pixels) are luma plane sizes, the 3 pointers point + * to the Y, U and V buffers which store data in planar format. + ****************************************************************************** +*/ + + typedef struct + { + M4VIFI_UInt32 u_width; /**< Width of luma in pixel unit */ + M4VIFI_UInt32 u_height; /**< Height of luma in pixel unit */ + M4VIFI_UInt32 u_topleft; /**< Pointer to first texture active pixel */ + M4VIFI_UInt32 u_stride; /**< Stride value */ + M4VIFI_UInt8 *pac_data; /**< Pointer to the data */ + } M4VIFI_ImagePlane; + +/** + ****************************************************************************** + * structure M4VIFI_FramingData + * @brief Data necessary to add an overlay on an image + * @note This structure details the position and the data of the overlay + ****************************************************************************** +*/ + typedef struct + { + M4VIFI_UInt32 + m_xPosStep; /**< X positioning of the overlay vs main picture. + X positioning is expressed in percentage vs the main + picture width. + m_xPosStep must be expressed by step of 1% and between + -50/+50%. + 0% means overlay is centered vs main picture on + X abscissa. */ + M4VIFI_UInt32 + m_yPosStep; /**< Y positioning of the overlay vs main picture. + Y positioning is expressed in percentage vs the main + picture width. + m_xPosStep must be expressed by step of 1% and between + -50/+50%. + 0% means overlay is centered vs main picture on + Y abscissa. */ + + M4VIFI_ImagePlane + * + m_imagePlane; /**< Pointer to the framing image with alpha channel */ + } M4VIFI_FramingData; + +/** + ****************************************************************************** + * structure M4VIFI_HLSoffset + * @brief HLS offset structure + * @note This structure have the hue, saturation and lightness value + * for quality enhancement. Range of values neccessarily be + * hue = -360 to 360, sat = 0 to 100 and light = 0 t0 100 + ****************************************************************************** +*/ + typedef struct + { + M4VIFI_Int16 hue; /**< Hue offset */ + M4VIFI_Int16 sat; /**< Saturation offset */ + M4VIFI_Int16 light; /**< Light offset */ + } M4VIFI_HLSoffset; + +/** + ****************************************************************************** + * structure M4VIFI_Tranformation + * @brief Image Tranformation Structure + * @note Image Tranformation Request + * rotation : 1 -> +90deg Rotation + * -1 -> -90deg Rotation + * 0 -> No Rotation + ****************************************************************************** +*/ + typedef struct + { + M4VIFI_Int32 i32_rotation; /**< Rotation Flag */ + } M4VIFI_Tranformation; + +/** + ****************************************************************************** + * structure M4VIFI_pContext + * @brief New Structures + * @note -# Structure of M4VIFI_HLSoffset + ****************************************************************************** +*/ + typedef struct + { + M4VIFI_HLSoffset hlsOffset; /**< HLS offset structure */ + } M4VIFI_pContext; + + /* + ***************************************************** + * External API functions + ***************************************************** + */ + + /**< Effect filters */ + M4VIFI_UInt8 M4VIFI_SepiaYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_GrayscaleYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_ContrastYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_NegativeYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_FlipYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_MirrorYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_Rotate180YUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_Rotate90RightYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_Rotate90LeftYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_ColorRYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_ColorGYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_ColorBYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_FramingRGB565toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_FramingYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_SetHueInYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_ColdYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + M4VIFI_UInt8 M4VIFI_WarmYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + +/* ADS Compiler */ + +/* Generic ARM assembly functions */ +#if defined ADS_ARM + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear RGB888toRGB888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear RGB565toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** RGB565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB565toYUV420AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BGR565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR565toYUV420AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV422 to YUV420 */ + M4VIFI_UInt8 M4VIFI_UYVYtoYUV420AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420 to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toRGB565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightAdsArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftAdsArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightAdsArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftAdsArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in RGB565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinRGB565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in BGR565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinBGR565AdsArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +#define M4VIFI_RGB565toYUV420 M4VIFI_RGB565toYUV420AdsArm +#define M4VIFI_BGR565toYUV420 M4VIFI_BGR565toYUV420AdsArm +#define M4VIFI_UYVYtoYUV420 M4VIFI_UYVYtoYUV420AdsArm +#define M4VIFI_YUV420toRGB565 M4VIFI_YUV420toRGB565AdsArm +#define M4VIFI_YUV420toBGR565 M4VIFI_YUV420toBGR565AdsArm +#define M4VIFI_ResizeBilinearYUV420toRGB565 \ + M4VIFI_ResizeBilinearYUV420toRGB565AdsArm + +#define M4VIFI_ResizeBilinearYUV420toBGR565 \ + M4VIFI_ResizeBilinearYUV420toBGR565AdsArm + +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightAdsArm + +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftAdsArm + +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightAdsArm + +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftAdsArm + +#define M4VIFI_SetHLSinRGB565 M4VIFI_SetHLSinRGB565AdsArm +#define M4VIFI_SetHLSinBGR565 M4VIFI_SetHLSinBGR565AdsArm + +/* ARM9E assembly functions */ +#elif defined ADS_ARM9E + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV888toYUV888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV565toYUV565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** RGB565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB565toYUV420AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BGR565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR565toYUV420AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV422 to YUV420 */ + M4VIFI_UInt8 M4VIFI_UYVYtoYUV420AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420 to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toRGB565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightAdsArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftAdsArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightAdsArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftAdsArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in RGB565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinRGB565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in BGR565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinBGR565AdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize YUV420toYUV420 from QCIF to QVGA*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoYUV420QVGAAdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGAAdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA with rotation +90*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RRAdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA with rotation -90*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RLAdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); +/** Resizes YUV420 Planar Image and stores in YUV420 Linear format with/without +or-90 rotation*/ + M4VIFI_UInt8 M4VIFI_YUV420PlanartoYUV420LinearAdsArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + +#define M4VIFI_RGB565toYUV420 M4VIFI_RGB565toYUV420AdsArm9E +#define M4VIFI_BGR565toYUV420 M4VIFI_BGR565toYUV420AdsArm9E +#define M4VIFI_UYVYtoYUV420 M4VIFI_UYVYtoYUV420AdsArm9E +#define M4VIFI_YUV420toRGB565 M4VIFI_YUV420toRGB565AdsArm9E +#define M4VIFI_YUV420toBGR565 M4VIFI_YUV420toBGR565AdsArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565 \ + M4VIFI_ResizeBilinearYUV420toRGB565AdsArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565 \ + M4VIFI_ResizeBilinearYUV420toBGR565AdsArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightAdsArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftAdsArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightAdsArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftAdsArm9E +#define M4VIFI_SetHLSinRGB565 M4VIFI_SetHLSinRGB565AdsArm9E +#define M4VIFI_SetHLSinBGR565 M4VIFI_SetHLSinBGR565AdsArm9E +#define M4VIFI_YUV420QCIFtoYUV420QVGA M4VIFI_YUV420QCIFtoYUV420QVGAAdsArm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA M4VIFI_YUV420QCIFtoRGB565QVGAAdsArm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA_RR M4VIFI_YUV420QCIFtoRGB565QVGA_RRAdsArm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA_RL M4VIFI_YUV420QCIFtoRGB565QVGA_RLAdsArm9E +#define M4VIFI_YUV420PlanartoYUV420Linear M4VIFI_YUV420PlanartoYUV420LinearAdsArm9E +/* GCC Compiler */ +/* Generic ARM assembly functions */ + +#elif defined GCC_ARM + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV888toYUV888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV565toYUV565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** RGB565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB565toYUV420GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BGR565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR565toYUV420GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420 to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toBGR565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightGccArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftGccArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toBGR565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightGccArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftGccArm( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Modify HLS in RGB565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinRGB565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Modify HLS in BGR565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinBGR565GccArm(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +#define M4VIFI_RGB565toYUV420 M4VIFI_RGB565toYUV420GccArm +#define M4VIFI_BGR565toYUV420 M4VIFI_BGR565toYUV420GccArm +#define M4VIFI_YUV420toRGB565 M4VIFI_YUV420toRGB565GccArm +#define M4VIFI_YUV420toBGR565 M4VIFI_YUV420toBGR565GccArm +#define M4VIFI_ResizeBilinearYUV420toRGB565 \ + M4VIFI_ResizeBilinearYUV420toRGB565GccArm +#define M4VIFI_ResizeBilinearYUV420toBGR565 \ + M4VIFI_ResizeBilinearYUV420toBGR565GccArm +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightGccArm +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftGccArm +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightGccArm +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftGccArm +#define M4VIFI_SetHLSinRGB565 M4VIFI_SetHLSinRGB565GccArm +#define M4VIFI_SetHLSinBGR565 M4VIFI_SetHLSinBGR565GccArm + +/* ARM9E assembly functions */ +#elif defined GCC_ARM9E + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV888toYUV888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV565toYUV565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** RGB565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB565toYUV420GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BGR565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR565toYUV420GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420 to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toRGB565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightGccArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftGccArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize Bilinear YUV420toBGR565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightGccArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftGccArm9E( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in RGB565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinRGB565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in BGR565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinBGR565GccArm9E(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +#define M4VIFI_RGB565toYUV420 M4VIFI_RGB565toYUV420GccArm9E +#define M4VIFI_BGR565toYUV420 M4VIFI_BGR565toYUV420GccArm9E +#define M4VIFI_YUV420toRGB565 M4VIFI_YUV420toRGB565GccArm9E +#define M4VIFI_YUV420toBGR565 M4VIFI_YUV420toBGR565GccArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565 \ + M4VIFI_ResizeBilinearYUV420toRGB565GccArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565 \ + M4VIFI_ResizeBilinearYUV420toBGR565GccArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightGccArm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftGccArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedRightGccArm9E +#define M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeftGccArm9E +#define M4VIFI_SetHLSinBGR565 M4VIFI_SetHLSinBGR565GccArm9E +#define M4VIFI_SetHLSinRGB565 M4VIFI_SetHLSinRGB565GccArm9E + +/* TI CCS assembly files */ +#elif defined TI411_ARM9E + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV888toYUV888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV565toYUV565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** YUV420 (Planar) to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 (Planar) to Resized RGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 (Planar) to Resized RGB888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420(Planar) to Resized and Rotated (-90) RGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420(Planar) to Resized and Rotated (+90) RGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420(Planar) to Resized YUV420(Planar) */ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoYUV420QVGA(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** Resize YUV420(Planar) of QCIF to RGB565 of QVGA resolution */ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +/** Resize YUV420(Planar) of QCIF to RGB565 of QVGA resolution with rotation(-90) */ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RL(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +/** Resize YUV420(Planar) of QCIF to RGB565 of QVGA resolution with rotation(+90) */ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RR(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + +#define M4VIFI_YUV420toRGB565 M4VIFI_YUV420toRGB565Ti411Arm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565 \ + M4VIFI_ResizeBilinearYUV420toRGB565Ti411Arm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeftTi411Arm9E +#define M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight \ + M4VIFI_ResizeBilinearYUV420toRGB565RotatedRightTi411Arm9E + +#define M4VIFI_YUV420QCIFtoYUV420QVGA M4VIFI_YUV420QCIFtoYUV420QVGATi411Arm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA M4VIFI_YUV420QCIFtoRGB565QVGATi411Arm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA_RL M4VIFI_YUV420QCIFtoRGB565QVGA_RLTi411Arm9E +#define M4VIFI_YUV420QCIFtoRGB565QVGA_RR M4VIFI_YUV420QCIFtoRGB565QVGA_RRTi411Arm9E + +/* ANSI C Functions */ +#else + + /** Apply grayscale effect RGB565toRGB565 */ + + M4VIFI_UInt8 M4VIFI_GrayscaleRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV888toYUV888 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV565toYUV565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + + /** RGB565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB565toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BRG565 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR565toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** BRG888 to YUV420 */ + M4VIFI_UInt8 M4VIFI_BGR888toYUV420(void *pUserData, + M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane PlaneOut[3]); + /** RGB888 to YUV420 */ + M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, + M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane PlaneOut[3]); + + /** YUV422 to YUV420 */ + M4VIFI_UInt8 M4VIFI_UYVYtoYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + + /** YUV420 to RGB565 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565RotatedLeft(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** YUV420 to BGR565 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR565RotatedRight(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** YUV420 to BGR24 */ + M4VIFI_UInt8 M4VIFI_YUV420toBGR24(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** YUV420 to RGB24 */ + M4VIFI_UInt8 M4VIFI_YUV420toRGB24(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** Resize Bilinear YUV420toYUV420 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toYUV420(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /** Resize Bilinear YUV420toRGB565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB888(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toRGB565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedLeft(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Resize Bilinear YUV420toBGR565 with rotation +90 or -90 */ + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedRight( + void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565RotatedLeft(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in RGB565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinRGB565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /** Modify HLS in BGR565 */ + M4VIFI_UInt8 M4VIFI_SetHLSinBGR565(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *PlaneOut); + /**Resize YUV420toYUV420 from QCIF to QVGA*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoYUV420QVGA(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA with rotation +90*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RR(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + /**Resize YUV420toRGB565 from QCIF to QVGA with rotation -90*/ + M4VIFI_UInt8 M4VIFI_YUV420QCIFtoRGB565QVGA_RL(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); +/** Resizes YUV420 Planar Image and stores in YUV420 Linear format with/without +or-90 rotation*/ + M4VIFI_UInt8 M4VIFI_YUV420PlanartoYUV420Linear(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); + +/** Resizes YUV420 Planar Image and stores in YUV422 Interleaved format + with/without +or-90 rotation*/ + M4VIFI_UInt8 M4VIFI_YUV420PlanartoYUV422Interleaved(void *pUserData, + M4VIFI_ImagePlane *pPlaneIn, M4VIFI_ImagePlane *pPlaneOut); +#endif + + /** definition of the converter function types */ + + typedef M4VIFI_UInt8 M4VIFI_PlanConverterFunctionType(void + *pContext, M4VIFI_ImagePlane* in, M4VIFI_ImagePlane* out); + + /** definition of the preprocessing function types */ + typedef M4VIFI_UInt8 M4VIFI_PreprocessFunctionType(void + *pContext, M4VIFI_ImagePlane* in, M4VIFI_ImagePlane* out); + + M4VIFI_UInt8 M4VIFI_YUV420toYUV420(void *user_data, + M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_YUV420PlanarToYUV420Semiplanar(void *user_data, + M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut); + M4VIFI_UInt8 M4VIFI_SemiplanarYUV420toYUV420(void *user_data, + M4VIFI_ImagePlane *PlaneIn, M4VIFI_ImagePlane *PlaneOut); +#ifdef __cplusplus + +} + +#endif /* __cplusplus */ + +#endif /* _M4VIFI_FILTERSAPI_H_ */ + +/* End of file M4VIFI_FiltersAPI.h */ diff --git a/libvideoeditor/vss/common/inc/M4VPP_API.h b/libvideoeditor/vss/common/inc/M4VPP_API.h new file mode 100755 index 0000000..a231d34 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4VPP_API.h @@ -0,0 +1,152 @@ +/* + * 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 M4VPP_API.h + * @brief Video preprocessing API public functions prototypes. + * @note + ****************************************************************************** +*/ + +#ifndef M4VPP_API_H +#define M4VPP_API_H + +#include "M4OSA_Types.h" /**< Include for common OSAL types */ +#include "M4OSA_Error.h" /**< Include for common OSAL errors */ + +/** + * Include Video filters interface definition (for the M4VIFI_ImagePlane type) */ +#include "M4VIFI_FiltersAPI.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + ****************************************************************************** + * Public type of the Video Preprocessing execution context + ****************************************************************************** +*/ +typedef M4OSA_Void* M4VPP_Context; + +typedef enum +{ + M4VPP_kIYUV420=0, /**< YUV 4:2:0 planar (standard input for mpeg-4 video) */ + M4VPP_kIYUV422, /**< YUV422 planar */ + M4VPP_kIYUYV, /**< YUV422 interlaced, luma first */ + M4VPP_kIUYVY, /**< YUV422 interlaced, chroma first */ + M4VPP_kIJPEG, /**< JPEG compressed frames */ + M4VPP_kIRGB444, /**< RGB 12 bits 4:4:4 */ + M4VPP_kIRGB555, /**< RGB 15 bits 5:5:5 */ + M4VPP_kIRGB565, /**< RGB 16 bits 5:6:5 */ + M4VPP_kIRGB24, /**< RGB 24 bits 8:8:8 */ + M4VPP_kIRGB32, /**< RGB 32 bits */ + M4VPP_kIBGR444, /**< BGR 12 bits 4:4:4 */ + M4VPP_kIBGR555, /**< BGR 15 bits 5:5:5 */ + M4VPP_kIBGR565, /**< BGR 16 bits 5:6:5 */ + M4VPP_kIBGR24, /**< BGR 24 bits 8:8:8 */ + M4VPP_kIBGR32 /**< BGR 32 bits */ +} M4VPP_InputVideoFormat; + + +/** + ****************************************************************************** + * @brief Prototype of the main video preprocessing function + * @note Preprocess one frame + * @param pContext: (IN) Execution context of the VPP. + * @param pPlaneIn: (INOUT) Input Image + * @param pPlaneOut: (INOUT) Output Image + ****************************************************************************** +*/ +typedef M4OSA_ERR (M4VPP_apply_fct) (M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + M4VIFI_ImagePlane* pPlaneOut); + + + +/** + ****************************************************************************** + * M4OSA_ERR M4VPP_initVideoPreprocessing(M4VPP_Context* pContext) + * @brief This function allocates a new execution context for the Video Preprocessing component. + * @note + * @param pContext: (OUT) Execution context allocated by the function. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_ALLOC: there is no more available memory. + * @return M4ERR_PARAMETER: pContext is NULL (debug only). + ****************************************************************************** +*/ +M4OSA_ERR M4VPP_initVideoPreprocessing(M4VPP_Context* pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VPP_applyVideoPreprocessing(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + * M4VIFI_ImagePlane* pPlaneOut) + * @brief Preprocess one frame. + * @note + * @param pContext: (IN) Execution context. + * @param pPlaneIn: (INOUT) Input Image + * @param pPlaneOut: (INOUT) Output Image + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext or pPlaneIn or pPlaneOut is NULL (debug only). + * @return M4ERR_STATE: Video Preprocessing is not in an appropriate state for this function + * to be called + ****************************************************************************** +*/ +M4OSA_ERR M4VPP_applyVideoPreprocessing(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn, + M4VIFI_ImagePlane* pPlaneOut); + +/** + ****************************************************************************** + * M4OSA_ERR M4VPP_cleanUpVideoPreprocessing(M4VPP_Context pContext) + * @brief This method frees the execution context for the Video Preprocessing component. + * Any further usage of the context will lead to unpredictable result. + * @note + * @param pContext: (IN) Execution context. + * @return M4NO_ERROR: there is no error. + * @return M4ERR_PARAMETER: pContext is NULL (debug only). + ****************************************************************************** +*/ +M4OSA_ERR M4VPP_cleanUpVideoPreprocessing(M4VPP_Context pContext); + +/** + ****************************************************************************** + * M4OSA_ERR M4VPP_setVideoPreprocessingMode(M4VPP_Context pContext, M4VES_InputVideoFormat format) + * @brief This method apply the video preprocessing to the input plane. Result is put into the + * output plan. + * @param pContext: (IN) Execution context. + * @param format : (IN) Format of input plane (rgb, yuv, ...) + * @return M4NO_ERROR: there is no error + ****************************************************************************** +*/ +M4OSA_ERR M4VPP_setVideoPreprocessingMode(M4VPP_Context pContext, M4VPP_InputVideoFormat format); + +/** + ****************************************************************************** + * @brief Definition of the errors specific to this module. + ****************************************************************************** +*/ + +/**< Input and output planes have incompatible properties */ +#define M4VPP_ERR_IMCOMPATIBLE_IN_AND_OUT_PLANES M4OSA_ERR_CREATE( M4_ERR,\ + M4PREPROCESS_VIDEO, 0x000001); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* M4VPP_API_H */ + diff --git a/libvideoeditor/vss/common/inc/M4WRITER_common.h b/libvideoeditor/vss/common/inc/M4WRITER_common.h new file mode 100755 index 0000000..779968b --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4WRITER_common.h @@ -0,0 +1,262 @@ +/* + * 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 M4WRITER_common.h + * @brief VES writers shell interface. + * @note This file defines the types internally used by the VES to abstract writers + ****************************************************************************** +*/ +#ifndef __M4WRITER_COMMON_H__ +#define __M4WRITER_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "M4OSA_Types.h" +#include "M4OSA_FileWriter.h" /* for M4OSA_FileWriterPointer */ +#include "M4OSA_FileReader.h" /* for M4OSA_FileWriterPointer */ +#include "M4OSA_OptionID.h" /* for M4OSA_OPTION_ID_CREATE() */ +#include "M4OSA_CoreID.h" /* for M4WRITER_COMMON */ + +#include "M4SYS_Stream.h" /* for M4SYS_StreamID */ +#include "M4SYS_AccessUnit.h" /* for M4SYS_AccessUnit */ + +/** + ****************************************************************************** + * MP4W Errors & Warnings definition + ****************************************************************************** +*/ +#define M4WAR_WRITER_STOP_REQ M4OSA_ERR_CREATE(M4_WAR, M4WRITER_COMMON ,0x000001) + +/** + ****************************************************************************** + * enum M4WRITER_OutputFileType + * @brief This enum defines the avalaible output file format. + ****************************************************************************** +*/ +typedef enum +{ + M4WRITER_kUnknown=-1, + M4WRITER_k3GPP=0, /**< 3GPP compliant file */ + M4WRITER_kAVI=1, /**< AVI file */ + M4WRITER_kAMR=2, /**< AMR file */ + M4WRITER_kNETWORK3GPP=3, /**< 3GPP via TCP */ + M4WRITER_kPCM=4, /**< PCM file */ + M4WRITER_kJPEG=5, /**< JPEG EXIF writer */ + M4WRITER_kMP3=6, /**< MP3 writer */ + + M4WRITER_kType_NB /* number of writers, keep it as last enum entry */ + +} M4WRITER_OutputFileType; + +/** + ****************************************************************************** + * enum M4WRITER_OptionID + * @brief This enums defines all avalaible options. All the reuturned values are in + * M4OSA_UInt32 type. + ****************************************************************************** +*/ +typedef enum { + M4WRITER_kMaxAUSize = M4OSA_OPTION_ID_CREATE (M4_READ|M4_WRITE, M4WRITER_COMMON, 0x01), + M4WRITER_kMaxChunckSize = M4OSA_OPTION_ID_CREATE (M4_READ|M4_WRITE, M4WRITER_COMMON, 0x02), + M4WRITER_kFileSize = M4OSA_OPTION_ID_CREATE (M4_READ , \ + M4WRITER_COMMON, 0x03), /**< File size if the process was ended when we call the method */ + M4WRITER_kFileSizeAudioEstimated= M4OSA_OPTION_ID_CREATE (M4_READ ,\ + M4WRITER_COMMON, 0x04), /**< File size if the process was ended when we call the + method, estimated size for audio */ + M4WRITER_kEmbeddedString = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x05), /**< String embedded at the end of the file(SW - VES) */ + M4WRITER_kEmbeddedVersion = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x06), /**< Version embedded at the end of the file */ + M4WRITER_kIntegrationTag = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x07), /**< String embedded at the end of the file (char[60] + for integration purpose) */ + M4WRITER_kMaxFileSize = M4OSA_OPTION_ID_CREATE (M4_WRITE , \ + M4WRITER_COMMON, 0x08), /**< Maximum file size limitation */ + M4WRITER_kMaxFileDuration = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x09), /**< Maximum file duration limitation */ + M4WRITER_kSetFtypBox = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x0A), /**< Set 'ftyp' atom */ + M4WRITER_kMetaData = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x0B), /**< Additionnal information to set in the file */ + M4WRITER_kDSI = M4OSA_OPTION_ID_CREATE (M4_WRITE , \ + M4WRITER_COMMON, 0x0C), /**< To set DSI of the file (Decoder specifc info) */ + M4WRITER_kJpegReserveFPData = M4OSA_OPTION_ID_CREATE (M4_WRITE ,\ + M4WRITER_COMMON, 0x0D), /**< Reserve some space in the file for JPEG fast + processing data */ + M4WRITER_kJpegSetFPData = M4OSA_OPTION_ID_CREATE (M4_WRITE , \ + M4WRITER_COMMON, 0x0E), /**< Write Fast Processing Data in the file*/ + /* + CRLV6775 -H.264 trimming */ + M4WRITER_kMUL_PPS_SPS = M4OSA_OPTION_ID_CREATE (M4_WRITE , M4WRITER_COMMON, 0x0F) + /* - CRLV6775 -H.264 trimming */ +} M4WRITER_OptionID; + + +/** + ****************************************************************************** + * struct M4WRITER_Header + * @brief This structure defines the buffer where an header is put. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_MemAddr8 pBuf; /**< Buffer for the header */ + M4OSA_UInt32 Size; /**< Size of the data */ +} M4WRITER_Header; + + +/** + ****************************************************************************** + * struct M4WRITER_StreamVideoInfos + * @brief This structure defines the specific video stream infos, extension to + * M4SYS_StreamDescription. + ****************************************************************************** +*/ +typedef struct { + M4OSA_UInt32 height; /**< Frame height */ + M4OSA_UInt32 width; /**< Frame Width */ + M4OSA_Double fps; /**< Targetted framerate of the video */ + M4WRITER_Header Header; /**< Sequence header of the video stream, + member set to NULL if no header present */ +} M4WRITER_StreamVideoInfos; + + +/** + ****************************************************************************** + * struct M4WRITER_StreamAudioInfos + * @brief This structure defines the specific audio stream infos, extension to + M4SYS_StreamDescription. + ****************************************************************************** +*/ +typedef struct { + M4OSA_UInt32 nbSamplesPerSec; /**< Number of Samples per second */ + M4OSA_UInt16 nbBitsPerSample; /**< Number of Bits in 1 sample */ + M4OSA_UInt16 nbChannels; /**< Number of channels */ + M4WRITER_Header Header; /**< Decoder Specific Info of the audiostream, + member set to NULL if no DSI present */ +} M4WRITER_StreamAudioInfos; + + +/** + ****************************************************************************** + * enum M4WRITER_Orientation + * @brief This enum defines the possible orientation of a frame as described + * in the EXIF standard. + ****************************************************************************** +*/ +typedef enum +{ + M4WRITER_OrientationUnknown = 0, + M4WRITER_OrientationTopLeft, + M4WRITER_OrientationTopRight, + M4WRITER_OrientationBottomRight, + M4WRITER_OrientationBottomLeft, + M4WRITER_OrientationLeftTop, + M4WRITER_OrientationRightTop, + M4WRITER_OrientationRightBottom, + M4WRITER_OrientationLeftBottom +}M4WRITER_Orientation ; + +/** + ****************************************************************************** + * struct M4WRITER_MetaData + * @brief This structure defines all the meta data to store in the encoded file. + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_Char* Description ; + M4OSA_Char* PhoneManufacturer ; + M4OSA_Char* PhoneModel ; + M4OSA_Char* Artist ; + M4OSA_Char* Copyright ; + M4OSA_Char* Software ; + M4OSA_Char* CreationDate; + M4WRITER_Orientation Orientation ; + + M4OSA_UInt32 Width ; + M4OSA_UInt32 Height ; + + M4OSA_UInt32 ThumbnailWidth ; + M4OSA_UInt32 ThumbnailHeight ; + M4OSA_Bool ThumbnailPresence ; +}M4WRITER_MetaData; + + +typedef void* M4WRITER_Context; + +typedef M4OSA_ERR (M4WRITER_openWrite) (M4WRITER_Context* hContext,\ + void* outputFileDescriptor,\ + M4OSA_FileWriterPointer* pFileWriterPointer,\ + void* tempFileDescriptor, \ + M4OSA_FileReadPointer* pFileReaderPointer); +typedef M4OSA_ERR (M4WRITER_addStream) (M4WRITER_Context pContext,\ + M4SYS_StreamDescription*streamDescription); +typedef M4OSA_ERR (M4WRITER_startWriting) (M4WRITER_Context pContext); +typedef M4OSA_ERR (M4WRITER_closeWrite) (M4WRITER_Context pContext); +typedef M4OSA_ERR (M4WRITER_setOption) (M4WRITER_Context pContext, \ + M4OSA_UInt32 optionID, \ + M4OSA_DataOption optionValue); +typedef M4OSA_ERR (M4WRITER_getOption) (M4WRITER_Context pContext, \ + M4OSA_UInt32 optionID, \ + M4OSA_DataOption optionValue); + + +/** + ****************************************************************************** + * struct M4WRITER_GlobalInterface + * @brief Defines all the functions required for a writer shell. + ****************************************************************************** +*/ +typedef struct _M4WRITER_GlobalInterface +{ + M4WRITER_openWrite* pFctOpen; + M4WRITER_addStream* pFctAddStream; + M4WRITER_startWriting* pFctStartWriting; + M4WRITER_closeWrite* pFctCloseWrite; + M4WRITER_setOption* pFctSetOption; + M4WRITER_getOption* pFctGetOption; +} M4WRITER_GlobalInterface; + +typedef M4OSA_ERR M4WRITER_startAU(M4WRITER_Context pContext, M4SYS_StreamID streamID,\ + M4SYS_AccessUnit* pAU); +typedef M4OSA_ERR M4WRITER_processAU(M4WRITER_Context pContext, M4SYS_StreamID streamID,\ + M4SYS_AccessUnit* pAU); + +/** + ****************************************************************************** + * struct M4WRITER_DataInterface + * @brief Defines all the functions required to write data with a writer shell. + ****************************************************************************** +*/ +typedef struct _M4WRITER_DataInterface +{ + M4WRITER_startAU* pStartAU; + M4WRITER_processAU* pProcessAU; + + M4WRITER_Context pWriterContext; + +} M4WRITER_DataInterface; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__M4WRITER_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4_BitStreamParser.h b/libvideoeditor/vss/common/inc/M4_BitStreamParser.h new file mode 100755 index 0000000..0e7dfb0 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4_BitStreamParser.h @@ -0,0 +1,135 @@ +/* + * 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 M4_BitStreamParser.h + * @brief MPEG-4 File Format bit stream utility + * @note This file contains utility functions used to parse MPEG specific + * data structures. + ************************************************************************ +*/ +#ifndef __M4_BITSTREAMPARSER_H__ +#define __M4_BITSTREAMPARSER_H__ + +#include "M4OSA_Types.h" + +/** +* M4_BitStreamParser_Init. +* +* Allocates the context and initializes internal data +* +* @param pContext : A pointer to the context internally used by the package - ALLOCATED BY THE +* FUNCTION (M4OSA_NULL if allocation fails) +* @param bitStream : A pointer to the bitstream - must be 32 bits as access are 32 bits +* @param size : The size of the bitstream in bytes +* +*/ +void M4_BitStreamParser_Init(void** pContext, void* pBitStream, M4OSA_Int32 size); + +/** + ************************************************************************ + * @brief Clean up context + * @param pContext (IN/OUT) M4_BitStreamParser context. + ************************************************************************ +*/ +void M4_BitStreamParser_CleanUp(void* pContext); + +/** + ************************************************************************ + * @brief Read the next <length> bits in the bitstream. + * @note The function does not update the bitstream pointer. + * @param pContext (IN/OUT) M4_BitStreamParser context. + * @param length (IN) The number of bits to extract from the bitstream + * @return the read bits + ************************************************************************ +*/ +M4OSA_UInt32 M4_BitStreamParser_ShowBits(void* pContext, M4OSA_Int32 length); + +/** + ************************************************************************ + * @brief Increment the bitstream pointer of <length> bits. + * @param pContext (IN/OUT) M4_BitStreamParser context. + * @param length (IN) The number of bit to shift the bitstream + ************************************************************************ +*/ +void M4_BitStreamParser_FlushBits(void* pContext, M4OSA_Int32 length); + +/** + ************************************************************************ + * @brief Get a pointer to the current byte pointed by the bitstream pointer. + * It does not update the bitstream pointer + * + * @param pContext : A pointer to the context internally used by the package + * @param length : The number of bit to extract from the bitstream + * + * @returns the read bits +*/ +M4OSA_UInt32 M4_BitStreamParser_GetBits(void* pContext,M4OSA_Int32 bitPos, M4OSA_Int32 length); + +/** +* M4_BitStreamParser_Restart resets the bitstream indexes. +* +* @param pContext : A pointer to the context internally used by the package +* +*/ +void M4_BitStreamParser_Restart(void* pContext); + +/** + ************************************************************************ + * @brief Get a pointer to the current byte pointed by the bitstream pointer. + * @returns pointer to the current location in the bitstream + * @note It should be used carefully as the pointer is in the bitstream itself + * and no copy is made. + * @param pContext (IN/OUT) M4_BitStreamParser context. +*/ +M4OSA_UInt8* M4_BitStreamParser_GetCurrentbitStreamPointer(void* pContext); + +/** +* M4_BitStreamParser_GetSize gets the size of the bitstream in bytes +* +* @param pContext : A pointer to the context internally used by the package +* +* @returns the size of the bitstream in bytes +*/ +M4OSA_Int32 M4_BitStreamParser_GetSize(void* pContext); + +void M4_MPEG4BitStreamParser_Init(void** pContext, void* pBitStream, M4OSA_Int32 size); + +/** +* getMpegLengthFromInteger returns a decoded size value from an encoded one (SDL) +* +* @param pContext : A pointer to the context internally used by the package +* @param val : encoded value +* +* @returns size in a human readable form +*/ + +M4OSA_Int32 M4_MPEG4BitStreamParser_GetMpegLengthFromInteger(void* pContext, M4OSA_UInt32 val); + + +/** + ************************************************************************ + * @brief Decode an MPEG4 Systems descriptor size from an encoded SDL size data. + * @note The value is read from the current bitstream location. + * @param pContext (IN/OUT) M4_BitStreamParser context. + * @return Size in a human readable form + ************************************************************************ +*/ +M4OSA_Int32 M4_MPEG4BitStreamParser_GetMpegLengthFromStream(void* pContext); + +#endif /*__M4_BITSTREAMPARSER_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4_Common.h b/libvideoeditor/vss/common/inc/M4_Common.h new file mode 100755 index 0000000..6e1d42f --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4_Common.h @@ -0,0 +1,164 @@ +/* + * 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 M4_Common.h + * @brief Common data structure between shells + * @note +************************************************************************* +*/ +#ifndef __M4_COMMON_H__ +#define __M4_COMMON_H__ + +#include "M4OSA_Types.h" + +/** + ************************************************************************ + * structure _parameterSet + * @brief This structure defines the structure of parameters for the avc + * decoder specific info + * @note + ************************************************************************ +*/ +typedef struct _parameterSet +{ + M4OSA_UInt16 m_length; /* Number of items*/ + M4OSA_UInt8* m_pParameterSetUnit; /* Array of items*/ +} ParameterSet ; + +/** + ************************************************************************ + * structure _avcSpecificInfo + * @brief This structure defines the structure of specific info for the avc decoder + * @note + ************************************************************************ +*/ +typedef struct _avcSpecificInfo +{ + M4OSA_UInt8 m_nalUnitLength; /* length in bytes of the NALUnitLength + field in a AVC sample */ + M4OSA_UInt8 m_numOfSequenceParameterSets; /* Number of sequence parameter sets*/ + M4OSA_UInt8 m_numOfPictureParameterSets; /* Number of picture parameter sets*/ + ParameterSet *m_pSequenceParameterSet; /* Sequence parameter sets array*/ + ParameterSet *m_pPictureParameterSet; /* Picture parameter sets array*/ +} AvcSpecificInfo ; + +/** + ************************************************************************ + * structure M4_SynthesisAudioInfo + * @brief This structure contains specific pointers used for synthesis audio format + ************************************************************************ +*/ +typedef struct _synthesisAudioInfo +{ + M4OSA_Void* m_pInputBuf; + M4OSA_Void* m_pInputInfo; + M4OSA_UInt16 m_uiNbSubFramePerStep; + M4OSA_UInt32 m_uiUsedBytes; +} M4_SynthesisAudioInfo; + + +/* + ************************************************************************ + * enum M4_AACDownsamplingMode + * @brief This enum states modes for Down sampling + ************************************************************************ +*/ +typedef enum +{ + AAC_kDS_OFF = 0, /**< No Down sampling */ + AAC_kDS_BY_2 = 1, /**< Down sampling by 2 + Profile = AAC : + output sampling rate = aac_samp_freq/2 + Profile = HE_AAC and input is AAC: + Output sampling rate = aac_samp_freq.(No downsamping). + Profile = HE_AAC and input is HE_AAC: + Output sampling rate = aac_samp_freq (Downsampling + occurs in SBR tool). + case profile = HE_AAC_v2 : + Not Supported */ + AAC_kDS_BY_3 = 2, /**< Down sampling by 3 - only for AAC profile */ + AAC_kDS_BY_4 = 3, /**< Down sampling by 4 - only for AAC profile */ + AAC_kDS_BY_8 = 4 /**< Down sampling by 8 - only for AAC profile */ + +} M4_AACDownsamplingMode; + + +/* + ************************************************************************ + * enum M4_AACOutputMode + * @brief This enum defines the output mode + ************************************************************************ +*/ +typedef enum +{ + AAC_kMono = 0, /**< Output is Mono */ + AAC_kStereo = 1 /**< Output is Stereo */ +} M4_AACOutputMode; + + +/* + ************************************************************************ + * enum M4_AACDecProfile + * @brief This enum defines the AAC decoder profile + ************************************************************************ +*/ +typedef enum +{ + AAC_kAAC = 0, /**< AAC profile (only AAC LC object are supported) */ + AAC_kHE_AAC = 1, /**< HE AAC or AAC+ profile (SBR in LP Mode) */ + AAC_kHE_AAC_v2 = 2 /**< HE AAC v2 or Enhanced AAC+ profile (SBR Tool in HQ Mode) */ +} M4_AACDecProfile; + + +/** + ************************************************************************ + * structure M4_AacDecoderConfig + * @brief This structure defines specific settings according to + * the user requirements + ************************************************************************ +*/ +typedef struct +{ + M4_AACDecProfile m_AACDecoderProfile; + M4_AACDownsamplingMode m_DownSamplingMode; + M4_AACOutputMode m_OutputMode; + +} M4_AacDecoderConfig; + + +/** + ************************************************************************ + * structure M4READER_AudioSbrUserdata + * @brief This structure defines the user's data needed to decode the + * AACplus stream + * @note The field m_pFirstAU is used in case of local files and + * the field m_bIsSbrEnabled is used in streaming case. + ************************************************************************ +*/ +typedef struct +{ + M4OSA_Void* m_pFirstAU; /**< The first AU from where SBR data are + extracted (local file case)*/ + M4OSA_Bool m_bIsSbrEnabled; /**< A boolean that indicates if the stream is + AACplus (streaming case)*/ + M4_AacDecoderConfig* m_pAacDecoderUserConfig;/**< Decoder specific user setting */ + +} M4READER_AudioSbrUserdata; + +#endif /* __M4_COMMON_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4_Logo.h b/libvideoeditor/vss/common/inc/M4_Logo.h new file mode 100755 index 0000000..79a2e1c --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4_Logo.h @@ -0,0 +1,30 @@ +/* + * 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 M4_Logo_h +#define M4_Logo_h +#ifdef __cplusplus +extern "C" +{ +#endif +extern const unsigned char logo[]; +extern const int logo_width; +extern const int logo_height; +#ifdef __cplusplus +} +#endif +#endif + diff --git a/libvideoeditor/vss/common/inc/M4_Utils.h b/libvideoeditor/vss/common/inc/M4_Utils.h new file mode 100755 index 0000000..ec4bfb7 --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4_Utils.h @@ -0,0 +1,50 @@ +/* + * 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 M4_Utils.h + * @brief Utilities + * @note This file defines utility macros +************************************************************************* +*/ +#ifndef __M4_UTILS_H__ +#define __M4_UTILS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* M4_MediaTime definition + This type is used internally by some shell components */ +#include "M4OSA_Types.h" +typedef M4OSA_Double M4_MediaTime; + +/* GET_MEMORY32 macro definition + This macro is used by the 3GP reader*/ +#ifdef __BIG_ENDIAN +#define GET_MEMORY32(x) (x) +#else +#define GET_MEMORY32(x) ( (((x)&0xff)<<24) | (((x)&0xff00)<<8) |\ + (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24) ) +#endif /*__BIG_ENDIAN*/ + +#ifdef __cplusplus +} +#endif + +#endif /* __M4_UTILS_H__*/ + diff --git a/libvideoeditor/vss/common/inc/M4_VideoEditingCommon.h b/libvideoeditor/vss/common/inc/M4_VideoEditingCommon.h new file mode 100755 index 0000000..3bac61f --- /dev/null +++ b/libvideoeditor/vss/common/inc/M4_VideoEditingCommon.h @@ -0,0 +1,378 @@ +/* + * 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 M4_VideoEditingCommon.h + * @brief Video Editing (VSS3GPP, MCS, PTO3GPP) common definitions + * @note + ****************************************************************************** +*/ + +#ifndef __M4_VIDEOEDITINGCOMMON_H__ +#define __M4_VIDEOEDITINGCOMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Version */ +/* CHANGE_VERSION_HERE */ +#define M4VIDEOEDITING_VERSION_MAJOR 3 +#define M4VIDEOEDITING_VERSION_MINOR 1 +#define M4VIDEOEDITING_VERSION_REVISION 0 + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_FileType + * @brief This enum defines the file format type to be used + ****************************************************************************** +*/ +typedef enum { + M4VIDEOEDITING_kFileType_3GPP = 0, /**< 3GPP file media type : input & output */ + M4VIDEOEDITING_kFileType_MP4 = 1, /**< MP4 file media type : input */ + M4VIDEOEDITING_kFileType_AMR = 2, /**< AMR file media type : input & output */ + M4VIDEOEDITING_kFileType_MP3 = 3, /**< MP3 file media type : input */ + M4VIDEOEDITING_kFileType_PCM = 4, /**< PCM RAW file media type : input RC */ + M4VIDEOEDITING_kFileType_JPG = 5, /**< STILL PICTURE FEATURE: JPG file media + type : input AND OUTPUT */ + M4VIDEOEDITING_kFileType_BMP = 6, /**< STILL PICTURE FEATURE: BMP file media + type : input only */ + M4VIDEOEDITING_kFileType_GIF = 7, /**< STILL PICTURE FEATURE: GIF file media + type : input only */ + M4VIDEOEDITING_kFileType_PNG = 8, /**< STILL PICTURE FEATURE: PNG file media + type : input only */ + M4VIDEOEDITING_kFileType_ARGB8888 = 9, /**< STILL PICTURE FEATURE: ARGB8888 file + media type : input only */ + + M4VIDEOEDITING_kFileType_Unsupported = 255 /**< Unsupported file media type */ +} M4VIDEOEDITING_FileType; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_VideoFormat + * @brief This enum defines the avalaible video compression formats. + ****************************************************************************** +*/ +typedef enum +{ + M4VIDEOEDITING_kNoneVideo = 0, /**< Video not present */ + M4VIDEOEDITING_kH263 = 1, /**< H263 video */ + M4VIDEOEDITING_kMPEG4 = 2, /**< MPEG-4 video */ + M4VIDEOEDITING_kMPEG4_EMP = 3, /**< MPEG-4 video with support for EMP + (hsr=15, vsr=15, err=0, Iperiod=15, + NO_M4V, NO_AC_PRED) */ + M4VIDEOEDITING_kH264 = 4, /**< H264 video */ + M4VIDEOEDITING_kNullVideo = 254, /**< Do not care video type, use NULL encoder */ + M4VIDEOEDITING_kUnsupportedVideo = 255 /**< Unsupported video stream type */ +} M4VIDEOEDITING_VideoFormat; + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_AudioFormat + * @brief This enum defines the avalaible audio format. + * @note HE_AAC, HE_AAC_v2 and MP3 can not be used for the output audio format + ****************************************************************************** +*/ +typedef enum { + M4VIDEOEDITING_kNoneAudio = 0, /**< Audio not present */ + M4VIDEOEDITING_kAMR_NB = 1, /**< AMR Narrow Band audio */ + M4VIDEOEDITING_kAAC = 2, /**< AAC audio */ + M4VIDEOEDITING_kAACplus = 3, /**< AAC+ audio */ + M4VIDEOEDITING_keAACplus = 4, /**< Enhanced AAC+ audio */ + M4VIDEOEDITING_kMP3 = 5, /**< MP3 audio */ + M4VIDEOEDITING_kEVRC = 6, /**< EVRC audio */ + M4VIDEOEDITING_kPCM = 7, /**< PCM audio */ + M4VIDEOEDITING_kNullAudio = 254, /**< Do not care audio type, use NULL encoder */ + M4VIDEOEDITING_kUnsupportedAudio = 255 /**< Unsupported audio stream type */ +} M4VIDEOEDITING_AudioFormat; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_VideoProfileAndLevel + * @brief This enum defines the video profile and level for MPEG-4 and H263 streams. + ****************************************************************************** +*/ +typedef enum +{ + M4VIDEOEDITING_kMPEG4_SP_Level_0 = 0, + M4VIDEOEDITING_kMPEG4_SP_Level_0b = 1, + M4VIDEOEDITING_kMPEG4_SP_Level_1 = 2, + M4VIDEOEDITING_kMPEG4_SP_Level_2 = 3, + M4VIDEOEDITING_kMPEG4_SP_Level_3 = 4, + M4VIDEOEDITING_kH263_Profile_0_Level_10 = 5, + M4VIDEOEDITING_kH263_Profile_0_Level_20 = 6, + M4VIDEOEDITING_kH263_Profile_0_Level_30 = 7, + M4VIDEOEDITING_kH263_Profile_0_Level_40 = 8, + M4VIDEOEDITING_kH263_Profile_0_Level_45 = 9, + M4VIDEOEDITING_kMPEG4_SP_Level_4a = 10, + M4VIDEOEDITING_kMPEG4_SP_Level_5 = 11, + M4VIDEOEDITING_kH264_Profile_0_Level_1 = 12, + M4VIDEOEDITING_kH264_Profile_0_Level_1b = 13, + M4VIDEOEDITING_kH264_Profile_0_Level_1_1 = 14, + M4VIDEOEDITING_kH264_Profile_0_Level_1_2 = 15, + M4VIDEOEDITING_kH264_Profile_0_Level_1_3 = 16, + M4VIDEOEDITING_kH264_Profile_0_Level_2 = 17, + M4VIDEOEDITING_kH264_Profile_0_Level_2_1 = 18, + M4VIDEOEDITING_kH264_Profile_0_Level_2_2 = 19, + M4VIDEOEDITING_kH264_Profile_0_Level_3 = 20, + M4VIDEOEDITING_kH264_Profile_0_Level_3_1 = 21, + M4VIDEOEDITING_kH264_Profile_0_Level_3_2 = 22, + M4VIDEOEDITING_kH264_Profile_0_Level_4 = 23, + M4VIDEOEDITING_kH264_Profile_0_Level_4_1 = 24, + M4VIDEOEDITING_kH264_Profile_0_Level_4_2 = 25, + M4VIDEOEDITING_kH264_Profile_0_Level_5 = 26, + M4VIDEOEDITING_kH264_Profile_0_Level_5_1 = 27, + M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range = 255 +} M4VIDEOEDITING_VideoProfileAndLevel; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_VideoFrameSize + * @brief This enum defines the available output frame sizes. + ****************************************************************************** +*/ +typedef enum +{ + M4VIDEOEDITING_kSQCIF=0, /**< SQCIF 128x96 */ + M4VIDEOEDITING_kQQVGA, /**< QQVGA 160x120 */ + M4VIDEOEDITING_kQCIF, /**< QCIF 176x144 */ + M4VIDEOEDITING_kQVGA, /**< QVGA 320x240 */ + M4VIDEOEDITING_kCIF, /**< CIF 352x288 */ + M4VIDEOEDITING_kVGA, +/* +PR LV5807 */ /**< VGA 640x480 */ + M4VIDEOEDITING_kWVGA, /**< WVGA 800x480 */ + M4VIDEOEDITING_kNTSC, +/* -PR LV5807 */ /**< NTSC 720x480 */ + +/* +CR Google */ + M4VIDEOEDITING_k640_360, /**< 640x360 */ + M4VIDEOEDITING_k854_480, /**< 854x480 */ + M4VIDEOEDITING_kHD1280, /**< 720p 1280x720 */ + M4VIDEOEDITING_kHD1080, /**< 720p 1080x720 */ + M4VIDEOEDITING_kHD960 /**< 720p 960x720 */ + +/* -CR Google */ + +} M4VIDEOEDITING_VideoFrameSize; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_Videoframerate + * @brief This enum defines the available video framerates. + ****************************************************************************** +*/ +typedef enum +{ + M4VIDEOEDITING_k5_FPS = 0, + M4VIDEOEDITING_k7_5_FPS, + M4VIDEOEDITING_k10_FPS, + M4VIDEOEDITING_k12_5_FPS, + M4VIDEOEDITING_k15_FPS, + M4VIDEOEDITING_k20_FPS, + M4VIDEOEDITING_k25_FPS, + M4VIDEOEDITING_k30_FPS +} M4VIDEOEDITING_VideoFramerate; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_AudioSamplingFrequency + * @brief This enum defines the available output audio sampling frequencies + * @note 8 kHz is the only supported frequency for AMR-NB output + * @note 16 kHz is the only supported frequency for AAC output + * @note The recommended practice is to use the Default value when setting the encoding parameters + ****************************************************************************** +*/ +typedef enum { + M4VIDEOEDITING_kDefault_ASF = 0, /**< Default Audio Sampling Frequency for selected + Audio output format */ + M4VIDEOEDITING_k8000_ASF = 8000, /**< Note: Default audio Sampling Frequency for + AMR-NB output */ + M4VIDEOEDITING_k11025_ASF = 11025, + M4VIDEOEDITING_k12000_ASF = 12000, + M4VIDEOEDITING_k16000_ASF = 16000, /**< Note: Default audio Sampling Frequency + for AAC output */ + M4VIDEOEDITING_k22050_ASF = 22050, + M4VIDEOEDITING_k24000_ASF = 24000, + M4VIDEOEDITING_k32000_ASF = 32000, + M4VIDEOEDITING_k44100_ASF = 44100, + M4VIDEOEDITING_k48000_ASF = 48000 + +} M4VIDEOEDITING_AudioSamplingFrequency; + + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_Bitrate + * @brief This enum defines the available audio or video bitrates. + ****************************************************************************** +*/ +typedef enum +{ + M4VIDEOEDITING_kVARIABLE_KBPS = -1, /* no regulation */ + M4VIDEOEDITING_kUndefinedBitrate = 0, /* undefined */ + M4VIDEOEDITING_k8_KBPS = 8000, + M4VIDEOEDITING_k9_2_KBPS = 9200, /* evrc only */ + M4VIDEOEDITING_k12_2_KBPS = 12200, /* amr only */ + M4VIDEOEDITING_k16_KBPS = 16000, + M4VIDEOEDITING_k24_KBPS = 24000, + M4VIDEOEDITING_k32_KBPS = 32000, + M4VIDEOEDITING_k40_KBPS = 40000, + M4VIDEOEDITING_k48_KBPS = 48000, + M4VIDEOEDITING_k56_KBPS = 56000, + M4VIDEOEDITING_k64_KBPS = 64000, + M4VIDEOEDITING_k80_KBPS = 80000, + M4VIDEOEDITING_k96_KBPS = 96000, + M4VIDEOEDITING_k112_KBPS = 112000, + M4VIDEOEDITING_k128_KBPS = 128000, + M4VIDEOEDITING_k160_KBPS = 160000, + M4VIDEOEDITING_k192_KBPS = 192000, + M4VIDEOEDITING_k224_KBPS = 224000, + M4VIDEOEDITING_k256_KBPS = 256000, + M4VIDEOEDITING_k288_KBPS = 288000, + M4VIDEOEDITING_k320_KBPS = 320000, + M4VIDEOEDITING_k384_KBPS = 384000, + M4VIDEOEDITING_k512_KBPS = 512000, + M4VIDEOEDITING_k800_KBPS = 800000, +/*+ New Encoder bitrates */ + M4VIDEOEDITING_k2_MBPS = 2000000, + M4VIDEOEDITING_k5_MBPS = 5000000, + M4VIDEOEDITING_k8_MBPS = 8000000, +/*- New Encoder bitrates */ +} M4VIDEOEDITING_Bitrate; + + +/** + ****************************************************************************** + * structure M4VIDEOEDITING_FtypBox + * @brief Information to build the 'ftyp' atom + ****************************************************************************** +*/ +#define M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS 10 +typedef struct +{ + /* All brand fields are actually char[4] stored in big-endian integer format */ + + M4OSA_UInt32 major_brand; /* generally '3gp4' */ + M4OSA_UInt32 minor_version; /* generally '0000' or 'x.x ' */ + M4OSA_UInt32 nbCompatibleBrands; /* number of compatible brands */ + M4OSA_UInt32 compatible_brands[M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS]; /* array of + max compatible brands */ + +} M4VIDEOEDITING_FtypBox; + +/* Some useful brands */ +#define M4VIDEOEDITING_BRAND_0000 0x00000000 +#define M4VIDEOEDITING_BRAND_3G2A 0x33673261 +#define M4VIDEOEDITING_BRAND_3GP4 0x33677034 +#define M4VIDEOEDITING_BRAND_3GP5 0x33677035 +#define M4VIDEOEDITING_BRAND_3GP6 0x33677036 +#define M4VIDEOEDITING_BRAND_AVC1 0x61766331 +#define M4VIDEOEDITING_BRAND_EMP 0x656D7020 +#define M4VIDEOEDITING_BRAND_ISOM 0x69736F6D +#define M4VIDEOEDITING_BRAND_MP41 0x6D703431 +#define M4VIDEOEDITING_BRAND_MP42 0x6D703432 +#define M4VIDEOEDITING_BRAND_VFJ1 0x76666A31 + +/** + ****************************************************************************** + * enum M4VIDEOEDITING_ClipProperties + * @brief This structure gathers the information related to an input file + ****************************************************************************** +*/ +typedef struct { + + /** + * Common */ + M4OSA_Bool bAnalysed; /**< Flag to know if the file has + been already analysed or not */ + M4OSA_UInt8 Version[3]; /**< Version of the libraries used to + perform the clip analysis */ + M4OSA_UInt32 uiClipDuration; /**< Clip duration (in ms) */ + M4VIDEOEDITING_FileType FileType; /**< .3gp, .amr, .mp3 */ + M4VIDEOEDITING_FtypBox ftyp; /**< 3gp 'ftyp' atom, major_brand = + 0 if not used */ + + /** + * Video */ + M4VIDEOEDITING_VideoFormat VideoStreamType; /**< Format of the video stream */ + M4OSA_UInt32 uiClipVideoDuration; /**< Video track duration (in ms) */ + M4OSA_UInt32 uiVideoBitrate; /**< Video average bitrate (in bps)*/ + M4OSA_UInt32 uiVideoMaxAuSize; /**< Maximum Access Unit size of the + video stream */ + M4OSA_UInt32 uiVideoWidth; /**< Video frame width */ + M4OSA_UInt32 uiVideoHeight; /**< Video frame height */ + M4OSA_UInt32 uiVideoTimeScale; /**< Video time scale */ + M4OSA_Float fAverageFrameRate; /**< Average frame rate of the video + stream */ + M4VIDEOEDITING_VideoProfileAndLevel ProfileAndLevel; /**< Supported MPEG4 and H263 + profiles and levels */ + M4OSA_UInt8 uiH263level; /**< H263 level (from core decoder)*/ + M4OSA_UInt8 uiVideoProfile; /**< H263 or MPEG-4 profile + (from core decoder) */ + M4OSA_Bool bMPEG4dataPartition; /**< MPEG-4 uses data partitioning */ + M4OSA_Bool bMPEG4rvlc; /**< MPEG-4 uses RVLC tool */ + M4OSA_Bool bMPEG4resynchMarker; /**< MPEG-4 stream uses Resynch + Marker */ + + /** + * Audio */ + M4VIDEOEDITING_AudioFormat AudioStreamType; /**< Format of the audio stream */ + M4OSA_UInt32 uiClipAudioDuration; /**< Audio track duration (in ms) */ + M4OSA_UInt32 uiAudioBitrate; /**< Audio average bitrate (in bps) */ + M4OSA_UInt32 uiAudioMaxAuSize; /**< Maximum Access Unit size of the + audio stream */ + M4OSA_UInt32 uiNbChannels; /**< Number of channels + (1=mono, 2=stereo) */ + M4OSA_UInt32 uiSamplingFrequency; /**< Sampling audio frequency + (8000 for amr, 16000 or more for aac) */ + M4OSA_UInt32 uiExtendedSamplingFrequency; /**< Extended frequency for + AAC+, eAAC+ streams */ + M4OSA_UInt32 uiDecodedPcmSize; /**< Size of the decoded PCM data */ + + /** + * Video editing compatibility chart */ + M4OSA_Bool bVideoIsEditable; /**< Video stream can be decoded and + re-encoded */ + M4OSA_Bool bAudioIsEditable; /**< Audio stream can be decoded and + re-encoded */ + M4OSA_Bool bVideoIsCompatibleWithMasterClip; /**< Video properties match reference + clip properties */ + M4OSA_Bool bAudioIsCompatibleWithMasterClip; /**< Audio properties match reference + clip properties */ + + /** + * Still Picture */ + M4OSA_UInt32 uiStillPicWidth; /**< Image width */ + M4OSA_UInt32 uiStillPicHeight; /**< Image height */ + M4OSA_UInt32 uiClipAudioVolumePercentage; + +} M4VIDEOEDITING_ClipProperties; + + +#ifdef __cplusplus + } +#endif + +#endif /* __M4_VIDEOEDITINGCOMMON_H__ */ + diff --git a/libvideoeditor/vss/common/inc/MonoTo2I_16.h b/libvideoeditor/vss/common/inc/MonoTo2I_16.h new file mode 100755 index 0000000..386b353 --- /dev/null +++ b/libvideoeditor/vss/common/inc/MonoTo2I_16.h @@ -0,0 +1,31 @@ +/* + * 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 _MONOTO2I_16_H_ +#define _MONOTO2I_16_H_ + + +void MonoTo2I_16( const short *src, + short *dst, + short n); + +/**********************************************************************************/ + +#endif /* _MONOTO2I_16_H_ */ + +/**********************************************************************************/ + diff --git a/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches.h b/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches.h new file mode 100755 index 0000000..46a7efc --- /dev/null +++ b/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches.h @@ -0,0 +1,27 @@ +/* + * 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 NXPSW_COMPILERSWITCHES_H +#define NXPSW_COMPILERSWITCHES_H + +/* ----- Main features ----- */ +#include "NXPSW_CompilerSwitches_MCS.h" /* Transcoder */ + +/* ----- Add-ons ----- */ + +#endif /* NXPSW_COMPILERSWITCHES_H */ + diff --git a/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches_MCS.h b/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches_MCS.h new file mode 100755 index 0000000..028cd27 --- /dev/null +++ b/libvideoeditor/vss/common/inc/NXPSW_CompilerSwitches_MCS.h @@ -0,0 +1,132 @@ +/* + * 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 NXPSW_COMPILERSWITCHES_MCS_H +#define NXPSW_COMPILERSWITCHES_MCS_H + + /***********/ + /* READERS */ + /***********/ + +/* ----- AMR reader support ----- */ +#define M4VSS_SUPPORT_READER_AMR /**< [default] Support .amr files */ + +/* ----- 3GPP reader support ----- */ +#define M4VSS_SUPPORT_READER_3GP /**< [default] Support .mp4, .3gp files */ + + +/* ----- MP3 reader support ----- */ +#define M4VSS_SUPPORT_READER_MP3 /**< [default] Support .mp3 files */ + +/* ----- RAW reader support ----- */ +#define M4VSS_SUPPORT_READER_PCM /**< [default] Support .pcm files */ + + + /************/ + /* DECODERS */ + /************/ + +/* ----- AMR NB decoder support ----- */ +#define M4VSS_SUPPORT_AUDEC_AMRNB /**< [default] Support AMR NB streams */ + +/* ----- AAC decoder support ----- */ +#define M4VSS_SUPPORT_AUDEC_AAC /**< [default] Support AAC, AAC+ and eAAC+ streams */ + +/* ----- MP4/H263 video decoder support ----- */ +#define M4VSS_SUPPORT_VIDEC_3GP /**< [default] Support mpeg4 and H263 decoders */ + +#ifdef M4VSS_SUPPORT_VIDEC_3GP +#define GET_DECODER_CONFIG_INFO +#endif + +#define M4VSS_SUPPORT_VIDEO_AVC /**< [default] Support H264 decoders */ + +/* ----- MP3 decoder support----- */ +#define M4VSS_SUPPORT_AUDEC_MP3 /**< [default] Support MP3 decoders */ + + +/* ----- NULL decoder support----- */ +#define M4VSS_SUPPORT_AUDEC_NULL /** [default] Support PCM reading */ + + + /***********/ + /* WRITERS */ + /***********/ + +/* ----- 3gp writer ----- */ +#define M4VSS_SUPPORT_WRITER_3GPP /**< [default] support encapsulating in 3gp format + {amr,aac} x {mpeg4,h263} */ + + + + + + /************/ + /* ENCODERS */ + /************/ + +/* ----- mpeg4 & h263 encoder ----- */ +#define M4VSS_SUPPORT_ENCODER_MPEG4 /**< [default] support encoding in mpeg4 and + h263 format {yuv,rgb} */ + +/* ----- h264 encoder ----- */ +#define M4VSS_SUPPORT_ENCODER_AVC + +/* ----- amr encoder ----- */ +#define M4VSS_SUPPORT_ENCODER_AMR /**< [default] support encoding in amr 12.2 format {amr,wav} */ + +/* ----- aac encoder ----- */ +#define M4VSS_SUPPORT_ENCODER_AAC /**< [default] support encoding in aac format {amr,wav} */ + + +/* ----- mp3 encoder ----- */ +#define M4VSS_SUPPORT_ENCODER_MP3 /**< [default] support encoding in mp3 format {mp3} */ + + /************/ + /* FEATURES */ + /************/ + +/* ----- VSS3GPP & xVSS ----- */ +#define M4VSS_SUPPORT_EXTENDED_FEATURES /**< [default] if defined, implementation is xVSS else + it is VSS3GPP */ + +/* ----- SPS ----- */ +#ifdef M4VSS_SUPPORT_EXTENDED_FEATURES + +//#define M4SPS_GIF_NOT_SUPPORTED /**< [option] do not support GIF format in still picture api */ +//#define M4SPS_JPEG_NOT_SUPPORTED /**< [option] do not support JPEG format in still picture api */ +//#define M4SPS_PNG_NOT_SUPPORTED /**< [option] do not support PNG format in still picture api */ +#define M4SPS_WBMP_NOT_SUPPORTED /**< [option] do not support WBMP format in still picture api */ +#define M4SPS_BGR565_COLOR_OUTPUT /**< [option] output in still picture api is BGR565 + (default = BGR24) */ + +#else + +#define M4SPS_GIF_NOT_SUPPORTED /**< [option] do not support GIF format in still picture api */ +//#define M4SPS_JPEG_NOT_SUPPORTED /**< [option] do not support JPEG format in still picture api */ +#define M4SPS_PNG_NOT_SUPPORTED /**< [option] do not support PNG format in still picture api */ +#define M4SPS_WBMP_NOT_SUPPORTED /**< [option] do not support WBMP format in still picture api */ +//#define M4SPS_BGR565_COLOR_OUTPUT /**< [option] output in still picture api is BGR565 +// (default = BGR24) */ + +#endif + +#define M4VSS_ENABLE_EXTERNAL_DECODERS + +#define M4VSS_SUPPORT_OMX_CODECS + +#endif /* NXPSW_COMPILERSWITCHES_MCS_H */ + diff --git a/libvideoeditor/vss/common/inc/SSRC.h b/libvideoeditor/vss/common/inc/SSRC.h new file mode 100755 index 0000000..16ca3f6 --- /dev/null +++ b/libvideoeditor/vss/common/inc/SSRC.h @@ -0,0 +1,297 @@ +/* + * 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. + */ + +/****************************************************************************************/ +/* */ +/* Project:: */ +/* %name: SSRC.h % */ +/* */ +/****************************************************************************************/ + +/* + The input and output blocks of the SRC are by default blocks of 40 ms. This means that + the following default block sizes are used: + + Fs Default Block size + ----- ---------- + 8000 320 + 11025 441 + 12000 480 + 16000 640 + 22050 882 + 24000 960 + 32000 1280 + 44100 1764 + 48000 1920 + + An API is provided to change the default block size into any multiple of the minimal + block size. + + All the sampling rates above are supported as input and as output sampling rate +*/ + +#ifndef __SSRC_H__ +#define __SSRC_H__ + +/**************************************************************************************** + INCLUDES +*****************************************************************************************/ + +#include "LVM_Types.h" + +/**************************************************************************************** + DEFINITIONS +*****************************************************************************************/ + +#define SSRC_INSTANCE_SIZE 548 +#define SSRC_INSTANCE_ALIGNMENT 4 +#define SSRC_SCRATCH_ALIGNMENT 4 + +/**************************************************************************************** + TYPE DEFINITIONS +*****************************************************************************************/ + +/* Status return values */ +typedef enum +{ + SSRC_OK = 0, /* Successful return from a routine */ + SSRC_INVALID_FS = 1, /* The input or the output sampling rate is + invalid */ + SSRC_INVALID_NR_CHANNELS = 2, /* The number of channels is not equal to mono + or stereo */ + SSRC_NULL_POINTER = 3, /* One of the input pointers is NULL */ + SSRC_WRONG_NR_SAMPLES = 4, /* Invalid number of samples */ + SSRC_ALLINGMENT_ERROR = 5, /* The instance memory or the scratch memory + is not alligned */ + SSRC_INVALID_MODE = 6, /* A wrong value has been used for the mode + parameter */ + SSRC_INVALID_VALUE = 7, /* An invalid (out of range) value has been + used for one of the parameters */ + LVXXX_RETURNSTATUS_DUMMY = LVM_MAXENUM +} SSRC_ReturnStatus_en; + +/* Instance memory */ +typedef struct +{ + LVM_INT32 Storage [ SSRC_INSTANCE_SIZE/4 ]; +} SSRC_Instance_t; + +/* Scratch memory */ +typedef LVM_INT32 SSRC_Scratch_t; + +/* Nuber of samples mode */ +typedef enum +{ + SSRC_NR_SAMPLES_DEFAULT = 0, + SSRC_NR_SAMPLES_MIN = 1, + SSRC_NR_SAMPLES_DUMMY = LVM_MAXENUM +} SSRC_NR_SAMPLES_MODE_en; + +/* Instance parameters */ +typedef struct +{ + LVM_Fs_en SSRC_Fs_In; + LVM_Fs_en SSRC_Fs_Out; + LVM_Format_en SSRC_NrOfChannels; + LVM_INT16 NrSamplesIn; + LVM_INT16 NrSamplesOut; +} SSRC_Params_t; + + +/**************************************************************************************** + FUNCTION PROTOTYPES +*****************************************************************************************/ + + +/****************************************************************************************/ +/* */ +/* FUNCTION: SSRC_GetNrSamples */ +/* */ +/* DESCRIPTION: */ +/* This function retrieves the number of samples (or sample pairs for stereo) to be */ +/* used as input and as output of the SSRC module. */ +/* */ +/* PARAMETERS: */ +/* Mode There are two modes: */ +/* - SSRC_NR_SAMPELS_DEFAULT. In this mode, the function */ +/* will return the number of samples for 40 ms blocks */ +/* - SSRC_NR_SAMPELS_MIN will return the minimal number */ +/* of samples that is supported for this conversion */ +/* ratio. Each integer multiple of this ratio will */ +/* be accepted by the SSRC_Init function */ +/* */ +/* pSSRC_Params pointer to the instance parameters */ +/* */ +/* RETURNS: */ +/* SSRC_OK Succeeded */ +/* SSRC_INVALID_FS When the requested input or output sampling rates */ +/* are invalid. */ +/* SSRC_INVALID_NR_CHANNELS When the channel format is not equal to LVM_MONO */ +/* or LVM_STEREO */ +/* SSRC_NULL_POINTER When pSSRC_Params is a NULL pointer */ +/* SSRC_INVALID_MODE When Mode is not a valid setting */ +/* */ +/* */ +/* NOTES: */ +/* */ +/****************************************************************************************/ + +SSRC_ReturnStatus_en SSRC_GetNrSamples( SSRC_NR_SAMPLES_MODE_en Mode, + SSRC_Params_t* pSSRC_Params ); + + +/****************************************************************************************/ +/* */ +/* FUNCTION: SSRC_GetScratchSize */ +/* */ +/* DESCRIPTION: */ +/* This function retrieves the scratch size for a given conversion ratio and */ +/* for given buffer sizes at the input and at the output */ +/* */ +/* PARAMETERS: */ +/* pSSRC_Params pointer to the instance parameters */ +/* pScratchSize pointer to the scratch size. The SSRC_GetScratchSize */ +/* function will fill in the correct value (in bytes). */ +/* */ +/* RETURNS: */ +/* SSRC_OK when the function call succeeds */ +/* SSRC_INVALID_FS When the requested input or output sampling rates */ +/* are invalid. */ +/* SSRC_INVALID_NR_CHANNELS When the channel format is not equal to LVM_MONO */ +/* or LVM_STEREO */ +/* SSRC_NULL_POINTER When any of the input pointers is a NULL pointer */ +/* SSRC_WRONG_NR_SAMPLES When the number of samples on the input or on the output */ +/* are incorrect */ +/* */ +/* NOTES: */ +/* */ +/****************************************************************************************/ + +SSRC_ReturnStatus_en SSRC_GetScratchSize( SSRC_Params_t* pSSRC_Params, + LVM_INT32* pScratchSize ); + + +/****************************************************************************************/ +/* */ +/* FUNCTION: SSRC_Init */ +/* */ +/* DESCRIPTION: */ +/* This function is used to initialize the SSRC module instance. */ +/* */ +/* PARAMETERS: */ +/* pSSRC_Instance Instance pointer */ +/* */ +/* pSSRC_Scratch pointer to the scratch memory */ +/* pSSRC_Params pointer to the instance parameters */ +/* pInputInScratch, pointer to a location in the scratch memory that can be */ +/* used to store the input samples (e.g. to save memory) */ +/* pOutputInScratch pointer to a location in the scratch memory that can be */ +/* used to store the output samples (e.g. to save memory) */ +/* */ +/* RETURNS: */ +/* SSRC_OK Succeeded */ +/* SSRC_INVALID_FS When the requested input or output sampling rates */ +/* are invalid. */ +/* SSRC_INVALID_NR_CHANNELS When the channel format is not equal to LVM_MONO */ +/* or LVM_STEREO */ +/* SSRC_WRONG_NR_SAMPLES When the number of samples on the input or the output */ +/* are incorrect */ +/* SSRC_NULL_POINTER When any of the input pointers is a NULL pointer */ +/* SSRC_ALLINGMENT_ERROR When the instance memory or the scratch memory is not */ +/* 4 bytes alligned */ +/* */ +/* NOTES: */ +/* 1. The init function will clear the internal state */ +/* */ +/****************************************************************************************/ + +SSRC_ReturnStatus_en SSRC_Init( SSRC_Instance_t* pSSRC_Instance, + SSRC_Scratch_t* pSSRC_Scratch, + SSRC_Params_t* pSSRC_Params, + LVM_INT16** ppInputInScratch, + LVM_INT16** ppOutputInScratch); + + +/****************************************************************************************/ +/* */ +/* FUNCTION: SSRC_SetGains */ +/* */ +/* DESCRIPTION: */ +/* This function sets headroom gain and the post gain of the SSRC */ +/* */ +/* PARAMETERS: */ +/* bHeadroomGainEnabled parameter to enable or disable the headroom gain of the */ +/* SSRC. The default value is LVM_MODE_ON. LVM_MODE_OFF */ +/* can be used in case it can be guaranteed that the input */ +/* level is below -6dB in all cases (the default headroom */ +/* is -6 dB) */ +/* */ +/* bOutputGainEnabled parameter to enable or disable the output gain. The */ +/* default value is LVM_MODE_ON */ +/* */ +/* OutputGain the value of the output gain. The output gain is a linear */ +/* gain value. 0x7FFF is equal to +6 dB and 0x0000 corresponds */ +/* to -inf dB. By default, a 3dB gain is applied, resulting */ +/* in an overall gain of -3dB (-6dB headroom + 3dB output gain)*/ +/* */ +/* RETURNS: */ +/* SSRC_OK Succeeded */ +/* SSRC_NULL_POINTER When pSSRC_Instance is a NULL pointer */ +/* SSRC_INVALID_MODE Wrong value used for the bHeadroomGainEnabled or the */ +/* bOutputGainEnabled parameters. */ +/* SSRC_INVALID_VALUE When OutputGain is out to the range [0;32767] */ +/* */ +/* NOTES: */ +/* 1. The SSRC_SetGains function is an optional function that should only be used */ +/* in rare cases. Preferably, use the default settings. */ +/* */ +/****************************************************************************************/ + +SSRC_ReturnStatus_en SSRC_SetGains( SSRC_Instance_t* pSSRC_Instance, + LVM_Mode_en bHeadroomGainEnabled, + LVM_Mode_en bOutputGainEnabled, + LVM_INT16 OutputGain ); + + +/****************************************************************************************/ +/* */ +/* FUNCTION: SSRC_Process */ +/* */ +/* DESCRIPTION: */ +/* Process function for the SSRC module. */ +/* */ +/* PARAMETERS: */ +/* pSSRC_Instance Instance pointer */ +/* pSSRC_AudioIn Pointer to the input data */ +/* pSSRC_AudioOut Pointer to the output data */ +/* */ +/* RETURNS: */ +/* SSRC_OK Succeeded */ +/* SSRC_NULL_POINTER When one of pSSRC_Instance, pSSRC_AudioIn or pSSRC_AudioOut */ +/* is NULL */ +/* */ +/* NOTES: */ +/* */ +/****************************************************************************************/ + +SSRC_ReturnStatus_en SSRC_Process( SSRC_Instance_t* pSSRC_Instance, + LVM_INT16* pSSRC_AudioIn, + LVM_INT16* pSSRC_AudioOut); + +/****************************************************************************************/ + +#endif /* __SSRC_H__ */ diff --git a/libvideoeditor/vss/common/inc/gLVAudioResampler.h b/libvideoeditor/vss/common/inc/gLVAudioResampler.h new file mode 100755 index 0000000..9d3d63f --- /dev/null +++ b/libvideoeditor/vss/common/inc/gLVAudioResampler.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. + */ + + + +#ifndef GLVAUDIORESAMPLER_H +#define GLVAUDIORESAMPLER_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef int8_t +#define int8_t signed char +#endif + +#ifndef int32_t +#define int32_t long int +#endif + +#ifndef uint32_t +#define uint32_t unsigned long int +#endif + +#ifndef int16_t +#define int16_t signed short +#endif + +#ifndef uint16_t +#define uint16_t unsigned short +#endif + +#ifndef status_t +#define status_t long int +#endif + + static const int kNumPhaseBits = 30; + // phase mask for fraction + static const uint32_t kPhaseMask = (1<<30)-1; + // multiplier to calculate fixed point phase increment + static const uint32_t kPhaseMultiplier = (1 << 30); + + static const int kNumInterpBits = 15; + + // bits to shift the phase fraction down to avoid overflow + static const int kPreInterpShift = 15; //=kNumPhaseBits - kNumInterpBits; + +typedef struct Buffer { + void* raw; + short* i16; + int8_t* i8; + long frameCount; + }Buffer; + +typedef enum src_quality { + DEFAULT=0, + LOW_QUALITY=1, + MED_QUALITY=2, + HIGH_QUALITY=3 + }src_quality; + +typedef struct LVAudioResampler +{ + + int32_t mBitDepth; + int32_t mChannelCount; + int32_t mSampleRate; + int32_t mInSampleRate; + Buffer mBuffer; + int16_t mVolume[2]; + int16_t mTargetVolume[2]; + int mFormat; + long mInputIndex; + int32_t mPhaseIncrement; + uint32_t mPhaseFraction; + int mX0L; + int mX0R; + int32_t kPreInterpShift; + int32_t kNumInterpBits; + src_quality mQuality; +}LVAudioResampler; + + +int32_t LVAudioResamplerCreate(int bitDepth, int inChannelCount, + int32_t sampleRate, int quality); +void LVAudiosetSampleRate(int32_t context,int32_t inSampleRate); +void LVAudiosetVolume(int32_t context, int16_t left, int16_t right) ; + +void LVAudioresample_LowQuality(int16_t* out, int16_t* input, long outFrameCount, int32_t context); +void LVResampler_LowQualityInit(int bitDepth, int inChannelCount, + int32_t sampleRate, int32_t context); + + +void MonoTo2I_16( const short *src, + short *dst, + short n); + +void From2iToMono_16( const short *src, + short *dst, + short n); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* GLVAUDIORESAMPLER_H */ + + diff --git a/libvideoeditor/vss/common/inc/marker.h b/libvideoeditor/vss/common/inc/marker.h new file mode 100755 index 0000000..d63ba8c --- /dev/null +++ b/libvideoeditor/vss/common/inc/marker.h @@ -0,0 +1,79 @@ +/* + * 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 MARKER_H +#define MARKER_H + +#define ADD_CODE_MARKER_FUN(m_condition) \ + if ( !(m_condition) ) \ + { \ + __asm__ volatile ( \ + ".word 0x21614062\n\t" /* '!a@b' */ \ + ".word 0x47712543\n\t" /* 'Gq%C' */ \ + ".word 0x5F5F5F43\n\t" /* '___C' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x245F5F5F" /* '$___' */ \ + ); \ + } + +#define ADD_TEXT_MARKER_FUN(m_condition) \ + if ( !(m_condition) ) \ + { \ + __asm__ volatile ( \ + ".word 0x21614062\n\t" /* '!a@b' */ \ + ".word 0x47712543\n\t" /* 'Gq%C' */ \ + ".word 0x5F5F5F54\n\t" /* '___T' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x5F5F5F5F\n\t" /* '____' */ \ + ".word 0x245F5F5F" /* '$___' */ \ + ); \ + } + +#endif |