Home | History | Annotate | Download | only in libmediaplayerservice
      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 
     23 namespace android {
     24 
     25 class MediaRecorderBase;
     26 class MediaPlayerService;
     27 class ICameraRecordingProxy;
     28 class IGraphicBufferProducer;
     29 
     30 class MediaRecorderClient : public BnMediaRecorder
     31 {
     32 public:
     33     virtual     status_t   setCamera(const sp<ICamera>& camera,
     34                                     const sp<ICameraRecordingProxy>& proxy);
     35     virtual     status_t   setPreviewSurface(const sp<IGraphicBufferProducer>& surface);
     36     virtual     status_t   setVideoSource(int vs);
     37     virtual     status_t   setAudioSource(int as);
     38     virtual     status_t   setOutputFormat(int of);
     39     virtual     status_t   setVideoEncoder(int ve);
     40     virtual     status_t   setAudioEncoder(int ae);
     41     virtual     status_t   setOutputFile(const char* path);
     42     virtual     status_t   setOutputFile(int fd, int64_t offset,
     43                                                   int64_t length);
     44     virtual     status_t   setVideoSize(int width, int height);
     45     virtual     status_t   setVideoFrameRate(int frames_per_second);
     46     virtual     status_t   setParameters(const String8& params);
     47     virtual     status_t   setListener(
     48                               const sp<IMediaRecorderClient>& listener);
     49     virtual     status_t   setClientName(const String16& clientName);
     50     virtual     status_t   prepare();
     51     virtual     status_t   getMaxAmplitude(int* max);
     52     virtual     status_t   start();
     53     virtual     status_t   stop();
     54     virtual     status_t   reset();
     55     virtual     status_t   init();
     56     virtual     status_t   close();
     57     virtual     status_t   release();
     58     virtual     status_t   dump(int fd, const Vector<String16>& args) const;
     59     virtual     sp<IGraphicBufferProducer> querySurfaceMediaSource();
     60 
     61 private:
     62     friend class           MediaPlayerService;  // for accessing private constructor
     63 
     64                            MediaRecorderClient(
     65                                    const sp<MediaPlayerService>& service,
     66                                                                pid_t pid);
     67     virtual                ~MediaRecorderClient();
     68 
     69     pid_t                  mPid;
     70     Mutex                  mLock;
     71     MediaRecorderBase      *mRecorder;
     72     sp<MediaPlayerService> mMediaPlayerService;
     73 };
     74 
     75 }; // namespace android
     76 
     77 #endif // ANDROID_MEDIARECORDERCLIENT_H
     78