summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmedia/jni/mediaeditor/VideoBrowserMain.c46
-rwxr-xr-xmedia/jni/mediaeditor/VideoBrowserMain.h3
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp9
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorThumbnailMain.cpp17
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorThumbnailMain.h6
5 files changed, 28 insertions, 53 deletions
diff --git a/media/jni/mediaeditor/VideoBrowserMain.c b/media/jni/mediaeditor/VideoBrowserMain.c
index 6ef688d1f2ff..2de55e311422 100755
--- a/media/jni/mediaeditor/VideoBrowserMain.c
+++ b/media/jni/mediaeditor/VideoBrowserMain.c
@@ -258,6 +258,7 @@ M4OSA_ERR videoBrowserCreate(
err = pContext->m_pDecoder->m_pFctCreate(
&pContext->m_pDecoderCtx,
pContext->m_pStreamHandler,
+ pContext->m_3gpReader,
pContext->m_3gpData,
&pContext->m_accessUnit,
pContext->m_pCodecLoaderContext) ;
@@ -284,6 +285,7 @@ M4OSA_ERR videoBrowserCreate(
err = pContext->m_pDecoder->m_pFctCreate(
&pContext->m_pDecoderCtx,
pContext->m_pStreamHandler,
+ pContext->m_3gpReader,
pContext->m_3gpData,
&pContext->m_accessUnit,
pContext->m_pCodecLoaderContext) ;
@@ -435,9 +437,12 @@ videoBrowserCleanUp_cleanUp:
* @param pContext (IN) : Video browser context
* @param pTime (IN/OUT) : Pointer on the time to reach. Updated
* by this function with the reached time
+* @param tolerance (IN) : We may decode an earlier frame within the tolerance.
+* The time difference is specified in milliseconds.
* @return M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
******************************************************************************/
-M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime)
+M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime,
+ M4OSA_UInt32 tolerance)
{
VideoBrowserContext* pC = (VideoBrowserContext*)pContext;
M4OSA_ERR err = M4NO_ERROR;
@@ -481,52 +486,15 @@ M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime)
bJumpNeeded = M4OSA_TRUE;
}
- if (M4OSA_TRUE == bJumpNeeded)
- {
- rapTime = targetTime;
- /*--- Retrieve the previous RAP time ---*/
- err = pC->m_3gpReader->m_pFctGetPrevRapTime(
- pC->m_pReaderCtx, pC->m_pStreamHandler, &rapTime);
-
- CHECK_ERR(videoBrowserPrepareFrame, err);
-
- jumpTime = rapTime;
-
- err = pC->m_3gpReader->m_pFctJump(pC->m_pReaderCtx,
- pC->m_pStreamHandler,
- (M4OSA_Int32*)&jumpTime);
- CHECK_ERR(videoBrowserPrepareFrame, err);
- }
-
timeMS = (M4_MediaTime)targetTime;
err = pC->m_pDecoder->m_pFctDecode(
- pC->m_pDecoderCtx, &timeMS, bJumpNeeded);
+ pC->m_pDecoderCtx, &timeMS, bJumpNeeded, tolerance);
if ((err != M4NO_ERROR) && (err != M4WAR_NO_MORE_AU))
{
return err;
}
- // FIXME:
- // Not sure that I understand why we need a second jump logic here
- if ((timeMS >= pC->m_currentCTS) && (M4OSA_TRUE == isBackward))
- {
- jumpTime = rapTime;
- err = pC->m_3gpReader->m_pFctJump(
- pC->m_pReaderCtx, pC->m_pStreamHandler, (M4OSA_Int32*)&jumpTime);
-
- CHECK_ERR(videoBrowserPrepareFrame, err);
-
- timeMS = (M4_MediaTime)rapTime;
- err = pC->m_pDecoder->m_pFctDecode(
- pC->m_pDecoderCtx, &timeMS, M4OSA_TRUE);
-
- if ((err != M4NO_ERROR) && (err != M4WAR_NO_MORE_AU))
- {
- return err;
- }
- }
-
err = pC->m_pDecoder->m_pFctRender(
pC->m_pDecoderCtx, &timeMS, pC->m_outputPlane, M4OSA_TRUE);
diff --git a/media/jni/mediaeditor/VideoBrowserMain.h b/media/jni/mediaeditor/VideoBrowserMain.h
index 5156ebb2ff50..00b5e050a232 100755
--- a/media/jni/mediaeditor/VideoBrowserMain.h
+++ b/media/jni/mediaeditor/VideoBrowserMain.h
@@ -133,7 +133,8 @@ M4OSA_ERR videoBrowserCleanUp(M4OSA_Context pContext) ;
* this function with the reached time
* @return M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
******************************************************************************/
-M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime);
+M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime,
+ M4OSA_UInt32 tolerance);
/******************************************************************************
* @brief This function sets the size and the position of the display.
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index c95a0c25c13a..14972a2f7623 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -763,7 +763,7 @@ static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,
ClipProperties.uiVideoWidth,
pContext->pEditSettings->pClipList[iCurrentClipIndex]->\
ClipProperties.uiVideoHeight,
- &tnTimeMs);
+ &tnTimeMs, 0);
if (result != M4NO_ERROR) {
free(pixelArray);
ThumbnailClose(tnContext);
@@ -991,7 +991,7 @@ static int videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
result = ThumbnailGetPixels16(tnContext, (M4OSA_Int16 *)pixelArray,
frameWidth,
- frameHeight, &timeMs);
+ frameHeight, &timeMs, 0);
if (result != M4NO_ERROR) {
free(pixelArray);
ThumbnailClose(tnContext);
@@ -2132,7 +2132,7 @@ static int videoEditor_getPixels(
m_dst32 = env->GetIntArrayElements(pixelArray, NULL);
- err = ThumbnailGetPixels32(mContext, (M4OSA_Int32 *)m_dst32, width,height,&timeMS);
+ err = ThumbnailGetPixels32(mContext, (M4OSA_Int32 *)m_dst32, width,height,&timeMS,0);
if (err != M4NO_ERROR ) {
if (env != NULL) {
jniThrowException(env, "java/lang/RuntimeException",\
@@ -2194,9 +2194,10 @@ static int videoEditor_getPixelsList(
m_dst32 = env->GetIntArrayElements(pixelArray, NULL);
+ M4OSA_UInt32 tolerance = deltatimeMS / 2;
do {
err = ThumbnailGetPixels32(mContext, ((M4OSA_Int32 *)m_dst32 + arrayOffset),
- width,height,&timeMS);
+ width,height,&timeMS, tolerance);
if (err != M4NO_ERROR ) {
if (env != NULL) {
jniThrowException(env, "java/lang/RuntimeException",\
diff --git a/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp b/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
index fe3734f3c839..1508246361aa 100755
--- a/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
@@ -74,7 +74,7 @@ typedef struct
M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray,
M4OSA_UInt32 width, M4OSA_UInt32 height,
- M4OSA_UInt32* pTimeMS);
+ M4OSA_UInt32* pTimeMS, M4OSA_UInt32 tolerance);
/**
@@ -219,7 +219,7 @@ ThumbnailOpen_cleanUp:
M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray,
M4OSA_UInt32 width, M4OSA_UInt32 height,
- M4OSA_UInt32* pTimeMS)
+ M4OSA_UInt32* pTimeMS, M4OSA_UInt32 tolerance)
{
M4OSA_ERR err;
@@ -249,7 +249,7 @@ M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
pC->m_previousTime = *pTimeMS;
}
- err = videoBrowserPrepareFrame(pC->m_pVideoBrowser, pTimeMS);
+ err = videoBrowserPrepareFrame(pC->m_pVideoBrowser, pTimeMS, tolerance);
CHECK_ERR(ThumbnailGetPixels, err);
if (pC->m_bRender != M4OSA_TRUE) {
@@ -264,7 +264,8 @@ ThumbnailGetPixels_cleanUp:
M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32* timeMS)
+ M4OSA_UInt32 height, M4OSA_UInt32* timeMS,
+ M4OSA_UInt32 tolerance)
{
M4OSA_ERR err = M4NO_ERROR;
@@ -277,7 +278,7 @@ M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
pC->m_dst16 = NULL;
pC->m_dst32 = pixelArray;
- err = ThumbnailGetPixels(pContext, pixelArray, width, height, timeMS);
+ err = ThumbnailGetPixels(pContext, pixelArray, width, height, timeMS, tolerance);
ThumbnailGetPixels32_cleanUp:
@@ -286,7 +287,8 @@ ThumbnailGetPixels32_cleanUp:
M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
M4OSA_Int16* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32* timeMS)
+ M4OSA_UInt32 height, M4OSA_UInt32* timeMS,
+ M4OSA_UInt32 tolerance)
{
M4OSA_ERR err = M4NO_ERROR;
@@ -298,7 +300,8 @@ M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
pC->m_dst16 = pixelArray;
pC->m_dst32 = NULL;
- err = ThumbnailGetPixels(pContext, (M4OSA_Int32*)pixelArray, width, height, timeMS);
+ err = ThumbnailGetPixels(pContext, (M4OSA_Int32*)pixelArray, width, height,
+ timeMS, tolerance);
ThumbnailGetPixels16_cleanUp:
diff --git a/media/jni/mediaeditor/VideoEditorThumbnailMain.h b/media/jni/mediaeditor/VideoEditorThumbnailMain.h
index 14c60dd6de21..0b3b0c8a8211 100755
--- a/media/jni/mediaeditor/VideoEditorThumbnailMain.h
+++ b/media/jni/mediaeditor/VideoEditorThumbnailMain.h
@@ -49,7 +49,8 @@ M4OSA_ERR ThumbnailOpen(M4OSA_Context *pPContext,
*/
M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32 *timeMS);
+ M4OSA_UInt32 height, M4OSA_UInt32 *timeMS,
+ M4OSA_UInt32 tolerance);
/**
************************************************************************
@@ -63,7 +64,8 @@ M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
*/
M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
M4OSA_Int16* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32 *timeMS);
+ M4OSA_UInt32 height, M4OSA_UInt32 *timeMS,
+ M4OSA_UInt32 tolerance);
/**
************************************************************************