From ad04d9201452001dbaac4349f084cc9316190b89 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 3 Mar 2009 14:04:24 -0800 Subject: auto import from //depot/cupcake/@132589 --- media/libmedia/mediarecorder.cpp | 75 ---------------------------------------- 1 file changed, 75 deletions(-) (limited to 'media/libmedia/mediarecorder.cpp') diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp index 98aac39..4ab26ac 100644 --- a/media/libmedia/mediarecorder.cpp +++ b/media/libmedia/mediarecorder.cpp @@ -58,10 +58,6 @@ status_t MediaRecorder::setPreviewSurface(const sp& surface) LOGE("setPreviewSurface called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } - if (!mIsVideoSourceSet) { - LOGE("try to set preview surface without setting the video source first"); - return INVALID_OPERATION; - } status_t ret = mMediaRecorder->setPreviewSurface(surface->getISurface()); if (OK != ret) { @@ -90,14 +86,6 @@ status_t MediaRecorder::init() mCurrentState = MEDIA_RECORDER_ERROR; return UNKNOWN_ERROR; } - - ret = mMediaRecorder->setListener(this); - if (OK != ret) { - LOGV("setListener failed: %d", ret); - mCurrentState = MEDIA_RECORDER_ERROR; - return UNKNOWN_ERROR; - } - mCurrentState = MEDIA_RECORDER_INITIALIZED; return ret; } @@ -179,10 +167,6 @@ status_t MediaRecorder::setOutputFormat(int of) LOGE("setOutputFormat called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } - if (mIsVideoSourceSet && of >= OUTPUT_FORMAT_RAW_AMR) { - LOGE("output format (%d) is meant for audio recording only and incompatible with video recording", of); - return INVALID_OPERATION; - } status_t ret = mMediaRecorder->setOutputFormat(of); if (OK != ret) { @@ -201,10 +185,6 @@ status_t MediaRecorder::setVideoEncoder(int ve) LOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } - if (!mIsVideoSourceSet) { - LOGE("try to set the video encoder without setting the video source first"); - return INVALID_OPERATION; - } if (mIsVideoEncoderSet) { LOGE("video encoder has already been set"); return INVALID_OPERATION; @@ -231,10 +211,6 @@ status_t MediaRecorder::setAudioEncoder(int ae) LOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } - if (!mIsAudioSourceSet) { - LOGE("try to set the audio encoder without setting the audio source first"); - return INVALID_OPERATION; - } if (mIsAudioEncoderSet) { LOGE("audio encoder has already been set"); return INVALID_OPERATION; @@ -317,10 +293,6 @@ status_t MediaRecorder::setVideoSize(int width, int height) LOGE("setVideoSize called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } - if (!mIsVideoSourceSet) { - LOGE("try to set video size without setting video source first"); - return INVALID_OPERATION; - } status_t ret = mMediaRecorder->setVideoSize(width, height); if (OK != ret) { @@ -342,10 +314,6 @@ status_t MediaRecorder::setVideoFrameRate(int frames_per_second) LOGE("setVideoFrameRate called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } - if (!mIsVideoSourceSet) { - LOGE("try to set video frame rate without setting video source first"); - return INVALID_OPERATION; - } status_t ret = mMediaRecorder->setVideoFrameRate(frames_per_second); if (OK != ret) { @@ -367,23 +335,6 @@ status_t MediaRecorder::prepare() LOGE("prepare called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } - if (mIsAudioSourceSet != mIsAudioEncoderSet) { - if (mIsAudioSourceSet) { - LOGE("audio source is set, but audio encoder is not set"); - } else { // must not happen, since setAudioEncoder checks this already - LOGE("audio encoder is set, but audio source is not set"); - } - return INVALID_OPERATION; - } - - if (mIsVideoSourceSet != mIsVideoEncoderSet) { - if (mIsVideoSourceSet) { - LOGE("video source is set, but video encoder is not set"); - } else { // must not happen, since setVideoEncoder checks this already - LOGE("video encoder is set, but video source is not set"); - } - return INVALID_OPERATION; - } status_t ret = mMediaRecorder->prepare(); if (OK != ret) { @@ -587,31 +538,5 @@ MediaRecorder::~MediaRecorder() } } -status_t MediaRecorder::setListener(const sp& listener) -{ - LOGV("setListener"); - Mutex::Autolock _l(mLock); - mListener = listener; - - return NO_ERROR; -} - -void MediaRecorder::notify(int msg, int ext1, int ext2) -{ - LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2); - - sp listener; - mLock.lock(); - listener = mListener; - mLock.unlock(); - - if (listener != NULL) { - Mutex::Autolock _l(mNotifyLock); - LOGV("callback application"); - listener->notify(msg, ext1, ext2); - LOGV("back from callback"); - } -} - }; // namespace android -- cgit v1.1