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 /libvideoeditor/vss/mcs | |
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
Diffstat (limited to 'libvideoeditor/vss/mcs')
-rwxr-xr-x | libvideoeditor/vss/mcs/inc/M4MCS_API.h | 107 | ||||
-rwxr-xr-x | libvideoeditor/vss/mcs/inc/M4MCS_InternalFunctions.h | 25 | ||||
-rwxr-xr-x | libvideoeditor/vss/mcs/inc/M4MCS_InternalTypes.h | 29 | ||||
-rwxr-xr-x | libvideoeditor/vss/mcs/src/Android.mk | 1 | ||||
-rwxr-xr-x | libvideoeditor/vss/mcs/src/M4MCS_API.c | 522 |
5 files changed, 0 insertions, 684 deletions
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; -} |