diff options
author | hongteng <hongteng@google.com> | 2011-04-21 23:01:07 -0700 |
---|---|---|
committer | hongteng <hongteng@google.com> | 2011-04-22 10:51:10 -0700 |
commit | 3b25fdc4a33b53cfcf67315c2d42ad699b8cefe2 (patch) | |
tree | 0333987ba73a33defc7dee67eb82fa67dbf14cff | |
parent | 694816d7291f17364502ac5d3319684a0b180860 (diff) | |
download | frameworks_av-3b25fdc4a33b53cfcf67315c2d42ad699b8cefe2.zip frameworks_av-3b25fdc4a33b53cfcf67315c2d42ad699b8cefe2.tar.gz frameworks_av-3b25fdc4a33b53cfcf67315c2d42ad699b8cefe2.tar.bz2 |
Fix for issue 3385135 "source code cleanup" engine part
- remove commented code
- remove code under #if 0
- remove macro FILE_LOWER_CASE as it is not used
- remove macro #if 1
- remove TIMESCALE_BUG macro, and all code under this macro as it is not used
- remove following unused functions:
* M4MCS_getExifInfo
* M4MCS_registerAudioEncoderExtended
* M4MCS_registerVideoDecoderExtended
* M4MCS_registerAudioDecoderExtended
* M4MCS_registerVideoEncoderExtended
Change-Id: I8e2916d956af6d381ae1962fedc61a8b48f60ce2
27 files changed, 69 insertions, 2312 deletions
diff --git a/libvideoeditor/lvpp/VideoEditorTools.cpp b/libvideoeditor/lvpp/VideoEditorTools.cpp index 9a43896..ad5cbc5 100755 --- a/libvideoeditor/lvpp/VideoEditorTools.cpp +++ b/libvideoeditor/lvpp/VideoEditorTools.cpp @@ -1281,16 +1281,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p u16_pix4 = *( (M4VIFI_UInt16 *) (pu8_rgbn + u32_stride_rgb + CST_RGB_16_SIZE));
/* Unpack RGB565 to 8bit R, G, B */
-#if 0
- /* (x,y) */
- GET_RGB565(i32_r00,i32_g00,i32_b00,u16_pix1);
- /* (x+1,y) */
- GET_RGB565(i32_r10,i32_g10,i32_b10,u16_pix2);
- /* (x,y+1) */
- GET_RGB565(i32_r01,i32_g01,i32_b01,u16_pix3);
- /* (x+1,y+1) */
- GET_RGB565(i32_r11,i32_g11,i32_b11,u16_pix4);
-#else
/* (x,y) */
GET_RGB565(i32_b00,i32_g00,i32_r00,u16_pix1);
/* (x+1,y) */
@@ -1299,8 +1289,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p GET_RGB565(i32_b01,i32_g01,i32_r01,u16_pix3);
/* (x+1,y+1) */
GET_RGB565(i32_b11,i32_g11,i32_r11,u16_pix4);
-#endif
-#if 1 /* Solution to avoid green effects due to transparency */
/* If RGB is transparent color (0, 63, 0), we transform it to white (31,63,31) */
if(i32_b00 == 0 && i32_g00 == 63 && i32_r00 == 0)
{
@@ -1322,7 +1310,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p i32_b11 = 31;
i32_r11 = 31;
}
-#endif
/* Convert RGB value to YUV */
i32_u00 = U16(i32_r00, i32_g00, i32_b00);
i32_v00 = V16(i32_r00, i32_g00, i32_b00);
@@ -1349,47 +1336,8 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p pu8_yn[1] = (M4VIFI_UInt8)i32_y10;
pu8_ys[0] = (M4VIFI_UInt8)i32_y01;
pu8_ys[1] = (M4VIFI_UInt8)i32_y11;
-#if 0 /* Temporary solution to avoid green effects due to transparency -> To be removed */
- count_null = 4;
- /* Store chroma data */
- if(i32_b00 == 0 && i32_g00 == 63 && i32_r00 == 0)
- {
- i32_u00 = 0;
- i32_v00 = 0;
- count_null --;
- }
- if(i32_b10 == 0 && i32_g10 == 63 && i32_r10 == 0)
- {
- i32_u10 = 0;
- i32_v10 = 0;
- count_null --;
- }
- if(i32_b01 == 0 && i32_g01 == 63 && i32_r01 == 0)
- {
- i32_u01 = 0;
- i32_v01 = 0;
- count_null --;
- }
- if(i32_b11 == 0 && i32_g11 == 63 && i32_r11 == 0)
- {
- i32_u11 = 0;
- i32_v11 = 0;
- count_null --;
- }
-
- if(count_null == 0)
- {
-#endif
*pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) >> 2);
*pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) >> 2);
-#if 0 /* Temporary solution to avoid green effects due to transparency -> To be removed */
- }
- else
- {
- *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) / count_null);
- *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) / count_null);
- }
-#endif
/* Prepare for next column */
pu8_rgbn += (CST_RGB_16_SIZE<<1);
/* Update current Y plane line pointer*/
diff --git a/libvideoeditor/osal/inc/M4OSA_Memory.h b/libvideoeditor/osal/inc/M4OSA_Memory.h index 7cb3d91..d80fff6 100755 --- a/libvideoeditor/osal/inc/M4OSA_Memory.h +++ b/libvideoeditor/osal/inc/M4OSA_Memory.h @@ -43,12 +43,6 @@ M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc (M4OSA M4OSA_CoreID coreID, M4OSA_Char* string); -M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_MemAddr32 M4OSA_malloc (M4OSA_UInt32 size, - M4OSA_CoreID coreID, - M4OSA_Char* string); - -M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_Void M4OSA_free (M4OSA_MemAddr32 address); - M4OSAL_MEMORY_EXPORT_TYPE extern M4OSA_ERR M4OSA_randInit(void); diff --git a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c b/libvideoeditor/osal/src/LVOSA_FileReader_optim.c index 14da016..dc84eab 100755 --- a/libvideoeditor/osal/src/LVOSA_FileReader_optim.c +++ b/libvideoeditor/osal/src/LVOSA_FileReader_optim.c @@ -450,30 +450,6 @@ M4OSA_ERR M4OSA_FileReader_CalculateSize(M4OSA_FileReader_Context_optim* apConte err = errno; M4OSA_TRACE1_1("M4OSA_FileReader_CalculateSize ERR = 0x%x", err); } -#if 0 - fileSeekPosition = 0; - errno = apContext->FS->seek(apContext->aFileDesc, M4OSA_kFileSeekEnd, &fileSeekPosition); - - if (M4NO_ERROR != errno) - { - apContext->readFilePos = M4OSA_EOF; - err = errno; - M4OSA_TRACE1_1("M4OSA_FileReader_CalculateSize ERR1 = 0x%x", err); - } - else - { - /* Retrieve size of the file */ - errno = apContext->FS->getOption(apContext->aFileDesc, - M4OSA_kFileReadGetFilePosition, - (M4OSA_DataOption*) &apContext->fileSize); - if (M4NO_ERROR != errno) - { - err = errno; - M4OSA_TRACE1_1("M4OSA_FileReader_CalculateSize ERR2 = 0x%x", err); - } - apContext->readFilePos = apContext->fileSize; - } -#endif #else ret_val = apContext->FS->pFctPtr_Seek(apContext->aFileDesc, 0, M4OSA_kFileSeekEnd, &errno); diff --git a/libvideoeditor/osal/src/M4OSA_FileCommon.c b/libvideoeditor/osal/src/M4OSA_FileCommon.c index a012ec0..1a2dc45 100755 --- a/libvideoeditor/osal/src/M4OSA_FileCommon.c +++ b/libvideoeditor/osal/src/M4OSA_FileCommon.c @@ -45,7 +45,6 @@ #include "M4OSA_Memory.h" #include "M4OSA_CharStar.h" -//#define FILE_LOWER_CASE //defined to support limitaion of lower case file system in sdcard. /** ************************************************************************ * @brief This function opens the provided URL and returns its context. @@ -86,9 +85,6 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, FILE* pFileHandler = M4OSA_NULL; M4OSA_FileContext *pFileContext = M4OSA_NULL; -#ifdef FILE_LOWER_CASE - M4OSA_Char *tmpLowerCaseUrl = M4OSA_NULL; -#endif #ifdef UTF_CONVERSION /*FB: to test the UTF16->UTF8 conversion into Video Artist*/ @@ -108,7 +104,6 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, printf("file open %s\n", tempConversionBuf); #endif /*UTF CONVERSION*/ -///*tmpLSA*/M4OSA_TRACE1_2("### M4OSA_fileCommonOpen %s 0x%X", pUrl, fileModeAccess); M4OSA_TRACE3_4("M4OSA_fileCommonOpen\t\tM4OSA_UInt16 %d\tM4OSA_Context* 0x%x\t" "M4OSA_Char* %s\tfileModeAccess %d", core_id, pContext, pUrl, fileModeAccess); @@ -139,15 +134,6 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, M4OSA_DEBUG_IF1((M4OSA_FILE_WRITER == core_id) && !(fileModeAccess & M4OSA_kFileWrite), M4ERR_FILE_BAD_MODE_ACCESS, "M4OSA_fileCommonOpen: M4OSA_kFileWrite"); -#ifdef FILE_LOWER_CASE - tmpLowerCaseUrl = (M4OSA_Char*)M4OSA_32bitAlignedMalloc(strlen(pUrl) +1, 0, "conversion buf"); - for(i=0; i<strlen(pUrl); i++) - { - tmpLowerCaseUrl[i] = M4OSA_chrToLower(pUrl[i]); - } - tmpLowerCaseUrl[i] = '\0'; //null terminate -#endif - /* Create flag necessary for opening file */ if ((fileModeAccess & M4OSA_kFileRead) && (fileModeAccess & M4OSA_kFileWrite)&&(fileModeAccess & M4OSA_kFileCreate)) @@ -189,12 +175,7 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, /*Free the temporary decoded buffer*/ free(tempConversionBuf); #else /* UTF_CONVERSION */ -#ifdef FILE_LOWER_CASE - pFileHandler = fopen((const char *)tmpLowerCaseUrl, (const char *)mode); - free(tmpLowerCaseUrl); -#else pFileHandler = fopen((const char *)pUrl, (const char *)mode); -#endif #endif /* UTF_CONVERSION */ if (M4OSA_NULL == pFileHandler) @@ -326,7 +307,6 @@ M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, M4OSA_Context* pContext, pFileContext->file_size = iSize; *pContext = pFileContext; -// /*tmpLSA*/M4OSA_TRACE1_1("### M4OSA_fileCommonOpen pFileContext 0x%X", pFileContext); return M4NO_ERROR; } diff --git a/libvideoeditor/osal/src/M4OSA_Thread.c b/libvideoeditor/osal/src/M4OSA_Thread.c index aa7666c..793c0e4 100755 --- a/libvideoeditor/osal/src/M4OSA_Thread.c +++ b/libvideoeditor/osal/src/M4OSA_Thread.c @@ -56,10 +56,6 @@ void* M4OSA_threadSyncForEverDo(void *context) M4OSA_mutexLock(threadContext->stateMutex, M4OSA_WAIT_FOREVER); - /*if(threadContext->startCallBack != M4OSA_NULL) - { - threadContext->startCallBack(threadContext, userData); - }*/ threadContext->state = M4OSA_kThreadRunning; @@ -156,11 +152,6 @@ M4OSA_ERR M4OSA_threadSyncOpen(M4OSA_Context* context, threadContext->name = M4OSA_NULL; threadContext->threadID = 0; threadContext->coreID = M4OSA_THREAD; -/* - threadContext->userData = M4OSA_NULL; - threadContext->stopCallBack = M4OSA_NULL; - threadContext->startCallBack = M4OSA_NULL; -*/ threadContext->state = M4OSA_kThreadOpened; threadContext->priority = M4OSA_kThreadNormalPriority ; @@ -256,29 +247,6 @@ M4OSA_ERR M4OSA_threadSyncStart(M4OSA_Context context, { if ( 0 == pthread_attr_setschedpolicy( &attribute, SCHED_OTHER ) ) { -#if 0 - min = sched_get_priority_min( SCHED_OTHER ); - max = sched_get_priority_max( SCHED_OTHER ); - - switch(threadContext->priority) - { - case M4OSA_kThreadLowestPriority: - priority = min; - break; - case M4OSA_kThreadLowPriority: - priority = min + ( max - min ) / 4; - break; - case M4OSA_kThreadNormalPriority: - priority = min + ( max - min ) / 2; - break; - case M4OSA_kThreadHighPriority: - priority = max - ( max - min ) / 4; - break; - case M4OSA_kThreadHighestPriority: - priority = max; - break; - } -#else /* Tentative patches to handle priorities in a better way : */ /* Use Android's predefined priorities (range +19..-20) *rather than Linux ones (0..99)*/ @@ -313,7 +281,6 @@ M4OSA_ERR M4OSA_threadSyncStart(M4OSA_Context context, priority = ANDROID_PRIORITY_URGENT_AUDIO; break; } -#endif sched.sched_priority = priority; if ( 0 == pthread_attr_setschedparam( &attribute, &sched ) ) @@ -546,48 +513,6 @@ M4OSA_ERR M4OSA_threadSleep(M4OSA_UInt32 time) return M4NO_ERROR; } - - - -#if(M4OSA_OPTIONID_THREAD_STARTED == M4OSA_TRUE) - -/*M4OSA_ERR M4OSA_SetThreadSyncStarted(M4OSA_Context context, - M4OSA_DataOption optionValue) -{ - M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context ; - - M4OSA_TRACE2_2("M4OSA_SetThreadSyncStarted\t\tM4OSA_Context 0x%x\t" - "M4OSA_DataOption 0x%x", context, optionValue); - - threadContext->startCallBack = (M4OSA_ThreadCallBack)optionValue; - - return M4NO_ERROR; -}*/ - -#endif /*M4OSA_OPTIONID_THREAD_STARTED*/ - - - - -#if(M4OSA_OPTIONID_THREAD_STOPPED == M4OSA_TRUE) - -/*M4OSA_ERR M4OSA_SetThreadSyncStopped(M4OSA_Context context, - M4OSA_DataOption optionValue) -{ - M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context; - - M4OSA_TRACE2_2("M4OSA_SetThreadSyncStopped\t\tM4OSA_Context 0x%x\t" - "M4OSA_DataOption 0x%x", context, optionValue); - - threadContext->stopCallBack = (M4OSA_ThreadCallBack)optionValue; - - return M4NO_ERROR; -}*/ - -#endif /*M4OSA_OPTIONID_THREAD_STOPPED*/ - - - #if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE) M4OSA_ERR M4OSA_SetThreadSyncPriority(M4OSA_Context context, @@ -673,29 +598,6 @@ M4OSA_ERR M4OSA_SetThreadSyncStackSize(M4OSA_Context context, #endif /*M4OSA_OPTIONID_THREAD_STACK_SIZE*/ - - -#if(M4OSA_OPTIONID_THREAD_USER_DATA == M4OSA_TRUE) - -/*M4OSA_ERR M4OSA_SetThreadSyncUserData(M4OSA_Context context, - M4OSA_DataOption optionValue) -{ - M4OSA_ThreadContext* threadContext = (M4OSA_ThreadContext*)context; - - M4OSA_TRACE2_2("M4OSA_SetThreadSyncUserData\t\tM4OSA_Context 0x%x\t" - "M4OSA_DataOption 0x%x", context, optionValue); - - threadContext->userData = (M4OSA_Void*)optionValue; - - return M4NO_ERROR; -}*/ - -#endif /*M4OSA_OPTIONID_THREAD_USER_DATA*/ - - - - - /** ************************************************************************ * @brief This method asks the core OSAL-Thread component to set the value @@ -756,32 +658,6 @@ M4OSA_ERR M4OSA_threadSyncSetOption(M4OSA_Context context, switch(optionID) { -#if(M4OSA_OPTIONID_THREAD_STARTED == M4OSA_TRUE) - /*case M4OSA_ThreadStarted: - { - err_code = M4OSA_SetThreadSyncStarted(context, optionValue); - - break; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_STARTED*/ - -#if(M4OSA_OPTIONID_THREAD_STOPPED == M4OSA_TRUE) - /*case M4OSA_ThreadStopped: - { - err_code = M4OSA_SetThreadSyncStopped(context, optionValue); - - break; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_STOPPED*/ - -#if(M4OSA_OPTIONID_THREAD_USER_DATA == M4OSA_TRUE) - /*case M4OSA_ThreadUserData: - { - err_code = M4OSA_SetThreadSyncUserData(context, optionValue); - - break; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_USER_DATA*/ #if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE) case M4OSA_ThreadPriority: @@ -876,38 +752,6 @@ M4OSA_ERR M4OSA_threadSyncGetOption(M4OSA_Context context, switch(optionID) { -#if(M4OSA_OPTIONID_THREAD_STARTED == M4OSA_TRUE) - /*case M4OSA_ThreadStarted: - { - M4OSA_ThreadCallBack* startCallBack = (M4OSA_ThreadCallBack*)optionValue; - - *startCallBack = threadContext->startCallBack; - - return M4NO_ERROR; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_STARTED*/ - -#if(M4OSA_OPTIONID_THREAD_STOPPED == M4OSA_TRUE) - /*case M4OSA_ThreadStopped: - { - M4OSA_ThreadCallBack* stopCallBack = (M4OSA_ThreadCallBack*)optionValue; - - *stopCallBack = threadContext->stopCallBack; - - return M4NO_ERROR; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_STOPPED*/ - -#if(M4OSA_OPTIONID_THREAD_USER_DATA == M4OSA_TRUE) - /*case M4OSA_ThreadUserData: - { - M4OSA_Void** userData = (M4OSA_Void**)optionValue; - - *userData = threadContext->userData; - - return M4NO_ERROR; - }*/ -#endif /*M4OSA_OPTIONID_THREAD_USER_DATA*/ #if(M4OSA_OPTIONID_THREAD_PRIORITY == M4OSA_TRUE) case M4OSA_ThreadPriority: diff --git a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c b/libvideoeditor/osal/src/M4PSW_MemoryInterface.c index a069b9b..6c33fc1 100755 --- a/libvideoeditor/osal/src/M4PSW_MemoryInterface.c +++ b/libvideoeditor/osal/src/M4PSW_MemoryInterface.c @@ -68,60 +68,5 @@ M4OSA_MemAddr32 M4OSA_32bitAlignedMalloc(M4OSA_UInt32 size, return Address; } -/** - ************************************************************************ - * @fn M4OSA_MemAddr32 M4OSA_malloc(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_malloc(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; -} - - -/** - ************************************************************************ - * @fn M4OSA_Void M4OSA_free(M4OSA_MemAddr32 address) - * @brief this function free the provided memory block - * @note As in stlib.h, this function does nothing if address is NULL. - * @param address (IN): address of the block to free - * @return none - ************************************************************************ -*/ - -M4OSA_Void M4OSA_free (M4OSA_MemAddr32 address) -{ - free(address); -} #endif diff --git a/libvideoeditor/vss/inc/M4xVSS_Internal.h b/libvideoeditor/vss/inc/M4xVSS_Internal.h index 9bed7b7..0f99632 100755 --- a/libvideoeditor/vss/inc/M4xVSS_Internal.h +++ b/libvideoeditor/vss/inc/M4xVSS_Internal.h @@ -335,9 +335,6 @@ typedef struct { M4OSA_Bool bAudioMono; M4VIDEOEDITING_Bitrate OutputVideoBitrate; M4VIDEOEDITING_Bitrate OutputAudioBitrate; -#ifdef TIMESCALE_BUG - M4OSA_UInt32 OutputVideoTimescale; -#endif M4OSA_Bool isBGM; /**< This boolean is used to know if the output file is already created or not */ M4OSA_Bool isCreated; @@ -389,17 +386,6 @@ typedef M4xVSS_SlideTransitionSettings M4xVSS_internal_SlideTransitionSetting * a JPEG by chunk mode. ****************************************************************************** */ -#if 0 -typedef struct { - M4OSA_FileReadPointer* m_pFileReadPtr; - M4OSA_Context m_pJPEGFileIn; - M4OSA_Void* m_pFileIn; - M4SPS_Stream m_inputStream; - M4OSA_UInt32 m_total_read; - M4OSA_UInt32 m_fileSize; - -} M4xVSS_internalJpegChunkMode; -#endif /** ****************************************************************************** diff --git a/libvideoeditor/vss/mcs/inc/M4MCS_API.h b/libvideoeditor/vss/mcs/inc/M4MCS_API.h index 16c4fd9..2592fb4 100755 --- a/libvideoeditor/vss/mcs/inc/M4MCS_API.h +++ b/libvideoeditor/vss/mcs/inc/M4MCS_API.h @@ -658,113 +658,6 @@ M4OSA_ERR M4MCS_registerExternalAudioEncoder(M4MCS_Context pContext, M4ENCODER_AudioGlobalInterface *pEncGlobalInterface); -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_getExifInfo(M4MCS_Context pContext); - * @brief Retrieve the EXIF tags informations from a Still picture - * @note This function will allocate and fill a Exif tag struct - * exifTags structure must be allocated/deallocated by the user - * exifTags members will point to internal SPE information, user should not try - * to modify or deallocate them - * @param pContext (IN) MCS context - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: pContext is M4OSA_NULL - ****************************************************************************** - */ -M4OSA_ERR M4MCS_getExifInfo(M4MCS_Context pContext, M4MCS_ExifInfos* exifTags); - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerAudioEncoderExtended(M4MCS_Context pContext, - * M4ENCODER_AudioFormat encoderType, - * M4ENCODER_AudioGlobalInterface *pEncoderInterface, - * M4OSA_Void* pUserData); - * @brief Registers an external Audio Encoder - * @note This is much different from the external audio encoder to cope up with specific - * requirement of OMX codec implementation. - * @param pContext (IN) MCS context - * @param encoderType (IN) Type of encoder - * @param pEncoderInterface (IN) Encoder interface to OMX shell function - * @param pUserData (IN) Pointer on a user data to give to external encoder - * (OMX Core Context) - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerAudioEncoderExtended(M4MCS_Context pContext, - M4ENCODER_AudioFormat encoderType, - M4ENCODER_AudioGlobalInterface *pEncoderInterface, - M4OSA_Void* pUserData); - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerVideoDecoderExtended(M4MCS_Context context, - M4VD_VideoType decoderType, - M4DECODER_VideoInterface *pDecoderInterface, - M4OSA_Void* pUserData) - * @brief Registers an external Video decoder - * @note This is much different from the external video decoder to cope up with specific - * requirement of OMX codec implementation. - * @param pContext (IN) MCS context - * @param decoderType (IN) Type of decoder (MPEG4 ...) - * @param pVidDecoderInterface (IN) Decoder interface of type 'M4DECODER_VideoInterface' - * @param pUserData (IN) Pointer on a user data to give to external decoder - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerVideoDecoderExtended(M4MCS_Context context, - M4VD_VideoType decoderType, - M4OSA_Context pVidDecoderInterface, - M4OSA_Void* pUserData); - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerVideoEncoderExtended() - * @brief Registers an external Video encoder - * @note This is much different from the external video encoder to cope up with specific - * requirement of OMX codec implementation. - So we use M4ENCODER_GlobalInterface instead of M4VE_Interface. - * @param pContext (IN) MCS context - * @param encoderType (IN) Type of encoder (MPEG4 ...) - * @param pEncoderInterface (IN) Encoder interface of type 'M4ENCODER_VideoInterface' - * @param pUserData (IN) Pointer on a user data to give to external encoder - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerVideoEncoderExtended(M4MCS_Context pContext, - M4VE_EncoderType encoderType, - M4OSA_Context pEncoderInterface, - M4OSA_Void* pUserData); - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerAudioDecoderExtended(M4MCS_Context pContext, - M4AD_Type decoderType, - M4AD_Interface *pDecoderInterface, - M4OSA_Void* pUserData); - * @brief Registers an external Audio Decoder - * @note This is much different from the external audio decoder to cope up with specific - * requirement of OMX codec implementation. - * @param pContext (IN) MCS context - * @param decoderType (IN) Type of decoder - * @param pDecoderInterface (IN) Decoder interface to OMX shell function - * @param pUserData (IN) Pointer on a user data to give to external decoder - * (OMX Core Context) - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerAudioDecoderExtended(M4MCS_Context pContext, - M4AD_Type decoderType, - M4AD_Interface *pDecoderInterface, - M4OSA_Void* pUserData); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libvideoeditor/vss/mcs/inc/M4MCS_InternalFunctions.h b/libvideoeditor/vss/mcs/inc/M4MCS_InternalFunctions.h index 422e40d..597a591 100755 --- a/libvideoeditor/vss/mcs/inc/M4MCS_InternalFunctions.h +++ b/libvideoeditor/vss/mcs/inc/M4MCS_InternalFunctions.h @@ -337,31 +337,6 @@ M4OSA_ERR M4MCS_editAudioEffectFct_FadeOut( M4OSA_Void *pFunctionContext, M4OSA_UInt32 uiPCMsize, M4MCS_ExternalProgress *pProgress); -#ifdef TIMESCALE_BUG -/** - ************************************************************************ - * M4OSA_ERR M4MCS_intParseVideoDSI( ) - * @brief : This function parses video DSI and changes writer vop time increment resolution - * @note : It also calculates the number of bits on which the vop_time_increment is coded - * in the input stream - * @param - * @return - ************************************************************************ - */ -M4OSA_ERR M4MCS_intParseVideoDSI(M4MCS_InternalContext* pC); - -/** - ************************************************************************ - * M4OSA_ERR M4MCS_intChangeAUVideoTimescale( ) - * @brief - * @note - * @param pC (IN/OUT) Internal edit context - * @return - ************************************************************************ - */ -M4OSA_ERR M4MCS_intChangeAUVideoTimescale(M4MCS_InternalContext* pC); -#endif /* TIMESCALE_BUG */ - #ifdef __cplusplus } #endif diff --git a/libvideoeditor/vss/mcs/inc/M4MCS_InternalTypes.h b/libvideoeditor/vss/mcs/inc/M4MCS_InternalTypes.h index 68d2448..ca63cc0 100755 --- a/libvideoeditor/vss/mcs/inc/M4MCS_InternalTypes.h +++ b/libvideoeditor/vss/mcs/inc/M4MCS_InternalTypes.h @@ -127,28 +127,6 @@ typedef enum M4MCS_kStreamState_FINISHED = 2 /**< The stream has finished encoding */ } M4MCS_StreamState; -#ifdef TIMESCALE_BUG -/** - ****************************************************************************** - * enum M4MCS_VolParse - * @brief VOL parsing results needed for VOP parsing - ****************************************************************************** - */ -typedef struct -{ - M4OSA_UInt8 video_object_layer_shape; - M4OSA_UInt8 sprite_enable; - M4OSA_UInt8 reduced_resolution_vop_enable; - M4OSA_UInt8 scalability; - M4OSA_UInt8 enhancement_type; - M4OSA_UInt8 complexity_estimation_disable; - M4OSA_UInt8 interlaced; - M4OSA_UInt8 sprite_warping_points; - M4OSA_UInt8 sprite_brightness_change; - M4OSA_UInt8 quant_precision; - -} M4MCS_VolParse; -#endif /** ****************************************************************************** @@ -437,13 +415,6 @@ typedef struct M4OSA_UInt32 uiAudioBitrate; /**< Targeted audio bitrate in bps */ M4OSA_UInt32 uiVideoBitrate; /**< Targeted video bitrate in bps */ -#ifdef TIMESCALE_BUG - M4OSA_UInt32 uiVideoTimescale; /**< Targeted timescale without decode/encode process */ - M4OSA_UInt32 uiTimescaleLength; /**< Length of the VOP time increment in bits */ - M4OSA_UInt32 uiOrigVideoTimescale; /**< Original timescale */ - M4OSA_UInt32 uiOrigTimescaleLength;/**< Original length of the VOP time increment in bits*/ - M4MCS_VolParse volParsing; /**< VOL parsing results needed for VOP parsing */ -#endif M4OSA_UInt8 uiProgress; /**< Progress information saved at each step to be able to return it in case of pause */ diff --git a/libvideoeditor/vss/mcs/src/Android.mk b/libvideoeditor/vss/mcs/src/Android.mk index 25438a8..d1d48bb 100755 --- a/libvideoeditor/vss/mcs/src/Android.mk +++ b/libvideoeditor/vss/mcs/src/Android.mk @@ -28,7 +28,6 @@ LOCAL_MODULE:= libvideoeditor_mcs LOCAL_SRC_FILES:= \ M4MCS_API.c \ M4MCS_AudioEffects.c \ - M4MCS_BitstreamParser.c \ M4MCS_Codecs.c \ M4MCS_MediaAndCodecSubscription.c \ M4MCS_VideoPreProcessing.c diff --git a/libvideoeditor/vss/mcs/src/M4MCS_API.c b/libvideoeditor/vss/mcs/src/M4MCS_API.c index 819ea68..91e3b96 100755 --- a/libvideoeditor/vss/mcs/src/M4MCS_API.c +++ b/libvideoeditor/vss/mcs/src/M4MCS_API.c @@ -2251,18 +2251,6 @@ M4OSA_ERR M4MCS_init( M4MCS_Context *pContext, pC->uiVideoBitrate = M4VIDEOEDITING_kUndefinedBitrate; /**< No bitrate set yet */ -#ifdef TIMESCALE_BUG - - /* By default, timescale is not modified; if this value is not 0, timescale is - * modified without decode/encode process - */ - pC->uiVideoTimescale = 0; - pC->uiTimescaleLength = 0; - pC->uiOrigVideoTimescale = 0; - pC->uiOrigTimescaleLength = 0; - -#endif - pC->WriterVideoStream.streamType = M4SYS_kVideoUnknown; pC->WriterVideoStreamInfo.Header.pBuf = M4OSA_NULL; pC->WriterAudioStream.streamType = M4SYS_kAudioUnknown; @@ -3678,19 +3666,6 @@ M4OSA_ERR M4MCS_setOutputParams( M4MCS_Context pContext, /* Set video parameters */ if( pC->novideo == M4OSA_FALSE ) { -#ifdef TIMESCALE_BUG - /* Check if we are in timescale modification */ - - if( pParams->OutputVideoTimescale != 0 ) - { - pC->uiVideoTimescale = pParams->OutputVideoTimescale; - - /* If timescale modification mode is on, we force NULL video encoding ... */ - pParams->OutputVideoFormat = M4VIDEOEDITING_kNullVideo; - } - -#endif - /** * Check Video Format correctness */ @@ -6770,51 +6745,6 @@ static M4OSA_ERR M4MCS_intPrepareWriter( M4MCS_InternalContext *pC ) } else if( M4ENCODER_kNULL == pC->EncodingVideoFormat ) { -#ifdef TIMESCALE_BUG - /* if we are in "timescale mode", we need to know on how many bits the v - op_time_increment is coded and to change the DSI */ - - if( pC->uiVideoTimescale == 0 ) - { - /* If we copy the stream from the input, we copy its DSI */ - pC->WriterVideoStreamInfo.Header.Size = pC->pReaderVideoStream-> - m_basicProperties.m_decoderSpecificInfoSize; - pC->WriterVideoStreamInfo.Header.pBuf = - (M4OSA_MemAddr8)pC->pReaderVideoStream-> - m_basicProperties.m_pDecoderSpecificInfo; - } - else - { - /* Allocate a new DSI */ - pC->WriterVideoStreamInfo.Header.Size = pC->pReaderVideoStream-> - m_basicProperties.m_decoderSpecificInfoSize; - pC->WriterVideoStreamInfo.Header.pBuf = - (M4OSA_Void - *)M4OSA_32bitAlignedMalloc(pC->WriterVideoStreamInfo.Header.Size, - M4MCS, - (M4OSA_Char - *) - "New decoder specific info for timescale modification"); - - if( pC->WriterVideoStreamInfo.Header.pBuf == M4OSA_NULL ) - { - M4OSA_TRACE1_0("M4MCS_intPrepareWriter: Allocation error\ - pC->WriterVideoStreamInfo.Header.pBuf"); - return M4ERR_ALLOC; - } - - /* Copy Reading DSI to new DSI */ - memcpy((void *)pC->WriterVideoStreamInfo.Header.pBuf, - (void *)pC->pReaderVideoStream-> - m_basicProperties.m_pDecoderSpecificInfo, - pC->WriterVideoStreamInfo.Header.Size); - - /* Call a function to change DSI and to get the nb of bits on which the - vop_time_increment is coded */ - err = M4MCS_intParseVideoDSI(pC); - } - -#else /* If we copy the stream from the input, we copy its DSI */ pC->WriterVideoStreamInfo.Header.Size = pC->pReaderVideoStream-> @@ -6823,8 +6753,6 @@ static M4OSA_ERR M4MCS_intPrepareWriter( M4MCS_InternalContext *pC ) (M4OSA_MemAddr8)pC->pReaderVideoStream-> m_basicProperties.m_pDecoderSpecificInfo; -#endif - } /* otherwise (MPEG4), the DSI will be recovered from the encoder later on. */ @@ -8999,16 +8927,6 @@ static M4OSA_ERR M4MCS_intVideoNullEncoding( M4MCS_InternalContext *pC ) pC->bLastDecodedFrameCTS = M4OSA_TRUE; - /* - CRLV6775 -H.264 Trimming */ - - /* commented,this part is done further on one of the temporary video AU (video AU1 or video AU2)*/ -#if 0 - /** - * Read the next video AU in the input file */ - - err = pC->m_pReaderDataIt->m_pFctGetNextAu(pC->pReaderContext, - (M4_StreamHandler *)pC->pReaderVideoStream, &pC->ReaderVideoAU); -#endif /* Find the next AU duration to obtain a more precise video end cut*/ /** @@ -9212,33 +9130,6 @@ static M4OSA_ERR M4MCS_intVideoNullEncoding( M4MCS_InternalContext *pC ) err); return err; } -#ifdef TIMESCALE_BUG - /* If we are in timescale modification mode or classic copy mode */ - - if( pC->uiVideoTimescale != 0 ) - { - /** - * Copy video data from reader AU to writer AU */ - //memcpy((M4OSA_MemAddr8)pC->WriterVideoAU.dataAddress, - //(M4OSA_MemAddr8)pC->ReaderVideoAU.m_dataAddress, pC->ReaderVideoAU.m_size); - pC->WriterVideoAU.size = pC->ReaderVideoAU.m_size; - - /* Call internal function to change AU timescale */ - err = M4MCS_intChangeAUVideoTimescale(pC); - - /** - * Convert CTS unit from milliseconds to timescale */ - pC->WriterVideoAU.CTS = - (M4OSA_Time)((( pC->ReaderVideoAU.m_CTS - pC->dViDecStartingCts) - * (pC->WriterVideoStream.timeScale / 1000.0))); - pC->WriterVideoAU.nbFrag = 0; - pC->WriterVideoAU.attribute = pC->ReaderVideoAU.m_attribute; - } - else - -#endif - - { /** * Copy video data from reader AU to writer AU */ M4OSA_TRACE3_1( @@ -9317,7 +9208,6 @@ static M4OSA_ERR M4MCS_intVideoNullEncoding( M4MCS_InternalContext *pC ) M4OSA_TRACE3_1("M4MCS_intVideoNullEncoding(): video AU: CTS=%d ms", pC->WriterVideoAU.CTS); - } /** * Write it to the output file */ @@ -11205,415 +11095,3 @@ M4OSA_ERR M4MCS_registerExternalAudioEncoder( M4MCS_Context pContext, return M4NO_ERROR; } -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_getExifInfo(M4MCS_Context pContext); - * @brief Retrieve the EXIF tags informations from a Still picture - * @note This function will allocate and fill a Exif tag struct - * exifTags structure must be allocated/deallocated by the user - * exifTags members will point to internal SPE information, user should not try - * to modify or deallocate them - * @param pContext (IN) MCS context - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: pContext is M4OSA_NULL - ****************************************************************************** - */ -M4OSA_ERR M4MCS_getExifInfo( M4MCS_Context pContext, M4MCS_ExifInfos *exifTags ) -{ - M4MCS_InternalContext *pC = (M4MCS_InternalContext *)(pContext); - M4OSA_ERR err; - - M4OSA_TRACE2_1("M4MCS_getExifInfo called with pContext=0x%x", pContext); - - /** - * Check input parameters */ - M4OSA_DEBUG_IF2((M4OSA_NULL == pContext), M4ERR_PARAMETER, - "M4MCS_getExifInfo: pContext is M4OSA_NULL"); - -#ifdef M4MCS_SUPPORT_STILL_PICTURE - - if( pC->m_bIsStillPicture ) - { - /** - * Call the corresponding still picture MCS function*/ - return M4MCS_stillPicGetExifInfo(pC, exifTags); - } - -#endif /*M4MCS_SUPPORT_STILL_PICTURE*/ - - return M4ERR_NOT_IMPLEMENTED; -} - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerVideoDecoderExtended(M4MCS_Context context, -M4DECODER_VideoType decoderType, -M4DECODER_VideoInterface *pDecoderInterface, -M4OSA_Void* pUserData) - * @brief Registers an external Video decoder - * @note This is much different from the external video decoder to cope up with specific - * requirement of OMX codec implementation. -So we use M4DECODER_VideoInterface instead of M4VD_Interface. - * @param pContext (IN) MCS context - * @param decoderType (IN) Type of decoder (MPEG4 ...) - * @param pVidDecoderInterface (IN) Decoder interface of type 'M4DECODER_VideoInterface' - * @param pUserData (IN) Pointer on a user data to give to external decoder - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerVideoDecoderExtended( M4MCS_Context context, - M4VD_VideoType decoderType, - M4OSA_Context pVidDecoderInterface, - M4OSA_Void *pUserData ) -{ - M4OSA_ERR err = M4NO_ERROR; - M4DECODER_VideoType nativeType; - M4DECODER_EXTERNAL_UserDataType shellUserData; - M4DECODER_VideoInterface *pDecoderInterface = - (M4DECODER_VideoInterface *)pVidDecoderInterface; - M4MCS_InternalContext *pC = (M4MCS_InternalContext *)context; - M4OSA_Bool bResetCurrentVideoDecoder = M4OSA_FALSE; - M4_StreamType mediaType = M4DA_StreamTypeUnknown; - - M4OSA_TRACE3_1( - "M4MCS_registerVideoDecoderExtended invoked with context = 0x%x", - context); - - switch( decoderType ) - { - case M4VD_kMpeg4VideoDec: - case M4VD_kH263VideoDec: - nativeType = M4DECODER_kVideoTypeMPEG4; - mediaType = M4DA_StreamTypeVideoMpeg4; - break; - - case M4VD_kH264VideoDec: - nativeType = M4DECODER_kVideoTypeAVC; - mediaType = M4DA_StreamTypeVideoMpeg4Avc; - break; - - default: - M4OSA_TRACE1_1( - "M4MCS_registerVideoDecoderExtended: unknown decoderType %d", - decoderType); - return M4ERR_PARAMETER; - } - - if( M4OSA_NULL != pC->m_pVideoDecoder ) - { - M4OSA_TRACE3_0( - "M4MCS_registerVideoDecoderExtended: pC->m_pVideoDecoder already set to \ - previous registered dec shell"); - - if( ( ( ( pC->pReaderVideoStream->m_basicProperties.m_streamType - == M4DA_StreamTypeVideoH263) - || (pC->pReaderVideoStream->m_basicProperties.m_streamType - == M4DA_StreamTypeVideoMpeg4)) - && (mediaType == M4DA_StreamTypeVideoMpeg4)) - || (( pC->pReaderVideoStream->m_basicProperties.m_streamType - == M4DA_StreamTypeVideoMpeg4Avc) - && (mediaType == M4DA_StreamTypeVideoMpeg4Avc)) ) - bResetCurrentVideoDecoder = M4OSA_TRUE; - } - - err = M4MCS_registerVideoDecoder(context, nativeType, pDecoderInterface); - - /** Provide the application user data back to the interface functions. ** - * For now we donot provide 'M4DECODER_EXTERNAL_UserDataType' **/ - ( (M4MCS_InternalContext - *)context)->m_pVideoDecoderUserDataTable[nativeType] = pUserData; - - if( ( M4NO_ERROR == err) && (M4OSA_TRUE == bResetCurrentVideoDecoder) ) - { - err = M4MCS_setCurrentVideoDecoder(context, mediaType); - M4OSA_TRACE3_1( - "M4MCS_registerVideoDecoderExtended: M4MCS_setCurrentVideoDecoder returned 0x%x", - err); - } - M4OSA_TRACE1_1( - "M4MCS_registerVideoDecoderExtended returning with error = 0x%x", err); - return err; -} - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerVideoEncoderExtended() - * @brief Registers an external Video encoder - * @note This is much different from the external video encoder to cope up with specific - * requirement of OMX codec implementation. -So we use M4ENCODER_GlobalInterface instead of M4VE_Interface. - * @param pContext (IN) MCS context - * @param encoderType (IN) Type of encoder (MPEG4 ...) - * @param pEncoderInterface (IN) Encoder interface of type 'M4ENCODER_VideoInterface' - * @param pUserData (IN) Pointer on a user data to give to external encoder - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerVideoEncoderExtended( M4MCS_Context pContext, - M4VE_EncoderType encoderType, - M4OSA_Context pEncoderInterface, - M4OSA_Void *pUserData ) -{ - M4OSA_ERR err = M4NO_ERROR; - M4ENCODER_Format nativeType; - M4ENCODER_GlobalInterface *pEncShellInterface = - (M4ENCODER_GlobalInterface *)pEncoderInterface; - M4MCS_InternalContext *pC = (M4MCS_InternalContext *)pContext; - M4OSA_Bool bResetCurrentVideoEncoder = M4OSA_FALSE; - M4VIDEOEDITING_VideoFormat mediaType = M4VIDEOEDITING_kNoneVideo; - - M4OSA_TRACE3_1( - "M4MCS_registerVideoEncoderExtended invoked with context = 0x%x", - pContext); - - switch( encoderType ) - { - case M4VE_kMpeg4VideoEnc: - nativeType = M4ENCODER_kMPEG4; - mediaType = M4VIDEOEDITING_kMPEG4; - break; - - case M4VE_kH263VideoEnc: - nativeType = M4ENCODER_kH263; - mediaType = M4VIDEOEDITING_kH263; - break; - - case M4VE_kH264VideoEnc: - nativeType = M4ENCODER_kH264; - mediaType = M4VIDEOEDITING_kH264; - break; - - default: - M4OSA_TRACE1_1( - "M4MCS_registerVideoEncoderExtended: unknown encoderType %d", - encoderType); - return M4ERR_PARAMETER; - } - - if( M4OSA_NULL != pC->pVideoEncoderGlobalFcts ) - { - M4OSA_TRACE3_0( - "M4MCS_registerVideoEncoderExtended:\ - pC->pVideoEncoderGlobalFcts already set to previous registered Enc shell"); - - if( pC->EncodingVideoFormat == nativeType ) - bResetCurrentVideoEncoder = M4OSA_TRUE; - } - - err = M4MCS_registerVideoEncoder(pContext, nativeType, pEncShellInterface); - - ( (M4MCS_InternalContext - *)pContext)->pVideoEncoderExternalAPITable[nativeType] - = pEncoderInterface; - ( (M4MCS_InternalContext - *)pContext)->pVideoEncoderUserDataTable[nativeType] = pUserData; - - if( ( M4NO_ERROR == err) && (M4OSA_TRUE == bResetCurrentVideoEncoder) ) - { - err = M4MCS_setCurrentVideoEncoder(pContext, mediaType); - M4OSA_TRACE3_1( - "M4MCS_registerVideoEncoderExtended: M4MCS_setCurrentVideoEncoder returned 0x%x", - err); - } - M4OSA_TRACE1_1( - "M4MCS_registerVideoEncoderExtended returning with error = 0x%x", err); - return err; -} - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerAudioEncoderExtended(M4MCS_Context pContext, -M4ENCODER_AudioFormat encoderType, -M4ENCODER_AudioGlobalInterface *pEncoderInterface, -M4OSA_Void* pUserData); - * @brief Registers an external Audio Encoder - * @note This is much different from the external audio encoder to cope up with specific - * requirement of OMX codec implementation. - * @param pContext (IN) MCS context - * @param encoderType (IN) Type of encoder - * @param pEncoderInterface (IN) Encoder interface to OMX shell function - * @param pUserData (IN) Pointer on a user data to give to external encoder - * (OMX Core Context) - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerAudioEncoderExtended( M4MCS_Context pContext, - M4ENCODER_AudioFormat encoderType, - M4ENCODER_AudioGlobalInterface *pEncoderInterface, - M4OSA_Void *pUserData ) -{ - M4OSA_ERR err = M4NO_ERROR; - M4MCS_InternalContext *pC = (M4MCS_InternalContext *)pContext; - M4OSA_Bool bResetCurrentAudioEncoder = M4OSA_FALSE; - M4VIDEOEDITING_AudioFormat mediaType = M4VIDEOEDITING_kNoneAudio; - - switch( encoderType ) - { - case M4ENCODER_kAMRNB: - mediaType = M4VIDEOEDITING_kAMR_NB; - break; - - case M4ENCODER_kAAC: - mediaType = M4VIDEOEDITING_kAAC; - break; - - case M4ENCODER_MP3: - mediaType = M4VIDEOEDITING_kMP3; - break; - - default: - M4OSA_TRACE1_1( - "M4MCS_registerAudioEncoderExtended: unknown encoderType %d", - encoderType); - return M4ERR_PARAMETER; - } - - if( M4OSA_NULL != pC->pAudioEncoderGlobalFcts ) - { - M4OSA_TRACE3_0( - "M4MCS_registerAudioEncoderExtended: pC->pAudioEncoderGlobalFcts already set to \ - previous registered Enc shell"); - - if( pC->AudioEncParams.Format == encoderType ) - bResetCurrentAudioEncoder = M4OSA_TRUE; - } - - err = M4MCS_registerAudioEncoder(pContext, encoderType, pEncoderInterface); - - if( M4NO_ERROR != err ) - { - M4OSA_TRACE1_1( - "M4MCS_registerAudioEncoderExtended: \ - M4MCS_registerAudioEncoder failed with error 0x%08X", - err); - free(pEncoderInterface); - return err; - } - - ( (M4MCS_InternalContext - *)pContext)->pAudioEncoderInterface[encoderType] = pEncoderInterface; - ( (M4MCS_InternalContext - *)pContext)->pAudioEncoderUserDataTable[encoderType] = pUserData; - - if( ( M4NO_ERROR == err) && (M4OSA_TRUE == bResetCurrentAudioEncoder) ) - { - err = M4MCS_setCurrentAudioEncoder(pContext, mediaType); - M4OSA_TRACE3_1( - "M4MCS_registerAudioEncoderExtended: M4MCS_setCurrentAudioEncoder returned 0x%x", - err); - } - return err; -} - -/** - ****************************************************************************** - * M4OSA_ERR M4MCS_registerAudioDecoderExtended(M4MCS_Context pContext, -M4AD_Type decoderType, -M4AD_Interface *pDecoderInterface, -M4OSA_Void* pUserData); - * @brief Registers an external Audio Decoder - * @note This is much different from the external audio decoder to cope up with specific - * requirement of OMX codec implementation. - * @param pContext (IN) MCS context - * @param decoderType (IN) Type of decoder - * @param pDecoderInterface (IN) Decoder interface to OMX shell function - * @param pUserData (IN) Pointer on a user data to give to external decoder - * (OMX Core Context) - * @return M4NO_ERROR: No error - * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL (debug only) - * @return M4ERR_STATE: MCS is not in an appropriate state for this function to be called - ****************************************************************************** - */ -M4OSA_ERR M4MCS_registerAudioDecoderExtended( M4MCS_Context pContext, - M4AD_Type decoderType, - M4AD_Interface *pDecoderInterface, - M4OSA_Void *pUserData ) -{ - M4OSA_ERR err = M4NO_ERROR; - M4MCS_InternalContext *pC = (M4MCS_InternalContext *)pContext; - M4OSA_Bool bResetCurrentAudioDecoder = M4OSA_FALSE; - M4_StreamType mediaType = M4DA_StreamTypeUnknown; - - switch( decoderType ) - { - case M4AD_kTypeAMRNB: - mediaType = M4DA_StreamTypeAudioAmrNarrowBand; - break; - - case M4AD_kTypeAAC: - mediaType = M4DA_StreamTypeAudioAac; - break; - - case M4AD_kTypeMP3: - mediaType = M4DA_StreamTypeAudioMp3; - break; - - default: - M4OSA_TRACE1_1( - "M4MCS_registerAudioDecoderExtended: unknown decoder type %d", - decoderType); - return M4ERR_PARAMETER; - } - - if( M4OSA_NULL != pC->m_pAudioDecoder ) - { - M4OSA_TRACE3_0( - "M4MCS_registerAudioDecoderExtended:\ - pC->m_pAudioDecoder already set to previous registered Dec shell"); - - if( pC->pReaderAudioStream->m_basicProperties.m_streamType - == mediaType ) - bResetCurrentAudioDecoder = M4OSA_TRUE; - - /* Audio decoder may be created for getting input Clip properties. - In that case, previous audio dec context needs to be destroyed* - * before registering new decoder shell */ - if( M4OSA_NULL != pC->pAudioDecCtxt ) - { - err = pC->m_pAudioDecoder->m_pFctDestroyAudioDec(pC->pAudioDecCtxt); - pC->pAudioDecCtxt = M4OSA_NULL; - - if( M4NO_ERROR != err ) - { - M4OSA_TRACE1_1( - "M4MCS_registerAudioDecoderExtended:\ - m_pAudioDecoder->m_pFctDestroyAudioDec returns 0x%x", - err); - } - } - } - - err = M4MCS_registerAudioDecoder(pContext, decoderType, pDecoderInterface); - - if( M4NO_ERROR != err ) - { - M4OSA_TRACE1_1( - "M4MCS_registerAudioDecoderExtended:\ - M4MCS_registerAudioDecoder failed with error 0x%08X", - err); - free(pDecoderInterface); - return err; - } - - ( (M4MCS_InternalContext - *)pContext)->m_pAudioDecoderItTable[decoderType] = pDecoderInterface; - ( (M4MCS_InternalContext - *)pContext)->m_pAudioDecoderUserDataTable[decoderType] = pUserData; - - ( (M4MCS_InternalContext *)pContext)->bExtOMXAudDecoder = M4OSA_TRUE; - - if( ( M4NO_ERROR == err) && (M4OSA_TRUE == bResetCurrentAudioDecoder) ) - { - err = M4MCS_setCurrentAudioDecoder(pContext, mediaType); - M4OSA_TRACE3_1( - "M4MCS_registerAudioDecoderExtended: M4MCS_setCurrentAudioDecoder returned 0x%x", - err); - } - return err; -} diff --git a/libvideoeditor/vss/src/M4ChannelCoverter.c b/libvideoeditor/vss/src/M4ChannelCoverter.c index 5d89820..eee62d8 100755 --- a/libvideoeditor/vss/src/M4ChannelCoverter.c +++ b/libvideoeditor/vss/src/M4ChannelCoverter.c @@ -44,7 +44,7 @@ void From2iToMono_16( const short *src, { short ii; long Temp; - for (ii = n; ii != 0; ii--){ + for (ii = n; ii != 0; ii--) { Temp = (long)*(src++); Temp += (long)*(src++); *(dst++) = (short)(Temp >>1); diff --git a/libvideoeditor/vss/src/M4PTO3GPP_API.c b/libvideoeditor/vss/src/M4PTO3GPP_API.c index c6cb3c2..e3fe84f 100755 --- a/libvideoeditor/vss/src/M4PTO3GPP_API.c +++ b/libvideoeditor/vss/src/M4PTO3GPP_API.c @@ -265,7 +265,7 @@ M4OSA_ERR M4PTO3GPP_Init( M4PTO3GPP_Context* pContext, * @return M4NO_ERROR: No error * @return M4ERR_PARAMETER: At least one parameter is M4OSA_NULL * @return M4ERR_STATE: M4PTO3GPP is not in an appropriate state for this function to be - called + called * @return M4ERR_ALLOC: There is no more available memory * @return ERR_PTO3GPP_INVALID_VIDEO_FRAME_SIZE_FOR_H263 The output video frame * size parameter is incompatible with H263 encoding @@ -317,7 +317,7 @@ M4OSA_ERR M4PTO3GPP_Open(M4PTO3GPP_Context pContext, M4PTO3GPP_Params* pParams) /** * Video Format */ - if( (M4VIDEOEDITING_kH263 != pParams->OutputVideoFormat) && + if ((M4VIDEOEDITING_kH263 != pParams->OutputVideoFormat) && (M4VIDEOEDITING_kMPEG4 != pParams->OutputVideoFormat) && (M4VIDEOEDITING_kMPEG4_EMP != pParams->OutputVideoFormat) && (M4VIDEOEDITING_kH264 != pParams->OutputVideoFormat)) @@ -328,7 +328,7 @@ M4OSA_ERR M4PTO3GPP_Open(M4PTO3GPP_Context pContext, M4PTO3GPP_Params* pParams) /** * Video Bitrate */ - if(!((M4VIDEOEDITING_k16_KBPS == pParams->OutputVideoBitrate) || + if (!((M4VIDEOEDITING_k16_KBPS == pParams->OutputVideoBitrate) || (M4VIDEOEDITING_k24_KBPS == pParams->OutputVideoBitrate) || (M4VIDEOEDITING_k32_KBPS == pParams->OutputVideoBitrate) || (M4VIDEOEDITING_k48_KBPS == pParams->OutputVideoBitrate) || diff --git a/libvideoeditor/vss/src/M4VD_EXTERNAL_BitstreamParser.c b/libvideoeditor/vss/src/M4VD_EXTERNAL_BitstreamParser.c index bdbf2ba..b2e8e6f 100755 --- a/libvideoeditor/vss/src/M4VD_EXTERNAL_BitstreamParser.c +++ b/libvideoeditor/vss/src/M4VD_EXTERNAL_BitstreamParser.c @@ -33,30 +33,6 @@ M4OSA_UInt32 M4VD_EXTERNAL_GetBitsFromMemory(M4VS_Bitstream_ctxt* parsingCtxt, M4OSA_UInt32 nb_bits) { -#if 0 - M4OSA_UInt32 code; - M4OSA_UInt32 i; - - code = 0; - for (i = 0; i < nb_bits; i++) - { - if (parsingCtxt->stream_index == 8) - { - memcpy( (void *)&(parsingCtxt->stream_byte), (void *)parsingCtxt->in, - sizeof(unsigned char)); - parsingCtxt->in++; - //fread(&stream_byte, sizeof(unsigned char),1,in); - parsingCtxt->stream_index = 0; - } - code = (code << 1); - code |= ((parsingCtxt->stream_byte & 0x80) >> 7); - - parsingCtxt->stream_byte = (parsingCtxt->stream_byte << 1); - parsingCtxt->stream_index++; - } - - return code; -#endif return(M4VD_Tools_GetBitsFromMemory(parsingCtxt,nb_bits)); } @@ -64,44 +40,6 @@ M4OSA_ERR M4VD_EXTERNAL_WriteBitsToMemory(M4OSA_UInt32 bitsToWrite, M4OSA_MemAddr32 dest_bits, M4OSA_UInt8 offset, M4OSA_UInt8 nb_bits) { -#if 0 - M4OSA_UInt8 i,j; - M4OSA_UInt32 temp_dest = 0, mask = 0, temp = 1; - M4OSA_UInt32 input = bitsToWrite; - - input = (input << (32 - nb_bits - offset)); - - /* Put destination buffer to 0 */ - for(j=0;j<3;j++) - { - for(i=0;i<8;i++) - { - if((j*8)+i >= offset && (j*8)+i < nb_bits + offset) - { - mask |= (temp << ((7*(j+1))-i+j)); - } - } - } - mask = ~mask; - *dest_bits &= mask; - - /* Parse input bits, and fill output buffer */ - for(j=0;j<3;j++) - { - for(i=0;i<8;i++) - { - if((j*8)+i >= offset && (j*8)+i < nb_bits + offset) - { - temp = ((input & (0x80000000 >> offset)) >> (31-offset)); - //*dest_bits |= (temp << (31 - i)); - *dest_bits |= (temp << ((7*(j+1))-i+j)); - input = (input << 1); - } - } - } - - return M4NO_ERROR; -#endif return (M4VD_Tools_WriteBitsToMemory( bitsToWrite,dest_bits, offset, nb_bits)); } diff --git a/libvideoeditor/vss/src/M4VD_EXTERNAL_Interface.c b/libvideoeditor/vss/src/M4VD_EXTERNAL_Interface.c index 21ed89d..8258eca 100755 --- a/libvideoeditor/vss/src/M4VD_EXTERNAL_Interface.c +++ b/libvideoeditor/vss/src/M4VD_EXTERNAL_Interface.c @@ -1072,35 +1072,6 @@ static M4OSA_ERR M4DECODER_EXTERNAL_AsynchronousRender(M4OSA_Context pVS_Context if(M4OSA_TRUE == pStreamContext->m_bDataRenderPending) { -#if 0 - if (!pStreamContext->m_bForceRender) - { - /* Targeted time is reached */ - if(pStreamContext->m_TargetRenderCts - pStreamContext->m_CurrentRenderCts < 1.0) - /* some +0.5 issues */ - { - M4OSA_TRACE2_0("M4DECODER_EXTERNAL_AsynchronousRender :\ - skip render because synchronisation"); - pStreamContext->m_uiRenderError = M4WAR_RENDER_FINISHED; - - M4ERR_EXIT(M4NO_ERROR); - } - - if ( (M4WAR_NO_MORE_AU == pStreamContext->m_uiDecodeError) - && (pStreamContext->m_CurrentDecodeCts \ - - pStreamContext->m_CurrentRenderCts < 1.0) ) - { - pStreamContext->m_uiRenderError = M4WAR_RENDER_FINISHED; - M4ERR_EXIT(M4NO_ERROR); - } - - if(pStreamContext->m_NbDecodedFrames == 0) - { - pStreamContext->m_uiRenderError = M4WAR_VIDEORENDERER_NO_NEW_FRAME; - M4ERR_EXIT(M4NO_ERROR); - } - } -#endif /* Render the frame */ pStreamContext->m_CurrentRenderCts = pStreamContext->m_CurrentDecodeCts; diff --git a/libvideoeditor/vss/src/M4VIFI_xVSS_RGB565toYUV420.c b/libvideoeditor/vss/src/M4VIFI_xVSS_RGB565toYUV420.c index 8f00d08..881da82 100755 --- a/libvideoeditor/vss/src/M4VIFI_xVSS_RGB565toYUV420.c +++ b/libvideoeditor/vss/src/M4VIFI_xVSS_RGB565toYUV420.c @@ -136,16 +136,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p u16_pix4 = *( (M4VIFI_UInt16 *) (pu8_rgbn + u32_stride_rgb + CST_RGB_16_SIZE)); /* Unpack RGB565 to 8bit R, G, B */ -#if 0 - /* (x,y) */ - GET_RGB565(i32_r00,i32_g00,i32_b00,u16_pix1); - /* (x+1,y) */ - GET_RGB565(i32_r10,i32_g10,i32_b10,u16_pix2); - /* (x,y+1) */ - GET_RGB565(i32_r01,i32_g01,i32_b01,u16_pix3); - /* (x+1,y+1) */ - GET_RGB565(i32_r11,i32_g11,i32_b11,u16_pix4); -#else /* (x,y) */ GET_RGB565(i32_b00,i32_g00,i32_r00,u16_pix1); /* (x+1,y) */ @@ -154,8 +144,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p GET_RGB565(i32_b01,i32_g01,i32_r01,u16_pix3); /* (x+1,y+1) */ GET_RGB565(i32_b11,i32_g11,i32_r11,u16_pix4); -#endif -#if 1 /* Solution to avoid green effects due to transparency */ /* If RGB is transparent color (0, 63, 0), we transform it to white (31,63,31) */ if(i32_b00 == 0 && i32_g00 == 63 && i32_r00 == 0) { @@ -177,7 +165,6 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p i32_b11 = 31; i32_r11 = 31; } -#endif /* Convert RGB value to YUV */ i32_u00 = U16(i32_r00, i32_g00, i32_b00); i32_v00 = V16(i32_r00, i32_g00, i32_b00); @@ -204,47 +191,8 @@ M4VIFI_UInt8 M4VIFI_xVSS_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *p pu8_yn[1] = (M4VIFI_UInt8)i32_y10; pu8_ys[0] = (M4VIFI_UInt8)i32_y01; pu8_ys[1] = (M4VIFI_UInt8)i32_y11; -#if 0 /* Temporary solution to avoid green effects due to transparency -> To be removed */ - count_null = 4; - /* Store chroma data */ - if(i32_b00 == 0 && i32_g00 == 63 && i32_r00 == 0) - { - i32_u00 = 0; - i32_v00 = 0; - count_null --; - } - if(i32_b10 == 0 && i32_g10 == 63 && i32_r10 == 0) - { - i32_u10 = 0; - i32_v10 = 0; - count_null --; - } - if(i32_b01 == 0 && i32_g01 == 63 && i32_r01 == 0) - { - i32_u01 = 0; - i32_v01 = 0; - count_null --; - } - if(i32_b11 == 0 && i32_g11 == 63 && i32_r11 == 0) - { - i32_u11 = 0; - i32_v11 = 0; - count_null --; - } - - if(count_null == 0) - { -#endif *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) >> 2); *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) >> 2); -#if 0 /* Temporary solution to avoid green effects due to transparency -> To be removed */ - } - else - { - *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) / count_null); - *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) / count_null); - } -#endif /* Prepare for next column */ pu8_rgbn += (CST_RGB_16_SIZE<<1); /* Update current Y plane line pointer*/ diff --git a/libvideoeditor/vss/src/M4VSS3GPP_AudioMixing.c b/libvideoeditor/vss/src/M4VSS3GPP_AudioMixing.c index 786ccbb..877dd97 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_AudioMixing.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_AudioMixing.c @@ -1433,25 +1433,6 @@ M4VSS3GPP_intAudioMixingOpen( M4VSS3GPP_InternalAudioMixingContext *pC, } } } -#if 0 - /** - * Compute the volume factors */ - if( (M4OSA_TRUE - == pC->bRemoveOriginal) ) - { - /** - * In the remove original case, we keep only the added audio */ - pC->fAddedFactor = 1.0F; - pC->fOrigFactor = 0.0F; - } - else - { - /** - * Compute the factor to apply to sample to do the mixing */ - pC->fAddedFactor = pSettings->uiAddVolume / 100.0F; - pC->fOrigFactor = 1.0F - pC->fAddedFactor; - } -#endif if( pC->b_DuckingNeedeed == M4OSA_FALSE) { /** @@ -2782,57 +2763,6 @@ static M4OSA_ERR M4VSS3GPP_intAudioMixingCopyAdded( pEncOutBuffer.pTableBufferSize[0] = 0; M4OSA_TRACE2_0("K **** blend AUs"); -#if 0 - - { - M4OSA_Char filename[13]; - M4OSA_Context pGIFFileInDebug = M4OSA_NULL; - M4OSA_FilePosition pos = 0; - - sprintf(filename, "toto.pcm"); - - err = pC->pOsaFileWritPtr->openWrite(&pGIFFileInDebug, filename, - M4OSA_kFileWrite | M4OSA_kFileAppend); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't open input gif file %s, error: 0x%x\n", - pFile, err); - return err; - } - - err = pC->pOsaFileWritPtr->seek(pGIFFileInDebug, M4OSA_kFileSeekEnd, - &pos); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't seek input gif file %s, error: 0x%x\n", - pFile, err); - return err; - } - - err = pC->pOsaFileWritPtr->writeData(pGIFFileInDebug, - pC->pSsrcBufferOut, - pC->pInputClipCtxt->AudioDecBufferOut.m_bufferSize); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't write input gif file %s, error: 0x%x\n", - pFile, err); - return err; - } - - err = pC->pOsaFileWritPtr->closeWrite(pGIFFileInDebug); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't close input gif file %s, error: 0x%x\n", - pFile, err); - return err; - } - } - -#endif /** * Encode the PCM audio */ diff --git a/libvideoeditor/vss/src/M4VSS3GPP_Codecs.c b/libvideoeditor/vss/src/M4VSS3GPP_Codecs.c index 3fe3a1d..aaa621e 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_Codecs.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_Codecs.c @@ -647,19 +647,6 @@ M4OSA_ERR M4VSS3GPP_unRegisterAllDecoders( M4VSS3GPP_MediaAndCodecCtxt *pC ) #endif pC->m_pVideoDecoderItTable[i] = M4OSA_NULL; -#ifdef M4VSS_ENABLE_EXTERNAL_DECODERS -#if 0 /* This is to avoid freeing OMX core context, passed as user data */ - - if( pC->m_pVideoDecoderUserDataTable[i] != M4OSA_NULL ) - { - free(pC->m_pVideoDecoderUserDataTable[i]); - /* there ought to be a better pattern... right? */ - pC->m_pVideoDecoderUserDataTable[i] = M4OSA_NULL; - } - -#endif - -#endif /* M4VSS_ENABLE_EXTERNAL_DECODERS */ } } diff --git a/libvideoeditor/vss/src/M4VSS3GPP_Edit.c b/libvideoeditor/vss/src/M4VSS3GPP_Edit.c index aa5e532..e778b52 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_Edit.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_Edit.c @@ -407,43 +407,6 @@ M4VSS3GPP_editDuplicateClipSettings( M4VSS3GPP_ClipSettings *pClipSettingsDest, } /* Duplicate effects */ -#if 0 - - if( M4OSA_TRUE == bCopyEffects ) - { - if( pClipSettingsOrig->nbEffects > 0 ) - { - pClipSettingsDest->Effects = (M4VSS3GPP_EffectSettings - *)M4OSA_32bitAlignedMalloc(sizeof(M4VSS3GPP_EffectSettings) - * pClipSettingsOrig->nbEffects, - M4VSS3GPP, "pClipSettingsDest->Effects"); - - if( M4OSA_NULL == pClipSettingsDest->Effects ) - { - M4OSA_TRACE1_1( - "M4VSS3GPP_editDuplicateClipSettings : ERROR allocating effects, nb=%lu", - pClipSettingsOrig->nbEffects); - pClipSettingsDest->nbEffects = 0; - return M4ERR_ALLOC; - } - - for ( uiFx = 0; uiFx < pClipSettingsOrig->nbEffects; uiFx++ ) - { - /* Copy plain structure */ - memcpy( - (void *) &(pClipSettingsDest->Effects[uiFx]), - (void *) &(pClipSettingsOrig->Effects[uiFx]), - sizeof(M4VSS3GPP_EffectSettings)); - } - } - } - else - { - pClipSettingsDest->nbEffects = 0; - pClipSettingsDest->Effects = M4OSA_NULL; - } - -#endif /* RC */ /* Return with no error */ M4OSA_TRACE3_0( @@ -2113,83 +2076,6 @@ static M4OSA_ERR M4VSS3GPP_intClipSettingsSanityCheck( uiClipActualDuration = pClip->uiEndCutTime - pClip->uiBeginCutTime; } - if( M4VIDEOEDITING_kMP3 != pClip->ClipProperties.AudioStreamType ) - { -#if 0 /*RC*/ - /** - * Check the three effects */ - - for ( uiFx = 0; uiFx < pClip->nbEffects; uiFx++ ) - { - pFx = &(pClip->Effects[uiFx]); /**< shortcut */ - - /** - * No effect cases */ - if( 0 == pFx->uiDuration ) - { - pFx->VideoEffectType = M4VSS3GPP_kVideoEffectType_None; - pFx->AudioEffectType = M4VSS3GPP_kAudioEffectType_None; - } - else if( ( M4VSS3GPP_kVideoEffectType_None == pFx->VideoEffectType) - && (M4VSS3GPP_kAudioEffectType_None == pFx->AudioEffectType) ) - { - pFx->uiStartTime = 0; - pFx->uiDuration = 0; - } - - /** - * We convert all the effects into middle effects, computing the corresponding - * start time and duration */ - if( M4VSS3GPP_kEffectKind_Begin == pFx->EffectKind ) - { - pFx->uiStartTime = 0; - } - else if( M4VSS3GPP_kEffectKind_End == pFx->EffectKind ) - { - /** - * Duration sanity check */ - if( pFx->uiDuration > uiClipActualDuration ) - { - pFx->uiDuration = uiClipActualDuration; - } - /** - * Start time computing */ - pFx->uiStartTime = uiClipActualDuration - pFx->uiDuration; - } - else if( M4VSS3GPP_kEffectKind_Middle == pFx->EffectKind ) - { - /** - * Duration sanity check */ - if( pFx->uiDuration + pFx->uiStartTime > uiClipActualDuration ) - { - pFx->uiDuration = uiClipActualDuration - pFx->uiStartTime; - } - } - else - { - M4OSA_TRACE1_1( - "M4VSS3GPP_intClipSettingsSanityCheck: unknown effect kind (0x%x),\ - returning M4VSS3GPP_ERR_INVALID_EFFECT_KIND", - pFx->EffectKind); - return M4VSS3GPP_ERR_INVALID_EFFECT_KIND; - } - - /** - * Check external effect function is set */ - if( ( pFx->VideoEffectType >= M4VSS3GPP_kVideoEffectType_External) - && (M4OSA_NULL == pFx->ExtVideoEffectFct) ) - { - M4OSA_TRACE1_0( - "M4VSS3GPP_intClipSettingsSanityCheck:\ - returning M4VSS3GPP_ERR_EXTERNAL_EFFECT_NULL"); - return M4VSS3GPP_ERR_EXTERNAL_EFFECT_NULL; - } - } - -#endif - - } - return M4NO_ERROR; } diff --git a/libvideoeditor/vss/src/M4VSS3GPP_EditAudio.c b/libvideoeditor/vss/src/M4VSS3GPP_EditAudio.c index 517746f..103a5ea 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_EditAudio.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_EditAudio.c @@ -1501,26 +1501,6 @@ static M4OSA_Void M4VSS3GPP_intCheckAudioEffects( M4VSS3GPP_InternalEditContext * If the announced duration is smaller than the real one, the end effect won't be applied at * the very end of the clip. To solve this issue we force the end effect. */ -#if 0 - - else if( ( M4VSS3GPP_kEffectKind_End == pFx->EffectKind) - && (t >= (M4OSA_Int32)(BC + pFx->uiStartTime)) ) - { - /** - * Set the active effect */ - *piClipActiveEffect = - pC->pClipList[uiClipIndex].nbEffects - 1 - uiFxIndex; - - /** - * The third effect has the highest priority, then the second one, - then the first one. - * Hence, as soon as we found an active effect, we can get out of this loop */ - uiFxIndex = pC-> - pClipList[ - uiClipIndex].nbEffects; /** get out of the for loop */ - } - -#endif /* RC */ } } diff --git a/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c b/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c index c2226a7..f69f14b 100755 --- a/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c +++ b/libvideoeditor/vss/src/M4VSS3GPP_EditVideo.c @@ -2219,16 +2219,6 @@ M4OSA_ERR M4VSS3GPP_intCreateVideoEncoder( M4VSS3GPP_InternalEditContext *pC ) /* Compute max bitrate depending on input files bitrates and transitions */ if( pC->Vstate == M4VSS3GPP_kEditVideoState_TRANSITION ) { -#if 0 - /* Max of the two blended files */ - if( pC->pC1->pSettings->ClipProperties.uiVideoBitrate - > pC->pC2->pSettings->ClipProperties.uiVideoBitrate ) - EncParams.Bitrate = - pC->pC1->pSettings->ClipProperties.uiVideoBitrate; - else - EncParams.Bitrate = - pC->pC2->pSettings->ClipProperties.uiVideoBitrate; -#endif EncParams.Bitrate = pC->ewc.uiVideoBitrate; } else diff --git a/libvideoeditor/vss/src/M4xVSS_API.c b/libvideoeditor/vss/src/M4xVSS_API.c index bce327d..8750fec 100755 --- a/libvideoeditor/vss/src/M4xVSS_API.c +++ b/libvideoeditor/vss/src/M4xVSS_API.c @@ -1660,483 +1660,6 @@ M4OSA_ERR M4xVSS_SendCommand( M4OSA_Context pContext, pTransitionList[i]->uiTransitionDuration; } - /************************ - JPG input file type case - *************************/ -#if 0 - - if( xVSS_context->pSettings->pClipList[i]->FileType - == M4VIDEOEDITING_kFileType_JPG ) - { - M4OSA_Char out_img[64]; - M4OSA_Char out_img_tmp[64]; - M4xVSS_Pto3GPP_params *pParams; - M4OSA_Context pJPEGFileIn; - /*UTF conversion support*/ - M4OSA_Void *pDecodedPath = pSettings->pClipList[i]->pFile; - - /* Parse Pto3GPP params chained list to know if input file has already been - converted */ - if( xVSS_context->pPTo3GPPparamsList != M4OSA_NULL ) - { - M4OSA_UInt32 pCmpResult = 0; - - pParams = xVSS_context->pPTo3GPPparamsList; - /* We parse all Pto3gpp Param chained list */ - while( pParams != M4OSA_NULL ) - { - pCmpResult = strcmp((const char *)pSettings->pClipList[i]->pFile, - (const char *)pParams->pFileIn); - - if( pCmpResult == 0 - && (pSettings->pClipList[i]->uiEndCutTime - == pParams->duration - || pSettings->pClipList[i]->xVSS.uiDuration - == pParams->duration) - && pSettings->pClipList[i]->xVSS.MediaRendering - == pParams->MediaRendering ) - { - /* Replace JPG filename with existing 3GP filename */ - goto replaceJPG_3GP; - } - /* We need to update this variable, in case some pictures have been added - between two */ - /* calls to M4xVSS_sendCommand */ - pPto3GPP_last = pParams; - pParams = pParams->pNext; - } - } - - /* Construct output temporary 3GP filename */ - err = M4OSA_chrSPrintf(out_img, 63, (M4OSA_Char *)"%simg%d.3gp", - xVSS_context->pTempPath, xVSS_context->tempFileIndex); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1("Error in M4OSA_chrSPrintf: 0x%x", err); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return err; - } - -#ifdef M4xVSS_RESERVED_MOOV_DISK_SPACE - - err = M4OSA_chrSPrintf(out_img_tmp, 63, "%simg%d.tmp", - xVSS_context->pTempPath, xVSS_context->tempFileIndex); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1("Error in M4OSA_chrSPrintf: 0x%x", err); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return err; - } - -#endif /*M4xVSS_RESERVED_MOOV_DISK_SPACE*/ - - xVSS_context->tempFileIndex++; - - /* Allocate last element Pto3GPP params structure */ - pParams = (M4xVSS_Pto3GPP_params - *)M4OSA_32bitAlignedMalloc(sizeof(M4xVSS_Pto3GPP_params), - M4VS, (M4OSA_Char *)"Element of Pto3GPP Params"); - - if( pParams == M4OSA_NULL ) - { - M4OSA_TRACE1_0( - "M4xVSS_sendCommand: Problem when allocating one element Pto3GPP Params"); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - - /* Initializes pfilexxx members of pParams to be able to free them correctly */ - pParams->pFileIn = M4OSA_NULL; - pParams->pFileOut = M4OSA_NULL; - pParams->pFileTemp = M4OSA_NULL; - pParams->pNext = M4OSA_NULL; - pParams->MediaRendering = M4xVSS_kResizing; - - if( xVSS_context->pPTo3GPPparamsList - == M4OSA_NULL ) /* Means it is the first element of the list */ - { - /* Initialize the xVSS context with the first element of the list */ - xVSS_context->pPTo3GPPparamsList = pParams; - - /* Save this element in case of other file to convert */ - pPto3GPP_last = pParams; - } - else - { - /* Update next pointer of the previous last element of the chain */ - pPto3GPP_last->pNext = pParams; - - /* Update save of last element of the chain */ - pPto3GPP_last = pParams; - } - - /* Fill the last M4xVSS_Pto3GPP_params element */ - pParams->duration = - xVSS_context->pSettings->pClipList[i]->uiEndCutTime; - /* If duration is filled, let's use it instead of EndCutTime */ - if( xVSS_context->pSettings->pClipList[i]->xVSS.uiDuration != 0 ) - { - pParams->duration = - xVSS_context->pSettings->pClipList[i]->xVSS.uiDuration; - } - - pParams->InputFileType = M4VIDEOEDITING_kFileType_JPG; - - /** - * UTF conversion: convert into the customer format, before being used*/ - pDecodedPath = xVSS_context->pSettings->pClipList[i]->pFile; - length = strlen(pDecodedPath); - - /** - * UTF conversion: convert into the customer format, before being used*/ - if( xVSS_context->UTFConversionContext.pConvFromUTF8Fct - != M4OSA_NULL && xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer - != M4OSA_NULL ) - { - err = M4xVSS_internalConvertFromUTF8(xVSS_context, (M4OSA_Void - *)xVSS_context->pSettings->pClipList[i]->pFile, - (M4OSA_Void *)xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer, - &length); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1( - "M4xVSS_SendCommand: pConvFromUTF8Fct returns err: 0x%x", - err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - pDecodedPath = - xVSS_context->UTFConversionContext.pTempOutConversionBuffer; - } - - /** - * End of the UTF conversion, use the converted file path*/ - pParams->pFileIn = (M4OSA_Void *)M4OSA_32bitAlignedMalloc(length + 1, M4VS, - (M4OSA_Char *)"Pto3GPP Params: file in"); - - if( pParams->pFileIn == M4OSA_NULL ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_SendCommand"); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - memcpy((void *)pParams->pFileIn, (void *)pDecodedPath, - (length + 1)); /* Copy input file path */ - - /* Check that JPG file is present on the FS (P4ME00002974) by just opening and - closing it */ - err = - xVSS_context->pFileReadPtr->openRead(&pJPEGFileIn, pDecodedPath, - M4OSA_kFileRead); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't open input jpg file %s, error: 0x%x\n", - pDecodedPath, err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - err = xVSS_context->pFileReadPtr->closeRead(pJPEGFileIn); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_2("Can't close input jpg file %s, error: 0x%x\n", - pDecodedPath, err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - - /** - * UTF conversion: convert into the customer format, before being used*/ - pDecodedPath = out_img; - length = strlen(pDecodedPath); - - if( xVSS_context->UTFConversionContext.pConvFromUTF8Fct - != M4OSA_NULL && xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer - != M4OSA_NULL ) - { - err = M4xVSS_internalConvertFromUTF8(xVSS_context, - (M4OSA_Void *)out_img, (M4OSA_Void *)xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer, &length); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1( - "M4xVSS_SendCommand: pConvFromUTF8Fct returns err: 0x%x", - err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - pDecodedPath = - xVSS_context->UTFConversionContext.pTempOutConversionBuffer; - } - - /** - * End of the UTF conversion, use the converted file path*/ - pParams->pFileOut = (M4OSA_Void *)M4OSA_32bitAlignedMalloc((length + 1), M4VS, - (M4OSA_Char *)"Pto3GPP Params: file out"); - - if( pParams->pFileOut == M4OSA_NULL ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_SendCommand"); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - memcpy((void *)pParams->pFileOut, (void *)pDecodedPath, - (length + 1)); /* Copy output file path */ - -#ifdef M4xVSS_RESERVED_MOOV_DISK_SPACE - /** - * UTF conversion: convert into the customer format, before being used*/ - - pDecodedPath = out_img_tmp; - length = strlen(pDecodedPath); - - if( xVSS_context->UTFConversionContext.pConvFromUTF8Fct - != M4OSA_NULL && xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer - != M4OSA_NULL ) - { - err = M4xVSS_internalConvertFromUTF8(xVSS_context, - (M4OSA_Void *)out_img_tmp, (M4OSA_Void *)xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer, &length); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1( - "M4xVSS_SendCommand: M4xVSS_internalConvertFromUTF8 returns err: 0x%x", - err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - pDecodedPath = - xVSS_context->UTFConversionContext.pTempOutConversionBuffer; - } - - /** - * End of the UTF conversion, use the converted file path*/ - pParams->pFileTemp = (M4OSA_Void *)M4OSA_32bitAlignedMalloc((length + 1), M4VS, - (M4OSA_Char *)"Pto3GPP Params: file temp"); - - if( pParams->pFileTemp == M4OSA_NULL ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_SendCommand"); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - memcpy((void *)pParams->pFileTemp, (void *)pDecodedPath, - (length + 1)); /* Copy temporary file path */ - -#endif /*M4xVSS_RESERVED_MOOV_DISK_SPACE*/ - - /* Fill PanAndZoom settings if needed */ - - if( M4OSA_TRUE - == xVSS_context->pSettings->pClipList[i]->xVSS.isPanZoom ) - { - pParams->isPanZoom = - xVSS_context->pSettings->pClipList[i]->xVSS.isPanZoom; - /* Check that Pan & Zoom parameters are corrects */ - if( xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXa > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXa - <= 0 || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftXa > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftXa < 0 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftYa > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftYa < 0 - || xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXb - > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXb - <= 0 || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftXb > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftXb < 0 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftYb > 1000 - || xVSS_context->pSettings->pClipList[i]->xVSS. - PanZoomTopleftYb < 0 ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_SendCommand"); - M4xVSS_freeCommand(xVSS_context); - return M4ERR_PARAMETER; - } - - pParams->PanZoomXa = - xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXa; - pParams->PanZoomTopleftXa = - xVSS_context->pSettings-> - pClipList[i]->xVSS.PanZoomTopleftXa; - pParams->PanZoomTopleftYa = - xVSS_context->pSettings-> - pClipList[i]->xVSS.PanZoomTopleftYa; - pParams->PanZoomXb = - xVSS_context->pSettings->pClipList[i]->xVSS.PanZoomXb; - pParams->PanZoomTopleftXb = - xVSS_context->pSettings-> - pClipList[i]->xVSS.PanZoomTopleftXb; - pParams->PanZoomTopleftYb = - xVSS_context->pSettings-> - pClipList[i]->xVSS.PanZoomTopleftYb; - } - else - { - pParams->isPanZoom = M4OSA_FALSE; - } - /*+ PR No: blrnxpsw#223*/ - /*Intializing the Video Frame Rate as it may not be intialized*/ - /*Other changes made is @ M4xVSS_Internal.c @ line 1518 in - M4xVSS_internalStartConvertPictureTo3gp*/ - switch( xVSS_context->pSettings->videoFrameRate ) - { - case M4VIDEOEDITING_k30_FPS: - pParams->framerate = 33; - break; - - case M4VIDEOEDITING_k25_FPS: - pParams->framerate = 40; - break; - - case M4VIDEOEDITING_k20_FPS: - pParams->framerate = 50; - break; - - case M4VIDEOEDITING_k15_FPS: - pParams->framerate = 66; - break; - - case M4VIDEOEDITING_k12_5_FPS: - pParams->framerate = 80; - break; - - case M4VIDEOEDITING_k10_FPS: - pParams->framerate = 100; - break; - - case M4VIDEOEDITING_k7_5_FPS: - pParams->framerate = 133; - break; - - case M4VIDEOEDITING_k5_FPS: - pParams->framerate = 200; - break; - - default: - /*Making Default Frame Rate @ 15 FPS*/ - pParams->framerate = 66; - break; - } - /*-PR No: blrnxpsw#223*/ - if( xVSS_context->pSettings->pClipList[i]->xVSS.MediaRendering - == M4xVSS_kCropping - || xVSS_context->pSettings->pClipList[i]->xVSS. - MediaRendering == M4xVSS_kBlackBorders - || xVSS_context->pSettings->pClipList[i]->xVSS. - MediaRendering == M4xVSS_kResizing ) - { - pParams->MediaRendering = - xVSS_context->pSettings->pClipList[i]->xVSS.MediaRendering; - } - - pParams->pNext = M4OSA_NULL; - pParams->isCreated = M4OSA_FALSE; - xVSS_context->nbStepTotal++; - -replaceJPG_3GP: - /* Update total duration */ - totalDuration += pParams->duration; - - /* Replacing in VSS structure the JPG file by the 3gp file */ - xVSS_context->pSettings->pClipList[i]->FileType = - M4VIDEOEDITING_kFileType_3GPP; - - if( xVSS_context->pSettings->pClipList[i]->pFile != M4OSA_NULL ) - { - free(xVSS_context->pSettings->pClipList[i]->pFile); - xVSS_context->pSettings->pClipList[i]->pFile = M4OSA_NULL; - } - - /** - * UTF conversion: convert into UTF8, before being used*/ - pDecodedPath = pParams->pFileOut; - - if( xVSS_context->UTFConversionContext.pConvToUTF8Fct != M4OSA_NULL - && xVSS_context->UTFConversionContext.pTempOutConversionBuffer - != M4OSA_NULL ) - { - err = M4xVSS_internalConvertToUTF8(xVSS_context, - (M4OSA_Void *)pParams->pFileOut, - (M4OSA_Void *)xVSS_context-> - UTFConversionContext.pTempOutConversionBuffer, - &length); - - if( err != M4NO_ERROR ) - { - M4OSA_TRACE1_1( - "M4xVSS_SendCommand: M4xVSS_internalConvertToUTF8 returns err: 0x%x", - err); - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - return err; - } - pDecodedPath = - xVSS_context->UTFConversionContext.pTempOutConversionBuffer; - } - else - { - length = strlen(pDecodedPath); - } - /** - * End of the UTF conversion, use the converted file path*/ - xVSS_context->pSettings->pClipList[i]->pFile = M4OSA_32bitAlignedMalloc((length - + 1), M4VS, (M4OSA_Char *)"xVSS file path of jpg to 3gp"); - - if( xVSS_context->pSettings->pClipList[i]->pFile == M4OSA_NULL ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_SendCommand"); - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - memcpy((void *)xVSS_context->pSettings->pClipList[i]->pFile, - (void *)pDecodedPath, (length + 1)); - /*FB: add file path size because of UTF16 conversion*/ - xVSS_context->pSettings->pClipList[i]->filePathSize = length+1; - } -#endif if( xVSS_context->pSettings->pClipList[i]->FileType == M4VIDEOEDITING_kFileType_ARGB8888 ) @@ -2635,12 +2158,6 @@ replaceARGB_3GP: M4OSA_Bool audioIsDifferent = M4OSA_FALSE; M4OSA_Bool videoIsDifferent = M4OSA_FALSE; M4OSA_Bool bAudioMono; -#ifdef TIMESCALE_BUG - - M4OSA_Bool timescaleDifferent = M4OSA_FALSE; - -#endif - /* Initialize file properties structure */ memset((void *) &fileProperties,0, @@ -2879,16 +2396,6 @@ replaceARGB_3GP: i); } -#ifdef TIMESCALE_BUG - /* Check timescale */ - - if( fileProperties.VideoStreamType == M4VIDEOEDITING_kMPEG4 //&& - /* !!!!!!!!!!!! Add condition to update timescale !!!!!!!!!!!!!!!!!!!!!!!!! */ ) - { - timescaleDifferent = M4OSA_TRUE; - } - -#endif /* If the output video format/size is not the same as provided video, let's transcode it */ @@ -2943,14 +2450,7 @@ replaceARGB_3GP: } } - if( videoIsDifferent == M4OSA_TRUE || audioIsDifferent == M4OSA_TRUE -#ifdef TIMESCALE_BUG - - || timescaleDifferent == M4OSA_TRUE - -#endif - - ) + if( videoIsDifferent == M4OSA_TRUE || audioIsDifferent == M4OSA_TRUE) { M4OSA_Char out_3gp[M4XVSS_MAX_PATH_LEN]; M4OSA_Char out_3gp_tmp[M4XVSS_MAX_PATH_LEN]; @@ -3015,25 +2515,6 @@ replaceARGB_3GP: pParams->InputFileType = M4VIDEOEDITING_kFileType_3GPP; pParams->OutputFileType = M4VIDEOEDITING_kFileType_3GPP; -#ifdef TIMESCALE_BUG - /* Check if timescale only needs to be modified */ - - if( timescaleDifferent == M4OSA_TRUE - && videoIsDifferent == M4OSA_FALSE ) - { - pParams->OutputVideoTimescale = 30; - pParams->OutputVideoFormat = M4VIDEOEDITING_kNullVideo; - pParams->OutputVideoFrameRate = - M4VIDEOEDITING_k15_FPS; /* Must be set, otherwise, - MCS returns an error ... */ - } - else - { - pParams->OutputVideoTimescale = 0; - } - -#endif - pParams->OutputVideoTimescale = xVSS_context->targetedTimescale; /* We do not need to reencode video if its parameters do not differ */ @@ -3515,15 +2996,6 @@ replace3GP_3GP: masterClip = i; xVSS_context->pSettings->uiMasterClip = i; } -#if 0 /* Changed to be able to mix with video only files */ - - if( xVSS_context->pSettings->uiMasterClip == 0 - && fileProperties.AudioStreamType != M4VIDEOEDITING_kNoneAudio ) - { - xVSS_context->pSettings->uiMasterClip = i; - } - -#endif } /************************** @@ -4579,13 +4051,6 @@ replace3GP_3GP: /* Initialize the xVSS context with the first element of the list */ xVSS_context->pMCSparamsList = pParams; -#if 0 /* Not necessary, BGM is the last element of transcoding */ - /* Save this element in case of other file to convert (can't happen, BGM ...) */ - - pMCS_last = pParams; - -#endif - } else { @@ -4671,13 +4136,6 @@ replace3GP_3GP: pMCS_last->pNext = pParams; } -#if 0 /* Not necessary, BGM is the last element of transcoding */ - /* Update save of last element of the chain (not necessary, BGM ...) */ - - pMCS_last = pParams; - -#endif - } /* Fill the last M4xVSS_MCS_params element */ @@ -4854,35 +4312,6 @@ replace3GP_3GP: memcpy((void *)pParams->pFileOut,(void *) xVSS_context->pcmPreviewFile, (length + 1)); /* Copy output file path */ -#if 0 - - xVSS_context->pcmPreviewFile = - (M4OSA_Char *)M4OSA_32bitAlignedMalloc(strlen(out_pcm) + 1, M4VS, - "pcmPreviewFile"); - - if( xVSS_context->pcmPreviewFile == M4OSA_NULL ) - { - M4OSA_TRACE1_0("Allocation error in M4xVSS_Init"); - free(out_pcm); - out_pcm = M4OSA_NULL; - /*FB: to avoid leaks when there is an error in the send command*/ - /* Free Send command */ - M4xVSS_freeCommand(xVSS_context); - /**/ - return M4ERR_ALLOC; - } - M4OSA_chrNCopy(xVSS_context->pcmPreviewFile, out_pcm, - strlen(out_pcm) + 1); - - /* Free temporary output filename */ - if( out_pcm != M4OSA_NULL ) - { - free(out_pcm); - out_pcm = M4OSA_NULL; - } - -#endif - /** * UTF conversion: convert into the customer format, before being used*/ @@ -5062,23 +4491,6 @@ replace3GP_3GP: } } - /* Default behaviour, if no audio/video output format is set, we put H263/AMR by default */ -#if 0 - - if( xVSS_context->pSettings->xVSS.outputVideoFormat - == M4VIDEOEDITING_kNoneVideo ) - { - xVSS_context->pSettings->xVSS.outputVideoFormat = M4VIDEOEDITING_kH263; - } - - if( xVSS_context->pSettings->xVSS.outputAudioFormat - == M4VIDEOEDITING_kNoneAudio ) - { - xVSS_context->pSettings->xVSS.outputAudioFormat = - M4VIDEOEDITING_kAMR_NB; - } - -#endif /* Changed to be able to mix with video only files -> in case no master clip is found (i.e only JPG input or video only input) */ /* and if there is a BGM, we force the added volume to 100 (i.e replace audio) */ diff --git a/libvideoeditor/vss/src/M4xVSS_internal.c b/libvideoeditor/vss/src/M4xVSS_internal.c index 174ddbd..e7e2dfd 100755 --- a/libvideoeditor/vss/src/M4xVSS_internal.c +++ b/libvideoeditor/vss/src/M4xVSS_internal.c @@ -171,9 +171,6 @@ M4OSA_ERR M4xVSS_internalStartTranscoding(M4OSA_Context pContext) break; } /**/ -#ifdef TIMESCALE_BUG - Params.OutputVideoTimescale = xVSS_context->pMCScurrentParams->OutputVideoTimescale; -#endif // new params after integrating MCS 2.0 // Set the number of audio effects; 0 for now. Params.nbEffects = 0; @@ -629,49 +626,6 @@ M4OSA_ERR M4xVSS_PictureCallbackFct(M4OSA_Void* pPictureCtxt, M4VIFI_ImagePlane* /*Save ratio values, they can be reused if the new ratios are 0*/ tempPanzoomXa = (M4OSA_UInt8)pC->m_pPto3GPPparams->PanZoomXa; tempPanzoomXb = (M4OSA_UInt8)pC->m_pPto3GPPparams->PanZoomXb; -#if 0 - /** - * Check size of output JPEG is compatible with pan & zoom parameters - First, check final (b) parameters */ - if(pC->m_pPto3GPPparams->PanZoomXb + pC->m_pPto3GPPparams->PanZoomTopleftXb > 100 ) - { - M4OSA_TRACE1_1("WARNING : Bad final Pan & Zoom settings !!!\ - New final Zoom ratio is: %d", (100 - pC->m_pPto3GPPparams->PanZoomTopleftXb)); - /* We do not change the topleft parameter as it may correspond to a precise area - of the picture -> only the zoom ratio is modified */ - pC->m_pPto3GPPparams->PanZoomXb = 100 - pC->m_pPto3GPPparams->PanZoomTopleftXb; - } - - if(pC->m_pPto3GPPparams->PanZoomXb + pC->m_pPto3GPPparams->PanZoomTopleftYb > 100 ) - { - M4OSA_TRACE1_1("WARNING : Bad final Pan & Zoom settings \ - !!! New final Zoom ratio is: %d", - (100 - pC->m_pPto3GPPparams->PanZoomTopleftYb)); - /* We do not change the topleft parameter as it may correspond to a - precise area of the picture -> only the zoom ratio is modified */ - pC->m_pPto3GPPparams->PanZoomXb = 100 - pC->m_pPto3GPPparams->PanZoomTopleftYb; - } - - /** - * Then, check initial (a) parameters */ - if(pC->m_pPto3GPPparams->PanZoomXa + pC->m_pPto3GPPparams->PanZoomTopleftXa > 100 ) - { - M4OSA_TRACE1_1("WARNING : Bad initial Pan & Zoom settings !!! \ - New initial Zoom ratio is: %d",(100 - pC->m_pPto3GPPparams->PanZoomTopleftXa)); - /* We do not change the topleft parameter as it may correspond to a precise - area of the picture-> only the zoom ratio is modified */ - pC->m_pPto3GPPparams->PanZoomXa = 100 - pC->m_pPto3GPPparams->PanZoomTopleftXa; - } - - if(pC->m_pPto3GPPparams->PanZoomXa + pC->m_pPto3GPPparams->PanZoomTopleftYa > 100 ) - { - M4OSA_TRACE1_1("WARNING : Bad initial Pan & Zoom settings !!! New initial\ - Zoom ratio is: %d", (100 - pC->m_pPto3GPPparams->PanZoomTopleftYa)); - /* We do not change the topleft parameter as it may correspond to a precise - area of the picture-> only the zoom ratio is modified */ - pC->m_pPto3GPPparams->PanZoomXa = 100 - pC->m_pPto3GPPparams->PanZoomTopleftYa; - } -#endif /*Check that the ratio is not 0*/ /*Check (a) parameters*/ if(pC->m_pPto3GPPparams->PanZoomXa == 0) @@ -3329,13 +3283,6 @@ M4OSA_ERR M4xVSS_freeSettings(M4VSS3GPP_EditSettings* pSettings) { // M4SPS_destroy(framingCtx->pSPSContext); framingCtx->pSPSContext = M4OSA_NULL; -#if 0 - if(framingCtx->inputStream.data_buffer != M4OSA_NULL) - { - free(framingCtx->inputStream.data_buffer); - framingCtx->inputStream.data_buffer = M4OSA_NULL; - } -#endif } /*Alpha blending structure*/ if(framingCtx->alphaBlendingStruct != M4OSA_NULL) @@ -3450,87 +3397,6 @@ M4OSA_ERR M4xVSS_freeCommand(M4OSA_Context pContext) free(xVSS_context->pSettings->xVSS.pBGMtrack); xVSS_context->pSettings->xVSS.pBGMtrack = M4OSA_NULL; } -#if 0 - /* Parse transitions to free internal "alpha magic" settings structure */ - /** - * In case there is twice or more the same Alpha Magic effect, the effect context - * may be freed twice or more. - * So, we parse all remaining transition settings to know if the context can be - * "re-freed", and if yes, we put its context to NULL to avoid freeing it again */ - for(i=0; i<xVSS_context->pSettings->uiClipNumber-1; i++) - { - if(xVSS_context->pSettings->pTransitionList[i] != M4OSA_NULL) - { - switch (xVSS_context->pSettings->pTransitionList[i]->VideoTransitionType) - { - case M4xVSS_kVideoTransitionType_AlphaMagic: - /** - * In case of Alpha Magic transition, some extra parameters need to be freed */ - if(xVSS_context->pSettings->pTransitionList[i]->\ - pExtVideoTransitionFctCtxt != M4OSA_NULL) - { - free((((M4xVSS_internal_AlphaMagicSettings*)\ - xVSS_context->pSettings->pTransitionList[i]->\ - pExtVideoTransitionFctCtxt)->pPlane->pac_data)); - ((M4xVSS_internal_AlphaMagicSettings*)xVSS_context->\ - pSettings->pTransitionList[i]->pExtVideoTransitionFctCtxt)->\ - pPlane->pac_data = M4OSA_NULL; - - free((((M4xVSS_internal_AlphaMagicSettings*)\ - xVSS_context->pSettings->pTransitionList[i]->\ - pExtVideoTransitionFctCtxt)->pPlane)); - ((M4xVSS_internal_AlphaMagicSettings*)xVSS_context->\ - pSettings->pTransitionList[i]->pExtVideoTransitionFctCtxt)->\ - pPlane = M4OSA_NULL; - - free((xVSS_context->pSettings->\ - pTransitionList[i]->pExtVideoTransitionFctCtxt)); - xVSS_context->pSettings->pTransitionList[i]->pExtVideoTransitionFctCtxt - = M4OSA_NULL; - - for(j=i+1;j<xVSS_context->pSettings->uiClipNumber-1;j++) - { - if(xVSS_context->pSettings->pTransitionList[j] != M4OSA_NULL) - { - if(xVSS_context->pSettings->pTransitionList[j]->\ - VideoTransitionType == M4xVSS_kVideoTransitionType_AlphaMagic) - { - M4OSA_UInt32 pCmpResult=0; - pCmpResult = strcmp((const char *)xVSS_context->pSettings->pTransitionList[i]->\ - xVSS.transitionSpecific.pAlphaMagicSettings->\ - pAlphaFilePath, - (const char *)xVSS_context->pSettings->pTransitionList[j]->\ - xVSS.transitionSpecific.pAlphaMagicSettings->\ - pAlphaFilePath); - if(pCmpResult == 0) - { - /* Free extra internal alpha magic structure and put it - to NULL to avoid refreeing it */ - free((xVSS_context->pSettings->\ - pTransitionList[j]->pExtVideoTransitionFctCtxt)); - xVSS_context->pSettings->pTransitionList[j]->\ - pExtVideoTransitionFctCtxt = M4OSA_NULL; - } - } - } - } - } - break; - - case M4xVSS_kVideoTransitionType_SlideTransition: - if(xVSS_context->pSettings->pTransitionList[i]->\ - pExtVideoTransitionFctCtxt != M4OSA_NULL) - { - free((xVSS_context->pSettings->\ - pTransitionList[i]->pExtVideoTransitionFctCtxt)); - xVSS_context->pSettings->pTransitionList[i]->\ - pExtVideoTransitionFctCtxt = M4OSA_NULL; - } - break; - } - } - } -#endif M4xVSS_freeSettings(xVSS_context->pSettings); @@ -4023,22 +3889,6 @@ M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, #ifdef DECODE_GIF_ON_SAVING M4OSA_ERR err; Framing = (M4xVSS_FramingStruct *)((M4xVSS_FramingContext*)userData)->aFramingCtx; -#if 0 - if(Framing == M4OSA_NULL) - { - ((M4xVSS_FramingContext*)userData)->clipTime = pProgress->uiOutputTime; - err = M4xVSS_internalDecodeGIF(userData); - if(M4NO_ERROR != err) - { - M4OSA_TRACE1_1("M4VSS3GPP_externalVideoEffectFraming:\ - Error in M4xVSS_internalDecodeGIF: 0x%x", err); - return err; - } - Framing = (M4xVSS_FramingStruct *)((M4xVSS_FramingContext*)userData)->aFramingCtx; - /* Initializes first GIF time */ - ((M4xVSS_FramingContext*)userData)->current_gif_time = pProgress->uiOutputTime; - } -#endif currentFraming = (M4xVSS_FramingStruct *)Framing; FramingRGB = Framing->FramingRgb->pac_data; #endif /*DECODE_GIF_ON_SAVING*/ @@ -4064,40 +3914,6 @@ M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, /** * If the current clip time has reach the duration of one frame of the framing picture * we need to step to next framing picture */ -#if 0 - if(((M4xVSS_FramingContext*)userData)->b_animated == M4OSA_TRUE) - { - while((((M4xVSS_FramingContext*)userData)->current_gif_time + currentFraming->duration)\ - < pProgress->uiOutputTime) - { -#ifdef DECODE_GIF_ON_SAVING - ((M4xVSS_FramingContext*)userData)->clipTime = pProgress->uiOutputTime; - err = M4xVSS_internalDecodeGIF(userData); - if(M4NO_ERROR != err) - { - M4OSA_TRACE1_1("M4VSS3GPP_externalVideoEffectFraming:\ - Error in M4xVSS_internalDecodeGIF: 0x%x", err); - return err; - } - if(currentFraming->duration != 0) - { - ((M4xVSS_FramingContext*)userData)->current_gif_time += currentFraming->duration; - } - else - { - ((M4xVSS_FramingContext*)userData)->current_gif_time \ - += pProgress->uiOutputTime - Framing->previousClipTime; - } - Framing = (M4xVSS_FramingStruct *)((M4xVSS_FramingContext*)userData)->aFramingCtx; - currentFraming = (M4xVSS_FramingStruct *)Framing; - FramingRGB = Framing->FramingRgb->pac_data; -#else - Framing->pCurrent = currentFraming->pNext; - currentFraming = Framing->pCurrent; -#endif /*DECODE_GIF_ON_SAVING*/ - } - } -#endif Framing->previousClipTime = pProgress->uiOutputTime; FramingRGB = currentFraming->FramingRgb->pac_data; @@ -4213,15 +4029,6 @@ M4OSA_ERR M4VSS3GPP_externalVideoEffectFraming( M4OSA_Void *userData, } } -#ifdef DECODE_GIF_ON_SAVING -#if 0 - if(pProgress->bIsLast == M4OSA_TRUE - && (M4OSA_Bool)((M4xVSS_FramingContext*)userData)->b_IsFileGif == M4OSA_TRUE) - { - M4xVSS_internalDecodeGIF_Cleaning((M4xVSS_FramingContext*)userData); - } -#endif -#endif /*DECODE_GIF_ON_SAVING*/ return M4VIFI_OK; } diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp index 809579b..3b3f89f 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp @@ -1304,7 +1304,6 @@ M4OSA_ERR VideoEditorVideoDecoder_decode(M4OSA_Context context, } else if ( INFO_FORMAT_CHANGED == errStatus ) { LOGV("VideoDecoder_decode:source returns INFO_FORMAT_CHANGED:TODO"); -#if 1 LOGV("VideoDecoder_decode : source returns INFO_FORMAT_CHANGED"); lerr = VideoEditorVideoDecoder_configureFromMetadata( pDecShellContext, @@ -1314,7 +1313,6 @@ M4OSA_ERR VideoEditorVideoDecoder_decode(M4OSA_Context context, "VideoDecoder_configureFromMetadata returns 0x%X", lerr); break; } -#endif continue; } diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp index 968b39b..0a595a2 100755 --- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp +++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp @@ -102,7 +102,7 @@ struct VideoEditorVideoEncoderSource : public MediaSource { }; sp<VideoEditorVideoEncoderSource> VideoEditorVideoEncoderSource::Create() { -
+ sp<VideoEditorVideoEncoderSource> aSource = new VideoEditorVideoEncoderSource(); return aSource; @@ -118,7 +118,7 @@ VideoEditorVideoEncoderSource::VideoEditorVideoEncoderSource(): } VideoEditorVideoEncoderSource::~VideoEditorVideoEncoderSource() { -
+ // Safety clean up if( STARTED == mState ) { stop(); @@ -173,7 +173,7 @@ sp<MetaData> VideoEditorVideoEncoderSource::getFormat() { LOGW("VideoEditorVideoEncoderSource::getFormat:THIS IS NOT IMPLEMENTED"); return NULL; -}
+} status_t VideoEditorVideoEncoderSource::read(MediaBuffer **buffer, const ReadOptions *options) { @@ -201,7 +201,7 @@ status_t VideoEditorVideoEncoderSource::read(MediaBuffer **buffer, } *buffer = mFirstBufferLink->buffer; tmpLink = mFirstBufferLink; - mFirstBufferLink = mFirstBufferLink->nextLink;
+ mFirstBufferLink = mFirstBufferLink->nextLink; if ( NULL == mFirstBufferLink ) { mLastBufferLink = NULL; @@ -235,7 +235,7 @@ int32_t VideoEditorVideoEncoderSource::storeBuffer(MediaBuffer *buffer) { } LOGV("VideoEditorVideoEncoderSource::storeBuffer() end"); return mNbBuffer; -}
+} /** ****************************************************************************** @@ -250,7 +250,7 @@ typedef enum { STARTED = 0x4, BUFFERING = 0x8, READING = 0x10 -} VideoEditorVideoEncoder_State;
+} VideoEditorVideoEncoder_State; typedef struct { VideoEditorVideoEncoder_State mState; @@ -299,7 +299,7 @@ M4OSA_ERR VideoEditorVideoEncoder_getDSI(M4ENCODER_Context pContext, sp<VideoEditorVideoEncoderSource> encoderSource = NULL; sp<MediaSource> encoder = NULL;; OMXClient client; -
+ LOGV("VideoEditorVideoEncoder_getDSI begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -389,7 +389,7 @@ cleanUp: M4OSA_ERR VideoEditorVideoEncoder_cleanup(M4ENCODER_Context pContext) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_cleanup begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -407,7 +407,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_cleanup no error"); } else { LOGV("VideoEditorVideoEncoder_cleanup ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_cleanup end"); return err; } @@ -416,11 +416,11 @@ M4OSA_ERR VideoEditorVideoEncoder_init(M4ENCODER_Format format, M4ENCODER_Context* pContext, M4WRITER_DataInterface* pWriterDataInterface, M4VPP_apply_fct* pVPPfct, M4VPP_Context pVPPctxt, - M4OSA_Void* pExternalAPI, M4OSA_Void* pUserData) {
+ M4OSA_Void* pExternalAPI, M4OSA_Void* pUserData) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_init begin: format %d", format); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -446,7 +446,7 @@ cleanUp: VideoEditorVideoEncoder_cleanup(pEncoderContext); *pContext = M4OSA_NULL; LOGV("VideoEditorVideoEncoder_init ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_init end"); return err; } @@ -454,7 +454,7 @@ cleanUp: M4OSA_ERR VideoEditorVideoEncoder_init_H263(M4ENCODER_Context* pContext, M4WRITER_DataInterface* pWriterDataInterface, M4VPP_apply_fct* pVPPfct, M4VPP_Context pVPPctxt, M4OSA_Void* pExternalAPI, M4OSA_Void* pUserData) - {
+ { return VideoEditorVideoEncoder_init(M4ENCODER_kH263, pContext, pWriterDataInterface, pVPPfct, pVPPctxt, pExternalAPI, pUserData); @@ -464,7 +464,7 @@ M4OSA_ERR VideoEditorVideoEncoder_init_H263(M4ENCODER_Context* pContext, M4OSA_ERR VideoEditorVideoEncoder_init_MPEG4(M4ENCODER_Context* pContext, M4WRITER_DataInterface* pWriterDataInterface, M4VPP_apply_fct* pVPPfct, M4VPP_Context pVPPctxt, M4OSA_Void* pExternalAPI, M4OSA_Void* pUserData) - {
+ { return VideoEditorVideoEncoder_init(M4ENCODER_kMPEG4, pContext, pWriterDataInterface, pVPPfct, pVPPctxt, pExternalAPI, pUserData); @@ -474,7 +474,7 @@ M4OSA_ERR VideoEditorVideoEncoder_init_MPEG4(M4ENCODER_Context* pContext, M4OSA_ERR VideoEditorVideoEncoder_init_H264(M4ENCODER_Context* pContext, M4WRITER_DataInterface* pWriterDataInterface, M4VPP_apply_fct* pVPPfct, M4VPP_Context pVPPctxt, M4OSA_Void* pExternalAPI, M4OSA_Void* pUserData) - {
+ { return VideoEditorVideoEncoder_init(M4ENCODER_kH264, pContext, pWriterDataInterface, pVPPfct, pVPPctxt, pExternalAPI, pUserData); @@ -483,7 +483,7 @@ M4OSA_ERR VideoEditorVideoEncoder_init_H264(M4ENCODER_Context* pContext, M4OSA_ERR VideoEditorVideoEncoder_close(M4ENCODER_Context pContext) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_close begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -507,7 +507,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_close no error"); } else { LOGV("VideoEditorVideoEncoder_close ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_close end"); return err; } @@ -524,7 +524,7 @@ M4OSA_ERR VideoEditorVideoEncoder_open(M4ENCODER_Context pContext, int32_t iProfile = 0; int32_t iFrameRate = 0; uint32_t codecFlags = 0; -
+ LOGV(">>> VideoEditorVideoEncoder_open begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -664,7 +664,7 @@ cleanUp: } else { VideoEditorVideoEncoder_close(pEncoderContext); LOGV("VideoEditorVideoEncoder_open ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_open end"); return err; } @@ -679,7 +679,7 @@ M4OSA_ERR VideoEditorVideoEncoder_processInputBuffer( M4VIFI_ImagePlane pOutPlane[3]; MediaBuffer* buffer = NULL; int32_t nbBuffer = 0; -
+ LOGV("VideoEditorVideoEncoder_processInputBuffer begin: cts %f", Cts); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -765,11 +765,11 @@ cleanUp: if ( OMX_COLOR_FormatYUV420SemiPlanar == \ pEncoderContext->mEncoderColorFormat ) { // Y plane has not been allocated - if ( pOutPlane[1].pac_data ) {
- SAFE_FREE(pOutPlane[1].pac_data);
+ if ( pOutPlane[1].pac_data ) { + SAFE_FREE(pOutPlane[1].pac_data); } - if ( pOutPlane[2].pac_data ) {
- SAFE_FREE(pOutPlane[2].pac_data);
+ if ( pOutPlane[2].pac_data ) { + SAFE_FREE(pOutPlane[2].pac_data); } } if ( (M4NO_ERROR == err) || (M4WAR_SF_LOW_BUFFER == err) ) { @@ -779,7 +779,7 @@ cleanUp: buffer->release(); } LOGV("VideoEditorVideoEncoder_processInputBuffer ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_processInputBuffer end"); return err; } @@ -792,7 +792,7 @@ M4OSA_ERR VideoEditorVideoEncoder_processOutputBuffer( int32_t i32Tmp = 0; int64_t i64Tmp = 0; status_t result = OK; -
+ LOGV("VideoEditorVideoEncoder_processOutputBuffer begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -809,7 +809,6 @@ M4OSA_ERR VideoEditorVideoEncoder_processOutputBuffer( VIDEOEDITOR_CHECK(0 == ((M4OSA_UInt32)buffer->data())%4, M4ERR_PARAMETER); VIDEOEDITOR_CHECK(buffer->meta_data().get(), M4ERR_PARAMETER); if ( buffer->meta_data()->findInt32(kKeyIsCodecConfig, &i32Tmp) && i32Tmp ){ -#if 1 { // Display the DSI LOGV("VideoEditorVideoEncoder_processOutputBuffer DSI %d", buffer->range_length()); @@ -818,7 +817,6 @@ M4OSA_ERR VideoEditorVideoEncoder_processOutputBuffer( LOGV("DSI [%d] %.2X", i, tmp[i]); } } -#endif #ifndef VIDEOEDITOR_ENCODER_GET_DSI_AT_CREATION VIDEOEDITOR_CHECK(M4OSA_NULL == pEncoderContext->mHeader.pBuf, @@ -846,8 +844,8 @@ M4OSA_ERR VideoEditorVideoEncoder_processOutputBuffer( M4ERR_STATE); pEncoderContext->mNbOutputFrames++; - if ( 0 > pEncoderContext->mFirstOutputCts ) {
- pEncoderContext->mFirstOutputCts = i64Tmp;
+ if ( 0 > pEncoderContext->mFirstOutputCts ) { + pEncoderContext->mFirstOutputCts = i64Tmp; } pEncoderContext->mLastOutputCts = i64Tmp; @@ -913,9 +911,9 @@ M4OSA_ERR VideoEditorVideoEncoder_processOutputBuffer( pEncoderContext->mAccessUnit->CTS = Cts; pEncoderContext->mAccessUnit->DTS = Cts; - LOGV("VideoEditorVideoEncoder_processOutputBuffer: AU @ 0x%X 0x%X %d %d",
+ LOGV("VideoEditorVideoEncoder_processOutputBuffer: AU @ 0x%X 0x%X %d %d", pEncoderContext->mAccessUnit->dataAddress, - *pEncoderContext->mAccessUnit->dataAddress,
+ *pEncoderContext->mAccessUnit->dataAddress, pEncoderContext->mAccessUnit->size, pEncoderContext->mAccessUnit->CTS); @@ -935,7 +933,7 @@ cleanUp: SAFE_FREE(pEncoderContext->mHeader.pBuf); pEncoderContext->mHeader.Size = 0; LOGV("VideoEditorVideoEncoder_processOutputBuffer ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_processOutputBuffer end"); return err; } @@ -947,20 +945,20 @@ M4OSA_ERR VideoEditorVideoEncoder_encode(M4ENCODER_Context pContext, VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; status_t result = OK; MediaBuffer* outputBuffer = NULL; -
+ LOGV("VideoEditorVideoEncoder_encode 0x%X %f %d", pInPlane, Cts, FrameMode); VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); pEncoderContext = (VideoEditorVideoEncoder_Context*)pContext; - if ( STARTED == pEncoderContext->mState ) {
- pEncoderContext->mState = BUFFERING;
+ if ( STARTED == pEncoderContext->mState ) { + pEncoderContext->mState = BUFFERING; } VIDEOEDITOR_CHECK( (BUFFERING | READING) & pEncoderContext->mState, M4ERR_STATE); pEncoderContext->mNbInputFrames++; - if ( 0 > pEncoderContext->mFirstInputCts ) {
- pEncoderContext->mFirstInputCts = Cts;
+ if ( 0 > pEncoderContext->mFirstInputCts ) { + pEncoderContext->mFirstInputCts = Cts; } pEncoderContext->mLastInputCts = Cts; @@ -992,13 +990,13 @@ M4OSA_ERR VideoEditorVideoEncoder_encode(M4ENCODER_Context pContext, } // Read result = pEncoderContext->mEncoder->read(&outputBuffer, NULL); - if( OK != result ) {
- LOGV("VideoEditorVideoEncoder_encode: encoder returns 0x%X", result);
- }
+ if( OK != result ) { + LOGV("VideoEditorVideoEncoder_encode: encoder returns 0x%X", result); + } if( ERROR_END_OF_STREAM == result ) { - if( outputBuffer != NULL ) {
- LOGV("VideoEditorVideoEncoder_encode : EOS w/ buffer");
+ if( outputBuffer != NULL ) { + LOGV("VideoEditorVideoEncoder_encode : EOS w/ buffer"); } VIDEOEDITOR_CHECK(0 == VIDEOEDITOR_MIN_BUFFER_NB, M4ERR_STATE); // No output provided here, just exit @@ -1017,7 +1015,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_encode no error"); } else { LOGV("VideoEditorVideoEncoder_encode ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_encode end"); return err; } @@ -1026,7 +1024,7 @@ M4OSA_ERR VideoEditorVideoEncoder_start(M4ENCODER_Context pContext) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; status_t result = OK; -
+ LOGV("VideoEditorVideoEncoder_start begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -1052,7 +1050,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_start no error"); } else { LOGV("VideoEditorVideoEncoder_start ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_start end"); return err; } @@ -1062,7 +1060,7 @@ M4OSA_ERR VideoEditorVideoEncoder_stop(M4ENCODER_Context pContext) { VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; MediaBuffer* outputBuffer = NULL; status_t result = OK; -
+ LOGV("VideoEditorVideoEncoder_stop begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -1102,7 +1100,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_stop no error"); } else { LOGV("VideoEditorVideoEncoder_stop ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_stop end"); return err; } @@ -1110,7 +1108,7 @@ cleanUp: M4OSA_ERR VideoEditorVideoEncoder_regulBitRate(M4ENCODER_Context pContext) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_regulBitRate begin"); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -1123,7 +1121,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_regulBitRate no error"); } else { LOGV("VideoEditorVideoEncoder_regulBitRate ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_regulBitRate end"); return err; } @@ -1132,7 +1130,7 @@ M4OSA_ERR VideoEditorVideoEncoder_setOption(M4ENCODER_Context pContext, M4OSA_UInt32 optionID, M4OSA_DataOption optionValue) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_setOption start optionID 0x%X", optionID); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -1160,7 +1158,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_setOption no error"); } else { LOGV("VideoEditorVideoEncoder_setOption ERROR 0x%X", err); - }
+ } LOGV("VideoEditorVideoEncoder_setOption end"); return err; } @@ -1169,7 +1167,7 @@ M4OSA_ERR VideoEditorVideoEncoder_getOption(M4ENCODER_Context pContext, M4OSA_UInt32 optionID, M4OSA_DataOption optionValue) { M4OSA_ERR err = M4NO_ERROR; VideoEditorVideoEncoder_Context* pEncoderContext = M4OSA_NULL; -
+ LOGV("VideoEditorVideoEncoder_getOption begin optinId 0x%X", optionID); // Input parameters check VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER); @@ -1195,7 +1193,7 @@ cleanUp: LOGV("VideoEditorVideoEncoder_getOption ERROR 0x%X", err); } return err; -}
+} M4OSA_ERR VideoEditorVideoEncoder_getInterface(M4ENCODER_Format format, M4ENCODER_Format* pFormat, @@ -1215,23 +1213,23 @@ M4OSA_ERR VideoEditorVideoEncoder_getInterface(M4ENCODER_Format format, *pFormat = format; switch( format ) { - case M4ENCODER_kH263:
- {
+ case M4ENCODER_kH263: + { (*pEncoderInterface)->pFctInit = - VideoEditorVideoEncoder_init_H263;
- break;
+ VideoEditorVideoEncoder_init_H263; + break; } - case M4ENCODER_kMPEG4:
- {
+ case M4ENCODER_kMPEG4: + { (*pEncoderInterface)->pFctInit = - VideoEditorVideoEncoder_init_MPEG4;
- break;
+ VideoEditorVideoEncoder_init_MPEG4; + break; } - case M4ENCODER_kH264:
- {
+ case M4ENCODER_kH264: + { (*pEncoderInterface)->pFctInit = - VideoEditorVideoEncoder_init_H264;
- break;
+ VideoEditorVideoEncoder_init_H264; + break; } default: LOGV("VideoEditorVideoEncoder_getInterface : unsupported format %d", diff --git a/libvideoeditor/vss/video_filters/src/M4VFL_transition.c b/libvideoeditor/vss/video_filters/src/M4VFL_transition.c index d63c7a5..62fff27 100755 --- a/libvideoeditor/vss/video_filters/src/M4VFL_transition.c +++ b/libvideoeditor/vss/video_filters/src/M4VFL_transition.c @@ -41,7 +41,6 @@ unsigned char M4VFL_modifyLumaByStep(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, M4VFL_ModifLumParam *lum_param, void *user_data) { -#if 1 unsigned short *p_src, *p_dest, *p_src_line, *p_dest_line; unsigned long pix_src; unsigned long u_outpx, u_outpx2; @@ -121,82 +120,6 @@ unsigned char M4VFL_modifyLumaByStep(M4ViComImagePlane *plane_in, M4ViComImagePl p_dest_line += u_stride_out; p_src_line += u_stride; } -#else /* if 0 */ - unsigned char *p_src, *p_dest, *p_src_line, *p_dest_line; - unsigned long u_width, u_stride, u_stride_out,u_height, pix; - unsigned long lf1, lf2, lf3; - long i, j; - - u_width = plane_in[0].u_width; - u_height = plane_in[0].u_height; - u_stride = (plane_in[0].u_stride); - u_stride_out = (plane_out[0].u_stride); - p_dest = (unsigned char *) &plane_out[0].pac_data[plane_out[0].u_topleft]; - p_src = (unsigned char *) &plane_in[0].pac_data[plane_in[0].u_topleft]; - p_dest_line = p_dest; - p_src_line = p_src; - - switch(lum_param->lum_factor) - { - case 0: - /* very specific case : set luma plane to 16 */ - for (j = u_height; j != 0; j--) - { - memset((void *)p_dest, 16,u_width); - p_dest += u_stride_out; - } - return 0; - - case 1: - /* 0.25 */ - lf1 = 6; lf2 = 6; lf3 = 7; - break; - case 2: - /* 0.375 */ - lf1 = 7; lf2 = 7; lf3 = 7; - break; - case 3: - /* 0.5 */ - lf1 = 7; lf2 = 7; lf3 = 8; - break; - case 4: - /* 0.625 */ - lf1 = 7; lf2 = 8; lf3 = 8; - break; - case 5: - /* 0.75 */ - lf1 = 8; lf2 = 8; lf3 = 8; - break; - case 6: - /* 0.875 */ - lf1 = 9; lf2 = 8; lf3 = 7; - break; - default: - lf1 = 8; lf2 = 8; lf3 = 9; - break; - } - - if (lum_param->copy_chroma != 0) - { - /* copy chroma plane */ - - } - - - for (j = u_height; j != 0; j--) - { - p_dest = p_dest_line; - p_src = p_src_line; - for (i = (u_width); i != 0; i--) - { - pix = (unsigned long) *p_src++; - *p_dest++ = (unsigned char) (((pix << lf1) + (pix << lf2) + (pix << lf3) ) >>\ - LUM_FACTOR_MAX); - } - p_dest_line += u_stride_out; - p_src_line += u_stride; - } -#endif /* if 0 */ return 0; } |