MediaRecorderClient.h revision fe44e4f74fe2582cbf012687059278dbcbdaa6f7
1/* 2 ** 3 ** Copyright 2008, The Android Open Source Project 4 ** 5 ** Licensed under the Apache License, Version 2.0 (the "License"); 6 ** you may not use this file except in compliance with the License. 7 ** You may obtain a copy of the License at 8 ** 9 ** http://www.apache.org/licenses/LICENSE-2.0 10 ** 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 */ 17 18#ifndef ANDROID_MEDIARECORDERCLIENT_H 19#define ANDROID_MEDIARECORDERCLIENT_H 20 21#include <media/IMediaRecorder.h> 22 23namespace android { 24 25struct MediaRecorderBase; 26class MediaPlayerService; 27class ICameraRecordingProxy; 28 29class MediaRecorderClient : public BnMediaRecorder 30{ 31 class ServiceDeathNotifier: public IBinder::DeathRecipient 32 { 33 public: 34 ServiceDeathNotifier( 35 const sp<IBinder>& service, 36 const sp<IMediaRecorderClient>& listener, 37 int which); 38 virtual ~ServiceDeathNotifier(); 39 virtual void binderDied(const wp<IBinder>& who); 40 41 private: 42 int mWhich; 43 sp<IBinder> mService; 44 wp<IMediaRecorderClient> mListener; 45 }; 46 47public: 48 virtual status_t setCamera(const sp<hardware::ICamera>& camera, 49 const sp<ICameraRecordingProxy>& proxy); 50 virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface); 51 virtual status_t setVideoSource(int vs); 52 virtual status_t setAudioSource(int as); 53 virtual status_t setOutputFormat(int of); 54 virtual status_t setVideoEncoder(int ve); 55 virtual status_t setAudioEncoder(int ae); 56 virtual status_t setOutputFile(int fd); 57 virtual status_t setNextOutputFile(int fd); 58 virtual status_t setVideoSize(int width, int height); 59 virtual status_t setVideoFrameRate(int frames_per_second); 60 virtual status_t setParameters(const String8& params); 61 virtual status_t setListener( 62 const sp<IMediaRecorderClient>& listener); 63 virtual status_t setClientName(const String16& clientName); 64 virtual status_t prepare(); 65 virtual status_t getMaxAmplitude(int* max); 66 virtual status_t start(); 67 virtual status_t stop(); 68 virtual status_t reset(); 69 virtual status_t pause(); 70 virtual status_t resume(); 71 virtual status_t init(); 72 virtual status_t close(); 73 virtual status_t release(); 74 virtual status_t dump(int fd, const Vector<String16>& args); 75 virtual status_t setInputSurface(const sp<PersistentSurface>& surface); 76 virtual sp<IGraphicBufferProducer> querySurfaceMediaSource(); 77 78private: 79 friend class MediaPlayerService; // for accessing private constructor 80 81 MediaRecorderClient( 82 const sp<MediaPlayerService>& service, 83 pid_t pid, 84 const String16& opPackageName); 85 virtual ~MediaRecorderClient(); 86 87 sp<IBinder::DeathRecipient> mCameraDeathListener; 88 sp<IBinder::DeathRecipient> mCodecDeathListener; 89 90 pid_t mPid; 91 Mutex mLock; 92 MediaRecorderBase *mRecorder; 93 sp<MediaPlayerService> mMediaPlayerService; 94}; 95 96}; // namespace android 97 98#endif // ANDROID_MEDIARECORDERCLIENT_H 99