1 // Copyright 2016 Samsung Electronics Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAPTURE_VIDEO_TIZEN_CAMERA_DEVICE_TIZEN_H_
6 #define MEDIA_CAPTURE_VIDEO_TIZEN_CAMERA_DEVICE_TIZEN_H_
12 #include "base/memory/singleton.h"
13 #include "media/base/video_types.h"
14 #include "media/mojo/interfaces/image_capture.mojom.h"
15 #include "ui/gfx/gpu_memory_buffer.h"
19 struct VideoCaptureFormat;
20 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
22 struct CameraCapability {
23 typedef gfx::Size Resolution;
26 CameraCapability() : fps(0) {}
28 CameraCapability(gfx::Size frame, int rate) : resolution(frame), fps(rate) {}
30 Resolution resolution;
39 class PhotoCapabilities {
41 bool IsRedEyeReductionOn();
42 mojom::MeteringMode GetWhiteBalanceMode() {
43 return mojom::MeteringMode::NONE;
45 mojom::MeteringMode GetExposureMode() { return mojom::MeteringMode::NONE; }
46 mojom::MeteringMode GetFocusMode() { return mojom::MeteringMode::NONE; }
47 mojom::RangePtr GetColorTemperature() { return mojom::Range::New(); }
48 mojom::RangePtr GetExposureCompensation();
49 mojom::RangePtr GetIso();
50 mojom::RangePtr GetBrightness();
51 mojom::RangePtr GetContrast();
52 mojom::RangePtr GetSaturation() { return mojom::Range::New(); }
53 mojom::RangePtr GetSharpness() { return mojom::Range::New(); }
54 mojom::RangePtr GetImageHeight();
55 mojom::RangePtr GetImageWidth();
56 mojom::RangePtr GetZoom();
59 PhotoCapabilities(camera_h camera) : camera_(camera) {}
62 Range exposureCompensation_;
67 friend class CameraHandle;
70 class CameraHandleClient {
72 virtual void OnStreamStopped() {}
75 virtual ~CameraHandleClient() {}
78 class CameraHandle final {
80 static CameraHandle* GetInstance();
82 camera_h GetCameraHandle() { return camera_handle_; };
83 camera_device_e GetDeviceName() { return device_name_; };
86 bool GetSupportedPreviewResolutions(
87 std::vector<CameraCapability::Resolution>& supported_resolutions) const;
88 bool GetSupportedPreviewPixelFormats(
89 std::vector<media::VideoPixelFormat>& supported_formats) const;
90 bool GetSupportedPreviewCapabilities(std::vector<CameraCapability>&) const;
91 void GetDeviceSupportedFormats(media::VideoCaptureFormats& supported_formats);
92 int GetMaxFrameRate(CameraCapability::Resolution) const;
93 int GetDeviceCounts();
94 void ResetHandle(camera_device_e device_name);
95 void SetClient(CameraHandleClient* client);
96 void UnsetClient(CameraHandleClient* client);
98 // Set Photo Capabilities
99 bool SetZoom(int value);
100 bool SetResolution(int width, int height);
101 bool SetBrightness(int value);
102 bool SetContrast(int value);
103 bool SetIso(int value);
104 bool SetExposure(int value);
106 std::unique_ptr<PhotoCapabilities> capabilities_;
112 camera_h camera_handle_;
113 camera_device_e device_name_;
114 CameraHandleClient* client_;
116 friend struct base::DefaultSingletonTraits<CameraHandle>;
117 DISALLOW_COPY_AND_ASSIGN(CameraHandle);
122 #endif // MEDIA_CAPTURE_VIDEO_TIZEN_CAMERA_DEVICE_TIZEN_H_