diff options
author | Chong Zhang <chz@google.com> | 2014-02-11 13:54:59 -0800 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-02-14 17:42:47 -0800 |
commit | 2c9c8cba8562cc3a27532e4cd348912cc78d8d98 (patch) | |
tree | dab3690baff0f03f604a41321281ce2f39167272 /media/libstagefright/ACodec.cpp | |
parent | b63d2433350d56bda9f3477549086c90bb6d535e (diff) | |
download | frameworks_av-2c9c8cba8562cc3a27532e4cd348912cc78d8d98.zip frameworks_av-2c9c8cba8562cc3a27532e4cd348912cc78d8d98.tar.gz frameworks_av-2c9c8cba8562cc3a27532e4cd348912cc78d8d98.tar.bz2 |
support for time lapse/slow motion when using SURFACE source
Bug: 13032650
Change-Id: Iecbadf9f29c8c49353416fc467fb3acdde279595
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index f2354b4..3d5b3b3 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -374,7 +374,9 @@ ACodec::ACodec() mStoreMetaDataInOutputBuffers(false), mMetaDataBuffersToSubmit(0), mRepeatFrameDelayUs(-1ll), - mMaxPtsGapUs(-1l), + mMaxPtsGapUs(-1ll), + mTimePerCaptureUs(-1ll), + mTimePerFrameUs(-1ll), mCreateInputBuffersSuspended(false) { mUninitializedState = new UninitializedState(this); mLoadedState = new LoadedState(this); @@ -1119,7 +1121,11 @@ status_t ACodec::configureCodec( } if (!msg->findInt64("max-pts-gap-to-encoder", &mMaxPtsGapUs)) { - mMaxPtsGapUs = -1l; + mMaxPtsGapUs = -1ll; + } + + if (!msg->findInt64("time-lapse", &mTimePerCaptureUs)) { + mTimePerCaptureUs = -1ll; } if (!msg->findInt32( @@ -1916,6 +1922,7 @@ status_t ACodec::setupVideoEncoder(const char *mime, const sp<AMessage> &msg) { return INVALID_OPERATION; } frameRate = (float)tmp; + mTimePerFrameUs = (int64_t) (1000000.0f / frameRate); } video_def->xFramerate = (OMX_U32)(frameRate * 65536.0f); @@ -3938,7 +3945,7 @@ void ACodec::LoadedState::onCreateInputSurface( } } - if (err == OK && mCodec->mMaxPtsGapUs > 0l) { + if (err == OK && mCodec->mMaxPtsGapUs > 0ll) { err = mCodec->mOMX->setInternalOption( mCodec->mNode, kPortIndexInput, @@ -3950,8 +3957,27 @@ void ACodec::LoadedState::onCreateInputSurface( ALOGE("[%s] Unable to configure max timestamp gap (err %d)", mCodec->mComponentName.c_str(), err); - } - } + } + } + + if (err == OK && mCodec->mTimePerCaptureUs > 0ll + && mCodec->mTimePerFrameUs > 0ll) { + int64_t timeLapse[2]; + timeLapse[0] = mCodec->mTimePerFrameUs; + timeLapse[1] = mCodec->mTimePerCaptureUs; + err = mCodec->mOMX->setInternalOption( + mCodec->mNode, + kPortIndexInput, + IOMX::INTERNAL_OPTION_TIME_LAPSE, + &timeLapse[0], + sizeof(timeLapse)); + + if (err != OK) { + ALOGE("[%s] Unable to configure time lapse (err %d)", + mCodec->mComponentName.c_str(), + err); + } + } if (err == OK && mCodec->mCreateInputBuffersSuspended) { bool suspend = true; |