• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MEDIA_RECORDER_BASE_H_
18 
19 #define MEDIA_RECORDER_BASE_H_
20 
21 #include <media/AudioSystem.h>
22 #include <media/mediarecorder.h>
23 #include <android/content/AttributionSourceState.h>
24 
25 #include <system/audio.h>
26 
27 #include <vector>
28 
29 namespace android {
30 
31 class ICameraRecordingProxy;
32 class IGraphicBufferProducer;
33 struct PersistentSurface;
34 
35 struct MediaRecorderBase {
MediaRecorderBaseMediaRecorderBase36     explicit MediaRecorderBase(const android::content::AttributionSourceState &attributionSource)
37         : mAttributionSource(attributionSource) {}
~MediaRecorderBaseMediaRecorderBase38     virtual ~MediaRecorderBase() {}
39 
40     virtual status_t init() = 0;
41     virtual status_t setAudioSource(audio_source_t as) = 0;
42     virtual status_t setPrivacySensitive(bool privacySensitive) = 0 ;
43     virtual status_t isPrivacySensitive(bool *privacySensitive) const = 0;
44     virtual status_t setVideoSource(video_source vs) = 0;
45     virtual status_t setOutputFormat(output_format of) = 0;
46     virtual status_t setAudioEncoder(audio_encoder ae) = 0;
47     virtual status_t setVideoEncoder(video_encoder ve) = 0;
48     virtual status_t setVideoSize(int width, int height) = 0;
49     virtual status_t setVideoFrameRate(int frames_per_second) = 0;
50     virtual status_t setCamera(const sp<hardware::ICamera>& camera,
51                                const sp<ICameraRecordingProxy>& proxy) = 0;
52     virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface) = 0;
53     virtual status_t setOutputFile(int fd) = 0;
setNextOutputFileMediaRecorderBase54     virtual status_t setNextOutputFile(int /*fd*/) {return INVALID_OPERATION;}
setOutputFileAuxiliaryMediaRecorderBase55     virtual status_t setOutputFileAuxiliary(int /*fd*/) {return INVALID_OPERATION;}
56     virtual status_t setParameters(const String8& params) = 0;
57     virtual status_t setListener(const sp<IMediaRecorderClient>& listener) = 0;
58     virtual status_t setClientName(const String16& clientName) = 0;
59     virtual status_t prepare() = 0;
60     virtual status_t start() = 0;
61     virtual status_t stop() = 0;
62     virtual status_t pause() = 0;
63     virtual status_t resume() = 0;
64     virtual status_t close() = 0;
65     virtual status_t reset() = 0;
66     virtual status_t getMaxAmplitude(int *max) = 0;
67     virtual status_t getMetrics(Parcel *reply) = 0;
68     virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
69     virtual status_t setInputSurface(const sp<PersistentSurface>& surface) = 0;
70     virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const = 0;
71     virtual status_t setInputDevice(audio_port_handle_t deviceId) = 0;
72     virtual status_t getRoutedDeviceId(audio_port_handle_t* deviceId) = 0;
73     virtual void setAudioDeviceCallback(const sp<AudioSystem::AudioDeviceCallback>& callback) = 0;
74     virtual status_t enableAudioDeviceCallback(bool enabled) = 0;
75     virtual status_t getActiveMicrophones(
76                         std::vector<media::MicrophoneInfoFw>* activeMicrophones) = 0;
77     virtual status_t setPreferredMicrophoneDirection(audio_microphone_direction_t direction) = 0;
78     virtual status_t setPreferredMicrophoneFieldDimension(float zoom) = 0;
79     virtual status_t getPortId(audio_port_handle_t *portId) const = 0;
80     virtual status_t getRtpDataUsage(uint64_t *bytes) = 0;
81 
82 
83 
84 protected:
85 
86     android::content::AttributionSourceState mAttributionSource;
87 
88 private:
89     MediaRecorderBase(const MediaRecorderBase &);
90     MediaRecorderBase &operator=(const MediaRecorderBase &);
91 };
92 
93 }  // namespace android
94 
95 #endif  // MEDIA_RECORDER_BASE_H_
96