From aa382f3637a68361989d5b70e3184bddcc472d3d Mon Sep 17 00:00:00 2001 From: hongteng Date: Fri, 22 Apr 2011 15:23:37 -0700 Subject: [PATCH] Fix for issue 4035003 Support for 64 bit datatype a. M4OSA_64BITS_SUPPORTED removed b. M4OSA_64BITS_NOT_SUPPORTED removed c. M4OSA_UInt64 removed d. M4OSA_Int64 removed e. M4OSA_INT32_FROM_INT32 removed f. M4OSA_TIME_FROM_INT32_UINT32 removed g. clean-up all macro in M4OSA_Time.h, M4OSA_Types.h and osal/inc/M4OSA_FileCommon.h Change-Id: I2b1751962945dcc668e995d05a57b66cd268642f --- libvideoeditor/osal/inc/M4OSA_FileCommon.h | 118 --------- libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h | 5 - libvideoeditor/osal/inc/M4OSA_Time.h | 119 +-------- libvideoeditor/osal/inc/M4OSA_Types.h | 275 --------------------- libvideoeditor/osal/src/M4OSA_CharStar.c | 29 --- libvideoeditor/osal/src/M4OSA_Clock.c | 24 -- libvideoeditor/osal/src/M4OSA_FileCommon.c | 49 ++-- libvideoeditor/osal/src/M4OSA_FileReader.c | 8 +- libvideoeditor/osal/src/M4OSA_FileWriter.c | 16 +- libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c | 17 +- libvideoeditor/vss/common/inc/M4DA_Types.h | 2 +- libvideoeditor/vss/mcs/src/M4MCS_API.c | 6 +- libvideoeditor/vss/src/M4AMRR_CoreReader.c | 12 +- libvideoeditor/vss/src/M4READER_Amr.c | 22 +- libvideoeditor/vss/src/M4READER_Pcm.c | 4 +- .../stagefrightshells/src/VideoEditor3gpReader.cpp | 21 +- .../stagefrightshells/src/VideoEditorMp3Reader.cpp | 16 +- 17 files changed, 72 insertions(+), 671 deletions(-) diff --git a/libvideoeditor/osal/inc/M4OSA_FileCommon.h b/libvideoeditor/osal/inc/M4OSA_FileCommon.h index 663be66140..eda6921b23 100755 --- a/libvideoeditor/osal/inc/M4OSA_FileCommon.h +++ b/libvideoeditor/osal/inc/M4OSA_FileCommon.h @@ -34,21 +34,7 @@ #include "M4OSA_OptionID.h" - -/*#define M4OSA_FILE_POS_64_BITS_SUPPORTED*/ /*Means M4OSA_Int64 is used*/ - -#ifndef M4OSA_FILE_POS_64_BITS_SUPPORTED -#define M4OSA_FILE_POS_32_BITS_SUPPORTED /*Means M4OSA_Int32 is used*/ -#endif /*M4OSA_FILE_POS_64_BITS_SUPPORTED*/ - - - -#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED -typedef M4OSA_Int64 M4OSA_FilePosition; -#endif -#ifdef M4OSA_FILE_POS_32_BITS_SUPPORTED typedef M4OSA_Int32 M4OSA_FilePosition; -#endif /** This enum defines the application mode access. * ie, the application uses a file descriptor to read or to write or @@ -129,109 +115,5 @@ typedef enum M4OSA_FileSeekAccessMode #define M4ERR_FILE_INVALID_POSITION M4OSA_ERR_CREATE(M4_ERR, M4OSA_FILE_COMMON, 0x000004) -#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED - -#define M4OSA_FPOS_SET(fpos_a, fpos_b)\ - M4OSA_INT64_SET(fpos_a, fpos_b) - -#define M4OSA_FPOS_ADD(fpos_result, fpos_a, fpos_b)\ - M4OSA_INT64_ADD(fpos_result, fpos_a, fpos_b) - -#define M4OSA_FPOS_SUB(fpos_result, fpos_a, fpos_b)\ - M4OSA_INT64_SUB(fpos_result, fpos_a, fpos_b) - -#define M4OSA_FPOS_ADD_CONST_UINT32(fpos_out, fpos_in, i32_in)\ - { M4OSA_Int64 i64_in;\ - M4OSA_INT64_FROM_INT32(i64_in, i32_in);\ - M4OSA_INT64_ADD(fpos_out, fpos_in, i64_in); } - -#define M4OSA_FPOS_SUB_CONST_UINT32(fpos_out, fpos_in, i32_in)\ - { M4OSA_Int64 i64_in;\ - M4OSA_INT64_FROM_INT32(i64_in, i32_in);\ - M4OSA_INT64_SUB(fpos_out, fpos_in, i64_in); } - -#define M4OSA_FPOS_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value)\ - M4OSA_INT64_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value) - -#define M4OSA_FPOS_SCALAR_DIVISION(fpos_result, fpos_a, i32_value)\ - M4OSA_INT64_SCALAR_DIVISION(fpos_result, fpos_a, i32_value) - -#define M4OSA_FPOS_COMPARE(fpos_a, fpos_b)\ - M4OSA_INT64_COMPARE(fpos_a, fpos_b) - -#define M4OSA_FILE_POSITION_TO_INT(fpos, ipos)\ - M4OSA_INT64_SET(ipos, fpos) - -#define M4OSA_INT_TO_FILE_POSITION(ipos, fpos)\ - M4OSA_FPOS_SET(fpos, ipos) - -#define M4OSA_FPOS_IS_POSITIVE(fpos_value)\ - M4OSA_INT64_IS_POSITIVE(fpos_value) - -#define M4OSA_FPOS_NEG(fpos_result, fpos_value)\ - M4OSA_INT64_NEG(fpos_result, fpos_value) - -#define M4OSA_FPOS_ABS(fpos_result, fpos_value)\ - M4OSA_INT64_ABS(fpos_result, fpos_value) - -#define M4OSA_FPOS_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ - M4OSA_INT64_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) - -#define M4OSA_FPOS_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ - M4OSA_INT64_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) - -#endif - -#ifdef M4OSA_FILE_POS_32_BITS_SUPPORTED - -#define M4OSA_FPOS_SET(fpos_a, fpos_b)\ - M4OSA_INT32_SET(fpos_a, fpos_b) - -#define M4OSA_FPOS_ADD(fpos_result, fpos_a, fpos_b)\ - M4OSA_INT32_ADD(fpos_result, fpos_a, fpos_b) - -#define M4OSA_FPOS_SUB(fpos_result, fpos_a, fpos_b)\ - M4OSA_INT32_SUB(fpos_result, fpos_a, fpos_b) - -#define M4OSA_FPOS_ADD_CONST_UINT32(fpos_out, fpos_in, i32_in)\ - M4OSA_FPOS_ADD(fpos_out, fpos_in, i32_in) - -#define M4OSA_FPOS_SUB_CONST_UINT32(fpos_out, fpos_in, i32_in)\ - M4OSA_FPOS_SUB(fpos_out, fpos_in, i32_in) - -#define M4OSA_FPOS_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value)\ - M4OSA_INT32_SCALAR_PRODUCT(fpos_result, fpos_a, i32_value) - -#define M4OSA_FPOS_SCALAR_DIVISION(fpos_result, fpos_a, i32_value)\ - M4OSA_INT32_SCALAR_DIVISION(fpos_result, fpos_a, i32_value) - -#define M4OSA_FPOS_COMPARE(fpos_a, fpos_b)\ - M4OSA_INT32_COMPARE(fpos_a, fpos_b) - -#define M4OSA_FILE_POSITION_TO_INT(fpos, ipos)\ - M4OSA_INT32_SET(ipos, fpos) - -#define M4OSA_INT_TO_FILE_POSITION(ipos, fpos)\ - M4OSA_FPOS_SET(fpos, ipos) - -#define M4OSA_FPOS_IS_POSITIVE(fpos_value)\ - M4OSA_INT32_IS_POSITIVE(fpos_value) - -#define M4OSA_FPOS_NEG(fpos_result, fpos_value)\ - M4OSA_INT32_NEG(fpos_result, fpos_value) - -#define M4OSA_FPOS_ABS(fpos_result, fpos_value)\ - M4OSA_INT32_ABS(fpos_result, fpos_value) - -#define M4OSA_FPOS_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ - M4OSA_INT32_LEFT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) - -#define M4OSA_FPOS_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions)\ - M4OSA_INT32_RIGHT_SHIFT(fpos_result, fpos_value, ui32_nbPositions) - -#endif - - - #endif /*M4OSA_FILECOMMON_H*/ diff --git a/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h b/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h index f3064a739e..261070fb95 100755 --- a/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h +++ b/libvideoeditor/osal/inc/M4OSA_FileCommon_priv.h @@ -46,12 +46,7 @@ typedef enum M4OSA_LastSeek typedef struct { M4OSA_UInt32 coreID_read; M4OSA_UInt32 coreID_write; -#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED - /** The file handler */ - M4OSA_Int32 file_desc; -#else FILE* file_desc; -#endif /* M4OSA_FILE_POS_64_BITS_SUPPORTED */ /** The name of the URL */ M4OSA_Char* url_name; /** The name of the file */ diff --git a/libvideoeditor/osal/inc/M4OSA_Time.h b/libvideoeditor/osal/inc/M4OSA_Time.h index 7545541860..737ebad91b 100755 --- a/libvideoeditor/osal/inc/M4OSA_Time.h +++ b/libvideoeditor/osal/inc/M4OSA_Time.h @@ -37,128 +37,13 @@ typedef signed long long M4OSA_Time; /** This macro sets the unknown time value */ -#ifdef M4OSA_64BITS_SUPPORTED - #define M4OSA_TIME_SET_UNKNOWN(time) {time = 0x8000000000000000LL ;} -#endif /* M4OSA_64BITS_SUPPORTED */ - -#ifdef M4OSA_64BITS_COUPLE_INT - #define M4OSA_TIME_SET_UNKNOWN(time) {\ - time.major = 0x80000000 ;\ - time.minor = 0x00000000 ;} -#endif /* M4OSA_64BITS_COUPLE_INT */ - -#ifdef M4OSA_64BITS_NOT_SUPPORTED - #define M4OSA_TIME_SET_UNKNOWN(time) {time = 0x80000000;} -#endif /* M4OSA_64BITS_NOT_SUPPORTED */ - - -/** This macro returns 1 if the provided time is set to unknown time, - and 0 else.*/ -#ifdef M4OSA_64BITS_SUPPORTED - -#define M4OSA_TIME_IS_UNKNOWN(time) (((M4OSA_UInt64)(time) == 0x8000000000000000LL) ? 1 : 0) - -#elif defined M4OSA_64BITS_COUPLE_INT - -#define M4OSA_TIME_IS_UNKNOWN(time)\ - (( (M4OSA_INT64_GET_HIGH32(time) == M4OSA_unknownTimeMajor)\ - &&(M4OSA_INT64_GET_LOW32(time) == M4OSA_unknownTimeMinor) ) ? 1:0) - -#else /* M4OSA_64BITS_NOT_SUPPORTED */ - -#define M4OSA_TIME_IS_UNKNOWN(time) (((M4OSA_UInt32)(time) == 0x80000000) ? 1 : 0) - -#endif - - -/** This macro affects time2 to time1.*/ -#define M4OSA_TIME_SET(time1, time2)\ - M4OSA_INT64_SET(time1, time2) - - -/** This macro sets time from i32.*/ -#define M4OSA_TIME_FROM_INT32(time, i32)\ - M4OSA_INT64_FROM_INT32(time, i32) - - -/** This macro sets time from i32 ui32.*/ -#define M4OSA_TIME_FROM_INT32_UINT32(time, i32, ui32)\ - M4OSA_INT64_FROM_INT32_UINT32(time, i32, ui32) - - -/** This macro tests if time is positive*/ -#define M4OSA_TIME_IS_POSITIVE(time)\ - M4OSA_INT64_IS_POSITIVE(time) - - -/** This macro sets time_out = -time_in*/ -#define M4OSA_TIME_NEG(time_out, time_in)\ - M4OSA_INT64_NEG(time_out, time_in) - - -/** This macro sets time_out = |time_in|*/ -#define M4OSA_TIME_ABS(time_out, time_in)\ - M4OSA_INT64_ABS(time_out, time_in) - - -/** This macro adds the 2 provided times (time1 and time2), - and writes the result in result. Both times must have the same timescale.*/ -#define M4OSA_TIME_ADD(result, time1, time2)\ - M4OSA_INT64_ADD(result, time1, time2) - - -/** This macro subs the 2 provided times (time1 and time2), - and writes the result in result.*/ -#define M4OSA_TIME_SUB(result, time1, time2)\ - M4OSA_INT64_SUB(result, time1, time2) - - -/** This macro does a scalar product (result = time*value), - and writes the result in result.*/ -#define M4OSA_TIME_SCALAR_PRODUCT(result, time, value)\ - M4OSA_INT64_SCALAR_PRODUCT(result, time, value) - - -/** This macro does a scalar division (result= time / value), - and writes the result in result.*/ -#define M4OSA_TIME_SCALAR_DIVISION(result, time, value)\ - M4OSA_INT64_SCALAR_DIVISION(result, time, value) - - -/** This macro updates the time to the oldTimeScale to the newTimeScale. The - result (the nearest rounded to the min value) is stored in result value. */ -#define M4OSA_TIME_CHANGE_TIMESCALE(result, time, oldTimeScale, newTimeScale)\ - { M4OSA_Time t_tempTime1, t_tempTime2, t_tempTime3;\ - M4OSA_Int32 i32_quotient = newTimeScale/oldTimeScale;\ - M4OSA_Int32 i32_rest = newTimeScale%oldTimeScale;\ - M4OSA_INT64_SCALAR_PRODUCT(t_tempTime1, time, i32_quotient);\ - M4OSA_INT64_SCALAR_PRODUCT(t_tempTime2, time, i32_rest);\ - M4OSA_INT64_SCALAR_DIVISION(t_tempTime3, t_tempTime2, oldTimeScale);\ - M4OSA_INT64_ADD(result, t_tempTime1, t_tempTime3); } - - -/** This macro tests the 2 provided times (time1 & time2). - The result is either: - * @arg 1: if time1 is bigger than time2 - * @arg 0: if time2 is equal to time2 - * @arg -1: if time1 is smaller than time2 */ -#define M4OSA_TIME_COMPARE(time1, time2)\ - M4OSA_INT64_COMPARE(time1, time2) +#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)\ - { M4OSA_INT64_TO_DOUBLE(result, time);\ - result = (1000*result)/((M4OSA_Double)timescale); } - - -/** This macro converts a millisecond time to M4OSA_Time with the provided - timescale. The result (the nearest rounded to the min value) is stored - in time value.*/ -#define M4OSA_MS_TO_TIME(time, timescale, ms)\ - {M4OSA_INT64_FROM_DOUBLE(time, (ms*((M4OSA_Double)(timescale))/1000.0));} - + { 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 index 6fcf47500e..2ee9568b1e 100755 --- a/libvideoeditor/osal/inc/M4OSA_Types.h +++ b/libvideoeditor/osal/inc/M4OSA_Types.h @@ -36,10 +36,6 @@ extern "C" { #endif -/*#define M4OSA_64BITS_SUPPORTED */ /* means long long is used */ -/*#define M4OSA_64BITS_COUPLE_INT */ /* means couple int32 is used */ -#define M4OSA_64BITS_NOT_SUPPORTED /* means Int32 is used */ - typedef signed char M4OSA_Bool; typedef unsigned char M4OSA_UInt8; @@ -59,35 +55,6 @@ typedef unsigned char M4OSA_WChar; typedef void M4OSA_Void; -typedef struct -{ - M4OSA_Int32 high; - M4OSA_Int32 low; -} M4OSA_CoupleInt32; - -#ifdef M4OSA_64BITS_SUPPORTED -typedef signed long long M4OSA_Int64; -typedef unsigned long long M4OSA_UInt64; -#endif - -#ifdef M4OSA_64BITS_COUPLE_INT -typedef struct -{ - M4OSA_Int32 major; - M4OSA_UInt32 minor; -} M4OSA_Int64; -typedef struct -{ - M4OSA_UInt32 major; - M4OSA_UInt32 minor; -} M4OSA_UInt64; -#endif - -#ifdef M4OSA_64BITS_NOT_SUPPORTED -typedef M4OSA_Int32 M4OSA_Int64; -typedef M4OSA_UInt32 M4OSA_UInt64; -#endif - /* Min & max definitions*/ #define M4OSA_UINT8_MIN 0 #define M4OSA_UINT8_MAX 255 @@ -113,22 +80,6 @@ typedef M4OSA_UInt32 M4OSA_UInt64; #define M4OSA_UCHAR_MIN 0 #define M4OSA_UCHAR_MAX 255 -#ifdef M4OSA_64BITS_NOT_SUPPORTED - -#define M4OSA_UINT64_MIN M4OSA_UINT32_MIN -#define M4OSA_UINT64_MAX M4OSA_UINT32_MAX -#define M4OSA_INT64_MIN M4OSA_INT32_MIN -#define M4OSA_INT64_MAX M4OSA_INT32_MAX - -#else /* M4OSA_64BITS_NOT_SUPPORTED*/ - -#define M4OSA_UINT64_MIN 0 -#define M4OSA_UINT64_MAX 0xFFFFFFFFFFFFFFFFLL -#define M4OSA_INT64_MIN 0x8000000000000000LL -#define M4OSA_INT64_MAX 0x7FFFFFFFFFFFFFFFLL - -#endif /* M4OSA_64BITS_NOT_SUPPORTED*/ - #define M4OSA_NULL 0x00 #define M4OSA_TRUE 0x01 #define M4OSA_FALSE 0x00 @@ -143,235 +94,9 @@ typedef M4OSA_UInt32 M4OSA_UInt64; typedef void* M4OSA_Context; - /** It is a unique ID for each core component*/ typedef M4OSA_UInt16 M4OSA_CoreID; - -/* Macro to support big endian and little endian platform */ - -/* to translate a 16 bits to its Big Endian value*/ -#define M4OSA_INT16_TO_BE(ui16_host) ((((ui16_host) & (M4OSA_UInt16) 0x00ff) << 8) | \ - (((ui16_host) & (M4OSA_UInt16) 0xff00) >> 8) ) - -/* to translate a 32 bits to its Big Endian value */ -#define M4OSA_INT32_TO_BE(ui32_host) ((((ui32_host) & (M4OSA_UInt32) 0x000000ff) << 24) | \ - (((ui32_host) & (M4OSA_UInt32) 0x0000ff00) << 8) | \ - (((ui32_host) & (M4OSA_UInt32) 0x00ff0000) >> 8) | \ - (((ui32_host) & (M4OSA_UInt32) 0xff000000) >> 24)) - -/* to translate a 64 bits to its Big Endian value */ -#define M4OSA_INT64_TO_BE(ui64_host) ((((ui64_host) & (M4OSA_UInt64) 0x00000000000000ff) << 56) | \ - (((ui64_host) & (M4OSA_UInt64) 0x000000000000ff00) << 40) | \ - (((ui64_host) & (M4OSA_UInt64) 0x0000000000ff0000) << 24) | \ - (((ui64_host) & (M4OSA_UInt64) 0x00000000ff000000) << 8) | \ - (((ui64_host) & (M4OSA_UInt64) 0x000000ff00000000) >> 8) | \ - (((ui64_host) & (M4OSA_UInt64) 0x0000ff0000000000) >> 24) | \ - (((ui64_host) & (M4OSA_UInt64) 0x00ff000000000000) >> 40) | \ - (((ui64_host) & (M4OSA_UInt64) 0xff00000000000000) >> 56)) - -/* to translate a Big Endian 16 bits to its host representation */ -#define M4OSA_BE_TO_INT16(ui16_net) ((((ui16_net) & (M4OSA_UInt16) 0x00ff) << 8) | \ - (((ui16_net) & (M4OSA_UInt16) 0xff00) >> 8) ) - -/* to translate a Big Endian 32 bits to its host representation*/ -#define M4OSA_BE_TO_INT32(ui32_net) ((((ui32_net) & (M4OSA_UInt32) 0x000000ff) << 24) | \ - (((ui32_net) & (M4OSA_UInt32) 0x0000ff00) << 8) | \ - (((ui32_net) & (M4OSA_UInt32) 0x00ff0000) >> 8) | \ - (((ui32_net) & (M4OSA_UInt32) 0xff000000) >> 24)) - -/* to translate a Big Endian 64 bits to its host representation */ -#define M4OSA_BE_TO_INT64(ui64_net) ((((ui64_net) & (M4OSA_UInt64) 0x00000000000000ff) << 56) | \ - (((ui64_net) & (M4OSA_UInt64) 0x000000000000ff00) << 40) | \ - (((ui64_net) & (M4OSA_UInt64) 0x0000000000ff0000) << 24) | \ - (((ui64_net) & (M4OSA_UInt64) 0x00000000ff000000) << 8) | \ - (((ui64_net) & (M4OSA_UInt64) 0x000000ff00000000) >> 8) | \ - (((ui64_net) & (M4OSA_UInt64) 0x0000ff0000000000) >> 24) | \ - (((ui64_net) & (M4OSA_UInt64) 0x00ff000000000000) >> 40) | \ - (((ui64_net) & (M4OSA_UInt64) 0xff00000000000000) >> 56)) - -/* to translate a 16 bits to its Little Endian value*/ -#define M4OSA_INT16_TO_LE(ui16_host) (ui16_host) - -/* to translate a 32 bits to its Little Endian value */ -#define M4OSA_INT32_TO_LE(ui32_host) (ui32_host) - -/* to translate a 64 bits to its Little Endian value */ -#define M4OSA_INT64_TO_LE(ui64_host) (ui64_host) - -/* to translate a Little Endian 16 bits to its host representation */ -#define M4OSA_LE_TO_INT16(ui16_net) (ui16_net) - -/* to translate a Little Endian 32 bits to its host representation*/ -#define M4OSA_LE_TO_INT32(ui32_net) (ui32_net) - -/* to translate a Little Endian 64 bits to its host representation */ -#define M4OSA_LE_TO_INT64(ui64_net) (ui64_net) - - -/* Macro to manipulate M4OSA_Int32*/ -#define M4OSA_INT32_SET(i32_out, i32_in)\ - { i32_out = i32_in; } - -#define M4OSA_INT32_ADD(i32_result, i32_a, i32_b)\ - { i32_result = (i32_a) + (i32_b); } - -#define M4OSA_INT32_SUB(i32_result, i32_a, i32_b)\ - { i32_result = (i32_a) - (i32_b); } - -#define M4OSA_INT32_SCALAR_PRODUCT(i32_result, i32_a, i32_value)\ - { i32_result = (i32_a) * (i32_value); } - -#define M4OSA_INT32_SCALAR_DIVISION(i32_result, i32_a, i32_value)\ - { i32_result = (i32_a) / (i32_value); } - -#define M4OSA_INT32_COMPARE(i32_a, i32_b)\ - ( ((i32_a) == (i32_b)) ? 0 : ( ((i32_a) > (i32_b)) ? 1 : -1) ) - -#define M4OSA_INT32_FROM_INT32(i32_result, i32_value)\ - { i32_result = (M4OSA_Int32)(i32_value); } - -#define M4OSA_INT32_FROM_INT32_UINT32(i32_result, i32_high, ui32_low)\ - { i32_result = (M4OSA_Int32)(ui32_low); } - -#define M4OSA_INT32_GET_LOW32(i32_value) ((M4OSA_Int32)(i32_value)) - -#define M4OSA_INT32_GET_HIGH32(i32_value) (0) - -#define M4OSA_INT32_IS_POSITIVE(i32_value) ((i32_value) >= 0) - -#define M4OSA_INT32_NEG(i32_result, i32_value)\ - { i32_result = -(i32_value); } - -#define M4OSA_INT32_ABS(i32_result, i32_value)\ - { if ((i32_value) > 0) { i32_result = i32_value; }\ - else { i32_result = -(i32_value); } } - -#define M4OSA_INT32_LEFT_SHIFT(i32_result, i32_value, ui32_nbPos)\ - { i64_result = (((ui32_nbPos)>0x1F)?0:((i64_value)<<(ui32_nbPos))); } - -#define M4OSA_INT32_RIGHT_SHIFT(i32_result, i32_value, ui32_nbPos)\ - { i64_result = (((ui32_nbPos)>0x1F)?0:((i64_value)>>(ui32_nbPos))); } - -#define M4OSA_INT32_TO_DOUBLE(f_result, i32_value)\ - { f_result = (M4OSA_Double)(i32_value); } - -#define M4OSA_INT32_FROM_DOUBLE(i32_result, f_value)\ - { i32_result = (M4OSA_Int32)(f_value); } - - -#ifdef M4OSA_64BITS_SUPPORTED - -/* Macro to manipulate M4OSA_Int64*/ -#define M4OSA_INT64_SET(i64_out, i64_in) { i64_out = i64_in; } - -#define M4OSA_INT64_ADD(i64_result, i64_a, i64_b)\ - { i64_result = (i64_a) + (i64_b); } - -#define M4OSA_INT64_SUB(i64_result, i64_a, i64_b)\ - { i64_result = (i64_a) - (i64_b); } - -#define M4OSA_INT64_SCALAR_PRODUCT(i64_result, i64_a, i32_value)\ - { i64_result = (i64_a) * (i32_value); } - -#define M4OSA_INT64_SCALAR_DIVISION(i64_result, i64_a, i32_value)\ - { i64_result = (i64_a) / (i32_value); } - -#define M4OSA_INT64_COMPARE(i64_a, i64_b)\ - ( ((i64_a) == (i64_b)) ? 0 : ( ((i64_a) > (i64_b)) ? 1 : -1) )\ - -#define M4OSA_INT64_FROM_INT32(i64_result, i32_value)\ - { i64_result = (M4OSA_Int64)(i32_value); } - -#define M4OSA_INT64_FROM_INT32_UINT32(i64_result, i32_high, ui32_low)\ - { i64_result = (i32_high); i64_result = (i64_result<<32)+(ui32_low); } - -#define M4OSA_INT64_GET_LOW32(i64_value)\ - ((M4OSA_Int32)((i64_value) & 0xFFFFFFFF)) - -#define M4OSA_INT64_GET_HIGH32(i64_value)\ - ((M4OSA_Int32)(((i64_value) >> 32) & 0xFFFFFFFF)) - -#define M4OSA_INT64_IS_POSITIVE(i64_value) (((i64_value)>=0)?1:0) - -#define M4OSA_INT64_NEG(i64_result, i64_value)\ - { i64_result = -(i64_value); } - -#define M4OSA_INT64_ABS(i64_result, i64_value)\ - { if (M4OSA_INT64_IS_POSITIVE(i64_value)) { i64_result = i64_value; }\ - else { M4OSA_INT64_NEG(i64_result, i64_value); } } - -#define M4OSA_INT64_LEFT_SHIFT(i64_result, i64_value, ui32_nbPos)\ - { i64_result = (((ui32_nbPos)>0x3F)?0:((i64_value)<<(ui32_nbPos))); } - -#define M4OSA_INT64_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPos)\ - { i64_result = (((ui32_nbPos)>0x3F)?0:((i64_value)>>(ui32_nbPos))); } - -#define M4OSA_INT64_TO_DOUBLE(f_result, i64_value)\ - { f_result = (M4OSA_Double)(i64_value); } - -#define M4OSA_INT64_FROM_DOUBLE(i64_result, f_value)\ - { i64_result = (M4OSA_Int64)(f_value); } - -#endif /*M4OSA_64BITS_SUPPORTED*/ - - -#ifdef M4OSA_64BITS_NOT_SUPPORTED - -#define M4OSA_INT64_SET(i64_out, i64_in)\ - M4OSA_INT32_SET(i64_out, i64_in) - -#define M4OSA_INT64_ADD(i64_result, i64_a, i64_b)\ - M4OSA_INT32_ADD(i64_result, i64_a, i64_b) - -#define M4OSA_INT64_SUB(i64_result, i64_a, i64_b)\ - M4OSA_INT32_SUB(i64_result, i64_a, i64_b) - -#define M4OSA_INT64_SCALAR_PRODUCT(i64_result, i64_a, i32_value)\ - M4OSA_INT32_SCALAR_PRODUCT(i64_result, i64_a, i32_value) - -#define M4OSA_INT64_SCALAR_DIVISION(i64_result, i64_a, i32_value)\ - M4OSA_INT32_SCALAR_DIVISION(i64_result, i64_a, i32_value) - -#define M4OSA_INT64_COMPARE(i64_a, i64_b)\ - M4OSA_INT32_COMPARE(i64_a, i64_b) - -#define M4OSA_INT64_FROM_INT32(i64_result, i32_value)\ - M4OSA_INT32_FROM_INT32(i64_result, i32_value) - -#define M4OSA_INT64_FROM_INT32_UINT32(i64_result, i32_high, ui32_low)\ - M4OSA_INT32_FROM_INT32_UINT32(i64_result, i32_high, ui32_low) - -#define M4OSA_INT64_GET_LOW32(i64_value)\ - M4OSA_INT32_GET_LOW32(i64_value) - -#define M4OSA_INT64_GET_HIGH32(i64_value)\ - M4OSA_INT32_GET_HIGH32(i64_value) - -#define M4OSA_INT64_IS_POSITIVE(i64_value)\ - M4OSA_INT32_IS_POSITIVE(i64_value) - -#define M4OSA_INT64_NEG(i64_result, i64_value)\ - M4OSA_INT32_NEG(i64_result, i64_value) - -#define M4OSA_INT64_ABS(i64_result, i64_value)\ - M4OSA_INT32_ABS(i64_result, i64_value) - -#define M4OSA_INT64_LEFT_SHIFT(i64_result, i64_value, ui32_nbPositions)\ - M4OSA_INT32_LEFT_SHIFT(i64_result, i64_value, ui32_nbPositions) - -#define M4OSA_INT64_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPositions)\ - M4OSA_INT32_RIGHT_SHIFT(i64_result, i64_value, ui32_nbPositions) - -#define M4OSA_INT64_TO_DOUBLE(f_result, i64_value)\ - M4OSA_INT32_TO_DOUBLE(f_result, i64_value) - -#define M4OSA_INT64_FROM_DOUBLE(i64_result, f_value)\ - M4OSA_INT32_FROM_DOUBLE(i64_result, f_value) - -#endif /*M4OSA_64BITS_NOT_SUPPORTED*/ - - #ifdef __cplusplus } #endif diff --git a/libvideoeditor/osal/src/M4OSA_CharStar.c b/libvideoeditor/osal/src/M4OSA_CharStar.c index a9461e2b9e..eb7e5255bb 100755 --- a/libvideoeditor/osal/src/M4OSA_CharStar.c +++ b/libvideoeditor/osal/src/M4OSA_CharStar.c @@ -401,17 +401,7 @@ M4OSA_ERR M4OSA_chrSPrintf(M4OSA_Char *pStrOut, M4OSA_UInt32 strOutMaxLen, newFormatLength = strlen((const char *)format) + 1; -#ifdef M4OSA_64BITS_SUPPORTED -#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED - newFormatLength += (count_ll+count_tm+count_aa); -#else - newFormatLength += (count_ll+count_tm-count_aa); -#endif -#elif defined M4OSA_64BITS_NOT_SUPPORTED newFormatLength -= (count_ll+count_tm+count_aa); -#else - return M4ERR_NOT_IMPLEMENTED; -#endif newFormat =(M4OSA_Char*)M4OSA_32bitAlignedMalloc(newFormatLength, M4OSA_CHARSTAR,(M4OSA_Char*)"M4OSA_chrPrintf: newFormat"); @@ -466,36 +456,17 @@ M4OSA_ERR M4OSA_chrSPrintf(M4OSA_Char *pStrOut, M4OSA_UInt32 strOutMaxLen, { if(!strncmp((const char *)format, "ll", 2)) { -#ifdef M4OSA_64BITS_SUPPORTED - *pTemp++ = 'l'; /* %ll */ - *pTemp++ = 'l'; -#else *pTemp++ = 'l'; /* %l */ -#endif format +=2; /* span the "ll" prefix */ } else if(!strncmp((const char *)format, "tm", 2)) { -#ifdef M4OSA_64BITS_SUPPORTED - *pTemp++ = 'l'; /* %ll */ - *pTemp++ = 'l'; -#else *pTemp++ = 'l'; /* %l */ -#endif format +=2; /* span the "tm" prefix */ } else if(!strncmp((const char *)format, "aa", 2)) { -#ifdef M4OSA_64BITS_SUPPORTED -#ifdef M4OSA_FILE_POS_64_BITS_SUPPORTED - *pTemp++ = 'l'; /* %ll */ - *pTemp++ = 'l'; -#else - *pTemp++ = 'l'; -#endif -#else *pTemp++ = 'l'; -#endif format +=2; /* span the "aa" prefix */ } } diff --git a/libvideoeditor/osal/src/M4OSA_Clock.c b/libvideoeditor/osal/src/M4OSA_Clock.c index 9148fe6b43..85fe303ab3 100755 --- a/libvideoeditor/osal/src/M4OSA_Clock.c +++ b/libvideoeditor/osal/src/M4OSA_Clock.c @@ -58,17 +58,10 @@ M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, M4OSA_UInt32 timescale) { struct timeval tv; struct timezone tz; -#ifdef M4OSA_64BITS_NOT_SUPPORTED M4OSA_UInt32 u32_time = 0; M4OSA_UInt32 u32_time_hi; M4OSA_UInt32 u32_time_lo; M4OSA_UInt32 u32_time_lh; -#else /* M4OSA_64BITS_SUPPORTED */ - M4OSA_Int64 i64_time = 0; - M4OSA_Int64 i64_time_hi; - M4OSA_Int64 i64_time_lo; - M4OSA_Int64 i64_temp; -#endif /* M4OSA_64BITS_SUPPORTED */ M4OSA_UInt32 factor; M4OSA_TRACE1_2("M4OSA_clockGetTime\t\tM4OSA_Time* 0x%x\tM4OSA_UInt32 %d", @@ -83,7 +76,6 @@ M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, M4OSA_UInt32 timescale) if(gettimeofday(&tv, &tz) == 0) { -#ifdef M4OSA_64BITS_NOT_SUPPORTED 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; @@ -91,16 +83,8 @@ M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, M4OSA_UInt32 timescale) u32_time_hi += ((u32_time_lo >> 16) & 0xFFFF); u32_time_lo &= 0xFFFF; u32_time = ((u32_time_hi & 0x7FFF) << 16) | u32_time_lo; -#else /* M4OSA_64BITS_SUPPORTED */ - tv.tv_usec /= factor; - M4OSA_INT64_FROM_INT32_UINT32(i64_time_hi, 0, tv.tv_sec); - M4OSA_INT64_FROM_INT32_UINT32(i64_time_lo, 0, tv.tv_usec); - M4OSA_INT64_SCALAR_PRODUCT(i64_temp, i64_time_hi, timescale); - M4OSA_INT64_ADD(i64_time, i64_temp, i64_time_lo); -#endif /* M4OSA_64BITS_SUPPORTED */ } -#ifdef M4OSA_64BITS_NOT_SUPPORTED /* M4OSA_Time is signed, so we need to check the max value*/ if (u32_time > M4OSA_INT32_MAX) { @@ -113,14 +97,6 @@ M4OSA_ERR M4OSA_clockGetTime(M4OSA_Time* pTime, M4OSA_UInt32 timescale) { return M4WAR_TIMESCALE_TOO_BIG; } -#else /* M4OSA_64BITS_SUPPORTED */ - *pTime = (M4OSA_Time)i64_time; - - if( timescale > 1000000 ) - { - return M4WAR_TIMESCALE_TOO_BIG; - } -#endif /* M4OSA_64BITS_SUPPORTED */ return M4NO_ERROR; } diff --git a/libvideoeditor/osal/src/M4OSA_FileCommon.c b/libvideoeditor/osal/src/M4OSA_FileCommon.c index 1a2dc45b6f..592766177a 100755 --- a/libvideoeditor/osal/src/M4OSA_FileCommon.c +++ b/libvideoeditor/osal/src/M4OSA_FileCommon.c @@ -249,8 +249,8 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, pFileContext->m_DescrModeAccess = M4OSA_kDescWriteAccess; } - M4OSA_INT_TO_FILE_POSITION(0, pFileContext->read_position); - M4OSA_INT_TO_FILE_POSITION(0, pFileContext->write_position); + 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, @@ -379,8 +379,8 @@ M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context pContext, M4OSA_FileContext* pFileContext = pContext; M4OSA_FilePosition fpos_current; M4OSA_FilePosition fpos_seek; - M4OSA_FilePosition fpos_null; - M4OSA_FilePosition fpos_neg_un; + M4OSA_FilePosition fpos_null = 0; + M4OSA_FilePosition fpos_neg_un = -1; M4OSA_FilePosition fpos_file_size; M4OSA_FilePosition fpos_seek_from_beginning; @@ -391,39 +391,36 @@ M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context pContext, M4OSA_DEBUG_IF2(0 == seekMode, M4ERR_PARAMETER, "M4OSA_fileCommonSeek"); M4OSA_DEBUG_IF2(M4OSA_NULL == pFilePos, M4ERR_PARAMETER, "M4OSA_fileCommonSeek"); - M4OSA_INT_TO_FILE_POSITION(0, fpos_null); - M4OSA_INT_TO_FILE_POSITION(-1, fpos_neg_un); - M4OSA_FPOS_SET(fpos_file_size, pFileContext->file_size); + fpos_file_size = pFileContext->file_size; if(SeekRead == pFileContext->current_seek) { - M4OSA_FPOS_SET(fpos_current, pFileContext->read_position); + fpos_current = pFileContext->read_position; } else if(SeekWrite == pFileContext->current_seek) { - M4OSA_FPOS_SET(fpos_current, pFileContext->write_position); + fpos_current = pFileContext->write_position; } else { - M4OSA_INT_TO_FILE_POSITION(0, fpos_current); + fpos_current = 0; } switch(seekMode) { case M4OSA_kFileSeekCurrent: { - M4OSA_FPOS_SET(fpos_seek, *pFilePos); + fpos_seek = *pFilePos; break; } case M4OSA_kFileSeekBeginning: { - M4OSA_FPOS_SUB(fpos_seek, *pFilePos, fpos_current) - break; + fpos_seek = *pFilePos - fpos_current; + break; } case M4OSA_kFileSeekEnd: { - M4OSA_FPOS_ADD(fpos_seek, fpos_file_size, *pFilePos); - M4OSA_FPOS_SUB(fpos_seek, fpos_seek, fpos_current); + fpos_seek = *pFilePos + fpos_file_size - fpos_current; break; } default: @@ -432,7 +429,7 @@ M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context pContext, } } - M4OSA_FPOS_ADD(fpos_seek_from_beginning, fpos_current, fpos_seek); + fpos_seek_from_beginning = fpos_current + fpos_seek; if(fseek(pFileContext->file_desc, fpos_seek, SEEK_CUR) != 0) { @@ -454,7 +451,7 @@ M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context pContext, } /* Set the returned position from the beginning of the file */ - M4OSA_FPOS_SET(*pFilePos, fpos_seek_from_beginning); + *pFilePos = fpos_seek_from_beginning; /* SEEK done, reset end of file value */ pFileContext->b_is_end_of_file = M4OSA_FALSE; @@ -545,17 +542,17 @@ M4OSA_ERR M4OSA_fileCommonGetAttribute(M4OSA_Context pContext, M4OSA_FileAttribu return M4ERR_BAD_CONTEXT; } - M4OSA_INT64_FROM_INT32(pAttribute->creationDate.time, TheStat.st_ctime); - M4OSA_INT64_FROM_INT32(pAttribute->lastAccessDate.time, TheStat.st_atime); - M4OSA_INT64_FROM_INT32(pAttribute->modifiedDate.time, TheStat.st_mtime); + 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.timeScale = 1; + pAttribute->lastAccessDate.timeScale = 1; + pAttribute->modifiedDate.timeScale = 1; - pAttribute->creationDate.referenceYear = 1970; - pAttribute->lastAccessDate.referenceYear= 1970; - pAttribute->modifiedDate.referenceYear = 1970; + pAttribute->creationDate.referenceYear = 1970; + pAttribute->lastAccessDate.referenceYear = 1970; + pAttribute->modifiedDate.referenceYear = 1970; pAttribute->modeAccess = fileContext->access_mode; diff --git a/libvideoeditor/osal/src/M4OSA_FileReader.c b/libvideoeditor/osal/src/M4OSA_FileReader.c index be3bb376ae..5e9f757459 100755 --- a/libvideoeditor/osal/src/M4OSA_FileReader.c +++ b/libvideoeditor/osal/src/M4OSA_FileReader.c @@ -117,8 +117,7 @@ M4OSA_ERR M4OSA_fileReadData(M4OSA_Context pContext, M4OSA_MemAddr8 data, } else { - M4OSA_FPOS_ADD_CONST_UINT32(pFileContext->read_position, - pFileContext->read_position, uiSizeRead); + pFileContext->read_position = pFileContext->read_position + uiSizeRead; if ((M4OSA_UInt32)uiSizeRead < *pSize) { *pSize = uiSizeRead; @@ -170,8 +169,7 @@ M4OSA_ERR M4OSA_fileReadData(M4OSA_Context pContext, M4OSA_MemAddr8 data, } else { - M4OSA_FPOS_ADD_CONST_UINT32(pFileContext->read_position, - pFileContext->read_position, uiSizeRead); + pFileContext->read_position = pFileContext->read_position + uiSizeRead; if ((M4OSA_UInt32)uiSizeRead < *pSize) { *pSize = uiSizeRead; @@ -310,7 +308,7 @@ M4OSA_ERR M4OSA_fileReadSeek(M4OSA_Context pContext, M4OSA_FileSeekAccessMode se } else { - M4OSA_FPOS_SET(pFileContext->read_position, *pPosition); + pFileContext->read_position = *pPosition; } #ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE diff --git a/libvideoeditor/osal/src/M4OSA_FileWriter.c b/libvideoeditor/osal/src/M4OSA_FileWriter.c index 1fc73dc013..92b462f226 100755 --- a/libvideoeditor/osal/src/M4OSA_FileWriter.c +++ b/libvideoeditor/osal/src/M4OSA_FileWriter.c @@ -113,12 +113,12 @@ M4OSA_ERR M4OSA_fileWriteData(M4OSA_Context pContext, M4OSA_MemAddr8 data, } fflush(pFileContext->file_desc); - M4OSA_FPOS_ADD_CONST_UINT32(pFileContext->write_position, pFileContext->write_position, WriteSize); + pFileContext->write_position = pFileContext->write_position + WriteSize; /* Update the file size */ - if(M4OSA_FPOS_COMPARE(pFileContext->write_position, pFileContext->file_size) > 0) + if(pFileContext->write_position > pFileContext->file_size) { - M4OSA_FPOS_SET(pFileContext->file_size, pFileContext->write_position); + pFileContext->file_size = pFileContext->write_position; } return err; } @@ -160,14 +160,12 @@ M4OSA_ERR M4OSA_fileWriteData(M4OSA_Context pContext, M4OSA_MemAddr8 data, return M4ERR_BAD_CONTEXT; } - M4OSA_FPOS_ADD_CONST_UINT32(pFileContext->write_position, - pFileContext->write_position, - uiSizeWrite); + pFileContext->write_position = pFileContext->write_position + uiSizeWrite; /* Update the file size */ - if(M4OSA_FPOS_COMPARE(pFileContext->write_position, pFileContext->file_size) > 0) + if(pFileContext->write_position > pFileContext->file_size) { - M4OSA_FPOS_SET(pFileContext->file_size, pFileContext->write_position); + pFileContext->file_size = pFileContext->write_position; } if((M4OSA_UInt32)uiSizeWrite < uiSize) @@ -285,7 +283,7 @@ M4OSA_ERR M4OSA_fileWriteSeek(M4OSA_Context pContext, M4OSA_FileSeekAccessMode s return err; } - M4OSA_FPOS_SET(pFileContext->write_position, *pPosition); + pFileContext->write_position = *pPosition; pFileContext->current_seek = SeekWrite; diff --git a/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c b/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c index 209198b6a6..cb0c84f25b 100755 --- a/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c +++ b/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c @@ -2879,7 +2879,6 @@ M4OSA_ERR M4MP4W_closeWrite( M4OSA_Context context ) #ifndef _M4MP4W_MOOV_FIRST - M4OSA_UInt32 filePos; M4OSA_FilePosition moovPos, mdatPos; #endif /*_M4MP4W_MOOV_FIRST*/ @@ -3616,12 +3615,8 @@ M4OSA_ERR M4MP4W_closeWrite( M4OSA_Context context ) #endif /*_M4MP4W_MOOV_FIRST*/ - /* Pierre Lebeaupin 19/12/2007: changing the way the mdat size is computed. */ #ifndef _M4MP4W_MOOV_FIRST /* seek is used to get the current position relative to the start of the file. */ - /* M4OSA_INT_TO_FILE_POSITION(0, moovPos); - /CLEANUPonERR( mMp4FileDataPtr->fileWriterFunctions->seek(mMp4FileDataPtr->fileWriterContext, - M4OSA_kFileSeekCurrent, &moovPos) ); */ /* ... or rather, seek used to be used for that, but it has been found this functionality is not reliably, or sometimes not at all, implemented in the various OSALs, so we now avoid using it. */ @@ -3634,9 +3629,6 @@ M4OSA_ERR M4MP4W_closeWrite( M4OSA_Context context ) /* moovPos will be used after writing the moov. */ #endif /*_M4MP4W_MOOV_FIRST*/ - /* End of Pierre Lebeaupin 19/12/2007: changing the way the mdat size is computed. */ - - /*moov*/ CLEANUPonERR(M4MP4W_putBE32(moovSize, mMp4FileDataPtr->fileWriterFunctions, fileWriterContext)); @@ -4511,13 +4503,12 @@ M4OSA_ERR M4MP4W_closeWrite( M4OSA_Context context ) /*overwrite mdat size*/ if (mMp4FileDataPtr->ftyp.major_brand != 0) - filePos = 16 + mMp4FileDataPtr->ftyp.nbCompatibleBrands * 4; + mdatPos= 16 + mMp4FileDataPtr->ftyp.nbCompatibleBrands * 4; else - filePos = 24; + mdatPos = 24; - M4OSA_INT_TO_FILE_POSITION(filePos, mdatPos); - M4OSA_FPOS_SUB(moovPos, moovPos, mdatPos); - M4OSA_FILE_POSITION_TO_INT(moovPos, mdatSize); + moovPos = moovPos - mdatPos; + mdatSize = moovPos; CLEANUPonERR(mMp4FileDataPtr->fileWriterFunctions->seek(fileWriterContext, M4OSA_kFileSeekBeginning, &mdatPos)); /*seek after ftyp...*/ diff --git a/libvideoeditor/vss/common/inc/M4DA_Types.h b/libvideoeditor/vss/common/inc/M4DA_Types.h index d41f934f44..0779bf97a0 100755 --- a/libvideoeditor/vss/common/inc/M4DA_Types.h +++ b/libvideoeditor/vss/common/inc/M4DA_Types.h @@ -83,7 +83,7 @@ typedef struct M4_StreamType m_streamType; /**< Stream type */ M4OSA_UInt32 m_streamId; /**< Stream Id (unique number definning the stream) */ - M4OSA_Int64 m_duration; /**< Duration of the stream in milli + M4OSA_Int32 m_duration; /**< Duration of the stream in milli seconds */ M4OSA_UInt32 m_averageBitRate; /**< Average bitrate in kb/s */ M4OSA_UInt32 m_maxAUSize; /**< Maximum size of an Access Unit */ diff --git a/libvideoeditor/vss/mcs/src/M4MCS_API.c b/libvideoeditor/vss/mcs/src/M4MCS_API.c index db6d92f3d1..8bed9044e8 100755 --- a/libvideoeditor/vss/mcs/src/M4MCS_API.c +++ b/libvideoeditor/vss/mcs/src/M4MCS_API.c @@ -8626,16 +8626,16 @@ m4mcs_intaudiotranscoding_encode_and_write: if( pC->pEffects[*pActiveEffectNumber].ExtAudioEffectFct != M4OSA_NULL ) { M4MCS_ExternalProgress pProgress; - M4OSA_UInt64 tempProgress = 0; + M4OSA_UInt32 tempProgress = 0; pProgress.uiClipTime = (M4OSA_UInt32)pC->ReaderAudioAU.m_CTS; pProgress.uiOutputTime = ( pC->WriterAudioAU.CTS * 1000) / pC->WriterAudioStream.timeScale; - tempProgress = ( (M4OSA_UInt64)pC->ReaderAudioAU.m_CTS + tempProgress = ( (M4OSA_UInt32)pC->ReaderAudioAU.m_CTS - pC->pEffects[*pActiveEffectNumber].uiStartTime - pC->uiBeginCutTime) * 1000; pProgress.uiProgress = - (M4OSA_UInt32)(tempProgress / (M4OSA_UInt64)pC->pEffects[ + (M4OSA_UInt32)(tempProgress / (M4OSA_UInt32)pC->pEffects[ *pActiveEffectNumber].uiDuration); err = pC->pEffects[*pActiveEffectNumber].ExtAudioEffectFct( diff --git a/libvideoeditor/vss/src/M4AMRR_CoreReader.c b/libvideoeditor/vss/src/M4AMRR_CoreReader.c index 8871e750f7..db2100f96e 100755 --- a/libvideoeditor/vss/src/M4AMRR_CoreReader.c +++ b/libvideoeditor/vss/src/M4AMRR_CoreReader.c @@ -347,7 +347,7 @@ M4OSA_ERR M4AMRR_getNextStream(M4OSA_Context Context, M4SYS_StreamDescription* p /* Timescale equals Sampling Frequency: NB-8000 Hz, WB-16000 Hz */ pStreamDesc->timeScale = (pStreamContext->m_streamType == M4SYS_kAMR )?8000:16000; - M4OSA_TIME_SET_UNKNOWN(pStreamDesc->duration); + pStreamDesc->duration = M4OSA_TIME_UNKNOWN; pStreamContext->m_pStreamHandler = (M4SYS_StreamDescription*)M4OSA_32bitAlignedMalloc(sizeof(M4SYS_StreamDescription), @@ -361,7 +361,7 @@ M4OSA_ERR M4AMRR_getNextStream(M4OSA_Context Context, M4SYS_StreamDescription* p pStreamContext->m_pStreamHandler->averageBitrate = pStreamDesc->averageBitrate; pStreamContext->m_pStreamHandler->decoderSpecificInfo = M4OSA_NULL ; pStreamContext->m_pStreamHandler->decoderSpecificInfoSize = 0 ; - M4OSA_TIME_SET_UNKNOWN(pStreamContext->m_pStreamHandler->duration); + pStreamContext->m_pStreamHandler->duration = M4OSA_TIME_UNKNOWN; pStreamContext->m_pStreamHandler->profileLevel = 0xFF ; pStreamContext->m_pStreamHandler->streamID = 1; pStreamContext->m_pStreamHandler->streamType = pStreamDesc->streamType ; @@ -595,7 +595,7 @@ M4OSA_ERR M4AMRR_seek(M4OSA_Context Context, M4SYS_StreamID* pStreamID, M4OSA_Ti /*Make explicit time cast, but take care that timescale is not used !!!*/ M4OSA_TIME_TO_MS(time_double, time, 1000); - M4OSA_INT64_FROM_INT32(*pObtainCTS, 0); + *pObtainCTS = 0; M4OSA_DEBUG_IF2((M4OSA_NULL == Context),M4ERR_PARAMETER,"Context M4OSA_NULL"); M4OSA_DEBUG_IF2((pStreamContext->m_contextId != M4AMRR_CONTEXTID),M4ERR_BAD_CONTEXT, @@ -740,11 +740,11 @@ M4OSA_ERR M4AMRR_seek(M4OSA_Context Context, M4SYS_StreamID* pStreamID, M4OSA_Ti if ( partSeekTime == 0) { - M4OSA_TIME_SET(*pObtainCTS, time); + *pObtainCTS = time; return M4NO_ERROR; } - M4OSA_INT64_FROM_DOUBLE(*pObtainCTS, (time_double - (M4OSA_Double)partSeekTime)) ; + *pObtainCTS = (M4OSA_Time)(time_double - (M4OSA_Double)partSeekTime); switch(seekMode) { @@ -793,7 +793,7 @@ M4OSA_ERR M4AMRR_seek(M4OSA_Context Context, M4SYS_StreamID* pStreamID, M4OSA_Ti if ( size == 0) { /* If the target time is invalid, point to begining and return */ - M4OSA_INT64_FROM_INT32(*pObtainCTS, 0); + *pObtainCTS = 0; filePos = pStreamContext->m_pSeekIndex[0]; pStreamContext->m_pOsaFilePtrFct->seek(pStreamContext->m_pAMRFile, M4OSA_kFileSeekBeginning, &filePos); diff --git a/libvideoeditor/vss/src/M4READER_Amr.c b/libvideoeditor/vss/src/M4READER_Amr.c index 9d4af88f04..a7cd653e8e 100755 --- a/libvideoeditor/vss/src/M4READER_Amr.c +++ b/libvideoeditor/vss/src/M4READER_Amr.c @@ -80,7 +80,7 @@ M4OSA_ERR M4READER_AMR_create(M4OSA_Context *pContext) pReaderContext->m_pAudioStream = M4OSA_NULL; pReaderContext->m_audioAu.dataAddress = M4OSA_NULL; - M4OSA_INT64_FROM_INT32(pReaderContext->m_maxDuration, 0); + pReaderContext->m_maxDuration = 0; pReaderContext->m_pCoreContext = M4OSA_NULL; pReaderContext->m_pOsaFileReaderFcts = M4OSA_NULL; @@ -303,14 +303,12 @@ M4OSA_ERR M4READER_AMR_getNextStream(M4OSA_Context context, M4READER_MediaFamily pStreamHandler->m_pDecoderSpecificInfo = (M4OSA_UInt8*)(streamDesc.decoderSpecificInfo); pStreamHandler->m_decoderSpecificInfoSize = streamDesc.decoderSpecificInfoSize; pStreamHandler->m_streamId = streamDesc.streamID; - // M4OSA_INT64_FROM_DOUBLE(pStreamHandler->m_duration, - // (M4OSA_Double)(((M4OSA_Float)streamDesc.duration*1000/(M4OSA_Float)(streamDesc.timeScale)))); pStreamHandler->m_duration = streamDesc.duration; pStreamHandler->m_pUserData = (void*)streamDesc.timeScale; /*trick to change*/ - if (M4OSA_TIME_COMPARE(streamDesc.duration, pC->m_maxDuration) > 0) + if (streamDesc.duration > pC->m_maxDuration) { - M4OSA_TIME_SET(pC->m_maxDuration, streamDesc.duration); + pC->m_maxDuration = streamDesc.duration; } pStreamHandler->m_averageBitRate = streamDesc.averageBitrate; @@ -422,7 +420,7 @@ M4OSA_ERR M4READER_AMR_getOption(M4OSA_Context context, M4OSA_OptionID optionId, { case M4READER_kOptionID_Duration : { - M4OSA_TIME_SET(*(M4OSA_Time*)pValue, pC->m_maxDuration); + *(M4OSA_Time*)pValue = pC->m_maxDuration; } break; @@ -523,15 +521,13 @@ M4OSA_ERR M4READER_AMR_reset(M4OSA_Context context, M4_StreamHandler *pStreamHan M4SYS_StreamID streamIdArray[2]; M4OSA_ERR err; M4SYS_AccessUnit* pAu; - M4OSA_Time time64; + M4OSA_Time time64 = 0; M4AMRR_State State; M4OSA_DEBUG_IF1((pC == 0), M4ERR_PARAMETER, "M4READER_AMR_reset: invalid context"); M4OSA_DEBUG_IF1((pStreamHandler == 0), M4ERR_PARAMETER, "M4READER_AMR_reset: invalid pointer to M4_StreamHandler"); - M4OSA_INT64_FROM_INT32(time64, 0); - if (pStreamHandler == (M4_StreamHandler*)pC->m_pAudioStream) { pAu = &pC->m_audioAu; @@ -596,8 +592,7 @@ M4OSA_ERR M4READER_AMR_jump(M4OSA_Context context, M4_StreamHandler *pStreamHand M4SYS_StreamID streamIdArray[2]; M4OSA_ERR err; M4SYS_AccessUnit* pAu; - M4OSA_Time time64; - M4OSA_Double timeDouble; /*used for type conversion only*/ + M4OSA_Time time64 = (M4OSA_Time)*pTime; M4AMRR_State State; M4OSA_DEBUG_IF1((pC == 0), M4ERR_PARAMETER, "M4READER_AMR_reset: invalid context"); @@ -605,8 +600,6 @@ M4OSA_ERR M4READER_AMR_jump(M4OSA_Context context, M4_StreamHandler *pStreamHand "M4READER_AMR_reset: invalid pointer to M4_StreamHandler"); M4OSA_DEBUG_IF1((pTime == 0), M4ERR_PARAMETER, "M4READER_3GP_jump: invalid time pointer"); - M4OSA_INT64_FROM_INT32(time64, *pTime); - if (pStreamHandler == (M4_StreamHandler*)pC->m_pAudioStream) { pAu = &pC->m_audioAu; @@ -641,8 +634,7 @@ M4OSA_ERR M4READER_AMR_jump(M4OSA_Context context, M4_StreamHandler *pStreamHand return err; } - M4OSA_INT64_TO_DOUBLE(timeDouble, time64); - *pTime = (M4OSA_Int32)timeDouble; + *pTime = (M4OSA_Int32)time64; return err; } diff --git a/libvideoeditor/vss/src/M4READER_Pcm.c b/libvideoeditor/vss/src/M4READER_Pcm.c index 627d135543..9f2e5b3866 100755 --- a/libvideoeditor/vss/src/M4READER_Pcm.c +++ b/libvideoeditor/vss/src/M4READER_Pcm.c @@ -249,7 +249,7 @@ M4OSA_ERR M4READER_PCM_getOption(M4OSA_Context context, M4OSA_OptionID optionId, switch (optionId) { case M4READER_kOptionID_Duration: - *((M4OSA_UInt64*)pValue) = pContext->m_pAudioStream->m_duration; + *((M4OSA_UInt32*)pValue) = pContext->m_pAudioStream->m_duration; break; case M4READER_kOptionID_Version: @@ -382,7 +382,7 @@ M4OSA_ERR M4READER_PCM_getNextStream(M4OSA_Context context, M4READER_MediaFamily pAudioStreamHandler->m_nbChannels = pDsi->nbChannels; M4OSA_TIME_TO_MS( fDuration, streamDesc.duration, streamDesc.timeScale); - pC->m_pAudioStream->m_duration = (M4OSA_Int64)fDuration; + pC->m_pAudioStream->m_duration = (M4OSA_Int32)fDuration; pC->m_pAudioStream->m_pDecoderSpecificInfo = (M4OSA_UInt8*)(streamDesc.decoderSpecificInfo); pC->m_pAudioStream->m_decoderSpecificInfoSize = streamDesc.decoderSpecificInfoSize; pC->m_pAudioStream->m_streamId = streamDesc.streamID; diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp index 6ea9753c31..ea4abcee78 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp @@ -406,7 +406,8 @@ M4OSA_ERR VideoEditor3gpReader_create(M4OSA_Context *pContext) { pC->mVideoSeeking = M4OSA_FALSE; pC->mVideoSeekTime = 0; - M4OSA_INT64_FROM_INT32(pC->mMaxDuration, 0); + pC->mMaxDuration = 0; + *pContext=pC; cleanUp: @@ -646,7 +647,7 @@ M4OSA_ERR VideoEditor3gpReader_getOption(M4OSA_Context context, case M4READER_kOptionID_Duration: { LOGV("VideoEditor3gpReader_getOption duration %d",pC->mMaxDuration); - M4OSA_TIME_SET(*(M4OSA_Time*)pValue, pC->mMaxDuration); + *(M4OSA_Time*)pValue = pC->mMaxDuration; } break; case M4READER_kOptionID_Version: @@ -859,7 +860,6 @@ M4OSA_ERR VideoEditor3gpReader_jump(M4OSA_Context context, M4OSA_ERR err = M4NO_ERROR; M4SYS_AccessUnit* pAu; M4OSA_Time time64; - M4OSA_Double timeDouble; M4OSA_DEBUG_IF1((pC == 0), M4ERR_PARAMETER, "VideoEditor3gpReader_jump: invalid context"); @@ -873,7 +873,7 @@ M4OSA_ERR VideoEditor3gpReader_jump(M4OSA_Context context, if (*pTime == (pStreamHandler->m_duration)) { *pTime -= 1; } - M4OSA_INT64_FROM_INT32(time64, *pTime); + time64 = (M4OSA_Time)*pTime; LOGV("VideoEditor3gpReader_jump time us %ld ", time64); @@ -906,8 +906,7 @@ M4OSA_ERR VideoEditor3gpReader_jump(M4OSA_Context context, time64 = time64 / 1000; /* Convert the time into milli sec */ LOGV("VideoEditor3gpReader_jump time ms before seekset %ld ", time64); - M4OSA_INT64_TO_DOUBLE(timeDouble, time64); - *pTime = (M4OSA_Int32)timeDouble; + *pTime = (M4OSA_Int32)time64; LOGV("VideoEditor3gpReader_jump end"); err = M4NO_ERROR; @@ -929,15 +928,13 @@ M4OSA_ERR VideoEditor3gpReader_reset(M4OSA_Context context, M4OSA_ERR err = M4NO_ERROR; M4SYS_StreamID streamIdArray[2]; M4SYS_AccessUnit* pAu; - M4OSA_Time time64; + M4OSA_Time time64 = 0; M4OSA_DEBUG_IF1((pC == 0), M4ERR_PARAMETER, "VideoEditor3gpReader_reset: invalid context"); M4OSA_DEBUG_IF1((pStreamHandler == 0), M4ERR_PARAMETER, "VideoEditor3gpReader_reset: invalid pointer to M4_StreamHandler"); - M4OSA_INT64_FROM_INT32(time64, 0); - LOGV("VideoEditor3gpReader_reset begin"); if (pStreamHandler == (M4_StreamHandler*)pC->mAudioStreamHandler) { @@ -1905,8 +1902,8 @@ M4OSA_ERR VideoEditor3gpReader_getPrevRapTime(M4OSA_Context context, if (*pTime == (pStreamHandler->m_duration)) { *pTime -= 1; } - M4OSA_INT64_FROM_INT32(time64, *pTime); - time64 = time64 * 1000; + + time64 = (M4OSA_Time)*pTime * 1000; LOGV("VideoEditor3gpReader_getPrevRapTime seek time: %ld",time64); options.setSeekTo(time64, MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC); @@ -1921,7 +1918,7 @@ M4OSA_ERR VideoEditor3gpReader_getPrevRapTime(M4OSA_Context context, LOGV("VideoEditor3gpReader_getPrevRapTime read time %ld, %x", tempTime64, mMediaBuffer); - (*pTime) = (tempTime64) / 1000; + *pTime = (M4OSA_Int32)(tempTime64 / 1000); if(mMediaBuffer != M4OSA_NULL) { LOGV(" mMediaBuffer size = %d length %d", mMediaBuffer->size(), diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp index d126fae0fb..1ae567ea6a 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorMp3Reader.cpp @@ -97,7 +97,7 @@ M4OSA_ERR VideoEditorMp3Reader_create(M4OSA_Context *pContext) { pReaderContext->mAudioStreamHandler = M4OSA_NULL; pReaderContext->mAudioAu.dataAddress = M4OSA_NULL; - M4OSA_INT64_FROM_INT32(pReaderContext->mMaxDuration, 0); + pReaderContext->mMaxDuration = 0; *pContext = pReaderContext; cleanUp: @@ -277,7 +277,7 @@ M4OSA_ERR VideoEditorMp3Reader_getOption(M4OSA_Context context, case M4READER_kOptionID_Duration: { LOGV("Mp3Reader duration=%ld",pReaderContext->mMaxDuration); - M4OSA_TIME_SET(*(M4OSA_Time*)pValue, pReaderContext->mMaxDuration); + *(M4OSA_Time*)pValue = pReaderContext->mMaxDuration; } break; @@ -372,8 +372,7 @@ M4OSA_ERR VideoEditorMp3Reader_jump(M4OSA_Context context, M4SYS_StreamID streamIdArray[2]; M4OSA_ERR err = M4NO_ERROR; M4SYS_AccessUnit* pAu; - M4OSA_Time time64; - M4OSA_Double timeDouble; + M4OSA_Time time64 = (M4OSA_Time)*pTime; LOGV("VideoEditorMp3Reader_jump begin"); M4OSA_DEBUG_IF1((pReaderContext == 0), M4ERR_PARAMETER, @@ -383,8 +382,6 @@ M4OSA_ERR VideoEditorMp3Reader_jump(M4OSA_Context context, M4OSA_DEBUG_IF1((pTime == 0), M4ERR_PARAMETER, "VideoEditorMp3Reader_jump: invalid time pointer"); - M4OSA_INT64_FROM_INT32(time64, *pTime); - if(pStreamHandler == (M4_StreamHandler*)pReaderContext->\ mAudioStreamHandler){ pAu = &pReaderContext->mAudioAu; @@ -408,8 +405,7 @@ M4OSA_ERR VideoEditorMp3Reader_jump(M4OSA_Context context, pReaderContext->mSeekTime = time64; time64 = time64 / 1000; /* Convert the time into milli sec */ - M4OSA_INT64_TO_DOUBLE(timeDouble, time64); - *pTime = (M4OSA_Int32)timeDouble; + *pTime = (M4OSA_Int32)time64; LOGV("VideoEditorMp3Reader_jump end "); return err; } @@ -623,7 +619,7 @@ M4OSA_ERR VideoEditorMp3Reader_reset(M4OSA_Context context, M4OSA_ERR err = M4NO_ERROR; M4SYS_StreamID streamIdArray[2]; M4SYS_AccessUnit* pAu; - M4OSA_Time time64; + M4OSA_Time time64 = 0; LOGV("VideoEditorMp3Reader_reset start"); M4OSA_DEBUG_IF1((pReaderContext == 0), M4ERR_PARAMETER, @@ -631,8 +627,6 @@ M4OSA_ERR VideoEditorMp3Reader_reset(M4OSA_Context context, M4OSA_DEBUG_IF1((pStreamHandler == 0), M4ERR_PARAMETER, "VideoEditorMp3Reader_reset: invalid pointer to M4_StreamHandler"); - M4OSA_INT64_FROM_INT32(time64, 0); - if (pStreamHandler == (M4_StreamHandler*)pReaderContext->\ mAudioStreamHandler) { pAu = &pReaderContext->mAudioAu; -- 2.11.0