diff options
Diffstat (limited to 'libvideoeditor/osal/inc')
30 files changed, 3587 insertions, 0 deletions
diff --git a/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h b/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h new file mode 100755 index 0000000..df0375b --- /dev/null +++ b/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h @@ -0,0 +1,86 @@ +/* + * 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_FileReader_optim.h + * @brief File reader for Symbian + * @note This file declares functions and types to read a file. + ****************************************************************************** +*/ + + + +#ifndef M4OSA_FILEREADER_OPTIM_H +#define M4OSA_FILEREADER_OPTIM_H + +#define M4OSA_READER_OPTIM_USE_OSAL_IF + +/**/ +#ifndef M4OSA_READER_OPTIM_USE_OSAL_IF + typedef struct + { + M4OSA_Void* (*pFctPtr_Open)( M4OSA_Void* fd, + M4OSA_UInt32 FileModeAccess, + M4OSA_UInt16* errno ); + M4OSA_FilePosition (*pFctPtr_Read)( M4OSA_Void* fd, + M4OSA_UInt8* data, + M4OSA_FilePosition size, + M4OSA_UInt16* errno ); + M4OSA_FilePosition (*pFctPtr_Seek)( M4OSA_Void* fd, + M4OSA_FilePosition pos, + M4OSA_FileSeekAccessMode mode, + M4OSA_UInt16* errno ); + M4OSA_FilePosition (*pFctPtr_Tell)( M4OSA_Void* fd, + M4OSA_UInt16* errno ); + M4OSA_Int32 (*pFctPtr_Close)( M4OSA_Void* fd, + M4OSA_UInt16* errno ); + M4OSA_Void (*pFctPtr_AccessType)( M4OSA_UInt32 FileModeAccess_In, + M4OSA_Void* FileModeAccess_Out ); + + } M4OSA_FileSystem_FctPtr; +#endif +/**/ + + +/* Reader API : bufferized functions */ +#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF + M4OSA_ERR M4OSA_fileReadOpen_optim( M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); +#else + M4OSA_ERR M4OSA_fileReadOpen_optim( M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess, + M4OSA_FileSystem_FctPtr *FS); +#endif + +M4OSA_ERR M4OSA_fileReadData_optim( M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32* size ); +M4OSA_ERR M4OSA_fileReadSeek_optim( M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position ); +M4OSA_ERR M4OSA_fileReadClose_optim( M4OSA_Context context ); +M4OSA_ERR M4OSA_fileReadGetOption_optim( M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption *optionValue ); +M4OSA_ERR M4OSA_fileReadSetOption_optim( M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption optionValue ); + +#endif /* M4OSA_FILEREADER_OPTIM_H */ diff --git a/libvideoeditor/osal/inc/LV_Macros.h b/libvideoeditor/osal/inc/LV_Macros.h new file mode 100755 index 0000000..d6312cc --- /dev/null +++ b/libvideoeditor/osal/inc/LV_Macros.h @@ -0,0 +1,108 @@ +/* + * 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 LV_Macros.h +* @par NXP Software +* @brief Macros definition for Smartphone team +*******************************************************************************/ + +#ifndef LV_MACROS_H +#define LV_MACROS_H + +/*------------*/ +/* INCLUDES */ +/*------------*/ +#include "M4OSA_Memory.h" +#include "M4OSA_Debug.h" + +/****************************************************************************** +* +* CHECK_PTR(fct, p, err, errValue) +* @note This macro checks the value p. If it is NULL, it sets the variable err +* to errValue and jumps to the label <fct>_cleanUp. A trace is displayed +* signalling the error, the function name and the line number. +* +******************************************************************************/ +#define CHECK_PTR(fct, p, err, errValue) \ +{ \ + if(M4OSA_NULL == (p)) \ + { \ + (err) = (errValue) ; \ + M4OSA_TRACE1_1((M4OSA_Char*)"" #fct "(L%d): " #p " is NULL, returning " #errValue "",__LINE__) ; \ + goto fct##_cleanUp; \ + } \ +} + +/****************************************************************************** +* +* CHECK_ERR(fct, err) +* @note This macro checks the value err. If it is not NULL, a trace is displayed +* signalling the error, the function name and the line number. The macro +* jumps to the label <fct>_cleanUp. +* +******************************************************************************/ +#define CHECK_ERR(fct, err) \ +{ \ + if(M4NO_ERROR != (err)) \ + { \ + M4OSA_TRACE1_2((M4OSA_Char*)"!!! " #fct "(L%d): ERROR 0x%.8x returned",\ + __LINE__,err) ; \ + goto fct##_cleanUp; \ + } \ +} + + +/****************************************************************************** +* +* CHECK_ERR(fct, err) +* @note This macro compares a current state with a state value. If they are different, +* err is set to M4ERR_STATE. +* A trace is displayed signalling the error, the function name and the line number. +* The macro jumps to the label <fct>_cleanUp. +* +******************************************************************************/ +#define CHECK_STATE(fct, stateValue, state) \ +{ \ + if((stateValue) != (state)) \ + { \ + M4OSA_TRACE1_1("" #fct " called in bad state %d", state) ; \ + (err) = M4ERR_STATE ; \ + goto fct##_cleanUp; \ + } \ +} + +/****************************************************************************** +* +* SAFE_FREE(p) +* @note This macro checks the value of p is not NULL. If it is NULL, it does +* nothing. Else, p is de allocated and set to NULL. +* +******************************************************************************/ +#define SAFE_FREE(p) \ +{ \ + if(M4OSA_NULL != (p)) \ + { \ + M4OSA_free((M4OSA_MemAddr32)(p)) ; \ + (p) = M4OSA_NULL ; \ + } \ +} + + + +#endif /*--- LV_MACROS_H ---*/ + diff --git a/libvideoeditor/osal/inc/LV_Types.h b/libvideoeditor/osal/inc/LV_Types.h new file mode 100755 index 0000000..534ea3a --- /dev/null +++ b/libvideoeditor/osal/inc/LV_Types.h @@ -0,0 +1,78 @@ +/* + * 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 LV_Types.h +* @brief Types definition for Smartphone team +*******************************************************************************/ + +#ifndef LV_TYPES_H +#define LV_TYPES_H + +/*------------*/ +/* INCLUDES */ +/*------------*/ +#include "M4OSA_Error.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*--------------------------------------*/ +/* CHARACTER ENCODING CONVERSION FCTS */ +/*--------------------------------------*/ +/****************************************************************************** +* +* M4OSA_UInt32 (*LV_fromUTF8ToNative_Fct)(const M4OSA_Char* pStart, +* M4OSA_Void** pOut); +* @note This function converts a string from UTF8 format which is the default +* encoding in the engines and application logics to the character encoding +* supported by the OS or platform. The memory will be allocated within this +* function and then, caller will have to free *targetStart thanks to M4OSA_free. +* Both strings must be NULL-terminateed. +* @param pStart (IN): String to convert. +* @param pOut (OUT): This pointer will be filled by this function. It contains the +* string converted to the native format. +* @return Success: Size in bytes allocated including the NULL character. Failure: 0 +* +******************************************************************************/ +typedef M4OSA_UInt32 (*LV_fromUTF8ToNative_Fct)(const M4OSA_Char* pStart, + M4OSA_Void** pOut); + +/****************************************************************************** +* +* M4OSA_UInt32 (*LV_fromNativeToUTF8_Fct)(const M4OSA_Char* pStart, +* M4OSA_Void** targetStart); +* @note This function converts a string in the character encoding supported by the +* OS or platform to from UTF8 format which is the default encoding in the +* engines and application logics. The memory will be allocated within this +* function and then, caller will have to free *targetStart thanks to M4OSA_free. +* Both strings must be NULL-terminateed. +* @param pStart (IN): String to convert. +* @param pOut (OUT): This pointer will be filled by this function. It contains the +* string converted to UTF8 format. +* @return Success: Size in bytes allocated including the NULL character. Failure: 0 +* +******************************************************************************/ +typedef M4OSA_UInt32 (*LV_fromNativeToUTF8_Fct)(const M4OSA_Void** pStart, + M4OSA_Char** pOut); +#ifdef __cplusplus +} +#endif + +#endif /*--- LV_TYPES_H ---*/ diff --git a/libvideoeditor/osal/inc/M4OSA_CharStar.h b/libvideoeditor/osal/inc/M4OSA_CharStar.h new file mode 100755 index 0000000..b51af23 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_CharStar.h @@ -0,0 +1,147 @@ +/* + * 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_CharStar.h + * @ingroup + * @brief external API of the Char Star set of functions. + ************************************************************************ +*/ + +#ifndef M4OSA_CHARSTAR_H +#define M4OSA_CHARSTAR_H + +/* general OSAL types and prototypes inclusion */ +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_Time.h" +#include "M4OSA_FileCommon.h" + +/* types definition */ +typedef enum +{ + M4OSA_kchrDec = 0x01, + M4OSA_kchrHexa = 0x02, + M4OSA_kchrOct = 0x03 +} M4OSA_chrNumBase; + +/* error and warning codes */ +#define M4ERR_CHR_STR_OVERFLOW M4OSA_ERR_CREATE(M4_ERR,M4OSA_CHARSTAR,0x000001) +#define M4ERR_CHR_CONV_FAILED M4OSA_ERR_CREATE(M4_ERR,M4OSA_CHARSTAR,0x000002) +#define M4WAR_CHR_NOT_FOUND M4OSA_ERR_CREATE(M4_WAR,M4OSA_CHARSTAR,0x000001) +#define M4WAR_CHR_NUM_RANGE M4OSA_ERR_CREATE(M4_WAR,M4OSA_CHARSTAR,0x000002) +#define M4WAR_CHR_NEGATIVE M4OSA_ERR_CREATE(M4_WAR,M4OSA_CHARSTAR,0x000003) + +/* prototypes of the Char Star functions */ +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrNCopy (M4OSA_Char *strOut, + M4OSA_Char *strIn, + M4OSA_UInt32 len2Copy); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrNCat (M4OSA_Char *strOut, + M4OSA_Char *strIn, + M4OSA_UInt32 len2Append); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrCompare (M4OSA_Char *strIn1, + M4OSA_Char *strIn2, + M4OSA_Int32 *cmpResult); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrNCompare (M4OSA_Char *strIn1, + M4OSA_Char *strIn2, + M4OSA_UInt32 len2Comp, + M4OSA_Int32 *cmpResult); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrAreIdentical (M4OSA_Char *strIn1, + M4OSA_Char *strIn2, + M4OSA_Bool *result); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrFindChar (M4OSA_Char *strIn, + M4OSA_Char c, + M4OSA_Char **pointerInStr); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrReverseFindChar(M4OSA_Char *strIn, + M4OSA_Char c, + M4OSA_Char **pointerInStr); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrSpan (M4OSA_Char *strIn, + M4OSA_Char *delimiters, + M4OSA_UInt32 *posInStr); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrSpanComplement (M4OSA_Char *strIn, + M4OSA_Char *delimiters, + M4OSA_UInt32 *posInStr); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrPbrk (M4OSA_Char *strIn, + M4OSA_Char *delimiters, + M4OSA_Char **pointerInStr); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrFindPattern (M4OSA_Char *strIn1, + M4OSA_Char *strIn2, + M4OSA_Char **pointerInStr1); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_UInt32 M4OSA_chrLength (M4OSA_Char *strIn); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_Char M4OSA_chrToLower (M4OSA_Char cIn); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_Char M4OSA_chrToUpper (M4OSA_Char cIn); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetWord (M4OSA_Char *strIn, + M4OSA_Char *beginDelimiters, + M4OSA_Char *endDelimiters, + M4OSA_Char *strOut, + M4OSA_UInt32 *strOutMaxLen, + M4OSA_Char **outputPointer); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetUInt32 (M4OSA_Char *strIn, + M4OSA_UInt32 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetUInt16 (M4OSA_Char *strIn, + M4OSA_UInt16 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetUInt8 (M4OSA_Char *strIn, + M4OSA_UInt8 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetInt64 (M4OSA_Char *strIn, + M4OSA_Int64 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetInt32 (M4OSA_Char *strIn, + M4OSA_Int32 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetInt16 (M4OSA_Char *strIn, + M4OSA_Int16 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetInt8 (M4OSA_Char *strIn, + M4OSA_Int8 *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetDouble (M4OSA_Char *strIn, + M4OSA_Double *val, + M4OSA_Char **strOut); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetTime (M4OSA_Char *strIn, + M4OSA_Time *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrGetFilePosition(M4OSA_Char *strIn, + M4OSA_FilePosition *val, + M4OSA_Char **strOut, + M4OSA_chrNumBase base); +M4OSAL_CHARSTAR_EXPORT_TYPE M4OSA_ERR M4OSA_chrSPrintf (M4OSA_Char *strOut, + M4OSA_UInt32 strOutMaxLen, + M4OSA_Char *format, + ...); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libvideoeditor/osal/inc/M4OSA_Clock.h b/libvideoeditor/osal/inc/M4OSA_Clock.h new file mode 100755 index 0000000..ca3c39e --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Clock.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 M4OSA_Clock.h + * @ingroup OSAL + * @brief clock API + ************************************************************************ +*/ + +#ifndef M4OSA_CLOCH_H +#define M4OSA_CLOCK_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_Time.h" + + +#define M4WAR_TIMESCALE_TOO_BIG M4OSA_ERR_CREATE(M4_WAR,M4OSA_CLOCK,0x000001) /**< Time precision too high for the system*/ +#define M4ERR_CLOCK_BAD_REF_YEAR M4OSA_ERR_CREATE(M4_ERR,M4OSA_CLOCK,0x000001) /**< Input year of reference is neither 1900, nor 1970 nor 2000*/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_CLOCK_EXPORT_TYPE M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, + M4OSA_UInt32 timescale); + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_CLOCK_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_CoreID.h b/libvideoeditor/osal/inc/M4OSA_CoreID.h new file mode 100755 index 0000000..e8ca1a2 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_CoreID.h @@ -0,0 +1,200 @@ +/* + * 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/osal/inc/M4OSA_Debug.h b/libvideoeditor/osal/inc/M4OSA_Debug.h new file mode 100755 index 0000000..6d93c9c --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Debug.h @@ -0,0 +1,267 @@ +/* + * 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_Debug.h + * @brief Debug and Trace Macro + ************************************************************************ +*/ + + +#ifndef _M4OSA_DEBUG_H_ +#define _M4OSA_DEBUG_H_ + +#include "M4OSA_Error.h" +#include "M4OSA_Types.h" + + +/* defaut value, defined only if not defined already. */ +#ifndef M4TRACE_ID +#define M4TRACE_ID M4UNKNOWN_COREID +#endif /* M4TRACE_ID undefined */ + + +#define M4OSA_SUPER_DEBUG_LEVEL 0 + +#ifndef M4OSA_DEBUG_LEVEL +#define M4OSA_DEBUG_LEVEL 0 +#endif + + +#define M4OSA_SUPER_TRACE_LEVEL 0 + +#ifndef M4OSA_TRACE_LEVEL +#define M4OSA_TRACE_LEVEL 0 +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#if (M4OSA_DEBUG_LEVEL >= 1) || (M4OSA_SUPER_DEBUG_LEVEL >= 1) + +/* Debug macros */ +extern M4OSA_Void M4OSA_DEBUG_traceFunction(M4OSA_UInt32 line, + M4OSA_Char* fileName, + M4OSA_UInt32 level, + M4OSA_Char* stringCondition, + M4OSA_Char* message, + M4OSA_ERR returnedError); + + +#define M4OSA_DEBUG_IFx(cond, errorCode, msg, level)\ + if(cond)\ + {\ + M4OSA_DEBUG_traceFunction(__LINE__, (M4OSA_Char*)__FILE__, level,\ + (M4OSA_Char*)#cond, (M4OSA_Char*)msg, + (errorCode));\ + return(errorCode);\ + } + +#define M4OSA_DEBUG(errorCode, msg)\ + M4OSA_DEBUG_traceFunction(__LINE__, (M4OSA_Char*)__FILE__, 1,\ + (M4OSA_Char*)#errorCode, (M4OSA_Char*)msg, + (errorCode)); + +#else /*(M4OSA_DEBUG_LEVEL >= 1) || (M4OSA_SUPER_DEBUG_LEVEL >= 1)*/ + + +#define M4OSA_DEBUG(errorCode, msg) + +#endif /*(M4OSA_DEBUG_LEVEL >= 1) || (M4OSA_SUPER_DEBUG_LEVEL >= 1)*/ + + + +#if (M4OSA_DEBUG_LEVEL >= 1) || (M4OSA_SUPER_DEBUG_LEVEL >= 1) + #define M4OSA_DEBUG_IF1(cond, errorCode, msg)\ + M4OSA_DEBUG_IFx(cond, errorCode, msg, 1) +#else + #define M4OSA_DEBUG_IF1(cond, errorCode, msg) +#endif /*(M4OSA_DEBUG_LEVEL >= 1) || (M4OSA_SUPER_DEBUG_LEVEL >= 1)*/ + + +#if (M4OSA_DEBUG_LEVEL >= 2) || (M4OSA_SUPER_DEBUG_LEVEL >= 2) + #define M4OSA_DEBUG_IF2(cond, errorCode, msg)\ + M4OSA_DEBUG_IFx(cond, errorCode, msg, 2) +#else + #define M4OSA_DEBUG_IF2(cond, errorCode, msg) +#endif /*(M4OSA_DEBUG_LEVEL >= 2) || (M4OSA_SUPER_DEBUG_LEVEL >= 2)*/ + + +#if (M4OSA_DEBUG_LEVEL >= 3) || (M4OSA_SUPER_DEBUG_LEVEL >= 3) + #define M4OSA_DEBUG_IF3(cond, errorCode, msg)\ + M4OSA_DEBUG_IFx(cond, errorCode, msg, 3) +#else + #define M4OSA_DEBUG_IF3(cond, errorCode, msg) +#endif /*(M4OSA_DEBUG_LEVEL >= 3) || (M4OSA_SUPER_DEBUG_LEVEL >= 3)*/ + + + +/* Trace macros */ + +#if (M4OSA_TRACE_LEVEL >= 1) || (M4OSA_SUPER_TRACE_LEVEL >= 1) + +extern M4OSA_Void M4OSA_TRACE_traceFunction(M4OSA_UInt32 line, + M4OSA_Char* fileName, + M4OSA_CoreID coreID, + M4OSA_UInt32 level, + M4OSA_Char* stringMsg, + ... ); + + + +#define M4OSA_TRACEx_0(msg, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level, (M4OSA_Char*)msg); + + +#define M4OSA_TRACEx_1(msg, param1, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level, (M4OSA_Char*)msg, param1); + + +#define M4OSA_TRACEx_2(msg, param1, param2, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level,\ + (M4OSA_Char*)msg, param1,\ + param2); + + +#define M4OSA_TRACEx_3(msg, param1, param2, param3, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level, (M4OSA_Char*)msg,\ + param1,param2, param3); + + +#define M4OSA_TRACEx_4(msg, param1, param2, param3, param4, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level,\ + (M4OSA_Char*)msg, param1,\ + param2, param3, param4); + + +#define M4OSA_TRACEx_5(msg, param1, param2, param3, param4, param5, level)\ + M4OSA_TRACE_traceFunction(__LINE__, (M4OSA_Char*)__FILE__,\ + (M4OSA_CoreID)M4TRACE_ID, level,\ + (M4OSA_Char*)msg, param1,\ + param2, param3, param4, param5); + +#endif /*(M4OSA_TRACE_LEVEL >= 1) || (M4OSA_SUPER_TRACE_LEVEL >= 1)*/ + + + +#if (M4OSA_TRACE_LEVEL >= 1) || (M4OSA_SUPER_TRACE_LEVEL >= 1) +#define M4OSA_TRACE1_0(msg)\ + M4OSA_TRACEx_0(msg, 1) + +#define M4OSA_TRACE1_1(msg, param1)\ + M4OSA_TRACEx_1(msg, param1, 1) + +#define M4OSA_TRACE1_2(msg, param1, param2)\ + M4OSA_TRACEx_2(msg, param1, param2, 1) + +#define M4OSA_TRACE1_3(msg, param1, param2, param3)\ + M4OSA_TRACEx_3(msg, param1, param2, param3, 1) + +#define M4OSA_TRACE1_4(msg, param1, param2, param3, param4)\ + M4OSA_TRACEx_4(msg, param1, param2, param3, param4, 1) + +#define M4OSA_TRACE1_5(msg, param1, param2, param3, param4, param5)\ + M4OSA_TRACEx_5(msg, param1, param2, param3, param4, param5, 1) + +#else /*(M4OSA_TRACE_LEVEL >= 1) || (M4OSA_SUPER_TRACE_LEVEL >= 1)*/ + +#define M4OSA_TRACE1_0(msg) +#define M4OSA_TRACE1_1(msg, param1) +#define M4OSA_TRACE1_2(msg, param1, param2) +#define M4OSA_TRACE1_3(msg, param1, param2, param3) +#define M4OSA_TRACE1_4(msg, param1, param2, param3, param4) +#define M4OSA_TRACE1_5(msg, param1, param2, param3, param4, param5) + +#endif /*(M4OSA_TRACE_LEVEL >= 1) || (M4OSA_SUPER_TRACE_LEVEL >= 1)*/ + + +#if (M4OSA_TRACE_LEVEL >= 2) || (M4OSA_SUPER_TRACE_LEVEL >= 2) +#define M4OSA_TRACE2_0(msg)\ + M4OSA_TRACEx_0(msg, 2) + +#define M4OSA_TRACE2_1(msg, param1)\ + M4OSA_TRACEx_1(msg, param1, 2) + +#define M4OSA_TRACE2_2(msg, param1, param2)\ + M4OSA_TRACEx_2(msg, param1, param2, 2) + +#define M4OSA_TRACE2_3(msg, param1, param2, param3)\ + M4OSA_TRACEx_3(msg, param1, param2, param3, 2) + +#define M4OSA_TRACE2_4(msg, param1, param2, param3, param4)\ + M4OSA_TRACEx_4(msg, param1, param2, param3, param4, 2) + +#define M4OSA_TRACE2_5(msg, param1, param2, param3, param4, param5)\ + M4OSA_TRACEx_5(msg, param1, param2, param3, param4, param5, 2) + +#else /*(M4OSA_TRACE_LEVEL >= 2) || (M4OSA_SUPER_TRACE_LEVEL >= 2)*/ + +#define M4OSA_TRACE2_0(msg) +#define M4OSA_TRACE2_1(msg, param1) +#define M4OSA_TRACE2_2(msg, param1, param2) +#define M4OSA_TRACE2_3(msg, param1, param2, param3) +#define M4OSA_TRACE2_4(msg, param1, param2, param3, param4) +#define M4OSA_TRACE2_5(msg, param1, param2, param3, param4, param5) +#endif /*(M4OSA_TRACE_LEVEL >= 2) || (M4OSA_SUPER_TRACE_LEVEL >= 2)*/ + + +#if (M4OSA_TRACE_LEVEL >= 3) || (M4OSA_SUPER_TRACE_LEVEL >= 3) +#define M4OSA_TRACE3_0(msg)\ + M4OSA_TRACEx_0(msg, 3) + +#define M4OSA_TRACE3_1(msg, param1)\ + M4OSA_TRACEx_1(msg, param1, 3) + +#define M4OSA_TRACE3_2(msg, param1, param2)\ + M4OSA_TRACEx_2(msg, param1, param2, 3) + +#define M4OSA_TRACE3_3(msg, param1, param2, param3)\ + M4OSA_TRACEx_3(msg, param1, param2, param3, 3) + +#define M4OSA_TRACE3_4(msg, param1, param2, param3, param4)\ + M4OSA_TRACEx_4(msg, param1, param2, param3, param4, 3) + +#define M4OSA_TRACE3_5(msg, param1, param2, param3, param4, param5)\ + M4OSA_TRACEx_5(msg, param1, param2, param3, param4, param5, 3) + +#else /*(M4OSA_TRACE_LEVEL >= 3) || (M4OSA_SUPER_TRACE_LEVEL >= 3)*/ + +#define M4OSA_TRACE3_0(msg) +#define M4OSA_TRACE3_1(msg, param1) +#define M4OSA_TRACE3_2(msg, param1, param2) +#define M4OSA_TRACE3_3(msg, param1, param2, param3) +#define M4OSA_TRACE3_4(msg, param1, param2, param3, param4) +#define M4OSA_TRACE3_5(msg, param1, param2, param3, param4, param5) + +#endif /*(M4OSA_TRACE_LEVEL >= 3) || (M4OSA_SUPER_TRACE_LEVEL >= 3)*/ + + + +#ifdef __cplusplus +} +#endif + +#endif /* _M4OSA_DEBUG_H_ */ + diff --git a/libvideoeditor/osal/inc/M4OSA_Error.h b/libvideoeditor/osal/inc/M4OSA_Error.h new file mode 100755 index 0000000..963bb63 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Error.h @@ -0,0 +1,173 @@ +/* + * 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_Error.h + * @ingroup OSAL + * @brief Definition of common error types + * @note This file contains macros to generate and analyze error codes. + ************************************************************************ +*/ + + +#ifndef M4OSA_ERROR_H +#define M4OSA_ERROR_H + +#include "M4OSA_Types.h" + +/** M4OSA_ERR is a 32 bits unsigned integer. + * To sort returned code, a specific naming convention must be followed: + * - Severity (2 bits): It may br either 0b00 (no error), 0b01 (warning) or + * 0b01 (fatal error) + * - Core ID (14 bits): It is a unique ID for each core component + * - ErrorID (16 bits): It is the specific error code + + * EACH CORE COMPONENT FUNCTION SHOULD RETURN AN M4OSA_ERR +*/ +typedef M4OSA_UInt32 M4OSA_ERR; + +#define M4_OK 0 +#define M4_WAR 1 +#define M4_ERR 2 + + +/* Macro to process M4OSA_ERR */ + +/** This macro tests if the provided M4OSA_ERR is a warning or not*/ +#define M4OSA_ERR_IS_WARNING(error) ((((error)>>30) == M4_WAR) ? 1:0) + +/** This macro tests if the provided M4OSA_ERR is a fatal error or not*/ +#define M4OSA_ERR_IS_ERROR(error) ((((error)>>30) == M4_ERR) ? 1:0) + +/** This macro returns an error code accroding to the 3 provided fields: + * @arg severity: (IN) [M4OSA_UInt32] Severity to put in the error code + * @arg coreID: (IN) [M4OSA_UInt32] CoreID to put in the error code + * @arg errorID: (IN) [M4OSA_UInt32] ErrorID to put in the error code*/ +#define M4OSA_ERR_CREATE(severity, coreID, errorID)\ + (M4OSA_Int32)((((M4OSA_UInt32)severity)<<30)+((((M4OSA_UInt32)coreID)&0x003FFF)<<16)+(((M4OSA_UInt32)errorID)&0x00FFFF)) + +/** This macro extracts the 3 fields from the error: + * @arg error: (IN) [M4OSA_ERR] Error code + * @arg severity: (OUT) [M4OSA_UInt32] Severity to put in the error code + * @arg coreID: (OUT) [M4OSA_UInt32] CoreID to put in the error code + * @arg errorID: (OUT) [M4OSA_UInt32] ErrorID to put in the error code*/ +#define M4OSA_ERR_SPLIT(error, severity, coreID, errorID)\ + { severity=(M4OSA_UInt32)((error)>>30);\ + coreID=(M4OSA_UInt32)(((error)>>16)&0x003FFF);\ + (M4OSA_UInt32)(errorID=(error)&0x00FFFF); } + + +/* "fake" CoreID, is used to report an unknown CoreID. Used by the trace system +when the core ID macro isn't defined. Defined here instead of CoreID.h to avoid +introducing dependencies to common/inc. */ + +#define M4UNKNOWN_COREID 0x3FFF /* max possible CoreID */ + +#define M4_COMMON 0x00 /**<Common*/ +#define M4MP4_COMMON 0x01 /**<Core MP4 (common)*/ +#define M4MP4_WRITER 0x02 /**<Core MP4 writer*/ +#define M4MP4_READER 0x03 /**<Core MP4 reader*/ +#define M4RTSP_COMMON 0x11 /**<Core RTSP common*/ +#define M4RTSP_WRITER 0x12 /**<Core RTSP transmitter*/ +#define M4RTSP_READER 0x13 /**<Core RTSP receiver*/ +#define M4RTP_WRITER 0x14 /**<Core RTP/RTCP receiver*/ +#define M4RTP_READER 0x15 /**<Core RTP/RTCP transmitter*/ +#define M4SAP_WRITER 0x16 /**<Core SAP transmitter*/ +#define M4SAP_READER 0x17 /**<Core SAP receiver*/ +#define M4DVBH_READER 0x18 /**<Core DVBH receiver*/ +#define M4SDP_WRITER 0x22 /**<Core SDP writer*/ +#define M4SDP_READER 0x31 /**<Core SDP reader*/ +#define M4PAK_AMR 0x32 /**<Core packetizer AMR (RFC3267)*/ +#define M4DEPAK_AMR 0x33 /**<Core de-packetizer AMR (RFC3267)*/ +#define M4PAK_H263 0x34 /**<Core packetizer H263 (RFC2429)*/ +#define M4DEPAK_H263 0x35 /**<Core de-packetizer H263(RFC2429)*/ +#define M4PAK_SIMPLE 0x36 /**<Core packetizer SimpleDraft (RFC xxxx)*/ +#define M4DEPAK_SIMPLE 0x37 /**<Core de-packetizer SimpleDraft (RFC xxxx)*/ +#define M4PAK_3016_VIDEO 0x38 /**<Core packetizer RFC3016 video*/ +#define M4DEPAK_3016_VIDEO 0x39 /**<Core de-packetizer RFC3016 video*/ +#define M4PAK_3016_AUDIO 0x3A /**<Core packetizer RFC3016 audio (LATM)*/ +#define M4DEPAK_3016_AUDIO 0x3B /**<Core de-packetizer RFC3016 audio (LATM)*/ +#define M4DEPAK_H264 0x3C /**<Core de-packetizer H264*/ +#define M4DEPAK_REALV 0x3D /**<Core de-packetizer Real Video */ +#define M4DEPAK_REALA 0x3E /**<Core de-packetizer Real Audio */ +#define M4RDT_READER 0x3F /**<Core RDT receiver*/ +#define M4TCP_DMUX 0x50 /**<Core TCP demux*/ +#define M4IOD_PARSER 0x51 /**<Core IOD parser*/ +#define M4OSA_FILE_COMMON 0x61 /**<OSAL file common*/ +#define M4OSA_FILE_WRITER 0x62 /**<OSAL file writer*/ +#define M4OSA_FILE_READER 0x63 /**<OSAL file reader*/ +#define M4OSA_FILE_EXTRA 0x64 /**<OSAL file extra*/ +#define M4OSA_DIRECTORY 0x65 /**<OSAL directory*/ +#define M4OSA_SOCKET 0x71 /**<OSAL socket (both reader and writer)*/ +#define M4OSA_THREAD 0x81 /**<OSAL thread*/ +#define M4OSA_MUTEX 0x82 /**<OSAL mutex*/ +#define M4OSA_SEMAPHORE 0x83 /**<OSAL semaphore*/ +#define M4OSA_CLOCK 0x84 /**<OSAL clock*/ +#define M4OSA_MEMORY 0x91 /**<OSAL memory*/ +#define M4CALL_BACK 0xA1 /**<Call Back error*/ +#define M4OSA_URI 0xB1 /**<OSAL URI handler*/ +#define M4OSA_STRING 0xB2 /**<OSAL string*/ +#define M4SYS_CMAPI 0xB3 /**<SYSTEM Common Medi API*/ +#define M4OSA_CHARSTAR 0xB4 /**<OSAL CharStar*/ +#define M4REACTOR 0xC1 /**<Core reactor*/ +#define M4TEST 0xD1 /**<Test component*/ +#define M4STACK 0xE1 /**< Core ID of the integrated stack*/ +#define M4STACK_REAL 0xE2 /**<Core ID of the Real integrated stack */ +#define M4TOOL_LBVT_PARAM 0xF1 /**<LB_VT config file manager*/ +#define M4TOOL_LINK_LIST 0xF2 /**<Tool linked list*/ +#define M4TOOL_BASE64 0xF3 /**<Core base64 encoder/decoder*/ + + + +/* Definition of common error codes */ +/** there is no error*/ +#define M4NO_ERROR 0x00000000 + +/** At least one parameter is NULL*/ +#define M4ERR_PARAMETER M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000001) +/** This function cannot be called now*/ +#define M4ERR_STATE M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000002) +/** There is no more memory available*/ +#define M4ERR_ALLOC M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000003) +/** Provided context is not a valid one*/ +#define M4ERR_BAD_CONTEXT M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000004) +#define M4ERR_CONTEXT_FAILED M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000005) +#define M4ERR_BAD_STREAM_ID M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000006) +/** The optionID is not a valid one*/ +#define M4ERR_BAD_OPTION_ID M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000007) +/** This option is a write only one*/ +#define M4ERR_WRITE_ONLY M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000008) +/** This option is a read only one*/ +#define M4ERR_READ_ONLY M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x000009) +/** This function is not supported yet*/ +#define M4ERR_NOT_IMPLEMENTED M4OSA_ERR_CREATE(M4_ERR,M4_COMMON,0x00000A) + +#define M4ERR_UNSUPPORTED_MEDIA_TYPE M4OSA_ERR_CREATE(M4_ERR, M4_COMMON, 0x00000B) + +#define M4WAR_NO_DATA_YET M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000001) +#define M4WAR_NO_MORE_STREAM M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000002) +#define M4WAR_INVALID_TIME M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000003) +#define M4WAR_NO_MORE_AU M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000004) +#define M4WAR_TIME_OUT M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000005) +/** The buffer is full*/ +#define M4WAR_BUFFER_FULL M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000006) +/* The server asks for a redirection */ +#define M4WAR_REDIRECT M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000007) +#define M4WAR_TOO_MUCH_STREAMS M4OSA_ERR_CREATE(M4_WAR,M4_COMMON,0x000008) + +#endif /*M4OSA_ERROR_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Export.h b/libvideoeditor/osal/inc/M4OSA_Export.h new file mode 100755 index 0000000..4d38346 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Export.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 M4OSA_Export.h + * @brief Data access export types for Android + * @note This file defines types which must be + * used to import or export any function. + ************************************************************************ +*/ + +#ifndef M4OSA_EXPORT_H +#define M4OSA_EXPORT_H + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus*/ + +/************************************/ +/* OSAL EXPORTS */ +/************************************/ + +#define M4OSAL_CHARSTAR_EXPORT_TYPE /**< OSAL CHAR_STAR */ +#define M4OSAL_CLOCK_EXPORT_TYPE /**< OSAL CLOCK */ +#define M4OSAL_DATE_EXPORT_TYPE /**< OSAL DATE */ +#define M4OSAL_FILE_EXPORT_TYPE /**< OSAL FILE */ +#define M4OSAL_REALTIME_EXPORT_TYPE /**< OSAL REAL TIME */ +#define M4OSAL_SOCKET_EXPORT_TYPE /**< SOCKET */ +#define M4OSAL_STRING_EXPORT_TYPE /**< OSAL STRING */ +#define M4OSAL_URI_EXPORT_TYPE /**< OSAL URI */ +#define M4OSAL_MEMORY_EXPORT_TYPE /**< OSAL MEMORY */ +#define M4OSAL_TRACE_EXPORT_TYPE /**< OSAL TRACE */ +#define M4OSAL_TOOL_TIMER_EXPORT_TYPE /**< OSAL TOOL TIMER */ +#define M4OSAL_SYSTEM_CM_EXPORT_TYPE /**< SYSTEM COMMON API */ +#define M4OSAL_LINKED_LIST_EXPORT_TYPE /**< TOOL LINKED LIST */ +#define M4OSAL_MEMORY_MANAGER_EXPORT_TYPE /**< MEMORY MANAGER */ +#define M4OSAL_TRACE_MANAGER_EXPORT_TYPE /**< TOOL TRACE MANAGER */ +#define M4VPS_EXPORT_TYPE /**< VPS API */ +#define M4AP_EXPORT_TYPE /**< AUDIO PRESENTERS */ +#define M4VP_EXPORT_TYPE /**< VIDEO PRESENTERS */ +#define M4CB_EXPORT_TYPE /**< Call back */ + +#ifdef __cplusplus +} +#endif /*__cplusplus*/ + +#endif /*M4OSA_EXPORT_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileAccess.h b/libvideoeditor/osal/inc/M4OSA_FileAccess.h new file mode 100755 index 0000000..489a981 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileAccess.h @@ -0,0 +1,71 @@ +/* + * 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 __M4OSA_FILEACESS_H__ +#define __M4OSA_FILEACESS_H__ + +#include "M4OSA_Types.h" +#include "M4OSA_Semaphore.h" +#include "M4OSA_Debug.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + ****************************************************************************** + * struct M4OSA_FilePtrFct + * @brief Defines the available functions for File read/write. + ****************************************************************************** +*/ +typedef enum +{ + M4OSA_FILEINTERFACE_RAM, + M4OSA_FILEINTERFACE_FFS, + M4OSA_FILEINTERFACE_OPTIM_FFS + +} M4OSA_FileInterface_t; + + +typedef struct +{ + M4OSA_FileWriterPointer *pFileWriter; /**< Pointer to file writer functions */ + M4OSA_FileReadPointer *pFileReader; /**< Pointer to file reader functions */ +} M4OSA_FilePtrFct; + +/*Semaphore for handling of R/W access*/ +extern M4OSA_Context M4OSA_FileInterface_RWsemaphore; /*defined in M4OSA_FileInterface.c*/ + +/** + ****************************************************************************** + * func M4_FileInterface_xxx + * @brief Manage the interface pointers for filesystem access + ****************************************************************************** +*/ +M4OSA_FilePtrFct* M4_FileInterface_InitPointer(void); +M4OSA_ERR M4_FileInterface_SelectPointer(M4OSA_FilePtrFct *pFileFctPtr, + M4OSA_FileInterface_t mode); +M4OSA_Void M4_FileInterface_FreePointer(M4OSA_FilePtrFct *pFileFctPtr); +M4OSA_ERR M4OSA_fileReadOpen_optim_SetInterfaceFFS(M4OSA_Context* pContext, + M4OSA_Void* pFileDescriptor, + M4OSA_UInt32 FileModeAccess); + +#ifdef __cplusplus +} +#endif /* __cplusplus*/ + +#endif /* __M4OSA_FILEACESS_H__*/ diff --git a/libvideoeditor/osal/inc/M4OSA_FileCache.h b/libvideoeditor/osal/inc/M4OSA_FileCache.h new file mode 100755 index 0000000..cb4c2ba --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileCache.h @@ -0,0 +1,69 @@ +/* + * 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_FileCache.h + * @ingroup OSAL + * @brief Osal File Reader and Writer with cache + * @note This file implements functions to manipulate + * filesystem access with intermediate buffers used to + * read and to write. + ****************************************************************************** +*/ + +#ifndef M4OSA_FILECACHE_H +#define M4OSA_FILECACHE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSA_ERR M4OSA_fileOpen_cache(M4OSA_Context* pContext, + M4OSA_Void* pFileDescriptor, + M4OSA_UInt32 FileModeAccess); +M4OSA_ERR M4OSA_fileReadData_cache( M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32* size ); +M4OSA_ERR M4OSA_fileWriteData_cache( M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32 size ); +M4OSA_ERR M4OSA_fileReadSeek_cache( M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position ); +M4OSA_ERR M4OSA_fileWriteSeek_cache( M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position ); +M4OSA_ERR M4OSA_fileGetOption_cache( M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption *optionValue ); +M4OSA_ERR M4OSA_fileSetOption_cache( M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption optionValue ); +M4OSA_ERR M4OSA_fileFlush_cache( M4OSA_Context pContext); +M4OSA_ERR M4OSA_fileClose_cache( M4OSA_Context context ); + +/* Used in VA */ +M4OSA_ERR M4OSA_fileExtrafTruncate_cache(M4OSA_Context context, + M4OSA_UInt32 length); + +#ifdef __cplusplus +} +#endif + + +#endif /* M4OSA_FILECACHE_H */ diff --git a/libvideoeditor/osal/inc/M4OSA_FileCommon.h b/libvideoeditor/osal/inc/M4OSA_FileCommon.h new file mode 100755 index 0000000..663be66 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileCommon.h @@ -0,0 +1,237 @@ +/* + * 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_FileCommon.h + * @ingroup OSAL + * @brief File common + * @note This file declares functions and types used by both the file + * writer and file reader. + ************************************************************************ +*/ + + +#ifndef M4OSA_FILECOMMON_H +#define M4OSA_FILECOMMON_H + +#include "M4OSA_Types.h" +#include "M4OSA_Time.h" +#include "M4OSA_Error.h" +#include "M4OSA_OptionID.h" + + + +/*#define M4OSA_FILE_POS_64_BITS_SUPPORTED*/ /*Means M4OSA_Int64 is used*/ + +#ifndef M4OSA_FILE_POS_64_BITS_SUPPORTED +#define M4OSA_FILE_POS_32_BITS_SUPPORTED /*Means M4OSA_Int32 is used*/ +#endif /*M4OSA_FILE_POS_64_BITS_SUPPORTED*/ + + + +#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED +typedef M4OSA_Int64 M4OSA_FilePosition; +#endif +#ifdef M4OSA_FILE_POS_32_BITS_SUPPORTED +typedef M4OSA_Int32 M4OSA_FilePosition; +#endif + +/** This enum defines the application mode access. + * ie, the application uses a file descriptor to read or to write or + * both to read and write at the same time. + * This structure is used for MM project only. It enables to read and write to a file + * with one descriptor. + */ +typedef enum +{ + M4OSA_kDescNoneAccess = 0x00, + M4OSA_kDescReadAccess = 0x01, /** The Descriptor reads only from the file */ + M4OSA_kDescWriteAccess = 0x02, /** The Descriptor writes only from the file*/ + M4OSA_kDescRWAccess = 0x03 /** The Descriptor reads and writes from/in the file*/ +} M4OSA_DescrModeAccess; + + +/** This enum defines the file mode access. Both text mode as binary mode + cannot be set together.*/ +typedef enum +{ + /** The file must be accessed in read only mode*/ + M4OSA_kFileRead = 0x01, + /** The file must be accessed in write only mode*/ + M4OSA_kFileWrite = 0x02, + /** The file must be accessed in append mode (An existing file must + be available to append data)*/ + M4OSA_kFileAppend = 0x04, + /** If the file does not exist, it will be created*/ + M4OSA_kFileCreate = 0x08, + /** Data are processed as binary one, there is no data management*/ + M4OSA_kFileIsTextMode = 0x10 +} M4OSA_FileModeAccess; + + +/** This type is used to store a date.*/ +typedef struct +{ + /** Time scale (tick number per second)*/ + M4OSA_UInt32 timeScale; + /** Date expressed in the time scale*/ + M4OSA_Time time; + /** Year of the absolute time (1900, 1970 or 2000)*/ + M4OSA_UInt32 referenceYear; +} M4OSA_Date; + + +/** This strucure defines the file attributes*/ +typedef struct +{ + /** The file mode access*/ + M4OSA_FileModeAccess modeAccess; + /** The creation date*/ + M4OSA_Date creationDate; + /** The last modification date*/ + M4OSA_Date modifiedDate; + /** The last access date (read)*/ + M4OSA_Date lastAccessDate; +} M4OSA_FileAttribute; + + + +/** This enum defines the seek behavior*/ +typedef enum M4OSA_FileSeekAccessMode +{ + /** Relative to the beginning of the file*/ + M4OSA_kFileSeekBeginning = 0x01, + /** Relative to the end of the file*/ + M4OSA_kFileSeekEnd = 0x02, + /** Relative to the current file position*/ + M4OSA_kFileSeekCurrent = 0x03 +} M4OSA_FileSeekAccessMode; + + +/* Error codes */ +#define M4ERR_FILE_NOT_FOUND M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_COMMON, 0x000001) +#define M4ERR_FILE_LOCKED M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_COMMON, 0x000002) +#define M4ERR_FILE_BAD_MODE_ACCESS M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_COMMON, 0x000003) +#define M4ERR_FILE_INVALID_POSITION M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_COMMON, 0x000004) + + +#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED + +#define M4OSA_FPOS_SET(fpos_a, fpos_b)\ + M4OSA_INT64_SET(fpos_a, fpos_b) + +#define M4OSA_FPOS_ADD(fpos_result, fpos_a, fpos_b)\ + M4OSA_INT64_ADD(fpos_result, fpos_a, fpos_b) + +#define M4OSA_FPOS_SUB(fpos_result, fpos_a, fpos_b)\ + M4OSA_INT64_SUB(fpos_result, fpos_a, fpos_b) + +#define M4OSA_FPOS_ADD_CONST_UINT32(fpos_out, fpos_in, i32_in)\ + { M4OSA_Int64 i64_in;\ + M4OSA_INT64_FROM_INT32(i64_in, i32_in);\ + M4OSA_INT64_ADD(fpos_out, fpos_in, i64_in); } + +#define M4OSA_FPOS_SUB_CONST_UINT32(fpos_out, fpos_in, i32_in)\ + { M4OSA_Int64 i64_in;\ + M4OSA_INT64_FROM_INT32(i64_in, i32_in);\ + M4OSA_INT64_SUB(fpos_out, fpos_in, i64_in); } + +#define M4OSA_FPOS_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value)\ + M4OSA_INT64_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value) + +#define M4OSA_FPOS_SCALAR_DIVISION(fpos_result, fpos_a, i32_value)\ + M4OSA_INT64_SCALAR_DIVISION(fpos_result, fpos_a, i32_value) + +#define M4OSA_FPOS_COMPARE(fpos_a, fpos_b)\ + M4OSA_INT64_COMPARE(fpos_a, fpos_b) + +#define M4OSA_FILE_POSITION_TO_INT(fpos, ipos)\ + M4OSA_INT64_SET(ipos, fpos) + +#define M4OSA_INT_TO_FILE_POSITION(ipos, fpos)\ + M4OSA_FPOS_SET(fpos, ipos) + +#define M4OSA_FPOS_IS_POSITIVE(fpos_value)\ + M4OSA_INT64_IS_POSITIVE(fpos_value) + +#define M4OSA_FPOS_NEG(fpos_result, fpos_value)\ + M4OSA_INT64_NEG(fpos_result, fpos_value) + +#define M4OSA_FPOS_ABS(fpos_result, fpos_value)\ + M4OSA_INT64_ABS(fpos_result, fpos_value) + +#define M4OSA_FPOS_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ + M4OSA_INT64_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) + +#define M4OSA_FPOS_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ + M4OSA_INT64_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) + +#endif + +#ifdef M4OSA_FILE_POS_32_BITS_SUPPORTED + +#define M4OSA_FPOS_SET(fpos_a, fpos_b)\ + M4OSA_INT32_SET(fpos_a, fpos_b) + +#define M4OSA_FPOS_ADD(fpos_result, fpos_a, fpos_b)\ + M4OSA_INT32_ADD(fpos_result, fpos_a, fpos_b) + +#define M4OSA_FPOS_SUB(fpos_result, fpos_a, fpos_b)\ + M4OSA_INT32_SUB(fpos_result, fpos_a, fpos_b) + +#define M4OSA_FPOS_ADD_CONST_UINT32(fpos_out, fpos_in, i32_in)\ + M4OSA_FPOS_ADD(fpos_out, fpos_in, i32_in) + +#define M4OSA_FPOS_SUB_CONST_UINT32(fpos_out, fpos_in, i32_in)\ + M4OSA_FPOS_SUB(fpos_out, fpos_in, i32_in) + +#define M4OSA_FPOS_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value)\ + M4OSA_INT32_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value) + +#define M4OSA_FPOS_SCALAR_DIVISION(fpos_result, fpos_a, i32_value)\ + M4OSA_INT32_SCALAR_DIVISION(fpos_result, fpos_a, i32_value) + +#define M4OSA_FPOS_COMPARE(fpos_a, fpos_b)\ + M4OSA_INT32_COMPARE(fpos_a, fpos_b) + +#define M4OSA_FILE_POSITION_TO_INT(fpos, ipos)\ + M4OSA_INT32_SET(ipos, fpos) + +#define M4OSA_INT_TO_FILE_POSITION(ipos, fpos)\ + M4OSA_FPOS_SET(fpos, ipos) + +#define M4OSA_FPOS_IS_POSITIVE(fpos_value)\ + M4OSA_INT32_IS_POSITIVE(fpos_value) + +#define M4OSA_FPOS_NEG(fpos_result, fpos_value)\ + M4OSA_INT32_NEG(fpos_result, fpos_value) + +#define M4OSA_FPOS_ABS(fpos_result, fpos_value)\ + M4OSA_INT32_ABS(fpos_result, fpos_value) + +#define M4OSA_FPOS_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ + M4OSA_INT32_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) + +#define M4OSA_FPOS_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ + M4OSA_INT32_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) + +#endif + + + +#endif /*M4OSA_FILECOMMON_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h b/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h new file mode 100755 index 0000000..f3064a7 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h @@ -0,0 +1,112 @@ +/* + * 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_FileCommon_priv.h + * @ingroup OSAL + * @brief File common private for Android + * @note This file declares functions and types used by both the file + * writer and file reader. + ************************************************************************ +*/ + +#ifndef M4OSA_FILECOMMON_PRIV_H +#define M4OSA_FILECOMMON_PRIV_H + + +#include "M4OSA_FileCommon.h" +#include <stdio.h> + +#define M4OSA_isAccessModeActived(compound_mode_access,elementary_mode_access)\ + (((compound_mode_access)&(elementary_mode_access))? 1:0) + + +typedef enum M4OSA_LastSeek +{ + SeekNone, + SeekRead, + SeekWrite +} M4OSA_LastSeek; + +/** This structure defines the file context*/ +typedef struct { + M4OSA_UInt32 coreID_read; + M4OSA_UInt32 coreID_write; +#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED + /** The file handler */ + M4OSA_Int32 file_desc; +#else + FILE* file_desc; +#endif /* M4OSA_FILE_POS_64_BITS_SUPPORTED */ + /** The name of the URL */ + M4OSA_Char* url_name; + /** The name of the file */ + M4OSA_Char* file_name; + /** The size in bytes of the file */ + M4OSA_FilePosition file_size; + /** The file mode access used to open the file */ + M4OSA_FileModeAccess access_mode; + M4OSA_LastSeek current_seek; + M4OSA_FilePosition read_position; + M4OSA_FilePosition write_position; + M4OSA_Bool b_is_end_of_file; + +#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE + M4OSA_Context semaphore_context; +#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */ + + + /* These two variables were added to manage case where a file + * is opened in read and write mode with one descriptor */ + M4OSA_DescrModeAccess m_DescrModeAccess; + M4OSA_UInt32 m_uiLockMode; + + +} M4OSA_FileContext; + + + +M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, + M4OSA_Context* context, + M4OSA_Char* URL, + M4OSA_FileModeAccess fileModeAccess); + +M4OSA_ERR M4OSA_fileCommonClose(M4OSA_UInt16 core_id, + M4OSA_Context context); + +M4OSA_ERR M4OSA_fileCommonGetAttribute(M4OSA_Context context, + M4OSA_FileAttribute* attribute); + +M4OSA_ERR M4OSA_fileCommonGetURL(M4OSA_Context context, + M4OSA_Char** url); + +M4OSA_ERR M4OSA_fileCommonGetFilename(M4OSA_Char* url, + M4OSA_Char** filename); + +M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position); + +#ifdef UTF_CONVERSION +M4OSA_ERR M4OSA_ToUTF8_OSAL (M4OSA_Void *pBufferIn, + M4OSA_UInt8 *pBufferOut, + M4OSA_UInt32 *bufferOutSize); +#endif /*UTF_CONVERSION*/ + + +#endif /*M4OSA_FILECOMMON_PRIV_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileExtra.h b/libvideoeditor/osal/inc/M4OSA_FileExtra.h new file mode 100755 index 0000000..0c9bac2 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileExtra.h @@ -0,0 +1,70 @@ +/* + * 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_FileExtra.h */ +/* @ingroup OSAL */ +/************************************************************************/ + + +#ifndef M4OSA_FILE_EXTRA_H +#define M4OSA_FILE_EXTRA_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_FileCommon.h" +/* size of the copy buffer (in bytes) for M4OSA_fileExtraCopy */ +#define BUFFER_COPY_SIZE 1024 + +typedef enum +{ + M4OSA_TypeInvalid = 0, + M4OSA_TypeFile, + M4OSA_TypeDir +} M4OSA_EntryType; + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSA_ERR M4OSA_fileExtraDelete(const M4OSA_Char* url); + +M4OSA_ERR M4OSA_fileExtraCopy(M4OSA_Char* srcUrl, M4OSA_Char* dstUrl); + +M4OSA_ERR M4OSA_fileExtraRename(M4OSA_Char* srcUrl, M4OSA_Char* dstUrl); + +M4OSA_ERR M4OSA_fileExtraChangeCurrentDir(const M4OSA_Char* url); + +M4OSA_ERR M4OSA_fileExtraCreateDir(const M4OSA_Char* pUrl); + +M4OSA_ERR M4OSA_fileExtraRemoveDir(const M4OSA_Char* pUrl); + +M4OSA_UInt32 M4OSA_fileExtraGetFreeSpace(const M4OSA_Char* pUrl); + +M4OSA_UInt32 M4OSA_fileExtraGetTotalSpace(const M4OSA_Char* pUrl); + +M4OSA_EntryType M4OSA_fileExtraGetType(const M4OSA_Char* pUrl); + +M4OSA_ERR M4OSA_fileExtrafTruncate(M4OSA_Context context, M4OSA_FilePosition length); + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_FILE_EXTRA_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileReader.h b/libvideoeditor/osal/inc/M4OSA_FileReader.h new file mode 100755 index 0000000..f0c75ff --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileReader.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. + */ +/** + ************************************************************************ + * @file M4OSA_FileReader.h + * @ingroup OSAL + * @brief File reader + * @note This file declares functions and types to read a file. + ************************************************************************ +*/ + + +#ifndef M4OSA_FILEREADER_H +#define M4OSA_FILEREADER_H + + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_FileCommon.h" +#include "M4OSA_Memory.h" + + + +/** This enum defines the option ID to be used in M4OSA_FileReadGetOption() + and M4OSA_FileReadSetOption()*/ +typedef enum M4OSA_FileReadOptionID +{ + /** Get the file size (M4OSA_fpos*)*/ + M4OSA_kFileReadGetFileSize + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_READER, 0x01), + + /** Get the file attributes (M4OSA_FileAttribute*)*/ + M4OSA_kFileReadGetFileAttribute + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_READER, 0x02), + + /** Get the file URL, provided by the M4OSA_FileReadOpen (M4OSA_Char*)*/ + M4OSA_kFileReadGetURL + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_READER, 0x03), + + /** Get the file position (M4OSA_fpos*)*/ + M4OSA_kFileReadGetFilePosition + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_READER, 0x04), + + /** Check end of file: TRUE if the EOF has been reached, FALSE else + (M4OSA_Bool*)*/ + M4OSA_kFileReadIsEOF + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_READER, 0x05), + + /** Check lock of file */ + M4OSA_kFileReadLockMode + = M4OSA_OPTION_ID_CREATE(M4_READWRITE, M4OSA_FILE_READER, 0x06) + +} M4OSA_FileReadOptionID; + + + + + +/** This structure stores the set of the function pointer to access to a + file in read mode*/ +typedef struct +{ + M4OSA_ERR (*openRead) (M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); + + M4OSA_ERR (*readData) (M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32* size); + + M4OSA_ERR (*seek) (M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position); + + M4OSA_ERR (*closeRead) (M4OSA_Context context); + + M4OSA_ERR (*setOption) (M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption optionValue); + + M4OSA_ERR (*getOption) (M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption *optionValue); +} M4OSA_FileReadPointer; + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadOpen (M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadData (M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32* size); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadSeek (M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadClose (M4OSA_Context context); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadGetOption (M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption *optionValue); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileReadSetOption (M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption optionValue); + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_FILEREADER_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileReaderRam.h b/libvideoeditor/osal/inc/M4OSA_FileReaderRam.h new file mode 100755 index 0000000..0480192 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileReaderRam.h @@ -0,0 +1,75 @@ +/* + * 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_FileReaderRam.h + * @ingroup OSAL + * @note This file implements functions to read a "file" stored in RAM. + ****************************************************************************** +*/ + + + +#ifndef M4OSA_FILEREADERRAM_H +#define M4OSA_FILEREADERRAM_H + +#include "M4OSA_FileReader.h" + +/** + ****************************************************************************** + * structure M4FI_FileReaderRam_Descriptor + * @brief This structure defines the File descriptor (public) + * @note This structure is used to store the pointer to the data in memory + * @note and its size + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_MemAddr8 pFileDesc; /* Pointer on file data */ + M4OSA_Int32 dataSize; /* Size of data */ +} M4OSA_FileReaderRam_Descriptor; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* reader API : RAM functions */ +M4OSA_ERR M4OSA_fileReadRamOpen( M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess ); +M4OSA_ERR M4OSA_fileReadRamData( M4OSA_Context context, + M4OSA_MemAddr8 buffer, + M4OSA_UInt32* size ); +M4OSA_ERR M4OSA_fileReadRamSeek( M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position ); +M4OSA_ERR M4OSA_fileReadRamClose( M4OSA_Context context ); +M4OSA_ERR M4OSA_fileReadRamGetOption( M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption *optionValue ); +M4OSA_ERR M4OSA_fileReadRamSetOption( M4OSA_Context context, + M4OSA_FileReadOptionID optionID, + M4OSA_DataOption optionValue ); + + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_FILEREADERRAM_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileReader_priv.h b/libvideoeditor/osal/inc/M4OSA_FileReader_priv.h new file mode 100755 index 0000000..be2af9a --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileReader_priv.h @@ -0,0 +1,39 @@ +/* + * 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_FileReader_priv.h + * @ingroup OSAL + * @brief File reader private for Android + * @note + ************************************************************************ +*/ + +#ifndef M4OSA_FILEREADER_PRIV_H +#define M4OSA_FILEREADER_PRIV_H + + +/** Those define enable/disable option ID*/ + +#define M4OSA_OPTIONID_FILE_READ_GET_FILE_SIZE M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_READ_GET_FILE_ATTRIBUTE M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_READ_GET_URL M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_READ_GET_FILE_POSITION M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_READ_IS_EOF M4OSA_TRUE + +#endif /*M4OSA_FILEREADER_PRIV_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileWriter.h b/libvideoeditor/osal/inc/M4OSA_FileWriter.h new file mode 100755 index 0000000..b8ba553 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileWriter.h @@ -0,0 +1,136 @@ +/* + * 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_FileWriter.h + * @ingroup OSAL + * @brief File writer + * @note This file declares functions and types to write in a file. + ************************************************************************ +*/ + + +#ifndef M4OSA_FILEWRITER_H +#define M4OSA_FILEWRITER_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_FileCommon.h" +#include "M4OSA_Memory.h" + + +/** This enum defines the option ID to be used in M4OSA_FileWriteGetOption() +and M4OSA_FileWriteSetOption()*/ +typedef enum +{ + /** Get the file URL, provided by the M4OSA_FileWriteOpen (M4OSA_Char*)*/ + M4OSA_kFileWriteGetURL + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_WRITER, 0x01), + + /** Get the file attributes (M4OSA_FileAttribute*)*/ + M4OSA_kFileWriteGetAttribute + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_WRITER, 0x02), + + /** Get the reader context for read & write file. (M4OSA_Context*)*/ + M4OSA_kFileWriteGetReaderContext + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_WRITER, 0x03), + + M4OSA_kFileWriteGetFilePosition + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_WRITER, 0x04), + + M4OSA_kFileWriteGetFileSize + = M4OSA_OPTION_ID_CREATE(M4_READ, M4OSA_FILE_WRITER, 0x05), + + + M4OSA_kFileWriteLockMode + = M4OSA_OPTION_ID_CREATE(M4_READWRITE, M4OSA_FILE_WRITER, 0x06), + + + /** Check lock of file */ + M4OSA_kFileWriteDescMode + = M4OSA_OPTION_ID_CREATE(M4_READWRITE, M4OSA_FILE_WRITER, 0x07) +} M4OSA_FileWriteOptionID; + + +/** This structure stores the set of the function pointer to access to a file + in read mode*/ +typedef struct +{ + M4OSA_ERR (*openWrite) (M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); + + M4OSA_ERR (*writeData) (M4OSA_Context context, + M4OSA_MemAddr8 data, + M4OSA_UInt32 size); + + M4OSA_ERR (*seek) (M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position); + + M4OSA_ERR (*Flush) (M4OSA_Context context); + M4OSA_ERR (*closeWrite) (M4OSA_Context context); + M4OSA_ERR (*setOption) (M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption optionValue); + + M4OSA_ERR (*getOption) (M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption* optionValue); +} M4OSA_FileWriterPointer; + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteOpen (M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteData (M4OSA_Context context, + M4OSA_MemAddr8 data, + M4OSA_UInt32 size); + +/* Pierre Lebeaupin 2008/04/29: WARNING! the feature of file*Seek which returns +the position in the file (from the beginning) after the seek in the "position" +pointer has been found to be unreliably (or sometimes not at all) implemented +in some OSALs, so relying on it is strongly discouraged, unless you really want +to have a pizza evening. */ +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteSeek (M4OSA_Context context, + M4OSA_FileSeekAccessMode seekMode, + M4OSA_FilePosition* position); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteClose (M4OSA_Context context); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteFlush (M4OSA_Context context); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteGetOption (M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption* optionValue); + +M4OSAL_FILE_EXPORT_TYPE M4OSA_ERR M4OSA_fileWriteSetOption (M4OSA_Context context, + M4OSA_OptionID optionID, + M4OSA_DataOption optionValue); + +#ifdef __cplusplus +} +#endif + + +#endif /*M4OSA_FILEWRITER_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileWriterRam.h b/libvideoeditor/osal/inc/M4OSA_FileWriterRam.h new file mode 100755 index 0000000..bc19a05 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileWriterRam.h @@ -0,0 +1,77 @@ +/* + * 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_FileWriterRam.h + * @ingroup OSAL + * @brief File writer to RAM + * @note This file implements functions to write a "file" in RAM. + ****************************************************************************** +*/ + + +#ifndef M4OSA_FILEWRITERRAM_H +#define M4OSA_FILEWRITERRAM_H + +#include "M4OSA_FileWriter.h" + + +/** + ****************************************************************************** + * structure M4OSA_FileWriterRam_Descriptor + * @brief This structure defines the File descriptor (public) + * @note This structure is used to store the pointer to the data in memory + * @note and its size + ****************************************************************************** +*/ +typedef struct +{ + M4OSA_MemAddr8 pFileDesc; /* Pointer on file data */ + M4OSA_Int32 dataSize; /* Size of data */ +} M4OSA_FileWriterRam_Descriptor; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Writer API : RAM functions */ +M4OSA_ERR M4OSA_fileWriteRamOpen(M4OSA_Context* context, + M4OSA_Void* fileDescriptor, + M4OSA_UInt32 fileModeAccess); +M4OSA_ERR M4OSA_fileWriteRamData(M4OSA_Context context, + M4OSA_MemAddr8 data, + M4OSA_UInt32 Size); +M4OSA_ERR M4OSA_fileWriteRamSeek(M4OSA_Context context, + M4OSA_FileSeekAccessMode SeekMode, + M4OSA_FilePosition* position); +M4OSA_ERR M4OSA_fileWriteRamClose(M4OSA_Context context); +M4OSA_ERR M4OSA_fileWriteRamFlush(M4OSA_Context context); +M4OSA_ERR M4OSA_fileWriteRamSetOption(M4OSA_Context context, + M4OSA_OptionID OptionID, + M4OSA_DataOption OptionValue); +M4OSA_ERR M4OSA_fileWriteRamGetOption(M4OSA_Context context, + M4OSA_OptionID OptionID, + M4OSA_DataOption* optionValue); + + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_FILEWRITERRAM_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_FileWriter_priv.h b/libvideoeditor/osal/inc/M4OSA_FileWriter_priv.h new file mode 100755 index 0000000..157d176 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_FileWriter_priv.h @@ -0,0 +1,38 @@ +/* + * 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_FileWriter_priv.h + * @ingroup OSAL + * @brief File writer private for Android +************************************************************************ +*/ + +#ifndef M4OSA_FILEWRITER_PRIV_H +#define M4OSA_FILEWRITER_PRIV_H + + +/** Those define enable/disable option ID*/ + +#define M4OSA_OPTIONID_FILE_WRITE_GET_FILE_SIZE M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_WRITE_GET_FILE_ATTRIBUTE M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_WRITE_GET_READER_CONTEXT M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_WRITE_GET_FILE_POSITION M4OSA_TRUE +#define M4OSA_OPTIONID_FILE_WRITE_GET_URL M4OSA_TRUE + +#endif /*M4OSA_FILEWRITER_PRIV_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Memory.h b/libvideoeditor/osal/inc/M4OSA_Memory.h new file mode 100755 index 0000000..d0bb49c --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Memory.h @@ -0,0 +1,74 @@ +/* + * 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_Memory.h + * @ingroup OSAL + * @brief Memory allocation + * @note This file defines function prototypes to allocate + * and free memory. + ************************************************************************ +*/ + +#ifndef M4OSA_MEMORY_H +#define M4OSA_MEMORY_H + + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" /*for M4OSA_CoreID definition*/ + +typedef M4OSA_Int32* M4OSA_MemAddr32; +typedef M4OSA_Int8* M4OSA_MemAddr8; + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr32 M4OSA_malloc (M4OSA_UInt32 size, + M4OSA_CoreID coreID, + M4OSA_Char* string); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Void M4OSA_free (M4OSA_MemAddr32 address); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Void M4OSA_memset (M4OSA_MemAddr8 address, + M4OSA_UInt32 size, + M4OSA_UInt8 value); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Void M4OSA_memcpy (M4OSA_MemAddr8 outputBlock, + M4OSA_MemAddr8 inputBlock, M4OSA_UInt32 size); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr8 M4OSA_memmove(M4OSA_MemAddr8 outputBlock, + M4OSA_MemAddr8 inputBlock, + M4OSA_UInt32 size); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Int32 M4OSA_memcmp (M4OSA_MemAddr8 address1, + M4OSA_MemAddr8 address2, M4OSA_UInt32 size); + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_ERR M4OSA_randInit(void); + + +M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_ERR M4OSA_rand(M4OSA_Int32* out_value, + M4OSA_UInt32 max_value); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libvideoeditor/osal/inc/M4OSA_Mutex.h b/libvideoeditor/osal/inc/M4OSA_Mutex.h new file mode 100755 index 0000000..92a416f --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Mutex.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. + */ +/** + ************************************************************************ + * @file M4OSA_Mutex.h + * @ingroup OSAL + * @brief mutex API + ************************************************************************ +*/ + + +#ifndef M4OSA_MUTEX_H +#define M4OSA_MUTEX_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + + +#ifdef __cplusplus +extern "C" +{ + +#endif + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_mutexOpen( M4OSA_Context* context ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_mutexLock( M4OSA_Context context, + M4OSA_UInt32 timeout ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_mutexUnlock( M4OSA_Context context ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_mutexClose( M4OSA_Context context ); + +#ifdef __cplusplus +} +#endif + + +#endif /*M4OSA_MUTEX_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_OptionID.h b/libvideoeditor/osal/inc/M4OSA_OptionID.h new file mode 100755 index 0000000..b937644 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_OptionID.h @@ -0,0 +1,73 @@ +/* + * 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_OptionID.h + * @ingroup OSAL + * @brief Option ID macros + * @note This file defines macros to generate and analyze option ID. + * Option ID is used by M4YYY_ZZsetOption() and + * M4YYY_ZZgetOption() functions. + ************************************************************************ +*/ + +#ifndef M4OSA_OPTIONID_H +#define M4OSA_OPTIONID_H + + +#include "M4OSA_Types.h" + +/** M4OSA_OptionID is a 32 bits unsigned integer. +- Right access (2 bits): Some options may have read only, write only or read + and write access +- Core ID (14 bits): It is a unique ID for each core component +- SubOption ID (16 bits): To select which option in a specific core component +*/ +typedef M4OSA_UInt32 M4OSA_OptionID; +typedef void* M4OSA_DataOption; + +#define M4_READ 0x01 +#define M4_WRITE 0x02 +#define M4_READWRITE 0x03 + +/* Macro to process M4OSA_OptionID */ + +/** This macro creates an optionID given read/write access, + coreID and SubOptionID*/ +#define M4OSA_OPTION_ID_CREATE(right, coreID, errorID)\ + (M4OSA_Int32)((((((M4OSA_UInt32)right)&0x03)<<30))+((((M4OSA_UInt32)coreID)&0x003FFF)<<16)+(((M4OSA_UInt32)errorID)&0x00FFFF)) + +/** This macro splits an optionID into read/write access, + coreID and SubOptionID*/ +#define M4OSA_OPTION_ID_SPLIT(optionID, right, coreID, errorID)\ + { right=(M4OSA_UInt8)((optionID)>>30);\ + coreID=(M4OSA_UInt16)(((optionID)>>16)&0x00003FFF);\ + errorID=(M4OSA_UInt32)((optionID)&0x0000FFFF); } + +/** This macro returns 1 if the optionID is writable, 0 otherwise*/ +#define M4OSA_OPTION_ID_IS_WRITABLE(optionID) ((((optionID)>>30)&M4_WRITE)!=0) + +/** This macro returns 1 if the optionID is readable, 0 otherwise*/ +#define M4OSA_OPTION_ID_IS_READABLE(optionID) ((((optionID)>>30)&M4_READ)!=0) + +/** This macro returns 1 if the optionID has its core ID equal to 'coreID', 0 otherwise*/ +#define M4OSA_OPTION_ID_IS_COREID(optionID, coreID)\ + (((((optionID)>>16)&0x003FFF) == (coreID)) ? M4OSA_TRUE:M4OSA_FALSE) + + +#endif /*M4OSA_OPTIONID_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Semaphore.h b/libvideoeditor/osal/inc/M4OSA_Semaphore.h new file mode 100755 index 0000000..fe73673 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Semaphore.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 M4OSA_Semaphore.h + * @ingroup OSAL + * @brief semaphore API + ************************************************************************ +*/ + +#ifndef M4OSA_SEMAPHORE_H +#define M4OSA_SEMAPHORE_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_semaphoreOpen( M4OSA_Context* context, + M4OSA_UInt32 initialNumber ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_semaphorePost( M4OSA_Context context ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_semaphoreWait( M4OSA_Context context, + M4OSA_Int32 timeout ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_semaphoreClose( M4OSA_Context context ); + +#ifdef __cplusplus +} +#endif + + +#endif /*M4OSA_SEMAPHORE_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_String.h b/libvideoeditor/osal/inc/M4OSA_String.h new file mode 100755 index 0000000..3fcf4ed --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_String.h @@ -0,0 +1,267 @@ +/* + * 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_String.h + * @ingroup OSAL + * @brief public definition for string library + ************************************************************************ +*/ + +#ifndef _M4OSA_STRING_H_ +#define _M4OSA_STRING_H_ + +#include "M4OSA_Types.h" +#include "M4OSA_FileCommon.h" +#include "M4OSA_Time.h" +#include "M4OSA_CharStar.h" + + + +typedef void* M4OSA_String; + +typedef enum +{ + M4OSA_kstrAll = 0, + M4OSA_kstrBegin, + M4OSA_kstrEnd +} M4OSA_strMode; + +/* types definition */ +typedef enum +{ + M4OSA_kstrDec = M4OSA_kchrDec, + M4OSA_kstrHexa = M4OSA_kchrHexa, + M4OSA_kstrOct = M4OSA_kchrOct +} M4OSA_strNumBase; + +/* Error and Warnings codes */ +#define M4ERR_STR_BAD_STRING M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000001) +#define M4ERR_STR_CONV_FAILED M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000002) +#define M4ERR_STR_OVERFLOW M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000003) +#define M4ERR_STR_BAD_ARGS M4OSA_ERR_CREATE(M4_ERR,M4OSA_STRING,0x000004) + +#define M4WAR_STR_OVERFLOW M4OSA_ERR_CREATE(M4_WAR,M4OSA_STRING,0x000001) +#define M4WAR_STR_NOT_FOUND M4OSA_ERR_CREATE(M4_WAR,M4OSA_STRING,0x000002) + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCreate( M4OSA_String* pstr); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strReset( M4OSA_String str); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strDestroy( M4OSA_String str); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetCharContent( M4OSA_String str, + M4OSA_Char* pchar); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetCharContent( M4OSA_String str, + M4OSA_Char** ppchar); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetChar( M4OSA_String str, + M4OSA_Char c); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetChar( M4OSA_String str, + M4OSA_Char* pc); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt8( M4OSA_String str, + M4OSA_Int8 i8, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt8( M4OSA_String str, + M4OSA_Int8* pi8, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt8( M4OSA_String str, + M4OSA_UInt8 ui8, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt8( M4OSA_String str, + M4OSA_UInt8* pui8, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt16( M4OSA_String str, + M4OSA_Int16 i16, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt16( M4OSA_String str, + M4OSA_Int16* pi16, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt16( M4OSA_String str, + M4OSA_UInt16 ui16, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt16( M4OSA_String str, + M4OSA_UInt16* pui16, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt32( M4OSA_String str, + M4OSA_Int32 i32, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt32( M4OSA_String str, + M4OSA_Int32* pi32, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUInt32( M4OSA_String str, + M4OSA_UInt32 ui32, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetUInt32( M4OSA_String str, + M4OSA_UInt32* pui32, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetDouble( M4OSA_String str, + M4OSA_Double d); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetDouble( M4OSA_String str, + M4OSA_Double* pd); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetInt64( M4OSA_String str, + M4OSA_Int64 i64, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetInt64( M4OSA_String str, + M4OSA_Int64* pi64, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetFilePosition( M4OSA_String str, + M4OSA_FilePosition fpos, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetFilePosition( M4OSA_String str, + M4OSA_FilePosition* pfpos, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetTime( M4OSA_String str, + M4OSA_Time t, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetTime( M4OSA_String str, + M4OSA_Time* pt, + M4OSA_strNumBase base); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetLength( M4OSA_String str, + M4OSA_UInt32 *pui32); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strTruncate( M4OSA_String str, + M4OSA_UInt32 ui32_length); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCopy( M4OSA_String str_in, + M4OSA_String str_out); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCopySubStr( M4OSA_String str_out, + M4OSA_UInt32 ui32_pos, + M4OSA_String str_in, + M4OSA_UInt32 ui32_offset, + M4OSA_UInt32* ui32_num); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strConcat( M4OSA_String str_first, + M4OSA_String str_second); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strInsertSubStr( M4OSA_String str_out, + M4OSA_UInt32 ui32_pos, + M4OSA_String str_in, + M4OSA_UInt32 ui32_offset, + M4OSA_UInt32* pui32_num); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCompare( M4OSA_String str_in1, + M4OSA_String str_in2, + M4OSA_Int32* pi32_result); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCompareSubStr( M4OSA_String str_in1, + M4OSA_UInt32 ui32_offset1, + M4OSA_String str_in2, + M4OSA_UInt32 ui32_offset2, + M4OSA_UInt32* pui32_num, + M4OSA_Int32* pi32_result); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCaseCompare( M4OSA_String str_in1, + M4OSA_String str_in2, + M4OSA_Int32* pi32_result); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strCaseCompareSubStr( M4OSA_String str_in1, + M4OSA_UInt32 ui32_offset1, + M4OSA_String str_in2, + M4OSA_UInt32 ui32_offset2, + M4OSA_UInt32* pui32_num, + M4OSA_Int32* pi32_result); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSpan( M4OSA_String str_in, + M4OSA_Char* charset, + M4OSA_UInt32* pui32_result); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSpanComplement( M4OSA_String str_in, + M4OSA_Char* charset, + M4OSA_UInt32* pui32_pos); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindFirstChar( M4OSA_String str_in, + M4OSA_Char c, + M4OSA_UInt32* pui32_pos); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindLastChar( M4OSA_String str_in, + M4OSA_Char c, + M4OSA_UInt32* pui32_pos); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindFirstSubStr( M4OSA_String str_in1, + M4OSA_String str_in2, + M4OSA_UInt32* pui32_pos); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strFindLastSubStr( M4OSA_String str_in1, + M4OSA_String str_in2, + M4OSA_UInt32* pui32_pos); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetFirstToken( M4OSA_String str_in, + M4OSA_String str_delim, + M4OSA_String pstr_token); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strGetLastToken( M4OSA_String str_in, + M4OSA_String str_delim, + M4OSA_String pstr_token); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetUpperCase( M4OSA_String str); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetLowerCase( M4OSA_String str); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strDelSubStr( M4OSA_String str_in, + M4OSA_UInt32 ui32_offset, + M4OSA_UInt32* ui32_num); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strReplaceSubStr( M4OSA_String str_in, + M4OSA_String str_old, + M4OSA_String str_new, + M4OSA_strMode mode); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSprintf( M4OSA_String str, + M4OSA_Char* format, + ...); + +M4OSAL_STRING_EXPORT_TYPE M4OSA_ERR M4OSA_strSetMinAllocationSize( M4OSA_String str, + M4OSA_UInt32 ui32_size); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libvideoeditor/osal/inc/M4OSA_String_priv.h b/libvideoeditor/osal/inc/M4OSA_String_priv.h new file mode 100755 index 0000000..3303c1d --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_String_priv.h @@ -0,0 +1,101 @@ +/* + * 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_String.h + * @ingroup OSAL + * @brief public definition for string library +************************************************************************ +*/ + + +#ifndef _M4OSA_STRING_PRIV_H +#define _M4OSA_STRING_PRIV_H + + +#include "M4OSA_Types.h" +#include "M4OSA_String.h" + +#include <stdarg.h> + +typedef struct +{ + /* string identifiant */ + M4OSA_UInt32 coreID; + /** data buffer */ + M4OSA_Char* pui8_buffer; + /** allocated size of the data buffer */ + M4OSA_UInt32 ui32_size; + /** size of valid data in the buffer */ + M4OSA_UInt32 ui32_length; +} M4OSA_strStruct; + + + +M4OSA_ERR M4OSA_strPrivRealloc( M4OSA_strStruct* str, + M4OSA_UInt32 ui32_length); + +M4OSA_ERR M4OSA_strPrivReallocCopy( M4OSA_strStruct* str, + M4OSA_UInt32 ui32_length); + +M4OSA_ERR M4OSA_strPrivSet( M4OSA_strStruct* str, + M4OSA_Char* pchar, + M4OSA_UInt32 ui32_length); + +M4OSA_ERR M4OSA_strPrivDuplicate( M4OSA_strStruct** ostr, + M4OSA_strStruct* istr); + +M4OSA_Int32 M4OSA_strPrivFindLastSubStr( M4OSA_strStruct* str1, + M4OSA_strStruct* str2, + M4OSA_UInt32 ui32_pos); + +M4OSA_ERR M4OSA_strPrivSetAndRepleceStr( M4OSA_strStruct* istr, + M4OSA_UInt32 ui32_pos, + M4OSA_UInt32 olength, + M4OSA_Char* nbuff, + M4OSA_UInt32 nlength); + +M4OSA_ERR M4OSA_strPrivReplaceSameSizeStr( M4OSA_strStruct* istr, + M4OSA_strStruct* ostr, + M4OSA_strStruct* nstr, + M4OSA_strMode mode); + +M4OSA_ERR M4OSA_strPrivReplaceSmallerStr( M4OSA_strStruct* istr, + M4OSA_strStruct* ostr, + M4OSA_strStruct* nstr, + M4OSA_strMode mode); + +M4OSA_ERR M4OSA_strPrivReplaceBiggerStr( M4OSA_strStruct* istr, + M4OSA_strStruct* ostr, + M4OSA_strStruct* nstr, + M4OSA_strMode mode); + +M4OSA_ERR M4OSA_strPrivSPrintf( M4OSA_strStruct* str, + M4OSA_Char *format, + va_list marker); + + +#define M4OSA_CHECK_MALLOC(buff, string)\ + if(buff == M4OSA_NULL)\ + {\ + M4OSA_DEBUG(M4ERR_ALLOC, string);\ + return M4ERR_ALLOC;\ + }\ + + +#endif + diff --git a/libvideoeditor/osal/inc/M4OSA_Thread.h b/libvideoeditor/osal/inc/M4OSA_Thread.h new file mode 100755 index 0000000..183a9f3 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Thread.h @@ -0,0 +1,128 @@ +/* + * 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_Thread.h + * @ingroup OSAL + * @brief thread API + ************************************************************************ +*/ + + +#ifndef M4OSA_THREAD_H +#define M4OSA_THREAD_H + +#include "M4OSA_Types.h" +#include "M4OSA_Error.h" +#include "M4OSA_OptionID.h" + + +/* Definition of common error codes */ +#define M4ERR_THREAD_NOT_STARTED M4OSA_ERR_CREATE(M4_ERR,M4OSA_THREAD,0x000001) + + +typedef enum +{ + M4OSA_kThreadOpened = 0x100, + M4OSA_kThreadStarting = 0x200, + M4OSA_kThreadRunning = 0x300, + M4OSA_kThreadStopping = 0x400, + M4OSA_kThreadClosed = 0x500 +} M4OSA_ThreadState; + + + +typedef enum +{ + M4OSA_kThreadHighestPriority = 0x000, + M4OSA_kThreadHighPriority = 0x100, + M4OSA_kThreadNormalPriority = 0x200, + M4OSA_kThreadLowPriority = 0x300, + M4OSA_kThreadLowestPriority = 0x400 +} M4OSA_ThreadPriorityLevel; + + + +typedef enum +{ + M4OSA_ThreadStarted + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x01), + + M4OSA_ThreadStopped + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x02), + + M4OSA_ThreadPriority + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x03), + + M4OSA_ThreadName + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x04), + + M4OSA_ThreadStackSize + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x05), + + M4OSA_ThreadUserData + = M4OSA_OPTION_ID_CREATE(M4_READ|M4_WRITE, M4OSA_THREAD, 0x06) + +} M4OSA_ThreadOptionID; + + + +typedef M4OSA_ERR (*M4OSA_ThreadDoIt)(M4OSA_Void*); +typedef M4OSA_Void (*M4OSA_ThreadCallBack)(M4OSA_Context, M4OSA_Void*); + +#ifdef __cplusplus +extern "C" +{ +#endif + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncOpen( M4OSA_Context* context, + M4OSA_ThreadDoIt func ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncStart( M4OSA_Context context, + M4OSA_Void* param ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncStop( M4OSA_Context context ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncClose( M4OSA_Context context ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncGetState( M4OSA_Context context, + M4OSA_ThreadState* state ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSleep( M4OSA_UInt32 time ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncSetOption(M4OSA_Context context, + M4OSA_ThreadOptionID option, + M4OSA_DataOption value ); + + +M4OSAL_REALTIME_EXPORT_TYPE M4OSA_ERR M4OSA_threadSyncGetOption(M4OSA_Context context, + M4OSA_ThreadOptionID option, + M4OSA_DataOption* value ); + +#ifdef __cplusplus +} +#endif + + +#endif /*M4OSA_THREAD_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Thread_priv.h b/libvideoeditor/osal/inc/M4OSA_Thread_priv.h new file mode 100755 index 0000000..fb9a51a --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Thread_priv.h @@ -0,0 +1,64 @@ +/* + * 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_Thread_priv.h + * @ingroup OSAL + * @brief Thread private for Android + * @note + ************************************************************************ +*/ + +#ifndef M4OSA_THREAD_PRIV_H +#define M4OSA_THREAD_PRIV_H + + +#include "M4OSA_Types.h" + + +/* Context for the thread */ +typedef struct M4OSA_ThreadContext { + M4OSA_UInt32 coreID; /* thread context identifiant */ + pthread_t threadID; /* thread identifier. */ + M4OSA_Char* name; /* thread name */ + M4OSA_UInt32 stackSize; /* thread stackSize in bytes */ + M4OSA_ThreadDoIt func; /* thread function */ + M4OSA_Void* param; /* thread parameter */ +/* + M4OSA_Void* userData; / * thread user data * / +*/ + M4OSA_ThreadState state; /* thread automaton state */ + M4OSA_Context stateMutex; /* mutex for thread state management */ +/* + M4OSA_ThreadCallBack startCallBack; / * starting thread call back * / + M4OSA_ThreadCallBack stopCallBack; / * stopping thread call back * / +*/ + M4OSA_Context semStartStop; /* semaphore for start and stop do_it */ + M4OSA_ThreadPriorityLevel priority; /* thread priority level */ +} M4OSA_ThreadContext ; + + +/** Those define enable/disable option ID*/ +#define M4OSA_OPTIONID_THREAD_STARTED M4OSA_TRUE +#define M4OSA_OPTIONID_THREAD_STOPPED M4OSA_TRUE +#define M4OSA_OPTIONID_THREAD_PRIORITY M4OSA_TRUE +#define M4OSA_OPTIONID_THREAD_STACK_SIZE M4OSA_TRUE +#define M4OSA_OPTIONID_THREAD_NAME M4OSA_TRUE +#define M4OSA_OPTIONID_THREAD_USER_DATA M4OSA_TRUE + +#endif /*M4OSA_THREAD_PRIV_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Time.h b/libvideoeditor/osal/inc/M4OSA_Time.h new file mode 100755 index 0000000..984c243 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Time.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 M4OSA_Time.h + * @ingroup OSAL + * @brief Time macros + * @note This file defines time type and associated macros which must + * be used to manipulate time. + ************************************************************************ +*/ + +/* $Id: M4OSA_Time.h,v 1.2 2007/01/05 13:12:22 thenault Exp $ */ + +#ifndef M4OSA_TIME_H +#define M4OSA_TIME_H + + +#include "M4OSA_Types.h" + + +typedef M4OSA_Int64 M4OSA_Time; + + +/** This macro sets the unknown time value */ +#ifdef M4OSA_64BITS_SUPPORTED + #define M4OSA_TIME_SET_UNKNOWN(time) {time = 0x8000000000000000LL ;} +#endif /* M4OSA_64BITS_SUPPORTED */ + +#ifdef M4OSA_64BITS_COUPLE_INT + #define M4OSA_TIME_SET_UNKNOWN(time) {\ + time.major = 0x80000000 ;\ + time.minor = 0x00000000 ;} +#endif /* M4OSA_64BITS_COUPLE_INT */ + +#ifdef M4OSA_64BITS_NOT_SUPPORTED + #define M4OSA_TIME_SET_UNKNOWN(time) {time = 0x80000000;} +#endif /* M4OSA_64BITS_NOT_SUPPORTED */ + + +/** This macro returns 1 if the provided time is set to unknown time, + and 0 else.*/ +#ifdef M4OSA_64BITS_SUPPORTED + +#define M4OSA_TIME_IS_UNKNOWN(time) (((M4OSA_UInt64)(time) == 0x8000000000000000LL) ? 1 : 0) + +#elif defined M4OSA_64BITS_COUPLE_INT + +#define M4OSA_TIME_IS_UNKNOWN(time)\ + (( (M4OSA_INT64_GET_HIGH32(time) == M4OSA_unknownTimeMajor)\ + &&(M4OSA_INT64_GET_LOW32(time) == M4OSA_unknownTimeMinor) ) ? 1:0) + +#else /* M4OSA_64BITS_NOT_SUPPORTED */ + +#define M4OSA_TIME_IS_UNKNOWN(time) (((M4OSA_UInt32)(time) == 0x80000000) ? 1 : 0) + +#endif + + +/** This macro affects time2 to time1.*/ +#define M4OSA_TIME_SET(time1, time2)\ + M4OSA_INT64_SET(time1, time2) + + +/** This macro sets time from i32.*/ +#define M4OSA_TIME_FROM_INT32(time, i32)\ + M4OSA_INT64_FROM_INT32(time, i32) + + +/** This macro sets time from i32 ui32.*/ +#define M4OSA_TIME_FROM_INT32_UINT32(time, i32, ui32)\ + M4OSA_INT64_FROM_INT32_UINT32(time, i32, ui32) + + +/** This macro tests if time is positive*/ +#define M4OSA_TIME_IS_POSITIVE(time)\ + M4OSA_INT64_IS_POSITIVE(time) + + +/** This macro sets time_out = -time_in*/ +#define M4OSA_TIME_NEG(time_out, time_in)\ + M4OSA_INT64_NEG(time_out, time_in) + + +/** This macro sets time_out = |time_in|*/ +#define M4OSA_TIME_ABS(time_out, time_in)\ + M4OSA_INT64_ABS(time_out, time_in) + + +/** This macro adds the 2 provided times (time1 and time2), + and writes the result in result. Both times must have the same timescale.*/ +#define M4OSA_TIME_ADD(result, time1, time2)\ + M4OSA_INT64_ADD(result, time1, time2) + + +/** This macro subs the 2 provided times (time1 and time2), + and writes the result in result.*/ +#define M4OSA_TIME_SUB(result, time1, time2)\ + M4OSA_INT64_SUB(result, time1, time2) + + +/** This macro does a scalar product (result = time*value), + and writes the result in result.*/ +#define M4OSA_TIME_SCALAR_PRODUCT(result, time, value)\ + M4OSA_INT64_SCALAR_PRODUCT(result, time, value) + + +/** This macro does a scalar division (result= time / value), + and writes the result in result.*/ +#define M4OSA_TIME_SCALAR_DIVISION(result, time, value)\ + M4OSA_INT64_SCALAR_DIVISION(result, time, value) + + +/** This macro updates the time to the oldTimeScale to the newTimeScale. The + result (the nearest rounded to the min value) is stored in result value. */ +#define M4OSA_TIME_CHANGE_TIMESCALE(result, time, oldTimeScale, newTimeScale)\ + { M4OSA_Time t_tempTime1, t_tempTime2, t_tempTime3;\ + M4OSA_Int32 i32_quotient = newTimeScale/oldTimeScale;\ + M4OSA_Int32 i32_rest = newTimeScale%oldTimeScale;\ + M4OSA_INT64_SCALAR_PRODUCT(t_tempTime1, time, i32_quotient);\ + M4OSA_INT64_SCALAR_PRODUCT(t_tempTime2, time, i32_rest);\ + M4OSA_INT64_SCALAR_DIVISION(t_tempTime3, t_tempTime2, oldTimeScale);\ + M4OSA_INT64_ADD(result, t_tempTime1, t_tempTime3); } + + +/** This macro tests the 2 provided times (time1 & time2). + The result is either: + * @arg 1: if time1 is bigger than time2 + * @arg 0: if time2 is equal to time2 + * @arg -1: if time1 is smaller than time2 */ +#define M4OSA_TIME_COMPARE(time1, time2)\ + M4OSA_INT64_COMPARE(time1, time2) + + +/** This macro converts a time with a time scale to millisecond. + The result is a M4OSA_Double*/ +#define M4OSA_TIME_TO_MS(result, time, timescale)\ + { M4OSA_INT64_TO_DOUBLE(result, time);\ + result = (1000*result)/((M4OSA_Double)timescale); } + + +/** This macro converts a millisecond time to M4OSA_Time with the provided + timescale. The result (the nearest rounded to the min value) is stored + in time value.*/ +#define M4OSA_MS_TO_TIME(time, timescale, ms)\ + {M4OSA_INT64_FROM_DOUBLE(time, (ms*((M4OSA_Double)(timescale))/1000.0));} + + +#endif /*M4OSA_TIME_H*/ + diff --git a/libvideoeditor/osal/inc/M4OSA_Types.h b/libvideoeditor/osal/inc/M4OSA_Types.h new file mode 100755 index 0000000..250f131 --- /dev/null +++ b/libvideoeditor/osal/inc/M4OSA_Types.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 M4OSA_Types.h + * @ingroup OSAL + * @brief Abstraction types for Android + * @note This file redefines basic types which must be + * used to declare any variable. +************************************************************************ +*/ + + +#ifndef M4OSA_TYPES_H +#define M4OSA_TYPES_H + +#include <ctype.h> +#include "M4OSA_Export.h" +#ifdef __cplusplus +extern "C" { +#endif + +/*#define M4OSA_64BITS_SUPPORTED */ /* means long long is used */ +/*#define M4OSA_64BITS_COUPLE_INT */ /* means couple int32 is used */ +#define M4OSA_64BITS_NOT_SUPPORTED /* means Int32 is used */ + + +typedef signed char M4OSA_Bool; +typedef unsigned char M4OSA_UInt8; +typedef signed char M4OSA_Int8; +typedef unsigned short M4OSA_UInt16; +typedef signed short M4OSA_Int16; +typedef unsigned long M4OSA_UInt32; +typedef signed long M4OSA_Int32; + +typedef signed char M4OSA_Char; +typedef unsigned char M4OSA_UChar; + +typedef double M4OSA_Double; +typedef float M4OSA_Float; + +typedef unsigned char M4OSA_WChar; + +typedef void M4OSA_Void; + +typedef struct +{ + M4OSA_Int32 high; + M4OSA_Int32 low; +} M4OSA_CoupleInt32; + +#ifdef M4OSA_64BITS_SUPPORTED +typedef signed long long M4OSA_Int64; +typedef unsigned long long M4OSA_UInt64; +#endif + +#ifdef M4OSA_64BITS_COUPLE_INT +typedef struct +{ + M4OSA_Int32 major; + M4OSA_UInt32 minor; +} M4OSA_Int64; +typedef struct +{ + M4OSA_UInt32 major; + M4OSA_UInt32 minor; +} M4OSA_UInt64; +#endif + +#ifdef M4OSA_64BITS_NOT_SUPPORTED +typedef M4OSA_Int32 M4OSA_Int64; +typedef M4OSA_UInt32 M4OSA_UInt64; +#endif + +/* Min & max definitions*/ +#define M4OSA_UINT8_MIN 0 +#define M4OSA_UINT8_MAX 255 + +#define M4OSA_UINT16_MIN 0 +#define M4OSA_UINT16_MAX 65535 + +#define M4OSA_UINT32_MIN 0 +#define M4OSA_UINT32_MAX 0xFFFFFFFF + +#define M4OSA_INT8_MIN -128 +#define M4OSA_INT8_MAX 127 + +#define M4OSA_INT16_MIN -32768 +#define M4OSA_INT16_MAX 32767 + +#define M4OSA_INT32_MIN (-0x7FFFFFFF-1) +#define M4OSA_INT32_MAX 0x7FFFFFFF + +#define M4OSA_CHAR_MIN -128 +#define M4OSA_CHAR_MAX 127 + +#define M4OSA_UCHAR_MIN 0 +#define M4OSA_UCHAR_MAX 255 + +#ifdef M4OSA_64BITS_NOT_SUPPORTED + +#define M4OSA_UINT64_MIN M4OSA_UINT32_MIN +#define M4OSA_UINT64_MAX M4OSA_UINT32_MAX +#define M4OSA_INT64_MIN M4OSA_INT32_MIN +#define M4OSA_INT64_MAX M4OSA_INT32_MAX + +#else /* M4OSA_64BITS_NOT_SUPPORTED*/ + +#define M4OSA_UINT64_MIN 0 +#define M4OSA_UINT64_MAX 0xFFFFFFFFFFFFFFFFLL +#define M4OSA_INT64_MIN 0x8000000000000000LL +#define M4OSA_INT64_MAX 0x7FFFFFFFFFFFFFFFLL + +#endif /* M4OSA_64BITS_NOT_SUPPORTED*/ + +#define M4OSA_NULL 0x00 +#define M4OSA_TRUE 0x01 +#define M4OSA_FALSE 0x00 +#define M4OSA_WAIT_FOREVER 0xffffffff + +#define M4OSA_CONST const +#define M4OSA_INLINE inline + +/* Rollover offset of the clock */ +/* This value must be the one of M4OSA_clockGetTime */ +#define M4OSA_CLOCK_ROLLOVER M4OSA_INT32_MAX + +typedef void* M4OSA_Context; + + +/** It is a unique ID for each core component*/ +typedef M4OSA_UInt16 M4OSA_CoreID; + + +/* Macro to support big endian and little endian platform */ + +/* to translate a 16 bits to its Big Endian value*/ +#define M4OSA_INT16_TO_BE(ui16_host) ((((ui16_host) & (M4OSA_UInt16) 0x00ff) << 8) | \ + (((ui16_host) & (M4OSA_UInt16) 0xff00) >> 8) ) + +/* to translate a 32 bits to its Big Endian value */ +#define M4OSA_INT32_TO_BE(ui32_host) ((((ui32_host) & (M4OSA_UInt32) 0x000000ff) << 24) | \ + (((ui32_host) & (M4OSA_UInt32) 0x0000ff00) << 8) | \ + (((ui32_host) & (M4OSA_UInt32) 0x00ff0000) >> 8) | \ + (((ui32_host) & (M4OSA_UInt32) 0xff000000) >> 24)) + +/* to translate a 64 bits to its Big Endian value */ +#define M4OSA_INT64_TO_BE(ui64_host) ((((ui64_host) & (M4OSA_UInt64) 0x00000000000000ff) << 56) | \ + (((ui64_host) & (M4OSA_UInt64) 0x000000000000ff00) << 40) | \ + (((ui64_host) & (M4OSA_UInt64) 0x0000000000ff0000) << 24) | \ + (((ui64_host) & (M4OSA_UInt64) 0x00000000ff000000) << 8) | \ + (((ui64_host) & (M4OSA_UInt64) 0x000000ff00000000) >> 8) | \ + (((ui64_host) & (M4OSA_UInt64) 0x0000ff0000000000) >> 24) | \ + (((ui64_host) & (M4OSA_UInt64) 0x00ff000000000000) >> 40) | \ + (((ui64_host) & (M4OSA_UInt64) 0xff00000000000000) >> 56)) + +/* to translate a Big Endian 16 bits to its host representation */ +#define M4OSA_BE_TO_INT16(ui16_net) ((((ui16_net) & (M4OSA_UInt16) 0x00ff) << 8) | \ + (((ui16_net) & (M4OSA_UInt16) 0xff00) >> 8) ) + +/* to translate a Big Endian 32 bits to its host representation*/ +#define M4OSA_BE_TO_INT32(ui32_net) ((((ui32_net) & (M4OSA_UInt32) 0x000000ff) << 24) | \ + (((ui32_net) & (M4OSA_UInt32) 0x0000ff00) << 8) | \ + (((ui32_net) & (M4OSA_UInt32) 0x00ff0000) >> 8) | \ + (((ui32_net) & (M4OSA_UInt32) 0xff000000) >> 24)) + +/* to translate a Big Endian 64 bits to its host representation */ +#define M4OSA_BE_TO_INT64(ui64_net) ((((ui64_net) & (M4OSA_UInt64) 0x00000000000000ff) << 56) | \ + (((ui64_net) & (M4OSA_UInt64) 0x000000000000ff00) << 40) | \ + (((ui64_net) & (M4OSA_UInt64) 0x0000000000ff0000) << 24) | \ + (((ui64_net) & (M4OSA_UInt64) 0x00000000ff000000) << 8) | \ + (((ui64_net) & (M4OSA_UInt64) 0x000000ff00000000) >> 8) | \ + (((ui64_net) & (M4OSA_UInt64) 0x0000ff0000000000) >> 24) | \ + (((ui64_net) & (M4OSA_UInt64) 0x00ff000000000000) >> 40) | \ + (((ui64_net) & (M4OSA_UInt64) 0xff00000000000000) >> 56)) + +/* to translate a 16 bits to its Little Endian value*/ +#define M4OSA_INT16_TO_LE(ui16_host) (ui16_host) + +/* to translate a 32 bits to its Little Endian value */ +#define M4OSA_INT32_TO_LE(ui32_host) (ui32_host) + +/* to translate a 64 bits to its Little Endian value */ +#define M4OSA_INT64_TO_LE(ui64_host) (ui64_host) + +/* to translate a Little Endian 16 bits to its host representation */ +#define M4OSA_LE_TO_INT16(ui16_net) (ui16_net) + +/* to translate a Little Endian 32 bits to its host representation*/ +#define M4OSA_LE_TO_INT32(ui32_net) (ui32_net) + +/* to translate a Little Endian 64 bits to its host representation */ +#define M4OSA_LE_TO_INT64(ui64_net) (ui64_net) + + +/* Macro to manipulate M4OSA_Int32*/ +#define M4OSA_INT32_SET(i32_out, i32_in)\ + { i32_out = i32_in; } + +#define M4OSA_INT32_ADD(i32_result, i32_a, i32_b)\ + { i32_result = (i32_a) + (i32_b); } + +#define M4OSA_INT32_SUB(i32_result, i32_a, i32_b)\ + { i32_result = (i32_a) - (i32_b); } + +#define M4OSA_INT32_SCALAR_PRODUCT(i32_result, i32_a, i32_value)\ + { i32_result = (i32_a) * (i32_value); } + +#define M4OSA_INT32_SCALAR_DIVISION(i32_result, i32_a, i32_value)\ + { i32_result = (i32_a) / (i32_value); } + +#define M4OSA_INT32_COMPARE(i32_a, i32_b)\ + ( ((i32_a) == (i32_b)) ? 0 : ( ((i32_a) > (i32_b)) ? 1 : -1) ) + +#define M4OSA_INT32_FROM_INT32(i32_result, i32_value)\ + { i32_result = (M4OSA_Int32)(i32_value); } + +#define M4OSA_INT32_FROM_INT32_UINT32(i32_result, i32_high, ui32_low)\ + { i32_result = (M4OSA_Int32)(ui32_low); } + +#define M4OSA_INT32_GET_LOW32(i32_value) ((M4OSA_Int32)(i32_value)) + +#define M4OSA_INT32_GET_HIGH32(i32_value) (0) + +#define M4OSA_INT32_IS_POSITIVE(i32_value) ((i32_value) >= 0) + +#define M4OSA_INT32_NEG(i32_result, i32_value)\ + { i32_result = -(i32_value); } + +#define M4OSA_INT32_ABS(i32_result, i32_value)\ + { if ((i32_value) > 0) { i32_result = i32_value; }\ + else { i32_result = -(i32_value); } } + +#define M4OSA_INT32_LEFT_SHIFT(i32_result, i32_value, ui32_nbPos)\ + { i64_result = (((ui32_nbPos)>0x1F)?0:((i64_value)<<(ui32_nbPos))); } + +#define M4OSA_INT32_RIGHT_SHIFT(i32_result, i32_value, ui32_nbPos)\ + { i64_result = (((ui32_nbPos)>0x1F)?0:((i64_value)>>(ui32_nbPos))); } + +#define M4OSA_INT32_TO_DOUBLE(f_result, i32_value)\ + { f_result = (M4OSA_Double)(i32_value); } + +#define M4OSA_INT32_FROM_DOUBLE(i32_result, f_value)\ + { i32_result = (M4OSA_Int32)(f_value); } + + +#ifdef M4OSA_64BITS_SUPPORTED + +/* Macro to manipulate M4OSA_Int64*/ +#define M4OSA_INT64_SET(i64_out, i64_in) { i64_out = i64_in; } + +#define M4OSA_INT64_ADD(i64_result, i64_a, i64_b)\ + { i64_result = (i64_a) + (i64_b); } + +#define M4OSA_INT64_SUB(i64_result, i64_a, i64_b)\ + { i64_result = (i64_a) - (i64_b); } + +#define M4OSA_INT64_SCALAR_PRODUCT(i64_result, i64_a, i32_value)\ + { i64_result = (i64_a) * (i32_value); } + +#define M4OSA_INT64_SCALAR_DIVISION(i64_result, i64_a, i32_value)\ + { i64_result = (i64_a) / (i32_value); } + +#define M4OSA_INT64_COMPARE(i64_a, i64_b)\ + ( ((i64_a) == (i64_b)) ? 0 : ( ((i64_a) > (i64_b)) ? 1 : -1) )\ + +#define M4OSA_INT64_FROM_INT32(i64_result, i32_value)\ + { i64_result = (M4OSA_Int64)(i32_value); } + +#define M4OSA_INT64_FROM_INT32_UINT32(i64_result, i32_high, ui32_low)\ + { i64_result = (i32_high); i64_result = (i64_result<<32)+(ui32_low); } + +#define M4OSA_INT64_GET_LOW32(i64_value)\ + ((M4OSA_Int32)((i64_value) & 0xFFFFFFFF)) + +#define M4OSA_INT64_GET_HIGH32(i64_value)\ + ((M4OSA_Int32)(((i64_value) >> 32) & 0xFFFFFFFF)) + +#define M4OSA_INT64_IS_POSITIVE(i64_value) (((i64_value)>=0)?1:0) + +#define M4OSA_INT64_NEG(i64_result, i64_value)\ + { i64_result = -(i64_value); } + +#define M4OSA_INT64_ABS(i64_result, i64_value)\ + { if (M4OSA_INT64_IS_POSITIVE(i64_value)) { i64_result = i64_value; }\ + else { M4OSA_INT64_NEG(i64_result, i64_value); } } + +#define M4OSA_INT64_LEFT_SHIFT(i64_result, i64_value, ui32_nbPos)\ + { i64_result = (((ui32_nbPos)>0x3F)?0:((i64_value)<<(ui32_nbPos))); } + +#define M4OSA_INT64_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPos)\ + { i64_result = (((ui32_nbPos)>0x3F)?0:((i64_value)>>(ui32_nbPos))); } + +#define M4OSA_INT64_TO_DOUBLE(f_result, i64_value)\ + { f_result = (M4OSA_Double)(i64_value); } + +#define M4OSA_INT64_FROM_DOUBLE(i64_result, f_value)\ + { i64_result = (M4OSA_Int64)(f_value); } + +#endif /*M4OSA_64BITS_SUPPORTED*/ + + +#ifdef M4OSA_64BITS_NOT_SUPPORTED + +#define M4OSA_INT64_SET(i64_out, i64_in)\ + M4OSA_INT32_SET(i64_out, i64_in) + +#define M4OSA_INT64_ADD(i64_result, i64_a, i64_b)\ + M4OSA_INT32_ADD(i64_result, i64_a, i64_b) + +#define M4OSA_INT64_SUB(i64_result, i64_a, i64_b)\ + M4OSA_INT32_SUB(i64_result, i64_a, i64_b) + +#define M4OSA_INT64_SCALAR_PRODUCT(i64_result, i64_a, i32_value)\ + M4OSA_INT32_SCALAR_PRODUCT(i64_result, i64_a, i32_value) + +#define M4OSA_INT64_SCALAR_DIVISION(i64_result, i64_a, i32_value)\ + M4OSA_INT32_SCALAR_DIVISION(i64_result, i64_a, i32_value) + +#define M4OSA_INT64_COMPARE(i64_a, i64_b)\ + M4OSA_INT32_COMPARE(i64_a, i64_b) + +#define M4OSA_INT64_FROM_INT32(i64_result, i32_value)\ + M4OSA_INT32_FROM_INT32(i64_result, i32_value) + +#define M4OSA_INT64_FROM_INT32_UINT32(i64_result, i32_high, ui32_low)\ + M4OSA_INT32_FROM_INT32_UINT32(i64_result, i32_high, ui32_low) + +#define M4OSA_INT64_GET_LOW32(i64_value)\ + M4OSA_INT32_GET_LOW32(i64_value) + +#define M4OSA_INT64_GET_HIGH32(i64_value)\ + M4OSA_INT32_GET_HIGH32(i64_value) + +#define M4OSA_INT64_IS_POSITIVE(i64_value)\ + M4OSA_INT32_IS_POSITIVE(i64_value) + +#define M4OSA_INT64_NEG(i64_result, i64_value)\ + M4OSA_INT32_NEG(i64_result, i64_value) + +#define M4OSA_INT64_ABS(i64_result, i64_value)\ + M4OSA_INT32_ABS(i64_result, i64_value) + +#define M4OSA_INT64_LEFT_SHIFT(i64_result, i64_value, ui32_nbPositions)\ + M4OSA_INT32_LEFT_SHIFT(i64_result, i64_value, ui32_nbPositions) + +#define M4OSA_INT64_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPositions)\ + M4OSA_INT32_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPositions) + +#define M4OSA_INT64_TO_DOUBLE(f_result, i64_value)\ + M4OSA_INT32_TO_DOUBLE(f_result, i64_value) + +#define M4OSA_INT64_FROM_DOUBLE(i64_result, f_value)\ + M4OSA_INT32_FROM_DOUBLE(i64_result, f_value) + +#endif /*M4OSA_64BITS_NOT_SUPPORTED*/ + + +#ifdef __cplusplus +} +#endif + +#endif /*M4OSA_TYPES_H*/ + |