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;
29e2a2dfcbf0c9d6bb7139263ecf0d8e53b4ca1049Chong Zhangclass IGraphicBufferConsumer;
308ba01021b573889802e67e029225a96f0dfa471aAndy McFaddenclass IGraphicBufferProducer;
3130ab66297501757d745b9ae10da61adcd891f497Andreas Huber
3230ab66297501757d745b9ae10da61adcd891f497Andreas Huberstruct MediaRecorderBase {
33be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganov    MediaRecorderBase(const String16 &opPackageName)
34be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganov        : mOpPackageName(opPackageName) {}
3530ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual ~MediaRecorderBase() {}
3630ab66297501757d745b9ae10da61adcd891f497Andreas Huber
3730ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t init() = 0;
38fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t setAudioSource(audio_source_t as) = 0;
3930ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoSource(video_source vs) = 0;
4030ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setOutputFormat(output_format of) = 0;
4130ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setAudioEncoder(audio_encoder ae) = 0;
4230ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoEncoder(video_encoder ve) = 0;
4330ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoSize(int width, int height) = 0;
4430ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setVideoFrameRate(int frames_per_second) = 0;
45d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    virtual status_t setCamera(const sp<hardware::ICamera>& camera,
464ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li                               const sp<ICameraRecordingProxy>& proxy) = 0;
4799617adda9bc46c43f511f0940bc735c73de61deMathias Agopian    virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface) = 0;
4830ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 0;
495d6aca5d86e86af3f8f597be573d4563d69ceb85Nipun Kwatra    virtual status_t setOutputFileAuxiliary(int fd) {return INVALID_OPERATION;}
5030ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t setParameters(const String8& params) = 0;
5137047fceba836f341d0108beed0991b0f8dfc543James Dong    virtual status_t setListener(const sp<IMediaRecorderClient>& listener) = 0;
52ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala    virtual status_t setClientName(const String16& clientName) = 0;
5330ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t prepare() = 0;
5430ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t start() = 0;
5530ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t stop() = 0;
56d008275796ac4cccf85fefce53cef733a49bc1faWonsik Kim    virtual status_t pause() = 0;
57d008275796ac4cccf85fefce53cef733a49bc1faWonsik Kim    virtual status_t resume() = 0;
5830ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t close() = 0;
5930ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t reset() = 0;
6030ab66297501757d745b9ae10da61adcd891f497Andreas Huber    virtual status_t getMaxAmplitude(int *max) = 0;
61b914122eb9cb54bbeae4ec03bfebb194aecdccbdJames Dong    virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
628f469e18c307cb9dc0d16ed9225972aa8be4516fChong Zhang    virtual status_t setInputSurface(const sp<IGraphicBufferConsumer>& surface) = 0;
638ba01021b573889802e67e029225a96f0dfa471aAndy McFadden    virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const = 0;
6430ab66297501757d745b9ae10da61adcd891f497Andreas Huber
65be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganov
66be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganovprotected:
67be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganov    String16 mOpPackageName;
68be71aa29a3c86d2e01cd17839d2a72ab09a1bce5Svet Ganov
6930ab66297501757d745b9ae10da61adcd891f497Andreas Huberprivate:
7030ab66297501757d745b9ae10da61adcd891f497Andreas Huber    MediaRecorderBase(const MediaRecorderBase &);
7130ab66297501757d745b9ae10da61adcd891f497Andreas Huber    MediaRecorderBase &operator=(const MediaRecorderBase &);
7230ab66297501757d745b9ae10da61adcd891f497Andreas Huber};
7330ab66297501757d745b9ae10da61adcd891f497Andreas Huber
7430ab66297501757d745b9ae10da61adcd891f497Andreas Huber}  // namespace android
7530ab66297501757d745b9ae10da61adcd891f497Andreas Huber
7630ab66297501757d745b9ae10da61adcd891f497Andreas Huber#endif  // MEDIA_RECORDER_BASE_H_
77