summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-06-29 16:56:52 -0700
committerJames Dong <jdong@google.com>2011-07-24 10:33:54 -0700
commit3cecf640c4daf2df616b278bd9986018c8182908 (patch)
tree0a9a7306e8a13af5a7149471569ca73827449aee /media/libmediaplayerservice
parent77882a8deb5167235ae591e49c9dcff9abb373c1 (diff)
downloadframeworks_av-3cecf640c4daf2df616b278bd9986018c8182908.zip
frameworks_av-3cecf640c4daf2df616b278bd9986018c8182908.tar.gz
frameworks_av-3cecf640c4daf2df616b278bd9986018c8182908.tar.bz2
Do not support still image capture mode for timelapse video recording
related-to-bug: 4973779 Change-Id: Ica665217ab10247b2242acc4e93d4fe9f83e3f45
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/MediaRecorderClient.cpp11
-rw-r--r--media/libmediaplayerservice/MediaRecorderClient.h1
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp177
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.h15
4 files changed, 7 insertions, 197 deletions
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index 905b885..6f80b35 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -178,17 +178,6 @@ status_t MediaRecorderClient::setOutputFile(int fd, int64_t offset, int64_t leng
return mRecorder->setOutputFile(fd, offset, length);
}
-status_t MediaRecorderClient::setOutputFileAuxiliary(int fd)
-{
- LOGV("setOutputFileAuxiliary(%d)", fd);
- Mutex::Autolock lock(mLock);
- if (mRecorder == NULL) {
- LOGE("recorder is not initialized");
- return NO_INIT;
- }
- return mRecorder->setOutputFileAuxiliary(fd);
-}
-
status_t MediaRecorderClient::setVideoSize(int width, int height)
{
LOGV("setVideoSize(%dx%d)", width, height);
diff --git a/media/libmediaplayerservice/MediaRecorderClient.h b/media/libmediaplayerservice/MediaRecorderClient.h
index c87a3c0..c9ccf22 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.h
+++ b/media/libmediaplayerservice/MediaRecorderClient.h
@@ -41,7 +41,6 @@ public:
virtual status_t setOutputFile(const char* path);
virtual status_t setOutputFile(int fd, int64_t offset,
int64_t length);
- virtual status_t setOutputFileAuxiliary(int fd);
virtual status_t setVideoSize(int width, int height);
virtual status_t setVideoFrameRate(int frames_per_second);
virtual status_t setParameters(const String8& params);
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 6427bb7..6fdb726 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -28,9 +28,7 @@
#include <media/stagefright/AMRWriter.h>
#include <media/stagefright/AACWriter.h>
#include <media/stagefright/CameraSource.h>
-#include <media/stagefright/VideoSourceDownSampler.h>
#include <media/stagefright/CameraSourceTimeLapse.h>
-#include <media/stagefright/MediaSourceSplitter.h>
#include <media/stagefright/MPEG2TSWriter.h>
#include <media/stagefright/MPEG4Writer.h>
#include <media/stagefright/MediaDebug.h>
@@ -67,8 +65,8 @@ static void addBatteryData(uint32_t params) {
StagefrightRecorder::StagefrightRecorder()
- : mWriter(NULL), mWriterAux(NULL),
- mOutputFd(-1), mOutputFdAux(-1),
+ : mWriter(NULL),
+ mOutputFd(-1),
mAudioSource(AUDIO_SOURCE_CNT),
mVideoSource(VIDEO_SOURCE_LIST_END),
mStarted(false), mSurfaceMediaSource(NULL) {
@@ -259,24 +257,6 @@ status_t StagefrightRecorder::setOutputFile(int fd, int64_t offset, int64_t leng
return OK;
}
-status_t StagefrightRecorder::setOutputFileAuxiliary(int fd) {
- LOGV("setOutputFileAuxiliary: %d", fd);
-
- if (fd < 0) {
- LOGE("Invalid file descriptor: %d", fd);
- return -EBADF;
- }
-
- mCaptureAuxVideo = true;
-
- if (mOutputFdAux >= 0) {
- ::close(mOutputFdAux);
- }
- mOutputFdAux = dup(fd);
-
- return OK;
-}
-
// Attempt to parse an int64 literal optionally surrounded by whitespace,
// returns true on success, false otherwise.
static bool safe_strtoi64(const char *s, int64_t *val) {
@@ -573,42 +553,6 @@ status_t StagefrightRecorder::setParamTimeBetweenTimeLapseFrameCapture(int64_t t
return OK;
}
-status_t StagefrightRecorder::setParamAuxVideoWidth(int32_t width) {
- LOGV("setParamAuxVideoWidth : %d", width);
-
- if (width <= 0) {
- LOGE("Width (%d) is not positive", width);
- return BAD_VALUE;
- }
-
- mAuxVideoWidth = width;
- return OK;
-}
-
-status_t StagefrightRecorder::setParamAuxVideoHeight(int32_t height) {
- LOGV("setParamAuxVideoHeight : %d", height);
-
- if (height <= 0) {
- LOGE("Height (%d) is not positive", height);
- return BAD_VALUE;
- }
-
- mAuxVideoHeight = height;
- return OK;
-}
-
-status_t StagefrightRecorder::setParamAuxVideoEncodingBitRate(int32_t bitRate) {
- LOGV("StagefrightRecorder::setParamAuxVideoEncodingBitRate: %d", bitRate);
-
- if (bitRate <= 0) {
- LOGE("Invalid video encoding bit rate: %d", bitRate);
- return BAD_VALUE;
- }
-
- mAuxVideoBitRate = bitRate;
- return OK;
-}
-
status_t StagefrightRecorder::setParamGeoDataLongitude(
int32_t longitudex10000) {
@@ -738,21 +682,6 @@ status_t StagefrightRecorder::setParameter(
return setParamTimeBetweenTimeLapseFrameCapture(
1000LL * timeBetweenTimeLapseFrameCaptureMs);
}
- } else if (key == "video-aux-param-width") {
- int32_t auxWidth;
- if (safe_strtoi32(value.string(), &auxWidth)) {
- return setParamAuxVideoWidth(auxWidth);
- }
- } else if (key == "video-aux-param-height") {
- int32_t auxHeight;
- if (safe_strtoi32(value.string(), &auxHeight)) {
- return setParamAuxVideoHeight(auxHeight);
- }
- } else if (key == "video-aux-param-encoding-bitrate") {
- int32_t auxVideoBitRate;
- if (safe_strtoi32(value.string(), &auxVideoBitRate)) {
- return setParamAuxVideoEncodingBitRate(auxVideoBitRate);
- }
} else {
LOGE("setParameter: failed to find key %s", key.string());
}
@@ -1517,7 +1446,6 @@ status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) {
}
status_t StagefrightRecorder::setupMPEG4Recording(
- bool useSplitCameraSource,
int outputFd,
int32_t videoWidth, int32_t videoHeight,
int32_t videoBitRate,
@@ -1531,28 +1459,7 @@ status_t StagefrightRecorder::setupMPEG4Recording(
if (mVideoSource < VIDEO_SOURCE_LIST_END) {
sp<MediaSource> mediaSource;
- if (useSplitCameraSource) {
- // TODO: Check if there is a better way to handle this
- if (mVideoSource == VIDEO_SOURCE_GRALLOC_BUFFER) {
- LOGE("Cannot use split camera when encoding frames");
- return INVALID_OPERATION;
- }
- LOGV("Using Split camera source");
- mediaSource = mCameraSourceSplitter->createClient();
- } else {
- err = setupMediaSource(&mediaSource);
- }
-
- if ((videoWidth != mVideoWidth) || (videoHeight != mVideoHeight)) {
- // TODO: Might be able to handle downsampling even if using GRAlloc
- if (mVideoSource == VIDEO_SOURCE_GRALLOC_BUFFER) {
- LOGE("Cannot change size or Downsample when encoding frames");
- return INVALID_OPERATION;
- }
- // Use downsampling from the original source.
- mediaSource =
- new VideoSourceDownSampler(mediaSource, videoWidth, videoHeight);
- }
+ err = setupMediaSource(&mediaSource);
if (err != OK) {
return err;
}
@@ -1620,24 +1527,8 @@ void StagefrightRecorder::setupMPEG4MetaData(int64_t startTimeUs, int32_t totalB
}
status_t StagefrightRecorder::startMPEG4Recording() {
- if (mCaptureAuxVideo) {
- if (!mCaptureTimeLapse) {
- LOGE("Auxiliary video can be captured only in time lapse mode");
- return UNKNOWN_ERROR;
- }
- LOGV("Creating MediaSourceSplitter");
- sp<CameraSource> cameraSource;
- status_t err = setupCameraSource(&cameraSource);
- if (err != OK) {
- return err;
- }
- mCameraSourceSplitter = new MediaSourceSplitter(cameraSource);
- } else {
- mCameraSourceSplitter = NULL;
- }
-
int32_t totalBitRate;
- status_t err = setupMPEG4Recording(mCaptureAuxVideo,
+ status_t err = setupMPEG4Recording(
mOutputFd, mVideoWidth, mVideoHeight,
mVideoBitRate, &totalBitRate, &mWriter);
if (err != OK) {
@@ -1653,33 +1544,6 @@ status_t StagefrightRecorder::startMPEG4Recording() {
return err;
}
- if (mCaptureAuxVideo) {
- CHECK(mOutputFdAux >= 0);
- if (mWriterAux != NULL) {
- LOGE("Auxiliary File writer is not avaialble");
- return UNKNOWN_ERROR;
- }
- if ((mAuxVideoWidth > mVideoWidth) || (mAuxVideoHeight > mVideoHeight) ||
- ((mAuxVideoWidth == mVideoWidth) && mAuxVideoHeight == mVideoHeight)) {
- LOGE("Auxiliary video size (%d x %d) same or larger than the main video size (%d x %d)",
- mAuxVideoWidth, mAuxVideoHeight, mVideoWidth, mVideoHeight);
- return UNKNOWN_ERROR;
- }
-
- int32_t totalBitrateAux;
- err = setupMPEG4Recording(mCaptureAuxVideo,
- mOutputFdAux, mAuxVideoWidth, mAuxVideoHeight,
- mAuxVideoBitRate, &totalBitrateAux, &mWriterAux);
- if (err != OK) {
- return err;
- }
-
- sp<MetaData> metaAux = new MetaData;
- setupMPEG4MetaData(startTimeUs, totalBitrateAux, &metaAux);
-
- return mWriterAux->start(metaAux.get());
- }
-
return OK;
}
@@ -1690,13 +1554,6 @@ status_t StagefrightRecorder::pause() {
}
mWriter->pause();
- if (mCaptureAuxVideo) {
- if (mWriterAux == NULL) {
- return UNKNOWN_ERROR;
- }
- mWriterAux->pause();
- }
-
if (mStarted) {
mStarted = false;
@@ -1724,13 +1581,6 @@ status_t StagefrightRecorder::stop() {
mCameraSourceTimeLapse = NULL;
}
- if (mCaptureAuxVideo) {
- if (mWriterAux != NULL) {
- mWriterAux->stop();
- mWriterAux.clear();
- }
- }
-
if (mWriter != NULL) {
err = mWriter->stop();
mWriter.clear();
@@ -1741,13 +1591,6 @@ status_t StagefrightRecorder::stop() {
mOutputFd = -1;
}
- if (mCaptureAuxVideo) {
- if (mOutputFdAux >= 0) {
- ::close(mOutputFdAux);
- mOutputFdAux = -1;
- }
- }
-
if (mStarted) {
mStarted = false;
@@ -1787,11 +1630,8 @@ status_t StagefrightRecorder::reset() {
mVideoEncoder = VIDEO_ENCODER_H263;
mVideoWidth = 176;
mVideoHeight = 144;
- mAuxVideoWidth = 176;
- mAuxVideoHeight = 144;
mFrameRate = -1;
mVideoBitRate = 192000;
- mAuxVideoBitRate = 192000;
mSampleRate = 8000;
mAudioChannels = 1;
mAudioBitRate = 12200;
@@ -1811,8 +1651,6 @@ status_t StagefrightRecorder::reset() {
mTrackEveryTimeDurationUs = 0;
mCaptureTimeLapse = false;
mTimeBetweenTimeLapseFrameCaptureUs = -1;
- mCaptureAuxVideo = false;
- mCameraSourceSplitter = NULL;
mCameraSourceTimeLapse = NULL;
mIsMetaDataStoredInVideoBuffers = false;
mEncoderProfiles = MediaProfiles::getInstance();
@@ -1821,7 +1659,6 @@ status_t StagefrightRecorder::reset() {
mLongitudex10000 = -3600000;
mOutputFd = -1;
- mOutputFdAux = -1;
return OK;
}
@@ -1858,8 +1695,6 @@ status_t StagefrightRecorder::dump(
snprintf(buffer, SIZE, " Recorder: %p\n", this);
snprintf(buffer, SIZE, " Output file (fd %d):\n", mOutputFd);
result.append(buffer);
- snprintf(buffer, SIZE, " Output file Auxiliary (fd %d):\n", mOutputFdAux);
- result.append(buffer);
snprintf(buffer, SIZE, " File format: %d\n", mOutputFormat);
result.append(buffer);
snprintf(buffer, SIZE, " Max file size (bytes): %lld\n", mMaxFileSizeBytes);
@@ -1904,14 +1739,10 @@ status_t StagefrightRecorder::dump(
result.append(buffer);
snprintf(buffer, SIZE, " Frame size (pixels): %dx%d\n", mVideoWidth, mVideoHeight);
result.append(buffer);
- snprintf(buffer, SIZE, " Aux Frame size (pixels): %dx%d\n", mAuxVideoWidth, mAuxVideoHeight);
- result.append(buffer);
snprintf(buffer, SIZE, " Frame rate (fps): %d\n", mFrameRate);
result.append(buffer);
snprintf(buffer, SIZE, " Bit rate (bps): %d\n", mVideoBitRate);
result.append(buffer);
- snprintf(buffer, SIZE, " Aux Bit rate (bps): %d\n", mAuxVideoBitRate);
- result.append(buffer);
::write(fd, result.string(), result.size());
return OK;
}
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 1618b92..5c5f05c 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -30,7 +30,6 @@ class Camera;
class ICameraRecordingProxy;
class CameraSource;
class CameraSourceTimeLapse;
-class MediaSourceSplitter;
struct MediaSource;
struct MediaWriter;
class MetaData;
@@ -55,7 +54,6 @@ struct StagefrightRecorder : public MediaRecorderBase {
virtual status_t setPreviewSurface(const sp<Surface>& surface);
virtual status_t setOutputFile(const char *path);
virtual status_t setOutputFile(int fd, int64_t offset, int64_t length);
- virtual status_t setOutputFileAuxiliary(int fd);
virtual status_t setParameters(const String8& params);
virtual status_t setListener(const sp<IMediaRecorderClient>& listener);
virtual status_t prepare();
@@ -74,8 +72,8 @@ private:
sp<ICameraRecordingProxy> mCameraProxy;
sp<Surface> mPreviewSurface;
sp<IMediaRecorderClient> mListener;
- sp<MediaWriter> mWriter, mWriterAux;
- int mOutputFd, mOutputFdAux;
+ sp<MediaWriter> mWriter;
+ int mOutputFd;
sp<AudioSource> mAudioSourceNode;
audio_source_t mAudioSource;
@@ -85,9 +83,8 @@ private:
video_encoder mVideoEncoder;
bool mUse64BitFileOffset;
int32_t mVideoWidth, mVideoHeight;
- int32_t mAuxVideoWidth, mAuxVideoHeight;
int32_t mFrameRate;
- int32_t mVideoBitRate, mAuxVideoBitRate;
+ int32_t mVideoBitRate;
int32_t mAudioBitRate;
int32_t mAudioChannels;
int32_t mSampleRate;
@@ -109,8 +106,6 @@ private:
bool mCaptureTimeLapse;
int64_t mTimeBetweenTimeLapseFrameCaptureUs;
- bool mCaptureAuxVideo;
- sp<MediaSourceSplitter> mCameraSourceSplitter;
sp<CameraSourceTimeLapse> mCameraSourceTimeLapse;
@@ -127,7 +122,6 @@ private:
sp<SurfaceMediaSource> mSurfaceMediaSource;
status_t setupMPEG4Recording(
- bool useSplitCameraSource,
int outputFd,
int32_t videoWidth, int32_t videoHeight,
int32_t videoBitRate,
@@ -166,9 +160,6 @@ private:
status_t setParamAudioTimeScale(int32_t timeScale);
status_t setParamTimeLapseEnable(int32_t timeLapseEnable);
status_t setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs);
- status_t setParamAuxVideoHeight(int32_t height);
- status_t setParamAuxVideoWidth(int32_t width);
- status_t setParamAuxVideoEncodingBitRate(int32_t bitRate);
status_t setParamVideoEncodingBitRate(int32_t bitRate);
status_t setParamVideoIFramesInterval(int32_t seconds);
status_t setParamVideoEncoderProfile(int32_t profile);