130ab66297501757d745b9ae10da61adcd891f497Andreas Huber/*
230ab66297501757d745b9ae10da61adcd891f497Andreas Huber * Copyright (C) 2009 The Android Open Source Project
330ab66297501757d745b9ae10da61adcd891f497Andreas Huber *
430ab66297501757d745b9ae10da61adcd891f497Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
530ab66297501757d745b9ae10da61adcd891f497Andreas Huber * you may not use this file except in compliance with the License.
630ab66297501757d745b9ae10da61adcd891f497Andreas Huber * You may obtain a copy of the License at
730ab66297501757d745b9ae10da61adcd891f497Andreas Huber *
830ab66297501757d745b9ae10da61adcd891f497Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
930ab66297501757d745b9ae10da61adcd891f497Andreas Huber *
1030ab66297501757d745b9ae10da61adcd891f497Andreas Huber * Unless required by applicable law or agreed to in writing, software
1130ab66297501757d745b9ae10da61adcd891f497Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
1230ab66297501757d745b9ae10da61adcd891f497Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1330ab66297501757d745b9ae10da61adcd891f497Andreas Huber * See the License for the specific language governing permissions and
1430ab66297501757d745b9ae10da61adcd891f497Andreas Huber * limitations under the License.
1530ab66297501757d745b9ae10da61adcd891f497Andreas Huber */
1630ab66297501757d745b9ae10da61adcd891f497Andreas Huber
1730ab66297501757d745b9ae10da61adcd891f497Andreas Huber#ifndef MEDIA_RECORDER_BASE_H_
1830ab66297501757d745b9ae10da61adcd891f497Andreas Huber
1930ab66297501757d745b9ae10da61adcd891f497Andreas Huber#define MEDIA_RECORDER_BASE_H_
2030ab66297501757d745b9ae10da61adcd891f497Andreas Huber
2130ab66297501757d745b9ae10da61adcd891f497Andreas Huber#include <media/mediarecorder.h>
2230ab66297501757d745b9ae10da61adcd891f497Andreas Huber
2364760240f931714858a59c1579f07264d7182ba2Dima Zavin#include <system/audio.h>
24fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin
2530ab66297501757d745b9ae10da61adcd891f497Andreas Hubernamespace android {
2630ab66297501757d745b9ae10da61adcd891f497Andreas Huber
274ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Liclass ICameraRecordingProxy;
284b79168835965cf0fc41ebe2a367e22b4cb20d08Jamie Gennisclass Surface;
298ba01021b573889802e67e029225a96f0dfa471aAndy McFaddenclass IGraphicBufferProducer;
3030ab66297501757d745b9ae10da61adcd891f497Andreas Huber
3130ab66297501757d745b9ae10da61adcd891f497Andreas Huberstruct MediaRecorderBase {
3230ab66297501757d745b9ae10da61adcd891f497Andreas Huber    MediaRecorderBase() {}
3330ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual ~MediaRecorderBase() {}
3430ab66297501757d745b9ae10da61adcd891f497Andreas Huber
3530ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t init() = 0;
36fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t setAudioSource(audio_source_t as) = 0;
3730ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoSource(video_source vs) = 0;
3830ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setOutputFormat(output_format of) = 0;
3930ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setAudioEncoder(audio_encoder ae) = 0;
4030ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoEncoder(video_encoder ve) = 0;
4130ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoSize(int width, int height) = 0;
4230ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoFrameRate(int frames_per_second) = 0;
434ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    virtual status_t setCamera(const sp<ICamera>& camera,
444ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li                               const sp<ICameraRecordingProxy>& proxy) = 0;
4599617adda9bc46c43f511f0940bc735c73de61deMathias Agopian    virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface) = 0;
4630ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setOutputFile(const char *path) = 0;
4730ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 0;
485d6aca5d86e86af3f8f597be573d4563d69ceb85Nipun Kwatra    virtual status_t setOutputFileAuxiliary(int fd) {return INVALID_OPERATION;}
4930ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setParameters(const String8& params) = 0;
5037047fceba836f341d0108beed0991b0f8dfc543James Dong    virtual status_t setListener(const sp<IMediaRecorderClient>& listener) = 0;
51ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala    virtual status_t setClientName(const String16& clientName) = 0;
5230ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t prepare() = 0;
5330ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t start() = 0;
5430ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t stop() = 0;
5530ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t close() = 0;
5630ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t reset() = 0;
5730ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t getMaxAmplitude(int *max) = 0;
58b914122eb9cb54bbeae4ec03bfebb194aecdccbdJames Dong    virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
598ba01021b573889802e67e029225a96f0dfa471aAndy McFadden    virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const = 0;
6030ab66297501757d745b9ae10da61adcd891f497Andreas Huber
6130ab66297501757d745b9ae10da61adcd891f497Andreas Huberprivate:
6230ab66297501757d745b9ae10da61adcd891f497Andreas Huber    MediaRecorderBase(const MediaRecorderBase &);
6330ab66297501757d745b9ae10da61adcd891f497Andreas Huber    MediaRecorderBase &operator=(const MediaRecorderBase &);
6430ab66297501757d745b9ae10da61adcd891f497Andreas Huber};
6530ab66297501757d745b9ae10da61adcd891f497Andreas Huber
6630ab66297501757d745b9ae10da61adcd891f497Andreas Huber}  // namespace android
6730ab66297501757d745b9ae10da61adcd891f497Andreas Huber
6830ab66297501757d745b9ae10da61adcd891f497Andreas Huber#endif  // MEDIA_RECORDER_BASE_H_
69