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_IMEDIARECORDER_H
19 #define ANDROID_IMEDIARECORDER_H
20 
21 #include <binder/IInterface.h>
22 #include <media/MicrophoneInfo.h>
23 #include <system/audio.h>
24 #include <vector>
25 
26 namespace android {
27 
28 class Surface;
29 namespace hardware {
30 class ICamera;
31 }
32 class ICameraRecordingProxy;
33 class IMediaRecorderClient;
34 class IGraphicBufferProducer;
35 struct PersistentSurface;
36 
37 class IMediaRecorder: public IInterface
38 {
39 public:
40     DECLARE_META_INTERFACE(MediaRecorder);
41 
42     virtual status_t setCamera(const sp<hardware::ICamera>& camera,
43                                const sp<ICameraRecordingProxy>& proxy) = 0;
44     virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface) = 0;
45     virtual status_t setVideoSource(int vs) = 0;
46     virtual status_t setAudioSource(int as) = 0;
47     virtual status_t setOutputFormat(int of) = 0;
48     virtual status_t setVideoEncoder(int ve) = 0;
49     virtual status_t setAudioEncoder(int ae) = 0;
50     virtual status_t setOutputFile(int fd) = 0;
51     virtual status_t setNextOutputFile(int fd) = 0;
52     virtual status_t setVideoSize(int width, int height) = 0;
53     virtual status_t setVideoFrameRate(int frames_per_second) = 0;
54     virtual status_t setParameters(const String8& params) = 0;
55     virtual status_t setListener(const sp<IMediaRecorderClient>& listener) = 0;
56     virtual status_t setClientName(const String16& clientName) = 0;
57     virtual status_t prepare() = 0;
58     virtual status_t getMaxAmplitude(int* max) = 0;
59     virtual status_t getMetrics(Parcel *reply) = 0;
60     virtual status_t start() = 0;
61     virtual status_t stop() = 0;
62     virtual status_t reset() = 0;
63     virtual status_t pause() = 0;
64     virtual status_t resume() = 0;
65     virtual status_t init() = 0;
66     virtual status_t close() = 0;
67     virtual status_t release() = 0;
68     virtual status_t setInputSurface(const sp<PersistentSurface>& surface) = 0;
69     virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() = 0;
70 
71     virtual status_t setInputDevice(audio_port_handle_t deviceId) = 0;
72     virtual status_t getRoutedDeviceId(audio_port_handle_t *deviceId) = 0;
73     virtual status_t enableAudioDeviceCallback(bool enabled) = 0;
74     virtual status_t getActiveMicrophones(
75                         std::vector<media::MicrophoneInfo>* activeMicrophones) = 0;
76     virtual status_t setPreferredMicrophoneDirection(audio_microphone_direction_t direction) = 0;
77     virtual status_t setPreferredMicrophoneFieldDimension(float zoom) = 0;
78     virtual status_t getPortId(audio_port_handle_t *portId) = 0;
79 };
80 
81 // ----------------------------------------------------------------------------
82 
83 class BnMediaRecorder: public BnInterface<IMediaRecorder>
84 {
85 public:
86     virtual status_t    onTransact( uint32_t code,
87                                     const Parcel& data,
88                                     Parcel* reply,
89                                     uint32_t flags = 0);
90 };
91 
92 }; // namespace android
93 
94 #endif // ANDROID_IMEDIARECORDER_H
95