diff options
author | James Dong <jdong@google.com> | 2011-05-13 16:31:10 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-13 16:31:10 -0700 |
commit | 9b1e4f1a18ac2489e24b4272a0a7ccfd0018efcc (patch) | |
tree | d8af67ab7fa0bbc023a6c01709cda812e6959830 | |
parent | 07b1bb529a1ae76c46a71b01338c166f9490629d (diff) | |
parent | 0f056290cb16763453f18bbef80cde673041dbbc (diff) | |
download | frameworks_av-9b1e4f1a18ac2489e24b4272a0a7ccfd0018efcc.zip frameworks_av-9b1e4f1a18ac2489e24b4272a0a7ccfd0018efcc.tar.gz frameworks_av-9b1e4f1a18ac2489e24b4272a0a7ccfd0018efcc.tar.bz2 |
Merge "Add support for platform-specific recording start time offset"
-rw-r--r-- | include/media/MediaProfiles.h | 9 | ||||
-rw-r--r-- | media/libmedia/MediaProfiles.cpp | 23 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h index f2107ec..ed26e63 100644 --- a/include/media/MediaProfiles.h +++ b/include/media/MediaProfiles.h @@ -150,6 +150,12 @@ public: */ Vector<int> getImageEncodingQualityLevels(int cameraId) const; + /** + * Returns the start time offset (in ms) for the given camera Id. + * If the given camera Id does not exist, -1 will be returned. + */ + int getStartTimeOffsetMs(int cameraId) const; + private: enum { // Camcorder profiles (high/low) and timelapse profiles (high/low) @@ -332,6 +338,8 @@ private: static int getCameraId(const char **atts); + void addStartTimeOffset(int cameraId, const char **atts); + ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const; void addImageEncodingQualityLevel(int cameraId, const char** atts); @@ -408,6 +416,7 @@ private: Vector<VideoDecoderCap*> mVideoDecoders; Vector<output_format> mEncoderOutputFileFormats; Vector<ImageEncodingQualityLevels *> mImageEncodingQualityLevels; + KeyedVector<int, int> mStartTimeOffsets; typedef struct { bool mHasRefProfile; // Refers to an existing profile diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index e6f3a33..069bbb7 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -356,6 +356,18 @@ MediaProfiles::getCameraId(const char** atts) return atoi(atts[1]); } +void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts) +{ + int offsetTimeMs = 700; + if (atts[2]) { + CHECK(!strcmp("startOffsetMs", atts[2])); + offsetTimeMs = atoi(atts[3]); + } + + LOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs); + mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs); +} + /*static*/ void MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts) { @@ -380,6 +392,7 @@ MediaProfiles::startElementHandler(void *userData, const char *name, const char profiles->mEncoderOutputFileFormats.add(createEncoderOutputFileFormat(atts)); } else if (strcmp("CamcorderProfiles", name) == 0) { profiles->mCurrentCameraId = getCameraId(atts); + profiles->addStartTimeOffset(profiles->mCurrentCameraId, atts); } else if (strcmp("EncoderProfile", name) == 0) { profiles->mCamcorderProfiles.add( createCamcorderProfile(profiles->mCurrentCameraId, atts, profiles->mCameraIds)); @@ -997,6 +1010,16 @@ Vector<int> MediaProfiles::getImageEncodingQualityLevels(int cameraId) const return result; } +int MediaProfiles::getStartTimeOffsetMs(int cameraId) const { + int offsetTimeMs = -1; + ssize_t index = mStartTimeOffsets.indexOfKey(cameraId); + if (index >= 0) { + offsetTimeMs = mStartTimeOffsets.valueFor(cameraId); + } + LOGV("%s: offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId); + return offsetTimeMs; +} + MediaProfiles::~MediaProfiles() { CHECK("destructor should never be called" == 0); |