120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber/*
220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Copyright (C) 2009 The Android Open Source Project
320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * you may not use this file except in compliance with the License.
620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * You may obtain a copy of the License at
720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber *
1020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * Unless required by applicable law or agreed to in writing, software
1120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
1220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * See the License for the specific language governing permissions and
1420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber * limitations under the License.
1520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber */
1620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#ifndef CAMERA_SOURCE_H_
1820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#define CAMERA_SOURCE_H_
2020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
2120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <media/stagefright/MediaBuffer.h>
2220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <media/stagefright/MediaSource.h>
2354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong#include <camera/ICamera.h>
244ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li#include <camera/ICameraRecordingProxyListener.h>
2554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong#include <camera/CameraParameters.h>
2620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <utils/List.h>
2720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <utils/RefBase.h>
28ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala#include <utils/String16.h>
2920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
3020111aa043c5f404472bc63b90bc5aad906b1101Andreas Hubernamespace android {
3120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
3220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberclass IMemory;
33be5c74f5da6a93b0d23f96e11848acfcc3b4d1d9Andreas Huberclass Camera;
3454ff19ac69ace7c05ea90d225e26dab3b133f487James Dongclass Surface;
3520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
367278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dongclass CameraSource : public MediaSource, public MediaBufferObserver {
3720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberpublic:
3854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    /**
3954ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * Factory method to create a new CameraSource using the current
4054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * settings (such as video size, frame rate, color format, etc)
4154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * from the default camera.
4254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *
43ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     * @param clientName The package/process name of the client application.
44ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     *    This is used for permissions checking.
4554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @return NULL on error.
4654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     */
47ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala    static CameraSource *Create(const String16 &clientName);
4854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
4954ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    /**
5054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * Factory method to create a new CameraSource.
5154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *
5254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @param camera the video input frame data source. If it is NULL,
5354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *          we will try to connect to the camera with the given
5454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *          cameraId.
5554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *
5654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @param cameraId the id of the camera that the source will connect
5754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *          to if camera is NULL; otherwise ignored.
58ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     * @param clientName the package/process name of the camera-using
59ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     *          application if camera is NULL; otherwise ignored. Used for
60ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     *          permissions checking.
61ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     * @param clientUid the UID of the camera-using application if camera is
62ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala     *          NULL; otherwise ignored. Used for permissions checking.
6354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @param videoSize the dimension (in pixels) of the video frame
6454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @param frameRate the target frames per second
6554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @param surface the preview surface for display where preview
6654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *          frames are sent to
675c9523154d106b555db6c41f85ab205a4f189b02James Dong     * @param storeMetaDataInVideoBuffers true to request the camera
685c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          source to store meta data in video buffers; false to
695c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          request the camera source to store real YUV frame data
705c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          in the video buffers. The camera source may not support
715c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          storing meta data in video buffers, if so, a request
725c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          to do that will NOT be honored. To find out whether
735c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          meta data is actually being stored in video buffers
745c9523154d106b555db6c41f85ab205a4f189b02James Dong     *          during recording, call isMetaDataStoredInVideoBuffers().
7554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     *
7654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @return NULL on error.
7754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     */
7854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    static CameraSource *CreateFromCamera(const sp<ICamera> &camera,
794ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li                                          const sp<ICameraRecordingProxy> &proxy,
8054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                                          int32_t cameraId,
81ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                                          const String16& clientName,
82ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                                          uid_t clientUid,
8354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                                          Size videoSize,
8454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                                          int32_t frameRate,
8599617adda9bc46c43f511f0940bc735c73de61deMathias Agopian                                          const sp<IGraphicBufferProducer>& surface,
865c9523154d106b555db6c41f85ab205a4f189b02James Dong                                          bool storeMetaDataInVideoBuffers = false);
8720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
8820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    virtual ~CameraSource();
8920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
9020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    virtual status_t start(MetaData *params = NULL);
91b44c9d2bdc0d5b9cb03254022a58e017b516e9e6James Dong    virtual status_t stop() { return reset(); }
925c9523154d106b555db6c41f85ab205a4f189b02James Dong    virtual status_t read(
935c9523154d106b555db6c41f85ab205a4f189b02James Dong            MediaBuffer **buffer, const ReadOptions *options = NULL);
9420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
9554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    /**
9654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * Check whether a CameraSource object is properly initialized.
9754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * Must call this method before stop().
9854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * @return OK if initialization has successfully completed.
9954ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     */
10054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    virtual status_t initCheck() const;
10154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
10254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    /**
10354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * Returns the MetaData associated with the CameraSource,
10454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * including:
10554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * kKeyColorFormat: YUV color format of the video frames
10654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * kKeyWidth, kKeyHeight: dimension (in pixels) of the video frames
10754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     * kKeySampleRate: frame rate in frames per second
1082b37ced30f89437c804c3945b901019b86d210aeJames Dong     * kKeyMIMEType: always fixed to be MEDIA_MIMETYPE_VIDEO_RAW
10954ff19ac69ace7c05ea90d225e26dab3b133f487James Dong     */
11020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    virtual sp<MetaData> getFormat();
11120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1125c9523154d106b555db6c41f85ab205a4f189b02James Dong    /**
1135c9523154d106b555db6c41f85ab205a4f189b02James Dong     * Tell whether this camera source stores meta data or real YUV
1145c9523154d106b555db6c41f85ab205a4f189b02James Dong     * frame data in video buffers.
1155c9523154d106b555db6c41f85ab205a4f189b02James Dong     *
1165c9523154d106b555db6c41f85ab205a4f189b02James Dong     * @return true if meta data is stored in the video
1175c9523154d106b555db6c41f85ab205a4f189b02James Dong     *      buffers; false if real YUV data is stored in
1185c9523154d106b555db6c41f85ab205a4f189b02James Dong     *      the video buffers.
1195c9523154d106b555db6c41f85ab205a4f189b02James Dong     */
1205c9523154d106b555db6c41f85ab205a4f189b02James Dong    bool isMetaDataStoredInVideoBuffers() const;
12120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
1227278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dong    virtual void signalBufferReturned(MediaBuffer* buffer);
1237278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dong
12465e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatraprotected:
1254ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    class ProxyListener: public BnCameraRecordingProxyListener {
1264ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    public:
1274ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li        ProxyListener(const sp<CameraSource>& source);
1284ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li        virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
1294ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li                const sp<IMemory> &data);
1304ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li
1314ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    private:
1324ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li        sp<CameraSource> mSource;
1334ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    };
1344ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li
1354ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    // isBinderAlive needs linkToDeath to work.
1364ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    class DeathNotifier: public IBinder::DeathRecipient {
1374ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    public:
1384ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li        DeathNotifier() {}
1394ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li        virtual void binderDied(const wp<IBinder>& who);
1404ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    };
1414ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li
14254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    enum CameraFlags {
14354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong        FLAGS_SET_CAMERA = 1L << 0,
14454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong        FLAGS_HOT_CAMERA = 1L << 1,
14554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    };
14654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
14754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    int32_t  mCameraFlags;
14854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    Size     mVideoSize;
149983cf231ab2d176a14595cdae46ff1b0c239af47James Dong    int32_t  mNumInputBuffers;
15054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    int32_t  mVideoFrameRate;
15154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    int32_t  mColorFormat;
15254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    status_t mInitCheck;
15354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
15454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    sp<Camera>   mCamera;
1554ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    sp<ICameraRecordingProxy>   mCameraRecordingProxy;
1564ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    sp<DeathNotifier> mDeathNotifier;
15799617adda9bc46c43f511f0940bc735c73de61deMathias Agopian    sp<IGraphicBufferProducer>  mSurface;
158653252be963c07c99109d20f942d1f30c52a9360James Dong    sp<MetaData> mMeta;
15920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
16065e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    int64_t mStartTimeUs;
16165e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    int32_t mNumFramesReceived;
16265e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    int64_t mLastFrameTimestampUs;
16365e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    bool mStarted;
1647757f5010a771fb8824b6fdf9788f588a1577e3fJames Dong    int32_t mNumFramesEncoded;
16565e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
166e8e5f86e9e310b065596c8cbbca1543eb833dee1James Dong    // Time between capture of two frames.
167e8e5f86e9e310b065596c8cbbca1543eb833dee1James Dong    int64_t mTimeBetweenFrameCaptureUs;
168e8e5f86e9e310b065596c8cbbca1543eb833dee1James Dong
1694ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    CameraSource(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy,
170ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                 int32_t cameraId, const String16& clientName, uid_t clientUid,
17154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                 Size videoSize, int32_t frameRate,
17299617adda9bc46c43f511f0940bc735c73de61deMathias Agopian                 const sp<IGraphicBufferProducer>& surface,
1735c9523154d106b555db6c41f85ab205a4f189b02James Dong                 bool storeMetaDataInVideoBuffers);
17465e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
17526cee964ab4e0a2bd6ae9ad199ba78ea9634421cRuben Brunk    virtual status_t startCameraRecording();
17665e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    virtual void releaseRecordingFrame(const sp<IMemory>& frame);
17765e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
17865e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    // Returns true if need to skip the current frame.
17965e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    // Called from dataCallbackTimestamp.
18065e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    virtual bool skipCurrentFrame(int64_t timestampUs) {return false;}
18165e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
18265e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    // Callback called when still camera raw data is available.
18365e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    virtual void dataCallback(int32_t msgType, const sp<IMemory> &data) {}
18465e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
18565e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
18665e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra            const sp<IMemory> &data);
18765e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
1889bb976e1c78048081cf9df4d8a1db67311413e5bRobert Shih    void releaseCamera();
1899bb976e1c78048081cf9df4d8a1db67311413e5bRobert Shih
19065e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatraprivate:
19165e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra    friend class CameraSourceListener;
19265e7e6facda89927cb26594b3b65ae81b3235ebcNipun Kwatra
19320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    Mutex mLock;
19420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    Condition mFrameAvailableCondition;
1957278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dong    Condition mFrameCompleteCondition;
1967278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dong    List<sp<IMemory> > mFramesReceived;
1977278cf32f1aa6a322f6dff1f8b7dacf7b6dddba6James Dong    List<sp<IMemory> > mFramesBeingEncoded;
198be5c74f5da6a93b0d23f96e11848acfcc3b4d1d9Andreas Huber    List<int64_t> mFrameTimes;
19920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
200be5c74f5da6a93b0d23f96e11848acfcc3b4d1d9Andreas Huber    int64_t mFirstFrameTimeUs;
20113aec890216948b0c364f8f92792129d0335f506James Dong    int32_t mNumFramesDropped;
202f60cafe0e6aad8f9ce54660fa88b651ae4e749e6James Dong    int32_t mNumGlitches;
203f60cafe0e6aad8f9ce54660fa88b651ae4e749e6James Dong    int64_t mGlitchDurationThresholdUs;
204365a963142093a1cd8efdcea76b5f65096a5b115James Dong    bool mCollectStats;
2055c9523154d106b555db6c41f85ab205a4f189b02James Dong    bool mIsMetaDataStoredInVideoBuffers;
206c32cd79d9ad4aba7d959b5b3be7361b4715e6f18James Dong
207c32cd79d9ad4aba7d959b5b3be7361b4715e6f18James Dong    void releaseQueuedFrames();
208f60cafe0e6aad8f9ce54660fa88b651ae4e749e6James Dong    void releaseOneRecordingFrame(const sp<IMemory>& frame);
209be5c74f5da6a93b0d23f96e11848acfcc3b4d1d9Andreas Huber
21054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
2114ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    status_t init(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy,
212ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                  int32_t cameraId, const String16& clientName, uid_t clientUid,
213ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                  Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers);
214ae4c1ac6401185539c03ce0819e174fd1b04b136James Dong
215ae4c1ac6401185539c03ce0819e174fd1b04b136James Dong    status_t initWithCameraAccess(
216ae4c1ac6401185539c03ce0819e174fd1b04b136James Dong                  const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy,
217ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                  int32_t cameraId, const String16& clientName, uid_t clientUid,
218ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                  Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers);
219ae4c1ac6401185539c03ce0819e174fd1b04b136James Dong
2204ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li    status_t isCameraAvailable(const sp<ICamera>& camera,
2214ca2c7c913f8bd4ada13aca56d36045d42d1e00fWu-cheng Li                               const sp<ICameraRecordingProxy>& proxy,
222ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                               int32_t cameraId,
223ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                               const String16& clientName,
224ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala                               uid_t clientUid);
225ceb388d6c03c38b96dc41c0ea4804b749aa077c4Eino-Ville Talvala
22654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    status_t isCameraColorFormatSupported(const CameraParameters& params);
22754ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    status_t configureCamera(CameraParameters* params,
22854ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                    int32_t width, int32_t height,
22954ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                    int32_t frameRate);
23054ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
23154ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    status_t checkVideoSize(const CameraParameters& params,
23254ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                    int32_t width, int32_t height);
23354ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
23454ff19ac69ace7c05ea90d225e26dab3b133f487James Dong    status_t checkFrameRate(const CameraParameters& params,
23554ff19ac69ace7c05ea90d225e26dab3b133f487James Dong                    int32_t frameRate);
23654ff19ac69ace7c05ea90d225e26dab3b133f487James Dong
237b44c9d2bdc0d5b9cb03254022a58e017b516e9e6James Dong    void stopCameraRecording();
238b44c9d2bdc0d5b9cb03254022a58e017b516e9e6James Dong    status_t reset();
239ea7b485595f8cec6a66668b5c54c8f297d843f77James Dong
24020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    CameraSource(const CameraSource &);
24120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    CameraSource &operator=(const CameraSource &);
24220111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber};
24320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
24420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber}  // namespace android
24520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
24620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#endif  // CAMERA_SOURCE_H_
247