1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #define LOG_TAG "VideoEditorOsal" 18 19 #include <VideoEditorJava.h> 20 #include <VideoEditorLogging.h> 21 #include <VideoEditorOsal.h> 22 23 extern "C" { 24 #include <M4OSA_Clock.h> 25 #include <M4OSA_CharStar.h> 26 #include <M4OSA_FileCommon.h> 27 #include <M4OSA_FileReader.h> 28 #include <M4OSA_FileWriter.h> 29 #include <M4OSA_Memory.h> 30 #include <M4OSA_Thread.h> 31 #include <M4xVSS_API.h> 32 #include <M4VSS3GPP_ErrorCodes.h> 33 #include <M4MCS_ErrorCodes.h> 34 #include <M4READER_Common.h> 35 #include <M4WRITER_common.h> 36 #include <M4VSS3GPP_API.h> 37 #include <M4DECODER_Common.h> 38 }; 39 40 41 #define VIDEOEDIT_OSAL_RESULT_STRING_MAX (32) 42 43 #define VIDEOEDIT_OSAL_RESULT_INIT(m_result) { m_result, #m_result } 44 45 46 typedef struct 47 { 48 M4OSA_ERR result; 49 const char* pName; 50 } VideoEdit_Osal_Result; 51 52 static const VideoEdit_Osal_Result gkRESULTS[] = 53 { 54 // M4OSA_Clock.h 55 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_TIMESCALE_TOO_BIG ), 56 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_CLOCK_BAD_REF_YEAR ), 57 58 // M4OSA_Error.h 59 VIDEOEDIT_OSAL_RESULT_INIT(M4NO_ERROR ), 60 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_PARAMETER ), 61 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_STATE ), 62 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_ALLOC ), 63 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_BAD_CONTEXT ), 64 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_CONTEXT_FAILED ), 65 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_BAD_STREAM_ID ), 66 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_BAD_OPTION_ID ), 67 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_WRITE_ONLY ), 68 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_READ_ONLY ), 69 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_NOT_IMPLEMENTED ), 70 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_UNSUPPORTED_MEDIA_TYPE ), 71 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_NO_DATA_YET ), 72 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_NO_MORE_STREAM ), 73 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_INVALID_TIME ), 74 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_NO_MORE_AU ), 75 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_TIME_OUT ), 76 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_BUFFER_FULL ), 77 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_REDIRECT ), 78 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_TOO_MUCH_STREAMS ), 79 80 // M4OSA_FileCommon.h 81 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_FILE_NOT_FOUND ), 82 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_FILE_LOCKED ), 83 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_FILE_BAD_MODE_ACCESS ), 84 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_FILE_INVALID_POSITION ), 85 86 // M4OSA_Thread.h 87 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_THREAD_NOT_STARTED ), 88 89 // M4xVSS_API.h 90 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_ANALYZING_DONE ), 91 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_PREVIEW_READY ), 92 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_SAVING_DONE ), 93 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_TRANSCODING_NECESSARY ), 94 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_OUTPUTFILESIZE_EXCEED ), 95 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_JPG_TOO_BIG ), 96 VIDEOEDIT_OSAL_RESULT_INIT(M4xVSSWAR_BUFFER_OUT_TOO_SMALL ), 97 VIDEOEDIT_OSAL_RESULT_INIT(M4xVSSERR_NO_MORE_SPACE ), 98 99 // M4VSS3GPP_ErrorCodes.h 100 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_FILE_TYPE ), 101 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_EFFECT_KIND ), 102 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_VIDEO_EFFECT_TYPE ), 103 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_AUDIO_EFFECT_TYPE ), 104 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_VIDEO_TRANSITION_TYPE ), 105 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_AUDIO_TRANSITION_TYPE ), 106 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_VIDEO_ENCODING_FRAME_RATE ), 107 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EXTERNAL_EFFECT_NULL ), 108 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EXTERNAL_TRANSITION_NULL ), 109 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_DURATION ), 110 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_END_CUT ), 111 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_OVERLAPPING_TRANSITIONS ), 112 #ifdef M4VSS3GPP_ERR_ANALYSIS_DATA_SIZE_TOO_SMALL 113 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_ANALYSIS_DATA_SIZE_TOO_SMALL ), 114 #endif 115 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_3GPP_FILE ), 116 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT ), 117 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_UNSUPPORTED_INPUT_AUDIO_FORMAT ), 118 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AMR_EDITING_UNSUPPORTED ), 119 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INPUT_VIDEO_AU_TOO_LARGE ), 120 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INPUT_AUDIO_AU_TOO_LARGE ), 121 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AU ), 122 #ifdef M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AMR_AU 123 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AMR_AU ), 124 #endif 125 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_ENCODER_ACCES_UNIT_ERROR ), 126 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_FORMAT ), 127 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_UNSUPPORTED_H263_PROFILE ), 128 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_PROFILE ), 129 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_RVLC ), 130 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_UNSUPPORTED_AUDIO_FORMAT ), 131 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_STREAM_IN_FILE ), 132 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_VIDEO_STREAM_IN_FILE), 133 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION ), 134 #ifdef M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_PLATFORM 135 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_PLATFORM ), 136 #endif 137 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FORMAT ), 138 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FRAME_SIZE ), 139 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_TIME_SCALE ), 140 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_DATA_PARTITIONING ), 141 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_UNSUPPORTED_MP3_ASSEMBLY ), 142 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_STREAM_TYPE ), 143 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_NB_OF_CHANNELS ), 144 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_WAR_INCOMPATIBLE_AUDIO_SAMPLING_FREQUENCY ), 145 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_NO_SUPPORTED_STREAM_IN_FILE ), 146 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_ADDVOLUME_EQUALS_ZERO ), 147 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_ADDCTS_HIGHER_THAN_VIDEO_DURATION ), 148 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_UNDEFINED_AUDIO_TRACK_FILE_FORMAT ), 149 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_UNSUPPORTED_ADDED_AUDIO_STREAM ), 150 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AUDIO_MIXING_UNSUPPORTED ), 151 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AUDIO_TRACK ), 152 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AUDIO_CANNOT_BE_MIXED ), 153 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INPUT_CLIP_IS_NOT_A_3GPP ), 154 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_BEGINLOOP_HIGHER_ENDLOOP ), 155 #ifdef M4VSS3GPP_ERR_AUDIO_MIXING_MP3_UNSUPPORTED 156 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AUDIO_MIXING_MP3_UNSUPPORTED ), 157 #endif 158 #ifdef M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AAC 159 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AAC ), 160 #endif 161 #ifdef M4VSS3GPP_ERR_ONLY_AMRNB_INPUT_CAN_BE_MIXED 162 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_ONLY_AMRNB_INPUT_CAN_BE_MIXED ), 163 #endif 164 #ifdef M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_EVRC 165 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_EVRC ), 166 #endif 167 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_H263_PROFILE_NOT_SUPPORTED ), 168 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_NO_SUPPORTED_VIDEO_STREAM_IN_FILE ), 169 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_INTERNAL_STATE ), 170 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_LUMA_FILTER_ERROR ), 171 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_TRANSITION_FILTER_ERROR ), 172 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AUDIO_DECODER_INIT_FAILED ), 173 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_AUDIO_DECODED_PCM_SIZE_ISSUE ), 174 VIDEOEDIT_OSAL_RESULT_INIT(M4VSS3GPP_ERR_OUTPUT_FILE_TYPE_ERROR ), 175 176 // M4MCS_ErrorCodes.h 177 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_WAR_TRANSCODING_DONE ), 178 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_WAR_MEDIATYPE_NOT_SUPPORTED ), 179 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_INPUT_FILE_CONTAINS_NO_SUPPORTED_STREAM ), 180 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_INVALID_INPUT_FILE ), 181 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_UNDEFINED_OUTPUT_VIDEO_FORMAT ), 182 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_UNDEFINED_OUTPUT_VIDEO_FRAME_SIZE ), 183 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_UNDEFINED_OUTPUT_VIDEO_FRAME_RATE ), 184 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_UNDEFINED_OUTPUT_AUDIO_FORMAT ), 185 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_INVALID_VIDEO_FRAME_SIZE_FOR_H263 ), 186 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_INVALID_VIDEO_FRAME_RATE_FOR_H263 ), 187 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_DURATION_IS_NULL ), 188 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_H263_FORBIDDEN_IN_MP4_FILE ), 189 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_H263_PROFILE_NOT_SUPPORTED ), 190 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_INVALID_AAC_SAMPLING_FREQUENCY ), 191 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_AUDIO_CONVERSION_FAILED ), 192 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_BEGIN_CUT_LARGER_THAN_DURATION ), 193 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_BEGIN_CUT_EQUALS_END_CUT ), 194 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_END_CUT_SMALLER_THAN_BEGIN_CUT ), 195 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_MAXFILESIZE_TOO_SMALL ), 196 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_VIDEOBITRATE_TOO_LOW ), 197 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_AUDIOBITRATE_TOO_LOW ), 198 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_VIDEOBITRATE_TOO_HIGH ), 199 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_AUDIOBITRATE_TOO_HIGH ), 200 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_OUTPUT_FILE_SIZE_TOO_SMALL ), 201 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_NOMORE_SPACE ), 202 VIDEOEDIT_OSAL_RESULT_INIT(M4MCS_ERR_FILE_DRM_PROTECTED ), 203 204 // M4READER_Common.h 205 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_READER_UNKNOWN_STREAM_TYPE ), 206 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_READER_NO_METADATA ), 207 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_READER_INFORMATION_NOT_PRESENT ), 208 209 // M4WRITER_Common.h 210 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_WRITER_STOP_REQ ), 211 // M4DECODER_Common.h 212 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_VIDEORENDERER_NO_NEW_FRAME ), 213 VIDEOEDIT_OSAL_RESULT_INIT(M4WAR_DEBLOCKING_FILTER_NOT_IMPLEMENTED ), 214 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_DECODER_H263_PROFILE_NOT_SUPPORTED ), 215 VIDEOEDIT_OSAL_RESULT_INIT(M4ERR_DECODER_H263_NOT_BASELINE ) 216 }; 217 218 static const int gkRESULTS_COUNT = (sizeof(gkRESULTS) / sizeof(VideoEdit_Osal_Result)); 219 220 #ifdef OSAL_MEM_LEAK_DEBUG 221 static int gAllocatedBlockCount = 0; 222 #endif 223 224 const char* 225 videoEditOsal_getResultString( 226 M4OSA_ERR result) 227 { 228 static char string[VIDEOEDIT_OSAL_RESULT_STRING_MAX] = ""; 229 const char* pString = M4OSA_NULL; 230 int index = 0; 231 232 // Loop over the list with constants. 233 for (index = 0; 234 ((M4OSA_NULL == pString) && (index < gkRESULTS_COUNT)); 235 index++) 236 { 237 // Check if the specified result matches. 238 if (result == gkRESULTS[index].result) 239 { 240 // Set the description. 241 pString = gkRESULTS[index].pName; 242 } 243 } 244 245 // Check if no result was found. 246 if (M4OSA_NULL == pString) 247 { 248 // Set the description to a default value. 249 M4OSA_chrSPrintf((M4OSA_Char *)string, sizeof(string) - 1, 250 (M4OSA_Char*)"<unknown(0x%08X)>", result); 251 pString = string; 252 } 253 254 // Return the result. 255 return(pString); 256 } 257 258 void * 259 videoEditOsal_alloc( 260 bool* pResult, 261 JNIEnv* pEnv, 262 size_t size, 263 const char* pDescription) 264 { 265 void *pData = M4OSA_NULL; 266 267 // Check if the previous action succeeded. 268 if (*pResult) 269 { 270 // Allocate memory for the settings. 271 pData = (M4VSS3GPP_EditSettings*)M4OSA_32bitAlignedMalloc(size, 0, (M4OSA_Char*)pDescription); 272 if (M4OSA_NULL != pData) 273 { 274 // Reset the allocated memory. 275 memset((void *)pData, 0,size); 276 #ifdef OSAL_MEM_LEAK_DEBUG 277 // Update the allocated block count. 278 gAllocatedBlockCount++; 279 #endif 280 } 281 else 282 { 283 // Reset the result flag. 284 (*pResult) = false; 285 286 // Log the error. 287 VIDEOEDIT_LOG_ERROR(ANDROID_LOG_ERROR, "VIDEO_EDITOR_OSAL", "videoEditOsal_alloc,\ 288 error: unable to allocate memory for %s", pDescription); 289 290 // Throw an exception. 291 jniThrowException(pEnv, "java/lang/OutOfMemoryError", "unable to allocate memory"); 292 } 293 } 294 295 // Return the allocated memory. 296 return(pData); 297 } 298 299 void 300 videoEditOsal_free( 301 void* pData) 302 { 303 // Check if memory was allocated. 304 if (M4OSA_NULL != pData) 305 { 306 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_OSAL", "videoEditOsal_free()"); 307 308 // Log the API call. 309 VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR_OSAL", "free"); 310 311 // Free the memory. 312 free(pData); 313 #ifdef OSAL_MEM_LEAK_DEBUG 314 // Update the allocated block count. 315 gAllocatedBlockCount--; 316 317 // Log the number of allocated blocks. 318 VIDEOEDIT_LOG_ALLOCATION(ANDROID_LOG_ERROR, "VIDEO_EDITOR_OSAL", "allocated, %d blocks",\ 319 gAllocatedBlockCount); 320 #endif 321 } 322 } 323 324 325 void 326 videoEditOsal_getFilePointers ( M4OSA_FileReadPointer *pOsaFileReadPtr, 327 M4OSA_FileWriterPointer *pOsaFileWritePtr) 328 { 329 if (pOsaFileReadPtr != M4OSA_NULL) 330 { 331 // Initialize the filereader function pointers. 332 pOsaFileReadPtr->openRead = M4OSA_fileReadOpen; 333 pOsaFileReadPtr->readData = M4OSA_fileReadData; 334 pOsaFileReadPtr->seek = M4OSA_fileReadSeek; 335 pOsaFileReadPtr->closeRead = M4OSA_fileReadClose; 336 pOsaFileReadPtr->setOption = M4OSA_fileReadSetOption; 337 pOsaFileReadPtr->getOption = M4OSA_fileReadGetOption; 338 } 339 340 if (pOsaFileWritePtr != M4OSA_NULL) 341 { 342 // Initialize the filewriter function pointers. 343 pOsaFileWritePtr->openWrite = M4OSA_fileWriteOpen; 344 pOsaFileWritePtr->writeData = M4OSA_fileWriteData; 345 pOsaFileWritePtr->seek = M4OSA_fileWriteSeek; 346 pOsaFileWritePtr->Flush = M4OSA_fileWriteFlush; 347 pOsaFileWritePtr->closeWrite = M4OSA_fileWriteClose; 348 pOsaFileWritePtr->setOption = M4OSA_fileWriteSetOption; 349 pOsaFileWritePtr->getOption = M4OSA_fileWriteGetOption; 350 } 351 } 352 353