diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:33 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:33 -0800 |
commit | 99ffda877980468a9ae31e013cd10fb3645df1b0 (patch) | |
tree | dbcbf90028d4e60763724ca1bac4a63af7170973 /include/media/mediarecorder.h | |
parent | 925a349b45d1d16eaaca6a1f4827191831271ca0 (diff) | |
download | frameworks_av-99ffda877980468a9ae31e013cd10fb3645df1b0.zip frameworks_av-99ffda877980468a9ae31e013cd10fb3645df1b0.tar.gz frameworks_av-99ffda877980468a9ae31e013cd10fb3645df1b0.tar.bz2 |
auto import from //depot/cupcake/@137055
Diffstat (limited to 'include/media/mediarecorder.h')
-rw-r--r-- | include/media/mediarecorder.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index 436e8f1..8991f08 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -19,6 +19,7 @@ #define ANDROID_MEDIARECORDER_H #include <utils.h> +#include <media/IMediaPlayerClient.h> namespace android { @@ -87,7 +88,24 @@ enum media_recorder_states { MEDIA_RECORDER_RECORDING = 1 << 4, }; -class MediaRecorder +// The "msg" code passed to the listener in notify. +enum { + MEDIA_RECORDER_EVENT_ERROR = 1 +}; + +enum { + MEDIA_RECORDER_ERROR_UNKNOWN = 1 +}; + +// ---------------------------------------------------------------------------- +// ref-counted object for callbacks +class MediaRecorderListener: virtual public RefBase +{ +public: + virtual void notify(int msg, int ext1, int ext2) = 0; +}; + +class MediaRecorder : public BnMediaPlayerClient { public: MediaRecorder(); @@ -105,6 +123,7 @@ public: status_t setOutputFile(int fd, int64_t offset, int64_t length); status_t setVideoSize(int width, int height); status_t setVideoFrameRate(int frames_per_second); + status_t setListener(const sp<MediaRecorderListener>& listener); status_t prepare(); status_t getMaxAmplitude(int* max); status_t start(); @@ -113,18 +132,22 @@ public: status_t init(); status_t close(); status_t release(); + void notify(int msg, int ext1, int ext2); private: void doCleanUp(); status_t doReset(); - sp<IMediaRecorder> mMediaRecorder; - media_recorder_states mCurrentState; - bool mIsAudioSourceSet; - bool mIsVideoSourceSet; - bool mIsAudioEncoderSet; - bool mIsVideoEncoderSet; - bool mIsOutputFileSet; + sp<IMediaRecorder> mMediaRecorder; + sp<MediaRecorderListener> mListener; + media_recorder_states mCurrentState; + bool mIsAudioSourceSet; + bool mIsVideoSourceSet; + bool mIsAudioEncoderSet; + bool mIsVideoEncoderSet; + bool mIsOutputFileSet; + Mutex mLock; + Mutex mNotifyLock; }; }; // namespace android |