1 /*
2  * Copyright (C) 2011 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 HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H
18 #define HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H
19 
20 /*
21  * Contains declaration of a class EmulatedQemuCamera that encapsulates
22  * functionality of an emulated camera connected to the host.
23  */
24 
25 #include "EmulatedCamera.h"
26 #include "EmulatedQemuCameraDevice.h"
27 #include <ui/GraphicBufferMapper.h>
28 
29 namespace android {
30 
31 /* Encapsulates functionality of an emulated camera connected to the host.
32  */
33 class EmulatedQemuCamera : public EmulatedCamera {
34 public:
35     /* Constructs EmulatedQemuCamera instance. */
36     EmulatedQemuCamera(int cameraId, struct hw_module_t* module,
37                        GraphicBufferMapper* gbm);
38 
39     /* Destructs EmulatedQemuCamera instance. */
40     ~EmulatedQemuCamera();
41 
42     /***************************************************************************
43      * EmulatedCamera virtual overrides.
44      **************************************************************************/
45 
46 public:
47     /* Initializes EmulatedQemuCamera instance. */
48      status_t Initialize(const char* device_name,
49                          const char* frame_dims,
50                          const char* facing_dir);
51 
52     /***************************************************************************
53      * EmulatedCamera abstract API implementation.
54      **************************************************************************/
55 
56 protected:
57     /* Gets emulated camera device ised by this instance of the emulated camera.
58      */
59     EmulatedCameraDevice* getCameraDevice();
60 
61     /***************************************************************************
62      * Data memebers.
63      **************************************************************************/
64 
65 protected:
66     /* Contained qemu camera device object. */
67     EmulatedQemuCameraDevice    mQemuCameraDevice;
68 
69     /* Supported frame dimensions reported by the camera device. */
70     String8                     mFrameDims;
71 
72 private:
73     using EmulatedCamera::Initialize;
74 };
75 
76 }; /* namespace android */
77 
78 #endif  /* HW_EMULATOR_CAMERA_EMULATED_QEMU_CAMERA_H */
79