Merge lp:~phablet-team/qtubuntu-camera/query-supported-flash-modes into lp:qtubuntu-camera/staging

Proposed by Florian Boucault
Status: Merged
Approved by: Florian Boucault
Approved revision: 136
Merged at revision: 153
Proposed branch: lp:~phablet-team/qtubuntu-camera/query-supported-flash-modes
Merge into: lp:qtubuntu-camera/staging
Diff against target: 134 lines (+32/-16)
5 files modified
debian/control (+1/-1)
src/aalcameraflashcontrol.cpp (+15/-14)
src/aalcameraflashcontrol.h (+3/-1)
unittests/mocks/aal/camera_compatibility_layer.cpp (+11/-0)
unittests/mocks/aal/camera_compatibility_layer_capabilities.h (+2/-0)
To merge this branch: bzr merge lp:~phablet-team/qtubuntu-camera/query-supported-flash-modes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Florian Boucault Pending
Review via email: mp+278616@code.launchpad.net

This proposal supersedes a proposal from 2015-01-14.

Commit message

Query the supported flash modes directly from Android instead of hardcoding them.

Note that this requires support in hybris (branch here: https://code-review.phablet.ubuntu.com/#/c/356/ )

Description of the change

Query the supported flash modes directly from Android instead of hardcoding them.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote : Posted in a previous version of this proposal

New hybris already available in vivid.

Revision history for this message
Florian Boucault (fboucault) wrote : Posted in a previous version of this proposal

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-08-28 13:50:23 +0000
3+++ debian/control 2015-11-25 16:56:43 +0000
4@@ -5,7 +5,7 @@
5 Build-Depends: debhelper (>= 9),
6 libgl1-mesa-dev | libgl-dev,
7 libgles2-mesa-dev,
8- libhybris-dev (>= 0.1.0+git20131207+e452e83-0ubuntu34),
9+ libhybris-dev (>= 0.1.0+git20131207+e452e83-0ubuntu36),
10 libpulse-dev,
11 libqt5opengl5-dev,
12 libqtubuntu-media-signals-dev (>=0.3+15.04.20150618.1-0ubuntu1),
13
14=== modified file 'src/aalcameraflashcontrol.cpp'
15--- src/aalcameraflashcontrol.cpp 2013-08-06 15:18:53 +0000
16+++ src/aalcameraflashcontrol.cpp 2015-11-25 16:56:43 +0000
17@@ -64,7 +64,7 @@
18
19 void AalCameraFlashControl::init(CameraControl *control)
20 {
21- querySupportedFlashModes();
22+ querySupportedFlashModes(control);
23
24 if (setOnInit) {
25 FlashMode mode = qt2Android(m_currentMode);
26@@ -94,31 +94,32 @@
27 QCameraExposure::FlashModes AalCameraFlashControl::android2Qt(FlashMode mode)
28 {
29 switch(mode) {
30- case FLASH_MODE_OFF:
31- return QCameraExposure::FlashOff;
32 case FLASH_MODE_ON:
33 return QCameraExposure::FlashOn;
34 case FLASH_MODE_TORCH:
35 return QCameraExposure::FlashTorch;
36 case FLASH_MODE_AUTO:
37- default:
38 return QCameraExposure::FlashAuto;
39+ case FLASH_MODE_OFF:
40+ default:
41+ return QCameraExposure::FlashOff;
42 }
43 }
44
45 /*!
46 * \brief AalCameraFlashControl::querySupportedFlashModes gets the supported
47 * flash modes for the current camera
48- * FIXME get the supported modes from libhybris
49 */
50-void AalCameraFlashControl::querySupportedFlashModes()
51+void AalCameraFlashControl::querySupportedFlashModes(CameraControl *control)
52 {
53 m_supportedModes.clear();
54- if (m_service->isBackCameraUsed()) {
55- m_supportedModes << QCameraExposure::FlashOff << QCameraExposure::FlashOn
56- << QCameraExposure::FlashAuto << QCameraExposure::FlashVideoLight
57- << QCameraExposure::FlashTorch;
58- } else {
59- m_supportedModes << QCameraExposure::FlashOff;
60- }
61-}
62+
63+ android_camera_enumerate_supported_flash_modes(control, &AalCameraFlashControl::supportedFlashModesCallback, this);
64+}
65+
66+void AalCameraFlashControl::supportedFlashModesCallback(void *context, FlashMode flashMode)
67+{
68+ AalCameraFlashControl *self = (AalCameraFlashControl*)context;
69+ self->m_supportedModes << self->android2Qt(flashMode);
70+}
71+
72
73=== modified file 'src/aalcameraflashcontrol.h'
74--- src/aalcameraflashcontrol.h 2013-08-06 15:18:53 +0000
75+++ src/aalcameraflashcontrol.h 2015-11-25 16:56:43 +0000
76@@ -37,13 +37,15 @@
77 bool isFlashReady() const;
78 void setFlashMode(QCameraExposure::FlashModes mode);
79
80+ static void supportedFlashModesCallback(void *context, FlashMode flashMode);
81+
82 public Q_SLOTS:
83 void init(CameraControl *control);
84
85 private:
86 FlashMode qt2Android(QCameraExposure::FlashModes mode);
87 QCameraExposure::FlashModes android2Qt(FlashMode mode);
88- void querySupportedFlashModes();
89+ void querySupportedFlashModes(CameraControl *control);
90
91 AalCameraService *m_service;
92 QCameraExposure::FlashModes m_currentMode;
93
94=== modified file 'unittests/mocks/aal/camera_compatibility_layer.cpp'
95--- unittests/mocks/aal/camera_compatibility_layer.cpp 2015-04-08 12:57:01 +0000
96+++ unittests/mocks/aal/camera_compatibility_layer.cpp 2015-11-25 16:56:43 +0000
97@@ -103,6 +103,17 @@
98 cb(ctx, SCENE_MODE_ACTION);
99 }
100
101+void android_camera_enumerate_supported_flash_modes(CameraControl* control, flash_mode_callback cb, void* ctx)
102+{
103+ Q_UNUSED(cb);
104+ Q_UNUSED(ctx);
105+ crashTest(control);
106+ cb(ctx, FLASH_MODE_ON);
107+ cb(ctx, FLASH_MODE_AUTO);
108+ cb(ctx, FLASH_MODE_TORCH);
109+ cb(ctx, FLASH_MODE_OFF);
110+}
111+
112 void android_camera_set_scene_mode(CameraControl* control, SceneMode mode)
113 {
114 Q_UNUSED(mode);
115
116=== modified file 'unittests/mocks/aal/camera_compatibility_layer_capabilities.h'
117--- unittests/mocks/aal/camera_compatibility_layer_capabilities.h 2014-11-24 10:58:09 +0000
118+++ unittests/mocks/aal/camera_compatibility_layer_capabilities.h 2015-11-25 16:56:43 +0000
119@@ -97,6 +97,7 @@
120
121 typedef void (*size_callback)(void* ctx, int width, int height);
122 typedef void (*scene_mode_callback)(void* ctx, SceneMode mode);
123+typedef void (*flash_mode_callback)(void* ctx, FlashMode mode);
124
125 // Dumps the camera parameters to stdout.
126 void android_camera_dump_parameters(CameraControl* control);
127@@ -116,6 +117,7 @@
128
129 void android_camera_get_effect_mode(CameraControl* control, EffectMode* mode);
130 void android_camera_get_flash_mode(CameraControl* control, FlashMode* mode);
131+void android_camera_enumerate_supported_flash_modes(CameraControl* control, flash_mode_callback cb, void* ctx);
132 void android_camera_get_white_balance_mode(CameraControl* control, WhiteBalanceMode* mode);
133 void android_camera_enumerate_supported_scene_modes(CameraControl* control, scene_mode_callback cb, void* ctx);
134 void android_camera_get_scene_mode(CameraControl* control, SceneMode* mode);

Subscribers

People subscribed via source and target branches

to all changes: