summaryrefslogtreecommitdiffstats
path: root/libvideoeditor/osal
diff options
context:
space:
mode:
Diffstat (limited to 'libvideoeditor/osal')
-rwxr-xr-xlibvideoeditor/osal/Android.mk1
-rwxr-xr-xlibvideoeditor/osal/inc/LVOSA_FileReader_optim.h85
-rwxr-xr-xlibvideoeditor/osal/inc/LV_Macros.h107
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_CharStar.h78
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Clock.h48
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_CoreID.h199
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Debug.h266
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Error.h174
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Export.h61
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileCommon.h118
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileCommon_priv.h106
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileReader.h131
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileReader_priv.h38
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileWriter.h135
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_FileWriter_priv.h37
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Memory.h57
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Mutex.h56
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_OptionID.h72
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Semaphore.h54
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Thread.h127
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Thread_priv.h63
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Time.h48
-rwxr-xr-xlibvideoeditor/osal/inc/M4OSA_Types.h104
-rwxr-xr-xlibvideoeditor/osal/src/Android.mk62
-rwxr-xr-xlibvideoeditor/osal/src/LVOSA_FileReader_optim.c1052
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_CharStar.c506
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Clock.c101
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileCommon.c667
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileReader.c549
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_FileWriter.c574
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Mutex.c275
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Random.c90
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Semaphore.c263
-rwxr-xr-xlibvideoeditor/osal/src/M4OSA_Thread.c797
-rwxr-xr-xlibvideoeditor/osal/src/M4PSW_DebugTrace.c85
-rwxr-xr-xlibvideoeditor/osal/src/M4PSW_MemoryInterface.c71
-rwxr-xr-xlibvideoeditor/osal/src/M4PSW_Trace.c98
-rw-r--r--libvideoeditor/osal/src/MODULE_LICENSE_APACHE20
-rw-r--r--libvideoeditor/osal/src/NOTICE190
39 files changed, 0 insertions, 7545 deletions
diff --git a/libvideoeditor/osal/Android.mk b/libvideoeditor/osal/Android.mk
deleted file mode 100755
index 5053e7d..0000000
--- a/libvideoeditor/osal/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h b/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h
deleted file mode 100755
index 237376d..0000000
--- a/libvideoeditor/osal/inc/LVOSA_FileReader_optim.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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
deleted file mode 100755
index b8d7e85..0000000
--- a/libvideoeditor/osal/inc/LV_Macros.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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)) \
- { \
- free((p)) ; \
- (p) = M4OSA_NULL ; \
- } \
-}
-
-
-
-#endif /*--- LV_MACROS_H ---*/
-
diff --git a/libvideoeditor/osal/inc/M4OSA_CharStar.h b/libvideoeditor/osal/inc/M4OSA_CharStar.h
deleted file mode 100755
index 06316f0..0000000
--- a/libvideoeditor/osal/inc/M4OSA_CharStar.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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_chrAreIdentical (M4OSA_Char *strIn1,
- M4OSA_Char *strIn2,
- M4OSA_Bool *result);
-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_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
deleted file mode 100755
index 52ea696..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Clock.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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_CLOCK_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
deleted file mode 100755
index 9172800..0000000
--- a/libvideoeditor/osal/inc/M4OSA_CoreID.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 826ab51..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Debug.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 75c3177..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Error.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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_UInt32)((((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)
-/* SF Codec detected INFO_FORMAT_CHANGE during decode */
-#define M4WAR_INFO_FORMAT_CHANGE M4OSA_ERR_CREATE(M4_WAR, M4_COMMON, 0x000009)
-
-#endif /*M4OSA_ERROR_H*/
-
diff --git a/libvideoeditor/osal/inc/M4OSA_Export.h b/libvideoeditor/osal/inc/M4OSA_Export.h
deleted file mode 100755
index b7a6e81..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Export.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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_FileCommon.h b/libvideoeditor/osal/inc/M4OSA_FileCommon.h
deleted file mode 100755
index f2afb8c..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileCommon.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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"
-
-
-typedef M4OSA_Int32 M4OSA_FilePosition;
-
-/** 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)
-
-
-#endif /*M4OSA_FILECOMMON_H*/
-
diff --git a/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h b/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h
deleted file mode 100755
index 1eba456..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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;
- FILE* file_desc;
- /** 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_FileReader.h b/libvideoeditor/osal/inc/M4OSA_FileReader.h
deleted file mode 100755
index c22756d..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileReader.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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_FileReader_priv.h b/libvideoeditor/osal/inc/M4OSA_FileReader_priv.h
deleted file mode 100755
index 327b086..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileReader_priv.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 9a11331..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileWriter.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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_FileWriter_priv.h b/libvideoeditor/osal/inc/M4OSA_FileWriter_priv.h
deleted file mode 100755
index 9d972f4..0000000
--- a/libvideoeditor/osal/inc/M4OSA_FileWriter_priv.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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
deleted file mode 100755
index a4d15cc..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Memory.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_32bitAlignedMalloc (M4OSA_UInt32 size,
- M4OSA_CoreID coreID,
- M4OSA_Char* string);
-
-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
deleted file mode 100755
index d496bdd..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Mutex.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 61b9044..0000000
--- a/libvideoeditor/osal/inc/M4OSA_OptionID.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 2630454..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Semaphore.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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_Thread.h b/libvideoeditor/osal/inc/M4OSA_Thread.h
deleted file mode 100755
index ca96afb..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Thread.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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
deleted file mode 100755
index b424b05..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Thread_priv.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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
deleted file mode 100755
index 21f25ed..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Time.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 signed long long M4OSA_Time;
-
-
-/** This macro sets the unknown time value */
-
-#define M4OSA_TIME_UNKNOWN 0x80000000
-
-/** 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)\
- { result = (1000*(M4OSA_Double)time)/((M4OSA_Double)timescale); }
-
-#endif /*M4OSA_TIME_H*/
-
diff --git a/libvideoeditor/osal/inc/M4OSA_Types.h b/libvideoeditor/osal/inc/M4OSA_Types.h
deleted file mode 100755
index ee258a0..0000000
--- a/libvideoeditor/osal/inc/M4OSA_Types.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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 <stdio.h>
-#include <string.h>
-#include "M4OSA_Export.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef int8_t M4OSA_Bool;
-typedef uint8_t M4OSA_UInt8;
-typedef int8_t M4OSA_Int8;
-typedef uint16_t M4OSA_UInt16;
-typedef int16_t M4OSA_Int16;
-typedef uint32_t M4OSA_UInt32;
-typedef int32_t 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;
-
-/* 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
-
-#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;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*M4OSA_TYPES_H*/
-
diff --git a/libvideoeditor/osal/src/Android.mk b/libvideoeditor/osal/src/Android.mk
deleted file mode 100755
index b613387..0000000
--- a/libvideoeditor/osal/src/Android.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-#
-# libvideoeditor_osal
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libvideoeditor_osal
-
-LOCAL_SRC_FILES:= \
- M4OSA_CharStar.c \
- M4OSA_Clock.c \
- M4OSA_FileCommon.c \
- M4OSA_FileReader.c \
- M4OSA_FileWriter.c \
- M4OSA_Mutex.c \
- M4OSA_Random.c \
- M4OSA_Semaphore.c \
- M4OSA_Thread.c \
- M4PSW_DebugTrace.c \
- M4PSW_MemoryInterface.c \
- M4PSW_Trace.c \
- LVOSA_FileReader_optim.c
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := libcutils libutils liblog
-
-LOCAL_C_INCLUDES += \
- $(TOP)/frameworks/av/libvideoeditor/osal/inc \
-
-LOCAL_SHARED_LIBRARIES += libdl
-
-LOCAL_CFLAGS += -Wno-multichar \
- -D__ANDROID__ \
- -DM4OSA_FILE_BLOCK_WITH_SEMAPHORE \
- -DUSE_STAGEFRIGHT_CODECS \
- -DUSE_STAGEFRIGHT_AUDIODEC \
- -DUSE_STAGEFRIGHT_VIDEODEC \
- -DUSE_STAGEFRIGHT_AUDIOENC \
- -DUSE_STAGEFRIGHT_VIDEOENC \
- -DUSE_STAGEFRIGHT_READERS \
- -DUSE_STAGEFRIGHT_3GPP_READER
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c b/libvideoeditor/osal/src/LVOSA_FileReader_optim.c
deleted file mode 100755
index e11e008..0000000
--- a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c
+++ /dev/null
@@ -1,1052 +0,0 @@
-/*
- * 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.c
- * @brief
- * @note This file implements functions to manipulate filesystem access
- ******************************************************************************
-*/
-
-/** Addition of Trace ID **/
-#include "M4OSA_CoreID.h"
-#include "M4OSA_Error.h"
-
-#ifdef M4TRACE_ID
-#undef M4TRACE_ID
-#endif
-#define M4TRACE_ID M4OSA_FILE_READER
-
-
-#include "M4OSA_FileCommon.h"
-#include "M4OSA_FileReader.h"
-#include "M4OSA_FileWriter.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Debug.h"
-
-#include "LVOSA_FileReader_optim.h"
-
-#define M4OSA_READER_OPTIM_USE_OSAL_IF
-#ifndef M4OSA_READER_OPTIM_USE_OSAL_IF
- #include "M4OSA_FileAccess.h"
-#endif
-
-#define M4ERR_CHECK_NULL_RETURN_VALUE(retval, pointer) if ((pointer) == M4OSA_NULL) return (retval);
-
-
-
-
-/**
- ******************************************************************************
- * File reader cache buffers parameters (size, number of buffers, etc)
- ******************************************************************************
-*/
-#define M4OSA_READBUFFER_SIZE 1024*16
-#define M4OSA_READBUFFER_NB 2
-#define M4OSA_READBUFFER_NONE -1
-#define M4OSA_EOF -1
-
-#define MAX_FILLS_SINCE_LAST_ACCESS M4OSA_READBUFFER_NB*2
-
-/**
- ******************************************************************************
- * structure M4OSA_FileReader_Buffer
- * @brief This structure defines the File reader Buffers context (private)
- ******************************************************************************
-*/
-typedef struct
-{
- M4OSA_MemAddr8 data; /**< buffer data */
- M4OSA_FilePosition size; /**< size of the buffer */
- M4OSA_FilePosition filepos; /**< position in the file where the buffer starts */
- M4OSA_FilePosition remain; /**< data amount not already copied from buffer */
- M4OSA_UInt32 nbFillSinceLastAcess; /**< To know since how many time we didn't use this buffer */
-} M4OSA_FileReader_Buffer_optim;
-
-/**
- ******************************************************************************
- * structure M4OSA_FileReader_Context
- * @brief This structure defines the File reader context (private)
- * @note This structure is used for all File Reader calls to store the context
- ******************************************************************************
-*/
-typedef struct
-{
- M4OSA_Bool IsOpened; /**< Micro state machine */
- M4OSA_FileAttribute FileAttribute; /**< Opening mode */
- M4OSA_FilePosition readFilePos; /**< Effective position of the GFL read pointer */
- M4OSA_FilePosition absolutePos; /**< Virtual position for next reading */
- M4OSA_FilePosition fileSize; /**< Size of the file */
-
- M4OSA_FileReader_Buffer_optim buffer[M4OSA_READBUFFER_NB]; /**< Read buffers */
-
- M4OSA_Void* aFileDesc; /**< File descriptor */
-
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_FileReadPointer* FS; /**< Filesystem interface */
-#else
- M4OSA_FileSystem_FctPtr *FS; /**< Filesystem interface */
-#endif
-
-} M4OSA_FileReader_Context_optim;
-
-/* __________________________________________________________ */
-/*| |*/
-/*| Global function for handling low level read access |*/
-/*|__________________________________________________________|*/
-
-static M4OSA_FileReadPointer* gv_NXPSW_READOPT_lowLevelFunctions;
-
-M4OSA_ERR NXPSW_FileReaderOptim_init(M4OSA_Void *lowLevel_functionPointers, M4OSA_Void *optimized_functionPointers)
-{
- M4OSA_FileReadPointer* lowLevel_fp = (M4OSA_FileReadPointer*) lowLevel_functionPointers;
- M4OSA_FileReadPointer* optimized_fp = (M4OSA_FileReadPointer*) optimized_functionPointers;
-
- //Set the optimized functions, to be called by the user
- optimized_fp->openRead = M4OSA_fileReadOpen_optim;
- optimized_fp->readData = M4OSA_fileReadData_optim;
- optimized_fp->seek = M4OSA_fileReadSeek_optim;
- optimized_fp->closeRead = M4OSA_fileReadClose_optim;
- optimized_fp->setOption = M4OSA_fileReadSetOption_optim;
- optimized_fp->getOption = M4OSA_fileReadGetOption_optim;
-
-
- return M4NO_ERROR;
-}
-
-M4OSA_ERR NXPSW_FileReaderOptim_cleanUp()
-{
-
- gv_NXPSW_READOPT_lowLevelFunctions = M4OSA_NULL;
-
- return M4NO_ERROR;
-}
-
-
-M4OSA_ERR NXPSW_FileReaderOptim_getLowLevelFunctions(M4OSA_Void **FS)
-{
- M4OSA_FileReadPointer** pFunctionsPointer = (M4OSA_FileReadPointer**) FS;
- *pFunctionsPointer = gv_NXPSW_READOPT_lowLevelFunctions;
- return M4NO_ERROR;
-}
-
-
-/* __________________________________________________________ */
-/*| |*/
-/*| Buffer handling functions for Read access |*/
-/*|__________________________________________________________|*/
-
-/**************************************************************/
-M4OSA_ERR M4OSA_FileReader_BufferInit(M4OSA_FileReader_Context_optim* apContext)
-/**************************************************************/
-{
- M4OSA_UInt8 i;
-
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- apContext->buffer[i].data = M4OSA_NULL;
- apContext->buffer[i].size = 0;
- apContext->buffer[i].filepos = 0;
- apContext->buffer[i].remain = 0;
- }
-
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- apContext->buffer[i].data = (M4OSA_MemAddr8) M4OSA_32bitAlignedMalloc(M4OSA_READBUFFER_SIZE,
- M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReader_BufferInit");
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext->buffer[i].data);
- }
-
- return M4NO_ERROR;
-}
-
-/**************************************************************/
-M4OSA_Void M4OSA_FileReader_BufferFree(M4OSA_FileReader_Context_optim* apContext)
-/**************************************************************/
-{
- M4OSA_Int8 i;
-
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- if(apContext->buffer[i].data != M4OSA_NULL)
- free(apContext->buffer[i].data);
-}
-
-/**************************************************************/
-M4OSA_FilePosition M4OSA_FileReader_BufferCopy(M4OSA_FileReader_Context_optim* apContext,
- M4OSA_Int8 i, M4OSA_FilePosition pos,
- M4OSA_FilePosition size, M4OSA_MemAddr8 pData)
-/**************************************************************/
-{
- M4OSA_FilePosition copysize;
- M4OSA_FilePosition offset;
-
- if(apContext->buffer[i].size == M4OSA_EOF) return M4OSA_EOF;
-
- if( (pos < apContext->buffer[i].filepos)
- || (pos > (apContext->buffer[i].filepos + apContext->buffer[i].size - 1)) )
- {
- return 0; /* nothing copied */
- }
-
- offset = pos - apContext->buffer[i].filepos;
-
- copysize = apContext->buffer[i].size - offset;
- copysize = (size < copysize) ? size : copysize;
-
- memcpy((void *)pData, (void *)(apContext->buffer[i].data + offset), copysize);
-
- apContext->buffer[i].remain -= copysize;
- apContext->buffer[i].nbFillSinceLastAcess = 0;
-
- return copysize;
-}
-
-/**************************************************************/
-M4OSA_ERR M4OSA_FileReader_BufferFill(M4OSA_FileReader_Context_optim* apContext,
- M4OSA_Int8 i, M4OSA_FilePosition pos)
-/**************************************************************/
-{
- M4OSA_FilePosition gridPos;
- M4OSA_FilePosition tempPos;
- M4OSA_UInt32 bufferSize;
- M4OSA_FilePosition diff;
- M4OSA_FilePosition size;
- M4OSA_ERR err = M4NO_ERROR;
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_ERR errno = M4NO_ERROR;
- M4OSA_UInt32 fileReadSize = 0;
- M4OSA_FilePosition fileSeekPosition = 0;
-#else
- M4OSA_Int32 ret_val;
- M4OSA_UInt16 errno;
-#endif
-
- M4OSA_TRACE3_4("BufferFill i = %d pos = %ld read = %ld old = %ld", i, pos,
- apContext->readFilePos, apContext->buffer[i].filepos);
-
- /* Avoid cycling statement because of EOF */
- if(pos >= apContext->fileSize)
- return M4WAR_NO_MORE_AU;
-
- /* Relocate to absolute postion if necessary */
- bufferSize = M4OSA_READBUFFER_SIZE;
- tempPos = (M4OSA_FilePosition) (pos / bufferSize);
- gridPos = tempPos * M4OSA_READBUFFER_SIZE;
- diff = gridPos - apContext->readFilePos;
-
- if(diff != 0)
- {
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- fileSeekPosition = diff;
- errno = apContext->FS->seek(apContext->aFileDesc, M4OSA_kFileSeekCurrent,
- &fileSeekPosition);
- apContext->readFilePos = gridPos;
-
- if(M4NO_ERROR != errno)
- {
- err = errno;
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR1 = 0x%x", err);
- return err;
- }
-
-#else
- ret_val = apContext->FS->pFctPtr_Seek(apContext->aFileDesc, diff,
- M4OSA_kFileSeekCurrent, &errno);
- apContext->readFilePos = gridPos;
-
- if(ret_val != 0)
- {
- err = M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_READER, errno);
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR1 = 0x%x", err);
- return err;
- }
-#endif /*M4OSA_READER_OPTIM_USE_OSAL_IF*/
- }
-
- apContext->buffer[i].filepos = apContext->readFilePos;
-
- /* Read Data */
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- fileReadSize = M4OSA_READBUFFER_SIZE;
- errno = apContext->FS->readData(apContext->aFileDesc,
- (M4OSA_MemAddr8)apContext->buffer[i].data, &fileReadSize);
-
- size = (M4OSA_FilePosition)fileReadSize;
- if ((M4NO_ERROR != errno)&&(M4WAR_NO_DATA_YET != errno))
- {
- apContext->buffer[i].size = M4OSA_EOF;
- apContext->buffer[i].remain = 0;
-
- err = errno;
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR2 = 0x%x", err);
- return err;
- }
-#else
- size = apContext->FS->pFctPtr_Read(apContext->aFileDesc,
- (M4OSA_UInt8 *)apContext->buffer[i].data, M4OSA_READBUFFER_SIZE, &errno);
- if(size == -1)
- {
- apContext->buffer[i].size = M4OSA_EOF;
- apContext->buffer[i].remain = 0;
-
- err = M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_READER, errno);
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR2 = 0x%x", err);
- return err;
- }
-#endif
-
- apContext->buffer[i].size = size;
- apContext->buffer[i].remain = size;
- apContext->buffer[i].nbFillSinceLastAcess = 0;
-
- /* Retrieve current position */
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- errno = apContext->FS->getOption(apContext->aFileDesc,
- M4OSA_kFileReadGetFilePosition,
- (M4OSA_DataOption*) &apContext->readFilePos);
-
- if (M4NO_ERROR != errno)
- {
- err = errno;
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR3 = 0x%x", err);
- }
- else if( (apContext->buffer[i].size >= 0)
- && (apContext->buffer[i].size < M4OSA_READBUFFER_SIZE) )
- {
- err = M4WAR_NO_DATA_YET;
- M4OSA_TRACE2_0("M4OSA_FileReader_BufferFill returns NO DATA YET");
- return err;
- }
-#else
- apContext->readFilePos = apContext->FS->pFctPtr_Tell(apContext->aFileDesc, &errno);
-
- if( (apContext->buffer[i].size >= 0)
- && (apContext->buffer[i].size < M4OSA_READBUFFER_SIZE) )
- {
- err = M4WAR_NO_DATA_YET;
- M4OSA_TRACE1_1("M4OSA_FileReader_BufferFill ERR3 = 0x%x", err);
- return err;
- }
-#endif /*M4OSA_READER_OPTIM_USE_OSAL_IF*/
-
- /* Return without error */
- return M4NO_ERROR;
-}
-
-/**************************************************************/
-M4OSA_Int8 M4OSA_FileReader_BufferMatch(M4OSA_FileReader_Context_optim* apContext,
- M4OSA_FilePosition pos)
-/**************************************************************/
-{
- M4OSA_Int8 i;
-
-
- /* Select the buffer which matches with given pos */
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- if( (pos >= apContext->buffer[i].filepos)
- && (pos < (apContext->buffer[i].filepos + apContext->buffer[i].size)) )
- {
- return i;
- }
- }
- return M4OSA_READBUFFER_NONE;
-}
-
-/**************************************************************/
-M4OSA_Int8 M4OSA_FileReader_BufferSelect(M4OSA_FileReader_Context_optim* apContext,
- M4OSA_Int8 current_i)
-/**************************************************************/
-{
- M4OSA_Int8 i,j;
- M4OSA_FilePosition min_amount,max_amount;
- M4OSA_Int8 min_i,max_count;
-
- /* update nbFillSinceLastAcess field */
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- apContext->buffer[i].nbFillSinceLastAcess ++;
- }
-
- /* Plan A : Scan for empty buffer */
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- if(apContext->buffer[i].remain == 0)
- {
- return i;
- }
- }
-
- max_count = M4OSA_READBUFFER_NB;
- max_amount = MAX_FILLS_SINCE_LAST_ACCESS;
-
- /* Plan B : Scan for dead buffer */
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- if(apContext->buffer[i].nbFillSinceLastAcess >= (M4OSA_UInt32) max_amount)
- {
- max_amount = apContext->buffer[i].nbFillSinceLastAcess;
- max_count = i;
- }
- }
- if(max_count<M4OSA_READBUFFER_NB)
- {
- M4OSA_TRACE2_2("DEAD BUFFER: %d, %d",max_count,apContext->buffer[max_count].nbFillSinceLastAcess);
- return max_count;
- }
-
- min_i = current_i;
- min_amount = M4OSA_READBUFFER_SIZE;
-
- /* Select the buffer which is the most "empty" */
- for(i=0; i<M4OSA_READBUFFER_NB; i++)
- {
- j = (i+current_i)%M4OSA_READBUFFER_NB;
-
- if(apContext->buffer[j].remain < min_amount)
- {
- min_amount = apContext->buffer[j].remain;
- min_i = j;
- }
- }
-
- return min_i;
-
-}
-
-/**************************************************************/
-M4OSA_ERR M4OSA_FileReader_CalculateSize(M4OSA_FileReader_Context_optim* apContext)
-/**************************************************************/
-{
- M4OSA_ERR err = M4NO_ERROR;
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_ERR errno = M4NO_ERROR;
-#else
- M4OSA_Int32 ret_val;
- M4OSA_UInt16 errno;
-#endif
-
- /* go to the end of file*/
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- errno = apContext->FS->getOption(apContext->aFileDesc, M4OSA_kFileReadGetFileSize,
- (M4OSA_DataOption*) &apContext->fileSize);
- if (M4NO_ERROR != errno)
- {
- err = errno;
- M4OSA_TRACE1_1("M4OSA_FileReader_CalculateSize ERR = 0x%x", err);
- }
-#else
- ret_val = apContext->FS->pFctPtr_Seek(apContext->aFileDesc, 0, M4OSA_kFileSeekEnd, &errno);
-
- if (ret_val != 0)
- {
- apContext->readFilePos = M4OSA_EOF;
- err = M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_READER, errno);
- M4OSA_TRACE1_1("M4OSA_FileReader_CalculateSize ERR = 0x%x", err);
- }
- else
- {
- /* Retrieve size of the file */
- apContext->fileSize = apContext->FS->pFctPtr_Tell(apContext->aFileDesc, &errno);
- apContext->readFilePos = apContext->fileSize;
- }
-#endif /*M4OSA_READER_OPTIM_USE_OSAL_IF*/
-
- return err;
-}
-
-
-/* __________________________________________________________ */
-/*| |*/
-/*| OSAL filesystem API |*/
-/*|__________________________________________________________|*/
-
-/**
-******************************************************************************
-* @brief This method opens the provided fileDescriptor and returns its context.
-* @param pContext: (OUT) File reader context.
-* @param pFileDescriptor : (IN) File Descriptor of the input file.
-* @param FileModeAccess : (IN) File mode access.
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER pContext or fileDescriptor is NULL
-* @return M4ERR_ALLOC there is no more memory available
-* @return M4ERR_FILE_BAD_MODE_ACCESS the file mode access is not correct (it must be either isTextMode or read)
-* @return M4ERR_FILE_NOT_FOUND The file can not be opened.
-******************************************************************************
-*/
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_ERR M4OSA_fileReadOpen_optim(M4OSA_Context* pContext,
- M4OSA_Void* pFileDescriptor,
- M4OSA_UInt32 FileModeAccess)
-#else
- M4OSA_ERR M4OSA_fileReadOpen_optim(M4OSA_Context* pContext,
- M4OSA_Void* pFileDescriptor,
- M4OSA_UInt32 FileModeAccess,
- M4OSA_FileSystem_FctPtr *FS)
-#endif
-{
- M4OSA_FileReader_Context_optim* apContext = M4OSA_NULL;
-
- M4OSA_ERR err = M4NO_ERROR;
- M4OSA_Void* aFileDesc = M4OSA_NULL;
- M4OSA_Bool buffers_allocated = M4OSA_FALSE;
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_ERR errno = M4NO_ERROR;
-#else
- M4OSA_UInt16 errno;
-#endif /*M4OSA_READER_OPTIM_USE_OSAL_IF*/
-
- M4OSA_TRACE2_3("M4OSA_fileReadOpen_optim p = 0x%p fd = %s mode = %lu", pContext,
- pFileDescriptor, FileModeAccess);
-
- /* Check input parameters */
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, pContext);
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, pFileDescriptor);
-
- *pContext = M4OSA_NULL;
-
- /* Allocate memory for the File reader context. */
- apContext = (M4OSA_FileReader_Context_optim *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileReader_Context_optim),
- M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReader_Context_optim");
-
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_ALLOC, apContext);
-
- /* Set filesystem interface */
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
-
- /*Set the optimized functions, to be called by the user*/
-
- apContext->FS = (M4OSA_FileReadPointer*) M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileReadPointer),
- M4OSA_FILE_READER, (M4OSA_Char *)"M4OSA_FileReaderOptim_init");
- if (M4OSA_NULL==apContext->FS)
- {
- M4OSA_TRACE1_0("M4OSA_FileReaderOptim_init - ERROR : allocation failed");
- return M4ERR_ALLOC;
- }
- apContext->FS->openRead = M4OSA_fileReadOpen;
- apContext->FS->readData = M4OSA_fileReadData;
- apContext->FS->seek = M4OSA_fileReadSeek;
- apContext->FS->closeRead = M4OSA_fileReadClose;
- apContext->FS->setOption = M4OSA_fileReadSetOption;
- apContext->FS->getOption = M4OSA_fileReadGetOption;
-#else
- apContext->FS = FS;
-#endif
-
- /* Verify access mode */
- if ( ((FileModeAccess & M4OSA_kFileAppend) != 0)
- || ((FileModeAccess & M4OSA_kFileRead) == 0))
- {
- err = M4ERR_FILE_BAD_MODE_ACCESS;
- goto cleanup;
- }
-
- /* Open file in read mode */
- if((FileModeAccess & M4OSA_kFileCreate) != 0)
- {
- err = M4ERR_FILE_BAD_MODE_ACCESS;
- }
- else
- {
- if ((FileModeAccess & M4OSA_kFileRead))
- {
- /* File is opened in read only*/
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- errno = apContext->FS->openRead(&aFileDesc, pFileDescriptor, FileModeAccess);
-
- if ((aFileDesc == M4OSA_NULL)||(M4NO_ERROR != errno))
- {
- /* converts the error to PSW format*/
- err = errno;
- M4OSA_TRACE2_1("M4OSA_fileReadOpen_optim ERR1 = 0x%x", err);
- apContext->IsOpened = M4OSA_FALSE;
- }
-#else
- aFileDesc = apContext->FS->pFctPtr_Open(pFileDescriptor, FileModeAccess, &errno);
-
- if (aFileDesc == M4OSA_NULL)
- {
- /* converts the error to PSW format*/
- err = M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_READER, errno);
- M4OSA_TRACE2_1("M4OSA_fileReadOpen_optim ERR1 = 0x%x", err);
- apContext->IsOpened = M4OSA_FALSE;
- }
-#endif
-
- else
- {
- apContext->IsOpened = M4OSA_TRUE;
- }
- }
- else
- {
- err = M4ERR_FILE_BAD_MODE_ACCESS;
- }
- }
-
- if (M4NO_ERROR != err) goto cleanup;
-
- /* Allocate buffers */
- err = M4OSA_FileReader_BufferInit(apContext);
- buffers_allocated = M4OSA_TRUE;
-
- if (M4NO_ERROR != err) goto cleanup;
-
- /* Initialize parameters */
- apContext->fileSize = 0;
- apContext->absolutePos = 0;
- apContext->readFilePos = 0;
-
- /* Retrieve the File Descriptor*/
- apContext->aFileDesc = aFileDesc;
-
- /* Retrieve the File mode Access */
- apContext->FileAttribute.modeAccess = (M4OSA_FileModeAccess) FileModeAccess;
-
- /*Retrieve the File reader context */
- *pContext= (M4OSA_Context)apContext;
-
- /* Compute file size */
- err = M4OSA_FileReader_CalculateSize(apContext);
-
- if (M4NO_ERROR != err) goto cleanup;
-
- return M4NO_ERROR;
-
-cleanup:
-
- /* free context */
- if (M4OSA_NULL != apContext)
- {
- if(buffers_allocated == M4OSA_TRUE)
- {
- M4OSA_FileReader_BufferFree(apContext);
- }
-
- free( apContext);
- *pContext = M4OSA_NULL;
- }
-
- M4OSA_TRACE2_1 ("M4OSA_fileReadOpen_optim: returns error 0x%0x", err)
- return err;
-}
-
-/**
-******************************************************************************
-* @brief This method reads the 'size' bytes in the core file reader (selected by its 'context')
-* and writes the data to the 'data' pointer. If 'size' byte can not be read in the core file reader,
-* 'size' parameter is updated to match the correct number of read bytes.
-* @param pContext: (IN) File reader context.
-* @param pData : (OUT) Data pointer of the read data.
-* @param pSize : (INOUT) Size of the data to read (in byte).
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER pSize, fileDescriptor or pData is NULL
-* @return M4ERR_ALLOC there is no more memory available
-* @return M4ERR_BAD_CONTEXT provided context is not a valid one.
-******************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadData_optim(M4OSA_Context pContext,M4OSA_MemAddr8 pData,
- M4OSA_UInt32* pSize)
-{
- M4OSA_FileReader_Context_optim* apContext =
- (M4OSA_FileReader_Context_optim*) pContext;
-
- M4OSA_ERR err;
- M4OSA_FilePosition aSize;
- M4OSA_FilePosition copiedSize;
- M4OSA_Int8 selected_buffer, current_buffer;
-
- M4OSA_TRACE3_3("M4OSA_fileReadData_optim p = 0x%p d = 0x%p s = %lu",
- pContext, pData, *pSize);
-
- /* Check input parameters */
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_BAD_CONTEXT, apContext);
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, pData);
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, pSize);
-
- if (apContext->IsOpened != M4OSA_TRUE)
- {
- return M4ERR_BAD_CONTEXT;
- }
-
- /* Prevent reading beyond EOF */
- if((*pSize > 0) && (apContext->absolutePos >= apContext->fileSize))
- {
- copiedSize = 0;
- err = M4WAR_NO_MORE_AU;
- goto cleanup;
- }
-
- /* Check if data can be read from a buffer */
- /* If not, fill one according to quantized positions */
- copiedSize = 0;
- err = M4NO_ERROR;
-
- selected_buffer = M4OSA_FileReader_BufferMatch(apContext, apContext->absolutePos);
-
- if(selected_buffer == M4OSA_READBUFFER_NONE)
- {
- selected_buffer = M4OSA_FileReader_BufferSelect(apContext, 0);
- err = M4OSA_FileReader_BufferFill(apContext, selected_buffer,
- apContext->absolutePos);
- }
-
- if(err != M4NO_ERROR)
- {
- if(err == M4WAR_NO_DATA_YET)
- {
- if (*pSize <= (M4OSA_UInt32)apContext->buffer[selected_buffer].size)
- {
- err = M4NO_ERROR;
- }
- else
- {
- copiedSize = (M4OSA_UInt32)apContext->buffer[selected_buffer].size;
- /*copy the content into pData*/
- M4OSA_FileReader_BufferCopy(apContext, selected_buffer,
- apContext->absolutePos, copiedSize, pData);
- goto cleanup;
- }
- }
- else
- {
- goto cleanup;
- }
- }
-
- M4OSA_TRACE3_3("read size = %lu buffer = %d pos = %ld", *pSize,
- selected_buffer, apContext->absolutePos);
-
- /* Copy buffer into pData */
- while(((M4OSA_UInt32)copiedSize < *pSize) && (err == M4NO_ERROR))
- {
- aSize = M4OSA_FileReader_BufferCopy(apContext, selected_buffer,
- apContext->absolutePos+copiedSize,
- *pSize-copiedSize, pData+copiedSize);
- copiedSize += aSize;
-
- if(aSize == 0)
- {
- err = M4WAR_NO_DATA_YET;
- }
- else
- {
- if((M4OSA_UInt32)copiedSize < *pSize)
- {
- current_buffer = selected_buffer;
- selected_buffer = M4OSA_FileReader_BufferMatch(apContext,
- apContext->absolutePos+copiedSize);
-
- if(selected_buffer == M4OSA_READBUFFER_NONE)
- {
- selected_buffer = M4OSA_FileReader_BufferSelect(apContext,
- current_buffer);
- err = M4OSA_FileReader_BufferFill(apContext, selected_buffer,
- apContext->absolutePos+copiedSize);
-
- if(err != M4NO_ERROR)
- {
- if(err == M4WAR_NO_DATA_YET)
- {
- /*If we got all the data that we wanted, we should return no error*/
- if ((*pSize-copiedSize) <= (M4OSA_UInt32)apContext->buffer[selected_buffer].size)
- {
- err = M4NO_ERROR;
- }
- /*If we did not get enough data, we will return NO_DATA_YET*/
-
- /*copy the data read*/
- aSize = M4OSA_FileReader_BufferCopy(apContext, selected_buffer,
- apContext->absolutePos+copiedSize,
- *pSize-copiedSize, pData+copiedSize);
- copiedSize += aSize;
-
- /*we reached end of file, so stop trying to read*/
- goto cleanup;
- }
- if (err == M4WAR_NO_MORE_AU)
- {
- err = M4WAR_NO_DATA_YET;
-
- /*copy the data read*/
- aSize = M4OSA_FileReader_BufferCopy(apContext, selected_buffer,
- apContext->absolutePos+copiedSize,
- *pSize-copiedSize, pData+copiedSize);
- copiedSize += aSize;
-
- /*we reached end of file, so stop trying to read*/
- goto cleanup;
-
- }
- else
- {
- goto cleanup;
- }
- }
- }
- }
- }
- }
-
-cleanup :
-
- /* Update the new position of the pointer */
- apContext->absolutePos = apContext->absolutePos + copiedSize;
-
- if((err != M4NO_ERROR)&&(err!=M4WAR_NO_DATA_YET))
- {
- M4OSA_TRACE2_3("M4OSA_fileReadData_optim size = %ld copied = %ld err = 0x%x",
- *pSize, copiedSize, err);
- }
-
- /* Effective copied size must be returned */
- *pSize = copiedSize;
-
-
- /* Read is done */
- return err;
-}
-
-/**
-******************************************************************************
-* @brief This method seeks at the provided position in the core file reader (selected by its 'context').
-* The position is related to the seekMode parameter it can be either :
-* From the beginning (position MUST be positive) : end position = position
-* From the end (position MUST be negative) : end position = file size + position
-* From the current position (signed offset) : end position = current position + position.
-* @param pContext: (IN) File reader context.
-* @param SeekMode : (IN) Seek access mode.
-* @param pPosition : (IN) Position in the file.
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER Seekmode or fileDescriptor is NULL
-* @return M4ERR_ALLOC there is no more memory available
-* @return M4ERR_BAD_CONTEXT provided context is not a valid one.
-* @return M4ERR_FILE_INVALID_POSITION the position cannot be reached.
-******************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadSeek_optim( M4OSA_Context pContext, M4OSA_FileSeekAccessMode SeekMode,
- M4OSA_FilePosition* pPosition)
-{
- M4OSA_FileReader_Context_optim* apContext = (M4OSA_FileReader_Context_optim*) pContext;
- M4OSA_ERR err = M4NO_ERROR;
- M4OSA_TRACE3_3("M4OSA_fileReadSeek_optim p = 0x%p mode = %d pos = %d", pContext,
- SeekMode, *pPosition);
-
- /* Check input parameters */
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_BAD_CONTEXT, apContext);
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, pPosition);
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_PARAMETER, SeekMode);
-
- if (apContext->IsOpened != M4OSA_TRUE)
- {
- return M4ERR_BAD_CONTEXT; /*< The context can not be correct */
- }
-
- /* Go to the desired position */
- switch(SeekMode)
- {
- case M4OSA_kFileSeekBeginning :
- if(*pPosition < 0) {
- return M4ERR_PARAMETER; /**< Bad SeekAcess mode */
- }
- apContext->absolutePos = *pPosition;
- *pPosition = apContext->absolutePos;
- break;
-
- case M4OSA_kFileSeekEnd :
- if(*pPosition > 0) {
- return M4ERR_PARAMETER; /**< Bad SeekAcess mode */
- }
- apContext->absolutePos = apContext->fileSize + *pPosition;
- *pPosition = apContext->absolutePos;
- break;
-
- case M4OSA_kFileSeekCurrent :
- if(((apContext->absolutePos + *pPosition) > apContext->fileSize) ||
- ((apContext->absolutePos + *pPosition) < 0)){
- return M4ERR_PARAMETER; /**< Bad SeekAcess mode */
- }
- apContext->absolutePos = apContext->absolutePos + *pPosition;
- *pPosition = apContext->absolutePos;
- break;
-
- default :
- err = M4ERR_PARAMETER; /**< Bad SeekAcess mode */
- break;
- }
-
- /* Return without error */
- return err;
-}
-
-/**
-******************************************************************************
-* @brief This method asks the core file reader to close the file
-* (associated to the context) and also frees the context.
-* @param pContext: (IN) File reader context.
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_BAD_CONTEXT provided context is not a valid one.
-******************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadClose_optim(M4OSA_Context pContext)
-{
- M4OSA_FileReader_Context_optim* apContext = (M4OSA_FileReader_Context_optim*) pContext;
-
- M4OSA_ERR err = M4NO_ERROR;
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- M4OSA_ERR errno = M4NO_ERROR;
-#else
- M4OSA_UInt16 errno;
-#endif
-
- M4OSA_TRACE2_1("M4OSA_fileReadClose_optim p = 0x%p", pContext );
-
- /* Check input parameters */
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_BAD_CONTEXT, apContext);
-
- if (apContext->IsOpened != M4OSA_TRUE)
- {
- return M4ERR_BAD_CONTEXT; /**< The context can not be correct */
- }
-
- /* buffer */
- M4OSA_FileReader_BufferFree(apContext);
-
- /* Close the file */
-#ifdef M4OSA_READER_OPTIM_USE_OSAL_IF
- errno = apContext->FS->closeRead(apContext->aFileDesc);
-
- if (M4NO_ERROR != errno)
- {
- /* converts the error to PSW format*/
- err = errno;
- M4OSA_TRACE2_1("M4OSA_fileReadClose_optim ERR1 = 0x%x", err);
- }
-#else
- aRet_Val = apContext->FS->pFctPtr_Close(apContext->aFileDesc, &errno);
-
- if (aRet_Val != 0)
- {
- /* converts the error to PSW format*/
- err = M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_READER, errno);
- M4OSA_TRACE2_1("M4OSA_fileReadClose_optim ERR1 = 0x%x", err);
- }
-#endif /*M4OSA_READER_OPTIM_USE_OSAL_IF*/
-
- apContext->IsOpened = M4OSA_FALSE;
-
- //>>>> GLM20090212 : set the low level function statically
- if (apContext->FS != M4OSA_NULL)
- {
- free( apContext->FS);
- }
- //<<<< GLM20090212 : set the low level function statically
-
- /* Free the context */
- free(apContext);
-
- /* Return without error */
- return err;
-}
-
-/**
-******************************************************************************
-* @brief This is a dummy function required to maintain function pointer
-* structure.
-* @note This is a dummy function required to maintain function pointer
-* structure.
-* @param pContext: (IN) Execution context.
-* @param OptionId : (IN) Id of the option to set.
-* @param OptionValue : (IN) Value of the option.
-* @return M4NO_ERROR: there is no error
-******************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadSetOption_optim(M4OSA_Context pContext,
- M4OSA_FileReadOptionID OptionID,
- M4OSA_DataOption OptionValue)
-{
- M4OSA_ERR err = M4NO_ERROR;
- return err;
-}
-
-/**
-******************************************************************************
-* @brief This method asks the core file reader to return the value associated
-* with the optionID.The caller is responsible for allocating/de-allocating
-* the memory of the value field.
-* @note The options handled by the component depend on the implementation
-* of the component.
-* @param pContext: (IN) Execution context.
-* @param OptionId : (IN) Id of the option to set.
-* @param pOptionValue : (OUT) Value of the option.
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_BAD_CONTEXT pContext is NULL
-* @return M4ERR_BAD_OPTION_ID the option id is not valid.
-* @return M4ERR_NOT_IMPLEMENTED The option is not implemented yet.
-******************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadGetOption_optim(M4OSA_Context pContext,
- M4OSA_FileReadOptionID OptionID,
- M4OSA_DataOption* pOptionValue)
-{
- M4OSA_FileReader_Context_optim* apContext = (M4OSA_FileReader_Context_optim*) pContext;
- M4OSA_ERR err = M4NO_ERROR;
-
- /* Check input parameters */
- M4ERR_CHECK_NULL_RETURN_VALUE(M4ERR_BAD_CONTEXT, apContext);
-
- if (apContext->IsOpened != M4OSA_TRUE)
- {
- return M4ERR_BAD_CONTEXT; /**< The context can not be correct */
- }
-
- /* Get the desired option if it is avalaible */
- switch(OptionID)
- {
- /* Get File Size */
- case M4OSA_kFileReadGetFileSize:/**< Get size of the file, limited to 32 bit size */
-
- (*(M4OSA_UInt32 *)pOptionValue) = apContext->fileSize;
- break;
-
- /* Check End of file Occurs */
- case M4OSA_kFileReadIsEOF : /**< See if we are at the end of the file */
-
- (*(M4OSA_Bool *)pOptionValue) = (apContext->absolutePos >= apContext->fileSize) ? M4OSA_TRUE : M4OSA_FALSE;
- break;
-
- /* Get File Position */
- case M4OSA_kFileReadGetFilePosition : /**< Get file position */
-
- *(M4OSA_FilePosition *)pOptionValue = apContext->absolutePos;
- break;
-
- /* Get Attribute */
- case M4OSA_kFileReadGetFileAttribute : /**< Get the file attribute = access mode */
-
- (*(M4OSA_FileAttribute *)pOptionValue).modeAccess = apContext->FileAttribute.modeAccess;
- break;
-
- default:
- /**< Bad option ID */
- err = M4ERR_BAD_OPTION_ID;
- break;
- }
-
- /*Return without error */
- return err;
-}
diff --git a/libvideoeditor/osal/src/M4OSA_CharStar.c b/libvideoeditor/osal/src/M4OSA_CharStar.c
deleted file mode 100755
index 0814cbf..0000000
--- a/libvideoeditor/osal/src/M4OSA_CharStar.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * 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 M4DPAK_CharStar.c
- * @ingroup
- * @brief definition of the Char Star set of functions.
- * @note This file defines the Char Star set of functions.
- *
- ************************************************************************
-*/
-
-
-#include "M4OSA_CharStar.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Debug.h"
-
-/* WARNING: Specific Android */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-
-
-/**
- ************************************************************************
- * @brief This function mimics the functionality of the libc's strncpy().
- * @note It copies exactly len2Copy characters from pStrIn to pStrOut,
- * truncating pStrIn or adding null characters to pStrOut if
- * necessary.
- * - If len2Copy is less than or equal to the length of pStrIn,
- * a null character is appended automatically to the copied
- * string.
- * - If len2Copy is greater than the length of pStrIn, pStrOut is
- * padded with null characters up to length len2Copy.
- * - pStrOut and pStrIn MUST NOT OVERLAP (this is NOT CHECKED).
- * @param pStrOut: (OUT) Destination character string.
- * @param pStrIn: (IN) Source character string.
- * @param len2Copy: (IN) Maximum number of characters from pStrIn to copy.
- * @return M4NO_ERROR: there is no error.
- * @return M4ERR_PARAMETER: pStrIn or pStrOut is M4OSA_NULL.
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_chrNCopy(M4OSA_Char* pStrOut, M4OSA_Char *pStrIn, M4OSA_UInt32 len2Copy)
-{
- M4OSA_TRACE1_3("M4OSA_chrNCopy\t(M4OSA_Char* %x,M4OSA_Char* %x,M4OSA_UInt32 %ld)",
- pStrOut,pStrIn,len2Copy);
- M4OSA_DEBUG_IF2((M4OSA_NULL == pStrOut),M4ERR_PARAMETER,
- "M4OSA_chrNCopy:\tpStrOut is M4OSA_NULL");
- M4OSA_DEBUG_IF2((M4OSA_NULL == pStrIn),M4ERR_PARAMETER,
- "M4OSA_chrNCopy:\tpStrIn is M4OSA_NULL");
-
- strncpy((char *)pStrOut, (const char *)pStrIn, (size_t)len2Copy);
- if(len2Copy <= (M4OSA_UInt32)strlen((const char *)pStrIn))
- {
- pStrOut[len2Copy] = '\0';
- }
-
- return M4NO_ERROR;
-}
-
-/**
- ************************************************************************
- * @brief This function returns the boolean comparison of pStrIn1 and pStrIn2.
- * @note The value returned in result is M4OSA_TRUE if the string
- * pointed to by pStrIn1 is strictly identical to the string pointed
- * to by pStrIn2, and M4OSA_FALSE otherwise.
- * @param pStrIn1: (IN) First character string.
- * @param pStrIn2: (IN) Second character string.
- * @param cmpResult: (OUT) Comparison result.
- * @return M4NO_ERROR: there is no error.
- * @return M4ERR_PARAMETER: pStrIn1 pStrIn2 or cmpResult is M4OSA_NULL.
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_chrAreIdentical(M4OSA_Char* pStrIn1, M4OSA_Char* pStrIn2,
- M4OSA_Bool* pResult)
-{
- M4OSA_UInt32 i32,len32;
- M4OSA_TRACE1_3("M4OSA_chrAreIdentical\t(M4OSA_Char* %x,M4OSA_Char* %x,"
- "M4OSA_Int32* %x)",pStrIn1,pStrIn2,pResult);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pStrIn1, M4ERR_PARAMETER,
- "M4OSA_chrAreIdentical:\tpStrIn1 is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pStrIn2, M4ERR_PARAMETER,
- "M4OSA_chrAreIdentical:\tpStrIn2 is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pResult, M4ERR_PARAMETER,
- "M4OSA_chrAreIdentical:\tpResult is M4OSA_NULL");
-
- len32 = (M4OSA_UInt32)strlen((const char *)pStrIn1);
- if(len32 != (M4OSA_UInt32)strlen((const char *)pStrIn2))
- {
- *pResult = M4OSA_FALSE;
- return M4NO_ERROR;
- }
-
- for(i32=0;i32<len32;i32++)
- {
- if(pStrIn1[i32] != pStrIn2[i32])
- {
- *pResult = M4OSA_FALSE;
- return M4NO_ERROR;
- }
- }
-
- *pResult = M4OSA_TRUE;
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function gets a M4OSA_UInt32 from string.
- * @note This function converts the first set of non-whitespace
- * characters of pStrIn to a M4OSA_UInt32 value pVal, assuming a
- * representation in base provided by the parameter base. pStrOut is
- * set to the first character of the string following the last
- * character of the number that has been converted.
- * - in case of a failure during the conversion, pStrOut is not
- * updated, and pVal is set to null.
- * - in case of negative number, pStrOut is not updated, and pVal is
- * set to null.
- * - in case of numerical overflow, pVal is set to M4OSA_UINT32_MAX.
- * - if pStrOut is not to be used, it can be set to M4OSA_NULL.
- * @param pStrIn: (IN) Character string.
- * @param pVal: (OUT) read value.
- * @param pStrOut: (OUT) Output character string.
- * @param base: (IN) Base of the character string representation.
- * @return M4NO_ERROR: there is no error.
- * @return M4ERR_PARAMETER: pStrIn or pVal is M4OSA_NULL.
- * @return M4ERR_CHR_CONV_FAILED: conversion failure.
- * @return M4WAR_CHR_NUM_RANGE: the character string represents a number
- * greater than M4OSA_UINT32_MAX.
- * @return M4WAR_CHR_NEGATIVE: the character string represents a negative
- * number.
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_chrGetUInt32(M4OSA_Char* pStrIn,
- M4OSA_UInt32* pVal,
- M4OSA_Char** pStrOut,
- M4OSA_chrNumBase base)
-{
- M4OSA_UInt32 ul;
- char* pTemp;
-
- M4OSA_TRACE1_4("M4OSA_chrGetUInt32\t(M4OSA_Char* %x, M4OSA_UInt32* %x"
- "M4OSA_Char** %x,M4OSA_chrNumBase %d)",pStrIn,pVal,pStrOut,base);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pStrIn, M4ERR_PARAMETER,
- "M4OSA_chrGetUInt32:\tpStrIn is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pVal, M4ERR_PARAMETER,
- "M4OSA_chrGetUInt32:\tpVal is M4OSA_NULL");
-
- errno = 0;
- switch(base)
- {
- case M4OSA_kchrDec:
- ul = strtoul((const char *)pStrIn, &pTemp, 10);
- break;
- case M4OSA_kchrHexa:
- ul = strtoul((const char *)pStrIn, &pTemp,16);
- break;
- case M4OSA_kchrOct:
- ul = strtoul((const char *)pStrIn, &pTemp,8);
- break;
- default:
- return M4ERR_PARAMETER;
- }
-
- /* has conversion failed ? */
- if((M4OSA_Char*)pTemp == pStrIn)
- {
- *pVal = 0;
- return M4ERR_CHR_CONV_FAILED;
- }
-
- /* was the number negative ? */
- if(*(pStrIn+strspn((const char *)pStrIn," \t")) == '-')
- {
- *pVal = 0;
- return M4WAR_CHR_NEGATIVE;
- }
-
- /* has an overflow occured ? */
- if(errno == ERANGE)
- {
- *pVal = M4OSA_UINT32_MAX;
- if(M4OSA_NULL != pStrOut)
- {
- *pStrOut = (M4OSA_Char*)pTemp;
- }
- return M4WAR_CHR_NUM_RANGE;
- }
-
- /* nominal case */
- *pVal = (M4OSA_UInt32)ul;
- if(M4OSA_NULL != pStrOut)
- {
- *pStrOut = (M4OSA_Char*)pTemp;
- }
-
- return M4NO_ERROR;
-}
-
-/**
- ************************************************************************
- * @brief This function gets a M4OSA_UInt16 from string.
- * @note This function converts the first set of non-whitespace
- * characters of pStrIn to a M4OSA_UInt16 value pVal, assuming a
- * representation in base provided by the parameter base. pStrOut is
- * set to the first character of the string following the last
- * character of the number that has been converted.
- * - in case of a failure during the conversion, pStrOut is not
- * updated, and pVal is set to null.
- * - in case of negative number, pStrOut is not updated, and pVal is
- * set to null.
- * - in case of numerical overflow, pVal is set to M4OSA_UINT16_MAX.
- * - if pStrOut is not to be used, it can be set to M4OSA_NULL.
- * @param pStrIn: (IN) Character string.
- * @param pVal: (OUT) read value.
- * @param pStrOut: (OUT) Output character string.
- * @param base: (IN) Base of the character string representation.
- * @return M4NO_ERROR: there is no error.
- * @return M4ERR_PARAMETER: pStrIn or pVal is M4OSA_NULL.
- * @return M4ERR_CHR_CONV_FAILED: conversion failure.
- * @return M4WAR_CHR_NUM_RANGE: the character string represents a number
- * greater than M4OSA_UINT16_MAX.
- * @return M4WAR_CHR_NEGATIVE: the character string represents a negative
- * number.
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_chrGetUInt16 (M4OSA_Char* pStrIn, M4OSA_UInt16 *pVal,
- M4OSA_Char** pStrOut, M4OSA_chrNumBase base)
-{
- M4OSA_UInt32 ul;
- char* pTemp;
-
- M4OSA_TRACE1_4("M4OSA_chrGetUInt16\t(M4OSA_Char* %x, M4OSA_UInt16* %x"
- "M4OSA_Char** %x,M4OSA_chrNumBase %d)",pStrIn,pVal,pStrOut,base);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pStrIn,M4ERR_PARAMETER,
- "M4OSA_chrGetUInt16:\tpStrIn is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pVal, M4ERR_PARAMETER,
- "M4OSA_chrGetUInt16:\tpVal is M4OSA_NULL");
-
- switch(base)
- {
- case M4OSA_kchrDec:
- ul = strtoul((const char *)pStrIn, &pTemp,10);
- break;
- case M4OSA_kchrHexa:
- ul = strtoul((const char *)pStrIn, &pTemp,16);
- break;
- case M4OSA_kchrOct:
- ul = strtoul((const char *)pStrIn, &pTemp,8);
- break;
- default:
- return M4ERR_PARAMETER;
- }
-
- /* has conversion failed ? */
- if((M4OSA_Char*)pTemp == pStrIn)
- {
- *pVal = 0;
- return M4ERR_CHR_CONV_FAILED;
- }
-
- /* was the number negative ? */
- if(*(pStrIn+strspn((const char *)pStrIn," \t")) == '-')
- {
- *pVal = 0;
- return M4WAR_CHR_NEGATIVE;
- }
-
- /* has an overflow occured ? */
- if(ul>M4OSA_UINT16_MAX)
- {
- *pVal = M4OSA_UINT16_MAX;
- if(M4OSA_NULL != pStrOut)
- {
- *pStrOut = (M4OSA_Char*)pTemp;
- }
- return M4WAR_CHR_NUM_RANGE;
- }
-
- /* nominal case */
- *pVal = (M4OSA_UInt16)ul;
- if(M4OSA_NULL != pStrOut)
- {
- *pStrOut = (M4OSA_Char*)pTemp;
- }
- return M4NO_ERROR;
-}
-
-M4OSA_ERR M4OSA_chrSPrintf(M4OSA_Char *pStrOut, M4OSA_UInt32 strOutMaxLen,
- M4OSA_Char *format, ...)
-{
- va_list marker;
- M4OSA_Char *pTemp;
- M4OSA_Char *percentPointer;
- M4OSA_Char *newFormat;
- M4OSA_Int32 newFormatLength=0;
- M4OSA_UInt32 count_ll = 0;
- M4OSA_UInt32 count_tm = 0;
- M4OSA_UInt32 count_aa = 0;
- M4OSA_UInt32 count;
- M4OSA_UInt32 nbChar;
- M4OSA_Int32 err;
- M4OSA_Char flagChar[] = "'-+ #0";
- M4OSA_Char widthOrPrecisionChar[] = "*0123456789";
- M4OSA_Char otherPrefixChar[] = "hlL";
- M4OSA_Char conversionChar[] = "diouxXnfeEgGcCsSp%";
-
- M4OSA_TRACE1_3("M4OSA_chrSPrintf\t(M4OSA_Char* %x, M4OSA_UInt32 %ld"
- "M4OSA_Char* %x)",pStrOut,strOutMaxLen,format);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pStrOut, M4ERR_PARAMETER,
- "M4OSA_chrSPrintf:\tpStrOut is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == format, M4ERR_PARAMETER,
- "M4OSA_chrSPrintf:\tformat is M4OSA_NULL");
-
- va_start(marker,format);
-
- /* count the number of %[flags][width][.precision]ll[conversion] */
- pTemp = format;
- while(*pTemp)
- {
- percentPointer = (M4OSA_Char *)strchr((const char *)pTemp,'%'); /* get the next percent character */
- if(!percentPointer)
- break; /* "This is the End", (c) J. Morrisson */
- pTemp = percentPointer+1; /* span it */
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- pTemp += strspn((const char *)pTemp,(const char *)flagChar); /* span the optional flags */
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- pTemp += strspn((const char *)pTemp,(const char *)widthOrPrecisionChar); /* span the optional width */
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- if(*pTemp=='.')
- {
- pTemp++;
- pTemp += strspn((const char *)pTemp, (const char *)widthOrPrecisionChar); /* span the optional precision */
- }
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- if(strlen((const char *)pTemp)>=2)
- {
- if(!strncmp((const char *)pTemp,"ll",2))
- {
- count_ll++; /* I got ONE */
- pTemp +=2; /* span the "ll" prefix */
- }
- else if(!strncmp((const char *)pTemp,"tm",2))
- {
- count_tm++;
- pTemp +=2;
- }
- else if(!strncmp((const char *)pTemp,"aa",2))
- {
- count_aa++;
- pTemp +=2;
- }
- }
- pTemp += strspn((const char *)pTemp, (const char *)otherPrefixChar); /* span the other optional prefix */
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- pTemp += strspn((const char *)pTemp, (const char *)conversionChar);
- if(!*pTemp)
- break; /* "This is the End", (c) J. Morrisson */
- }
-
- count = count_ll + count_tm + count_aa;
-
- if(!count)
- {
- err= vsnprintf((char *)pStrOut, (size_t)strOutMaxLen + 1, (const char *)format, marker);
- va_end(marker);
- if ((err<0) || ((M4OSA_UInt32)err>strOutMaxLen))
- {
- pStrOut[strOutMaxLen] = '\0';
- return M4ERR_CHR_STR_OVERFLOW;
- }
- else
- {
- return M4NO_ERROR;
- }
- }
-
-
- newFormatLength = strlen((const char *)format) + 1;
-
- newFormatLength -= (count_ll+count_tm+count_aa);
-
- newFormat =(M4OSA_Char*)M4OSA_32bitAlignedMalloc(newFormatLength,
- M4OSA_CHARSTAR,(M4OSA_Char*)"M4OSA_chrPrintf: newFormat");
- if(M4OSA_NULL == newFormat)
- return M4ERR_ALLOC;
- newFormat[newFormatLength-1] = '\0';
- pTemp = newFormat;
-
- /* copy format to newFormat, replacing %[flags][width][.precision]ll[conversion]
- * by %[flags][width][.precision]I64[conversion] */
- while(*format)
- {
- nbChar = strcspn((const char *)format, "%");
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar); /* copy characters before the % character */
- format +=nbChar;
- pTemp +=nbChar;
- }
- if(!*format) break;
- *pTemp++ = *format++; /* copy the % character */
- nbChar = strspn((const char *)format, (const char *)flagChar);
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar); /* copy the flag characters */
- format +=nbChar;
- pTemp +=nbChar;
- }
- if(!*format) break;
- nbChar = strspn((const char *)format, (const char *)widthOrPrecisionChar);
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar); /* copy the width characters */
- format +=nbChar;
- pTemp +=nbChar;
- }
- if(!*format) break;
- if(*format=='.')
- {
- *pTemp++ = *format++; /* copy the dot character */
- if(!format) break;
- nbChar = strspn((const char *)format, (const char *)widthOrPrecisionChar);
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar); /* copy the width characters */
- format +=nbChar;
- pTemp +=nbChar;
- }
- if(!format) break;
- }
- if(strlen((const char *)format)>=2)
- {
- if(!strncmp((const char *)format, "ll", 2))
- {
- *pTemp++ = 'l'; /* %l */
- format +=2; /* span the "ll" prefix */
- }
- else if(!strncmp((const char *)format, "tm", 2))
- {
- *pTemp++ = 'l'; /* %l */
- format +=2; /* span the "tm" prefix */
- }
- else if(!strncmp((const char *)format, "aa", 2))
- {
- *pTemp++ = 'l';
- format +=2; /* span the "aa" prefix */
- }
- }
- nbChar = strspn((const char *)format, (const char *)otherPrefixChar);
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar); /* copy the other Prefix */
- format +=nbChar;
- pTemp +=nbChar;
- }
- if(!*format) break;
- nbChar = strspn((const char *)format, (const char *)conversionChar);
- if(nbChar)
- {
- strncpy((char *)pTemp, (const char *)format, nbChar);
- format += nbChar;
- pTemp += nbChar;
- }
- if(!*format) break;
- }
-
- /* Zero terminate the format string. */
- (*pTemp) = '\0';
-
- err = vsnprintf((char *)pStrOut, (size_t)strOutMaxLen + 1, (const char *)newFormat, marker);
- va_end(marker);
- free(newFormat);
- if ((err<0) || ((M4OSA_UInt32)err>strOutMaxLen))
- {
- pStrOut[strOutMaxLen] = '\0';
- return M4ERR_CHR_STR_OVERFLOW;
- }
- else
- {
- return M4NO_ERROR;
- }
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_Clock.c b/libvideoeditor/osal/src/M4OSA_Clock.c
deleted file mode 100755
index 9817b22..0000000
--- a/libvideoeditor/osal/src/M4OSA_Clock.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.c
- * @brief Clock related functions
- * @note This file implements functions to manipulate clock
- ************************************************************************
-*/
-
-#include <sys/time.h>
-#include <time.h>
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_Clock.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Types.h"
-
-
-
-
-/**
- ************************************************************************
- * @brief This function gets an absolute time to an unknown reference with
- * a high precision.
- * @note It means it can only be used to get a relative time by computing
- * differences between to times.
- * It is to the caller to allocate time. Time is expressed in
- * timescale unit.
- * M4OSA_ROLLOVER_CLOCK in M4OSA_Types.h must be configured with the rollover
- * offset of this function.
- * @param time: (IN/OUT) time
- * @param timescale: (IN) The timescale (time unit per second)
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4WAR_TIMESCALE_TOO_BIG: the precision of the system clock is
- * not
- * compliant with the input timescale
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, M4OSA_UInt32 timescale)
-{
- struct timeval tv;
- struct timezone tz;
- M4OSA_UInt32 u32_time = 0;
- M4OSA_UInt32 u32_time_hi;
- M4OSA_UInt32 u32_time_lo;
- M4OSA_UInt32 u32_time_lh;
- M4OSA_UInt32 factor;
-
- M4OSA_TRACE1_2("M4OSA_clockGetTime\t\tM4OSA_Time* 0x%x\tM4OSA_UInt32 %d",
- pTime, timescale);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pTime, M4ERR_PARAMETER,
- "M4OSA_clockGetTime: pTime is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == timescale, M4ERR_PARAMETER,
- "M4OSA_clockGetTime: timescale is 0");
-
- factor = 1000000 / timescale;
-
- if(gettimeofday(&tv, &tz) == 0)
- {
- u32_time_lo = (tv.tv_sec & 0xFFFF) * timescale;
- u32_time_hi = (((tv.tv_sec >> 16) & 0xFFFF) * timescale) + ((u32_time_lo >> 16) & 0xFFFF);
- u32_time_lo &= 0xFFFF;
- u32_time_lo += tv.tv_usec / factor;
- u32_time_hi += ((u32_time_lo >> 16) & 0xFFFF);
- u32_time_lo &= 0xFFFF;
- u32_time = ((u32_time_hi & 0x7FFF) << 16) | u32_time_lo;
- }
-
- /* M4OSA_Time is signed, so we need to check the max value*/
- if (u32_time > M4OSA_INT32_MAX)
- {
- u32_time = u32_time - M4OSA_INT32_MAX;
- }
-
- *pTime = (M4OSA_Time)u32_time;
-
- if( timescale > 10000 )
- {
- return M4WAR_TIMESCALE_TOO_BIG;
- }
-
- return M4NO_ERROR;
-}
diff --git a/libvideoeditor/osal/src/M4OSA_FileCommon.c b/libvideoeditor/osal/src/M4OSA_FileCommon.c
deleted file mode 100755
index c12db5d..0000000
--- a/libvideoeditor/osal/src/M4OSA_FileCommon.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * 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.c
- * @brief File common for Android
- * @note This file implements functions used by both the file writer
- * and file reader.
- ************************************************************************
-*/
-
-#ifndef USE_STAGEFRIGHT_CODECS
-#error "USE_STAGEFRIGHT_CODECS is not defined"
-#endif /*USE_STAGEFRIGHT_CODECS*/
-
-#ifdef UTF_CONVERSION
-#include <string.h>
-#endif /*UTF_CONVERSION*/
-
-#include <sys/stat.h>
-#include <errno.h>
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
-#include "M4OSA_Semaphore.h"
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_FileCommon.h"
-#include "M4OSA_FileCommon_priv.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_CharStar.h"
-
-/**
- ************************************************************************
- * @brief This function opens the provided URL and returns its context.
- * If an error occured, the context is set to NULL.
- * @param core_id: (IN) Core ID of the caller (M4OSA_FILE_READER or M4OSA_FILE_WRITER)
- * @param context: (OUT) Context of the core file reader
- * @param url: (IN) URL of the input file
- * @param fileModeAccess: (IN) File mode access
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_ALLOC: there is no more memory available
- * @return M4ERR_NOT_IMPLEMENTED: the URL does not match with the supported
- * file
- * @return M4ERR_FILE_NOT_FOUND: the file cannot be found
- * @return M4ERR_FILE_LOCKED: the file is locked by an other
- * application/process
- * @return M4ERR_FILE_BAD_MODE_ACCESS: the file mode access is not correct
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext,
- M4OSA_Char* pUrl, M4OSA_FileModeAccess fileModeAccess)
-{
-
- M4OSA_Int32 i = 0;
- M4OSA_Int32 iMode = 0;
- M4OSA_Int32 iSize = 0;
- M4OSA_Int32 iSavePos = 0;
-
- M4OSA_Char mode[4] = "";
- M4OSA_Char* pReadString = (M4OSA_Char*)"r";
- M4OSA_Char* pWriteString = (M4OSA_Char*)"w";
- M4OSA_Char* pAppendString = (M4OSA_Char*)"a";
- M4OSA_Char* pBinaryString = (M4OSA_Char*)"b";
- M4OSA_Char* pPlusString = (M4OSA_Char*)"+";
-
- M4OSA_ERR err = M4NO_ERROR;
-
- FILE* pFileHandler = M4OSA_NULL;
- M4OSA_FileContext *pFileContext = M4OSA_NULL;
-
-
-#ifdef UTF_CONVERSION
- /*FB: to test the UTF16->UTF8 conversion into Video Artist*/
- /*Convert the URL from UTF16 to UTF8*/
- M4OSA_Void* tempConversionBuf;
- M4OSA_UInt32 tempConversionSize = 1000;
-
- tempConversionBuf = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(tempConversionSize +1, 0, "conversion buf");
- if(tempConversionBuf == M4OSA_NULL)
- {
- M4OSA_TRACE1_0("Error when allocating conversion buffer\n");
- return M4ERR_PARAMETER;
- }
- M4OSA_ToUTF8_OSAL(pUrl, tempConversionBuf, &tempConversionSize);
- ((M4OSA_Char*)tempConversionBuf)[tempConversionSize ] = '\0';
-
- printf("file open %s\n", tempConversionBuf);
-#endif /*UTF CONVERSION*/
-
- M4OSA_TRACE3_4("M4OSA_fileCommonOpen\t\tM4OSA_UInt16 %d\tM4OSA_Context* 0x%x\t"
- "M4OSA_Char* %s\tfileModeAccess %d", core_id, pContext, pUrl, fileModeAccess);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER, "M4OSA_fileCommonOpen: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pUrl, M4ERR_PARAMETER, "M4OSA_fileCommonOpen: pUrl is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == fileModeAccess, M4ERR_PARAMETER, "M4OSA_fileCommonOpen: fileModeAccess is 0");
-
- /* Read mode not set for the reader */
- M4OSA_DEBUG_IF1((M4OSA_FILE_READER == core_id) && !(fileModeAccess & M4OSA_kFileRead),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileRead");
-
- /* Read mode not set for the reader */
- M4OSA_DEBUG_IF1((M4OSA_FILE_READER == core_id) && !(fileModeAccess & M4OSA_kFileRead),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileRead");
-
- /* M4OSAfileReadOpen cannot be used with Write file mode access */
- M4OSA_DEBUG_IF1((M4OSA_FILE_READER == core_id) && (fileModeAccess & M4OSA_kFileWrite),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileWrite");
-
- /* Append and Create flags cannot be used with Read */
- M4OSA_DEBUG_IF1((M4OSA_FILE_READER == core_id) && (fileModeAccess & M4OSA_kFileAppend),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileAppend");
-
- M4OSA_DEBUG_IF1((M4OSA_FILE_READER == core_id) && (fileModeAccess & M4OSA_kFileCreate),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileCreate");
-
- /* Write mode not set for the writer */
- M4OSA_DEBUG_IF1((M4OSA_FILE_WRITER == core_id) && !(fileModeAccess & M4OSA_kFileWrite),
- M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileWrite");
-
- /* Create flag necessary for opening file */
- if ((fileModeAccess & M4OSA_kFileRead) &&
- (fileModeAccess & M4OSA_kFileWrite)&&(fileModeAccess & M4OSA_kFileCreate))
- {
- strncat((char *)mode, (const char *)pWriteString, (size_t)1);
- strncat((char *)mode, (const char *)pPlusString, (size_t)1);
- }
- else
- {
- if(fileModeAccess & M4OSA_kFileAppend)
- {
- strncat((char *)mode, (const char *)pAppendString, (size_t)1);
- }
- else if(fileModeAccess & M4OSA_kFileRead)
- {
- strncat((char *)mode, (const char *)pReadString, (size_t)1);
- }
- else if(fileModeAccess & M4OSA_kFileWrite)
- {
- strncat((char *)mode, (const char *)pWriteString, (size_t)1);
- }
-
- if((fileModeAccess & M4OSA_kFileRead)&&(fileModeAccess & M4OSA_kFileWrite))
- {
- strncat((char *)mode,(const char *)pPlusString, (size_t)1);
- }
- }
-
- if(!(fileModeAccess & M4OSA_kFileIsTextMode))
- {
- strncat((char *)mode, (const char *)pBinaryString,(size_t)1);
- }
-
- /*Open the file*/
-
-#ifdef UTF_CONVERSION
- /*Open the converted path*/
- pFileHandler = fopen((const char *)tempConversionBuf, (const char *)mode);
- /*Free the temporary decoded buffer*/
- free(tempConversionBuf);
-#else /* UTF_CONVERSION */
- pFileHandler = fopen((const char *)pUrl, (const char *)mode);
-#endif /* UTF_CONVERSION */
-
- if (M4OSA_NULL == pFileHandler)
- {
- switch(errno)
- {
- case ENOENT:
- {
- M4OSA_DEBUG(M4ERR_FILE_NOT_FOUND, "M4OSA_fileCommonOpen: No such file or directory");
- M4OSA_TRACE1_1("File not found: %s", pUrl);
- return M4ERR_FILE_NOT_FOUND;
- }
- case EACCES:
- {
- M4OSA_DEBUG(M4ERR_FILE_LOCKED, "M4OSA_fileCommonOpen: Permission denied");
- return M4ERR_FILE_LOCKED;
- }
- case EINVAL:
- {
- M4OSA_DEBUG(M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: Invalid Argument");
- return M4ERR_FILE_BAD_MODE_ACCESS;
- }
- case EMFILE:
- case ENOSPC:
- case ENOMEM:
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonOpen: Too many open files");
- return M4ERR_ALLOC;
- }
- default:
- {
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_fileCommonOpen");
- return M4ERR_NOT_IMPLEMENTED;
- }
- }
- }
-
- /* Allocate the file context */
- pFileContext = (M4OSA_FileContext*) M4OSA_32bitAlignedMalloc(sizeof(M4OSA_FileContext),
- core_id, (M4OSA_Char*)"M4OSA_fileCommonOpen: file context");
- if (M4OSA_NULL == pFileContext)
- {
- fclose(pFileHandler);
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonOpen");
- return M4ERR_ALLOC;
- }
-
- pFileContext->file_desc = pFileHandler;
- pFileContext->access_mode = fileModeAccess;
- pFileContext->current_seek = SeekNone;
- pFileContext->b_is_end_of_file = M4OSA_FALSE;
-
- /**
- * Note: Never use this expression "i = (value1 == value2) ? x: y;"
- * because that doens't compile on other platforms (ADS for example)
- * Use: if(value1 == value2)
- * { i= x; ..etc
- */
- pFileContext->coreID_write = 0;
- pFileContext->coreID_read = 0;
- pFileContext->m_DescrModeAccess = M4OSA_kDescNoneAccess;
-
- if (M4OSA_FILE_READER == core_id)
- {
- pFileContext->coreID_read = core_id;
- pFileContext->m_DescrModeAccess = M4OSA_kDescReadAccess;
- }
- else if (M4OSA_FILE_WRITER == core_id)
- {
- pFileContext->coreID_write = core_id;
- pFileContext->m_DescrModeAccess = M4OSA_kDescWriteAccess;
- }
-
- pFileContext->read_position = 0;
- pFileContext->write_position = 0;
-
- /* Allocate the memory to store the URL string */
- pFileContext->url_name = (M4OSA_Char*) M4OSA_32bitAlignedMalloc(strlen((const char *)pUrl)+1,
- core_id, (M4OSA_Char*)"M4OSA_fileCommonOpen: URL name");
- if (M4OSA_NULL == pFileContext->url_name)
- {
- fclose(pFileHandler);
- free(pFileContext);
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonOpen");
- return M4ERR_ALLOC;
- }
- M4OSA_chrNCopy(pFileContext->url_name, pUrl, strlen((const char *)pUrl)+1);
-
- /* Get the file name */
- err = M4OSA_fileCommonGetFilename(pUrl, &pFileContext->file_name);
- if(M4NO_ERROR != err)
- {
- fclose(pFileHandler);
- free(pFileContext->url_name);
- free(pFileContext);
- M4OSA_DEBUG(err, "M4OSA_fileCommonOpen");
- return err;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreOpen(&(pFileContext->semaphore_context), 1); /* Allocate the semaphore */
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-
-
-#ifdef USE_STAGEFRIGHT_CODECS
- // Workaround for file system bug on Stingray/Honeycomb where a file re-created will keep
- // the original file's size filled with 0s. Do not seek to the end to avoid ill effects
- if(fileModeAccess & M4OSA_kFileAppend) {
- /* Get the file size */
- iSavePos = ftell(pFileHandler); /* 1- Check the first position */
- fseek(pFileHandler, 0, SEEK_END); /* 2- Go to the end of the file*/
- iSize = ftell(pFileHandler); /* 3- Check the file size */
- fseek(pFileHandler, iSavePos, SEEK_SET);/* 4- go to the first position */
- } else {
- iSize = 0;
- }
-#else /* USE_STAGEFRIGHT_CODECS */
- /* Get the file size */
- iSavePos = ftell(pFileHandler); /* 1- Check the first position */
- fseek(pFileHandler, 0, SEEK_END); /* 2- Go to the end of the file*/
- iSize = ftell(pFileHandler); /* 3- Check the file size */
- fseek(pFileHandler, iSavePos, SEEK_SET);/* 4- go to the first position */
-#endif /* USE_STAGEFRIGHT_CODECS */
-
-
-
- /* Warning possible overflow if the file is higher than 2GBytes */
- pFileContext->file_size = iSize;
-
- *pContext = pFileContext;
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function convert from UTF16 to UTF8
- * @param pBufferIn: (IN) UTF16 input path
- * @param pBufferOut: (OUT) UTF8 output path
- * @param bufferOutSize: (IN/OUT) size of the output path
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: the output path size is not enough to contain
- * the decoded path
- ************************************************************************
-*/
-#ifdef UTF_CONVERSION
-M4OSA_ERR M4OSA_ToUTF8_OSAL (M4OSA_Void *pBufferIn, M4OSA_UInt8 *pBufferOut,
- M4OSA_UInt32 *bufferOutSize)
-{
- M4OSA_UInt16 i;
- wchar_t *w_str = (wchar_t *) pBufferIn;
- M4OSA_UInt32 len, size_needed, size_given;
- if (pBufferIn == NULL)
- {
- *pBufferOut=NULL;
- *bufferOutSize=1;
- }
- else
- {
- len = wcslen(w_str);
- size_needed = len+1;
- size_given = *bufferOutSize;
-
- *bufferOutSize=size_needed;
- if (size_given < size_needed )
- {
- return M4ERR_PARAMETER;
- }
- else
- {
- for (i=0; i<len; i++)
- {
- pBufferOut[i]=(M4OSA_UInt8)w_str[i];
- }
- pBufferOut[len]=0;
- }
- }
- return M4NO_ERROR;
-}
-#endif /*UTF CONVERSION*/
-
-/**
- ************************************************************************
- * @brief This function seeks at the provided position.
- * @param context: (IN/OUT) Context of the core file reader
- * @param seekMode: (IN) Seek access mode
- * @param position: (IN/OUT) Position in the file
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- * @return M4ERR_FILE_INVALID_POSITION: the position cannot be reached
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context pContext,
- M4OSA_FileSeekAccessMode seekMode,
- M4OSA_FilePosition* pFilePos)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_FilePosition fpos_current;
- M4OSA_FilePosition fpos_seek;
- M4OSA_FilePosition fpos_null = 0;
- M4OSA_FilePosition fpos_neg_un = -1;
- M4OSA_FilePosition fpos_file_size;
- M4OSA_FilePosition fpos_seek_from_beginning;
-
- M4OSA_TRACE3_3("M4OSA_fileCommonSeek\t\tM4OSA_Context 0x%x\t M4OSA_FileSeekAccessMode %d\tM4OSA_FilePosition* 0x%x",
- pContext, seekMode, pFilePos);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER, "M4OSA_fileCommonSeek");
- M4OSA_DEBUG_IF2(0 == seekMode, M4ERR_PARAMETER, "M4OSA_fileCommonSeek");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFilePos, M4ERR_PARAMETER, "M4OSA_fileCommonSeek");
-
- fpos_file_size = pFileContext->file_size;
-
- if(SeekRead == pFileContext->current_seek)
- {
- fpos_current = pFileContext->read_position;
- }
- else if(SeekWrite == pFileContext->current_seek)
- {
- fpos_current = pFileContext->write_position;
- }
- else
- {
- fpos_current = 0;
- }
-
- switch(seekMode)
- {
- case M4OSA_kFileSeekCurrent:
- {
- fpos_seek = *pFilePos;
- break;
- }
- case M4OSA_kFileSeekBeginning:
- {
- fpos_seek = *pFilePos - fpos_current;
- break;
- }
- case M4OSA_kFileSeekEnd:
- {
- fpos_seek = *pFilePos + fpos_file_size - fpos_current;
- break;
- }
- default:
- {
- return M4ERR_PARAMETER;
- }
- }
-
- fpos_seek_from_beginning = fpos_current + fpos_seek;
-
- if(fseek(pFileContext->file_desc, fpos_seek, SEEK_CUR) != 0)
- {
- switch(errno)
- {
- case EINVAL:
- {
- /* meaning the value for origin is invalid or the position
- specified by offset is before the beginning of the file */
- return M4ERR_FILE_INVALID_POSITION;
- }
-
- case EBADF:
- default:
- {
- return M4ERR_BAD_CONTEXT;/* file handle is invalid */
- }
- }
- }
-
- /* Set the returned position from the beginning of the file */
- *pFilePos = fpos_seek_from_beginning;
-
- /* SEEK done, reset end of file value */
- pFileContext->b_is_end_of_file = M4OSA_FALSE;
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function asks to close the file (associated to the context)
- * @note The context of the core file reader/writer is freed.
- * @param context: (IN/OUT) Context of the core file reader
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- ************************************************************************
-*/
-
-M4OSA_ERR M4OSA_fileCommonClose(M4OSA_UInt16 core_id, M4OSA_Context pContext)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_Int32 i32_err_code=0;
-
- M4OSA_TRACE3_2("M4OSA_fileCommonClose\tM4OSA_UInt16 %d\tM4OSA_Context 0x%x",
- core_id, pContext);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext,
- M4ERR_PARAMETER, "M4OSA_fileCommonClose: pContext is M4OSA_NULL");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context, M4ERR_BAD_CONTEXT,
- "M4OSA_fileCommonClose: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- free(pFileContext->url_name);
- pFileContext->url_name = M4OSA_NULL;
-
- free(pFileContext->file_name);
- pFileContext->file_name = M4OSA_NULL;
-
- i32_err_code = fclose(pFileContext->file_desc);
-
- pFileContext->file_desc = M4OSA_NULL;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreClose(pFileContext->semaphore_context);/* free the semaphore */
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- free(pFileContext);
-
- if (i32_err_code != 0)
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_fileCommonClose");
- return M4ERR_BAD_CONTEXT;
- }
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function gets the file attributes (associated to the
- * context)
- * @param context: (IN) Context of the core file reader
- * @param attribute: (OUT) The file attribute (allocated by the caller)
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileCommonGetAttribute(M4OSA_Context pContext, M4OSA_FileAttribute* pAttribute)
-{
-
- M4OSA_FileContext* fileContext = pContext;
-
- struct stat TheStat;
-
- M4OSA_TRACE3_2("M4OSA_fileCommonGetAttribute\tM4OSA_Context 0x%x\t"
- "M4OSA_FileAttribute* 0x%x", pContext, pAttribute);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER, "M4OSA_fileCommonGetAttribute");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pAttribute, M4ERR_PARAMETER, "M4OSA_fileCommonGetAttribute");
-
- if(stat((char*)fileContext->url_name, &TheStat) != 0)
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_fileCommonGetAttribute");
- return M4ERR_BAD_CONTEXT;
- }
-
- pAttribute->creationDate.time = (M4OSA_Time)TheStat.st_ctime;
- pAttribute->lastAccessDate.time = (M4OSA_Time)TheStat.st_atime;
- pAttribute->modifiedDate.time = (M4OSA_Time)TheStat.st_mtime;
-
- pAttribute->creationDate.timeScale = 1;
- pAttribute->lastAccessDate.timeScale = 1;
- pAttribute->modifiedDate.timeScale = 1;
-
- pAttribute->creationDate.referenceYear = 1970;
- pAttribute->lastAccessDate.referenceYear = 1970;
- pAttribute->modifiedDate.referenceYear = 1970;
-
- pAttribute->modeAccess = fileContext->access_mode;
-
- return M4NO_ERROR;
-}
-
-/**
- ************************************************************************
- * @brief This function gets the file URL (associated to the context).
- * @note
- * @param context: (IN) Context of the core file reader
- * @param url: (OUT) The buffer containing the URL (allocated by
- * M4OSA_fileCommonGetURL)
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileCommonGetURL(M4OSA_Context pContext, M4OSA_Char** pUrl)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_UInt32 uiLength;
-
- M4OSA_TRACE3_2("M4OSA_fileCommonGetURL\tM4OSA_Context 0x%x\tM4OSA_Char** 0x%x",
- pContext, pUrl);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileCommonGetURL: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pUrl, M4ERR_PARAMETER,
- "M4OSA_fileCommonGetURL: pUrl is M4OSA_NULL");
-
- uiLength = strlen((const char *)pFileContext->url_name)+1;
-
- /* Allocate the memory to store the url_name */
- *pUrl = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(uiLength, M4OSA_FILE_COMMON,
- (M4OSA_Char*)"M4OSA_fileCommonGetURL: url");
- if(M4OSA_NULL == *pUrl)
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonGetURL");
- return M4ERR_ALLOC;
- }
-
- M4OSA_chrNCopy(*pUrl, pFileContext->url_name, uiLength);
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function gets a string containing the file name associated
- * to the input URL.
- * @note The user should not forget to delete the output string using
- * M4OSA_strDestroy
- * @param pUrl: (IN) The buffer containing the URL
- * @param pFileName: (OUT) The string containing the URL. It is
- * allocated inside this function
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_NOT_IMPLEMENTED: the URL does not match with the supported
- * file
- * @return M4ERR_ALLOC: there is no more memory available
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileCommonGetFilename(M4OSA_Char* pUrl, M4OSA_Char** pFileName)
-{
- M4OSA_Int32 i = 0;
- M4OSA_Int32 iUrlLen = 0;
- M4OSA_Int32 FileNameLen = 0;
-
- M4OSA_Char* ptrUrl = M4OSA_NULL;
- M4OSA_Char* ptrFilename = M4OSA_NULL;
-
- M4OSA_TRACE3_2("M4OSA_fileCommonGetURL\tM4OSA_Char* %s\tM4OSA_Char** 0x%x",
- pUrl, pFileName);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pUrl, M4ERR_PARAMETER,
- "M4OSA_fileCommonGetFilename: pUrl is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileName, M4ERR_PARAMETER,
- "M4OSA_fileCommonGetFilename: pFileName is M4OSA_NULL");
-
- *pFileName = M4OSA_NULL;
-
- /*Parse URL*/
- iUrlLen = strlen((const char *)pUrl);
- for(i=iUrlLen-1; i>=0; i--)
- {
- if (pUrl[i] != '\\' && pUrl[i] != '/')
- {
- FileNameLen++;
- }
- else
- {
- break; /* find the beginning of the file name */
- }
- }
-
- ptrFilename = (M4OSA_Char*) M4OSA_32bitAlignedMalloc(FileNameLen+1, M4OSA_FILE_COMMON,
- (M4OSA_Char*)"M4OSA_fileCommonGetFilename: Filename string");
- if (ptrFilename == M4OSA_NULL)
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileCommonGetFilename");
- return M4ERR_ALLOC;
- }
-
- ptrUrl = pUrl + (iUrlLen - FileNameLen);
- M4OSA_chrNCopy(ptrFilename, ptrUrl, FileNameLen+1);
-
- *pFileName = ptrFilename;
-
- return M4NO_ERROR;
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_FileReader.c b/libvideoeditor/osal/src/M4OSA_FileReader.c
deleted file mode 100755
index 40a72f5..0000000
--- a/libvideoeditor/osal/src/M4OSA_FileReader.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * 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.c
- * @author Cedric Lecoutre (cedric.lecoutre@philips.com)
- * Laurent Fay (laurent.fay@philips.com)
- * @par Org: Philips Digital Systems Laboratories - Paris (PDSL-P)
- * @brief File reader for Android
- * @note This file implements functions to read a file.
- ************************************************************************
-*/
-
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_FileCommon_priv.h"
-#include "M4OSA_FileReader.h"
-#include "M4OSA_FileReader_priv.h"
-#include "M4OSA_Memory.h"
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
-#include "M4OSA_Semaphore.h"
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-
-/**
-************************************************************************
-* @brief This function opens the provided URL and returns its context.
-* If an error occured, the context is set to NULL.
-* @param context: (OUT) Context of the core file reader
-* @param url: (IN) URL of the input file
-* @param fileModeAccess: (IN) File mode access
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER: at least one parameter is NULL
-* @return M4ERR_ALLOC: there is no more memory available
-* @return M4ERR_NOT_IMPLEMENTED: the URL does not match with the supported
-* file
-* @return M4ERR_FILE_NOT_FOUND: the file cannot be found
-* @return M4ERR_FILE_LOCKED: the file is locked by an other
-* application/process
-* @return M4ERR_FILE_BAD_MODE_ACCESS: the file mode access is not correct
-************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadOpen(M4OSA_Context* pContext, M4OSA_Void* pFileDescriptor,
- M4OSA_UInt32 fileModeAccess)
-{
- M4OSA_TRACE1_3("M4OSA_fileReadOpen : pC = 0x%p fd = 0x%p mode = %lu",
- pContext, pFileDescriptor, fileModeAccess);
-
- return M4OSA_fileCommonOpen(M4OSA_FILE_READER, pContext,
- pFileDescriptor, fileModeAccess);
-}
-
-/**
-************************************************************************
-* @brief This function reads the 'size' bytes in the core file reader
-* (selected by its 'context') and writes the data to the 'data'
-* pointer.
-* @note If 'size' byte cannot be read in the core file reader, 'size'
-* parameter is updated to match the correct
-* @note number of read bytes.
-* @param context: (IN/OUT) Context of the core file reader
-* @param buffer: (OUT) Data pointer of the read data
-* @param size: (IN/OUT) Size of the data to read (in bytes)
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER: at least one parameter is NULL
-* @return M4ERR_BAD_CONTEXT: provided context is not a valid one
-* @return M4ERR_ALLOC: there is no more memory available
-* @return M4WAR_NO_DATA_YET: there is no enough data to fill the 'data'
-* buffer, so the size parameter has been updated.
-************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadData(M4OSA_Context pContext, M4OSA_MemAddr8 data,
- M4OSA_UInt32* pSize)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_ERR err = M4NO_ERROR;
- M4OSA_Int32 uiSizeRead;
-
- M4OSA_TRACE2_2("M4OSA_fileReadData : data = 0x%p size = %lu",
- data, (M4OSA_NULL != pSize) ? (*pSize) : 0);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileReadData: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == data, M4ERR_PARAMETER,
- "M4OSA_fileReadData: data is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pSize, M4ERR_PARAMETER,
- "M4OSA_fileReadData: pSize is M4OSA_NULL");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context,
- M4ERR_BAD_CONTEXT, "M4OSA_fileReadData: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if(M4OSA_kDescRWAccess == pFileContext->m_DescrModeAccess) /* read write */
- {
- uiSizeRead = fread(data, sizeof(M4OSA_Char), *pSize,
- pFileContext->file_desc);
- if(-1 == uiSizeRead)
- {
- /* handle is invalid, or the file is not open for reading, or the file is locked */
- *pSize = 0;
- err = M4ERR_BAD_CONTEXT;
- }
- else
- {
- pFileContext->read_position = pFileContext->read_position + uiSizeRead;
- if ((M4OSA_UInt32)uiSizeRead < *pSize)
- {
- *pSize = uiSizeRead;
- /* This is the end of file */
- pFileContext->b_is_end_of_file = M4OSA_TRUE;
- err = M4WAR_NO_DATA_YET;
- }
- else
- {
- *pSize = uiSizeRead;
- }
- }
-
- return err;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if(pFileContext->current_seek != SeekRead)
- {
- /* fseek to the last read position */
- err = M4OSA_fileCommonSeek(pContext, M4OSA_kFileSeekBeginning,
- &(pFileContext->read_position));
- if(M4OSA_ERR_IS_ERROR(err))
- {
- M4OSA_DEBUG(err, "M4OSA_fileReadData: M4OSA_fileCommonSeek");
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return err;
- }
-
- pFileContext->current_seek = SeekRead;
- }
-
- /* Read data */
- uiSizeRead = fread(data, sizeof(M4OSA_Char), *pSize,
- pFileContext->file_desc);
- if(-1 == uiSizeRead)
- {
- /* handle is invalid, or the file is not open for reading,
- or the file is locked */
- *pSize = 0;
- err = M4ERR_BAD_CONTEXT;
- }
- else
- {
- pFileContext->read_position = pFileContext->read_position + uiSizeRead;
- if ((M4OSA_UInt32)uiSizeRead < *pSize)
- {
- *pSize = uiSizeRead;
-
- /* This is the end of file */
- pFileContext->b_is_end_of_file = M4OSA_TRUE;
-
- err = M4WAR_NO_DATA_YET;
- }
- else
- {
- *pSize = uiSizeRead;
- }
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-
- return err;
-}
-
-
-/**
-************************************************************************
- * @brief This function seeks at the provided position in the core file
- * reader (selected by its 'context'). The position is related to
- * the seekMode parameter it can be either from the beginning, from
- * the end or from the current postion. To support large file
- * access (more than 2GBytes), the position is provided on a 64
- * bits.
- * @note If this function returns an error the current position pointer
- * in the file must not change. Else the current
- * position pointer must be updated.
- * @param context: (IN/OUT) Context of the core file reader
- * @param seekMode: (IN) Seek access mode
- * @param position: (IN/OUT) Position in the file
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- * @return M4ERR_FILE_INVALID_POSITION: the position cannot be reached
- ************************************************************************
-*/
-
-M4OSA_ERR M4OSA_fileReadSeek(M4OSA_Context pContext, M4OSA_FileSeekAccessMode seekMode,
- M4OSA_FilePosition* pPosition)
-{
- M4OSA_FileContext* pFileContext = (M4OSA_FileContext*)pContext;
- M4OSA_ERR err;
-
- M4OSA_TRACE2_2("M4OSA_fileReadSeek : mode = %d pos = %lu", seekMode,
- (pPosition != M4OSA_NULL) ? (*pPosition) : 0);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileReadSeek: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == seekMode, M4ERR_PARAMETER,
- "M4OSA_fileReadSeek: seekMode is 0");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pPosition, M4ERR_PARAMETER,
- "M4OSA_fileReadSeek: pPosition is M4OSA_NULL");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context,
- M4ERR_BAD_CONTEXT, "M4OSA_fileReadSeek: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if (M4OSA_kDescRWAccess == pFileContext->m_DescrModeAccess)
- {
- M4OSA_UInt32 SeekModeOption;
- /* Go to the desired position */
- if (M4OSA_kFileSeekBeginning == seekMode)
- {
- SeekModeOption = SEEK_SET;
- }
- else if (M4OSA_kFileSeekEnd == seekMode)
- {
- SeekModeOption = SEEK_END;
- }
- else if (M4OSA_kFileSeekCurrent == seekMode)
- {
- SeekModeOption = SEEK_CUR;
- }
- else
- {
- M4OSA_TRACE1_0("M4OSA_fileReadSeek: END WITH ERROR !!! (CONVERION ERROR FOR THE SEEK MODE)");
- return M4ERR_PARAMETER;
- }
-
- /**
- * Go to the desired position */
- err = fseek(pFileContext->file_desc, *pPosition, SeekModeOption);
- if(err != 0)
- {
- /* converts the error to PSW format*/
- err=((M4OSA_UInt32)(M4_ERR)<<30)+(((M4OSA_FILE_WRITER)&0x003FFF)<<16)+(M4OSA_Int16)(err);
- M4OSA_TRACE1_1("M4OSA_FileReadSeek error:%x",err);
- }
- else
- {
- return M4NO_ERROR;
- }
-
- /* Return without error */
- return err;
- }
-
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if(pFileContext->current_seek != SeekRead)
- {
-
- /* fseek to the last read position */
- err = M4OSA_fileCommonSeek(pContext, M4OSA_kFileSeekBeginning,
- &(pFileContext->read_position));
- if(M4OSA_ERR_IS_ERROR(err))
- {
- M4OSA_DEBUG(err, "M4OSA_fileReadData: M4OSA_fileCommonSeek");
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return err;
- }
-
- pFileContext->current_seek = SeekRead;
- }
-
- err = M4OSA_fileCommonSeek(pContext, seekMode, pPosition);
- if(M4OSA_ERR_IS_ERROR(err))
- {
- M4OSA_DEBUG(err, "M4OSA_fileReadData: M4OSA_fileCommonSeek");
- }
- else
- {
- pFileContext->read_position = *pPosition;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return err;
-}
-
-
-/**
- ************************************************************************
- * @brief This function asks the core file reader to close the file
- * (associated to the context).
- * @note The context of the core file reader is freed.
- * @param pContext: (IN/OUT) Context of the core file reader
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadClose(M4OSA_Context pContext)
-{
- M4OSA_FileContext* pFileContext = (M4OSA_FileContext*)pContext;
-
- M4OSA_TRACE1_1("M4OSA_fileReadClose : pC = 0x%p", pContext);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileReadClose: pContext is M4OSA_NULL");
-
- if(M4OSA_FILE_WRITER == pFileContext->coreID_write)
- {
- return M4NO_ERROR;
- }
-
- return M4OSA_fileCommonClose(M4OSA_FILE_READER, pContext);
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This function asks the core file reader to return the value
- * associated with the optionID. The caller is responsible for
- * allocating/de-allocating the memory of the value field.
- * @note 'value' must be cast according to the type related to the
- * optionID As the caller is responsible for
- * allocating/de-allocating the 'value' field, the callee must copy
- * this field to its internal variable.
- * @param pContext: (IN/OUT) Context of the core file reader
- * @param pOptionID: (IN) ID of the option
- * @param pOptionValue: (OUT) Value of the option
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
- * @return M4ERR_WRITE_ONLY: this option is a write only one
- * @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadGetOption(M4OSA_Context pContext, M4OSA_FileReadOptionID optionID,
- M4OSA_DataOption* pOptionValue)
-{
- M4OSA_FileContext* pFileContext = pContext;
-
- M4OSA_TRACE2_1("M4OSA_fileReadGetOption : option = 0x%x", optionID);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileReadGetOption: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(optionID == 0, M4ERR_PARAMETER,
- "M4OSA_fileReadGetOption: optionID is 0");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pOptionValue, M4ERR_PARAMETER,
- "M4OSA_fileReadGetOption: pOptionValue is M4OSA_NULL");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_FILE_READER),
- M4ERR_BAD_OPTION_ID, "M4OSA_fileReadGetOption");
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_READABLE(optionID),
- M4ERR_WRITE_ONLY, "M4OSA_fileReadGetOption");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context,
- M4ERR_BAD_CONTEXT,
- "M4OSA_fileReadGetOption: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- switch(optionID)
- {
-#if(M4OSA_OPTIONID_FILE_READ_GET_FILE_POSITION == M4OSA_TRUE)
- case M4OSA_kFileReadGetFilePosition:
- {
- M4OSA_FilePosition* pPosition = (M4OSA_FilePosition*)pOptionValue;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- *pPosition = pFileContext->read_position;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_READ_GET_FILE_POSITION*/
-
-#if(M4OSA_OPTIONID_FILE_READ_IS_EOF == M4OSA_TRUE)
- case M4OSA_kFileReadIsEOF:
- {
- M4OSA_Bool* bIsEndOfFile = (M4OSA_Bool*)pOptionValue;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- *bIsEndOfFile = pFileContext->b_is_end_of_file;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_READ_IS_EOF*/
-
-
-#if(M4OSA_OPTIONID_FILE_READ_GET_FILE_SIZE == M4OSA_TRUE)
- case M4OSA_kFileReadGetFileSize:
- {
- M4OSA_FilePosition* pPosition = (M4OSA_FilePosition*)pOptionValue;
- M4OSA_Int32 iSavePos = 0;
- M4OSA_Int32 iSize = 0;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
- /**
- * Bugfix: update the file size.
- * When a file is in read mode, may be another application is writing in.
- * So, we have to update the file size */
- iSavePos = ftell(pFileContext->file_desc); /*1- Check the first position */
- fseek(pFileContext->file_desc, 0, SEEK_END); /*2- Go to the end of the file */
- iSize = ftell(pFileContext->file_desc); /*3- Check the file size*/
- fseek(pFileContext->file_desc, iSavePos, SEEK_SET); /*4- go to the first position*/
- pFileContext->file_size = iSize;
-
- *pPosition = pFileContext->file_size;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_READ_GET_FILE_SIZE*/
-
-#if(M4OSA_OPTIONID_FILE_READ_GET_FILE_ATTRIBUTE == M4OSA_TRUE)
- case M4OSA_kFileReadGetFileAttribute:
- {
- return M4OSA_fileCommonGetAttribute(pContext,
- (M4OSA_FileAttribute*)pOptionValue);
- }
-#endif /*M4OSA_OPTIONID_FILE_READ_GET_FILE_ATTRIBUTE*/
-
-#if(M4OSA_OPTIONID_FILE_READ_GET_URL == M4OSA_TRUE)
- case M4OSA_kFileReadGetURL:
- {
- return M4OSA_fileCommonGetURL(pContext, (M4OSA_Char**)pOptionValue);
- }
-#endif /*M4OSA_OPTIONID_FILE_READ_GET_URL*/
-
- case M4OSA_kFileReadLockMode:
- {
- *(M4OSA_UInt32*)pOptionValue = pFileContext->m_uiLockMode;
- return M4NO_ERROR;
- }
- }
-
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_fileReadGetOption");
-
- return M4ERR_NOT_IMPLEMENTED;
-}
-
-/**
- ************************************************************************
- * @fn M4OSA_ERR M4OSA_fileReadSetOption (M4OSA_Context context,
- * M4OSA_OptionID optionID, M4OSA_DataOption optionValue))
- * @brief This function asks the core file reader to set the value associated with the optionID.
- * The caller is responsible for allocating/de-allocating the memory of the value field.
- * @note As the caller is responsible for allocating/de-allocating the 'value' field, the callee must copy this field
- * to its internal variable.
- * @param pContext: (IN/OUT) Context of the core file reader
- * @param optionID: (IN) ID of the option
- * @param value: (IN) Value of the option
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
- * @return M4ERR_READ_ONLY: this option is a read only one
- * @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileReadSetOption(M4OSA_Context pContext,
- M4OSA_FileReadOptionID optionID,
- M4OSA_DataOption optionValue)
-{
- M4OSA_FileContext* pFileContext = pContext;
-
- M4OSA_TRACE2_1("M4OSA_fileReadSetOption : option = 0x%x", optionID);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileReadSetOption: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == optionID, M4ERR_PARAMETER,
- "M4OSA_fileReadSetOption");
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_FILE_READER),
- M4ERR_BAD_OPTION_ID, "M4OSA_fileReadSetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_WRITABLE(optionID),
- M4ERR_READ_ONLY, "M4OSA_fileReadSetOption");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context,
- M4ERR_BAD_CONTEXT,
- "M4OSA_fileReadSetOption: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- switch(optionID)
- {
- case M4OSA_kFileReadLockMode:
- {
- pFileContext->m_uiLockMode= (M4OSA_UInt32)*(M4OSA_UInt32*)optionValue;
- return M4NO_ERROR;
- }
- default:
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_fileReadSetOption");
- return M4ERR_NOT_IMPLEMENTED;
- }
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_FileWriter.c b/libvideoeditor/osal/src/M4OSA_FileWriter.c
deleted file mode 100755
index 37fc173..0000000
--- a/libvideoeditor/osal/src/M4OSA_FileWriter.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * 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.c
- * @brief File writer for Android
- * @note This file implements functions to write in a file.
- ************************************************************************
-*/
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_FileCommon_priv.h"
-#include "M4OSA_FileWriter.h"
-#include "M4OSA_FileWriter_priv.h"
-#include "M4OSA_Memory.h"
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
-#include "M4OSA_Semaphore.h"
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-/**
- ************************************************************************
- * @brief This function opens the provided URL and returns its context.
- * If an error occured, the context is set to NULL.
- * @param pContext: (OUT) Context of the core file writer
- * @param pUrl: (IN) URL of the input file
- * @param fileModeAccess: (IN) File mode access
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_ALLOC: there is no more memory available
- * @return M4ERR_NOT_IMPLEMENTED: the URL does not match with the supported
- * file
- * @return M4ERR_FILE_NOT_FOUND: the file cannot be found
- * @return M4ERR_FILE_LOCKED: the file is locked by an other
- * application/process
- * @return M4ERR_FILE_BAD_MODE_ACCESS: the file mode access is not correct
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileWriteOpen(M4OSA_Context* pContext, M4OSA_Void* pUrl,
- M4OSA_UInt32 fileModeAccess)
-{
- M4OSA_TRACE1_3("M4OSA_fileWriteOpen : pC = 0x%p fd = 0x%p mode = %d",
- pContext, pUrl, fileModeAccess);
-
- return M4OSA_fileCommonOpen(M4OSA_FILE_WRITER, pContext, pUrl,
- fileModeAccess);
-}
-
-
-/**
- ************************************************************************
- * @brief This function writes the 'size' bytes stored at 'data' memory
- * in the file selected by its context.
- * @note The caller is responsible for allocating/de-allocating the
- * memory for 'data' parameter.
- * @note Moreover the data pointer must be allocated to store at least
- * 'size' bytes.
- * @param pContext: (IN/OUT) Context of the core file reader
- * @param buffer: (IN) Data pointer of the write data
- * @param size: (IN) Size of the data to write (in bytes)
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileWriteData(M4OSA_Context pContext, M4OSA_MemAddr8 data,
- M4OSA_UInt32 uiSize)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_ERR err;
- M4OSA_UInt32 uiSizeWrite;
-
- M4OSA_TRACE2_2("M4OSA_fileWriteData : data = 0x%p size = %lu", data,
- uiSize);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteData: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_NULL == data, M4ERR_PARAMETER,
- "M4OSA_fileWriteData: data is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == uiSize, M4ERR_PARAMETER,
- "M4OSA_fileWriteData: uiSize is 0");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context,
- M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteData: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if (M4OSA_kDescRWAccess == pFileContext->m_DescrModeAccess)
- {
- M4OSA_UInt32 WriteSize;
- err = M4NO_ERROR;
- WriteSize = fwrite((void *)data,1, uiSize, pFileContext->file_desc);
- if(WriteSize != uiSize)
- {
- /* converts the error to PSW format*/
- err = ((M4OSA_UInt32)(M4_ERR)<<30)+(((M4OSA_FILE_WRITER)&0x003FFF)<<16)+(M4OSA_Int16)(WriteSize);
- M4OSA_TRACE1_1("M4OSA_FileWriteData error:%x",err);
- }
- fflush(pFileContext->file_desc);
-
- pFileContext->write_position = pFileContext->write_position + WriteSize;
-
- /* Update the file size */
- if(pFileContext->write_position > pFileContext->file_size)
- {
- pFileContext->file_size = pFileContext->write_position;
- }
- return err;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if(pFileContext->current_seek != SeekWrite)
- {
- /* fseek to the last read position */
- err = M4OSA_fileCommonSeek(pContext, M4OSA_kFileSeekBeginning,
- &(pFileContext->write_position));
-
- if(M4OSA_ERR_IS_ERROR(err))
- {
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
- M4OSA_DEBUG(err, "M4OSA_fileWriteData: M4OSA_fileCommonSeek");
- return err;
- }
-
- pFileContext->current_seek = SeekWrite;
- }
-
- /* Write data */
- uiSizeWrite = fwrite(data, sizeof(M4OSA_Char), uiSize, pFileContext->file_desc);
-
- if(uiSizeWrite == (M4OSA_UInt32)-1)
- {
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- /* An error occured */
-
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_fileWriteData: fwrite failed");
- return M4ERR_BAD_CONTEXT;
- }
-
- pFileContext->write_position = pFileContext->write_position + uiSizeWrite;
-
- /* Update the file size */
- if(pFileContext->write_position > pFileContext->file_size)
- {
- pFileContext->file_size = pFileContext->write_position;
- }
-
- if((M4OSA_UInt32)uiSizeWrite < uiSize)
- {
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_fileWriteData");
- return M4ERR_ALLOC;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function seeks at the provided position in the core file
- * writer (selected by its 'context'). The position is related to
- * the seekMode parameter it can be either from the beginning,
- * from the end or from the current postion. To support large file
- * access (more than 2GBytes), the position is provided on a 64
- * bits.
- * @note If this function returns an error the current position pointer
- * in the file must not change. Else the current position pointer
- * must be updated.
- * @param pContext: (IN/OUT) Context of the core file reader
- * @param seekMode: (IN) Seek access mode
- * @param position: (IN/OUT) Position in the file
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
- * @return M4ERR_FILE_INVALID_POSITION: the position cannot be reached
- ************************************************************************
- */
-M4OSA_ERR M4OSA_fileWriteSeek(M4OSA_Context pContext, M4OSA_FileSeekAccessMode seekMode,
- M4OSA_FilePosition* pPosition)
-{
- M4OSA_FileContext* pFileContext = (M4OSA_FileContext*)pContext;
- M4OSA_ERR err;
-
- M4OSA_TRACE2_2("M4OSA_fileWriteSeek : mode = %d pos = %lu",
- seekMode, (M4OSA_NULL != pPosition) ? (*pPosition) : 0);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteSeek: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(0 == seekMode, M4ERR_PARAMETER,
- "M4OSA_fileWriteSeek: seemMode is 0");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pPosition, M4ERR_PARAMETER,
- "M4OSA_fileWriteSeek: pPosition is M4OSA_NULL");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context, M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteSeek: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if (M4OSA_kDescRWAccess == pFileContext->m_DescrModeAccess) /* read write */
- {
- M4OSA_UInt32 SeekModeOption;
- /*The position for the seek mode between the SHP and the OSAl part are different */
- if (M4OSA_kFileSeekBeginning == seekMode)
- {
- SeekModeOption = SEEK_SET;
- }
- else if (M4OSA_kFileSeekEnd == seekMode)
- {
- SeekModeOption = SEEK_END;
- }
- else if (M4OSA_kFileSeekCurrent == seekMode)
- {
- SeekModeOption = SEEK_CUR;
- }
- else
- {
- M4OSA_TRACE1_0("M4OSA_fileWriteSeek: END WITH ERROR !!! (CONVERION ERROR FOR THE SEEK MODE) ");
- return M4ERR_PARAMETER;
- }
-
- /**
- * Go to the desired position */
- err = fseek(pFileContext->file_desc,*pPosition,SeekModeOption);
- if(err != 0)
- {
- /* converts the error to PSW format*/
- err=((M4OSA_UInt32)(M4_ERR)<<30)+(((M4OSA_FILE_WRITER)&0x003FFF)<<16)+(M4OSA_Int16)(err);
- M4OSA_TRACE1_1("M4OSA_FileWriteSeek error:%x",err);
- }
- else
- {
- return M4NO_ERROR;
- }
-
- return err;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- err = M4OSA_fileCommonSeek(pContext, seekMode, pPosition);
-
- if(M4OSA_ERR_IS_ERROR(err))
- {
- M4OSA_DEBUG(err, "M4OSA_fileWriteSeek: M4OSA_fileCommonSeek");
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return err;
- }
-
- pFileContext->write_position = *pPosition;
-
- pFileContext->current_seek = SeekWrite;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
-}
-
-
-/**
- ************************************************************************
- * @brief This function asks the core file writer to close the file
- * (associated to the context).
- * @note The context of the core file writer is freed.
- * @param pContext: (IN/OUT) Context of the core file writer
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_ALLOC: there is no more memory available
-************************************************************************
-*/
-
-M4OSA_ERR M4OSA_fileWriteClose(M4OSA_Context pContext)
-{
- M4OSA_FileContext* pFileContext = (M4OSA_FileContext*)pContext;
-
- M4OSA_TRACE1_1("M4OSA_fileWriteClose : pC = 0x%p", pContext);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteClose: pContext is M4OSA_NULL");
-
- return M4OSA_fileCommonClose(M4OSA_FILE_WRITER, pContext);
-}
-
-
-/**
- ************************************************************************
- * @brief This function flushes the stream associated to the context.
- * @param pContext: (IN/OUT) Context of the core file writer
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_fileWriteFlush(M4OSA_Context pContext)
-{
- M4OSA_FileContext* pFileContext = pContext;
- M4OSA_ERR err = M4NO_ERROR;
-
- M4OSA_TRACE2_1("M4OSA_fileWriteFlush : pC = 0x%p", pContext);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteFlush: pcontext is M4OSA_NULL");
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context, M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteFlush: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- if (fflush(pFileContext->file_desc) != 0)
- {
- err = M4ERR_BAD_CONTEXT;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return err;
-}
-
-
-/**
- ************************************************************************
- * @brief This function asks the core file writer to return the value
- * associated with the optionID.
- * The caller is responsible for allocating/de-allocating the
- * memory of the value field.
- * @note 'value' must be cast according to the type related to the
- * optionID
- * As the caller is responsible for allocating/de-allocating the
- * 'value' field, the callee must copy this field
- * to its internal variable.
- * @param pContext: (IN/OUT) Context of the core file writer
- * @param optionID: (IN) ID of the option
- * @param value: (OUT) Value of the option
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
- * @return M4ERR_WRITE_ONLY: this option is a write only one
- * @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
-************************************************************************
-*/
-
-M4OSA_ERR M4OSA_fileWriteGetOption(M4OSA_Context pContext, M4OSA_OptionID optionID,
- M4OSA_DataOption* pOptionValue)
-{
- M4OSA_FileContext* pFileContext = pContext;
-
- M4OSA_TRACE2_1("M4OSA_fileWriteGetOption : option = 0x%x", optionID);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteGetOption: pContext is M4OSA_NULL");
- M4OSA_DEBUG_IF2(optionID == 0, M4ERR_PARAMETER, "M4OSA_fileWriteGetOption");
- M4OSA_DEBUG_IF2(M4OSA_NULL == pOptionValue, M4ERR_PARAMETER,
- "M4OSA_fileWriteGetOption: pOtionValue is M4OSA_NULL");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_FILE_WRITER),
- M4ERR_BAD_OPTION_ID, "M4OSA_fileWriteGetOption");
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_READABLE(optionID), M4ERR_WRITE_ONLY,
- "M4OSA_fileWriteGetOption");
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context, M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteGetOption: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- switch(optionID)
- {
-#if(M4OSA_OPTIONID_FILE_WRITE_GET_FILE_POSITION == M4OSA_TRUE)
- case M4OSA_kFileWriteGetFilePosition:
- {
- M4OSA_FilePosition* position = (M4OSA_FilePosition*)pOptionValue;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- *position = pFileContext->write_position;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_WRITE_GET_FILE_POSITION*/
-
-#if(M4OSA_OPTIONID_FILE_WRITE_GET_FILE_SIZE == M4OSA_TRUE)
- case M4OSA_kFileWriteGetFileSize:
- {
- M4OSA_FilePosition* position = (M4OSA_FilePosition*)pOptionValue;
-
- if(M4OSA_kDescRWAccess == pFileContext->m_DescrModeAccess)
- {
- M4OSA_Int32 iSavePos = 0;
- M4OSA_Int32 iSize = 0;
-
- iSavePos = ftell(pFileContext->file_desc); /*1- Check the first position */
- fseek(pFileContext->file_desc, 0, SEEK_END); /*2- Go to the end of the file */
- *position = ftell(pFileContext->file_desc); /*3- Check the file size*/
- fseek(pFileContext->file_desc, iSavePos, SEEK_SET); /*4- go to the first position*/
- return M4NO_ERROR;
- }
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphoreWait(pFileContext->semaphore_context, M4OSA_WAIT_FOREVER);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- *position = pFileContext->file_size;
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_semaphorePost(pFileContext->semaphore_context);
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_WRITE_GET_FILE_SIZE*/
-
-#if(M4OSA_OPTIONID_FILE_WRITE_GET_URL == M4OSA_TRUE)
- case M4OSA_kFileWriteGetURL:
- {
- return M4OSA_fileCommonGetURL (pContext, (M4OSA_Char**)pOptionValue);
- }
-#endif /*M4OSA_OPTIONID_FILE_WRITE_GET_URL*/
-
-#if(M4OSA_OPTIONID_FILE_WRITE_GET_FILE_ATTRIBUTE == M4OSA_TRUE)
- case M4OSA_kFileWriteGetAttribute:
- {
- return M4OSA_fileCommonGetAttribute(pContext,
- (M4OSA_FileAttribute*)pOptionValue);
- }
-#endif /*M4OSA_OPTIONID_FILE_WRITE_GET_FILE_ATTRIBUTE*/
-
-#if(M4OSA_OPTIONID_FILE_WRITE_GET_READER_CONTEXT == M4OSA_TRUE)
- case M4OSA_kFileWriteGetReaderContext:
- {
- M4OSA_FileModeAccess access = pFileContext->access_mode;
-
- M4OSA_DEBUG_IF1(!(access & M4OSA_kFileRead), M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteGetOption: M4OSA_kFileRead");
-
- M4OSA_DEBUG_IF1(!(access & M4OSA_kFileWrite), M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteGetOption: M4OSA_kFileWrite");
-
- pFileContext->coreID_read = M4OSA_FILE_READER;
-
- *pOptionValue = pContext;
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_FILE_WRITE_GET_READER_CONTEXT*/
-
- case M4OSA_kFileWriteLockMode:
- {
- *(M4OSA_UInt32*)pOptionValue = pFileContext->m_uiLockMode;
- return M4NO_ERROR;
- }
-
- }
-
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_fileWriteGetOption");
-
- return M4ERR_NOT_IMPLEMENTED;
-}
-
-
-/**
-************************************************************************
-* @brief This function asks the core file writer to set the value
-* associated with the optionID.
-* The caller is responsible for allocating/de-allocating the
-* memory of the value field.
-* @note As the caller is responsible for allocating/de-allocating the
-* 'value' field, the callee must copy this field to its internal
-* variable.
-* @param pContext: (IN/OUT) Context of the core file writer
-* @param optionID: (IN) ID of the option
-* @param value: (IN) Value of the option
-* @return M4NO_ERROR: there is no error
-* @return M4ERR_PARAMETER: at least one parameter is NULL
-* @return M4ERR_BAD_CONTEXT: provided context is not a valid one
-* @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
-* @return M4ERR_READ_ONLY: this option is a read only one
-* @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
-************************************************************************
-*/
-
-M4OSA_ERR M4OSA_fileWriteSetOption(M4OSA_Context pContext,
- M4OSA_OptionID optionID,
- M4OSA_DataOption optionValue)
-{
- M4OSA_FileContext* pFileContext = pContext;
-
- M4OSA_TRACE2_1("M4OSA_fileWriteSetOption : option = 0x%x", optionID);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_fileWriteSetOption");
-
- M4OSA_DEBUG_IF2(0 == optionID, M4ERR_PARAMETER, "M4OSA_fileWriteSetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_FILE_WRITER),
- M4ERR_BAD_OPTION_ID, "M4OSA_fileWriteSetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_WRITABLE(optionID), M4ERR_READ_ONLY,
- "M4OSA_fileReadSetOption");
-
-#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE
- M4OSA_DEBUG_IF2(M4OSA_NULL == pFileContext->semaphore_context, M4ERR_BAD_CONTEXT,
- "M4OSA_fileWriteSetOption: semaphore_context is M4OSA_NULL");
-#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */
-
- switch(optionID)
- {
- case M4OSA_kFileWriteLockMode:
- {
- pFileContext->m_uiLockMode = (M4OSA_UInt32)*(M4OSA_UInt32*)optionValue;
- return M4NO_ERROR;
- }
-
- case M4OSA_kFileWriteDescMode:
- {
- pFileContext->m_DescrModeAccess = (M4OSA_Int32)*(M4OSA_Int32*)optionValue;
- return M4NO_ERROR;
- }
-
- default:
- return M4ERR_NOT_IMPLEMENTED;
- }
-
- return M4ERR_NOT_IMPLEMENTED;
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_Mutex.c b/libvideoeditor/osal/src/M4OSA_Mutex.c
deleted file mode 100755
index bbe6bba..0000000
--- a/libvideoeditor/osal/src/M4OSA_Mutex.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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.
- */
-/**
- ************************************************************************
- * @brief Mutex for Android
- * @note This file implements functions to manipulate mutex
- ************************************************************************
-*/
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_Types.h"
-#include "M4OSA_Error.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Mutex.h"
-
-#include <pthread.h>
-#include <errno.h>
-
-
-/* Context for the mutex */
-typedef struct
-{
- M4OSA_UInt32 coreID; /* mutex context identifiant */
- pthread_mutex_t mutex; /* mutex */
- pthread_t threadOwnerID; /* thread owner identifiant */
-} M4OSA_MutexContext;
-
-
-
-/**
- ************************************************************************
- * @brief This method creates a new mutex.
- * @note This function creates and allocates a unique context. It's the
- * OSAL real time responsibility for managing its context. It must
- * be freed by the M4OSA_mutexClose function. The context parameter
- * will be sent back to any OSAL core mutex functions to allow
- * retrieving data associated to the opened mutex.
- * @param pContext:(OUT) Context of the created mutex
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_ALLOC: there is no more available memory
- * @return M4ERR_CONTEXT_FAILED: the context creation failed
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_mutexOpen(M4OSA_Context* pContext)
-{
- M4OSA_MutexContext* pMutexContext = (M4OSA_MutexContext*)M4OSA_NULL;
- pthread_mutexattr_t attribute = { 0 };
- M4OSA_Bool opened = M4OSA_FALSE;
-
- M4OSA_TRACE1_1("M4OSA_mutexOpen\t\tM4OSA_Context* 0x%x", pContext);
- M4OSA_DEBUG_IF2(M4OSA_NULL == pContext, M4ERR_PARAMETER,
- "M4OSA_mutexOpen: pContext is M4OSA_NULL");
-
- *pContext = M4OSA_NULL;
-
- pMutexContext = (M4OSA_MutexContext*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_MutexContext),
- M4OSA_MUTEX, (M4OSA_Char*)"M4OSA_mutexOpen: mutex context");
-
- if(M4OSA_NULL == pMutexContext)
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_mutexOpen");
- return M4ERR_ALLOC;
- }
-
- /* Initialize the mutex attribute. */
- if ( 0 == pthread_mutexattr_init( &attribute ) )
- {
- /* Initialize the mutex type. */
- if ( 0 == pthread_mutexattr_settype( &attribute, PTHREAD_MUTEX_RECURSIVE ) )
- {
- /* Initialize the mutex. */
- if (0 == pthread_mutex_init( &pMutexContext->mutex, &attribute ) )
- {
- opened = M4OSA_TRUE;
- }
- }
-
- /* Destroy the mutex attribute. */
- pthread_mutexattr_destroy( &attribute );
- }
-
- if(!opened)
- {
- M4OSA_DEBUG(M4ERR_CONTEXT_FAILED, "M4OSA_mutexOpen: OS mutex creation failed");
- free(pMutexContext);
- return M4ERR_CONTEXT_FAILED ;
- }
-
- pMutexContext->coreID = M4OSA_MUTEX;
-
- pMutexContext->threadOwnerID = 0;
-
- *pContext = (M4OSA_Context) pMutexContext;
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method locks the mutex. "Context" identifies the mutex.
- * @note If the mutex is already locked, the calling thread blocks until
- * the mutex becomes available (by calling M4OSA_mutexUnlock) or
- * "timeout" is reached. This is a blocking call.
- * @param context:(IN/OUT) Context of the mutex
- * @param timeout:(IN) Time out in milliseconds
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4WAR_TIME_OUT: time out is elapsed before mutex has been
- * available
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_mutexLock(M4OSA_Context context, M4OSA_UInt32 timeout)
-{
- M4OSA_MutexContext* pMutexContext = (M4OSA_MutexContext*)context;
- pthread_t currentThread;
- int result;
- struct timespec ts;
- struct timespec left;
-
- M4OSA_TRACE1_2("M4OSA_mutexLock\t\tM4OSA_Context 0x%x\tM4OSA_UInt32 %d",
- context, timeout);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == context, M4ERR_PARAMETER,
- "M4OSA_mutexLock: context is M4OSA_NULL");
- M4OSA_DEBUG_IF2(pMutexContext->coreID != M4OSA_MUTEX,
- M4ERR_BAD_CONTEXT, "M4OSA_mutexLock");
-
- currentThread = pthread_self();
-
- if(pMutexContext ->threadOwnerID == currentThread)
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: Thread tried to lock a mutex it already owns");
- return M4ERR_BAD_CONTEXT ;
- }
-
- /* Lock the mutex. */
- if ( M4OSA_WAIT_FOREVER == timeout)
- {
- if ( 0 != pthread_mutex_lock(&pMutexContext->mutex) )
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: OS mutex wait failed");
- return M4ERR_BAD_CONTEXT;
- }
- }
- else
- {
- result = pthread_mutex_trylock(&pMutexContext->mutex);
- while ( ( EBUSY == result ) && ( 0 < timeout ) )
- {
- ts.tv_sec = 0;
- if (1 <= timeout)
- {
- ts.tv_nsec = 1000000;
- timeout -= 1;
- }
- else
- {
- ts.tv_nsec = timeout * 1000000;
- timeout = 0;
- }
- nanosleep(&ts, &left);
- result = pthread_mutex_trylock(&pMutexContext->mutex);
- }
- if (0 != result)
- {
- if (EBUSY == result)
- {
- return M4WAR_TIME_OUT;
- }
- else
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: OS mutex wait failed");
- return M4ERR_BAD_CONTEXT;
- }
- }
- }
-
- pMutexContext->threadOwnerID = currentThread;
-
- return M4NO_ERROR;
-}
-
-
-
-/**
- ************************************************************************
- * @brief This method unlocks the mutex. The mutex is identified by
- * its context
- * @note The M4OSA_mutexLock unblocks the thread with the highest
- * priority and made it ready to run.
- * @note No hypotheses can be made on which thread will be un-blocked
- * between threads with the same priority.
- * @param context:(IN/OUT) Context of the mutex
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
-************************************************************************
-*/
-M4OSA_ERR M4OSA_mutexUnlock(M4OSA_Context context)
-{
- M4OSA_MutexContext* pMutexContext = (M4OSA_MutexContext*)context;
- pthread_t currentThread;
-
- M4OSA_TRACE1_1("M4OSA_mutexUnlock\t\tM4OSA_Context 0x%x", context);
- M4OSA_DEBUG_IF2(M4OSA_NULL == context, M4ERR_PARAMETER,
- "M4OSA_mutexUnlock: context is M4OSA_NULL");
- M4OSA_DEBUG_IF2(M4OSA_MUTEX != pMutexContext->coreID,
- M4ERR_BAD_CONTEXT, "M4OSA_mutexUnlock");
-
- currentThread = pthread_self();
-
- if(pMutexContext->threadOwnerID != currentThread)
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexUnlock: Thread tried to unlock a mutex it doesn't own");
- return M4ERR_BAD_CONTEXT;
- }
-
- pMutexContext->threadOwnerID = 0 ;
-
- pthread_mutex_unlock(&pMutexContext->mutex);
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method deletes a mutex (identify by its context). After
- * this call, the mutex and its context is no more useable. This
- * function frees all the memory related to this mutex.
- * @note It is an application issue to warrant no more threads are locked
- * on the deleted mutex.
- * @param context:(IN/OUT) Context of the mutex
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_mutexClose(M4OSA_Context context)
-{
- M4OSA_MutexContext* pMutexContext = (M4OSA_MutexContext*)context;
-
- M4OSA_TRACE1_1("M4OSA_mutexClose\t\tM4OSA_Context 0x%x", context);
-
- M4OSA_DEBUG_IF2(M4OSA_NULL == context, M4ERR_PARAMETER,
- "M4OSA_mutexClose: context is M4OSA_NULL");
- M4OSA_DEBUG_IF2(pMutexContext->coreID != M4OSA_MUTEX,
- M4ERR_BAD_CONTEXT, "M4OSA_mutexUnlock");
-
- pthread_mutex_destroy(&pMutexContext->mutex);
-
- free( pMutexContext);
-
- return M4NO_ERROR;
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_Random.c b/libvideoeditor/osal/src/M4OSA_Random.c
deleted file mode 100755
index c24d039..0000000
--- a/libvideoeditor/osal/src/M4OSA_Random.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 M4PSW_Trace.c
- * @brief Trace function for trace macros
- * @note This file gives the implementation of the trace function used
- * in the trace instrumentation macros
- ************************************************************************
-*/
-
-#include <stdio.h> /*for printf */
-#include <stdarg.h> /* ANSI C macros and defs for variable args */
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "M4OSA_Types.h"
-#include "M4OSA_Error.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Mutex.h"
-/**
- ************************************************************************
- * @fn M4OSA_ERR M4OSA_randInit()
- * @brief this function initialize the number generator
- * this function must be called once before any call to M4OSA_rand()
- * need the stdlib and time libraries
- * @note
- * @param
- * @return M4NO_ERROR
- ************************************************************************
-*/
-
-M4OSA_ERR M4OSA_randInit()
-{
- int i;
-
- srand(time(NULL));
-
- /* Windows' rand is rotten, the first generated value after the init
- above is not random enough, so let's shake things a little... */
-
- for (i=0; i<100; i++) rand();
-
- return M4NO_ERROR;
-}
-/**
- ************************************************************************
- * @fn M4OSA_ERR M4OSA_rand(M4OSA_Int32* out_value, M4OSA_UInt32 max_value)
- * @brief This function gives a random number between 1 and max_value
- * (inclusive) with approximately equal probability, and
- * returns this number in out_value. For instance, a max_value
- * of 6 will simulate a fair 6-sided dice roll.
- * @note
- * @param out_value (OUT): on return, points to random result
- * @param max_value (IN): max expected value
- * @return M4NO_ERROR
- ************************************************************************
-*/
-
-M4OSA_ERR M4OSA_rand(M4OSA_Int32* out_value, M4OSA_UInt32 max_value)
-{
- if( (out_value == M4OSA_NULL) || (max_value < 1) )
- {
- return M4ERR_PARAMETER;
- }
-
- (*out_value) = rand();
- /* notice this algorithm will only work for max_values such that the multiplication
- won't overflow, which means that max_value typically shouldn't go over the range of
- an Int16. */
- (*out_value) = (((*out_value) * max_value) / ((M4OSA_UInt32)RAND_MAX + 1)) + 1;
-
- return M4NO_ERROR;
-}
-
-
diff --git a/libvideoeditor/osal/src/M4OSA_Semaphore.c b/libvideoeditor/osal/src/M4OSA_Semaphore.c
deleted file mode 100755
index f3b5852..0000000
--- a/libvideoeditor/osal/src/M4OSA_Semaphore.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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.c
- * @brief Semaphore for Windows
- * @note This file implements functions to manipulate semaphore
- ************************************************************************
-*/
-
-
-
-#include "M4OSA_Debug.h"
-#include "M4OSA_Types.h"
-#include "M4OSA_Error.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Semaphore.h"
-
-#include <semaphore.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-
-
-/* Context for the semaphore */
-typedef struct {
- M4OSA_UInt32 coreID; /* semaphore context identifiant */
- sem_t semaphore; /* semaphore */
-} M4OSA_SemaphoreContext;
-
-
-
-
-/**
- ************************************************************************
- * @brief This method creates a new semaphore with the "initialCounter"
- * value.
- * @note This function creates and allocates a unique context. It's the
- * OSAL real time responsibility for managing its context. It must
- * be freed by the M4OSA_semaphoreClose function. The context
- * parameter will be sent back to any OSAL core semaphore functions
- * to allow retrieving data associated to the opened semaphore.
- * @param context:(OUT) Context of the created semaphore
- * @param initial_count:(IN) Initial counter of the semaphore
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: provided context is NULL
- * @return M4ERR_ALLOC: there is no more available memory
- * @return M4ERR_CONTEXT_FAILED: the context creation failed
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_semaphoreOpen(M4OSA_Context* context,
- M4OSA_UInt32 initial_count)
-{
- M4OSA_SemaphoreContext* semaphoreContext = M4OSA_NULL;
-
- M4OSA_TRACE1_2("M4OSA_semaphoreOpen\t\tM4OSA_Context* 0x%x\tM4OSA_UInt32 "
- "%d", context, initial_count);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_semaphoreOpen");
-
- *context = M4OSA_NULL;
-
- semaphoreContext = (M4OSA_SemaphoreContext*) M4OSA_32bitAlignedMalloc(
- sizeof(M4OSA_SemaphoreContext), M4OSA_SEMAPHORE,
- (M4OSA_Char*)"M4OSA_semaphoreOpen: semaphore context");
-
- if(semaphoreContext == M4OSA_NULL)
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_semaphoreOpen");
-
- return M4ERR_ALLOC;
- }
-
- if (0 != sem_init(&semaphoreContext->semaphore, 0, initial_count))
- {
- free(semaphoreContext);
-
- M4OSA_DEBUG(M4ERR_CONTEXT_FAILED,
- "M4OSA_semaphoreOpen: OS semaphore creation failed");
-
- return M4ERR_CONTEXT_FAILED;
- }
-
- semaphoreContext->coreID = M4OSA_SEMAPHORE ;
- *context = (M4OSA_Context)semaphoreContext;
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method decrements (one by one) the semaphore counter. The
- * semaphore is identified by its context This call is not blocking
- * if the semaphore counter is positive or zero (after
- * decrementation). This call is blocking if the semaphore counter
- * is less than zero (after decrementation), until the semaphore is
- * upper than zero (see M4OSA_semaphorePost) or time_out is
- * reached.
- * @note If "timeout" value is M4OSA_WAIT_FOREVER, the calling thread
- * will block indefinitely until the semaphore is unlocked.
- * @param context:(IN/OUT) Context of the semaphore
- * @param timeout:(IN) Time out in milliseconds
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4WAR_TIME_OUT: time out is elapsed before semaphore has been
- * available.
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_semaphoreWait(M4OSA_Context context, M4OSA_Int32 timeout)
-{
- M4OSA_SemaphoreContext* semaphoreContext = (M4OSA_SemaphoreContext*)context;
- struct timespec ts;
- struct timespec left;
- int result;
-
- M4OSA_TRACE1_2("M4OSA_semaphoreWait\t\tM4OSA_Context 0x%x\tM4OSA_UInt32 %d",
- context, timeout);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_semaphoreWait");
-
- M4OSA_DEBUG_IF2(semaphoreContext->coreID != M4OSA_SEMAPHORE,
- M4ERR_BAD_CONTEXT, "M4OSA_semaphoreWait");
-
- if ( (M4OSA_Int32)M4OSA_WAIT_FOREVER == timeout)
- {
- if ( 0 != sem_wait(&semaphoreContext->semaphore) )
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT,
- "M4OSA_semaphoreWait: OS semaphore wait failed");
-
- return M4ERR_BAD_CONTEXT ;
- }
- }
- else
- {
- result = sem_trywait(&semaphoreContext->semaphore);
- while ( ((EBUSY == result) || (EAGAIN == result)) && ( 0 < timeout ) )
- {
- ts.tv_sec = 0;
- if (1 <= timeout)
- {
- ts.tv_nsec = 1000000;
- timeout -= 1;
- }
- else
- {
- ts.tv_nsec = timeout * 1000000;
- timeout = 0;
- }
- nanosleep(&ts, &left);
- result = sem_trywait(&semaphoreContext->semaphore);
- }
- if (0 != result)
- {
- if ((EBUSY == result) || (EAGAIN == result))
- {
- return M4WAR_TIME_OUT;
- }
- else
- {
- M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_semaphoreWait: OS semaphore wait failed");
- return M4ERR_BAD_CONTEXT;
- }
- }
- }
-
- return M4NO_ERROR;
-}
-
-
-
-
-
-/**
- ************************************************************************
- * @brief This method increments the semaphore counter. The semaphore is
- * identified by its context
- * @note If the semaphore counter is upper than zero (after addition),
- * the M4OSA_semaphoreWait call of the thread with the highest
- * priority is unblocked and made ready to run.
- * @note No hypotheses can be made on which thread will be unblocked
- * between threads with the same priority.
- * @param context:(IN/OUT) Context of the semaphore
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
-************************************************************************
-*/
-M4OSA_ERR M4OSA_semaphorePost(M4OSA_Context context)
-{
- M4OSA_SemaphoreContext* semaphoreContext = (M4OSA_SemaphoreContext*)context;
-
- M4OSA_TRACE1_1("M4OSA_semaphorePost\t\tM4OSA_Context 0x%x", context);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_semaphorePost");
-
- M4OSA_DEBUG_IF2(semaphoreContext->coreID != M4OSA_SEMAPHORE,
- M4ERR_BAD_CONTEXT, "M4OSA_semaphorePost");
-
- sem_post(&semaphoreContext->semaphore);
-
- return M4NO_ERROR;
-}
-
-
-
-
-
-/**
- ************************************************************************
- * @brief This method deletes a semaphore (identify by its context).
- * After this call the semaphore and its context is no more
- * useable. This function frees all the memory related to this
- * semaphore.
- * @note It is an application issue to warrant no more threads are locked
- * on the deleted semaphore.
- * @param context:(IN/OUT) Context of the semaphore
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one.
-************************************************************************
-*/
-M4OSA_ERR M4OSA_semaphoreClose(M4OSA_Context context)
-{
- M4OSA_SemaphoreContext* semaphoreContext = (M4OSA_SemaphoreContext*)context;
-
- M4OSA_TRACE1_1("M4OSA_semaphoreClose\t\tM4OSA_Context 0x%x", context);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_semaphoreClose");
-
- M4OSA_DEBUG_IF2(semaphoreContext->coreID != M4OSA_SEMAPHORE,
- M4ERR_BAD_CONTEXT, "M4OSA_semaphoreClose");
-
- sem_destroy(&semaphoreContext->semaphore);
-
- free(semaphoreContext);
-
- return M4NO_ERROR;
-}
-
diff --git a/libvideoeditor/osal/src/M4OSA_Thread.c b/libvideoeditor/osal/src/M4OSA_Thread.c
deleted file mode 100755
index 3e82fb3..0000000
--- a/libvideoeditor/osal/src/M4OSA_Thread.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/*
- * 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.c
- * @ingroup OSAL
- * @brief Implements and manipulate threads
- * @note This file implements functions to manipulate threads
- ************************************************************************
-*/
-
-#include <sched.h>
-#include <time.h>
-#include <pthread.h>
-#include <errno.h>
-
-#include <utils/threads.h>
-#include "M4OSA_Debug.h"
-#include "M4OSA_Memory.h"
-#include "M4OSA_Thread.h"
-#include "M4OSA_Thread_priv.h"
-#include "M4OSA_Mutex.h"
-#include "M4OSA_Semaphore.h"
-#include "M4OSA_CharStar.h"
-
-
-void* M4OSA_threadSyncForEverDo(void *context)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- M4OSA_Bool auto_kill = M4OSA_FALSE;
-
- /*
- M4OSA_Void* userData;
- */
-
- M4OSA_TRACE2_1("M4OSA_threadSyncForEverDo\t\tLPVOID 0x%x", context);
-
- /*
- userData = threadContext->userData;
- */
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
-
- threadContext->state = M4OSA_kThreadRunning;
-
- M4OSA_semaphorePost(threadContext->semStartStop);
-
- while(threadContext->state == M4OSA_kThreadRunning)
- {
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- if((threadContext->func(threadContext->param)) != M4NO_ERROR)
- {
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- if(threadContext->state == M4OSA_kThreadRunning)
- {
-
- //PR 2354 - ACO : Suppress stopping state and don't
- // unlock mutex before closing the thread
- threadContext->state = M4OSA_kThreadOpened;
- M4OSA_mutexUnlock(threadContext->stateMutex);
- return 0;
- }
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
- }
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
- }
-
-
- M4OSA_semaphorePost(threadContext->semStartStop);
-
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
-
- return 0;
-}
-
-
-
-
-
-/**
- ************************************************************************
- * @brief This method creates a new thread. After this call the thread is
- * identified by its "context". The thread function is provided by
- * the "func" parameter. This function creates & allocates a unique
- * context. It's the OSAL real time responsibility for managing its
- * context. It must be freed by the M4OSA_threadSyncClose function.
- * The context parameter will be sent back to any OSAL core thread
- * functions to allow retrieving data associated to the opened
- * thread.
- * @note This function creates the thread, but the thread is not running.
- * @note Once the thread is created, the state is M4OSA_kThreadOpened.
- * @param context:(OUT) Context of the created thread
- * @param func:(IN) "doIt" function pointer to run
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_ALLOC: there is no more available memory
- * @return M4ERR_CONTEXT_FAILED: the context creation failed
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncOpen(M4OSA_Context* context,
- M4OSA_ThreadDoIt func)
-{
- M4OSA_ThreadContext* threadContext = M4OSA_NULL;
- M4OSA_ERR err_code;
-
- M4OSA_TRACE1_2("M4OSA_threadSyncOpen\t\tM4OSA_Context* 0x%x\t"
- "M4OSA_ThreadDoIt 0x%x", context, func);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncOpen");
-
- M4OSA_DEBUG_IF2(func == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncOpen");
-
- *context = M4OSA_NULL;
-
- threadContext =
- (M4OSA_ThreadContext*)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_ThreadContext),
- M4OSA_THREAD, (M4OSA_Char*)"M4OSA_threadSyncOpen: thread context");
-
- if(threadContext == M4OSA_NULL)
- {
- M4OSA_DEBUG(M4ERR_ALLOC, "M4OSA_threadSyncOpen");
-
- return M4ERR_ALLOC;
- }
-
- threadContext->func = func;
- threadContext->stackSize = 64 * 1024;
- threadContext->name = M4OSA_NULL;
- threadContext->threadID = 0;
- threadContext->coreID = M4OSA_THREAD;
- threadContext->state = M4OSA_kThreadOpened;
- threadContext->priority = M4OSA_kThreadNormalPriority ;
-
- err_code = M4OSA_mutexOpen(&(threadContext->stateMutex));
-
- if(M4OSA_ERR_IS_ERROR(err_code))
- {
- M4OSA_DEBUG(err_code, "M4OSA_threadSyncOpen: M4OSA_mutexOpen");
-
- return err_code;
- }
-
- err_code = M4OSA_semaphoreOpen(&(threadContext->semStartStop), 0);
-
- if(M4OSA_ERR_IS_ERROR(err_code))
- {
- M4OSA_DEBUG(err_code, "M4OSA_threadSyncOpen: M4OSA_semaphoreOpen");
-
- return err_code;
- }
-
- *context = threadContext;
-
- return M4NO_ERROR;
-}
-
-
-
-
-
-/**
- ************************************************************************
- * @brief This method runs a specified thread. The "param" parameter
- * allows the application to set a specific parameter to the
- * created thread. This parameter will be used as the second one of
- * the "M4OSA_ThreadDoIt" function.
- * @note This method is a blocking up to the thread is running.
- * Before calling this method, the state is M4OSA_kThreadOpened.
- * Once the method is called, the state is M4OSA_kThreadStarting.
- * Once the thread is running, the state is M4OSA_kThreadRunning.
- * @note This method returns immediately. If the "threadStarted" optionID
- * is not NULL, the thread will call it before running the doIt
- * function.
- * @param context:(IN/OUT) Context of the thread
- * @param param:(IN) Application data thread parameter
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_STATE: this function cannot be called now
- * @return M4ERR_THREAD_NOT_STARTED: the thread did not start
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncStart(M4OSA_Context context,
- M4OSA_Void* param)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- pthread_attr_t attribute = { 0, 0, 0, 0, 0, 0 };
- int min = 0;
- int max = 0;
- int priority = 0;
- struct sched_param sched = { 0 };
-
- M4OSA_TRACE1_2("M4OSA_threadSyncStart\t\tM4OSA_Context 0x%x\tM4OSA_Void* "
- "0x%x", context, param);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncStart");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncStart");
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- if(threadContext->state != M4OSA_kThreadOpened)
- {
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_DEBUG(M4ERR_STATE, "M4OSA_threadSyncStart");
-
- return M4ERR_STATE;
- }
-
- threadContext->state = M4OSA_kThreadStarting;
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
- threadContext->param = param;
-
- if ( 0 == pthread_attr_init( &attribute ) )
- {
- if ( 0 == pthread_attr_setdetachstate( &attribute, PTHREAD_CREATE_DETACHED ) )
- {
- if ( 0 == pthread_attr_setstacksize( &attribute, (size_t)threadContext->stackSize ) )
- {
- if ( 0 == pthread_attr_setschedpolicy( &attribute, SCHED_OTHER ) )
- {
- /* Tentative patches to handle priorities in a better way : */
- /* Use Android's predefined priorities (range +19..-20)
- *rather than Linux ones (0..99)*/
-
- /* Get min and max priorities */
- min = sched_get_priority_min( SCHED_FIFO );
- max = sched_get_priority_max( SCHED_FIFO );
-
- M4OSA_TRACE1_2("M4OSA_threadSyncStart MAX=%d MIN=%d", max, min);
-
- /* tentative modification of the priorities */
- /* Set the priority based on default android priorities */
- /* This probably requires some more tuning,
- * outcome of this priority settings are not yet satisfactory */
- /* Implementing thread handling based on Android's thread creation
- * helpers might bring some improvement (see threads.h) */
- switch(threadContext->priority)
- {
- case M4OSA_kThreadLowestPriority:
- priority = ANDROID_PRIORITY_NORMAL;
- break;
- case M4OSA_kThreadLowPriority:
- priority = ANDROID_PRIORITY_DISPLAY;
- break;
- case M4OSA_kThreadNormalPriority:
- priority = ANDROID_PRIORITY_URGENT_DISPLAY;
- break;
- case M4OSA_kThreadHighPriority:
- priority = ANDROID_PRIORITY_AUDIO;
- break;
- case M4OSA_kThreadHighestPriority:
- priority = ANDROID_PRIORITY_URGENT_AUDIO;
- break;
- }
- sched.sched_priority = priority;
-
- if ( 0 == pthread_attr_setschedparam( &attribute, &sched ) )
- {
- if ( 0 == pthread_create( &threadContext->threadID,
- &attribute,
- &M4OSA_threadSyncForEverDo,
- (void *)threadContext ) )
- {
- if ( M4OSA_FALSE == M4OSA_ERR_IS_ERROR( M4OSA_semaphoreWait(
- threadContext->semStartStop,
- M4OSA_WAIT_FOREVER ) ) )
- {
- return M4NO_ERROR;
- }
- }
- }
- }
- }
- }
- pthread_attr_destroy( &attribute );
- }
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- threadContext->state = M4OSA_kThreadOpened;
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_DEBUG(M4ERR_THREAD_NOT_STARTED, "M4OSA_threadSyncStart");
-
- return M4ERR_THREAD_NOT_STARTED;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method stops a specified thread.
- * @note This call is a blocking one up to the "M4OSA_ThreadDoIt"
- * function has returned.
- * Before the method is called, the state is M4OSA_kThreadRunning.
- * Once the method is called, the state is M4OSA_kThreadStopping.
- * Once the thread is stopped, the state is M4OSA_kThreadOpened.
- * @note This method returns once the thread has been stopped. If the
- * "threadStopped" optionID is not NULL, the thread will call it
- * before dying.
- * @param context:(IN/OUT) Context of the thread
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_STATE: this function cannot be called now
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncStop(M4OSA_Context context)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
-
- M4OSA_TRACE1_1("M4OSA_threadSyncStop\t\tM4OSA_Context 0x%x", context);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncStop");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncStop");
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- if(threadContext->state != M4OSA_kThreadRunning)
- {
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_DEBUG(M4ERR_STATE, "M4OSA_threadSyncStop");
-
- return M4ERR_STATE;
- }
-
- threadContext->state = M4OSA_kThreadStopping;
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_semaphoreWait(threadContext->semStartStop, M4OSA_WAIT_FOREVER);
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- threadContext->state = M4OSA_kThreadOpened;
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method deletes a thread (identified by its context). After
- * this call the thread and its context are no more useable. This
- * function frees all the memory related to this thread.
- * @note Before the method is called, the state is M4OSA_kThreadOpened.
- * Once the method is called, the state is M4OSA_kThreadClosed.
- * @param context:(IN/OUT) Context of the thread
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_STATE: this function cannot be called now
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncClose(M4OSA_Context context)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- M4OSA_ERR err_code;
-
- M4OSA_TRACE1_1("M4OSA_threadSyncClose\t\tM4OSA_Context 0x%x", context);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncClose");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncClose");
-
- M4OSA_DEBUG_IF2(threadContext->state == M4OSA_kThreadClosed,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncClose");
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- if(threadContext->state != M4OSA_kThreadOpened)
- {
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_DEBUG(M4ERR_STATE, "M4OSA_threadSyncClose");
-
- return M4ERR_STATE;
- }
-
- threadContext->state = M4OSA_kThreadClosed;
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- err_code = M4OSA_mutexClose(threadContext->stateMutex);
-
- if(M4OSA_ERR_IS_ERROR(err_code))
- {
- M4OSA_DEBUG(err_code, "M4OSA_threadSyncClose: M4OSA_mutexClose");
-
- return err_code;
- }
-
- err_code = M4OSA_semaphoreClose(threadContext->semStartStop);
-
- if(M4OSA_ERR_IS_ERROR(err_code))
- {
- M4OSA_DEBUG(err_code, "M4OSA_threadSyncClose: M4OSA_semaphoreClose");
-
- return err_code;
- }
-
- if(threadContext->name != M4OSA_NULL)
- {
- free(threadContext->name);
- }
-
- free(threadContext);
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method asks the thread to return its state.
- * @note The caller is responsible for allocating/deallocating the state
- * field.
- * @param context:(IN) Context of the thread
- * @param state:(OUT) Thread state
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncGetState(M4OSA_Context context,
- M4OSA_ThreadState* state)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
-
- M4OSA_TRACE1_2("M4OSA_threadSyncGetState\t\tM4OSA_Context 0x%x\t"
- "M4OSA_ThreadState* 0x%x", context, state);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncGetState");
-
- M4OSA_DEBUG_IF2(state == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncGetState");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncGetState");
-
- *state = threadContext->state;
-
- return M4NO_ERROR;
-}
-
-
-
-
-/**
- ************************************************************************
- * @brief This method asks the calling thread to sleep during "timeSleep"
- * milliseconds.
- * @note This function does not have any context.
- * @param time:(IN) Time to sleep in milliseconds
- * @return M4NO_ERROR: there is no error
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSleep(M4OSA_UInt32 time)
-{
- struct timespec rqtp = { 0, 0 };
- struct timespec rmtp = { 0, 0 };
-
- M4OSA_TRACE1_1("M4OSA_threadSleep\t\tM4OSA_UInt32 %d", time);
-
- rqtp.tv_sec = (time_t)time/1000;
- rqtp.tv_nsec = (time%1000) * 1000000;
- nanosleep(&rqtp, &rmtp);
-
- return M4NO_ERROR;
-}
-
-#if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE)
-
-M4OSA_ERR M4OSA_SetThreadSyncPriority(M4OSA_Context context,
- M4OSA_DataOption optionValue)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- M4OSA_ThreadPriorityLevel priority
- = (M4OSA_ThreadPriorityLevel)(optionValue);
-
- M4OSA_TRACE2_2("M4OSA_SetThreadSyncPriority\t\tM4OSA_Context 0x%x\t"
- "M4OSA_DataOption 0x%x", context, optionValue);
-
- if((M4OSA_UInt32)(uintptr_t)optionValue>M4OSA_kThreadLowestPriority)
- {
- return M4ERR_PARAMETER;
- }
-
- threadContext->priority = priority;
-
- return M4NO_ERROR;
-}
-
-#endif /*M4OSA_OPTIONID_THREAD_PRIORITY*/
-
-
-
-
-#if(M4OSA_OPTIONID_THREAD_NAME == M4OSA_TRUE)
-
-M4OSA_ERR M4OSA_SetThreadSyncName(M4OSA_Context context,
- M4OSA_DataOption optionValue)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- M4OSA_Char* name = (M4OSA_Char*)optionValue;
- M4OSA_UInt32 nameSize ;
-
- M4OSA_TRACE2_2("M4OSA_SetThreadSyncName\t\tM4OSA_Context 0x%x\t"
- "M4OSA_DataOption 0x%x", context, optionValue);
-
- if(threadContext->name != NULL)
- {
- free(threadContext->name);
- threadContext->name = M4OSA_NULL;
- }
-
- if(optionValue != M4OSA_NULL)
- {
- nameSize = strlen((const char *)name)+1;
-
- threadContext->name =
- (M4OSA_Char*)M4OSA_32bitAlignedMalloc(nameSize, M4OSA_THREAD,
- (M4OSA_Char*)"M4OSA_SetThreadSyncName: thread name");
-
- if(threadContext == M4OSA_NULL)
- {
- return M4ERR_ALLOC;
- }
-
- memcpy((void *)threadContext->name, (void *)name,
- nameSize);
- }
-
- return M4NO_ERROR;
-}
-
-#endif /*M4OSA_OPTIONID_THREAD_NAME*/
-
-
-#if(M4OSA_OPTIONID_THREAD_STACK_SIZE == M4OSA_TRUE)
-
-M4OSA_ERR M4OSA_SetThreadSyncStackSize(M4OSA_Context context,
- M4OSA_DataOption optionValue)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
-
- M4OSA_TRACE2_2("M4OSA_SetThreadSyncStackSize\t\tM4OSA_Context 0x%x\t"
- "M4OSA_DataOption 0x%x", context, optionValue);
-
- threadContext->stackSize = (M4OSA_UInt32)(uintptr_t)optionValue;
-
- return M4NO_ERROR;
-}
-
-#endif /*M4OSA_OPTIONID_THREAD_STACK_SIZE*/
-
-/**
- ************************************************************************
- * @brief This method asks the core OSAL-Thread component to set the value
- * associated with the optionID. The caller is responsible for
- * allocating/deallocating the memory of the value field.
- * @note As the caller is responsible of allocating/de-allocating the
- * "value" field, the callee must copy this field to its internal
- * variable.
- * @param context:(IN/OUT) Context of the thread
- * @param optionID:(IN) ID of the option
- * @param optionValue:(IN) Value of the option
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
- * @return M4ERR_STATE: this option is not available now
- * @return M4ERR_READ_ONLY: this option is a read only one
- * @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncSetOption(M4OSA_Context context,
- M4OSA_ThreadOptionID optionID,
- M4OSA_DataOption optionValue)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
- M4OSA_ERR err_code;
-
- M4OSA_TRACE1_3("M4OSA_threadSyncSetOption\t\tM4OSA_Context 0x%x\t"
- "M4OSA_OptionID %d\tM4OSA_DataOption 0x%x",
- context, optionID, optionValue);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncSetOption");
-
- M4OSA_DEBUG_IF2(optionID == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncSetOption");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncSetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_THREAD),
- M4ERR_BAD_OPTION_ID, "M4OSA_threadSyncSetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_WRITABLE(optionID),
- M4ERR_READ_ONLY, "M4OSA_threadSyncSetOption");
-
-
- M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER);
-
- if(threadContext->state != M4OSA_kThreadOpened)
- {
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- M4OSA_DEBUG(M4ERR_STATE, "M4OSA_threadSyncSetOption");
-
- return M4ERR_STATE;
- }
-
- switch(optionID)
- {
-
-#if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE)
- case M4OSA_ThreadPriority:
- {
- err_code = M4OSA_SetThreadSyncPriority(context, optionValue);
-
- break;
- }
-#endif /*M4OSA_OPTIONID_THREAD_PRIORITY*/
-
-#if(M4OSA_OPTIONID_THREAD_NAME == M4OSA_TRUE)
- case M4OSA_ThreadName:
- {
- err_code = M4OSA_SetThreadSyncName(context, optionValue);
-
- break;
- }
-#endif /*M4OSA_OPTIONID_THREAD_NAME*/
-
-#if(M4OSA_OPTIONID_THREAD_STACK_SIZE == M4OSA_TRUE)
- case M4OSA_ThreadStackSize:
- {
- err_code = M4OSA_SetThreadSyncStackSize(context, optionValue);
-
- break;
- }
-#endif /*M4OSA_OPTIONID_THREAD_STACK_SIZE*/
-
- default:
- {
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_threadSyncSetOption");
-
- err_code = M4ERR_NOT_IMPLEMENTED;
- }
- }
-
- M4OSA_mutexUnlock(threadContext->stateMutex);
-
- return err_code;
-}
-
-
-
-/**
- ************************************************************************
- * @brief This method asks the OSAL-Thread to return the value associated
- * with the optionID. The caller is responsible for
- * allocating/deallocating the memory of the value field.
- * @note "optionValue" must be cast according to the type related to the
- * optionID.
- * @note As the caller is responsible for de-allocating the "value"
- * field, the core OSAL-Thread component must perform a copy of its
- * internal value to the value field.
- * @param context:(IN) Context of the thread
- * @param optionID:(IN) ID of the option
- * @param optionValue:(OUT) Value of the option
- * @return M4NO_ERROR: there is no error
- * @return M4ERR_PARAMETER: at least one parameter is NULL
- * @return M4ERR_BAD_CONTEXT: provided context is not a valid one
- * @return M4ERR_BAD_OPTION_ID: the optionID is not a valid one
- * @return M4ERR_WRITE_ONLY: this option is a write only one
- * @return M4ERR_NOT_IMPLEMENTED: this option is not implemented
- ************************************************************************
-*/
-M4OSA_ERR M4OSA_threadSyncGetOption(M4OSA_Context context,
- M4OSA_ThreadOptionID optionID,
- M4OSA_DataOption* optionValue)
-{
- M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context;
-
- M4OSA_TRACE1_3("M4OSA_threadSyncGetOption\t\tM4OSA_Context 0x%x\t"
- "M4OSA_OptionID %d\tM4OSA_DataOption* 0x%x",
- context, optionID, optionValue);
-
- M4OSA_DEBUG_IF2(context == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncGetOption");
-
- M4OSA_DEBUG_IF2(optionID == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncGetOption");
-
- M4OSA_DEBUG_IF2(optionValue == M4OSA_NULL,
- M4ERR_PARAMETER, "M4OSA_threadSyncGetOption");
-
- M4OSA_DEBUG_IF2(threadContext->coreID != M4OSA_THREAD,
- M4ERR_BAD_CONTEXT, "M4OSA_threadSyncGetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_COREID(optionID, M4OSA_THREAD),
- M4ERR_BAD_OPTION_ID, "M4OSA_threadSyncGetOption");
-
- M4OSA_DEBUG_IF2(!M4OSA_OPTION_ID_IS_READABLE(optionID),
- M4ERR_WRITE_ONLY, "M4OSA_threadSyncGetOption");
-
- switch(optionID)
- {
-
-#if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE)
- case M4OSA_ThreadPriority:
- {
- M4OSA_ThreadPriorityLevel* priority =
- (M4OSA_ThreadPriorityLevel*)optionValue;
-
- *priority = threadContext->priority;
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_THREAD_PRIORITY*/
-
-#if(M4OSA_OPTIONID_THREAD_NAME == M4OSA_TRUE)
- case M4OSA_ThreadName:
- {
- M4OSA_Char** name = (M4OSA_Char**)optionValue;
-
- *name = threadContext->name;
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_THREAD_NAME*/
-
-#if(M4OSA_OPTIONID_THREAD_STACK_SIZE == M4OSA_TRUE)
- case M4OSA_ThreadStackSize:
- {
- M4OSA_UInt32* stackSize = (M4OSA_UInt32*)optionValue;
-
- *stackSize = threadContext->stackSize;
-
- return M4NO_ERROR;
- }
-#endif /*M4OSA_OPTIONID_THREAD_STACK_SIZE*/
-
- default:
- break;
- }
-
- M4OSA_DEBUG(M4ERR_NOT_IMPLEMENTED, "M4OSA_threadSyncGetOption");
-
- return M4ERR_NOT_IMPLEMENTED;
-}
-
diff --git a/libvideoeditor/osal/src/M4PSW_DebugTrace.c b/libvideoeditor/osal/src/M4PSW_DebugTrace.c
deleted file mode 100755
index 850ed91..0000000
--- a/libvideoeditor/osal/src/M4PSW_DebugTrace.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 M4PSW_DebugTrace.c
- * @brief Default trace function for debugging macros
- * @note This file gives the default implementation of the trace function
- * used in the debug instrumentation macros, based on printf.
- * Application writers are strongly encouraged to implement their
- * own "M4OSA_DebugTrace".
- ************************************************************************
-*/
-
-
-#include <inttypes.h>
-#include <stdio.h> /*for printf */
-
-#include "M4OSA_Types.h"
-#include "M4OSA_Error.h"
-
-/*#define NO_FILE */ /* suppresses the file name print out */
-
-
-/**
- ************************************************************************
- * void M4OSA_DebugTrace(M4OSA_Int32 line, char* file, M4OSA_Int32 level,
- * M4OSA_Char* cond, char* msg, M4OSA_ERR err)
- * @brief This function implements the trace for debug tests
- * @note This function is to be called in the debug macros only.
- * This implementation uses printf.
- * @param line (IN): the line number in the source file
- * @param file (IN): the source file name
- * @param level (IN): the debug level
- * @param msg (IN): the error message
- * @param err (IN): the return value (error code)
- * @return none
- ************************************************************************
-*/
-
-M4OSAL_TRACE_EXPORT_TYPE void M4OSA_DebugTrace(M4OSA_Int32 line,
- M4OSA_Char* file,
- M4OSA_Int32 level,
- M4OSA_Char* cond,
- M4OSA_Char* msg,
- M4OSA_ERR err)
-{
- M4OSA_Int32 i;
-
- /* try to "indent" the resulting traces depending on the level */
- for (i =0 ; i < level; i ++)
- {
- printf(" ");
- }
-
-#ifdef NO_FILE
- printf("Error: %" PRIu32 ", on %s: %s\n",err,cond,msg);
-#else /* NO_FILE */
- printf("Error: %" PRIu32 ", on %s: %s Line %" PRIu32 " in: %s\n",err,cond,msg,line,file);
-#endif /* NO_FILE */
-
-}
-
-M4OSAL_TRACE_EXPORT_TYPE M4OSA_Void M4OSA_DEBUG_traceFunction(M4OSA_UInt32 line,
- M4OSA_Char* fileName,
- M4OSA_UInt32 level,
- M4OSA_Char* stringCondition,
- M4OSA_Char* message,
- M4OSA_ERR returnedError)
-{
- M4OSA_DebugTrace(line, fileName, level, stringCondition, message, returnedError);
-}
-
diff --git a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c b/libvideoeditor/osal/src/M4PSW_MemoryInterface.c
deleted file mode 100755
index ea4ccea..0000000
--- a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 M4PSW_MemoryInterface.c
- * @brief Memory Interface
- * @note Implementation of the osal memory functions
- *************************************************************************
-*/
-
-#include <stdlib.h>
-#include <memory.h>
-
-#include <time.h>
-#include "M4OSA_Memory.h"
-#ifndef M4VPS_ADVANCED_MEMORY_MANAGER
-/**
- ************************************************************************
- * @fn M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc(M4OSA_UInt32 size,
- * M4OSA_CoreID coreID,
- * M4OSA_Char* string)
- * @brief this function allocates a memory block (at least 32 bits aligned)
- * @note
- * @param size (IN): size of allocated block in bytes
- * @param coreID (IN): identification of the caller component
- * @param string (IN): description of the allocated block (null terminated)
- * @return address of the allocated block, M4OSA_NULL if no memory available
- ************************************************************************
-*/
-
-M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc(M4OSA_UInt32 size,
- M4OSA_CoreID coreID,
- M4OSA_Char* string)
-{
- M4OSA_MemAddr32 Address = M4OSA_NULL;
-
- /**
- * If size is 0, malloc on WIN OS allocates a zero-length item in
- * the heap and returns a valid pointer to that item.
- * On other platforms, malloc could returns an invalid pointer
- * So, DON'T allocate memory of 0 byte */
- if (size == 0)
- {
- return Address;
- }
-
- if (size%4 != 0)
- {
- size = size + 4 - (size%4);
- }
-
- Address = (M4OSA_MemAddr32) malloc(size);
-
- return Address;
-}
-
-#endif
-
diff --git a/libvideoeditor/osal/src/M4PSW_Trace.c b/libvideoeditor/osal/src/M4PSW_Trace.c
deleted file mode 100755
index f3d9a1f..0000000
--- a/libvideoeditor/osal/src/M4PSW_Trace.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 M4PSW_Trace.c
- * @brief Trace function for trace macros
- * @note This file gives the implementation of the trace function used
- * in the trace instrumentation macros
- ************************************************************************
-*/
-
-
-#include <stdio.h> /*for printf */
-#include <stdarg.h> /* ANSI C macros and defs for variable args */
-#include "utils/Log.h"
-
-#include "M4OSA_Types.h"
-#include "M4OSA_Debug.h"
-
-#define NO_FILE /* suppresses the file name print out */
-
-#define MAX_STRING_SIZE 1024
-
-/**
- ************************************************************************
- * void M4OSA_Trace(M4OSA_Int32 line, M4OSA_Char* file ,M4OSA_Int32 level,
- * M4OSA_Char* format, ...)
- * @brief This function implements the trace for debug tests
- * @note This implementation uses printf. First the variables are retrieved using
- * ANSI C defs and macros which enable to access a variable number of arguments.
- * Then the printf is done (with some ornemental adds).
- * @param level (IN): the debug level
- * @param format (IN): the "printf" formated string
- * @param ... (IN): as many parameters as required ...
- * @return none
- ************************************************************************
-*/
-
-M4OSAL_TRACE_EXPORT_TYPE void M4OSA_Trace(M4OSA_Int32 line, M4OSA_Char* file ,
- M4OSA_Int32 level, M4OSA_Char* format, ...)
-{
- M4OSA_Char message[MAX_STRING_SIZE];
- M4OSA_Int32 i;
- va_list marker; /* pointer to list of arguments */
-
- /* get the var arguments into the string message to be able to print */
- va_start(marker,format); /* set ptr to first argument in the list of arguments passed to the function */
- vsprintf((char *)message, (const char *)format,marker ); /* formats and writes the data into message */
- va_end(marker); /* reset pointer to NULL */
-
- /* do the actual print */
-#ifdef NO_FILE
- __android_log_print(ANDROID_LOG_INFO, "M4OSA_Trace", "%s", (char*)message);
-#else /* NO_FILE */
- __android_log_print(ANDROID_LOG_INFO, "M4OSA_Trace", "%s", "%s at %lu in %s",
- (char *)message, line, file);
-#endif /* NO_FILE */
-
-}
-
-M4OSAL_TRACE_EXPORT_TYPE M4OSA_Void M4OSA_TRACE_traceFunction(M4OSA_UInt32 line,
- M4OSA_Char* fileName,
- M4OSA_CoreID coreID,
- M4OSA_UInt32 level,
- M4OSA_Char* stringMsg, ...)
-{
- M4OSA_Char message[MAX_STRING_SIZE];
- M4OSA_Int32 i;
- va_list marker; /* pointer to list of arguments */
-
- /* get the var arguments into the string message to be able to print */
- va_start(marker,stringMsg); /* set ptr to first argument in the list of arguments passed to the function */
- vsprintf((char *)message, (const char *)stringMsg,marker ); /* formats and writes the data into message */
- va_end(marker); /* reset pointer to NULL */
-
- /* do the actual print */
-#ifdef NO_FILE
- __android_log_print(ANDROID_LOG_INFO, "M4OSA_TRACE_traceFunction", "%s", (char*)message);
-#else /* NO_FILE */
- __android_log_print(ANDROID_LOG_INFO, "M4OSA_TRACE_traceFunction", "%s", "%s at %lu in %s",
- (char *)message, line, (char*)file);
-#endif /* NO_FILE */
-
-}
-
diff --git a/libvideoeditor/osal/src/MODULE_LICENSE_APACHE2 b/libvideoeditor/osal/src/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libvideoeditor/osal/src/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libvideoeditor/osal/src/NOTICE b/libvideoeditor/osal/src/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libvideoeditor/osal/src/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-