diff options
author | Santosh Madhava <smadhava@google.com> | 2011-02-17 19:09:39 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-17 19:09:39 -0800 |
commit | 7e006bd24cccffb9c9fd48fd3b2709b6639bc5f1 (patch) | |
tree | cf3c922e29f8df4c21e816ac1d3b5a240ac6f56f /libvideoeditor | |
parent | f84f29a3b43d903989f10288bfd3934d446228b3 (diff) | |
parent | b2d6e0f74a12e5cce5b429e646172c63346346c3 (diff) | |
download | frameworks_av-7e006bd24cccffb9c9fd48fd3b2709b6639bc5f1.zip frameworks_av-7e006bd24cccffb9c9fd48fd3b2709b6639bc5f1.tar.gz frameworks_av-7e006bd24cccffb9c9fd48fd3b2709b6639bc5f1.tar.bz2 |
Merge "Fix for issue 3439595 : Movie studio playback previous frames"
Diffstat (limited to 'libvideoeditor')
-rw-r--r-- | libvideoeditor/lvpp/PreviewPlayer.cpp | 57 | ||||
-rw-r--r-- | libvideoeditor/lvpp/PreviewPlayer.h | 2 | ||||
-rwxr-xr-x | libvideoeditor/lvpp/VideoEditorPlayer.cpp | 5 | ||||
-rwxr-xr-x | libvideoeditor/lvpp/VideoEditorPlayer.h | 2 | ||||
-rwxr-xr-x | libvideoeditor/lvpp/VideoEditorPreviewController.cpp | 14 | ||||
-rwxr-xr-x | libvideoeditor/lvpp/VideoEditorPreviewController.h | 3 |
6 files changed, 62 insertions, 21 deletions
diff --git a/libvideoeditor/lvpp/PreviewPlayer.cpp b/libvideoeditor/lvpp/PreviewPlayer.cpp index 9bae14a..d6233fa 100644 --- a/libvideoeditor/lvpp/PreviewPlayer.cpp +++ b/libvideoeditor/lvpp/PreviewPlayer.cpp @@ -830,6 +830,8 @@ void PreviewPlayer::onVideoEvent() { mFlags |= VIDEO_AT_EOS; mOverlayUpdateEventPosted = false; postStreamDoneEvent_l(err); + // Set the last decoded timestamp to duration + mDecodedVideoTs = (mPlayEndTimeMsec*1000); return; } @@ -845,14 +847,23 @@ void PreviewPlayer::onVideoEvent() { int64_t videoTimeUs; CHECK(mVideoBuffer->meta_data()->findInt64(kKeyTime, &videoTimeUs)); - if((videoTimeUs/1000) < mPlayBeginTimeMsec) { - // Frames are before begin cut time - // Donot render - mVideoBuffer->release(); - mVideoBuffer = NULL; - continue; + if (mSeeking) { + if (videoTimeUs < mSeekTimeUs) { + // buffers are before seek time + // ignore them + mVideoBuffer->release(); + mVideoBuffer = NULL; + continue; + } + } else { + if((videoTimeUs/1000) < mPlayBeginTimeMsec) { + // Frames are before begin cut time + // Donot render + mVideoBuffer->release(); + mVideoBuffer = NULL; + continue; + } } - break; } } @@ -867,7 +878,6 @@ void PreviewPlayer::onVideoEvent() { mVideoTimeUs = timeUs; } - mDecodedVideoTs = timeUs; if(!mStartNextPlayer) { int64_t playbackTimeRemaining = (mPlayEndTimeMsec*1000) - timeUs; @@ -966,6 +976,8 @@ void PreviewPlayer::onVideoEvent() { postStreamDoneEvent_l(ERROR_END_OF_STREAM); return; } + // Capture the frame timestamp to be rendered + mDecodedVideoTs = timeUs; // Post processing to apply video effects for(i=0;i<mNumberEffects;i++) { @@ -1821,15 +1833,23 @@ status_t PreviewPlayer::readFirstVideoFrame() { int64_t videoTimeUs; CHECK(mVideoBuffer->meta_data()->findInt64(kKeyTime, &videoTimeUs)); - - if((videoTimeUs/1000) < mPlayBeginTimeMsec) { - // buffers are before begin cut time - // ignore them - mVideoBuffer->release(); - mVideoBuffer = NULL; - continue; + if (mSeeking) { + if (videoTimeUs < mSeekTimeUs) { + // buffers are before seek time + // ignore them + mVideoBuffer->release(); + mVideoBuffer = NULL; + continue; + } + } else { + if((videoTimeUs/1000) < mPlayBeginTimeMsec) { + // buffers are before begin cut time + // ignore them + mVideoBuffer->release(); + mVideoBuffer = NULL; + continue; + } } - break; } } @@ -1848,4 +1868,9 @@ status_t PreviewPlayer::readFirstVideoFrame() { } +status_t PreviewPlayer::getLastRenderedTimeMs(uint32_t *lastRenderedTimeMs) { + *lastRenderedTimeMs = (((mDecodedVideoTs+mDecVideoTsStoryBoard)/1000)-mPlayBeginTimeMsec); + return OK; +} + } // namespace android diff --git a/libvideoeditor/lvpp/PreviewPlayer.h b/libvideoeditor/lvpp/PreviewPlayer.h index dceffab..4d3a312 100644 --- a/libvideoeditor/lvpp/PreviewPlayer.h +++ b/libvideoeditor/lvpp/PreviewPlayer.h @@ -92,7 +92,7 @@ struct PreviewPlayer : public AwesomePlayer { status_t resetJniCallbackTimeStamp(); status_t setImageClipProperties(uint32_t width, uint32_t height); status_t readFirstVideoFrame(); - + status_t getLastRenderedTimeMs(uint32_t *lastRenderedTimeMs); private: friend struct PreviewPlayerEvent; diff --git a/libvideoeditor/lvpp/VideoEditorPlayer.cpp b/libvideoeditor/lvpp/VideoEditorPlayer.cpp index 7df6669..ab2bb67 100755 --- a/libvideoeditor/lvpp/VideoEditorPlayer.cpp +++ b/libvideoeditor/lvpp/VideoEditorPlayer.cpp @@ -277,6 +277,11 @@ status_t VideoEditorPlayer::readFirstVideoFrame() { return mPlayer->readFirstVideoFrame();
}
+status_t VideoEditorPlayer::getLastRenderedTimeMs(uint32_t *lastRenderedTimeMs) {
+ mPlayer->getLastRenderedTimeMs(lastRenderedTimeMs);
+ return NO_ERROR;
+}
+
/* Implementation of AudioSink interface */
#undef LOG_TAG
#define LOG_TAG "VeAudioSink"
diff --git a/libvideoeditor/lvpp/VideoEditorPlayer.h b/libvideoeditor/lvpp/VideoEditorPlayer.h index 47d174d..c61e33a 100755 --- a/libvideoeditor/lvpp/VideoEditorPlayer.h +++ b/libvideoeditor/lvpp/VideoEditorPlayer.h @@ -142,7 +142,7 @@ public: virtual status_t resetJniCallbackTimeStamp();
virtual status_t setImageClipProperties(uint32_t width, uint32_t height);
virtual status_t readFirstVideoFrame();
-
+ virtual status_t getLastRenderedTimeMs(uint32_t *lastRenderedTimeMs);
private:
PreviewPlayer *mPlayer;
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp index e6f6052..830648a 100755 --- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp +++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp @@ -25,6 +25,7 @@ namespace android { VideoEditorPreviewController::VideoEditorPreviewController()
: mCurrentPlayer(0),
+ mActivePlayerIndex(0),
mThreadContext(NULL),
mPlayerState(VePlayerIdle),
mPrepareReqest(M4OSA_FALSE),
@@ -550,6 +551,7 @@ M4OSA_ERR VideoEditorPreviewController::startPreview( // Start playing with player instance 0
mCurrentPlayer = 0;
+ mActivePlayerIndex = 0;
if(toMs == -1) {
LOGV("startPreview: Preview till end of storyboard");
@@ -622,8 +624,9 @@ M4OSA_ERR VideoEditorPreviewController::startPreview( return M4NO_ERROR;
}
-M4OSA_ERR VideoEditorPreviewController::stopPreview() {
+M4OSA_UInt32 VideoEditorPreviewController::stopPreview() {
M4OSA_ERR err = M4NO_ERROR;
+ uint32_t lastRenderedFrameTimeMs = 0;
LOGV("stopPreview");
// Stop the thread
@@ -658,6 +661,10 @@ M4OSA_ERR VideoEditorPreviewController::stopPreview() { LOGV("stop the player first");
mVePlayer[playerInst]->stop();
}
+ if (playerInst == mActivePlayerIndex) {
+ // Return the last rendered frame time stamp
+ mVePlayer[mActivePlayerIndex]->getLastRenderedTimeMs(&lastRenderedFrameTimeMs);
+ }
LOGV("stopPreview: clearing mVePlayer");
mVePlayer[playerInst].clear();
@@ -685,7 +692,8 @@ M4OSA_ERR VideoEditorPreviewController::stopPreview() { mOutputVideoWidth = 0;
mOutputVideoHeight = 0;
- return M4NO_ERROR;
+ LOGV("stopPreview() lastRenderedFrameTimeMs %ld", lastRenderedFrameTimeMs);
+ return lastRenderedFrameTimeMs;
}
M4OSA_ERR VideoEditorPreviewController::clearSurface(
@@ -1065,6 +1073,8 @@ M4OSA_ERR VideoEditorPreviewController::threadProc(M4OSA_Void* param) { pController->mClipList[index]->uiBeginCutTime,
pController->mClipList[index]->ClipProperties.uiClipAudioVolumePercentage);
}
+ // Capture the active player being used
+ pController->mActivePlayerIndex = pController->mCurrentPlayer;
pController->mVePlayer[pController->mCurrentPlayer]->start();
LOGV("threadProc: started");
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.h b/libvideoeditor/lvpp/VideoEditorPreviewController.h index be40c7c..216b077 100755 --- a/libvideoeditor/lvpp/VideoEditorPreviewController.h +++ b/libvideoeditor/lvpp/VideoEditorPreviewController.h @@ -74,7 +74,7 @@ public: M4OSA_ERR startPreview(M4OSA_UInt32 fromMS, M4OSA_Int32 toMs,
M4OSA_UInt16 callBackAfterFrameCount, M4OSA_Bool loop) ;
- M4OSA_ERR stopPreview();
+ M4OSA_UInt32 stopPreview();
M4OSA_ERR renderPreviewFrame(const sp<Surface> &surface,
VideoEditor_renderPreviewFrameStr* pFrameInfo,
@@ -122,6 +122,7 @@ private: M4OSA_UInt32 mLastPreviewClipEndTime;
M4OSA_UInt32 mVideoStoryBoardTimeMsUptoFirstPreviewClip;
OverlayState mOverlayState;
+ int mActivePlayerIndex;
M4xVSS_MediaRendering mRenderingMode;
uint32_t mOutputVideoWidth;
|